tek-wallet 0.0.723 → 0.0.724

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.
@@ -18,6 +18,8 @@ export interface DrawerComponentProps extends Omit<GeneralProps, "onClick" | "sx
18
18
  direction?: DRAWER_DIRECTION;
19
19
  disableSwipe?: boolean;
20
20
  triggerStatus?: DRAWER_TRIGGER_STATUS;
21
+ onDismiss?: () => void;
22
+ draggable?: boolean;
21
23
  }
22
24
  export interface DrawerComponentRef {
23
25
  open: () => void;
@@ -39,10 +39,9 @@ var DRAWER_TRIGGER_STATUS;
39
39
  DRAWER_TRIGGER_STATUS["DISABLED"] = "DISABLED";
40
40
  })(DRAWER_TRIGGER_STATUS || (exports.DRAWER_TRIGGER_STATUS = DRAWER_TRIGGER_STATUS = {}));
41
41
  var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
42
- var onOpen = props.onOpen, onClose = props.onClose, onToggle = props.onToggle, sx = props.sx, trigger = props.trigger, direction = props.direction, children = props.children, disableSwipe = props.disableSwipe, className = props.className, _a = props.triggerStatus, triggerStatus = _a === void 0 ? DRAWER_TRIGGER_STATUS.ENABLED : _a, rest = __rest(props, ["onOpen", "onClose", "onToggle", "sx", "trigger", "direction", "children", "disableSwipe", "className", "triggerStatus"]);
42
+ var onOpen = props.onOpen, onClose = props.onClose, onToggle = props.onToggle, sx = props.sx, trigger = props.trigger, direction = props.direction, children = props.children, _a = props.triggerStatus, triggerStatus = _a === void 0 ? DRAWER_TRIGGER_STATUS.ENABLED : _a, onDismiss = props.onDismiss, draggable = props.draggable, rest = __rest(props, ["onOpen", "onClose", "onToggle", "sx", "trigger", "direction", "children", "triggerStatus", "onDismiss", "draggable"]);
43
43
  var _b = (0, react_1.useState)(false), isShowDrawerComponent = _b[0], setIsShowDrawerComponent = _b[1];
44
44
  var _c = (0, react_1.useState)(undefined), isOpen = _c[0], setIsOpen = _c[1];
45
- var DrawerComponent = (0, react_1.useMemo)(function () { return (isOpen !== undefined || disableSwipe ? material_1.Drawer : material_1.SwipeableDrawer); }, [isOpen, disableSwipe]);
46
45
  var lockStatus = function () {
47
46
  setIsOpen(isShowDrawerComponent);
48
47
  };
@@ -70,12 +69,6 @@ var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
70
69
  var newState = !isShowDrawerComponent;
71
70
  setIsShowDrawerComponent(newState);
72
71
  onToggle === null || onToggle === void 0 ? void 0 : onToggle(newState);
73
- if (newState) {
74
- onOpen === null || onOpen === void 0 ? void 0 : onOpen();
75
- }
76
- else {
77
- onClose === null || onClose === void 0 ? void 0 : onClose();
78
- }
79
72
  };
80
73
  (0, react_1.useImperativeHandle)(ref, function () { return ({
81
74
  open: handleOpen,
@@ -83,21 +76,25 @@ var DrawerComponent = (0, react_1.forwardRef)(function (props, ref) {
83
76
  lockStatus: lockStatus,
84
77
  unlockStatus: unlockStatus,
85
78
  }); });
86
- var onDrawerClose = function (e) {
79
+ var onDrawerClose = function () {
87
80
  setIsShowDrawerComponent(false);
88
- onClose === null || onClose === void 0 ? void 0 : onClose(e);
81
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
89
82
  };
90
83
  var onDrawerOpen = function (e) {
91
84
  setIsShowDrawerComponent(true);
92
85
  onOpen === null || onOpen === void 0 ? void 0 : onOpen(e);
93
86
  };
94
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({ display: "block" }, sx), className: className, onClick: toggle, children: trigger }), (0, jsx_runtime_1.jsx)(DrawerComponent, __assign({}, rest, { sx: {
87
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign({}, sx), onClick: toggle, children: trigger }), (0, jsx_runtime_1.jsx)(material_1.SwipeableDrawer, __assign({}, rest, { disableSwipeToOpen: true, sx: {
95
88
  "& .MuiDrawer-paper": {
96
89
  backgroundColor: "transparent",
97
90
  overflow: "hidden",
98
91
  boxShadow: "none",
99
92
  },
100
- }, anchor: direction || DRAWER_DIRECTION.BOTTOM, open: isOpen !== null && isOpen !== void 0 ? isOpen : isShowDrawerComponent, onOpen: onDrawerOpen, onClose: onDrawerClose, children: children }))] }));
93
+ }, anchor: direction || "bottom", open: isOpen !== null && isOpen !== void 0 ? isOpen : isShowDrawerComponent, onOpen: onDrawerOpen, onClose: onDrawerClose, ModalProps: {
94
+ onBackdropClick: function () {
95
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
96
+ },
97
+ }, draggable: draggable, children: children }))] }));
101
98
  });
102
99
  DrawerComponent.displayName = "DrawerComponent";
103
100
  exports.default = DrawerComponent;
@@ -49,18 +49,16 @@ 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, _b;
52
+ var _a;
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);
55
54
  };
56
55
  var close = function () {
57
- var _a, _b;
56
+ var _a;
58
57
  (_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
59
- (_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
60
58
  };
61
59
  var keyboardId = (0, useUniqueId_1.useUniqueId)("wealth-deposit-keyboard");
62
60
  var keyboardRef = (0, react_1.useRef)(null);
63
- 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) {
61
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onDismiss: props.onClose, 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) {
64
62
  var _a;
65
63
  (_a = props === null || props === void 0 ? void 0 : props.setAmount) === null || _a === void 0 ? void 0 : _a.call(props, value);
66
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: {
@@ -50,18 +50,14 @@ function WealthWithdraw(props) {
50
50
  var _a, _b;
51
51
  var drawerRef = (0, react_1.useRef)(null);
52
52
  var handleOnClose = function () {
53
- var _a;
54
53
  (0, ref_extension_1.safeCloseDrawer)(drawerRef);
55
- (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
56
54
  };
57
55
  var close = function () {
58
- var _a;
59
56
  (0, ref_extension_1.safeCloseDrawer)(drawerRef);
60
- (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
61
57
  };
62
58
  var keyboardId = (0, useUniqueId_1.useUniqueId)("wealth-withdraw-keyboard");
63
59
  var keyboardRef = (0, react_1.useRef)(null);
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) {
60
+ return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: props.children, onDismiss: props.onClose, 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) {
65
61
  var _a;
66
62
  (_a = props === null || props === void 0 ? void 0 : props.setAmount) === null || _a === void 0 ? void 0 : _a.call(props, value);
67
63
  }, 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: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.723",
3
+ "version": "0.0.724",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",