oolib 2.124.0 → 2.124.2
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/ImageInput/ImageInputContext.d.ts +2 -1
- package/dist/components/ImageInput/ImageInputContext.js +34 -5
- package/dist/components/ImageInput/comps/Placeholder/index.js +36 -11
- package/dist/components/ImageInput/comps/Placeholder/styled.d.ts +1 -0
- package/dist/components/ImageInput/comps/Placeholder/styled.js +3 -2
- package/dist/components/ImageInput/index.d.ts +2 -1
- package/dist/components/ImageInput/index.js +2 -2
- package/dist/components/cards/CardContent/index.js +2 -1
- package/dist/components/cards/ListContent/index.js +2 -1
- package/dist/stories/ImageInput/ImageInput.stories.d.ts +38 -5
- package/dist/stories/ImageInput/ImageInput.stories.js +5 -3
- package/dist/stories/ImageInput/imageInputArgTypes.d.ts +8 -0
- package/dist/stories/ImageInput/imageInputArgTypes.js +5 -0
- package/dist/stories/ImageInput/imageInputParseArgTypes.d.ts +7 -0
- package/dist/stories/ImageInput/imageInputParseArgTypes.js +9 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const ImageInputContext: React.Context<any>;
|
|
2
|
-
export function ImageInputContextProvider({ children, value, multiple, allowedFormats, formatConvertConfig, folderName, bucketEnv, onChange, id, aspectRatio, readOnly, enableCaptions, defaultImageSpread, invert, containerShape, stretchToFullHeight, dropzoneLabel, dropzoneSublabel, disableImageBorder, omitEditorTools, files, showOptionalLabelInDropzone, isRequired, isInRTE }: {
|
|
2
|
+
export function ImageInputContextProvider({ children, value, multiple, allowedFormats, formatConvertConfig, folderName, bucketEnv, onChange, id, aspectRatio, readOnly, enableCaptions, defaultImageSpread, invert, containerShape, stretchToFullHeight, dropzoneLabel, dropzoneSublabel, disableImageBorder, omitEditorTools, files, showOptionalLabelInDropzone, isRequired, isInRTE, showImageUploadCaution }: {
|
|
3
3
|
children: any;
|
|
4
4
|
value: any;
|
|
5
5
|
multiple: any;
|
|
@@ -24,6 +24,7 @@ export function ImageInputContextProvider({ children, value, multiple, allowedFo
|
|
|
24
24
|
showOptionalLabelInDropzone: any;
|
|
25
25
|
isRequired: any;
|
|
26
26
|
isInRTE: any;
|
|
27
|
+
showImageUploadCaution: any;
|
|
27
28
|
}): React.JSX.Element;
|
|
28
29
|
export function useImageInputContext(): any;
|
|
29
30
|
import React from "react";
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -39,7 +50,7 @@ var useFakeUploadMedia_1 = require("../../utilsOolib/useFakeUploadMedia");
|
|
|
39
50
|
var bannerContext_1 = require("../Banners/bannerContext");
|
|
40
51
|
exports.ImageInputContext = (0, react_1.createContext)();
|
|
41
52
|
var ImageInputContextProvider = function (_a) {
|
|
42
|
-
var children = _a.children, value = _a.value, multiple = _a.multiple, allowedFormats = _a.allowedFormats, formatConvertConfig = _a.formatConvertConfig, folderName = _a.folderName, bucketEnv = _a.bucketEnv, onChange = _a.onChange, id = _a.id, aspectRatio = _a.aspectRatio, readOnly = _a.readOnly, enableCaptions = _a.enableCaptions, defaultImageSpread = _a.defaultImageSpread, invert = _a.invert, containerShape = _a.containerShape, stretchToFullHeight = _a.stretchToFullHeight, dropzoneLabel = _a.dropzoneLabel, dropzoneSublabel = _a.dropzoneSublabel, disableImageBorder = _a.disableImageBorder, omitEditorTools = _a.omitEditorTools, files = _a.files, showOptionalLabelInDropzone = _a.showOptionalLabelInDropzone, isRequired = _a.isRequired, isInRTE = _a.isInRTE;
|
|
53
|
+
var children = _a.children, value = _a.value, multiple = _a.multiple, allowedFormats = _a.allowedFormats, formatConvertConfig = _a.formatConvertConfig, folderName = _a.folderName, bucketEnv = _a.bucketEnv, onChange = _a.onChange, id = _a.id, aspectRatio = _a.aspectRatio, readOnly = _a.readOnly, enableCaptions = _a.enableCaptions, defaultImageSpread = _a.defaultImageSpread, invert = _a.invert, containerShape = _a.containerShape, stretchToFullHeight = _a.stretchToFullHeight, dropzoneLabel = _a.dropzoneLabel, dropzoneSublabel = _a.dropzoneSublabel, disableImageBorder = _a.disableImageBorder, omitEditorTools = _a.omitEditorTools, files = _a.files, showOptionalLabelInDropzone = _a.showOptionalLabelInDropzone, isRequired = _a.isRequired, isInRTE = _a.isInRTE, showImageUploadCaution = _a.showImageUploadCaution;
|
|
43
54
|
var theme = (0, styled_components_1.useTheme)();
|
|
44
55
|
var _b = (0, react_1.useState)(undefined), uploadProgress = _b[0], setUploadProgress = _b[1];
|
|
45
56
|
var handleUploadProgess = function (progress) { return setUploadProgress(progress); };
|
|
@@ -56,7 +67,9 @@ var ImageInputContextProvider = function (_a) {
|
|
|
56
67
|
(0, useFakeUploadMedia_1.useFakeUploadMedia)({ handleUploadProgess: handleUploadProgess }), upload = _c.mutate, isLoading = _c.isLoading; //for storybook purposes cuz we dont have access to mediaupload api here
|
|
57
68
|
var SET_ALERT_BANNER = (0, bannerContext_1.useBannerContext)().SET_ALERT_BANNER;
|
|
58
69
|
var _d = (0, react_1.useState)(0), noOfImagesUploading = _d[0], setNoOfImagesUploading = _d[1];
|
|
59
|
-
var _e = (0, react_1.useState)(
|
|
70
|
+
var _e = (0, react_1.useState)({}), uploadArgs = _e[0], setUploadArgs = _e[1];
|
|
71
|
+
var _f = (0, react_1.useState)(false), showModal = _f[0], setShowModal = _f[1];
|
|
72
|
+
var _g = (0, react_1.useState)(undefined), publicUrlBeingReplaced = _g[0], setPublicUrlBeingReplaced = _g[1];
|
|
60
73
|
var handleUpload = function (_a) {
|
|
61
74
|
var files = _a.files, callback = _a.callback, publicUrlToReplace = _a.publicUrlToReplace;
|
|
62
75
|
//publicUrlToReplace passed only if replace action
|
|
@@ -89,6 +102,16 @@ var ImageInputContextProvider = function (_a) {
|
|
|
89
102
|
},
|
|
90
103
|
});
|
|
91
104
|
};
|
|
105
|
+
var handleUploadWithCheck = function (args) {
|
|
106
|
+
var item = localStorage.getItem("PreUploadImageCautionAcknowleged");
|
|
107
|
+
if (item && JSON.parse(item)) {
|
|
108
|
+
handleUpload(__assign({}, args));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
setUploadArgs(args);
|
|
112
|
+
setShowModal(true);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
92
115
|
/**
|
|
93
116
|
* this is specifically required in the RTE scenario,
|
|
94
117
|
* wherein, the minute files are uploaded from the RTE,
|
|
@@ -133,7 +156,7 @@ var ImageInputContextProvider = function (_a) {
|
|
|
133
156
|
newValue[idx] = newImage;
|
|
134
157
|
onChange(id, newValue);
|
|
135
158
|
};
|
|
136
|
-
var
|
|
159
|
+
var _h = (0, react_1.useState)(false), imageUnderEdit = _h[0], setImageUnderEdit = _h[1];
|
|
137
160
|
return (react_1.default.createElement(exports.ImageInputContext.Provider, { value: {
|
|
138
161
|
//props
|
|
139
162
|
id: id,
|
|
@@ -154,7 +177,9 @@ var ImageInputContextProvider = function (_a) {
|
|
|
154
177
|
omitEditorTools: omitEditorTools,
|
|
155
178
|
//handlers, states initiated in this Context
|
|
156
179
|
upload: upload,
|
|
157
|
-
handleUpload:
|
|
180
|
+
handleUpload: showImageUploadCaution.enable
|
|
181
|
+
? handleUploadWithCheck
|
|
182
|
+
: handleUpload,
|
|
158
183
|
noOfImagesUploading: noOfImagesUploading,
|
|
159
184
|
publicUrlBeingReplaced: publicUrlBeingReplaced,
|
|
160
185
|
uploadProgress: uploadProgress,
|
|
@@ -166,7 +191,11 @@ var ImageInputContextProvider = function (_a) {
|
|
|
166
191
|
setImageUnderEdit: setImageUnderEdit,
|
|
167
192
|
showOptionalLabelInDropzone: showOptionalLabelInDropzone,
|
|
168
193
|
isRequired: isRequired,
|
|
169
|
-
isInRTE: isInRTE
|
|
194
|
+
isInRTE: isInRTE,
|
|
195
|
+
uploadArgs: uploadArgs,
|
|
196
|
+
showModal: showModal,
|
|
197
|
+
setShowModal: setShowModal,
|
|
198
|
+
showImageUploadCaution: showImageUploadCaution
|
|
170
199
|
} }, children));
|
|
171
200
|
};
|
|
172
201
|
exports.ImageInputContextProvider = ImageInputContextProvider;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
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
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -34,11 +45,14 @@ var icons_1 = require("../../../../icons");
|
|
|
34
45
|
var themes_1 = require("../../../../themes");
|
|
35
46
|
var Typo_1 = require("../../../Typo");
|
|
36
47
|
var FileUploadWrapper_1 = require("../../../FileUploadWrapper");
|
|
48
|
+
var ModalConfirm_1 = require("../../../Modals/ModalConfirm");
|
|
49
|
+
var genIcon_1 = require("../../../Dropdowns/utils/genIcon");
|
|
50
|
+
var styled_1 = require("./styled");
|
|
37
51
|
var ImageSquare = icons_1.icons.ImageSquare;
|
|
38
52
|
var greyColor100 = themes_1.colors.greyColor100;
|
|
39
53
|
var Placeholder = function (_a) {
|
|
40
54
|
var aspectRatioProp = _a.aspectRatio;
|
|
41
|
-
var _b = (0, ImageInputContext_1.useImageInputContext)(), aspectRatioFromContext = _b.aspectRatio, containerShape = _b.containerShape, uploadProgress = _b.uploadProgress, isLoading = _b.isLoading, dropzoneLabel = _b.dropzoneLabel, dropzoneSublabel = _b.dropzoneSublabel, stretchToFullHeight = _b.stretchToFullHeight, multiple = _b.multiple, showOptionalLabelInDropzone = _b.showOptionalLabelInDropzone, isRequired = _b.isRequired;
|
|
55
|
+
var _b = (0, ImageInputContext_1.useImageInputContext)(), aspectRatioFromContext = _b.aspectRatio, containerShape = _b.containerShape, uploadProgress = _b.uploadProgress, isLoading = _b.isLoading, dropzoneLabel = _b.dropzoneLabel, dropzoneSublabel = _b.dropzoneSublabel, stretchToFullHeight = _b.stretchToFullHeight, multiple = _b.multiple, showOptionalLabelInDropzone = _b.showOptionalLabelInDropzone, isRequired = _b.isRequired, showImageUploadCaution = _b.showImageUploadCaution, uploadArgs = _b.uploadArgs, showModal = _b.showModal, setShowModal = _b.setShowModal;
|
|
42
56
|
/** cuz in inlineimageinput we define an explicit aspect ratio for the placeholder only. since the image doesnt need an aspect ratio container */
|
|
43
57
|
var aspectRatio = aspectRatioProp || aspectRatioFromContext;
|
|
44
58
|
var styledPlaceholderWrapperRef = (0, react_1.useRef)(null);
|
|
@@ -65,15 +79,26 @@ var Placeholder = function (_a) {
|
|
|
65
79
|
// const [dragOverActive, setDragOverActive] = useState(false)
|
|
66
80
|
var _d = (0, ImageInputContext_1.useImageInputContext)(), handleUpload = _d.handleUpload, onChange = _d.onChange, value = _d.value, id = _d.id;
|
|
67
81
|
var inputRef = (0, react_1.useRef)(null);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
var handleOnConfirm = function () {
|
|
83
|
+
localStorage.setItem("PreUploadImageCautionAcknowleged", "true");
|
|
84
|
+
handleUpload(__assign({}, uploadArgs));
|
|
85
|
+
setShowModal(false);
|
|
86
|
+
};
|
|
87
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
88
|
+
react_1.default.createElement(AspectRatioShell_1.default, { aspectRatio: aspectRatio, containerShape: containerShape, stretchToFullHeight: stretchToFullHeight, onShellPrepared: decideUIStyle },
|
|
89
|
+
react_1.default.createElement(FileUploadWrapper_1.FileUploadWrapper, { styledPlaceholderWrapperRef: styledPlaceholderWrapperRef, uploadProgress: uploadProgress, isLoading: isLoading, containerShape: containerShape, multiple: multiple, smallPlaceholderUI: smallPlaceholderUI, mediaType: "image", handleUpload: handleUpload, onChange: onChange, value: value, id: id, inputRef: inputRef },
|
|
90
|
+
smallPlaceholderUI ? (react_1.default.createElement(react_1.Fragment, null,
|
|
91
|
+
react_1.default.createElement(ImageSquare, { size: 16, color: greyColor100 }),
|
|
92
|
+
react_1.default.createElement(Typo_1.SANS_0, { semibold: true }, dropzoneLabel),
|
|
93
|
+
showOptionalLabelInDropzone && isRequired === false && (react_1.default.createElement(Typo_1.SANS_0, null, "(optional)")))) : (react_1.default.createElement(react_1.Fragment, null,
|
|
94
|
+
react_1.default.createElement(ImageSquare, { size: 30, color: greyColor100 }),
|
|
95
|
+
react_1.default.createElement(Typo_1.SANS_2, { semibold: true }, "".concat(dropzoneLabel, " ").concat(showOptionalLabelInDropzone && isRequired === false
|
|
96
|
+
? "(optional)"
|
|
97
|
+
: "")),
|
|
98
|
+
react_1.default.createElement(Typo_1.SANS_2, null, dropzoneSublabel))),
|
|
99
|
+
showImageUploadCaution.enable ? (react_1.default.createElement(styled_1.StyledCautionMsg, null,
|
|
100
|
+
react_1.default.createElement("div", { style: { flex: 0 } }, (0, genIcon_1.genIcon)({ icon: "Info" })),
|
|
101
|
+
react_1.default.createElement(Typo_1.SANS_3, { style: { textAlign: "left" } }, showImageUploadCaution.subTitle))) : null)),
|
|
102
|
+
showModal ? (react_1.default.createElement(ModalConfirm_1.ModalConfirm, __assign({}, showImageUploadCaution, { onClose: function () { return setShowModal(false); }, onConfirm: handleOnConfirm }))) : null));
|
|
78
103
|
};
|
|
79
104
|
exports.default = Placeholder;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export const StyledPlaceholderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export const StyledPlaceholder: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export const SstyledPlaceholder: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export const StyledCautionMsg: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SstyledPlaceholder = exports.StyledPlaceholder = exports.StyledPlaceholderWrapper = void 0;
|
|
10
|
+
exports.StyledCautionMsg = exports.SstyledPlaceholder = exports.StyledPlaceholder = exports.StyledPlaceholderWrapper = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var themes_1 = require("../../../../themes");
|
|
13
13
|
var utilsOolib_1 = require("../../../../utilsOolib");
|
|
@@ -36,4 +36,5 @@ exports.SstyledPlaceholder = styled_components_1.default.div(templateObject_3 ||
|
|
|
36
36
|
var containerShape = _a.containerShape;
|
|
37
37
|
return containerShape === "circle" ? "50%" : "unset";
|
|
38
38
|
}, greyColor100);
|
|
39
|
-
|
|
39
|
+
exports.StyledCautionMsg = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\nborder: 1px solid ", " ;\ndisplay: flex;\ngap: 1rem;\nbackground-color: ", " ;\npadding: 1rem 2rem;\nmargin-top: 3rem;\nwidth: fit-content;\nmax-width: 70%;\n"], ["\n\nborder: 1px solid ", " ;\ndisplay: flex;\ngap: 1rem;\nbackground-color: ", " ;\npadding: 1rem 2rem;\nmargin-top: 3rem;\nwidth: fit-content;\nmax-width: 70%;\n"])), themes_1.colors.yellow, themes_1.colors.lightYellow);
|
|
40
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* - richInputHasValue (util)
|
|
7
7
|
* - RichTextEditor
|
|
8
8
|
*/
|
|
9
|
-
export function ImageInput({ id, value, onChange, readOnly, multiple, stretchToFullHeight, aspectRatio, containerShape, invert, enableCaptions, defaultImageSpread, allowedFormats, folderName, bucketEnv, formatConvertConfig, dropzoneLabel, dropzoneSublabel, disableImageBorder, omitEditorTools, isRequired, files, isInRTE }: {
|
|
9
|
+
export function ImageInput({ id, value, onChange, readOnly, multiple, stretchToFullHeight, aspectRatio, containerShape, invert, enableCaptions, defaultImageSpread, allowedFormats, folderName, bucketEnv, formatConvertConfig, dropzoneLabel, dropzoneSublabel, disableImageBorder, omitEditorTools, isRequired, showImageUploadCaution, files, isInRTE }: {
|
|
10
10
|
id: any;
|
|
11
11
|
value: any;
|
|
12
12
|
onChange: any;
|
|
@@ -27,6 +27,7 @@ export function ImageInput({ id, value, onChange, readOnly, multiple, stretchToF
|
|
|
27
27
|
disableImageBorder?: boolean;
|
|
28
28
|
omitEditorTools?: any[];
|
|
29
29
|
isRequired: any;
|
|
30
|
+
showImageUploadCaution?: {};
|
|
30
31
|
files: any;
|
|
31
32
|
isInRTE: any;
|
|
32
33
|
}, ...args: any[]): React.JSX.Element;
|
|
@@ -33,14 +33,14 @@ var getBlockLabelProps_1 = require("../../utils/getBlockLabelProps");
|
|
|
33
33
|
function ImageInput(_a) {
|
|
34
34
|
var id = _a.id, value = _a.value, onChange = _a.onChange, readOnly = _a.readOnly, multiple = _a.multiple, _b = _a.stretchToFullHeight, stretchToFullHeight = _b === void 0 ? false : _b, _c = _a.aspectRatio, aspectRatio = _c === void 0 ? '5/3' : _c, _d = _a.containerShape, containerShape = _d === void 0 ? 'rectangle' : _d, //alt = circle
|
|
35
35
|
invert = _a.invert, _e = _a.enableCaptions, enableCaptions = _e === void 0 ? true : _e, _f = _a.defaultImageSpread, defaultImageSpread = _f === void 0 ? 'contain' : _f, _g = _a.allowedFormats, allowedFormats = _g === void 0 ? ["jpg", "jpeg", "png"] : _g, _h = _a.folderName, folderName = _h === void 0 ? 'images' : _h, bucketEnv = _a.bucketEnv, formatConvertConfig = _a.formatConvertConfig, dropzoneLabel = _a.dropzoneLabel, dropzoneSublabel = _a.dropzoneSublabel, _j = _a.disableImageBorder, disableImageBorder = _j === void 0 ? false : _j, _k = _a.omitEditorTools, omitEditorTools = _k === void 0 ? [] : _k, //can include : 'cover_contain' | 'rotate' | 'reposition'
|
|
36
|
-
isRequired = _a.isRequired, files = _a.files, //used by RTEImageInput
|
|
36
|
+
isRequired = _a.isRequired, _l = _a.showImageUploadCaution, showImageUploadCaution = _l === void 0 ? {} : _l, files = _a.files, //used by RTEImageInput
|
|
37
37
|
isInRTE = _a.isInRTE;
|
|
38
38
|
var props = arguments[0];
|
|
39
39
|
var showOptionalLabelInDropzone = !props.label && !props.sublabel;
|
|
40
40
|
return (react_1.default.createElement(ImageInputContext_1.ImageInputContextProvider, { value: value, onChange: onChange, id: id, allowedFormats: allowedFormats, formatConvertConfig: formatConvertConfig, folderName: folderName, bucketEnv: bucketEnv, multiple: multiple, aspectRatio: aspectRatio, readOnly: readOnly, enableCaptions: enableCaptions, defaultImageSpread: defaultImageSpread, invert: invert, containerShape: containerShape, stretchToFullHeight: stretchToFullHeight, disableImageBorder: disableImageBorder, omitEditorTools: omitEditorTools, dropzoneLabel: dropzoneLabel || (multiple ? "Add Images ( max 10 )" : "Add Image"),
|
|
41
41
|
dropzoneSublabel: dropzoneSublabel ||
|
|
42
42
|
"Supports: ".concat(allowedFormats.map(function (f) { return f.toUpperCase(); }).join(", ")), showOptionalLabelInDropzone: showOptionalLabelInDropzone, // in cases like cover image scenario, we wanna show the 'optional' label in the dropzone area, rather than label area
|
|
43
|
-
isRequired: isRequired, files: files, isInRTE: isInRTE },
|
|
43
|
+
isRequired: isRequired, files: files, isInRTE: isInRTE, showImageUploadCaution: showImageUploadCaution },
|
|
44
44
|
react_1.default.createElement("div", { style: { height: stretchToFullHeight ? "100%" : "auto", } },
|
|
45
45
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, getBlockLabelProps_1.getBlockLabelProps)(__assign(__assign({}, props), { hideOptionalLabel: showOptionalLabelInDropzone })))),
|
|
46
46
|
multiple ? (react_1.default.createElement(GallerySlider_1.default, null)) : isInRTE
|
|
@@ -27,6 +27,7 @@ var CrownSimple = icons_1.icons.CrownSimple;
|
|
|
27
27
|
var CardContent = function (_a) {
|
|
28
28
|
var id = _a.id, data = _a.data, config = _a.config, to = _a.to, onClick = _a.onClick, openInNewTab = _a.openInNewTab, actions = _a.actions, highlight = _a.highlight;
|
|
29
29
|
var theme = (0, styled_components_1.useTheme)();
|
|
30
|
+
var localize = (0, utilsOolib_1.useLocale)();
|
|
30
31
|
var parseSpecialSyntax = (theme || {}).parseSpecialSyntax;
|
|
31
32
|
var showEmbedSection = !!((config === null || config === void 0 ? void 0 : config.image) || (config === null || config === void 0 ? void 0 : config.video));
|
|
32
33
|
var _b = (0, parseCardConfig_1.parseCardConfig)({
|
|
@@ -60,7 +61,7 @@ var CardContent = function (_a) {
|
|
|
60
61
|
" ",
|
|
61
62
|
react_1.default.createElement(LineClampWrapper_1.LineClampWrapper, { noOfLines_M: 6, title: title },
|
|
62
63
|
react_1.default.createElement(styled_1.StyledTitle, { capitalize: true, className: "StyledTitle" },
|
|
63
|
-
react_1.default.createElement(styled_1.StyledTitleSpan, { className: "StyledTitleSpan" }, title))))) : null),
|
|
64
|
+
react_1.default.createElement(styled_1.StyledTitleSpan, { className: "StyledTitleSpan" }, localize(title)))))) : null),
|
|
64
65
|
tagDisplay && react_1.default.createElement(Tags_1.TagDisplay, { display: tagDisplay, color: "green" }),
|
|
65
66
|
(metaBlock === null || metaBlock === void 0 ? void 0 : metaBlock.length) > 0 ? (react_1.default.createElement(MetaBlock_1.default, { data: data, config: metaBlock }) //show only two meta for cardContent
|
|
66
67
|
) : null),
|
|
@@ -27,6 +27,7 @@ var mixins_1 = require("../../../themes/mixins");
|
|
|
27
27
|
var ListContent = function (_a) {
|
|
28
28
|
var id = _a.id, data = _a.data, config = _a.config, to = _a.to, onClick = _a.onClick, openInNewTab = _a.openInNewTab, actions = _a.actions, statusTag = _a.statusTag, _b = _a.variant, variant = _b === void 0 ? "content" : _b;
|
|
29
29
|
var theme = (0, styled_components_1.useTheme)();
|
|
30
|
+
var localize = (0, utilsOolib_1.useLocale)();
|
|
30
31
|
var screenWidth = (0, _EXPORTS_1.useScreenWidth)();
|
|
31
32
|
var parseSpecialSyntax = (theme || {}).parseSpecialSyntax;
|
|
32
33
|
var _c = (0, parseCardConfig_1.parseCardConfig)({
|
|
@@ -54,7 +55,7 @@ var ListContent = function (_a) {
|
|
|
54
55
|
title ? (react_1.default.createElement("div", { style: { flexGrow: 1 } },
|
|
55
56
|
react_1.default.createElement(LineClampWrapper_1.LineClampWrapper, { noOfLines_M: 6, noOfLines_D: 3, title: title },
|
|
56
57
|
react_1.default.createElement(styled_1.StyledTitle, { capitalize: true, className: "StyledTitle" },
|
|
57
|
-
react_1.default.createElement(styled_1.StyledTitleSpan, { className: "StyledTitleSpan" }, title))))) : null,
|
|
58
|
+
react_1.default.createElement(styled_1.StyledTitleSpan, { className: "StyledTitleSpan" }, localize(title)))))) : null,
|
|
58
59
|
(metaBlock === null || metaBlock === void 0 ? void 0 : metaBlock.length) > 0 && (react_1.default.createElement("div", { style: { width: "100%", paddingTop: "1rem" } },
|
|
59
60
|
react_1.default.createElement(MetaBlock_1.default, { data: data, config: metaBlock })))),
|
|
60
61
|
variant === "content" ? ((mediaConfigExists || actions) && (react_1.default.createElement(styled_js_1.StyledContentModule2, null,
|
|
@@ -46,7 +46,13 @@ export namespace ImageInput {
|
|
|
46
46
|
readOnly: {
|
|
47
47
|
name: string;
|
|
48
48
|
control: string;
|
|
49
|
-
};
|
|
49
|
+
}; /**
|
|
50
|
+
* very important, in order to force the component to rerender
|
|
51
|
+
* when things like aspect ratio are changed.
|
|
52
|
+
* cuz natively, its not possible to modify the aspect ratio of
|
|
53
|
+
* an image input after it has rerendered.
|
|
54
|
+
* Hence this hack
|
|
55
|
+
*/
|
|
50
56
|
sizeProfile: {
|
|
51
57
|
name: string;
|
|
52
58
|
control: {
|
|
@@ -68,6 +74,10 @@ export namespace ImageInput {
|
|
|
68
74
|
name: string;
|
|
69
75
|
type: string;
|
|
70
76
|
};
|
|
77
|
+
showImageUploadCaution: {
|
|
78
|
+
name: string;
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
71
81
|
}, "imageTitle" | "dropzoneLabelMultiple" | "sizeProfile">;
|
|
72
82
|
let args: Omit<{
|
|
73
83
|
containerShape: string;
|
|
@@ -83,6 +93,7 @@ export namespace ImageInput {
|
|
|
83
93
|
imageTitle: string;
|
|
84
94
|
readOnly: boolean;
|
|
85
95
|
invert: boolean;
|
|
96
|
+
showImageUploadCaution: boolean;
|
|
86
97
|
}, "imageTitle" | "dropzoneLabelMultiple" | "sizeProfile">;
|
|
87
98
|
function render(args: any): React.JSX.Element;
|
|
88
99
|
}
|
|
@@ -130,7 +141,13 @@ export namespace ImageGallery {
|
|
|
130
141
|
readOnly: {
|
|
131
142
|
name: string;
|
|
132
143
|
control: string;
|
|
133
|
-
};
|
|
144
|
+
}; /**
|
|
145
|
+
* very important, in order to force the component to rerender
|
|
146
|
+
* when things like aspect ratio are changed.
|
|
147
|
+
* cuz natively, its not possible to modify the aspect ratio of
|
|
148
|
+
* an image input after it has rerendered.
|
|
149
|
+
* Hence this hack
|
|
150
|
+
*/
|
|
134
151
|
sizeProfile: {
|
|
135
152
|
name: string;
|
|
136
153
|
control: {
|
|
@@ -152,6 +169,10 @@ export namespace ImageGallery {
|
|
|
152
169
|
name: string;
|
|
153
170
|
type: string;
|
|
154
171
|
};
|
|
172
|
+
showImageUploadCaution: {
|
|
173
|
+
name: string;
|
|
174
|
+
type: string;
|
|
175
|
+
};
|
|
155
176
|
}, "dropzoneLabel" | "imageTitle" | "sizeProfile">;
|
|
156
177
|
export { argTypes_1 as argTypes };
|
|
157
178
|
let args_1: Omit<{
|
|
@@ -168,6 +189,7 @@ export namespace ImageGallery {
|
|
|
168
189
|
imageTitle: string;
|
|
169
190
|
readOnly: boolean;
|
|
170
191
|
invert: boolean;
|
|
192
|
+
showImageUploadCaution: boolean;
|
|
171
193
|
}, "dropzoneLabel" | "imageTitle" | "sizeProfile">;
|
|
172
194
|
export { args_1 as args };
|
|
173
195
|
export function render_1(args: any): React.JSX.Element;
|
|
@@ -217,7 +239,13 @@ export namespace ProfileImageInput {
|
|
|
217
239
|
readOnly: {
|
|
218
240
|
name: string;
|
|
219
241
|
control: string;
|
|
220
|
-
};
|
|
242
|
+
}; /**
|
|
243
|
+
* very important, in order to force the component to rerender
|
|
244
|
+
* when things like aspect ratio are changed.
|
|
245
|
+
* cuz natively, its not possible to modify the aspect ratio of
|
|
246
|
+
* an image input after it has rerendered.
|
|
247
|
+
* Hence this hack
|
|
248
|
+
*/
|
|
221
249
|
sizeProfile: {
|
|
222
250
|
name: string;
|
|
223
251
|
control: {
|
|
@@ -239,7 +267,11 @@ export namespace ProfileImageInput {
|
|
|
239
267
|
name: string;
|
|
240
268
|
type: string;
|
|
241
269
|
};
|
|
242
|
-
|
|
270
|
+
showImageUploadCaution: {
|
|
271
|
+
name: string;
|
|
272
|
+
type: string;
|
|
273
|
+
};
|
|
274
|
+
}, "size" | "aspectRatio" | "enableCaptions" | "defaultImageSpread" | "containerShape" | "dropzoneLabel" | "dropzoneSublabel" | "showImageUploadCaution" | "dropzoneLabelMultiple" | "optionalLabel">;
|
|
243
275
|
export { argTypes_2 as argTypes };
|
|
244
276
|
let args_2: Omit<{
|
|
245
277
|
containerShape: string;
|
|
@@ -255,7 +287,8 @@ export namespace ProfileImageInput {
|
|
|
255
287
|
imageTitle: string;
|
|
256
288
|
readOnly: boolean;
|
|
257
289
|
invert: boolean;
|
|
258
|
-
|
|
290
|
+
showImageUploadCaution: boolean;
|
|
291
|
+
}, "size" | "aspectRatio" | "enableCaptions" | "defaultImageSpread" | "containerShape" | "dropzoneLabel" | "dropzoneSublabel" | "showImageUploadCaution" | "dropzoneLabelMultiple" | "optionalLabel">;
|
|
259
292
|
export { args_2 as args };
|
|
260
293
|
export function render_2(args: any): React.JSX.Element;
|
|
261
294
|
export { render_2 as render };
|
|
@@ -53,7 +53,7 @@ var ImageInput_ = function (args) {
|
|
|
53
53
|
var props = __assign(__assign({}, (0, imageInputParseArgTypes_1.imageInputParseArgTypes)({
|
|
54
54
|
args: args,
|
|
55
55
|
})), { value: val, onChange: function (k, v) { return setVal(v); } });
|
|
56
|
-
console.log({
|
|
56
|
+
console.log({ props: props });
|
|
57
57
|
/**
|
|
58
58
|
* very important, in order to force the component to rerender
|
|
59
59
|
* when things like aspect ratio are changed.
|
|
@@ -150,7 +150,8 @@ exports.ProfileImageInput = {
|
|
|
150
150
|
"dropzoneSublabel",
|
|
151
151
|
"size",
|
|
152
152
|
"optionalLabel",
|
|
153
|
-
"enableCaptions"
|
|
153
|
+
"enableCaptions",
|
|
154
|
+
"showImageUploadCaution"
|
|
154
155
|
]),
|
|
155
156
|
args: (0, excludeKeys_1.excludeKeys)(imageInputArgTypes_1.imageInputArgs, [
|
|
156
157
|
"containerShape",
|
|
@@ -161,7 +162,8 @@ exports.ProfileImageInput = {
|
|
|
161
162
|
"dropzoneSublabel",
|
|
162
163
|
"size",
|
|
163
164
|
"optionalLabel",
|
|
164
|
-
"enableCaptions"
|
|
165
|
+
"enableCaptions",
|
|
166
|
+
"showImageUploadCaution"
|
|
165
167
|
]),
|
|
166
168
|
render: function (args) { return react_1.default.createElement(ProfileImageInput_, __assign({}, args)); },
|
|
167
169
|
};
|
|
@@ -90,6 +90,12 @@ export namespace imageInputArgTypes {
|
|
|
90
90
|
let type_2: string;
|
|
91
91
|
export { type_2 as type };
|
|
92
92
|
}
|
|
93
|
+
namespace showImageUploadCaution {
|
|
94
|
+
let name_13: string;
|
|
95
|
+
export { name_13 as name };
|
|
96
|
+
let type_3: string;
|
|
97
|
+
export { type_3 as type };
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
export namespace imageInputArgs {
|
|
95
101
|
let containerShape_1: string;
|
|
@@ -118,4 +124,6 @@ export namespace imageInputArgs {
|
|
|
118
124
|
export { readOnly_1 as readOnly };
|
|
119
125
|
let invert_1: boolean;
|
|
120
126
|
export { invert_1 as invert };
|
|
127
|
+
let showImageUploadCaution_1: boolean;
|
|
128
|
+
export { showImageUploadCaution_1 as showImageUploadCaution };
|
|
121
129
|
}
|
|
@@ -58,6 +58,10 @@ exports.imageInputArgTypes = {
|
|
|
58
58
|
enableCaptions: {
|
|
59
59
|
name: 'Captions',
|
|
60
60
|
type: 'boolean'
|
|
61
|
+
},
|
|
62
|
+
showImageUploadCaution: {
|
|
63
|
+
name: "Show Image Upload Caution",
|
|
64
|
+
type: 'boolean'
|
|
61
65
|
}
|
|
62
66
|
};
|
|
63
67
|
exports.imageInputArgs = {
|
|
@@ -75,4 +79,5 @@ exports.imageInputArgs = {
|
|
|
75
79
|
imageTitle: 'Placeholder Title',
|
|
76
80
|
readOnly: false,
|
|
77
81
|
invert: false,
|
|
82
|
+
showImageUploadCaution: false
|
|
78
83
|
};
|
|
@@ -14,4 +14,11 @@ export function imageInputParseArgTypes({ args, isImageSlider, isProfileImageInp
|
|
|
14
14
|
imageTitle: any;
|
|
15
15
|
isRequired: boolean;
|
|
16
16
|
enableCaptions: any;
|
|
17
|
+
showImageUploadCaution: {
|
|
18
|
+
enable: any;
|
|
19
|
+
title: string;
|
|
20
|
+
subTitle: string;
|
|
21
|
+
onConfirmText: string;
|
|
22
|
+
onCancelText: string;
|
|
23
|
+
};
|
|
17
24
|
};
|
|
@@ -8,7 +8,7 @@ var imageInputParseArgTypes = function (_a) {
|
|
|
8
8
|
var args = _a.args, _b = _a.isImageSlider, isImageSlider = _b === void 0 ? false : _b, _c = _a.isProfileImageInput, isProfileImageInput = _c === void 0 ? false : _c;
|
|
9
9
|
var _containerShape = args.containerShape, _size = args.size, _aspectRatio = args.aspectRatio, _defaultImageSpread = args.defaultImageSpread, invert = args.invert, _dropzoneLabel = args.dropzoneLabel, _dropzoneLabelMultiple = args.dropzoneLabelMultiple, dropzoneSublabel = args.dropzoneSublabel, readOnly = args.readOnly,
|
|
10
10
|
//profile image input related
|
|
11
|
-
sizeProfile = args.sizeProfile, imageTitle = args.imageTitle, optionalLabel = args.optionalLabel, enableCaptions = args.enableCaptions;
|
|
11
|
+
sizeProfile = args.sizeProfile, imageTitle = args.imageTitle, optionalLabel = args.optionalLabel, enableCaptions = args.enableCaptions, showImageUploadCaution = args.showImageUploadCaution;
|
|
12
12
|
return ({
|
|
13
13
|
containerShape: _containerShape === null || _containerShape === void 0 ? void 0 : _containerShape.toLowerCase(),
|
|
14
14
|
size: isProfileImageInput
|
|
@@ -25,7 +25,14 @@ var imageInputParseArgTypes = function (_a) {
|
|
|
25
25
|
//profile image input related
|
|
26
26
|
imageTitle: imageTitle,
|
|
27
27
|
isRequired: !optionalLabel,
|
|
28
|
-
enableCaptions: enableCaptions
|
|
28
|
+
enableCaptions: enableCaptions,
|
|
29
|
+
showImageUploadCaution: {
|
|
30
|
+
enable: showImageUploadCaution,
|
|
31
|
+
title: "Are you uploading any sensitive data?",
|
|
32
|
+
subTitle: "We are committed to protecting the identities of all students and staff at school. Please do not upload any image that is sensitive in nature or portrays a person in distress.",
|
|
33
|
+
onConfirmText: "I Understand",
|
|
34
|
+
onCancelText: "Cancel Upload",
|
|
35
|
+
}
|
|
29
36
|
});
|
|
30
37
|
};
|
|
31
38
|
exports.imageInputParseArgTypes = imageInputParseArgTypes;
|