tek-wallet 0.0.721 → 0.0.723

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.
@@ -7,6 +7,7 @@ interface WealthDepositProps {
7
7
  amount?: string;
8
8
  content?: (keyboardId: string) => React.ReactNode;
9
9
  footer?: (drawerRef: DrawerComponentRef | null) => React.ReactNode;
10
+ onClose?: () => void;
10
11
  }
11
12
  export default function WealthDeposit(props: WealthDepositProps): import("react/jsx-runtime").JSX.Element;
12
13
  export type { WealthDepositProps };
@@ -49,12 +49,14 @@ function WealthDeposit(props) {
49
49
  var _a, _b;
50
50
  var drawerRef = (0, react_1.useRef)(null);
51
51
  var handleOnClose = function () {
52
- var _a;
52
+ var _a, _b;
53
53
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
54
+ (_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
54
55
  };
55
56
  var close = function () {
56
- var _a;
57
+ var _a, _b;
57
58
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
59
+ (_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
58
60
  };
59
61
  var keyboardId = (0, useUniqueId_1.useUniqueId)("wealth-deposit-keyboard");
60
62
  var keyboardRef = (0, react_1.useRef)(null);
@@ -7,6 +7,7 @@ interface WealthWithdrawProps {
7
7
  amount?: string;
8
8
  content?: (keyboardId: string) => React.ReactNode;
9
9
  footer?: (drawerRef: DrawerComponentRef | null) => React.ReactNode;
10
+ onClose?: () => void;
10
11
  }
11
12
  export default function WealthWithdraw(props: WealthWithdrawProps): import("react/jsx-runtime").JSX.Element;
12
13
  export {};
@@ -45,23 +45,26 @@ var deposit_1 = __importDefault(require("./deposit"));
45
45
  var xhub_keyboard_1 = require("xhub-keyboard");
46
46
  var PageHeader_1 = __importDefault(require("../../PageHeader"));
47
47
  var useUniqueId_1 = require("../../../../hooks/useUniqueId");
48
+ var ref_extension_1 = require("../../../../utils/ref.extension");
48
49
  function WealthWithdraw(props) {
49
50
  var _a, _b;
50
51
  var drawerRef = (0, react_1.useRef)(null);
51
52
  var handleOnClose = function () {
52
53
  var _a;
53
- (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
54
+ (0, ref_extension_1.safeCloseDrawer)(drawerRef);
55
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
54
56
  };
55
57
  var close = function () {
56
58
  var _a;
57
- (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
59
+ (0, ref_extension_1.safeCloseDrawer)(drawerRef);
60
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
58
61
  };
59
62
  var keyboardId = (0, useUniqueId_1.useUniqueId)("wealth-withdraw-keyboard");
60
63
  var keyboardRef = (0, react_1.useRef)(null);
61
64
  return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onClose: handleOnClose, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { ref: keyboardRef, id: keyboardId, value: props.amount, onChange: function (value) {
62
65
  var _a;
63
66
  (_a = props === null || props === void 0 ? void 0 : props.setAmount) === null || _a === void 0 ? void 0 : _a.call(props, value);
64
- }, keyboardType: xhub_keyboard_1.KeyboardType.Double, layoutType: xhub_keyboard_1.LayoutType.Integer, viewFullHeight: true, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: close, fullScreen: true, backgroundColor: "#fff", overrideHeader: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Topup", overrideBack: handleOnClose, sx: {
67
+ }, keyboardType: xhub_keyboard_1.KeyboardType.Double, layoutType: xhub_keyboard_1.LayoutType.Integer, viewFullHeight: true, children: (0, jsx_runtime_1.jsx)(ModalLayout_1.default, { onClose: close, fullScreen: true, backgroundColor: "#fff", overrideHeader: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Withdraw", overrideBack: handleOnClose, sx: {
65
68
  height: "fit-content",
66
69
  color: "text.tertiary",
67
70
  } }), children: (0, jsx_runtime_1.jsx)(deposit_1.default, { keyboardId: keyboardId, depositContent: (_a = props.content) === null || _a === void 0 ? void 0 : _a.call(props, keyboardId), footer: (_b = props.footer) === null || _b === void 0 ? void 0 : _b.call(props, drawerRef.current) }) }) }) }));
@@ -0,0 +1,3 @@
1
+ import { DrawerComponentRef } from "../components/ui/DrawerComponent";
2
+ declare function safeCloseDrawer(ref: React.RefObject<DrawerComponentRef | null>): void;
3
+ export { safeCloseDrawer };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.safeCloseDrawer = safeCloseDrawer;
4
+ function safeCloseDrawer(ref) {
5
+ var _a, _b;
6
+ (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.blur();
7
+ (_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.close();
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.721",
3
+ "version": "0.0.723",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",