@bifrostui/react 1.4.4-beta.0 → 1.4.5-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/es/Tabs/Tab.js CHANGED
@@ -35,8 +35,11 @@ import React from "react";
35
35
  import TabsContext from "./TabsContext";
36
36
  import "./Tab.css";
37
37
  const prefixCls = "bui-tab";
38
+ const defaultProps = {
39
+ disabled: false
40
+ };
38
41
  const Tab = /* @__PURE__ */ React.forwardRef((props, ref) => {
39
- const _a = props, { className, children, index, disabled, onClick } = _a, others = __objRest(_a, ["className", "children", "index", "disabled", "onClick"]);
42
+ const _a = __spreadValues(__spreadValues({}, defaultProps), props), { className, children, index, disabled, onClick } = _a, others = __objRest(_a, ["className", "children", "index", "disabled", "onClick"]);
40
43
  const tabsContext = React.useContext(TabsContext);
41
44
  const { value, align, triggerChange } = tabsContext;
42
45
  return /* @__PURE__ */ React.createElement(
@@ -74,9 +77,6 @@ const Tab = /* @__PURE__ */ React.forwardRef((props, ref) => {
74
77
  );
75
78
  });
76
79
  Tab.displayName = "BuiTab";
77
- Tab.defaultProps = {
78
- disabled: false
79
- };
80
80
  var Tab_default = Tab;
81
81
  export {
82
82
  Tab_default as default
package/es/Tabs/Tabs.css CHANGED
@@ -1,20 +1,25 @@
1
1
  .bui-tabs {
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));
2
+ --bui-tabs-height: 39px;
3
+ --bui-tabs-color: var(--bui-color-fg-subtle);
4
+ --bui-tabs-active-color: var(--bui-color-fg-default);
5
+ --bui-tabs-line-color: var(--bui-color-primary);
6
+ --bui-tabs-line-height: 3px;
7
+ --bui-tabs-line-width: 18px;
8
+ --bui-tabs-line-border-radius: 3px;
9
+ --bui-tabs-line-bottom: 0;
10
+ --bui-tabs-line-box-shadow: none;
11
+ --bui-tabs-mask-width: 12px;
12
+ --bui-tabs-mask-height: 100%;
13
+ --bui-tab-height: 100%;
14
+ --bui-tab-padding: var(--bui-spacing-lg) var(--bui-spacing-lg) 10px;
15
+ --bui-tab-font-size: var(--bui-text-size-1);
16
+ --bui-tab-active-font-size: var(--bui-text-size-1);
17
+ --bui-tabs-active-font-weight: var(--bui-font-weight-medium);
13
18
  position: relative;
14
19
  font-family: var(--bui-font-family);
15
20
  }
16
21
  .bui-tabs-tabs {
17
- height: var(--height);
22
+ height: var(--bui-tabs-height);
18
23
  display: flex;
19
24
  flex-wrap: nowrap;
20
25
  justify-content: flex-start;
@@ -28,12 +33,13 @@
28
33
  }
29
34
  .bui-tabs-tabline {
30
35
  position: absolute;
31
- width: var(--line-width);
32
- bottom: 0;
33
- height: var(--line-height);
36
+ width: var(--bui-tabs-line-width);
37
+ bottom: var(--bui-tabs-line-bottom);
38
+ height: var(--bui-tabs-line-height);
34
39
  color: var(--bui-color-primary);
35
- background: var(--line-color);
36
- border-radius: var(--bui-shape-radius-label);
40
+ background: var(--bui-tabs-line-color);
41
+ border-radius: var(--bui-tabs-line-border-radius);
42
+ box-shadow: var(--bui-tabs-line-box-shadow);
37
43
  }
38
44
  .bui-tabs-content {
39
45
  padding: var(--bui-spacing-lg);
@@ -43,8 +49,8 @@
43
49
  top: 0;
44
50
  bottom: 0;
45
51
  z-index: 1;
46
- width: var(--mask-width);
47
- height: var(--mask-height);
52
+ width: var(--bui-tabs-mask-width);
53
+ height: var(--bui-tabs-mask-height);
48
54
  pointer-events: none;
49
55
  }
50
56
  .bui-tabs-mask-left {
package/es/Tabs/Tabs.js CHANGED
@@ -45,14 +45,19 @@ 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
+ align: "center",
50
+ tabs: []
51
+ };
48
52
  const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
49
- const _a = props, { children, className, value, tabs, align, onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "align", "onChange"]);
53
+ const _a = __spreadValues(__spreadValues({}, defaultProps), props), { children, className, value, tabs, align, onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "align", "onChange"]);
50
54
  const [active, setActive] = useState("");
51
55
  const tabsRef = useRef(null);
52
56
  const activeLineRef = useRef(null);
53
57
  const [lineData, setLineData] = useState({
54
58
  x: 0,
55
- transitionInUse: false
59
+ transitionInUse: false,
60
+ hasActiveTab: false
56
61
  });
57
62
  const [maskData, setMaskData] = useState({
58
63
  leftMaskOpacity: 0,
@@ -95,7 +100,8 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
95
100
  }
96
101
  setLineData({
97
102
  x,
98
- transitionInUse
103
+ transitionInUse,
104
+ hasActiveTab: !!activeTab
99
105
  });
100
106
  const maxScrollDistance = containerScrollWidth - containerWidth;
101
107
  if (maxScrollDistance <= 0 || !activeTab)
@@ -109,25 +115,6 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
109
115
  tabsRef.current.scrollLeft = nextScrollLeft;
110
116
  }
111
117
  };
112
- useEffect(() => {
113
- setActive(value);
114
- }, [value]);
115
- useLayoutEffect(() => {
116
- animate({ transitionInUse: false });
117
- }, []);
118
- useEffect(() => {
119
- const handleResize = debounce(() => {
120
- animate({ transitionInUse: true });
121
- updateMask();
122
- }, 100);
123
- window.addEventListener("resize", handleResize);
124
- return () => {
125
- window.removeEventListener("resize", handleResize);
126
- };
127
- }, [active]);
128
- useDidMountEffect(() => {
129
- animate({ transitionInUse: true });
130
- }, [active, tabs, children]);
131
118
  const updateMask = useMemo(
132
119
  () => throttle(
133
120
  () => {
@@ -150,6 +137,25 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
150
137
  ),
151
138
  []
152
139
  );
140
+ useEffect(() => {
141
+ setActive(value);
142
+ }, [value]);
143
+ useLayoutEffect(() => {
144
+ animate({ transitionInUse: false });
145
+ }, []);
146
+ useEffect(() => {
147
+ const handleResize = debounce(() => {
148
+ animate({ transitionInUse: true });
149
+ updateMask();
150
+ }, 100);
151
+ window.addEventListener("resize", handleResize);
152
+ return () => {
153
+ window.removeEventListener("resize", handleResize);
154
+ };
155
+ }, [active]);
156
+ useDidMountEffect(() => {
157
+ animate({ transitionInUse: true });
158
+ }, [active, tabs, children]);
153
159
  useLayoutEffect(() => {
154
160
  updateMask();
155
161
  }, []);
@@ -191,10 +197,10 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
191
197
  {
192
198
  ref: activeLineRef,
193
199
  className: clsx(`${prefixCls}-tabline`, {
194
- "bui-tabline-invisible": isMini || !lineData.x
200
+ "bui-tabline-invisible": isMini || !lineData.hasActiveTab
195
201
  }),
196
202
  style: {
197
- transition: lineData.transitionInUse ? "transform 0.25s ease-in-out" : void 0,
203
+ transition: lineData.transitionInUse ? "transform 0.3s ease-in-out" : void 0,
198
204
  transform: `translate3d(${lineData.x}px, 0px, 0px)`
199
205
  }
200
206
  }
@@ -211,10 +217,6 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
211
217
  }), children)));
212
218
  });
213
219
  Tabs.displayName = "BuiTabs";
214
- Tabs.defaultProps = {
215
- align: "center",
216
- tabs: []
217
- };
218
220
  var Tabs_default = Tabs;
219
221
  export {
220
222
  Tabs_default as default
@@ -3,9 +3,6 @@ import React, { SyntheticEvent } from 'react';
3
3
  export interface TabHeaderItem {
4
4
  title: React.ReactNode;
5
5
  index: string;
6
- /**
7
- * 是否禁止点击
8
- */
9
6
  disabled?: boolean;
10
7
  }
11
8
  export interface ITabsChangeData {
@@ -14,11 +11,8 @@ export interface ITabsChangeData {
14
11
  }
15
12
  export type TabChangeEvent = (e?: SyntheticEvent, data?: ITabsChangeData) => void;
16
13
  export interface ITabItem {
17
- /** 面板标题 */
18
14
  title: React.ReactNode;
19
- /** 面板的索引值 */
20
15
  index: string;
21
- /** 面板是否禁用 */
22
16
  disabled?: boolean;
23
17
  }
24
18
  export type ITabAlign = 'start' | 'center';
package/es/Tag/Tag.css CHANGED
@@ -47,7 +47,7 @@
47
47
  border: 1px solid var(--bui-color-border-danger);
48
48
  }
49
49
  .bui-tag-outlined.bui-tag-vip {
50
- color: var(--bui-color-red);
50
+ color: var(--bui-color-primary);
51
51
  border: 1px solid var(--bui-color-border-primary);
52
52
  }
53
53
  .bui-tag-contained {
@@ -1,6 +1,6 @@
1
1
  .bui-tooltip {
2
2
  --arrow-size: var(--bui-tooltip-arrow-size, 8PX);
3
- --localtion-position: var(--bui-tooltip-localtion-position, 8PX);
3
+ --location-position: var(--bui-tooltip-location-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(--localtion-position);
20
+ left: var(--location-position);
21
21
  }
22
22
  .bui-tooltip .bui-tooltip-arrow.location-right {
23
- right: var(--localtion-position);
23
+ right: var(--location-position);
24
24
  }
25
25
  .bui-tooltip .bui-tooltip-arrow.location-top {
26
- top: var(--localtion-position);
26
+ top: var(--location-position);
27
27
  }
28
28
  .bui-tooltip .bui-tooltip-arrow.location-bottom {
29
- bottom: var(--localtion-position);
29
+ bottom: var(--location-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.4-beta.0",
3
+ "version": "1.4.5-beta.0",
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": "^1.2.1",
33
+ "clsx": "^2.1.1",
34
34
  "dayjs": "^1.11.7",
35
35
  "swiper": "^8.1.5",
36
- "@bifrostui/icons": "1.4.4-beta.0",
37
- "@bifrostui/styles": "1.4.4-beta.0",
38
- "@bifrostui/utils": "1.4.4-beta.0",
39
- "@bifrostui/types": "1.4.4-beta.0"
36
+ "@bifrostui/icons": "1.4.5-beta.0",
37
+ "@bifrostui/types": "1.4.5-beta.0",
38
+ "@bifrostui/utils": "1.4.5-beta.0",
39
+ "@bifrostui/styles": "1.4.5-beta.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tarojs/components": "^3.0.0",