@bifrostui/react 1.4.4-beta.0 → 1.4.4

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.
@@ -124,7 +124,7 @@
124
124
  color: var(--bui-color-white);
125
125
  background-image:
126
126
  linear-gradient(
127
- 45deg,
127
+ 90deg,
128
128
  var(--bui-color-primary-start) 0%,
129
129
  var(--bui-color-primary-end) 100%);
130
130
  }
@@ -132,7 +132,7 @@
132
132
  color: var(--bui-color-white);
133
133
  background-image:
134
134
  linear-gradient(
135
- 45deg,
135
+ 90deg,
136
136
  var(--bui-color-success-start) 0%,
137
137
  var(--bui-color-success-end) 100%);
138
138
  }
@@ -140,7 +140,7 @@
140
140
  color: var(--bui-color-white);
141
141
  background-image:
142
142
  linear-gradient(
143
- 45deg,
143
+ 90deg,
144
144
  var(--bui-color-info-start) 0%,
145
145
  var(--bui-color-info-end) 100%);
146
146
  }
@@ -148,7 +148,7 @@
148
148
  color: var(--bui-color-white);
149
149
  background-image:
150
150
  linear-gradient(
151
- 45deg,
151
+ 90deg,
152
152
  var(--bui-color-warning-start) 0%,
153
153
  var(--bui-color-warning-end) 100%);
154
154
  }
@@ -156,7 +156,7 @@
156
156
  color: var(--bui-color-white);
157
157
  background-image:
158
158
  linear-gradient(
159
- 45deg,
159
+ 90deg,
160
160
  var(--bui-color-danger-start) 0%,
161
161
  var(--bui-color-danger-end) 100%);
162
162
  }
@@ -114,7 +114,7 @@
114
114
  color: var(--bui-color-white);
115
115
  background-image:
116
116
  linear-gradient(
117
- 45deg,
117
+ 90deg,
118
118
  var(--bui-color-primary-start) 0%,
119
119
  var(--bui-color-primary-end) 100%);
120
120
  }
@@ -122,7 +122,7 @@
122
122
  color: var(--bui-color-white);
123
123
  background-image:
124
124
  linear-gradient(
125
- 45deg,
125
+ 90deg,
126
126
  var(--bui-color-success-start) 0%,
127
127
  var(--bui-color-success-end) 100%);
128
128
  }
@@ -130,7 +130,7 @@
130
130
  color: var(--bui-color-white);
131
131
  background-image:
132
132
  linear-gradient(
133
- 45deg,
133
+ 90deg,
134
134
  var(--bui-color-info-start) 0%,
135
135
  var(--bui-color-info-end) 100%);
136
136
  }
@@ -138,7 +138,7 @@
138
138
  color: var(--bui-color-white);
139
139
  background-image:
140
140
  linear-gradient(
141
- 45deg,
141
+ 90deg,
142
142
  var(--bui-color-warning-start) 0%,
143
143
  var(--bui-color-warning-end) 100%);
144
144
  }
@@ -146,7 +146,7 @@
146
146
  color: var(--bui-color-white);
147
147
  background-image:
148
148
  linear-gradient(
149
- 45deg,
149
+ 90deg,
150
150
  var(--bui-color-danger-start) 0%,
151
151
  var(--bui-color-danger-end) 100%);
152
152
  }
@@ -50,7 +50,7 @@ export type InputProps<D extends React.ElementType = 'div', P = {}> = OverridePr
50
50
  /**
51
51
  * 点击清除图标的回调,非受控状态也会清除输入框内容
52
52
  */
53
- onClear?: (e: React.SyntheticEvent) => void;
53
+ onClear?: (e: React.MouseEvent<HTMLDivElement>) => void;
54
54
  /**
55
55
  * 输入框内容变化时的回调
56
56
  */
@@ -60,11 +60,11 @@ export type InputProps<D extends React.ElementType = 'div', P = {}> = OverridePr
60
60
  /**
61
61
  * 聚焦时的回调
62
62
  */
63
- onFocus?: (e: React.SyntheticEvent) => void;
63
+ onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
64
64
  /**
65
65
  * 失焦时的回调
66
66
  */
67
- onBlur?: (e: React.SyntheticEvent) => void;
67
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
68
68
  };
69
69
  defaultComponent: D;
70
70
  }, D>;
@@ -191,7 +191,10 @@ const Picker = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
191
191
  }
192
192
  }
193
193
  };
194
- const handleSelect = (e, { columnIndex, columnOption }) => {
194
+ const handleSelect = (e, {
195
+ columnIndex,
196
+ columnOption
197
+ }) => {
195
198
  updateItem(e, columnOption, columnIndex);
196
199
  };
197
200
  const handleClose = (e, data) => {
@@ -11,11 +11,17 @@ export interface IPickerOptionItem {
11
11
  */
12
12
  value: string | number;
13
13
  }
14
+ export type ICascadePickerChildOptionItem = IPickerOptionItem & {
15
+ /**
16
+ * 用于级联选项,子节点可能没有children属性
17
+ */
18
+ children?: ICascadePickerChildOptionItem[];
19
+ };
14
20
  export type ICascadePickerOptionItem = IPickerOptionItem & {
15
21
  /**
16
- * 用于级联选项
22
+ * 用于级联选项,根节点必须含有children属性
17
23
  */
18
- children?: ICascadePickerOptionItem[];
24
+ children: ICascadePickerChildOptionItem[];
19
25
  };
20
26
  export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> = OverrideProps<{
21
27
  props: P & {
@@ -44,29 +50,29 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
44
50
  /**
45
51
  * 点击确认按钮时候回调
46
52
  */
47
- onConfirm?: (e: React.SyntheticEvent, data: {
53
+ onConfirm?: (e: React.MouseEvent<HTMLDivElement>, data: {
48
54
  value: (string | number)[];
49
- options: ICascadePickerOptionItem[];
55
+ options: ICascadePickerChildOptionItem[][];
50
56
  }) => void;
51
57
  /**
52
58
  * 选项值变更时的回调
53
59
  */
54
- onOptionChange?: (e: React.SyntheticEvent, data: {
60
+ onOptionChange?: (e: React.TransitionEvent<HTMLDivElement>, data: {
55
61
  value: (string | number)[];
56
- options: IPickerOptionItem[][] | ICascadePickerOptionItem[];
57
- currentOption: ICascadePickerOptionItem;
62
+ options: ICascadePickerChildOptionItem[][];
63
+ currentOption: ICascadePickerChildOptionItem;
58
64
  }) => void;
59
65
  /**
60
66
  * 点击取消按钮时候回调
61
67
  */
62
- onCancel?: (e: React.SyntheticEvent) => void;
68
+ onCancel?: (e: React.MouseEvent<HTMLDivElement>) => void;
63
69
  /**
64
70
  * 关闭选择器时执行
65
71
  */
66
- onClose?: (e: React.SyntheticEvent, data: {
72
+ onClose?: (e: React.MouseEvent<HTMLDivElement>, data: {
67
73
  from: string;
68
74
  value: (string | number)[];
69
- options: IPickerOptionItem[][] | ICascadePickerOptionItem[];
75
+ options: ICascadePickerChildOptionItem[][];
70
76
  }) => void;
71
77
  };
72
78
  defaultComponent: D;
@@ -77,7 +83,7 @@ export type PickerPanelProps<D extends React.ElementType = 'div', P = {}> = Over
77
83
  * 单列面板的列表数据
78
84
  * @default []
79
85
  */
80
- options?: IPickerOptionItem[][] | ICascadePickerOptionItem[];
86
+ options?: ICascadePickerChildOptionItem[];
81
87
  /**
82
88
  * 默认值
83
89
  */
@@ -93,8 +99,8 @@ export type PickerPanelProps<D extends React.ElementType = 'div', P = {}> = Over
93
99
  /**
94
100
  * 选择选项时的回调
95
101
  */
96
- onSelect?: (e: React.SyntheticEvent, data: {
97
- columnOption: IPickerOptionItem[] | ICascadePickerOptionItem;
102
+ onSelect?: (e: React.TransitionEvent<HTMLDivElement>, data: {
103
+ columnOption: ICascadePickerChildOptionItem;
98
104
  columnIndex: number;
99
105
  }) => void;
100
106
  };
@@ -1,4 +1,4 @@
1
- import { ICascadePickerOptionItem } from './Picker.types';
1
+ import { ICascadePickerOptionItem, ICascadePickerChildOptionItem } from './Picker.types';
2
2
  /**
3
3
  * 根据第一列数据判断选择器类型
4
4
  */
@@ -6,7 +6,7 @@ export declare const pickerPanelType: (options?: any[]) => "multiple" | "single"
6
6
  /**
7
7
  * 格式化级联模式数据
8
8
  */
9
- export declare const formatCascade: (columns: ICascadePickerOptionItem[], values?: (number | string)[]) => ICascadePickerOptionItem[][];
9
+ export declare const formatCascade: (columns: ICascadePickerOptionItem[], values?: (number | string)[]) => ICascadePickerChildOptionItem[][];
10
10
  /**
11
11
  * 统一options数据格式
12
12
  */
package/dist/Tabs/Tabs.js CHANGED
@@ -71,7 +71,8 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
71
71
  const activeLineRef = (0, import_react.useRef)(null);
72
72
  const [lineData, setLineData] = (0, import_react.useState)({
73
73
  x: 0,
74
- transitionInUse: false
74
+ transitionInUse: false,
75
+ hasActiveTab: false
75
76
  });
76
77
  const [maskData, setMaskData] = (0, import_react.useState)({
77
78
  leftMaskOpacity: 0,
@@ -114,7 +115,8 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
114
115
  }
115
116
  setLineData({
116
117
  x,
117
- transitionInUse
118
+ transitionInUse,
119
+ hasActiveTab: !!activeTab
118
120
  });
119
121
  const maxScrollDistance = containerScrollWidth - containerWidth;
120
122
  if (maxScrollDistance <= 0 || !activeTab)
@@ -210,7 +212,7 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
210
212
  {
211
213
  ref: activeLineRef,
212
214
  className: (0, import_clsx.default)(`${prefixCls}-tabline`, {
213
- "bui-tabline-invisible": import_utils.isMini || !lineData.x
215
+ "bui-tabline-invisible": import_utils.isMini || !lineData.hasActiveTab
214
216
  }),
215
217
  style: {
216
218
  transition: lineData.transitionInUse ? "transform 0.25s ease-in-out" : void 0,
@@ -124,7 +124,7 @@
124
124
  color: var(--bui-color-white);
125
125
  background-image:
126
126
  linear-gradient(
127
- 45deg,
127
+ 90deg,
128
128
  var(--bui-color-primary-start) 0%,
129
129
  var(--bui-color-primary-end) 100%);
130
130
  }
@@ -132,7 +132,7 @@
132
132
  color: var(--bui-color-white);
133
133
  background-image:
134
134
  linear-gradient(
135
- 45deg,
135
+ 90deg,
136
136
  var(--bui-color-success-start) 0%,
137
137
  var(--bui-color-success-end) 100%);
138
138
  }
@@ -140,7 +140,7 @@
140
140
  color: var(--bui-color-white);
141
141
  background-image:
142
142
  linear-gradient(
143
- 45deg,
143
+ 90deg,
144
144
  var(--bui-color-info-start) 0%,
145
145
  var(--bui-color-info-end) 100%);
146
146
  }
@@ -148,7 +148,7 @@
148
148
  color: var(--bui-color-white);
149
149
  background-image:
150
150
  linear-gradient(
151
- 45deg,
151
+ 90deg,
152
152
  var(--bui-color-warning-start) 0%,
153
153
  var(--bui-color-warning-end) 100%);
154
154
  }
@@ -156,7 +156,7 @@
156
156
  color: var(--bui-color-white);
157
157
  background-image:
158
158
  linear-gradient(
159
- 45deg,
159
+ 90deg,
160
160
  var(--bui-color-danger-start) 0%,
161
161
  var(--bui-color-danger-end) 100%);
162
162
  }
@@ -114,7 +114,7 @@
114
114
  color: var(--bui-color-white);
115
115
  background-image:
116
116
  linear-gradient(
117
- 45deg,
117
+ 90deg,
118
118
  var(--bui-color-primary-start) 0%,
119
119
  var(--bui-color-primary-end) 100%);
120
120
  }
@@ -122,7 +122,7 @@
122
122
  color: var(--bui-color-white);
123
123
  background-image:
124
124
  linear-gradient(
125
- 45deg,
125
+ 90deg,
126
126
  var(--bui-color-success-start) 0%,
127
127
  var(--bui-color-success-end) 100%);
128
128
  }
@@ -130,7 +130,7 @@
130
130
  color: var(--bui-color-white);
131
131
  background-image:
132
132
  linear-gradient(
133
- 45deg,
133
+ 90deg,
134
134
  var(--bui-color-info-start) 0%,
135
135
  var(--bui-color-info-end) 100%);
136
136
  }
@@ -138,7 +138,7 @@
138
138
  color: var(--bui-color-white);
139
139
  background-image:
140
140
  linear-gradient(
141
- 45deg,
141
+ 90deg,
142
142
  var(--bui-color-warning-start) 0%,
143
143
  var(--bui-color-warning-end) 100%);
144
144
  }
@@ -146,7 +146,7 @@
146
146
  color: var(--bui-color-white);
147
147
  background-image:
148
148
  linear-gradient(
149
- 45deg,
149
+ 90deg,
150
150
  var(--bui-color-danger-start) 0%,
151
151
  var(--bui-color-danger-end) 100%);
152
152
  }
@@ -50,7 +50,7 @@ export type InputProps<D extends React.ElementType = 'div', P = {}> = OverridePr
50
50
  /**
51
51
  * 点击清除图标的回调,非受控状态也会清除输入框内容
52
52
  */
53
- onClear?: (e: React.SyntheticEvent) => void;
53
+ onClear?: (e: React.MouseEvent<HTMLDivElement>) => void;
54
54
  /**
55
55
  * 输入框内容变化时的回调
56
56
  */
@@ -60,11 +60,11 @@ export type InputProps<D extends React.ElementType = 'div', P = {}> = OverridePr
60
60
  /**
61
61
  * 聚焦时的回调
62
62
  */
63
- onFocus?: (e: React.SyntheticEvent) => void;
63
+ onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
64
64
  /**
65
65
  * 失焦时的回调
66
66
  */
67
- onBlur?: (e: React.SyntheticEvent) => void;
67
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
68
68
  };
69
69
  defaultComponent: D;
70
70
  }, D>;
@@ -12,5 +12,5 @@ declare const Modal: React.ForwardRefExoticComponent<Omit<ViewProps & {
12
12
  keepMounted?: boolean;
13
13
  } & import("@bifrostui/types").ICommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
14
14
  ref?: React.Ref<HTMLDivElement>;
15
- }, keyof import("@bifrostui/types").ICommonProps | "open" | "container" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ }, "open" | keyof import("@bifrostui/types").ICommonProps | "container" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
16
  export default Modal;
@@ -161,7 +161,10 @@ const Picker = /* @__PURE__ */ React.forwardRef((props, ref) => {
161
161
  }
162
162
  }
163
163
  };
164
- const handleSelect = (e, { columnIndex, columnOption }) => {
164
+ const handleSelect = (e, {
165
+ columnIndex,
166
+ columnOption
167
+ }) => {
165
168
  updateItem(e, columnOption, columnIndex);
166
169
  };
167
170
  const handleClose = (e, data) => {
@@ -11,11 +11,17 @@ export interface IPickerOptionItem {
11
11
  */
12
12
  value: string | number;
13
13
  }
14
+ export type ICascadePickerChildOptionItem = IPickerOptionItem & {
15
+ /**
16
+ * 用于级联选项,子节点可能没有children属性
17
+ */
18
+ children?: ICascadePickerChildOptionItem[];
19
+ };
14
20
  export type ICascadePickerOptionItem = IPickerOptionItem & {
15
21
  /**
16
- * 用于级联选项
22
+ * 用于级联选项,根节点必须含有children属性
17
23
  */
18
- children?: ICascadePickerOptionItem[];
24
+ children: ICascadePickerChildOptionItem[];
19
25
  };
20
26
  export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> = OverrideProps<{
21
27
  props: P & {
@@ -44,29 +50,29 @@ export type PickerProps<D extends React.ElementType = 'div', P = DrawerProps> =
44
50
  /**
45
51
  * 点击确认按钮时候回调
46
52
  */
47
- onConfirm?: (e: React.SyntheticEvent, data: {
53
+ onConfirm?: (e: React.MouseEvent<HTMLDivElement>, data: {
48
54
  value: (string | number)[];
49
- options: ICascadePickerOptionItem[];
55
+ options: ICascadePickerChildOptionItem[][];
50
56
  }) => void;
51
57
  /**
52
58
  * 选项值变更时的回调
53
59
  */
54
- onOptionChange?: (e: React.SyntheticEvent, data: {
60
+ onOptionChange?: (e: React.TransitionEvent<HTMLDivElement>, data: {
55
61
  value: (string | number)[];
56
- options: IPickerOptionItem[][] | ICascadePickerOptionItem[];
57
- currentOption: ICascadePickerOptionItem;
62
+ options: ICascadePickerChildOptionItem[][];
63
+ currentOption: ICascadePickerChildOptionItem;
58
64
  }) => void;
59
65
  /**
60
66
  * 点击取消按钮时候回调
61
67
  */
62
- onCancel?: (e: React.SyntheticEvent) => void;
68
+ onCancel?: (e: React.MouseEvent<HTMLDivElement>) => void;
63
69
  /**
64
70
  * 关闭选择器时执行
65
71
  */
66
- onClose?: (e: React.SyntheticEvent, data: {
72
+ onClose?: (e: React.MouseEvent<HTMLDivElement>, data: {
67
73
  from: string;
68
74
  value: (string | number)[];
69
- options: IPickerOptionItem[][] | ICascadePickerOptionItem[];
75
+ options: ICascadePickerChildOptionItem[][];
70
76
  }) => void;
71
77
  };
72
78
  defaultComponent: D;
@@ -77,7 +83,7 @@ export type PickerPanelProps<D extends React.ElementType = 'div', P = {}> = Over
77
83
  * 单列面板的列表数据
78
84
  * @default []
79
85
  */
80
- options?: IPickerOptionItem[][] | ICascadePickerOptionItem[];
86
+ options?: ICascadePickerChildOptionItem[];
81
87
  /**
82
88
  * 默认值
83
89
  */
@@ -93,8 +99,8 @@ export type PickerPanelProps<D extends React.ElementType = 'div', P = {}> = Over
93
99
  /**
94
100
  * 选择选项时的回调
95
101
  */
96
- onSelect?: (e: React.SyntheticEvent, data: {
97
- columnOption: IPickerOptionItem[] | ICascadePickerOptionItem;
102
+ onSelect?: (e: React.TransitionEvent<HTMLDivElement>, data: {
103
+ columnOption: ICascadePickerChildOptionItem;
98
104
  columnIndex: number;
99
105
  }) => void;
100
106
  };
@@ -1,4 +1,4 @@
1
- import { ICascadePickerOptionItem } from './Picker.types';
1
+ import { ICascadePickerOptionItem, ICascadePickerChildOptionItem } from './Picker.types';
2
2
  /**
3
3
  * 根据第一列数据判断选择器类型
4
4
  */
@@ -6,7 +6,7 @@ export declare const pickerPanelType: (options?: any[]) => "multiple" | "single"
6
6
  /**
7
7
  * 格式化级联模式数据
8
8
  */
9
- export declare const formatCascade: (columns: ICascadePickerOptionItem[], values?: (number | string)[]) => ICascadePickerOptionItem[][];
9
+ export declare const formatCascade: (columns: ICascadePickerOptionItem[], values?: (number | string)[]) => ICascadePickerChildOptionItem[][];
10
10
  /**
11
11
  * 统一options数据格式
12
12
  */
package/es/Tabs/Tabs.js CHANGED
@@ -52,7 +52,8 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
52
52
  const activeLineRef = useRef(null);
53
53
  const [lineData, setLineData] = useState({
54
54
  x: 0,
55
- transitionInUse: false
55
+ transitionInUse: false,
56
+ hasActiveTab: false
56
57
  });
57
58
  const [maskData, setMaskData] = useState({
58
59
  leftMaskOpacity: 0,
@@ -95,7 +96,8 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
95
96
  }
96
97
  setLineData({
97
98
  x,
98
- transitionInUse
99
+ transitionInUse,
100
+ hasActiveTab: !!activeTab
99
101
  });
100
102
  const maxScrollDistance = containerScrollWidth - containerWidth;
101
103
  if (maxScrollDistance <= 0 || !activeTab)
@@ -191,7 +193,7 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
191
193
  {
192
194
  ref: activeLineRef,
193
195
  className: clsx(`${prefixCls}-tabline`, {
194
- "bui-tabline-invisible": isMini || !lineData.x
196
+ "bui-tabline-invisible": isMini || !lineData.hasActiveTab
195
197
  }),
196
198
  style: {
197
199
  transition: lineData.transitionInUse ? "transform 0.25s ease-in-out" : void 0,
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.4",
4
4
  "description": "React components for building mobile application",
5
5
  "homepage": "http://bui.taopiaopiao.com",
6
6
  "license": "MIT",
@@ -33,10 +33,10 @@
33
33
  "clsx": "^1.2.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.4",
37
+ "@bifrostui/styles": "1.4.4",
38
+ "@bifrostui/types": "1.4.4",
39
+ "@bifrostui/utils": "1.4.4"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@tarojs/components": "^3.0.0",