oolib 2.111.3 → 2.112.1
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/components/AudioInput/index.js +4 -3
- package/dist/components/ImageInput/comps/ImageEditor/index.js +1 -1
- package/dist/components/PDFInput/index.js +4 -3
- package/dist/components/VideoInput/index.js +4 -3
- package/dist/utilsOolib/index.d.ts +30 -0
- package/dist/utilsOolib/index.js +30 -0
- package/package.json +1 -1
|
@@ -72,7 +72,8 @@ function AudioInput(_a) {
|
|
|
72
72
|
},
|
|
73
73
|
handleUploadProgess: handleUploadProgess,
|
|
74
74
|
})) || (0, useFakeUploadImpression_1.useFakeUploadImpression)({ handleUploadProgess: handleUploadProgess, fileType: "audio" }), upload = _c.mutate, isLoading = _c.isLoading;
|
|
75
|
-
var handleUpload = function (
|
|
75
|
+
var handleUpload = function (_a) {
|
|
76
|
+
var files = _a.files;
|
|
76
77
|
if (!files)
|
|
77
78
|
return;
|
|
78
79
|
if (!upload)
|
|
@@ -89,7 +90,7 @@ function AudioInput(_a) {
|
|
|
89
90
|
};
|
|
90
91
|
(0, react_1.useEffect)(function () {
|
|
91
92
|
if (files) {
|
|
92
|
-
handleUpload(files);
|
|
93
|
+
handleUpload({ files: files });
|
|
93
94
|
}
|
|
94
95
|
}, []);
|
|
95
96
|
return (react_1.default.createElement(react_1.Fragment, null,
|
|
@@ -99,7 +100,7 @@ function AudioInput(_a) {
|
|
|
99
100
|
react_1.default.createElement(AudioPlayer_1.AudioPlayer, { audioData: audioData }),
|
|
100
101
|
react_1.default.createElement(AudioAction_1.AudioAction, { id: id, isInRTE: isInRTE, inputRef: inputRef, parentOnChange: parentOnChange })))),
|
|
101
102
|
react_1.default.createElement("input", { type: "file" // When user clicks on upload new video from action menu inputRef.current.click() this does not work for upload button. this approch deals with that issue.
|
|
102
|
-
, accept: "audio/*", ref: inputRef, style: { display: "none" }, id: "AudioField", onChange: function (v) { return handleUpload(v.target.files); } })));
|
|
103
|
+
, accept: "audio/*", ref: inputRef, style: { display: "none" }, id: "AudioField", onChange: function (v) { return handleUpload({ files: v.target.files }); } })));
|
|
103
104
|
}
|
|
104
105
|
;
|
|
105
106
|
exports.default = AudioInput;
|
|
@@ -151,7 +151,7 @@ function ImageEditor(_a) {
|
|
|
151
151
|
react_1.default.createElement("div", { style: {
|
|
152
152
|
borderRadius: "0.2rem",
|
|
153
153
|
padding: readOnly ? "1rem" : "2rem",
|
|
154
|
-
backgroundColor:
|
|
154
|
+
backgroundColor: invert ? themes_1.colors.greyColor90 : themes_1.colors.greyColor5,
|
|
155
155
|
} }, !LexicalTextEditor
|
|
156
156
|
? (0, renderRTEPlaceholderForOolibPreview_1.renderRTEPlaceholderForOolibPreview)({
|
|
157
157
|
width: '100%',
|
|
@@ -81,7 +81,8 @@ function PDFInput(_a) {
|
|
|
81
81
|
},
|
|
82
82
|
handleUploadProgess: handleUploadProgess,
|
|
83
83
|
})) || (0, useFakeUploadImpression_1.useFakeUploadImpression)({ handleUploadProgess: handleUploadProgess, fileType: "pdf" }), upload = _c.mutate, isLoading = _c.isLoading;
|
|
84
|
-
var handleUpload = function (
|
|
84
|
+
var handleUpload = function (_a) {
|
|
85
|
+
var files = _a.files;
|
|
85
86
|
if (!files)
|
|
86
87
|
return;
|
|
87
88
|
if (!upload)
|
|
@@ -98,13 +99,13 @@ function PDFInput(_a) {
|
|
|
98
99
|
};
|
|
99
100
|
(0, react_1.useEffect)(function () {
|
|
100
101
|
if (files) {
|
|
101
|
-
handleUpload(files);
|
|
102
|
+
handleUpload({ files: files });
|
|
102
103
|
}
|
|
103
104
|
}, []);
|
|
104
105
|
return (react_1.default.createElement(react_3.Fragment, null,
|
|
105
106
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, getBlockLabelProps_1.getBlockLabelProps)(props), { invert: invert })),
|
|
106
107
|
(readOnly && value) ? (value === null || value === void 0 ? void 0 : value.map(function (d, i) { return (react_1.default.createElement(PDFEmbed_1.default, { key: i, filePath: d.publicUrl, fileName: d.originalFilename, fileID: d.generation })); }))
|
|
107
|
-
: !value || (value === null || value === void 0 ? void 0 : value.length) === 0 && !isLoading ? (react_1.default.createElement(FileUploadWrapper_1.FileUploadWrapper, { height: "18rem", isLoading: isLoading, mediaType: "pdf", handleUpload: handleUpload, uploadProgress: uploadProgress, enableClickUpload: false },
|
|
108
|
+
: !value || (value === null || value === void 0 ? void 0 : value.length) === 0 && !isLoading ? (react_1.default.createElement(FileUploadWrapper_1.FileUploadWrapper, { height: "18rem", isLoading: isLoading, mediaType: "pdf", handleUpload: handleUpload, onChange: parentOnChange, uploadProgress: uploadProgress, enableClickUpload: false },
|
|
108
109
|
react_1.default.createElement(Buttons_1.ButtonSecondary, { onClick: function () { return inputRef.current.click(); }, icon: "UploadSimple", value: "Upload Pdf", invert: invert }))) : (value === null || value === void 0 ? void 0 : value.map(function (d, i) { return (react_1.default.createElement("div", { style: { position: 'relative' }, key: i },
|
|
109
110
|
react_1.default.createElement(PDFEmbed_1.default, { filePath: d.publicUrl, fileName: d.originalFilename, fileID: d.generation }),
|
|
110
111
|
react_1.default.createElement(StyledActionsButtonWrapper, null,
|
|
@@ -63,8 +63,9 @@ function VideoInput(_a) {
|
|
|
63
63
|
handleUploadProgess: handleUploadProgess,
|
|
64
64
|
})) ||
|
|
65
65
|
(0, useFakeUploadImpression_1.useFakeUploadImpression)({ handleUploadProgess: handleUploadProgess, fileType: "video" }), upload = _e.mutate, isLoading = _e.isLoading;
|
|
66
|
-
var handleUpload = function (
|
|
66
|
+
var handleUpload = function (_a) {
|
|
67
67
|
// onChange(id, undefined) //so that the prev video is cleared and loader shows up
|
|
68
|
+
var files = _a.files;
|
|
68
69
|
if (!files)
|
|
69
70
|
return;
|
|
70
71
|
if (!upload)
|
|
@@ -82,7 +83,7 @@ function VideoInput(_a) {
|
|
|
82
83
|
};
|
|
83
84
|
(0, react_1.useEffect)(function () {
|
|
84
85
|
if (files) {
|
|
85
|
-
handleUpload(files);
|
|
86
|
+
handleUpload({ files: files });
|
|
86
87
|
}
|
|
87
88
|
}, []);
|
|
88
89
|
var createVideoPreview = function (_a) {
|
|
@@ -121,6 +122,6 @@ function VideoInput(_a) {
|
|
|
121
122
|
react_1.default.createElement(Buttons_1.ButtonSecondary, { onClick: function () { return inputRef.current.click(); }, value: "Upload A Video", icon: "UploadSimple", invert: invert, id: "videoField" }))))),
|
|
122
123
|
showEmbedLinkModal && (react_1.default.createElement(EmbedLinkModal_1.EmbedLinkModal, { setShowEmbedLinkModal: setShowEmbedLinkModal, value: value, createVideoPreview: createVideoPreview, canPlay: canPlay, onChange: onChange, id: id, invert: invert })),
|
|
123
124
|
react_1.default.createElement("input", { type: "file" // When user clicks on upload new video from action menu inputRef.current.click() this does not work for upload button. this approch deals with that issue.
|
|
124
|
-
, accept: "video/*", ref: inputRef, style: { display: "none" }, id: "videoField", onChange: function (v) { return handleUpload(v.target.files); } })));
|
|
125
|
+
, accept: "video/*", ref: inputRef, style: { display: "none" }, id: "videoField", onChange: function (v) { return handleUpload({ files: v.target.files }); } })));
|
|
125
126
|
}
|
|
126
127
|
exports.default = VideoInput;
|
|
@@ -6,8 +6,38 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { ReactNode } from 'react';
|
|
8
8
|
import { ColorsType } from '../themes/colors';
|
|
9
|
+
/**
|
|
10
|
+
* Generates a function that localizes a value based on the current theme.
|
|
11
|
+
*
|
|
12
|
+
* @param {ReactNode} value - The value to be localized
|
|
13
|
+
* @return {ReactNode} The localized value
|
|
14
|
+
*/
|
|
9
15
|
export declare const useLocale: () => (value: ReactNode) => ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Returns the primary color at 10% opacity from the provided colors object or falls back to a default primary color
|
|
18
|
+
*
|
|
19
|
+
* @param {ColorsType} colors - An optional ColorsType object to retrieve the primary color from
|
|
20
|
+
* @return {string} The primary color value at 10% opacity
|
|
21
|
+
*/
|
|
10
22
|
export declare const getPrimaryColor10: (colors?: ColorsType) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the primary color at 40% opacity from the provided colors object or falls back to a default primary color.
|
|
25
|
+
*
|
|
26
|
+
* @param {ColorsType} colors - An optional ColorsType object to retrieve the primary color from
|
|
27
|
+
* @return {string} The primary color at 40% opacity.
|
|
28
|
+
*/
|
|
11
29
|
export declare const getPrimaryColor40: (colors?: ColorsType) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Returns the primary color at 100% opacity from the provided colors object or falls back to a default primary color.
|
|
32
|
+
*
|
|
33
|
+
* @param {ColorsType} colors - Optional colors object containing primary color levels.
|
|
34
|
+
* @return {string} The primary color at 100 level.
|
|
35
|
+
*/
|
|
12
36
|
export declare const getPrimaryColor100: (colors?: ColorsType) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Get the primary color text.
|
|
39
|
+
*
|
|
40
|
+
* @param {ColorsType} colors - Optional colors object
|
|
41
|
+
* @return {string} The primary color text
|
|
42
|
+
*/
|
|
13
43
|
export declare const getPrimaryColorText: (colors?: ColorsType) => string;
|
package/dist/utilsOolib/index.js
CHANGED
|
@@ -14,6 +14,12 @@ var react_1 = __importDefault(require("react"));
|
|
|
14
14
|
var styled_components_1 = require("styled-components");
|
|
15
15
|
var colors_1 = require("../themes/colors");
|
|
16
16
|
var primaryColor10 = colors_1.colors.primaryColor10, primaryColor40 = colors_1.colors.primaryColor40, primaryColor100 = colors_1.colors.primaryColor100, primaryColorText = colors_1.colors.primaryColorText;
|
|
17
|
+
/**
|
|
18
|
+
* Generates a function that localizes a value based on the current theme.
|
|
19
|
+
*
|
|
20
|
+
* @param {ReactNode} value - The value to be localized
|
|
21
|
+
* @return {ReactNode} The localized value
|
|
22
|
+
*/
|
|
17
23
|
var useLocale = function () {
|
|
18
24
|
var currentTheme = (0, styled_components_1.useTheme)();
|
|
19
25
|
;
|
|
@@ -32,18 +38,42 @@ var useLocale = function () {
|
|
|
32
38
|
return localize;
|
|
33
39
|
};
|
|
34
40
|
exports.useLocale = useLocale;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the primary color at 10% opacity from the provided colors object or falls back to a default primary color
|
|
43
|
+
*
|
|
44
|
+
* @param {ColorsType} colors - An optional ColorsType object to retrieve the primary color from
|
|
45
|
+
* @return {string} The primary color value at 10% opacity
|
|
46
|
+
*/
|
|
35
47
|
var getPrimaryColor10 = function (colors) {
|
|
36
48
|
return (colors === null || colors === void 0 ? void 0 : colors.primaryColor10) || primaryColor10;
|
|
37
49
|
};
|
|
38
50
|
exports.getPrimaryColor10 = getPrimaryColor10;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the primary color at 40% opacity from the provided colors object or falls back to a default primary color.
|
|
53
|
+
*
|
|
54
|
+
* @param {ColorsType} colors - An optional ColorsType object to retrieve the primary color from
|
|
55
|
+
* @return {string} The primary color at 40% opacity.
|
|
56
|
+
*/
|
|
39
57
|
var getPrimaryColor40 = function (colors) {
|
|
40
58
|
return (colors === null || colors === void 0 ? void 0 : colors.primaryColor40) || primaryColor40;
|
|
41
59
|
};
|
|
42
60
|
exports.getPrimaryColor40 = getPrimaryColor40;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the primary color at 100% opacity from the provided colors object or falls back to a default primary color.
|
|
63
|
+
*
|
|
64
|
+
* @param {ColorsType} colors - Optional colors object containing primary color levels.
|
|
65
|
+
* @return {string} The primary color at 100 level.
|
|
66
|
+
*/
|
|
43
67
|
var getPrimaryColor100 = function (colors) {
|
|
44
68
|
return (colors === null || colors === void 0 ? void 0 : colors.primaryColor100) || primaryColor100;
|
|
45
69
|
};
|
|
46
70
|
exports.getPrimaryColor100 = getPrimaryColor100;
|
|
71
|
+
/**
|
|
72
|
+
* Get the primary color text.
|
|
73
|
+
*
|
|
74
|
+
* @param {ColorsType} colors - Optional colors object
|
|
75
|
+
* @return {string} The primary color text
|
|
76
|
+
*/
|
|
47
77
|
var getPrimaryColorText = function (colors) {
|
|
48
78
|
return (colors === null || colors === void 0 ? void 0 : colors.primaryColorText) || primaryColorText;
|
|
49
79
|
};
|