tek-wallet 0.0.536 → 0.0.538
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.
|
@@ -54,6 +54,7 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
54
54
|
var theme = (0, material_1.useTheme)();
|
|
55
55
|
var swiperRef = (0, react_1.useRef)(null);
|
|
56
56
|
var activityTypes = (0, useActivities_1.default)().activityTypes;
|
|
57
|
+
var _a = (0, react_1.useState)(0), activeTab = _a[0], setActiveTab = _a[1];
|
|
57
58
|
var open = function () {
|
|
58
59
|
var _a;
|
|
59
60
|
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
@@ -82,10 +83,14 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
82
83
|
close();
|
|
83
84
|
handleOnClose();
|
|
84
85
|
};
|
|
86
|
+
var handleSlideChange = function (index) {
|
|
87
|
+
console.warn("🚀 ~ handleSlideChange ~ index:", index);
|
|
88
|
+
setActiveTab(index);
|
|
89
|
+
};
|
|
85
90
|
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { disableSwipe: true, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities", overrideBack: handleBack }), children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: { height: "100%", paddingTop: 0 }, children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { ref: swiperRef, tabParamName: "activity-tab", swiperProps: {
|
|
86
91
|
slidesPerView: 1,
|
|
87
92
|
spaceBetween: 40,
|
|
88
|
-
}, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
93
|
+
}, onTabChange: handleSlideChange, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
89
94
|
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: type.name, value: index, "data-index": index, sx: {
|
|
90
95
|
padding: "".concat(theme.mixins.customPadding.p8, " ").concat(theme.mixins.customPadding.p16),
|
|
91
96
|
minHeight: "unset",
|
|
@@ -105,7 +110,7 @@ var Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
105
110
|
}, children: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
106
111
|
return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: {
|
|
107
112
|
position: "relative",
|
|
108
|
-
}, children: (0, jsx_runtime_1.jsx)(ActivitiesTypeSlice_1.default, { type: type, isActive:
|
|
113
|
+
}, children: (0, jsx_runtime_1.jsx)(ActivitiesTypeSlice_1.default, { type: type, isActive: activeTab === index }) }, index));
|
|
109
114
|
}) }) }) }) }) }));
|
|
110
115
|
});
|
|
111
116
|
Activities.displayName = "Activities";
|
|
@@ -9,6 +9,7 @@ interface SwiperControlledProps extends GeneralProps {
|
|
|
9
9
|
disableSwipe?: boolean;
|
|
10
10
|
swiperStyle?: Record<string, string | number>;
|
|
11
11
|
tabParamName?: string;
|
|
12
|
+
onTabChange?: (index: number) => void;
|
|
12
13
|
}
|
|
13
14
|
export interface SwiperControlledRef {
|
|
14
15
|
slideTo: (index: number) => void;
|
|
@@ -40,9 +40,17 @@ var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
|
|
|
40
40
|
var tabParamName = props.tabParamName || "";
|
|
41
41
|
var initialTab = searchParams.get(tabParamName);
|
|
42
42
|
var _a = (0, react_2.useState)(initialTab ? +initialTab : props.initialActiveTab || 0), activeTab = _a[0], setActiveTab = _a[1];
|
|
43
|
+
var onTabChange = function (index) {
|
|
44
|
+
var _a;
|
|
45
|
+
setActiveTab(index);
|
|
46
|
+
(_a = props.onTabChange) === null || _a === void 0 ? void 0 : _a.call(props, index);
|
|
47
|
+
};
|
|
48
|
+
(0, react_2.useEffect)(function () {
|
|
49
|
+
onTabChange(activeTab);
|
|
50
|
+
}, []);
|
|
43
51
|
var slideTo = function (index) {
|
|
44
52
|
var _a, _b;
|
|
45
|
-
|
|
53
|
+
onTabChange(index);
|
|
46
54
|
(_b = (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(index);
|
|
47
55
|
};
|
|
48
56
|
var next = function () {
|
|
@@ -71,12 +79,12 @@ var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
|
|
|
71
79
|
router.replace("".concat(pathname, "?").concat(params.toString()));
|
|
72
80
|
};
|
|
73
81
|
var handleSlideChange = function (swiper) {
|
|
74
|
-
|
|
82
|
+
onTabChange(swiper.activeIndex);
|
|
75
83
|
rememberTabDeBounce(function () { return rememberTab(swiper.activeIndex); });
|
|
76
84
|
};
|
|
77
85
|
var handleTabChange = function (event, value) {
|
|
78
86
|
var _a, _b;
|
|
79
|
-
|
|
87
|
+
onTabChange(value);
|
|
80
88
|
(_b = (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(value);
|
|
81
89
|
rememberTabDeBounce(function () { return rememberTab(value); });
|
|
82
90
|
};
|
package/dist/utils/formatDate.js
CHANGED