@bifrostui/react 1.4.7 → 2.0.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.
Files changed (118) hide show
  1. package/dist/ActionSheet/ActionSheet.css +2 -2
  2. package/dist/ActionSheet/ActionSheetItem.js +3 -8
  3. package/dist/Avatar/Avatar.js +3 -8
  4. package/dist/Avatar/AvatarGroup.js +2 -6
  5. package/dist/Badge/Badge.js +3 -8
  6. package/dist/Button/Button.css +77 -78
  7. package/dist/Button/Button.d.ts +1 -1
  8. package/dist/Button/Button.js +4 -10
  9. package/dist/Button/Button.types.d.ts +8 -7
  10. package/dist/Calendar/Calendar.js +6 -14
  11. package/dist/Card/Card.css +1 -1
  12. package/dist/Card/CardContent.css +1 -2
  13. package/dist/Card/CardFooter.css +2 -4
  14. package/dist/Card/CardHeader.css +4 -5
  15. package/dist/Checkbox/Checkbox.js +2 -6
  16. package/dist/Checkbox/CheckboxGroup.js +4 -7
  17. package/dist/CollapsePanel/CollapsePanelItem.js +45 -46
  18. package/dist/Countdown/Countdown.js +5 -12
  19. package/dist/Divider/Divider.js +8 -5
  20. package/dist/Drawer/Drawer.js +4 -10
  21. package/dist/Fade/Fade.js +52 -56
  22. package/dist/IconButton/IconButton.js +5 -12
  23. package/dist/Image/Image.js +112 -119
  24. package/dist/Input/Input.js +4 -10
  25. package/dist/List/List.js +3 -8
  26. package/dist/List/ListItem.js +42 -44
  27. package/dist/List/ListItemContent.js +1 -4
  28. package/dist/List/ListItemExtra.js +9 -4
  29. package/dist/List/ListItemFooter.js +9 -4
  30. package/dist/List/ListItemHeader.js +9 -4
  31. package/dist/Loading/Loading.js +13 -4
  32. package/dist/Modal/Modal.js +0 -6
  33. package/dist/Modal/Modal.miniapp.d.ts +1 -1
  34. package/dist/Modal/Modal.miniapp.js +4 -10
  35. package/dist/NavBar/NavBar.js +0 -1
  36. package/dist/Popover/Popover.css +5 -5
  37. package/dist/Radio/Radio.css +0 -1
  38. package/dist/Radio/Radio.js +2 -6
  39. package/dist/Radio/RadioGroup.js +0 -3
  40. package/dist/Rating/Rating.js +8 -18
  41. package/dist/Select/Select.js +4 -8
  42. package/dist/Skeleton/Skeleton.js +5 -9
  43. package/dist/Slide/Slide.js +69 -74
  44. package/dist/Slider/Slider.js +6 -14
  45. package/dist/Steps/Step.js +81 -82
  46. package/dist/Steps/Steps.d.ts +1 -1
  47. package/dist/Steps/Steps.js +57 -60
  48. package/dist/Switch/Switch.js +75 -78
  49. package/dist/TabBar/TabBar.js +3 -8
  50. package/dist/Tabs/Tab.css +10 -16
  51. package/dist/Tabs/Tab.js +15 -7
  52. package/dist/Tabs/Tabs.css +13 -22
  53. package/dist/Tabs/Tabs.js +26 -42
  54. package/dist/Tabs/Tabs.types.d.ts +0 -10
  55. package/dist/Tag/Tag.css +1 -1
  56. package/dist/Tag/Tag.js +2 -6
  57. package/dist/TextArea/TextArea.js +5 -12
  58. package/dist/Tooltip/Tooltip.css +5 -5
  59. package/dist/Transition/TransitionCore.js +3 -8
  60. package/es/ActionSheet/ActionSheet.css +2 -2
  61. package/es/ActionSheet/ActionSheetItem.js +3 -8
  62. package/es/Avatar/Avatar.js +3 -8
  63. package/es/Avatar/AvatarGroup.js +2 -6
  64. package/es/Badge/Badge.js +3 -8
  65. package/es/Button/Button.css +77 -78
  66. package/es/Button/Button.d.ts +1 -1
  67. package/es/Button/Button.js +3 -9
  68. package/es/Button/Button.types.d.ts +8 -7
  69. package/es/Calendar/Calendar.js +6 -14
  70. package/es/Card/Card.css +1 -1
  71. package/es/Card/CardContent.css +1 -2
  72. package/es/Card/CardFooter.css +2 -4
  73. package/es/Card/CardHeader.css +4 -5
  74. package/es/Checkbox/Checkbox.js +2 -6
  75. package/es/Checkbox/CheckboxGroup.js +4 -7
  76. package/es/CollapsePanel/CollapsePanelItem.js +45 -46
  77. package/es/Countdown/Countdown.js +5 -12
  78. package/es/Divider/Divider.js +8 -5
  79. package/es/Drawer/Drawer.js +4 -10
  80. package/es/Fade/Fade.js +52 -56
  81. package/es/IconButton/IconButton.js +5 -12
  82. package/es/Image/Image.js +112 -119
  83. package/es/Input/Input.js +4 -10
  84. package/es/List/List.js +3 -8
  85. package/es/List/ListItem.js +42 -44
  86. package/es/List/ListItemContent.js +1 -4
  87. package/es/List/ListItemExtra.js +9 -4
  88. package/es/List/ListItemFooter.js +9 -4
  89. package/es/List/ListItemHeader.js +9 -4
  90. package/es/Loading/Loading.js +13 -4
  91. package/es/Modal/Modal.js +0 -6
  92. package/es/Modal/Modal.miniapp.js +4 -10
  93. package/es/NavBar/NavBar.js +0 -1
  94. package/es/Popover/Popover.css +5 -5
  95. package/es/Radio/Radio.css +0 -1
  96. package/es/Radio/Radio.js +2 -6
  97. package/es/Radio/RadioGroup.js +0 -3
  98. package/es/Rating/Rating.js +8 -18
  99. package/es/Select/Select.js +4 -8
  100. package/es/Skeleton/Skeleton.js +5 -9
  101. package/es/Slide/Slide.js +69 -74
  102. package/es/Slider/Slider.js +6 -14
  103. package/es/Steps/Step.js +81 -82
  104. package/es/Steps/Steps.d.ts +1 -1
  105. package/es/Steps/Steps.js +57 -60
  106. package/es/Switch/Switch.js +75 -78
  107. package/es/TabBar/TabBar.js +3 -8
  108. package/es/Tabs/Tab.css +10 -16
  109. package/es/Tabs/Tab.js +15 -7
  110. package/es/Tabs/Tabs.css +13 -22
  111. package/es/Tabs/Tabs.js +28 -55
  112. package/es/Tabs/Tabs.types.d.ts +0 -10
  113. package/es/Tag/Tag.css +1 -1
  114. package/es/Tag/Tag.js +2 -6
  115. package/es/TextArea/TextArea.js +5 -12
  116. package/es/Tooltip/Tooltip.css +5 -5
  117. package/es/Transition/TransitionCore.js +3 -8
  118. package/package.json +6 -6
package/es/Tabs/Tabs.js CHANGED
@@ -26,44 +26,31 @@ var __objRest = (source, exclude) => {
26
26
  }
27
27
  return target;
28
28
  };
29
- import {
30
- debounce,
31
- isMini,
32
- throttle,
33
- useDidMountEffect
34
- } from "@bifrostui/utils";
29
+ import { debounce, isMini, throttle, useEventCallback } from "@bifrostui/utils";
35
30
  import clsx from "clsx";
36
- import React, {
37
- useEffect,
38
- useLayoutEffect,
39
- useMemo,
40
- useRef,
41
- useState
42
- } from "react";
31
+ import React, { useEffect, useMemo, useRef, useState } from "react";
43
32
  import Tab from "./Tab";
44
33
  import { TabsContextProvider } from "./TabsContext";
45
34
  import bound from "./utils/bound";
46
35
  import "./Tabs.css";
47
36
  const prefixCls = "bui-tabs";
48
37
  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"]);
50
- const [active, setActive] = useState("");
38
+ const _a = props, { children, className, value, tabs = [], onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "onChange"]);
51
39
  const tabsRef = useRef(null);
52
40
  const activeLineRef = useRef(null);
53
- const [lineData, setLineData] = useState({
41
+ const [indicatorData, setIndicatorData] = useState({
54
42
  x: 0,
55
- transitionInUse: false,
56
43
  hasActiveTab: false
57
44
  });
58
45
  const [maskData, setMaskData] = useState({
59
46
  leftMaskOpacity: 0,
60
47
  rightMaskOpacity: 0
61
48
  });
62
- const animate = ({ transitionInUse }) => {
49
+ const animate = useEventCallback(() => {
63
50
  const container = tabsRef.current;
64
51
  if (!container)
65
52
  return;
66
- const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === active);
53
+ const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === value);
67
54
  const activeLine = activeLineRef.current;
68
55
  if (!activeLine)
69
56
  return;
@@ -94,9 +81,8 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
94
81
  activeLineWidth = activeLine.offsetWidth;
95
82
  x = activeTabLeft + (activeTabWidth - activeLineWidth) / 2;
96
83
  }
97
- setLineData({
84
+ setIndicatorData({
98
85
  x,
99
- transitionInUse,
100
86
  hasActiveTab: !!activeTab
101
87
  });
102
88
  const maxScrollDistance = containerScrollWidth - containerWidth;
@@ -110,26 +96,7 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
110
96
  if (tabsRef.current) {
111
97
  tabsRef.current.scrollLeft = nextScrollLeft;
112
98
  }
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]);
99
+ });
133
100
  const updateMask = useMemo(
134
101
  () => throttle(
135
102
  () => {
@@ -152,7 +119,20 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
152
119
  ),
153
120
  []
154
121
  );
155
- useLayoutEffect(() => {
122
+ useEffect(() => {
123
+ animate();
124
+ }, [value]);
125
+ useEffect(() => {
126
+ const handleResize = debounce(() => {
127
+ animate();
128
+ updateMask();
129
+ }, 100);
130
+ window.addEventListener("resize", handleResize);
131
+ return () => {
132
+ window.removeEventListener("resize", handleResize);
133
+ };
134
+ }, []);
135
+ useEffect(() => {
156
136
  updateMask();
157
137
  }, []);
158
138
  const handleClick = (e, item) => {
@@ -162,16 +142,13 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
162
142
  if (index === void 0 || index === null) {
163
143
  return;
164
144
  }
165
- if (active !== value) {
166
- setActive(index);
167
- }
168
145
  if (index !== value) {
169
146
  onChange == null ? void 0 : onChange(e, { index });
170
147
  }
171
148
  };
172
149
  const providerValue = useMemo(() => {
173
- return { value, align, triggerChange: handleClick };
174
- }, [value, align, children, handleClick]);
150
+ return { value, triggerChange: handleClick };
151
+ }, [value, children, handleClick]);
175
152
  return /* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: clsx(prefixCls, className) }, others), /* @__PURE__ */ React.createElement(
176
153
  "div",
177
154
  {
@@ -192,12 +169,12 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
192
169
  "div",
193
170
  {
194
171
  ref: activeLineRef,
195
- className: clsx(`${prefixCls}-tabline`, {
196
- "bui-tabline-invisible": isMini || !lineData.hasActiveTab
172
+ className: clsx(`${prefixCls}-indicator`, {
173
+ "bui-indicator-invisible": isMini || !indicatorData.hasActiveTab
197
174
  }),
198
175
  style: {
199
- transition: lineData.transitionInUse ? "transform 0.25s ease-in-out" : void 0,
200
- transform: `translate3d(${lineData.x}px, 0px, 0px)`
176
+ transition: "transform 0.3s ease-in-out",
177
+ transform: `translate3d(${indicatorData.x}px, 0px, 0px)`
201
178
  }
202
179
  }
203
180
  ), /* @__PURE__ */ React.createElement(TabsContextProvider, { value: providerValue }, !!tabs.length && tabs.map((item) => {
@@ -213,10 +190,6 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
213
190
  }), children)));
214
191
  });
215
192
  Tabs.displayName = "BuiTabs";
216
- Tabs.defaultProps = {
217
- align: "center",
218
- tabs: []
219
- };
220
193
  var Tabs_default = Tabs;
221
194
  export {
222
195
  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';
@@ -32,10 +26,6 @@ export type TabsProps<D extends React.ElementType = 'div', P = {}> = OverridePro
32
26
  * 切换面板的数据
33
27
  */
34
28
  tabs?: ITabItem[];
35
- /**
36
- * 对齐方式,默认为center
37
- */
38
- align?: ITabAlign;
39
29
  /**
40
30
  * 切换面板的回调
41
31
  */
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 {
package/es/Tag/Tag.js CHANGED
@@ -47,9 +47,9 @@ const Tag = /* @__PURE__ */ React.forwardRef((props, ref) => {
47
47
  const _a = props, {
48
48
  className,
49
49
  style,
50
- color,
50
+ color = "default",
51
51
  htmlColor,
52
- variant,
52
+ variant = "outlined",
53
53
  onClick,
54
54
  children
55
55
  } = _a, others = __objRest(_a, [
@@ -98,10 +98,6 @@ const Tag = /* @__PURE__ */ React.forwardRef((props, ref) => {
98
98
  );
99
99
  });
100
100
  Tag.displayName = "BuiTag";
101
- Tag.defaultProps = {
102
- variant: "outlined",
103
- color: "default"
104
- };
105
101
  var Tag_default = Tag;
106
102
  export {
107
103
  Tag_default as default
@@ -40,17 +40,17 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
40
40
  const _a = props, {
41
41
  className,
42
42
  value,
43
- defaultValue,
43
+ defaultValue = "",
44
44
  textareaProps,
45
45
  textareaRef,
46
46
  name,
47
47
  placeholder,
48
48
  disabled,
49
- rows,
49
+ rows = DEFAULT_ROWS,
50
50
  maxLength,
51
- autoSize,
52
- autoFocus,
53
- showCount,
51
+ autoSize = false,
52
+ autoFocus = false,
53
+ showCount = false,
54
54
  onChange
55
55
  } = _a, others = __objRest(_a, [
56
56
  "className",
@@ -175,13 +175,6 @@ const TextArea = /* @__PURE__ */ React.forwardRef(
175
175
  }
176
176
  );
177
177
  TextArea.displayName = "BuiTextArea";
178
- TextArea.defaultProps = {
179
- defaultValue: "",
180
- rows: DEFAULT_ROWS,
181
- autoSize: false,
182
- autoFocus: false,
183
- showCount: false
184
- };
185
178
  var TextArea_default = TextArea;
186
179
  export {
187
180
  TextArea_default as default
@@ -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 {
@@ -59,8 +59,8 @@ const TransitionCore = forwardRef(
59
59
  children,
60
60
  mountOnEnter,
61
61
  unmountOnExit,
62
- enter,
63
- exit,
62
+ enter = true,
63
+ exit = true,
64
64
  timeout: _timeout,
65
65
  delay: _delay,
66
66
  onEnter,
@@ -69,7 +69,7 @@ const TransitionCore = forwardRef(
69
69
  onExit,
70
70
  onExiting,
71
71
  onExited,
72
- nextTick
72
+ nextTick = setTimeout
73
73
  } = _a, childProps = __objRest(_a, [
74
74
  "appear",
75
75
  "in",
@@ -224,11 +224,6 @@ const TransitionCore = forwardRef(
224
224
  }
225
225
  );
226
226
  TransitionCore.displayName = "BuiTransitionCore";
227
- TransitionCore.defaultProps = {
228
- enter: true,
229
- exit: true,
230
- nextTick: setTimeout
231
- };
232
227
  var TransitionCore_default = TransitionCore;
233
228
  export {
234
229
  TransitionCore_default as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifrostui/react",
3
- "version": "1.4.7",
3
+ "version": "2.0.0-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/styles": "1.4.7",
37
- "@bifrostui/icons": "1.4.7",
38
- "@bifrostui/types": "1.4.7",
39
- "@bifrostui/utils": "1.4.7"
36
+ "@bifrostui/icons": "2.0.0-beta.0",
37
+ "@bifrostui/styles": "2.0.0-beta.0",
38
+ "@bifrostui/types": "2.0.0-beta.0",
39
+ "@bifrostui/utils": "2.0.0-beta.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tarojs/components": "^3.0.0",