@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
@@ -59,68 +59,65 @@ module.exports = __toCommonJS(Steps_exports);
59
59
  var import_utils = require("@bifrostui/utils");
60
60
  var import_clsx = __toESM(require("clsx"));
61
61
  var import_react = __toESM(require("react"));
62
- var import_Steps = require("./Steps.css");
63
62
  var import_StepsContext = require("./StepsContext");
63
+ var import_Steps2 = require("./Steps.css");
64
64
  const prefixCls = "bui-steps";
65
- const Steps = (0, import_react.forwardRef)((props, ref) => {
66
- const _a = props, {
67
- className,
68
- children,
69
- direction,
70
- current,
71
- labelPlacement,
72
- onChange
73
- } = _a, others = __objRest(_a, [
74
- "className",
75
- "children",
76
- "direction",
77
- "current",
78
- "labelPlacement",
79
- "onChange"
80
- ]);
81
- const renderStep = () => {
82
- return (0, import_utils.toArray)(children).map((child, index) => {
83
- const childProps = __spreadValues({
84
- key: index
85
- }, child.props);
86
- if (!child.props.status) {
87
- if (index === current) {
88
- childProps.status = "active";
89
- } else if (index < current) {
90
- childProps.status = "finish";
91
- } else {
92
- childProps.status = "wait";
65
+ const Steps = (0, import_react.forwardRef)(
66
+ (_a, ref) => {
67
+ var _b = _a, {
68
+ className,
69
+ children,
70
+ direction = "vertical",
71
+ current = 0,
72
+ labelPlacement = "horizontal",
73
+ onChange
74
+ } = _b, others = __objRest(_b, [
75
+ "className",
76
+ "children",
77
+ "direction",
78
+ "current",
79
+ "labelPlacement",
80
+ "onChange"
81
+ ]);
82
+ const renderStep = () => {
83
+ return (0, import_utils.toArray)(children).map((child, index) => {
84
+ const childProps = __spreadValues({
85
+ key: index
86
+ }, child.props);
87
+ if (!child.props.status) {
88
+ if (index === current) {
89
+ childProps.status = "active";
90
+ } else if (index < current) {
91
+ childProps.status = "finish";
92
+ } else {
93
+ childProps.status = "wait";
94
+ }
93
95
  }
94
- }
95
- return (0, import_react.cloneElement)(child, childProps);
96
- });
97
- };
98
- return /* @__PURE__ */ import_react.default.createElement(
99
- import_StepsContext.StepsContextProvider,
100
- {
101
- value: {
102
- direction,
103
- current,
104
- labelPlacement,
105
- onChange
106
- }
107
- },
108
- /* @__PURE__ */ import_react.default.createElement(
109
- "div",
110
- __spreadValues({
111
- className: (0, import_clsx.default)(prefixCls, className, {
112
- [`${prefixCls}-${direction}`]: direction
113
- }),
114
- ref
115
- }, others),
116
- renderStep()
117
- )
118
- );
119
- });
96
+ return (0, import_react.cloneElement)(child, childProps);
97
+ });
98
+ };
99
+ return /* @__PURE__ */ import_react.default.createElement(
100
+ import_StepsContext.StepsContextProvider,
101
+ {
102
+ value: {
103
+ direction,
104
+ current,
105
+ labelPlacement,
106
+ onChange
107
+ }
108
+ },
109
+ /* @__PURE__ */ import_react.default.createElement(
110
+ "div",
111
+ __spreadValues({
112
+ className: (0, import_clsx.default)(prefixCls, className, {
113
+ [`${prefixCls}-${direction}`]: direction
114
+ }),
115
+ ref
116
+ }, others),
117
+ renderStep()
118
+ )
119
+ );
120
+ }
121
+ );
120
122
  Steps.displayName = "Steps";
121
- Steps.defaultProps = {
122
- current: 0,
123
- direction: "vertical",
124
- labelPlacement: "horizontal"
125
- };
126
123
  var Steps_default = Steps;
@@ -64,83 +64,80 @@ var import_clsx = __toESM(require("clsx"));
64
64
  var import_react = __toESM(require("react"));
65
65
  var import_Switch2 = require("./Switch.css");
66
66
  const prefixCls = "bui-switch";
67
- const Switch = (0, import_react.forwardRef)((props, ref) => {
68
- const _a = props, {
69
- className,
70
- checked,
71
- defaultChecked,
72
- inputProps,
73
- inputRef,
74
- name,
75
- checkedChildren,
76
- unCheckedChildren,
77
- disabled,
78
- size,
79
- color,
80
- onChange
81
- } = _a, others = __objRest(_a, [
82
- "className",
83
- "checked",
84
- "defaultChecked",
85
- "inputProps",
86
- "inputRef",
87
- "name",
88
- "checkedChildren",
89
- "unCheckedChildren",
90
- "disabled",
91
- "size",
92
- "color",
93
- "onChange"
94
- ]);
95
- const [switchChecked, triggerChange] = (0, import_utils.useValue)({
96
- value: checked,
97
- defaultValue: !!defaultChecked
98
- });
99
- const changeAction = (e, isChecked) => {
100
- triggerChange(e, isChecked);
101
- onChange == null ? void 0 : onChange(e, { checked: isChecked });
102
- };
103
- const handleChange = (e) => {
104
- var _a2;
105
- const isChecked = !switchChecked;
106
- changeAction(e, isChecked);
107
- (_a2 = inputProps == null ? void 0 : inputProps.onChange) == null ? void 0 : _a2.call(inputProps, e);
108
- };
109
- return /* @__PURE__ */ import_react.default.createElement(
110
- "div",
111
- __spreadValues({
112
- ref,
113
- className: (0, import_clsx.default)(
114
- `${prefixCls}`,
115
- `${prefixCls}-${size}`,
116
- `${prefixCls}-${color}`,
117
- {
118
- [`${prefixCls}-checked`]: switchChecked,
119
- [`${prefixCls}-disabled`]: disabled
120
- },
121
- className
122
- )
123
- }, others),
124
- /* @__PURE__ */ import_react.default.createElement(
125
- "input",
126
- __spreadProps(__spreadValues({
127
- ref: inputRef,
128
- type: "checkbox",
129
- name,
130
- checked: switchChecked,
131
- disabled
132
- }, inputProps), {
133
- onChange: handleChange,
134
- className: (0, import_clsx.default)(`${prefixCls}-input`, inputProps == null ? void 0 : inputProps.className)
135
- })
136
- ),
137
- (checkedChildren || unCheckedChildren) && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-inner` }, switchChecked ? checkedChildren : unCheckedChildren)
138
- );
139
- });
67
+ const Switch = (0, import_react.forwardRef)(
68
+ (_a, ref) => {
69
+ var _b = _a, {
70
+ className,
71
+ checked,
72
+ defaultChecked,
73
+ inputProps,
74
+ inputRef,
75
+ name,
76
+ checkedChildren,
77
+ unCheckedChildren,
78
+ disabled = false,
79
+ size = "medium",
80
+ color = "primary",
81
+ onChange
82
+ } = _b, others = __objRest(_b, [
83
+ "className",
84
+ "checked",
85
+ "defaultChecked",
86
+ "inputProps",
87
+ "inputRef",
88
+ "name",
89
+ "checkedChildren",
90
+ "unCheckedChildren",
91
+ "disabled",
92
+ "size",
93
+ "color",
94
+ "onChange"
95
+ ]);
96
+ const [switchChecked, triggerChange] = (0, import_utils.useValue)({
97
+ value: checked,
98
+ defaultValue: !!defaultChecked
99
+ });
100
+ const changeAction = (e, isChecked) => {
101
+ triggerChange(e, isChecked);
102
+ onChange == null ? void 0 : onChange(e, { checked: isChecked });
103
+ };
104
+ const handleChange = (e) => {
105
+ var _a2;
106
+ const isChecked = !switchChecked;
107
+ changeAction(e, isChecked);
108
+ (_a2 = inputProps == null ? void 0 : inputProps.onChange) == null ? void 0 : _a2.call(inputProps, e);
109
+ };
110
+ return /* @__PURE__ */ import_react.default.createElement(
111
+ "div",
112
+ __spreadValues({
113
+ ref,
114
+ className: (0, import_clsx.default)(
115
+ `${prefixCls}`,
116
+ `${prefixCls}-${size}`,
117
+ `${prefixCls}-${color}`,
118
+ {
119
+ [`${prefixCls}-checked`]: switchChecked,
120
+ [`${prefixCls}-disabled`]: disabled
121
+ },
122
+ className
123
+ )
124
+ }, others),
125
+ /* @__PURE__ */ import_react.default.createElement(
126
+ "input",
127
+ __spreadProps(__spreadValues({
128
+ ref: inputRef,
129
+ type: "checkbox",
130
+ name,
131
+ checked: switchChecked,
132
+ disabled
133
+ }, inputProps), {
134
+ onChange: handleChange,
135
+ className: (0, import_clsx.default)(`${prefixCls}-input`, inputProps == null ? void 0 : inputProps.className)
136
+ })
137
+ ),
138
+ (checkedChildren || unCheckedChildren) && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefixCls}-inner` }, switchChecked ? checkedChildren : unCheckedChildren)
139
+ );
140
+ }
141
+ );
140
142
  Switch.displayName = "BuiSwitch";
141
- Switch.defaultProps = {
142
- disabled: false,
143
- size: "medium",
144
- color: "primary"
145
- };
146
143
  var Switch_default = Switch;
@@ -63,9 +63,9 @@ var import_TabBar = require("./TabBar.css");
63
63
  const prefixCls = "bui-tab-bar";
64
64
  const TabBar = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
65
65
  const _a = props || {}, {
66
- current,
67
- activeColor,
68
- color,
66
+ current = 0,
67
+ activeColor = "primary",
68
+ color = "default",
69
69
  children,
70
70
  className,
71
71
  onChange
@@ -97,9 +97,4 @@ const TabBar = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
97
97
  );
98
98
  });
99
99
  TabBar.displayName = "BuiTabBar";
100
- TabBar.defaultProps = {
101
- activeColor: "primary",
102
- color: "default",
103
- current: 0
104
- };
105
100
  var TabBar_default = TabBar;
package/dist/Tabs/Tab.css CHANGED
@@ -4,31 +4,25 @@
4
4
  justify-content: center;
5
5
  white-space: nowrap;
6
6
  width: min-content;
7
- height: var(--tab-height);
7
+ height: 100%;
8
8
  box-sizing: border-box;
9
9
  position: relative;
10
10
  cursor: pointer;
11
- font-size: var(--font-size);
11
+ font-size: var(--bui-tabs-font-size);
12
12
  line-height: var(--bui-line-height);
13
- color: var(--color);
14
- padding: var(--tab-padding);
15
- font-family: var(--bui-font-family);
13
+ color: var(--bui-tabs-color);
14
+ padding: var(--bui-tab-padding);
15
+ font-family: var(--bui-tabs-font-family);
16
16
  }
17
17
  .bui-tab-active {
18
- font-size: var(--font-size);
19
- line-height: var(--bui-line-height);
20
- font-weight: var(--bui-font-weight-medium);
21
- color: var(--active-color);
22
- }
23
- .bui-tab-center {
24
- flex: 1 0 0;
25
- margin: 0 auto;
18
+ --bui-tabs-font-family: var(--bui-font-family-accent, inherit);
19
+ --bui-tabs-color: var(--bui-color-fg-default);
20
+ font-weight: 600;
26
21
  }
27
22
  .bui-tab-miniapp-active {
28
- font-size: var(--font-size);
23
+ --bui-tabs-color: var(--bui-color-fg-default);
29
24
  line-height: 1.5;
30
25
  font-weight: var(--bui-font-weight-medium);
31
- color: var(--active-color);
32
26
  position: relative;
33
27
  }
34
28
  .bui-tab-miniapp-active-line {
@@ -46,7 +40,7 @@
46
40
  opacity: 0.5;
47
41
  pointer-events: none;
48
42
  }
49
- .bui-tabline-invisible {
43
+ .bui-indicator-invisible {
50
44
  visibility: hidden;
51
45
  background-color: transparent;
52
46
  }
package/dist/Tabs/Tab.js CHANGED
@@ -66,16 +66,27 @@ var import_TabsContext = __toESM(require("./TabsContext"));
66
66
  var import_Tab2 = require("./Tab.css");
67
67
  const prefixCls = "bui-tab";
68
68
  const Tab = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
69
- const _a = props, { className, children, index, disabled, onClick } = _a, others = __objRest(_a, ["className", "children", "index", "disabled", "onClick"]);
69
+ const _a = props, {
70
+ className,
71
+ children,
72
+ index,
73
+ disabled = false,
74
+ onClick
75
+ } = _a, others = __objRest(_a, [
76
+ "className",
77
+ "children",
78
+ "index",
79
+ "disabled",
80
+ "onClick"
81
+ ]);
70
82
  const tabsContext = import_react.default.useContext(import_TabsContext.default);
71
- const { value, align, triggerChange } = tabsContext;
83
+ const { value, triggerChange } = tabsContext;
72
84
  return /* @__PURE__ */ import_react.default.createElement(
73
85
  "div",
74
86
  __spreadProps(__spreadValues({
75
87
  ref,
76
88
  className: (0, import_clsx.default)(
77
89
  prefixCls,
78
- align !== "start" && `${prefixCls}-${align}`,
79
90
  {
80
91
  [`${prefixCls}-active`]: !import_utils.isMini && index === value,
81
92
  [`${prefixCls}-miniapp-active`]: import_utils.isMini && index === value,
@@ -97,14 +108,11 @@ const Tab = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
97
108
  "div",
98
109
  {
99
110
  className: (0, import_clsx.default)(`${prefixCls}-miniapp-active-line`, {
100
- "bui-tabline-invisible": index !== value
111
+ "bui-indicator-invisible": index !== value
101
112
  })
102
113
  }
103
114
  )
104
115
  );
105
116
  });
106
117
  Tab.displayName = "BuiTab";
107
- Tab.defaultProps = {
108
- disabled: false
109
- };
110
118
  var Tab_default = Tab;
@@ -1,20 +1,10 @@
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));
13
2
  position: relative;
14
- font-family: var(--bui-font-family);
3
+ font-family: var(--bui-tabs-font-family);
4
+ font-weight: var(--bui-tabs-font-weight);
15
5
  }
16
6
  .bui-tabs-tabs {
17
- height: var(--height);
7
+ height: var(--bui-tabs-height);
18
8
  display: flex;
19
9
  flex-wrap: nowrap;
20
10
  justify-content: flex-start;
@@ -26,14 +16,15 @@
26
16
  .bui-tabs-tabs::-webkit-scrollbar {
27
17
  display: none;
28
18
  }
29
- .bui-tabs-tabline {
19
+ .bui-tabs-indicator {
30
20
  position: absolute;
31
- width: var(--line-width);
32
- bottom: 0;
33
- height: var(--line-height);
21
+ width: var(--bui-tabs-indicator-width);
22
+ bottom: var(--bui-tabs-indicator-bottom);
23
+ height: var(--bui-tabs-indicator-height);
34
24
  color: var(--bui-color-primary);
35
- background: var(--line-color);
36
- border-radius: var(--bui-shape-radius-label);
25
+ background: var(--bui-tabs-indicator-bg);
26
+ border-radius: var(--bui-tabs-indicator-border-radius);
27
+ box-shadow: var(--bui-tabs-indicator-box-shadow);
37
28
  }
38
29
  .bui-tabs-content {
39
30
  padding: var(--bui-spacing-lg);
@@ -43,8 +34,8 @@
43
34
  top: 0;
44
35
  bottom: 0;
45
36
  z-index: 1;
46
- width: var(--mask-width);
47
- height: var(--mask-height);
37
+ width: 12px;
38
+ height: 100%;
48
39
  pointer-events: none;
49
40
  }
50
41
  .bui-tabs-mask-left {
@@ -63,7 +54,7 @@
63
54
  var(--bui-color-bg-view),
64
55
  rgba(255, 255, 255, 0));
65
56
  }
66
- .bui-tabline-invisible {
57
+ .bui-indicator-invisible {
67
58
  visibility: hidden;
68
59
  background-color: transparent;
69
60
  }
package/dist/Tabs/Tabs.js CHANGED
@@ -65,24 +65,22 @@ var import_bound = __toESM(require("./utils/bound"));
65
65
  var import_Tabs2 = require("./Tabs.css");
66
66
  const prefixCls = "bui-tabs";
67
67
  const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
68
- const _a = props, { children, className, value, tabs, align, onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "align", "onChange"]);
69
- const [active, setActive] = (0, import_react.useState)("");
68
+ const _a = props, { children, className, value, tabs = [], onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "onChange"]);
70
69
  const tabsRef = (0, import_react.useRef)(null);
71
70
  const activeLineRef = (0, import_react.useRef)(null);
72
- const [lineData, setLineData] = (0, import_react.useState)({
71
+ const [indicatorData, setIndicatorData] = (0, import_react.useState)({
73
72
  x: 0,
74
- transitionInUse: false,
75
73
  hasActiveTab: false
76
74
  });
77
75
  const [maskData, setMaskData] = (0, import_react.useState)({
78
76
  leftMaskOpacity: 0,
79
77
  rightMaskOpacity: 0
80
78
  });
81
- const animate = ({ transitionInUse }) => {
79
+ const animate = (0, import_utils.useEventCallback)(() => {
82
80
  const container = tabsRef.current;
83
81
  if (!container)
84
82
  return;
85
- const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === active);
83
+ const activeIndex = !!tabs.length && tabs.findIndex((item) => item.index === value);
86
84
  const activeLine = activeLineRef.current;
87
85
  if (!activeLine)
88
86
  return;
@@ -113,9 +111,8 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
113
111
  activeLineWidth = activeLine.offsetWidth;
114
112
  x = activeTabLeft + (activeTabWidth - activeLineWidth) / 2;
115
113
  }
116
- setLineData({
114
+ setIndicatorData({
117
115
  x,
118
- transitionInUse,
119
116
  hasActiveTab: !!activeTab
120
117
  });
121
118
  const maxScrollDistance = containerScrollWidth - containerWidth;
@@ -129,26 +126,7 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
129
126
  if (tabsRef.current) {
130
127
  tabsRef.current.scrollLeft = nextScrollLeft;
131
128
  }
132
- };
133
- (0, import_react.useEffect)(() => {
134
- setActive(value);
135
- }, [value]);
136
- (0, import_react.useLayoutEffect)(() => {
137
- animate({ transitionInUse: false });
138
- }, []);
139
- (0, import_react.useEffect)(() => {
140
- const handleResize = (0, import_utils.debounce)(() => {
141
- animate({ transitionInUse: true });
142
- updateMask();
143
- }, 100);
144
- window.addEventListener("resize", handleResize);
145
- return () => {
146
- window.removeEventListener("resize", handleResize);
147
- };
148
- }, [active]);
149
- (0, import_utils.useDidMountEffect)(() => {
150
- animate({ transitionInUse: true });
151
- }, [active, tabs, children]);
129
+ });
152
130
  const updateMask = (0, import_react.useMemo)(
153
131
  () => (0, import_utils.throttle)(
154
132
  () => {
@@ -171,7 +149,20 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
171
149
  ),
172
150
  []
173
151
  );
174
- (0, import_react.useLayoutEffect)(() => {
152
+ (0, import_react.useEffect)(() => {
153
+ animate();
154
+ }, [value]);
155
+ (0, import_react.useEffect)(() => {
156
+ const handleResize = (0, import_utils.debounce)(() => {
157
+ animate();
158
+ updateMask();
159
+ }, 100);
160
+ window.addEventListener("resize", handleResize);
161
+ return () => {
162
+ window.removeEventListener("resize", handleResize);
163
+ };
164
+ }, []);
165
+ (0, import_react.useEffect)(() => {
175
166
  updateMask();
176
167
  }, []);
177
168
  const handleClick = (e, item) => {
@@ -181,16 +172,13 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
181
172
  if (index === void 0 || index === null) {
182
173
  return;
183
174
  }
184
- if (active !== value) {
185
- setActive(index);
186
- }
187
175
  if (index !== value) {
188
176
  onChange == null ? void 0 : onChange(e, { index });
189
177
  }
190
178
  };
191
179
  const providerValue = (0, import_react.useMemo)(() => {
192
- return { value, align, triggerChange: handleClick };
193
- }, [value, align, children, handleClick]);
180
+ return { value, triggerChange: handleClick };
181
+ }, [value, children, handleClick]);
194
182
  return /* @__PURE__ */ import_react.default.createElement("div", __spreadValues({ ref, className: (0, import_clsx.default)(prefixCls, className) }, others), /* @__PURE__ */ import_react.default.createElement(
195
183
  "div",
196
184
  {
@@ -211,12 +199,12 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
211
199
  "div",
212
200
  {
213
201
  ref: activeLineRef,
214
- className: (0, import_clsx.default)(`${prefixCls}-tabline`, {
215
- "bui-tabline-invisible": import_utils.isMini || !lineData.hasActiveTab
202
+ className: (0, import_clsx.default)(`${prefixCls}-indicator`, {
203
+ "bui-indicator-invisible": import_utils.isMini || !indicatorData.hasActiveTab
216
204
  }),
217
205
  style: {
218
- transition: lineData.transitionInUse ? "transform 0.25s ease-in-out" : void 0,
219
- transform: `translate3d(${lineData.x}px, 0px, 0px)`
206
+ transition: "transform 0.3s ease-in-out",
207
+ transform: `translate3d(${indicatorData.x}px, 0px, 0px)`
220
208
  }
221
209
  }
222
210
  ), /* @__PURE__ */ import_react.default.createElement(import_TabsContext.TabsContextProvider, { value: providerValue }, !!tabs.length && tabs.map((item) => {
@@ -232,8 +220,4 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
232
220
  }), children)));
233
221
  });
234
222
  Tabs.displayName = "BuiTabs";
235
- Tabs.defaultProps = {
236
- align: "center",
237
- tabs: []
238
- };
239
223
  var Tabs_default = Tabs;
@@ -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/dist/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/dist/Tag/Tag.js CHANGED
@@ -77,9 +77,9 @@ const Tag = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
77
77
  const _a = props, {
78
78
  className,
79
79
  style,
80
- color,
80
+ color = "default",
81
81
  htmlColor,
82
- variant,
82
+ variant = "outlined",
83
83
  onClick,
84
84
  children
85
85
  } = _a, others = __objRest(_a, [
@@ -128,8 +128,4 @@ const Tag = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
128
128
  );
129
129
  });
130
130
  Tag.displayName = "BuiTag";
131
- Tag.defaultProps = {
132
- variant: "outlined",
133
- color: "default"
134
- };
135
131
  var Tag_default = Tag;