ag-common 0.0.123 → 0.0.124
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.
- package/dist/common/helpers/binary.d.ts +10 -0
- package/dist/common/helpers/binary.js +10 -0
- package/dist/ui/components/{Modal/Close.d.ts → Close/index.d.ts} +0 -0
- package/dist/ui/components/{Modal/Close.js → Close/index.js} +0 -1
- package/dist/ui/components/Modal/index.js +5 -2
- package/dist/ui/components/index.d.ts +1 -0
- package/dist/ui/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* convert an ArrayBuffer (usually from file.arrayBuffer) to base64. Usually on client side before server send
|
|
4
|
+
* @param buffer
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
2
7
|
export declare function arrayBufferToBase64(buffer: ArrayBuffer): string;
|
|
8
|
+
/**
|
|
9
|
+
* convert a base64 string to a binary Buffer. Usually on server side from client sent content
|
|
10
|
+
* @param raw
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
3
13
|
export declare const base64ToBinary: (raw: string) => Buffer;
|
|
@@ -19,6 +19,11 @@ function toArrayBuffer(base64) {
|
|
|
19
19
|
}
|
|
20
20
|
return bytes.buffer;
|
|
21
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* convert an ArrayBuffer (usually from file.arrayBuffer) to base64. Usually on client side before server send
|
|
24
|
+
* @param buffer
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
22
27
|
function arrayBufferToBase64(buffer) {
|
|
23
28
|
let binary = '';
|
|
24
29
|
const bytes = new Uint8Array(buffer);
|
|
@@ -29,5 +34,10 @@ function arrayBufferToBase64(buffer) {
|
|
|
29
34
|
return (0, string_1.toBase64)(binary);
|
|
30
35
|
}
|
|
31
36
|
exports.arrayBufferToBase64 = arrayBufferToBase64;
|
|
37
|
+
/**
|
|
38
|
+
* convert a base64 string to a binary Buffer. Usually on server side from client sent content
|
|
39
|
+
* @param raw
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
32
42
|
const base64ToBinary = (raw) => toBuffer(toArrayBuffer(raw));
|
|
33
43
|
exports.base64ToBinary = base64ToBinary;
|
|
File without changes
|
|
@@ -25,7 +25,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
25
|
exports.ModalDropList = exports.Modal = exports.ModalItem = void 0;
|
|
26
26
|
const react_1 = __importStar(require("react"));
|
|
27
27
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
28
|
-
const Close_1 = require("
|
|
28
|
+
const Close_1 = require("../Close");
|
|
29
29
|
const useOnClickOutside_1 = require("../../helpers/useOnClickOutside");
|
|
30
30
|
const FixedBackground = styled_components_1.default.div `
|
|
31
31
|
position: fixed;
|
|
@@ -67,6 +67,9 @@ exports.ModalItem = styled_components_1.default.div `
|
|
|
67
67
|
background-color: #eee;
|
|
68
68
|
}
|
|
69
69
|
`;
|
|
70
|
+
const CloseStyled = (0, styled_components_1.default)(Close_1.Close) `
|
|
71
|
+
z-index: 1;
|
|
72
|
+
`;
|
|
70
73
|
const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'bottom', showCloseButton = true, closeOnMoveMouseOutside = false, className, closeOnClickOutside = true, }) => {
|
|
71
74
|
const ref = (0, react_1.useRef)(null);
|
|
72
75
|
(0, useOnClickOutside_1.useOnClickOutside)({ ref, moveMouseOutside: closeOnMoveMouseOutside }, () => {
|
|
@@ -79,7 +82,7 @@ const Modal = ({ open, setOpen, children, position = 'left', topPosition = 'bott
|
|
|
79
82
|
}
|
|
80
83
|
return (react_1.default.createElement(FixedBackground, { className: className },
|
|
81
84
|
react_1.default.createElement(ModalBase, { "data-position": position, "data-topposition": topPosition, ref: ref },
|
|
82
|
-
showCloseButton && react_1.default.createElement(
|
|
85
|
+
showCloseButton && react_1.default.createElement(CloseStyled, { onClick: () => setOpen(false) }),
|
|
83
86
|
children)));
|
|
84
87
|
};
|
|
85
88
|
exports.Modal = Modal;
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./BorderGradient"), exports);
|
|
14
14
|
__exportStar(require("./Button"), exports);
|
|
15
15
|
__exportStar(require("./Chevron"), exports);
|
|
16
|
+
__exportStar(require("./Close"), exports);
|
|
16
17
|
__exportStar(require("./Confirm"), exports);
|
|
17
18
|
__exportStar(require("./Dropdown"), exports);
|
|
18
19
|
__exportStar(require("./DropdownList"), exports);
|