oolib 2.63.4 → 2.63.6
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/Dropdowns/comps/OptionContent/index.js +1 -1
- package/dist/components/Dropdowns/utils/genProfileImg.d.ts +1 -2
- package/dist/components/Dropdowns/utils/genProfileImg.js +4 -12
- package/dist/components/ImageInput/comps/ImageEditor/index.js +1 -1
- package/dist/components/ImageInput/comps/ImageEditor/utils/smallImageInputUIConditionsMet.d.ts +1 -2
- package/dist/components/ImageInput/comps/ImageEditor/utils/smallImageInputUIConditionsMet.js +2 -2
- package/dist/components/ImageInput/derivedComps/ProfileImageInput/index.d.ts +16 -0
- package/dist/components/ImageInput/derivedComps/ProfileImageInput/index.js +59 -0
- package/dist/components/OKELink/index.js +2 -3
- package/package.json +1 -1
- package/dist/utilsOolib/renderImagePlaceholderForOolibPreview.d.ts +0 -2
- package/dist/utilsOolib/renderImagePlaceholderForOolibPreview.js +0 -26
|
@@ -21,7 +21,7 @@ var OptionContent = function (_a) {
|
|
|
21
21
|
gap: "1rem",
|
|
22
22
|
maxWidth: "36rem",
|
|
23
23
|
} },
|
|
24
|
-
(0, genProfileImg_1.genProfileImg)({ image: image, display: display, invert: invert, theme: theme }),
|
|
24
|
+
image && (0, genProfileImg_1.genProfileImg)({ image: image, display: display, invert: invert, theme: theme }),
|
|
25
25
|
icon && (0, genIcon_1.genIcon)(icon),
|
|
26
26
|
react_1.default.createElement("div", null,
|
|
27
27
|
react_1.default.createElement(TypoComp, { invert: invert, semibold: desc ? true : false, className: "OKE-Dropdown__optionText ".concat(optionsClassName || "") }, (0, getText_1.getText)(display)),
|
|
@@ -5,18 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.genProfileImg = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var
|
|
8
|
+
var ProfileImageInput_1 = require("../../ImageInput/derivedComps/ProfileImageInput");
|
|
9
9
|
var genProfileImg = function (_a) {
|
|
10
|
-
var image = _a.image, display = _a.display, invert = _a.invert
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (0, renderImagePlaceholderForOolibPreview_1.renderImagePlaceholderForOolibPreview)();
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
var ProfileImageDisplay = theme.ProfileImageDisplay;
|
|
17
|
-
return (react_1.default.createElement("div", { style: { flex: "0 0 auto" } },
|
|
18
|
-
react_1.default.createElement(ProfileImageDisplay, { value: image, imageTitle: display, size: 20, invert: invert })));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
10
|
+
var image = _a.image, display = _a.display, invert = _a.invert;
|
|
11
|
+
return (react_1.default.createElement("div", { style: { flex: "0 0 auto" } },
|
|
12
|
+
react_1.default.createElement(ProfileImageInput_1.ProfileImageInput, { readOnly: true, value: image, imageTitle: display, size: 20, invert: invert })));
|
|
21
13
|
};
|
|
22
14
|
exports.genProfileImg = genProfileImg;
|
|
@@ -109,7 +109,7 @@ function ImageEditor(_a) {
|
|
|
109
109
|
if (isInPopUp) {
|
|
110
110
|
setEditorStyle("toolbar");
|
|
111
111
|
}
|
|
112
|
-
else if ((0, smallImageInputUIConditionsMet_1.smallImageInputUIConditionsMet)({ width: width, height: height
|
|
112
|
+
else if ((0, smallImageInputUIConditionsMet_1.smallImageInputUIConditionsMet)({ width: width, height: height }) || containerShape === 'circle') {
|
|
113
113
|
setEditorStyle("modal");
|
|
114
114
|
}
|
|
115
115
|
else {
|
package/dist/components/ImageInput/comps/ImageEditor/utils/smallImageInputUIConditionsMet.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.smallImageInputUIConditionsMet = void 0;
|
|
4
4
|
var smallImageInputUIConditionsMet = function (_a) {
|
|
5
|
-
var width = _a.width, height = _a.height
|
|
6
|
-
return width < 300 || height < 300
|
|
5
|
+
var width = _a.width, height = _a.height;
|
|
6
|
+
return width < 300 || height < 300;
|
|
7
7
|
};
|
|
8
8
|
exports.smallImageInputUIConditionsMet = smallImageInputUIConditionsMet;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function ProfileImageInput({ id, value, onChange, readOnly, invert, allowedFormats, disableImageBorder, defaultImageSpread, containerShape, size, imageTitle: _imageTitle, imageTitlePath, content: _content, }: {
|
|
2
|
+
id: any;
|
|
3
|
+
value: any;
|
|
4
|
+
onChange: any;
|
|
5
|
+
readOnly: any;
|
|
6
|
+
invert: any;
|
|
7
|
+
allowedFormats?: string[];
|
|
8
|
+
disableImageBorder: any;
|
|
9
|
+
defaultImageSpread?: string;
|
|
10
|
+
containerShape?: string;
|
|
11
|
+
size?: number;
|
|
12
|
+
imageTitle: any;
|
|
13
|
+
imageTitlePath: any;
|
|
14
|
+
content: any;
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
import React from "react";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProfileImageInput = void 0;
|
|
7
|
+
var react_1 = __importDefault(require("react"));
|
|
8
|
+
var __1 = require("../../");
|
|
9
|
+
var themes_1 = require("../../../../themes");
|
|
10
|
+
var getVal_1 = require("../../../../utils/getterSetterDeleter/getVal");
|
|
11
|
+
var makeArrayFromLength_1 = require("../../../../utils/makeArrayFromLength");
|
|
12
|
+
var Typo_1 = require("../../../Typo");
|
|
13
|
+
var ProfileImageInput = function (_a) {
|
|
14
|
+
var _b;
|
|
15
|
+
var
|
|
16
|
+
//props that pass on to ImageInput
|
|
17
|
+
id = _a.id, value = _a.value, onChange = _a.onChange, readOnly = _a.readOnly, invert = _a.invert, _c = _a.allowedFormats, allowedFormats = _c === void 0 ? ["jpg", "jpeg", "png"] : _c, disableImageBorder = _a.disableImageBorder, _d = _a.defaultImageSpread, defaultImageSpread = _d === void 0 ? "cover" : _d, _e = _a.containerShape, containerShape = _e === void 0 ? "circle" : _e,
|
|
18
|
+
//ProfileImageInput specific props
|
|
19
|
+
_f = _a.size,
|
|
20
|
+
//ProfileImageInput specific props
|
|
21
|
+
size = _f === void 0 ? 200 : _f, // Number > representing pixels
|
|
22
|
+
_imageTitle = _a.imageTitle, imageTitlePath = _a.imageTitlePath, _content = _a.content;
|
|
23
|
+
var content = _content;
|
|
24
|
+
var imageTitle = _imageTitle ||
|
|
25
|
+
(imageTitlePath && (0, getVal_1.getVal)(content, imageTitlePath)) ||
|
|
26
|
+
(value && ((_b = value[0]) === null || _b === void 0 ? void 0 : _b.publicUrl)) ||
|
|
27
|
+
"";
|
|
28
|
+
var sizeString = size + "px";
|
|
29
|
+
var calcPlaceholderInitialSize = function (_size) {
|
|
30
|
+
var size = _size / 10; //cuz now we are using pixel size
|
|
31
|
+
if (typeof size !== "number")
|
|
32
|
+
return undefined;
|
|
33
|
+
var inverseDecay = function (size) { return (1.2 / (size * size)) * 7; };
|
|
34
|
+
var textSize = 0;
|
|
35
|
+
(0, makeArrayFromLength_1.makeArrayFromLength)(size).map(function (s) {
|
|
36
|
+
textSize = textSize + inverseDecay(s + 1);
|
|
37
|
+
});
|
|
38
|
+
return textSize + size / 2;
|
|
39
|
+
};
|
|
40
|
+
return (react_1.default.createElement("div", { style: { width: sizeString, height: sizeString } },
|
|
41
|
+
//if edit mode then show imageinput
|
|
42
|
+
//if readonly mode, then value has to exist for imageinput to show
|
|
43
|
+
//the Array check is important so that string do that get accepted as value
|
|
44
|
+
((Array.isArray(value) && (value === null || value === void 0 ? void 0 : value.length) > 0) || !readOnly) ? (react_1.default.createElement(__1.ImageInput, { id: id, value: value, onChange: onChange, aspectRatio: "1/1", containerShape: containerShape, enableCaptions: false, defaultImageSpread: defaultImageSpread, formatConvertConfig: "noConversion", omitEditorTools: ['cover_contain'], allowedFormats: allowedFormats, readOnly: readOnly, invert: invert, disableImageBorder: disableImageBorder })) : (react_1.default.createElement("div", { style: {
|
|
45
|
+
width: "100%",
|
|
46
|
+
height: "100%",
|
|
47
|
+
borderRadius: "50%",
|
|
48
|
+
backgroundColor: invert ? themes_1.colors.greyColor80 : themes_1.colors.greyColor100,
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center'
|
|
52
|
+
} },
|
|
53
|
+
react_1.default.createElement(Typo_1.LABEL, { style: {
|
|
54
|
+
fontSize: calcPlaceholderInitialSize(size),
|
|
55
|
+
fontWeight: 500,
|
|
56
|
+
letterSpacing: 0,
|
|
57
|
+
}, invert: true }, imageTitle.charAt(0).toUpperCase())))));
|
|
58
|
+
};
|
|
59
|
+
exports.ProfileImageInput = ProfileImageInput;
|
|
@@ -37,12 +37,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.OKELink = void 0;
|
|
38
38
|
var react_1 = __importStar(require("react"));
|
|
39
39
|
var react_router_dom_1 = require("react-router-dom");
|
|
40
|
-
// import { ProfileImageDisplay } from '../../inputs/ImageInput/derivedComps/ProfileImageDisplay'
|
|
41
40
|
var styled_components_1 = require("styled-components");
|
|
42
41
|
var DisplayIcon_1 = require("../../utils/comps/DisplayIcon");
|
|
43
42
|
var injectHttps_1 = require("../../utils/injectHttps");
|
|
44
43
|
var utilsOolib_1 = require("../../utilsOolib");
|
|
45
44
|
var styled_1 = require("./styled");
|
|
45
|
+
var ProfileImageInput_1 = require("../ImageInput/derivedComps/ProfileImageInput");
|
|
46
46
|
var OKELink = function (_a) {
|
|
47
47
|
var _to = _a.to, link = _a.link, //link is deprecated. use to instead
|
|
48
48
|
onClick = _a.onClick, icon = _a.icon, iconAfter = _a.iconAfter, text = _a.text, children = _a.children, invertUnderline = _a.invertUnderline, color = _a.color, invert = _a.invert, disabled = _a.disabled, className = _a.className, style = _a.style, avatar = _a.avatar, // imageData // [ {...} ] OR {...}
|
|
@@ -82,12 +82,11 @@ var OKELink = function (_a) {
|
|
|
82
82
|
}));
|
|
83
83
|
};
|
|
84
84
|
var genAvatar = function (avatar) {
|
|
85
|
-
var _a;
|
|
86
85
|
if (!avatar)
|
|
87
86
|
return;
|
|
88
87
|
//else
|
|
89
88
|
return (react_1.default.createElement("div", { style: { marginRight: '1rem', flex: '0 0 auto' } },
|
|
90
|
-
react_1.default.createElement(
|
|
89
|
+
react_1.default.createElement(ProfileImageInput_1.ProfileImageInput, { readOnly: true, value: avatar === null || avatar === void 0 ? void 0 : avatar.userUploaded, imageTitle: children || text, size: 20, invert: invert })));
|
|
91
90
|
};
|
|
92
91
|
var linkContents = react_1.default.createElement(react_1.Fragment, null,
|
|
93
92
|
genAvatar(avatar),
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderImagePlaceholderForOolibPreview = void 0;
|
|
7
|
-
var react_1 = __importDefault(require("react"));
|
|
8
|
-
var phosphor_react_1 = require("phosphor-react");
|
|
9
|
-
var Tooltip_1 = require("../components/Tooltip");
|
|
10
|
-
var themes_1 = require("../themes");
|
|
11
|
-
var renderImagePlaceholderForOolibPreview = function (options) {
|
|
12
|
-
if (options === void 0) { options = {}; }
|
|
13
|
-
var _a = options.width, width = _a === void 0 ? "2rem" : _a, _b = options.height, height = _b === void 0 ? '2rem' : _b, _c = options.borderRadius, borderRadius = _c === void 0 ? "50%" : _c, _d = options.tooltipPos, tooltipPos = _d === void 0 ? 'bottom' : _d;
|
|
14
|
-
return (react_1.default.createElement("div", { style: {
|
|
15
|
-
width: width,
|
|
16
|
-
height: height,
|
|
17
|
-
borderRadius: borderRadius,
|
|
18
|
-
background: themes_1.colors.lightRed,
|
|
19
|
-
display: "flex",
|
|
20
|
-
justifyContent: "center",
|
|
21
|
-
alignItems: "center",
|
|
22
|
-
flex: "0 0 auto",
|
|
23
|
-
} },
|
|
24
|
-
react_1.default.createElement(Tooltip_1.Tooltip, { popOutOfOverflowHiddenParent: true, position: tooltipPos, text: "ProfileImageDisplay component needs to be provided via theme provider in order to render profile image", presetTarget: "infoIcon" })));
|
|
25
|
-
};
|
|
26
|
-
exports.renderImagePlaceholderForOolibPreview = renderImagePlaceholderForOolibPreview;
|