tek-wallet 0.0.822 → 0.0.824

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.
Files changed (44) hide show
  1. package/dist/components/TekWallet/components/layouts/ChildPageLayout/index.js +3 -1
  2. package/dist/components/TekWallet/components/layouts/DefaultPageLayout/index.js +3 -1
  3. package/dist/components/TekWallet/components/ui/AssetViewHeader/index.js +2 -0
  4. package/dist/components/TekWallet/components/ui/AssetsBoard/index.js +1 -0
  5. package/dist/components/TekWallet/components/ui/Input/ClearInput.d.ts +5 -0
  6. package/dist/components/TekWallet/components/ui/{WithdrawFunction/components/tutorial.js → Input/ClearInput.js} +5 -9
  7. package/dist/components/TekWallet/components/ui/Input/PasteInput.d.ts +5 -0
  8. package/dist/components/TekWallet/components/ui/{WithdrawFunction/components/transferHistory.js → Input/PasteInput.js} +5 -9
  9. package/dist/components/TekWallet/components/ui/Input/QrScan.d.ts +5 -0
  10. package/dist/components/TekWallet/components/ui/Input/QrScan.js +31 -0
  11. package/dist/components/TekWallet/components/ui/Input/index.d.ts +12 -10
  12. package/dist/components/TekWallet/components/ui/Input/index.js +120 -19
  13. package/dist/components/TekWallet/components/ui/Input/index_bk.d.ts +10 -0
  14. package/dist/components/TekWallet/components/ui/Input/index_bk.js +46 -0
  15. package/dist/components/TekWallet/components/ui/QrCodeReader/index.d.ts +2 -1
  16. package/dist/components/TekWallet/components/ui/QrCodeReader/index.js +12 -5
  17. package/dist/components/TekWallet/components/views/SendExternalView/components/Form.js +54 -77
  18. package/dist/components/TekWallet/components/views/SendInternalView/components/Form.js +24 -68
  19. package/dist/components/TekWallet/components/views/SendNftView/components/Form.js +19 -65
  20. package/dist/components/TekWallet/components/views/SettingView/index.js +2 -2
  21. package/dist/components/TekWallet/index.d.ts +1 -0
  22. package/dist/components/TekWallet/index.js +1 -0
  23. package/dist/components/TekWallet/providers/TanstackReactQuery/index.js +4 -1
  24. package/dist/components/TekWallet/providers/TekWalletProvider/index.d.ts +9 -3
  25. package/dist/components/TekWallet/providers/TekWalletProvider/index.js +2 -2
  26. package/package.json +1 -1
  27. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/selectToken.d.ts +0 -13
  28. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/selectToken.js +0 -48
  29. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sendForm.d.ts +0 -29
  30. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sendForm.js +0 -235
  31. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByBalance.d.ts +0 -7
  32. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByBalance.js +0 -45
  33. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByToken.d.ts +0 -7
  34. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/sortByToken.js +0 -45
  35. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/summary/infoSummary.d.ts +0 -14
  36. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/summary/infoSummary.js +0 -111
  37. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/transferHistory.d.ts +0 -5
  38. package/dist/components/TekWallet/components/ui/WithdrawFunction/components/tutorial.d.ts +0 -5
  39. package/dist/components/TekWallet/components/ui/WithdrawFunction/index.d.ts +0 -38
  40. package/dist/components/TekWallet/components/ui/WithdrawFunction/index.js +0 -570
  41. package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.d.ts +0 -11
  42. package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.js +0 -382
  43. package/dist/components/TekWallet/utils/sort.utils.d.ts +0 -3
  44. package/dist/components/TekWallet/utils/sort.utils.js +0 -24
@@ -70,10 +70,12 @@ var mui_1 = require("../../../theme/mui");
70
70
  var AppBackDrop_1 = __importDefault(require("../../ui/AppBackDrop"));
71
71
  var react_simple_pull_to_refresh_1 = __importDefault(require("react-simple-pull-to-refresh"));
72
72
  var Refresh_1 = __importDefault(require("../../ui/Atoms/Refresh"));
73
+ var providers_1 = require("../../../providers");
73
74
  var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
74
75
  var header = props.header, footer = props.footer, children = props.children, sx = props.sx, className = props.className, classNames = props.classNames, statusMessage = props.statusMessage, sxs = props.sxs, pullToRefreshProps = props.pullToRefreshProps, rest = __rest(props, ["header", "footer", "children", "sx", "className", "classNames", "statusMessage", "sxs", "pullToRefreshProps"]);
75
76
  var _a = (0, react_1.useState)(StatusDisplay_1.StatusDisplayType.Normal), status = _a[0], setStatus = _a[1];
76
77
  var theme = (0, mui_1.useTheme)();
78
+ var offset = (0, providers_1.useWalletSetup)().offset;
77
79
  var _b = pullToRefreshProps || {}, onRefresh = _b.onRefresh, isPullable = _b.isPullable, restPullToRefreshProps = __rest(_b, ["onRefresh", "isPullable"]);
78
80
  (0, react_1.useImperativeHandle)(ref, function () {
79
81
  return {
@@ -96,7 +98,7 @@ var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
96
98
  return [2 /*return*/, Promise.all([new Promise(function (resolve) { return setTimeout(resolve, 1000); }), onRefresh === null || onRefresh === void 0 ? void 0 : onRefresh()])]; // for user feel data is loading
97
99
  });
98
100
  }); };
99
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: ref, sx: __assign({ height: "100%", width: "100%", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", overflow: "hidden", backgroundColor: theme.palette.background.default }, sx), className: className }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.header), className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, sxs === null || sxs === void 0 ? void 0 : sxs.body), className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: [!!isPullable && ((0, jsx_runtime_1.jsx)(react_simple_pull_to_refresh_1.default, __assign({ pullingContent: null, refreshingContent: ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", pt: 3 }, children: (0, jsx_runtime_1.jsx)(Refresh_1.default, {}) })) }, restPullToRefreshProps, { onRefresh: handleRefresh, children: children }))), !isPullable && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.footer), className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { open: true, hideProgress: true, message: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status, statusMessage: statusMessage === null || statusMessage === void 0 ? void 0 : statusMessage[status] }) }))] })));
101
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: ref, sx: __assign({ height: "100%", width: "100%", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", overflow: "hidden", backgroundColor: theme.palette.background.default, pt: offset === null || offset === void 0 ? void 0 : offset.top }, sx), className: className }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.header), className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({ height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, sxs === null || sxs === void 0 ? void 0 : sxs.body), className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: [!!isPullable && ((0, jsx_runtime_1.jsx)(react_simple_pull_to_refresh_1.default, __assign({ pullingContent: null, refreshingContent: ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "center", pt: 3 }, children: (0, jsx_runtime_1.jsx)(Refresh_1.default, {}) })) }, restPullToRefreshProps, { onRefresh: handleRefresh, children: children }))), !isPullable && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ width: "100%" }, sxs === null || sxs === void 0 ? void 0 : sxs.footer), className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { open: true, hideProgress: true, message: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status, statusMessage: statusMessage === null || statusMessage === void 0 ? void 0 : statusMessage[status] }) }))] })));
100
102
  });
101
103
  ChildPageLayout.displayName = "ChildPageLayout";
102
104
  exports.default = ChildPageLayout;
@@ -15,8 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var material_1 = require("@mui/material");
17
17
  var mui_1 = require("../../../theme/mui");
18
+ var providers_1 = require("../../../providers");
18
19
  var DefaultPageLayout = function (props) {
19
20
  var theme = (0, mui_1.useTheme)();
20
- return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.styleMixins.pagePadding), { minHeight: "100%", width: "100%" }), props.sx), children: props.children }));
21
+ var offset = (0, providers_1.useWalletSetup)().offset;
22
+ return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.styleMixins.pagePadding), { pb: (offset === null || offset === void 0 ? void 0 : offset.bottom) || theme.styleMixins.pagePadding.paddingBottom, minHeight: "100%", width: "100%" }), props.sx), children: props.children }));
21
23
  };
22
24
  exports.default = DefaultPageLayout;
@@ -67,11 +67,13 @@ var AssetViewHeader = function () {
67
67
  var options = (0, TekWalletProvider_1.useWalletSetup)().options;
68
68
  var theme = (0, mui_1.useTheme)();
69
69
  var modalRef = (0, react_1.useRef)(null);
70
+ var offset = (0, TekWalletProvider_1.useWalletSetup)().offset;
70
71
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { justifyContent: "start", position: "relative", boxShadow: "0 0 1px 2px rgba(0, 0, 0, 0.03)", px: theme.styleMixins.customPadding.p16 }), children: [(0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: modalRef, trigger: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign({}, theme.styleMixins.row), { alignItems: "center", justifyContent: "start", textAlign: "center", gap: theme.styleMixins.gaps.g4, py: theme.styleMixins.customPadding.p8 }), theme.styleMixins.value), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1.25rem", height: "1.25rem" }, children: SvgPath_1.WALLET }), (0, compactWalletAddress_1.default)(masterWallet), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "0.625rem", height: "0.625rem" }, children: SvgPath_1.ARROW_DROP_DOWN })] }), direction: DrawerComponent_1.DRAWER_DIRECTION.TOP, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
71
72
  width: "100%",
72
73
  height: "fit-content",
73
74
  backgroundColor: "background.default",
74
75
  padding: theme.styleMixins.customPadding.p16,
76
+ pt: (offset === null || offset === void 0 ? void 0 : offset.top) || theme.styleMixins.customPadding.p16,
75
77
  }, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.row), { justifyContent: "space-between" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { component: "div", sx: __assign(__assign({}, theme.styleMixins.headerTitle), { py: theme.styleMixins.customPadding.p8, textAlign: "left" }), children: "Wallet address" }), (0, jsx_runtime_1.jsx)(CloseModal_1.default, { onClick: function () { var _a; return (_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.close(); } })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.styleMixins.column), children: [!!masterWallet && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: masterWallet !== null && masterWallet !== void 0 ? masterWallet : "", messageSuccess: "Copied Internal address", children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ py: theme.styleMixins.customPadding.p8 }, theme.styleMixins.row), { justifyContent: "space-between", alignItems: "center", gap: theme.styleMixins.gaps.g8, color: "text.primary" }), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1.75rem", height: "1.75rem", opacity: 0.7 }, children: SvgPath_1.WALLET }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.styleMixins.column), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.styleMixins.listTitle), { color: "inherit" }), children: "Internal wallet" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.styleMixins.listDescription), children: (0, compactWalletAddress_1.default)(masterWallet) })] }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1rem", height: "1rem" }, children: SvgPath_1.IC_COPY })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
76
78
  my: theme.styleMixins.customPadding.p8,
77
79
  } })] })), blockchainWallets === null || blockchainWallets === void 0 ? void 0 : blockchainWallets.map(function (wallet, index) { return ((0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: wallet.blockchainAddress, messageSuccess: "Copied ".concat(wallet.networkName, " address"), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({ py: theme.styleMixins.customPadding.p8 }, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g8, justifyContent: "space-between", alignItems: "center" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: wallet.networkIcon, width: 28, sx: { borderRadius: theme.styleMixins.customRadius.full } }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.styleMixins.column), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.styleMixins.listTitle), children: wallet.networkName }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, theme.styleMixins.listDescription), children: (0, compactWalletAddress_1.default)(wallet.blockchainAddress) })] }), (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: "1rem", height: "1rem" }, children: SvgPath_1.IC_COPY })] }) }, wallet.blockchainAddress + index)); })] })] }) }), (0, jsx_runtime_1.jsx)(link_1.default, { href: "".concat((options === null || options === void 0 ? void 0 : options.basePath) || "", "/tek-wallet/").concat(TekWalletView_1.TekWalletViewRoutes.SETTING), children: (0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: {
@@ -26,6 +26,7 @@ var AssetsBoard = function () {
26
26
  return ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { swiperProps: {
27
27
  slidesPerView: 1,
28
28
  spaceBetween: 40,
29
+ autoHeight: true,
29
30
  }, tabParamName: "assets-tab", tabs: ASSETS_TABS === null || ASSETS_TABS === void 0 ? void 0 : ASSETS_TABS.map(function (type, index) {
30
31
  return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: type.name, value: index, "data-index": index, sx: {
31
32
  padding: "".concat(theme.styleMixins.customPadding.p8, " ").concat(theme.styleMixins.customPadding.p16),
@@ -0,0 +1,5 @@
1
+ import { SvgIconProps } from "@mui/material";
2
+ export interface ClearInputProps extends SvgIconProps {
3
+ }
4
+ declare function ClearInput(props: ClearInputProps): import("react/jsx-runtime").JSX.Element;
5
+ export default ClearInput;
@@ -24,12 +24,8 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  var jsx_runtime_1 = require("react/jsx-runtime");
26
26
  var material_1 = require("@mui/material");
27
- var SvgPath_1 = require("../../SvgPath");
28
- var Tutorial = function (props) {
29
- var rest = __rest(props, []);
30
- return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, __assign({ inheritViewBox: true, sx: {
31
- width: 20,
32
- height: 20,
33
- } }, rest, { children: SvgPath_1.IC_TUTORIAL })));
34
- };
35
- exports.default = Tutorial;
27
+ function ClearInput(props) {
28
+ var sx = props.sx, rest = __rest(props, ["sx"]);
29
+ return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, __assign({ sx: __assign({ width: 24, height: 24 }, sx) }, rest, { children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "48px", viewBox: "0 -960 960 960", width: "48px", fill: "currentColor", children: (0, jsx_runtime_1.jsx)("path", { d: "M333.08-311.08 480-458l146.92 146.92 22-22L502-480l146.92-146.92-22-22L480-502 333.08-648.92l-22 22L458-480 311.08-333.08l22 22ZM480.13-120q-74.44 0-139.79-28.34t-114.48-77.42q-49.13-49.08-77.49-114.37Q120-405.42 120-479.87q0-74.67 28.34-140.41 28.34-65.73 77.42-114.36 49.08-48.63 114.37-76.99Q405.42-840 479.87-840q74.67 0 140.41 28.34 65.73 28.34 114.36 76.92 48.63 48.58 76.99 114.26Q840-554.81 840-480.13q0 74.44-28.34 139.79t-76.92 114.48q-48.58 49.13-114.26 77.49Q554.81-120 480.13-120Z" }) }) })));
30
+ }
31
+ exports.default = ClearInput;
@@ -0,0 +1,5 @@
1
+ import { SvgIconProps } from "@mui/material";
2
+ export interface PasteInputProps extends SvgIconProps {
3
+ }
4
+ declare function PasteInput(props: PasteInputProps): import("react/jsx-runtime").JSX.Element;
5
+ export default PasteInput;
@@ -24,12 +24,8 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  var jsx_runtime_1 = require("react/jsx-runtime");
26
26
  var material_1 = require("@mui/material");
27
- var SvgPath_1 = require("../../SvgPath");
28
- var TransferHistory = function (props) {
29
- var rest = __rest(props, []);
30
- return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, __assign({ inheritViewBox: true, sx: {
31
- width: 20,
32
- height: 20,
33
- } }, rest, { children: SvgPath_1.IC_HISTORY })));
34
- };
35
- exports.default = TransferHistory;
27
+ function PasteInput(props) {
28
+ var sx = props.sx, rest = __rest(props, ["sx"]);
29
+ return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, __assign({ sx: __assign({ width: 24, height: 24 }, sx) }, rest, { children: (0, jsx_runtime_1.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M14.625 10.6875V8.71875C14.625 8.04742 14.3583 7.40359 13.8836 6.92889C13.4089 6.45418 12.7651 6.1875 12.0938 6.1875H10.9688C10.745 6.1875 10.5304 6.09861 10.3721 5.94037C10.2139 5.78214 10.125 5.56753 10.125 5.34375V4.21875C10.125 3.54742 9.85832 2.90359 9.38361 2.42889C8.90891 1.95418 8.26508 1.6875 7.59375 1.6875H6.1875M6.1875 11.25H11.8125M6.1875 13.5H9M7.875 1.6875H4.21875C3.753 1.6875 3.375 2.0655 3.375 2.53125V15.4688C3.375 15.9345 3.753 16.3125 4.21875 16.3125H13.7812C14.247 16.3125 14.625 15.9345 14.625 15.4688V8.4375C14.625 6.64729 13.9138 4.9304 12.648 3.66453C11.3821 2.39866 9.66521 1.6875 7.875 1.6875Z", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) }) })));
30
+ }
31
+ exports.default = PasteInput;
@@ -0,0 +1,5 @@
1
+ import { SvgIconProps } from "@mui/material";
2
+ export interface QrScanProps extends SvgIconProps {
3
+ }
4
+ declare function QrScan(props: QrScanProps): import("react/jsx-runtime").JSX.Element;
5
+ export default QrScan;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ var jsx_runtime_1 = require("react/jsx-runtime");
26
+ var material_1 = require("@mui/material");
27
+ function QrScan(props) {
28
+ var sx = props.sx, rest = __rest(props, ["sx"]);
29
+ return ((0, jsx_runtime_1.jsx)(material_1.SvgIcon, __assign({ sx: __assign({ width: 24, height: 24 }, sx) }, rest, { children: (0, jsx_runtime_1.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: (0, jsx_runtime_1.jsx)("path", { d: "M5.625 2.8125H4.5C4.05245 2.8125 3.62323 2.99029 3.30676 3.30676C2.99029 3.62323 2.8125 4.05245 2.8125 4.5V5.625M12.375 2.8125H13.5C13.9476 2.8125 14.3768 2.99029 14.6932 3.30676C15.0097 3.62323 15.1875 4.05245 15.1875 4.5V5.625M15.1875 12.375V13.5C15.1875 13.9476 15.0097 14.3768 14.6932 14.6932C14.3768 15.0097 13.9476 15.1875 13.5 15.1875H12.375M5.625 15.1875H4.5C4.05245 15.1875 3.62323 15.0097 3.30676 14.6932C2.99029 14.3768 2.8125 13.9476 2.8125 13.5V12.375M11.25 9C11.25 9.59674 11.0129 10.169 10.591 10.591C10.169 11.0129 9.59674 11.25 9 11.25C8.40326 11.25 7.83097 11.0129 7.40901 10.591C6.98705 10.169 6.75 9.59674 6.75 9C6.75 8.40326 6.98705 7.83097 7.40901 7.40901C7.83097 6.98705 8.40326 6.75 9 6.75C9.59674 6.75 10.169 6.98705 10.591 7.40901C11.0129 7.83097 11.25 8.40326 11.25 9Z", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) }) })));
30
+ }
31
+ exports.default = QrScan;
@@ -1,10 +1,12 @@
1
- import { TextFieldProps, BoxProps, SxProps } from "@mui/material";
2
- interface InputProps extends BoxProps {
3
- inputRest?: TextFieldProps;
4
- leftPart?: React.ReactNode;
5
- rightPart?: React.ReactNode;
6
- inputSx?: SxProps;
7
- }
8
- export type InputRef = HTMLInputElement;
9
- declare const Input: import("react").ForwardRefExoticComponent<Omit<InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
10
- export default Input;
1
+ import { TextFieldProps as MuiTextFieldProps } from "@mui/material";
2
+ export type TextFieldProps = MuiTextFieldProps & {
3
+ className?: string;
4
+ canClear?: boolean;
5
+ canPaste?: boolean;
6
+ canCopy?: boolean;
7
+ canScan?: boolean;
8
+ onPaste?: () => void;
9
+ sanitizeScanText?: (text: string) => string;
10
+ };
11
+ declare function TextField(props: TextFieldProps): import("react/jsx-runtime").JSX.Element;
12
+ export default TextField;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  var __assign = (this && this.__assign) || function () {
3
4
  __assign = Object.assign || function(t) {
4
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -10,6 +11,42 @@ var __assign = (this && this.__assign) || function () {
10
11
  };
11
12
  return __assign.apply(this, arguments);
12
13
  };
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
23
+ var __generator = (this && this.__generator) || function (thisArg, body) {
24
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
25
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
+ function verb(n) { return function (v) { return step([n, v]); }; }
27
+ function step(op) {
28
+ if (f) throw new TypeError("Generator is already executing.");
29
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
30
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
+ if (y = 0, t) op = [op[0] & 2, t.value];
32
+ switch (op[0]) {
33
+ case 0: case 1: t = op; break;
34
+ case 4: _.label++; return { value: op[1], done: false };
35
+ case 5: _.label++; y = op[1]; op = [0]; continue;
36
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
+ default:
38
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
+ if (t[2]) _.ops.pop();
43
+ _.trys.pop(); continue;
44
+ }
45
+ op = body.call(thisArg, _);
46
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
+ }
49
+ };
13
50
  var __rest = (this && this.__rest) || function (s, e) {
14
51
  var t = {};
15
52
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -21,26 +58,90 @@ var __rest = (this && this.__rest) || function (s, e) {
21
58
  }
22
59
  return t;
23
60
  };
61
+ var __importDefault = (this && this.__importDefault) || function (mod) {
62
+ return (mod && mod.__esModule) ? mod : { "default": mod };
63
+ };
24
64
  Object.defineProperty(exports, "__esModule", { value: true });
25
65
  var jsx_runtime_1 = require("react/jsx-runtime");
26
66
  var material_1 = require("@mui/material");
67
+ var ClearInput_1 = __importDefault(require("./ClearInput"));
27
68
  var react_1 = require("react");
28
- var mui_1 = require("../../../theme/mui");
29
- var Input = (0, react_1.forwardRef)(function (props, inputRef) {
30
- var inputRest = props.inputRest, leftPart = props.leftPart, rightPart = props.rightPart, sx = props.sx, inputSx = props.inputSx, rest = __rest(props, ["inputRest", "leftPart", "rightPart", "sx", "inputSx"]);
31
- var theme = (0, mui_1.useTheme)();
32
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: inputRef, sx: __assign(__assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g12, borderRadius: 1, paddingX: theme.styleMixins.customPadding.p16, border: "1px solid ".concat(theme.palette.divider), backgroundColor: theme.palette.background.default, color: theme.palette.text.primary, backdropFilter: "blur(10px)" }), sx) }, rest, { children: [leftPart, (0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ autoComplete: "off", hiddenLabel: true, sx: __assign({ backgroundColor: "transparent", border: "none", outline: "none", flex: 1, height: "fit-content", "& .MuiInputBase-input": {
33
- border: "none",
34
- outline: "none",
35
- color: theme.palette.text.primary,
36
- fontSize: theme.typography.fontSize13,
37
- lineHeight: theme.typography.leading140,
38
- fontWeight: theme.typography.fontWeight400,
39
- padding: "".concat(theme.styleMixins.customPadding.p12, " ").concat(0, "px"),
40
- // height: "fit-content",
41
- }, "& fieldset": { border: "none" }, "& .MuiInputBase-input::placeholder": {
42
- fontSize: theme.typography.fontSize13,
43
- } }, inputSx) }, inputRest)), rightPart] })));
44
- });
45
- Input.displayName = "Input";
46
- exports.default = Input;
69
+ var PasteInput_1 = __importDefault(require("./PasteInput"));
70
+ var QrScan_1 = __importDefault(require("./QrScan"));
71
+ // import ScanQR from "@/components/Molecules/ScanQR";
72
+ var lodash_1 = __importDefault(require("lodash"));
73
+ var cn_1 = require("../../../utils/cn");
74
+ var QrCodeReader_1 = __importDefault(require("../QrCodeReader"));
75
+ function TextField(props) {
76
+ var _this = this;
77
+ var className = props.className, value = props.value, canClear = props.canClear, canPaste = props.canPaste, canScan = props.canScan, onChange = props.onChange, slotProps = props.slotProps, sx = props.sx, sanitizeScanText = props.sanitizeScanText, rest = __rest(props, ["className", "value", "canClear", "canPaste", "canScan", "onChange", "slotProps", "sx", "sanitizeScanText"]);
78
+ var textFieldRef = (0, react_1.useRef)(null);
79
+ var input = (slotProps || {}).input;
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
+ var readOnly = (input || {}).readOnly;
82
+ var theme = (0, material_1.useTheme)();
83
+ var emitChange = (0, react_1.useCallback)(function (result) {
84
+ var _a, _b;
85
+ var input = (_a = textFieldRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("input");
86
+ if (input) {
87
+ var nativeInputValueSetter = (_b = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")) === null || _b === void 0 ? void 0 : _b.set;
88
+ nativeInputValueSetter === null || nativeInputValueSetter === void 0 ? void 0 : nativeInputValueSetter.call(input, result);
89
+ var event_1 = new Event("input", { bubbles: true });
90
+ input.dispatchEvent(event_1);
91
+ }
92
+ }, []);
93
+ var handlePaste = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
94
+ var input, clipboardData, nativeInputValueSetter, event_2;
95
+ var _a, _b;
96
+ return __generator(this, function (_c) {
97
+ switch (_c.label) {
98
+ case 0:
99
+ input = (_a = textFieldRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("input");
100
+ if (!input) return [3 /*break*/, 2];
101
+ return [4 /*yield*/, navigator.clipboard.readText()];
102
+ case 1:
103
+ clipboardData = _c.sent();
104
+ nativeInputValueSetter = (_b = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")) === null || _b === void 0 ? void 0 : _b.set;
105
+ nativeInputValueSetter === null || nativeInputValueSetter === void 0 ? void 0 : nativeInputValueSetter.call(input, clipboardData);
106
+ event_2 = new Event("input", { bubbles: true });
107
+ input.dispatchEvent(event_2);
108
+ _c.label = 2;
109
+ case 2: return [2 /*return*/];
110
+ }
111
+ });
112
+ }); }, []);
113
+ var handleScanResult = (0, react_1.useCallback)(function (result) {
114
+ if (sanitizeScanText) {
115
+ result = sanitizeScanText(result);
116
+ }
117
+ emitChange(result);
118
+ }, [sanitizeScanText, emitChange]);
119
+ var slotPropsMerge = (0, react_1.useMemo)(function () {
120
+ return lodash_1.default.merge({
121
+ input: {
122
+ endAdornment: ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { display: "flex", alignItems: "center", gap: 0, color: "primary.main" }, children: [canClear && !!value && !readOnly && ((0, jsx_runtime_1.jsx)(ClearInput_1.default, { onClick: function () { return emitChange(""); }, sx: { width: 24, height: 24 } })), canScan && !value && !readOnly && ((0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { onScan: handleScanResult, children: (0, jsx_runtime_1.jsx)(QrScan_1.default, { sx: { width: 24, height: 24 } }) })), canPaste && !value && !readOnly && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [canScan && ((0, jsx_runtime_1.jsx)(material_1.Divider, { orientation: "vertical", flexItem: true, sx: { mx: 1.5, my: 0.5 } })), (0, jsx_runtime_1.jsx)(PasteInput_1.default, { onClick: handlePaste, sx: { width: 24, height: 24 } })] }))] })),
123
+ sx: {
124
+ caretColor: theme.palette.primary.main,
125
+ "&::selection": {
126
+ backgroundColor: (0, material_1.alpha)(theme.palette.primary.main, 0.3),
127
+ },
128
+ },
129
+ },
130
+ }, slotProps);
131
+ }, [
132
+ canClear,
133
+ value,
134
+ readOnly,
135
+ canScan,
136
+ emitChange,
137
+ canPaste,
138
+ handlePaste,
139
+ theme.palette.primary.main,
140
+ slotProps,
141
+ handleScanResult,
142
+ ]);
143
+ return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ ref: textFieldRef, className: (0, cn_1.cn)(className), value: value || "", onChange: onChange }, rest, { slotProps: slotPropsMerge, sx: __assign({ "& .MuiInputBase-input": {
144
+ pr: 2,
145
+ }, height: "fit-content" }, sx) })));
146
+ }
147
+ exports.default = TextField;
@@ -0,0 +1,10 @@
1
+ import { TextFieldProps, BoxProps, SxProps } from "@mui/material";
2
+ interface InputProps extends BoxProps {
3
+ inputRest?: TextFieldProps;
4
+ leftPart?: React.ReactNode;
5
+ rightPart?: React.ReactNode;
6
+ inputSx?: SxProps;
7
+ }
8
+ export type InputRef = HTMLInputElement;
9
+ declare const Input: import("react").ForwardRefExoticComponent<Omit<InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
10
+ export default Input;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ var jsx_runtime_1 = require("react/jsx-runtime");
26
+ var material_1 = require("@mui/material");
27
+ var react_1 = require("react");
28
+ var mui_1 = require("../../../theme/mui");
29
+ var Input = (0, react_1.forwardRef)(function (props, inputRef) {
30
+ var inputRest = props.inputRest, leftPart = props.leftPart, rightPart = props.rightPart, sx = props.sx, inputSx = props.inputSx, rest = __rest(props, ["inputRest", "leftPart", "rightPart", "sx", "inputSx"]);
31
+ var theme = (0, mui_1.useTheme)();
32
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: inputRef, sx: __assign(__assign(__assign({}, theme.styleMixins.row), { gap: theme.styleMixins.gaps.g12, borderRadius: 1, paddingX: theme.styleMixins.customPadding.p16, border: "1px solid ".concat(theme.palette.divider), backgroundColor: theme.palette.background.default, color: theme.palette.text.primary, backdropFilter: "blur(10px)" }), sx) }, rest, { children: [leftPart, (0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ autoComplete: "off", hiddenLabel: true, sx: __assign({ backgroundColor: "transparent", border: "none", outline: "none", flex: 1, height: "fit-content", "& .MuiInputBase-input": {
33
+ border: "none",
34
+ outline: "none",
35
+ color: theme.palette.text.primary,
36
+ fontSize: theme.typography.fontSize13,
37
+ lineHeight: theme.typography.leading140,
38
+ fontWeight: theme.typography.fontWeight400,
39
+ padding: "".concat(theme.styleMixins.customPadding.p12, " ").concat(0, "px"),
40
+ // height: "fit-content",
41
+ }, "& fieldset": { border: "none" }, "& .MuiInputBase-input::placeholder": {
42
+ fontSize: theme.typography.fontSize13,
43
+ } }, inputSx) }, inputRest)), rightPart] })));
44
+ });
45
+ Input.displayName = "Input";
46
+ exports.default = Input;
@@ -1,7 +1,8 @@
1
1
  import { BoxProps } from "@mui/material";
2
2
  import { IDetectedBarcode } from "@yudiel/react-qr-scanner";
3
3
  interface QrCodeReaderProps extends BoxProps {
4
- onResult: (result: IDetectedBarcode[]) => void;
4
+ onResult?: (result: IDetectedBarcode[]) => void;
5
+ onScan?: (result: string) => void;
5
6
  }
6
7
  export interface QrCodeReaderRef {
7
8
  open: () => void;
@@ -55,7 +55,7 @@ var STYLES = {
55
55
  nodeSize: "10%",
56
56
  };
57
57
  var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
58
- var sx = props.sx, className = props.className, children = props.children, onResult = props.onResult;
58
+ var sx = props.sx, className = props.className, children = props.children, onResult = props.onResult, onScan = props.onScan;
59
59
  var qrReaderContainer = (0, react_1.useRef)(null);
60
60
  var drawerRef = (0, react_1.useRef)(null);
61
61
  var _a = (0, react_1.useState)(false), isOpen = _a[0], setIsOpen = _a[1];
@@ -124,7 +124,14 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
124
124
  styleTag.remove();
125
125
  };
126
126
  }, []);
127
- var _d = (0, providers_1.useWalletSetup)(), topOffset = _d.topOffset, overrideQRScanMethod = _d.overrideQRScanMethod;
127
+ var handleScan = (0, react_1.useCallback)(function (result) {
128
+ var _a;
129
+ onResult === null || onResult === void 0 ? void 0 : onResult(result);
130
+ var text = (_a = result === null || result === void 0 ? void 0 : result[0]) === null || _a === void 0 ? void 0 : _a.rawValue;
131
+ onScan === null || onScan === void 0 ? void 0 : onScan(text);
132
+ close();
133
+ }, [onResult, onScan]);
134
+ var _d = (0, providers_1.useWalletSetup)(), offset = _d.offset, overrideQRScanMethod = _d.overrideQRScanMethod;
128
135
  if (!!overrideQRScanMethod) {
129
136
  var handleOverrideQRScanMethod = function () { return __awaiter(void 0, void 0, void 0, function () {
130
137
  var result, fakeIDetectedBarcode, error_1;
@@ -149,7 +156,7 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
149
156
  },
150
157
  cornerPoints: [],
151
158
  };
152
- onResult([fakeIDetectedBarcode]);
159
+ handleScan([fakeIDetectedBarcode]);
153
160
  return [3 /*break*/, 3];
154
161
  case 2:
155
162
  error_1 = _a.sent();
@@ -165,7 +172,7 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
165
172
  backgroundColor: "transparent !important",
166
173
  }, header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { hideBack: true, title: "Scan QR code", sx: {
167
174
  position: "absolute",
168
- top: topOffset || 0,
175
+ top: (offset === null || offset === void 0 ? void 0 : offset.top) || 0,
169
176
  left: 0,
170
177
  right: 0,
171
178
  zIndex: 1001,
@@ -254,7 +261,7 @@ var QrCodeReader = (0, react_1.forwardRef)(function (props, ref) {
254
261
  height: "100%",
255
262
  objectFit: "cover",
256
263
  },
257
- }, onScan: onResult })] })] })) }) }) }));
264
+ }, onScan: handleScan })] })] })) }) }) }));
258
265
  });
259
266
  QrCodeReader.displayName = "QrCodeReader";
260
267
  exports.default = QrCodeReader;