@bifrostui/react 2.0.0-alpha.17 → 2.0.0-alpha.19
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/dist/Modal/Modal.miniapp.d.ts +1 -1
- package/dist/Tabs/TabIndicator.d.ts +0 -2
- package/dist/Tabs/TabIndicator.js +83 -37
- package/dist/Tabs/TabMask.d.ts +2 -4
- package/dist/Tabs/TabMask.js +12 -53
- package/dist/Tabs/Tabs.css +1 -1
- package/dist/Tabs/Tabs.js +17 -6
- package/dist/Tabs/index.css +1 -1
- package/dist/Tabs/miniapp/TabIndicator.js +109 -14
- package/dist/Tabs/miniapp/Tabs.js +12 -36
- package/es/Modal/Modal.miniapp.d.ts +1 -1
- package/es/Tabs/TabIndicator.d.ts +0 -2
- package/es/Tabs/TabIndicator.js +84 -38
- package/es/Tabs/TabMask.d.ts +2 -4
- package/es/Tabs/TabMask.js +13 -54
- package/es/Tabs/Tabs.css +1 -1
- package/es/Tabs/Tabs.js +18 -7
- package/es/Tabs/index.css +1 -1
- package/es/Tabs/miniapp/TabIndicator.js +110 -15
- package/es/Tabs/miniapp/Tabs.js +12 -36
- package/package.json +5 -5
- package/dist/Tabs/miniapp/TabMask.d.ts +0 -13
- package/dist/Tabs/miniapp/TabMask.js +0 -66
- package/es/Tabs/miniapp/TabMask.d.ts +0 -13
- package/es/Tabs/miniapp/TabMask.js +0 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifrostui/react",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.19",
|
|
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/
|
|
47
|
-
"@bifrostui/
|
|
48
|
-
"@bifrostui/
|
|
49
|
-
"@bifrostui/utils": "2.0.0-alpha.
|
|
46
|
+
"@bifrostui/icons": "2.0.0-alpha.19",
|
|
47
|
+
"@bifrostui/styles": "2.0.0-alpha.19",
|
|
48
|
+
"@bifrostui/types": "2.0.0-alpha.19",
|
|
49
|
+
"@bifrostui/utils": "2.0.0-alpha.19"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@tarojs/components": "^3.0.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface TabMaskProps {
|
|
3
|
-
/** 位置:左侧或右侧 */
|
|
4
|
-
position: 'left' | 'right';
|
|
5
|
-
/** 当前滚动位置 */
|
|
6
|
-
scrollLeft: number;
|
|
7
|
-
/** 容器宽度 */
|
|
8
|
-
containerWidth: number;
|
|
9
|
-
/** 滚动区域总宽度 */
|
|
10
|
-
scrollWidth: number;
|
|
11
|
-
}
|
|
12
|
-
declare const _default: React.NamedExoticComponent<TabMaskProps>;
|
|
13
|
-
export default _default;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var TabMask_exports = {};
|
|
29
|
-
__export(TabMask_exports, {
|
|
30
|
-
default: () => TabMask_default
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(TabMask_exports);
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_clsx = __toESM(require("clsx"));
|
|
35
|
-
var import_classes = require("../classes");
|
|
36
|
-
const TabMask = ({
|
|
37
|
-
position,
|
|
38
|
-
scrollLeft,
|
|
39
|
-
containerWidth,
|
|
40
|
-
scrollWidth
|
|
41
|
-
}) => {
|
|
42
|
-
const shouldShow = import_react.default.useMemo(() => {
|
|
43
|
-
if (position === "left") {
|
|
44
|
-
return scrollLeft > 0;
|
|
45
|
-
}
|
|
46
|
-
const rightRange = Math.abs(scrollWidth - (scrollLeft + containerWidth));
|
|
47
|
-
return rightRange > 1;
|
|
48
|
-
}, [position, scrollLeft, containerWidth, scrollWidth]);
|
|
49
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
-
"div",
|
|
51
|
-
{
|
|
52
|
-
className: (0, import_clsx.default)(
|
|
53
|
-
import_classes.tabMaskClass,
|
|
54
|
-
position === "left" ? import_classes.tabMaskLeftClass : import_classes.tabMaskRightClass
|
|
55
|
-
),
|
|
56
|
-
style: {
|
|
57
|
-
opacity: shouldShow ? 1 : 0,
|
|
58
|
-
transition: "opacity 0.1s ease-in-out"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
TabMask.displayName = "BuiTabsMask";
|
|
64
|
-
var TabMask_default = /* @__PURE__ */ import_react.default.memo(TabMask, (prevProps, nextProps) => {
|
|
65
|
-
return prevProps.position === nextProps.position && prevProps.scrollLeft === nextProps.scrollLeft && prevProps.containerWidth === nextProps.containerWidth && prevProps.scrollWidth === nextProps.scrollWidth;
|
|
66
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface TabMaskProps {
|
|
3
|
-
/** 位置:左侧或右侧 */
|
|
4
|
-
position: 'left' | 'right';
|
|
5
|
-
/** 当前滚动位置 */
|
|
6
|
-
scrollLeft: number;
|
|
7
|
-
/** 容器宽度 */
|
|
8
|
-
containerWidth: number;
|
|
9
|
-
/** 滚动区域总宽度 */
|
|
10
|
-
scrollWidth: number;
|
|
11
|
-
}
|
|
12
|
-
declare const _default: React.NamedExoticComponent<TabMaskProps>;
|
|
13
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { tabMaskClass, tabMaskLeftClass, tabMaskRightClass } from "../classes";
|
|
4
|
-
const TabMask = ({
|
|
5
|
-
position,
|
|
6
|
-
scrollLeft,
|
|
7
|
-
containerWidth,
|
|
8
|
-
scrollWidth
|
|
9
|
-
}) => {
|
|
10
|
-
const shouldShow = React.useMemo(() => {
|
|
11
|
-
if (position === "left") {
|
|
12
|
-
return scrollLeft > 0;
|
|
13
|
-
}
|
|
14
|
-
const rightRange = Math.abs(scrollWidth - (scrollLeft + containerWidth));
|
|
15
|
-
return rightRange > 1;
|
|
16
|
-
}, [position, scrollLeft, containerWidth, scrollWidth]);
|
|
17
|
-
return /* @__PURE__ */ React.createElement(
|
|
18
|
-
"div",
|
|
19
|
-
{
|
|
20
|
-
className: clsx(
|
|
21
|
-
tabMaskClass,
|
|
22
|
-
position === "left" ? tabMaskLeftClass : tabMaskRightClass
|
|
23
|
-
),
|
|
24
|
-
style: {
|
|
25
|
-
opacity: shouldShow ? 1 : 0,
|
|
26
|
-
transition: "opacity 0.1s ease-in-out"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
TabMask.displayName = "BuiTabsMask";
|
|
32
|
-
var TabMask_default = /* @__PURE__ */ React.memo(TabMask, (prevProps, nextProps) => {
|
|
33
|
-
return prevProps.position === nextProps.position && prevProps.scrollLeft === nextProps.scrollLeft && prevProps.containerWidth === nextProps.containerWidth && prevProps.scrollWidth === nextProps.scrollWidth;
|
|
34
|
-
});
|
|
35
|
-
export {
|
|
36
|
-
TabMask_default as default
|
|
37
|
-
};
|