tek-wallet 0.0.491 → 0.0.492
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.
|
@@ -8,6 +8,7 @@ interface SwiperControlledProps extends GeneralProps {
|
|
|
8
8
|
swiperProps?: SwiperProps;
|
|
9
9
|
disableSwipe?: boolean;
|
|
10
10
|
swiperStyle?: Record<string, string | number>;
|
|
11
|
+
tabParamName?: string;
|
|
11
12
|
}
|
|
12
13
|
export interface SwiperControlledRef {
|
|
13
14
|
slideTo: (index: number) => void;
|
|
@@ -19,14 +19,25 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
}
|
|
20
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
21
|
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
22
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
26
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
24
27
|
var react_1 = require("swiper/react");
|
|
25
28
|
var react_2 = require("react");
|
|
26
29
|
var material_1 = require("@mui/material");
|
|
30
|
+
var navigation_1 = require("next/navigation");
|
|
31
|
+
var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
|
|
32
|
+
var navigation_2 = require("next/navigation");
|
|
27
33
|
var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
|
|
28
|
-
var _a = (0, react_2.useState)(props.initialActiveTab || 0), activeTab = _a[0], setActiveTab = _a[1];
|
|
29
34
|
var swiperRef = (0, react_2.useRef)(null);
|
|
35
|
+
var router = (0, useCustomRouter_1.default)();
|
|
36
|
+
var pathname = (0, navigation_2.usePathname)();
|
|
37
|
+
var searchParams = (0, navigation_1.useSearchParams)();
|
|
38
|
+
var tabParamName = props.tabParamName || "swiper-controlled-tab";
|
|
39
|
+
var initialTab = searchParams.get(tabParamName);
|
|
40
|
+
var _a = (0, react_2.useState)(initialTab ? +initialTab : props.initialActiveTab || 0), activeTab = _a[0], setActiveTab = _a[1];
|
|
30
41
|
var slideTo = function (index) {
|
|
31
42
|
var _a, _b;
|
|
32
43
|
setActiveTab(index);
|
|
@@ -52,11 +63,13 @@ var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
|
|
|
52
63
|
}); });
|
|
53
64
|
var handleSlideChange = function (swiper) {
|
|
54
65
|
setActiveTab(swiper.activeIndex);
|
|
66
|
+
router.replace("".concat(pathname, "?").concat(tabParamName, "=").concat(swiper.activeIndex));
|
|
55
67
|
};
|
|
56
68
|
var handleTabChange = function (event, value) {
|
|
57
69
|
var _a, _b;
|
|
58
70
|
setActiveTab(value);
|
|
59
71
|
(_b = (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(value);
|
|
72
|
+
router.replace("".concat(pathname, "?").concat(tabParamName, "=").concat(value));
|
|
60
73
|
};
|
|
61
74
|
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ width: "100%", display: "flex", flexDirection: "column" }, props.sx), children: [props.tabs && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
62
75
|
maxWidth: "100%",
|