tek-wallet 0.0.232 → 0.0.233

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.
@@ -1,6 +1,7 @@
1
+ import { TextFieldProps } from "@mui/material";
1
2
  interface InputProps {
2
3
  className?: string;
3
- inputRest?: React.InputHTMLAttributes<HTMLInputElement>;
4
+ inputRest?: TextFieldProps;
4
5
  inputStyles?: React.CSSProperties;
5
6
  leftPart?: React.ReactNode;
6
7
  rightPart?: React.ReactNode;
@@ -28,7 +28,10 @@ var react_1 = require("react");
28
28
  var Input = (0, react_1.forwardRef)(function (props, inputRef) {
29
29
  var inputRest = props.inputRest, inputClassName = props.inputStyles, leftPart = props.leftPart, rightPart = props.rightPart, rest = __rest(props, ["inputRest", "inputStyles", "leftPart", "rightPart"]);
30
30
  var theme = (0, material_1.useTheme)();
31
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: inputRef, sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12, borderRadius: theme.mixins.theBorderRadius.r12, padding: theme.mixins.customPadding.p3, backgroundColor: "background.white16" }) }, rest, { children: [leftPart, (0, jsx_runtime_1.jsx)("input", __assign({}, inputRest, { style: __assign({ backgroundColor: "transparent", border: "none", outline: "none", fontSize: theme.typography.fontSize16, lineHeight: theme.typography.leading140, fontWeight: theme.typography.fontWeight400, color: theme.palette.text.white }, inputClassName) })), rightPart] })));
31
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: inputRef, sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12, borderRadius: theme.mixins.theBorderRadius.r12, px: theme.mixins.customPadding.p16, backgroundColor: "background.white16", border: "1px solid ".concat(theme.palette.border.white24), backdropFilter: "blur(10px)" }) }, rest, { children: [leftPart, (0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, inputRest, { variant: "outlined", sx: __assign({ backgroundColor: "transparent", border: "none", outline: "none", fontSize: theme.typography.fontSize16, lineHeight: theme.typography.leading140, fontWeight: theme.typography.fontWeight400, color: theme.palette.text.white, py: theme.mixins.customPadding.p12, flex: 1, "& ::placeholder": {
32
+ color: theme.palette.text.white64,
33
+ fontSize: theme.typography.fontSize14,
34
+ } }, inputClassName) })), (0, jsx_runtime_1.jsx)("input", { style: {} }), rightPart] })));
32
35
  });
33
36
  Input.displayName = "Input";
34
37
  exports.default = Input;
@@ -65,6 +65,9 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
65
65
  var _c = (0, react_1.useState)(), selectedNetwork = _c[0], setSelectedNetwork = _c[1];
66
66
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
67
67
  var _d = (0, useWithdrawData_1.default)(), withdrawTokens = _d.withdrawTokens, updateWithdrawToken = _d.updateWithdrawToken;
68
+ var _e = (0, react_1.useState)(""), amount = _e[0], setAmount = _e[1];
69
+ var _f = (0, react_1.useState)(""), memo = _f[0], setMemo = _f[1];
70
+ var _g = (0, react_1.useState)(""), recipientAddress = _g[0], setRecipientAddress = _g[1];
68
71
  var networks = (0, react_1.useMemo)(function () {
69
72
  console.warn("🚀 ~ networks ~ selectedToken:", selectedToken);
70
73
  if (!selectedToken) {
@@ -84,11 +87,39 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
84
87
  var close = function () {
85
88
  var _a;
86
89
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
90
+ clearValues();
87
91
  };
88
92
  (0, react_1.useImperativeHandle)(ref, function () { return ({
89
93
  open: open,
90
94
  close: close,
91
95
  }); });
96
+ var handleChangeRecipientAddress = function (e) {
97
+ setRecipientAddress(e.target.value);
98
+ };
99
+ var handleChangeAmount = function (e) {
100
+ setAmount(e.target.value);
101
+ };
102
+ var handleChangeMemo = function (e) {
103
+ setMemo(e.target.value);
104
+ };
105
+ var gotoStep = function (step) {
106
+ var _a;
107
+ setCurrentStep(step);
108
+ (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(step);
109
+ };
110
+ var clearValues = function () {
111
+ setSelectedToken(undefined);
112
+ setSelectedNetwork(undefined);
113
+ gotoStep(WithdrawStep.SELECT_METHOD);
114
+ setAmount("");
115
+ setMemo("");
116
+ setRecipientAddress("");
117
+ };
118
+ var handleOnClose = function (e) {
119
+ var _a;
120
+ clearValues();
121
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);
122
+ };
92
123
  var handleSelectMethod = function (method) {
93
124
  console.warn("🚀 ~ handleSelectMethod ~ method:", method);
94
125
  switch (method) {
@@ -131,7 +162,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
131
162
  updateWithdrawToken();
132
163
  }
133
164
  }, [isAuthenticated]);
134
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (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, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
165
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { overrideHeader: (0, jsx_runtime_1.jsx)(BackHeader_1.default, { sx: {
135
166
  width: "100%",
136
167
  display: "flex",
137
168
  alignItems: "center",
@@ -151,13 +182,19 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
151
182
  if (!item)
152
183
  return null;
153
184
  return ((0, jsx_runtime_1.jsx)(NetworkSelection_1.default, { onClick: handleSelectNetwork, networkData: JSON.stringify(item), active: (selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.id) === item.id }, item.id));
154
- }) }) }, WithdrawStep.SELECT_NETWORK), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Recipient address" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
155
- placeholder: "Enter recipient address",
156
- }, rightPart: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { children: "Paste" }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("qr_can"), width: 20 })] }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Select network" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Enter amount" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
157
- placeholder: "".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value, " - ").concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value),
158
- }, rightPart: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { children: "Max" }) }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Memo" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
159
- placeholder: "Enter memo",
160
- } }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" })] }) }, WithdrawStep.CONFIRM)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length) }) }) }));
185
+ }) }) }, WithdrawStep.SELECT_NETWORK), (0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Recipient address" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
186
+ placeholder: "Enter recipient address",
187
+ value: recipientAddress,
188
+ onChange: handleChangeRecipientAddress,
189
+ }, rightPart: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { sx: __assign({}, theme.mixins.smallButton), children: "Paste" }), (0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical" }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("qr_can"), width: 20 })] }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Select network" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: selectedNetwork === null || selectedNetwork === void 0 ? void 0 : selectedNetwork.name })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Enter amount" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
190
+ placeholder: "".concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.min_value, " - ").concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.max_value, " ").concat(selectedToken === null || selectedToken === void 0 ? void 0 : selectedToken.name),
191
+ value: amount,
192
+ onChange: handleChangeAmount,
193
+ }, rightPart: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: (0, jsx_runtime_1.jsx)(Button_1.default.Secondary, { sx: __assign({}, theme.mixins.smallButton), children: "Max" }) }) })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8 }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Memo" }), (0, jsx_runtime_1.jsx)(Input_1.default, { inputRest: {
194
+ placeholder: "Enter memo",
195
+ value: memo,
196
+ onChange: handleChangeMemo,
197
+ } })] }), (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: { width: "100%" }, children: "Confirm" })] }) }, WithdrawStep.CONFIRM)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length) }) }) }));
161
198
  });
162
199
  WithdrawFunction.displayName = "WithdrawFunction";
163
200
  exports.default = WithdrawFunction;
@@ -223,6 +223,10 @@ var theme = (0, styles_1.createTheme)({
223
223
  fontWeight: typography.fontWeight400,
224
224
  fontSize: typography.fontSize12,
225
225
  },
226
+ smallButton: {
227
+ fontSize: typography.fontSize11,
228
+ padding: "".concat(customPadding.p8, " ").concat(customPadding.p4),
229
+ },
226
230
  },
227
231
  });
228
232
  exports.default = theme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.232",
3
+ "version": "0.0.233",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",