tek-wallet 0.0.143 → 0.0.145

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.
@@ -61,34 +61,30 @@ var DepositFunction = (0, react_1.forwardRef)(function (props, ref) {
61
61
  var _a;
62
62
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
63
63
  };
64
+ (0, react_1.useImperativeHandle)(ref, function () { return ({
65
+ open: open,
66
+ close: close,
67
+ }); });
64
68
  var handleBack = function () {
65
69
  var _a;
66
70
  (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.prev();
67
71
  setCurrentStep(currentStep - 1);
68
72
  };
69
- (0, react_1.useImperativeHandle)(ref, function () { return ({
70
- open: open,
71
- close: close,
72
- }); });
73
- var handleSelectToken = function (token) {
73
+ var nextStep = function () {
74
74
  var _a;
75
+ (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.next();
76
+ setCurrentStep(function (prev) { return prev + 1; });
77
+ };
78
+ var handleSelectToken = function (token) {
75
79
  setSelectedToken(token);
76
80
  if (!!token) {
77
- (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.next();
81
+ nextStep();
78
82
  }
79
83
  };
80
- return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: props.onClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { overrideBack: handleBack, hideBack: currentStep === DepositStep.SELECT_TOKEN, children: (0, jsx_runtime_1.jsx)(ModalTitle_1.default, { children: DEPOSIT_STEP_NAME[currentStep] }) }), onClose: close, children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: { autoHeight: true }, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
81
- display: "flex",
82
- flexDirection: "column",
83
- gap: theme.mixins.gaps.g16,
84
- }, children: tokens === null || tokens === void 0 ? void 0 : tokens.map(function (item) {
84
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: props.onClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { title: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { overrideBack: handleBack, hideBack: currentStep === DepositStep.SELECT_TOKEN, children: (0, jsx_runtime_1.jsx)(ModalTitle_1.default, { children: DEPOSIT_STEP_NAME[currentStep] }) }), onClose: close, children: (0, jsx_runtime_1.jsxs)(SwiperControlled_1.default, { ref: swiperRef, swiperProps: { autoHeight: true }, children: [(0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12, height: "fit-content" }), children: tokens === null || tokens === void 0 ? void 0 : tokens.map(function (item) {
85
85
  var stringifiedTokenData = JSON.stringify(__assign(__assign({}, item), { name: "Fake", fullname: "Fake fullname" }));
86
86
  return ((0, jsx_runtime_1.jsx)(TokenSelection_1.default, { onClick: handleSelectToken, tokenData: stringifiedTokenData, active: (selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.id) != "kf" }, item.id));
87
- }) }) }, DepositStep.SELECT_TOKEN), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
88
- display: "flex",
89
- alignItems: "center",
90
- gap: theme.mixins.gaps.g12,
91
- }, children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function (item) {
87
+ }) }) }, DepositStep.SELECT_TOKEN), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(function (item) {
92
88
  return ((0, jsx_runtime_1.jsx)(NetworkSelection_1.default, { networkData: JSON.stringify({
93
89
  name: "network ".concat(item),
94
90
  icon: "https://via.placeholder.com/150",
@@ -6,6 +6,7 @@ interface SwiperControlledProps extends GeneralProps {
6
6
  tabsClassName?: string;
7
7
  swiperProps?: SwiperProps;
8
8
  disableSwipe?: boolean;
9
+ swiperStyle?: React.StyleHTMLAttributes<HTMLDivElement>;
9
10
  }
10
11
  export interface SwiperControlledRef {
11
12
  slideTo: (index: number) => void;
@@ -53,10 +53,7 @@ var SwiperControlled = (0, react_2.forwardRef)(function (props, ref) {
53
53
  setActiveTab(value);
54
54
  (_b = (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideTo(value);
55
55
  };
56
- 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.jsxs)(material_1.Tabs, { value: activeTab, onChange: handleTabChange, children: __spreadArray([], props.tabs, true) })), (0, jsx_runtime_1.jsx)(react_1.Swiper, __assign({}, props.swiperProps, { onSlideChange: handleSlideChange, ref: swiperRef, initialSlide: activeTab, style: {
57
- width: "100%",
58
- flex: 1,
59
- }, allowTouchMove: !props.disableSwipe, children: props.children }))] }));
56
+ 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.jsxs)(material_1.Tabs, { value: activeTab, onChange: handleTabChange, children: __spreadArray([], props.tabs, true) })), (0, jsx_runtime_1.jsx)(react_1.Swiper, __assign({}, props.swiperProps, { onSlideChange: handleSlideChange, ref: swiperRef, initialSlide: activeTab, style: __assign({ width: "100%" }, props.swiperStyle), allowTouchMove: !props.disableSwipe, children: props.children }))] }));
60
57
  });
61
58
  SwiperControlled.displayName = "SwiperControlled";
62
59
  exports.default = SwiperControlled;
@@ -36,6 +36,10 @@ var TokenSelection = function (props) {
36
36
  var tokenDataString = props.tokenData, sx = props.sx, rest = __rest(props, ["tokenData", "sx"]);
37
37
  var theme = (0, material_1.useTheme)();
38
38
  var tokenData = (0, react_1.useMemo)(function () { return (0, parsePropsData_1.default)(tokenDataString); }, [tokenDataString]);
39
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ onClick: function () { var _a; return (_a = props === null || props === void 0 ? void 0 : props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, tokenData); }, sx: __assign({ backgroundColor: "background.white16", border: "1px solid", borderColor: props.active ? "border.secondary" : "transparent", borderRadius: theme.mixins.theBorderRadius.r12, padding: theme.mixins.customPadding.p12, display: "flex", alignItems: "center", cursor: "pointer" }, sx) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.column), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.value, children: tokenData === null || tokenData === void 0 ? void 0 : tokenData.name }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.valueDescription, children: "tokenData.name" })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { marginLeft: "auto" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.value, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 20000 }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.valueDescription, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 2000 }) })] })] })));
39
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box
40
+ // onClick={() => props?.onClick?.(tokenData)}
41
+ , __assign({
42
+ // onClick={() => props?.onClick?.(tokenData)}
43
+ sx: __assign({ backgroundColor: "background.white16", border: "1px solid", borderColor: props.active ? "border.secondary" : "transparent", borderRadius: theme.mixins.theBorderRadius.r12, padding: theme.mixins.customPadding.p12, display: "flex", alignItems: "center", cursor: "pointer" }, sx) }, rest, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.column), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.value, children: tokenData === null || tokenData === void 0 ? void 0 : tokenData.name }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.valueDescription, children: "tokenData.name" })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { marginLeft: "auto" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.value, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 20000 }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: theme.mixins.valueDescription, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 2000 }) })] })] })));
40
44
  };
41
45
  exports.default = TokenSelection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.143",
3
+ "version": "0.0.145",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",