@bifrostui/react 2.0.0-alpha.27 → 2.0.0-alpha.29

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.
@@ -57,6 +57,9 @@ const StackDemo = () => {
57
57
  {
58
58
  onClick: () => {
59
59
  setOpen((prev) => !prev);
60
+ },
61
+ style: {
62
+ marginBottom: "18px"
60
63
  }
61
64
  },
62
65
  open ? "Exit" : "Enter"
@@ -1,6 +1,3 @@
1
- .bui-btn {
2
- margin-bottom: 18px;
3
- }
4
1
  .slide-enter {
5
2
  transform: translate3d(-100%, 0, 0);
6
3
  }
@@ -177,7 +177,11 @@ const Calendar = /* @__PURE__ */ import_react.default.forwardRef(
177
177
  if (!(0, import_utils2.isEqualVal)(prevValueRef.current, value)) {
178
178
  const latestDate = formattedValue == null ? void 0 : formattedValue[0];
179
179
  const lastInitialValue = renderMonth;
180
- const inSameMonth = isRangeMode && selectedStartDate && selectedEndDate || latestDate && (0, import_dayjs.default)(latestDate).isSame(lastInitialValue, "month");
180
+ if (!latestDate) {
181
+ prevValueRef.current = value;
182
+ return;
183
+ }
184
+ const inSameMonth = isRangeMode ? selectedStartDate && (0, import_dayjs.default)(selectedStartDate).isSame(lastInitialValue, "month") || selectedEndDate && (0, import_dayjs.default)(selectedEndDate).isSame(lastInitialValue, "month") : latestDate && (0, import_dayjs.default)(latestDate).isSame(lastInitialValue, "month");
181
185
  if (!inSameMonth) {
182
186
  const latestBeforeThanLast = (0, import_dayjs.default)(latestDate).isBefore(
183
187
  lastInitialValue,
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { DatePickerProps } from './DatePicker.types';
3
- declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "defaultValue" | "value" | "onChange" | "onClose" | "onConfirm">>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "defaultValue" | "onChange" | "value" | "onClose" | "onConfirm">>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  export default DatePicker;
@@ -33,11 +33,11 @@ export interface DialogProps extends Omit<ModalProps, 'title' | 'content'> {
33
33
  /**
34
34
  * 透传给内部Button组件的属性
35
35
  */
36
- okButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, string>;
36
+ okButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, any>;
37
37
  /**
38
38
  * 透传给内部Button组件的属性
39
39
  */
40
- cancelButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, string>;
40
+ cancelButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, any>;
41
41
  /**
42
42
  * 确认按钮文本内容
43
43
  */
@@ -80,6 +80,10 @@ export type DialogOptions = Omit<DialogProps, 'placeholder' | 'inputProps' | 'on
80
80
  * 取消回调
81
81
  */
82
82
  onCancel?: (e: React.SyntheticEvent) => void;
83
+ /**
84
+ * 透传 data- 属性
85
+ */
86
+ [key: `data-${string}`]: any;
83
87
  };
84
88
  /**
85
89
  * prompt函数式调用配置参数
@@ -43,6 +43,7 @@ xhs-page {
43
43
  }
44
44
  .bui-dialog-actions {
45
45
  display: flex;
46
+ flex-direction: row;
46
47
  align-items: center;
47
48
  justify-content: center;
48
49
  }
@@ -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" | "BackdropProps" | "onClose" | "keepMounted" | "disablePortal" | "hideBackdrop" | "disableScrollLock">, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ }, keyof import("@bifrostui/types").ICommonProps | "open" | "container" | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
16
  export default Modal;
@@ -7,6 +7,7 @@ xhs-page {
7
7
  }
8
8
  .bui-radio {
9
9
  display: inline-flex;
10
+ flex-direction: row;
10
11
  align-items: center;
11
12
  position: relative;
12
13
  font-family: var(--bui-font-family);
@@ -174,7 +174,9 @@ const Swiper = (0, import_react.forwardRef)((props, ref) => {
174
174
  spaceBetween
175
175
  }, others), {
176
176
  onSwiper: (o) => {
177
+ var _a2;
177
178
  swiperInstance.current = o;
179
+ (_a2 = props.onSwiper) == null ? void 0 : _a2.call(props, o);
178
180
  },
179
181
  style: __spreadProps(__spreadValues({}, sty), {
180
182
  "--indicator-color": defaultIndicatorColor,
package/dist/Tabs/Tabs.js CHANGED
@@ -153,7 +153,9 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
153
153
  if (!tabsEl)
154
154
  return void 0;
155
155
  const checkScrollable = () => {
156
- setIsScrollable(tabsEl.scrollWidth > tabsEl.offsetWidth);
156
+ const { scrollWidth = 0, offsetWidth = 0 } = tabsEl;
157
+ const isOverflow = scrollWidth - offsetWidth > 1;
158
+ setIsScrollable(isOverflow);
157
159
  };
158
160
  checkScrollable();
159
161
  if (typeof ResizeObserver === "undefined") {
@@ -100,7 +100,7 @@ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
100
100
  const lastScrollLeftRef = import_react.default.useRef(0);
101
101
  const isFirstScroll = import_react.default.useRef(true);
102
102
  const [scrollWithAnimation, setScrollWithAnimation] = import_react.default.useState(false);
103
- const isScrollable = scrollWidth > containerWidth;
103
+ const isScrollable = scrollWidth - containerWidth > 1;
104
104
  if (process.env.NODE_ENV !== "production") {
105
105
  if (tabs.length > 0 && import_react.default.Children.count(children) > 0) {
106
106
  console.warn(
@@ -15,10 +15,13 @@ xhs-page {
15
15
  }
16
16
  .bui-toast {
17
17
  position: fixed;
18
- left: 50%;
18
+ left: 0;
19
+ right: 0;
20
+ margin: 0 auto;
19
21
  z-index: var(--bui-z-index-toast);
20
22
  min-width: var(--bui-toast-min-width);
21
23
  max-width: var(--bui-toast-max-width);
24
+ width: fit-content;
22
25
  padding: var(--bui-toast-padding);
23
26
  font-size: var(--bui-text-size-1);
24
27
  color: var(--bui-color-white);
@@ -31,20 +34,19 @@ xhs-page {
31
34
  }
32
35
  .bui-toast.bui-toast-allow-click {
33
36
  position: fixed;
34
- right: unset;
35
37
  bottom: unset;
36
38
  }
37
39
  .bui-toast-center {
38
40
  top: 50%;
39
- transform: translate(-50%, -50%);
41
+ transform: translateY(-50%);
40
42
  }
41
43
  .bui-toast-top {
42
44
  top: var(--bui-toast-position-top);
43
- transform: translate(-50%, calc(-1 * var(--bui-toast-position-top)));
45
+ transform: translateY(calc(-1 * var(--bui-toast-position-top)));
44
46
  }
45
47
  .bui-toast-bottom {
46
48
  top: var(--bui-toast-position-bottom);
47
- transform: translate(-50%, calc(-1 * var(--bui-toast-position-bottom)));
49
+ transform: translateY(calc(-1 * var(--bui-toast-position-bottom)));
48
50
  }
49
51
  .bui-toast-icon {
50
52
  display: flex;
@@ -25,6 +25,9 @@ const StackDemo = () => {
25
25
  {
26
26
  onClick: () => {
27
27
  setOpen((prev) => !prev);
28
+ },
29
+ style: {
30
+ marginBottom: "18px"
28
31
  }
29
32
  },
30
33
  open ? "Exit" : "Enter"
@@ -1,6 +1,3 @@
1
- .bui-btn {
2
- margin-bottom: 18px;
3
- }
4
1
  .slide-enter {
5
2
  transform: translate3d(-100%, 0, 0);
6
3
  }
@@ -147,7 +147,11 @@ const Calendar = /* @__PURE__ */ React.forwardRef(
147
147
  if (!isEqualVal(prevValueRef.current, value)) {
148
148
  const latestDate = formattedValue == null ? void 0 : formattedValue[0];
149
149
  const lastInitialValue = renderMonth;
150
- const inSameMonth = isRangeMode && selectedStartDate && selectedEndDate || latestDate && dayjs(latestDate).isSame(lastInitialValue, "month");
150
+ if (!latestDate) {
151
+ prevValueRef.current = value;
152
+ return;
153
+ }
154
+ const inSameMonth = isRangeMode ? selectedStartDate && dayjs(selectedStartDate).isSame(lastInitialValue, "month") || selectedEndDate && dayjs(selectedEndDate).isSame(lastInitialValue, "month") : latestDate && dayjs(latestDate).isSame(lastInitialValue, "month");
151
155
  if (!inSameMonth) {
152
156
  const latestBeforeThanLast = dayjs(latestDate).isBefore(
153
157
  lastInitialValue,
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { DatePickerProps } from './DatePicker.types';
3
- declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "defaultValue" | "onChange" | "value" | "onClose" | "onConfirm">>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps<"div", Omit<import("../Picker").PickerProps<"div", import("..").DrawerProps>, "value" | "defaultValue" | "onChange" | "onClose" | "onConfirm">>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  export default DatePicker;
@@ -33,11 +33,11 @@ export interface DialogProps extends Omit<ModalProps, 'title' | 'content'> {
33
33
  /**
34
34
  * 透传给内部Button组件的属性
35
35
  */
36
- okButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, string>;
36
+ okButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, any>;
37
37
  /**
38
38
  * 透传给内部Button组件的属性
39
39
  */
40
- cancelButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, string>;
40
+ cancelButtonProps?: Partial<ButtonProps> & Record<`data-${string}`, any>;
41
41
  /**
42
42
  * 确认按钮文本内容
43
43
  */
@@ -80,6 +80,10 @@ export type DialogOptions = Omit<DialogProps, 'placeholder' | 'inputProps' | 'on
80
80
  * 取消回调
81
81
  */
82
82
  onCancel?: (e: React.SyntheticEvent) => void;
83
+ /**
84
+ * 透传 data- 属性
85
+ */
86
+ [key: `data-${string}`]: any;
83
87
  };
84
88
  /**
85
89
  * prompt函数式调用配置参数
@@ -43,6 +43,7 @@ xhs-page {
43
43
  }
44
44
  .bui-dialog-actions {
45
45
  display: flex;
46
+ flex-direction: row;
46
47
  align-items: center;
47
48
  justify-content: center;
48
49
  }
@@ -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
- }, "open" | "container" | "disableScrollLock" | "onClose" | keyof import("@bifrostui/types").ICommonProps | "BackdropProps" | "disablePortal" | "keepMounted" | "hideBackdrop">, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
+ }, "open" | "container" | keyof import("@bifrostui/types").ICommonProps | "disablePortal" | "hideBackdrop" | "BackdropProps" | "onClose" | "disableScrollLock" | "keepMounted">, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
16
  export default Modal;
@@ -7,6 +7,7 @@ xhs-page {
7
7
  }
8
8
  .bui-radio {
9
9
  display: inline-flex;
10
+ flex-direction: row;
10
11
  align-items: center;
11
12
  position: relative;
12
13
  font-family: var(--bui-font-family);
@@ -148,7 +148,9 @@ const Swiper = forwardRef((props, ref) => {
148
148
  spaceBetween
149
149
  }, others), {
150
150
  onSwiper: (o) => {
151
+ var _a2;
151
152
  swiperInstance.current = o;
153
+ (_a2 = props.onSwiper) == null ? void 0 : _a2.call(props, o);
152
154
  },
153
155
  style: __spreadProps(__spreadValues({}, sty), {
154
156
  "--indicator-color": defaultIndicatorColor,
package/es/Tabs/Tabs.js CHANGED
@@ -123,7 +123,9 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
123
123
  if (!tabsEl)
124
124
  return void 0;
125
125
  const checkScrollable = () => {
126
- setIsScrollable(tabsEl.scrollWidth > tabsEl.offsetWidth);
126
+ const { scrollWidth = 0, offsetWidth = 0 } = tabsEl;
127
+ const isOverflow = scrollWidth - offsetWidth > 1;
128
+ setIsScrollable(isOverflow);
127
129
  };
128
130
  checkScrollable();
129
131
  if (typeof ResizeObserver === "undefined") {
@@ -75,7 +75,7 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
75
75
  const lastScrollLeftRef = React.useRef(0);
76
76
  const isFirstScroll = React.useRef(true);
77
77
  const [scrollWithAnimation, setScrollWithAnimation] = React.useState(false);
78
- const isScrollable = scrollWidth > containerWidth;
78
+ const isScrollable = scrollWidth - containerWidth > 1;
79
79
  if (process.env.NODE_ENV !== "production") {
80
80
  if (tabs.length > 0 && React.Children.count(children) > 0) {
81
81
  console.warn(
@@ -15,10 +15,13 @@ xhs-page {
15
15
  }
16
16
  .bui-toast {
17
17
  position: fixed;
18
- left: 50%;
18
+ left: 0;
19
+ right: 0;
20
+ margin: 0 auto;
19
21
  z-index: var(--bui-z-index-toast);
20
22
  min-width: var(--bui-toast-min-width);
21
23
  max-width: var(--bui-toast-max-width);
24
+ width: fit-content;
22
25
  padding: var(--bui-toast-padding);
23
26
  font-size: var(--bui-text-size-1);
24
27
  color: var(--bui-color-white);
@@ -31,20 +34,19 @@ xhs-page {
31
34
  }
32
35
  .bui-toast.bui-toast-allow-click {
33
36
  position: fixed;
34
- right: unset;
35
37
  bottom: unset;
36
38
  }
37
39
  .bui-toast-center {
38
40
  top: 50%;
39
- transform: translate(-50%, -50%);
41
+ transform: translateY(-50%);
40
42
  }
41
43
  .bui-toast-top {
42
44
  top: var(--bui-toast-position-top);
43
- transform: translate(-50%, calc(-1 * var(--bui-toast-position-top)));
45
+ transform: translateY(calc(-1 * var(--bui-toast-position-top)));
44
46
  }
45
47
  .bui-toast-bottom {
46
48
  top: var(--bui-toast-position-bottom);
47
- transform: translate(-50%, calc(-1 * var(--bui-toast-position-bottom)));
49
+ transform: translateY(calc(-1 * var(--bui-toast-position-bottom)));
48
50
  }
49
51
  .bui-toast-icon {
50
52
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bifrostui/react",
3
- "version": "2.0.0-alpha.27",
3
+ "version": "2.0.0-alpha.29",
4
4
  "description": "React components for building mobile application",
5
5
  "homepage": "http://bui.taopiaopiao.com",
6
6
  "license": "MIT",
@@ -43,10 +43,10 @@
43
43
  "clsx": "^2.1.1",
44
44
  "dayjs": "^1.11.7",
45
45
  "swiper": "^8.1.5",
46
- "@bifrostui/styles": "2.0.0-alpha.27",
47
- "@bifrostui/icons": "2.0.0-alpha.27",
48
- "@bifrostui/types": "2.0.0-alpha.27",
49
- "@bifrostui/utils": "2.0.0-alpha.27"
46
+ "@bifrostui/icons": "2.0.0-alpha.29",
47
+ "@bifrostui/styles": "2.0.0-alpha.29",
48
+ "@bifrostui/types": "2.0.0-alpha.29",
49
+ "@bifrostui/utils": "2.0.0-alpha.29"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@tarojs/components": "^3.0.0",