@cerebruminc/cerebellum 13.4.0 → 13.4.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/lib/cjs/DialogHandler.cjs +2 -2
- package/lib/cjs/Form.cjs +5 -3
- package/lib/cjs/Form.cjs.map +1 -1
- package/lib/cjs/{FormikContainer-ed00a147.js → FormikContainer-cebc6fbe.js} +2 -2
- package/lib/cjs/{FormikContainer-ed00a147.js.map → FormikContainer-cebc6fbe.js.map} +1 -1
- package/lib/cjs/{ImagePicker-454ad23d.js → ImagePicker-08a324fc.js} +177 -46
- package/lib/cjs/{ImagePicker-454ad23d.js.map → ImagePicker-08a324fc.js.map} +1 -1
- package/lib/cjs/ImagePicker.cjs +4 -4
- package/lib/cjs/{SnackContainer-980dbf9f.js → SnackContainer-dcea49a1.js} +2 -2
- package/lib/cjs/{SnackContainer-980dbf9f.js.map → SnackContainer-dcea49a1.js.map} +1 -1
- package/lib/cjs/ThemeProvider.cjs +2 -2
- package/lib/cjs/{Toast-0d6d285e.js → Toast-2bc00b54.js} +5 -2
- package/lib/cjs/{Toast-0d6d285e.js.map → Toast-2bc00b54.js.map} +1 -1
- package/lib/cjs/index.cjs +6 -4
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/DialogHandler.js +2 -2
- package/lib/esm/Form.js +5 -3
- package/lib/esm/Form.js.map +1 -1
- package/lib/esm/{FormikContainer-972cb7b5.js → FormikContainer-140aa2e4.js} +2 -2
- package/lib/esm/{FormikContainer-972cb7b5.js.map → FormikContainer-140aa2e4.js.map} +1 -1
- package/lib/esm/{ImagePicker-5b68b937.js → ImagePicker-a93304aa.js} +173 -47
- package/lib/esm/{ImagePicker-5b68b937.js.map → ImagePicker-a93304aa.js.map} +1 -1
- package/lib/esm/ImagePicker.js +4 -4
- package/lib/esm/{SnackContainer-8156c4a6.js → SnackContainer-227df6f4.js} +2 -2
- package/lib/esm/{SnackContainer-8156c4a6.js.map → SnackContainer-227df6f4.js.map} +1 -1
- package/lib/esm/ThemeProvider.js +2 -2
- package/lib/esm/{Toast-40d9f007.js → Toast-d07ba541.js} +5 -2
- package/lib/esm/{Toast-40d9f007.js.map → Toast-d07ba541.js.map} +1 -1
- package/lib/esm/index.js +6 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/types/src/components/ImagePicker/ImagePickerStyles.d.ts +1 -1
- package/lib/types/src/components/ImagePicker/types.d.ts +1 -5
- package/lib/types/src/components/SnackContainer/types.d.ts +1 -0
- package/lib/types/src/helpers/compress-image.d.ts +1 -0
- package/lib/types/src/helpers/convert-heic-to-png.d.ts +1 -0
- package/package.json +4 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Toast = require('./Toast-
|
|
6
|
-
var SnackContainer = require('./SnackContainer-
|
|
5
|
+
var Toast = require('./Toast-2bc00b54.js');
|
|
6
|
+
var SnackContainer = require('./SnackContainer-dcea49a1.js');
|
|
7
7
|
require('./colors.cjs');
|
|
8
8
|
require('./_tslib-955e611e.js');
|
|
9
9
|
require('react/jsx-runtime');
|
package/lib/cjs/Form.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var FormWrapper = require('./FormStyles-0c0f28e0.js');
|
|
6
|
-
var FormikContainer = require('./FormikContainer-
|
|
6
|
+
var FormikContainer = require('./FormikContainer-cebc6fbe.js');
|
|
7
7
|
var FormFieldTypeEnum = require('./FormFieldTypeEnum.cjs');
|
|
8
8
|
require('./_tslib-955e611e.js');
|
|
9
9
|
require('styled-components');
|
|
@@ -106,14 +106,16 @@ require('./DescriptiveDropdownInput-0b5f7b1f.js');
|
|
|
106
106
|
require('./EmailInput-ee2e8ac8.js');
|
|
107
107
|
require('./InlineEmailInput-78e3cce8.js');
|
|
108
108
|
require('./Email.cjs');
|
|
109
|
-
require('./ImagePicker-
|
|
109
|
+
require('./ImagePicker-08a324fc.js');
|
|
110
110
|
require('./Delete-32a19298.js');
|
|
111
111
|
require('./Edit.cjs');
|
|
112
|
-
require('./Toast-
|
|
112
|
+
require('./Toast-2bc00b54.js');
|
|
113
113
|
require('./Typography-78d16930.js');
|
|
114
114
|
require('./TextVariantEnum.cjs');
|
|
115
115
|
require('./CheckmarkCircle.cjs');
|
|
116
116
|
require('./Warning-0428175d.js');
|
|
117
|
+
require('browser-image-compression');
|
|
118
|
+
require('libheif-js/wasm-bundle');
|
|
117
119
|
require('./SingleButton-6f14308b.js');
|
|
118
120
|
require('./MultiSelect-062af0bf.js');
|
|
119
121
|
require('./Clear.cjs');
|
package/lib/cjs/Form.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Form.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -42,7 +42,7 @@ var SwitchTypeEnum = require('./SwitchTypeEnum.cjs');
|
|
|
42
42
|
var DescriptiveDropdownInput = require('./DescriptiveDropdownInput-0b5f7b1f.js');
|
|
43
43
|
var EmailInput = require('./EmailInput-ee2e8ac8.js');
|
|
44
44
|
var InlineEmailInput = require('./InlineEmailInput-78e3cce8.js');
|
|
45
|
-
var ImagePicker = require('./ImagePicker-
|
|
45
|
+
var ImagePicker = require('./ImagePicker-08a324fc.js');
|
|
46
46
|
var MultiSelect = require('./MultiSelect-062af0bf.js');
|
|
47
47
|
var InlineInput = require('./InlineInput-ffaab44c.js');
|
|
48
48
|
var Input = require('./Input-9cf5b719.js');
|
|
@@ -1295,4 +1295,4 @@ FormikContainer.defaultProps = {
|
|
|
1295
1295
|
};
|
|
1296
1296
|
|
|
1297
1297
|
exports.FormikContainer = FormikContainer;
|
|
1298
|
-
//# sourceMappingURL=FormikContainer-
|
|
1298
|
+
//# sourceMappingURL=FormikContainer-cebc6fbe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormikContainer-
|
|
1
|
+
{"version":3,"file":"FormikContainer-cebc6fbe.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -11,21 +11,104 @@ var Edit = require('./Edit.cjs');
|
|
|
11
11
|
var formatBytesToString = require('./formatBytesToString.cjs');
|
|
12
12
|
var Inputs = require('./Inputs-0137c1dc.js');
|
|
13
13
|
var ButtonColorFamilyEnum = require('./ButtonColorFamilyEnum.cjs');
|
|
14
|
-
var Toast = require('./Toast-
|
|
14
|
+
var Toast = require('./Toast-2bc00b54.js');
|
|
15
15
|
require('react-dom');
|
|
16
16
|
var isEmptyObject = require('./isEmptyObject.cjs');
|
|
17
17
|
var useMeasure = require('./useMeasure-39ee8db4.js');
|
|
18
|
+
var imageCompression = require('browser-image-compression');
|
|
19
|
+
var libheif = require('libheif-js/wasm-bundle');
|
|
18
20
|
var showLabel = require('./showLabel-8e3c09f1.js');
|
|
19
21
|
require('./Button.cjs');
|
|
20
22
|
var SingleButton = require('./SingleButton-6f14308b.js');
|
|
21
23
|
var ButtonVariantEnum = require('./ButtonVariantEnum.cjs');
|
|
22
24
|
var IconButton = require('./IconButton-99b9f2dd.js');
|
|
23
25
|
var helpers = require('./helpers-b07f14f3.js');
|
|
26
|
+
var LoadingEllipsis = require('./LoadingEllipsis-b9895744.js');
|
|
24
27
|
var BodyLEmphasis = require('./BodyLEmphasis.cjs');
|
|
25
|
-
var Loading = require('./Loading.cjs');
|
|
26
|
-
require('./Scroller.cjs');
|
|
27
28
|
var focusAfter = require('./focusAfter.cjs');
|
|
28
29
|
|
|
30
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
31
|
+
|
|
32
|
+
var imageCompression__default = /*#__PURE__*/_interopDefaultLegacy(imageCompression);
|
|
33
|
+
var libheif__default = /*#__PURE__*/_interopDefaultLegacy(libheif);
|
|
34
|
+
|
|
35
|
+
var compressImage = function (file) { return _tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
36
|
+
var options, compressedFile;
|
|
37
|
+
return _tslib.__generator(this, function (_a) {
|
|
38
|
+
switch (_a.label) {
|
|
39
|
+
case 0:
|
|
40
|
+
options = {
|
|
41
|
+
maxSizeMB: 2,
|
|
42
|
+
maxWidthOrHeight: 1920,
|
|
43
|
+
useWebWorker: true,
|
|
44
|
+
alwaysKeepResolution: true,
|
|
45
|
+
};
|
|
46
|
+
return [4 /*yield*/, imageCompression__default["default"](file, options)];
|
|
47
|
+
case 1:
|
|
48
|
+
compressedFile = _a.sent();
|
|
49
|
+
return [2 /*return*/, compressedFile];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}); };
|
|
53
|
+
|
|
54
|
+
function dataURLToBlob(dataUrl) {
|
|
55
|
+
var byteString = atob(dataUrl.split(",")[1]);
|
|
56
|
+
var mimeString = dataUrl.split(",")[0].split(":")[1].split(";")[0];
|
|
57
|
+
var ab = new ArrayBuffer(byteString.length);
|
|
58
|
+
var ia = new Uint8Array(ab);
|
|
59
|
+
for (var i = 0; i < byteString.length; i++) {
|
|
60
|
+
ia[i] = byteString.charCodeAt(i);
|
|
61
|
+
}
|
|
62
|
+
return new Blob([ab], { type: mimeString });
|
|
63
|
+
}
|
|
64
|
+
var convertHEICtoPNG = function (file) { return _tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
65
|
+
var arrayBuffer, decoder, data, image_1, originalWidth, originalHeight, canvas, context, imageData_1, dataUrl, blob, convertedFile, error_1;
|
|
66
|
+
return _tslib.__generator(this, function (_a) {
|
|
67
|
+
switch (_a.label) {
|
|
68
|
+
case 0:
|
|
69
|
+
_a.trys.push([0, 3, , 4]);
|
|
70
|
+
return [4 /*yield*/, file.arrayBuffer()];
|
|
71
|
+
case 1:
|
|
72
|
+
arrayBuffer = _a.sent();
|
|
73
|
+
if (!arrayBuffer) {
|
|
74
|
+
throw new Error("Error: arrayBuffer is null or undefined");
|
|
75
|
+
}
|
|
76
|
+
decoder = new libheif__default["default"].HeifDecoder();
|
|
77
|
+
data = decoder.decode(new Uint8Array(arrayBuffer));
|
|
78
|
+
image_1 = data[0];
|
|
79
|
+
originalWidth = image_1.get_width();
|
|
80
|
+
originalHeight = image_1.get_height();
|
|
81
|
+
canvas = document.createElement("canvas");
|
|
82
|
+
canvas.width = originalWidth;
|
|
83
|
+
canvas.height = originalHeight;
|
|
84
|
+
context = canvas.getContext("2d");
|
|
85
|
+
if (!context) {
|
|
86
|
+
throw new Error("Error: context undefined");
|
|
87
|
+
}
|
|
88
|
+
imageData_1 = context.createImageData(originalWidth, originalHeight);
|
|
89
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
90
|
+
image_1.display(imageData_1, function (displayData) {
|
|
91
|
+
if (!displayData) {
|
|
92
|
+
return reject(new Error("HEIF processing error"));
|
|
93
|
+
}
|
|
94
|
+
resolve();
|
|
95
|
+
});
|
|
96
|
+
})];
|
|
97
|
+
case 2:
|
|
98
|
+
_a.sent();
|
|
99
|
+
context.putImageData(imageData_1, 0, 0);
|
|
100
|
+
dataUrl = canvas.toDataURL("image/png");
|
|
101
|
+
blob = dataURLToBlob(dataUrl);
|
|
102
|
+
convertedFile = new File([blob], "image.png", { type: "image/png" });
|
|
103
|
+
return [2 /*return*/, convertedFile];
|
|
104
|
+
case 3:
|
|
105
|
+
error_1 = _a.sent();
|
|
106
|
+
throw new Error("This is the error ".concat(error_1));
|
|
107
|
+
case 4: return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); };
|
|
111
|
+
|
|
29
112
|
var Base = styled.styled.div(templateObject_1 || (templateObject_1 = _tslib.__makeTemplateObject(["\n position: relative;\n width: ", "px;\n"], ["\n position: relative;\n width: ", "px;\n"])), function (_a) {
|
|
30
113
|
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
31
114
|
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.width) || theme.imagePicker.size;
|
|
@@ -63,16 +146,7 @@ var ImageInput = styled.styled.input(templateObject_3 || (templateObject_3 = _ts
|
|
|
63
146
|
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
64
147
|
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.width) || theme.imagePicker.size) - 2;
|
|
65
148
|
});
|
|
66
|
-
var
|
|
67
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
68
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.borderRadius) || theme.imagePicker.borderRadius;
|
|
69
|
-
}, function (_a) {
|
|
70
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
71
|
-
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.height) || theme.imagePicker.size) - 2;
|
|
72
|
-
}, function (_a) {
|
|
73
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
74
|
-
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.width) || theme.imagePicker.size) - 2;
|
|
75
|
-
}, Loading.loadingPseudo({}));
|
|
149
|
+
var EllipsisContainer = styled.styled.div(templateObject_4 || (templateObject_4 = _tslib.__makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n"])));
|
|
76
150
|
var CenterImage = styled.styled.div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n ", ";\n border-radius: ", "px;\n display: flex;\n overflow: hidden;\n padding: ", "px;\n pointer-events: none;\n"], ["\n ", ";\n border-radius: ", "px;\n display: flex;\n overflow: hidden;\n padding: ", "px;\n pointer-events: none;\n"])), focusAfter.absoluteFill({}), function (_a) {
|
|
77
151
|
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
78
152
|
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.borderRadius) || theme.imagePicker.borderRadius - 1;
|
|
@@ -137,7 +211,7 @@ var FakeTextLink = styled.styled.span(templateObject_14 || (templateObject_14 =
|
|
|
137
211
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
|
|
138
212
|
|
|
139
213
|
var ImagePicker = function (_a) {
|
|
140
|
-
var _b = _a.actionButtonVariant, actionButtonVariant = _b === void 0 ? ButtonVariantEnum.ButtonVariantEnum.Text : _b, actionText = _a.actionText, deleteButton = _a.deleteButton, disabled = _a.disabled, _c = _a.editButtonColorFamily, editButtonColorFamily = _c === void 0 ? ButtonColorFamilyEnum.ButtonColorFamilyEnum.Blue : _c, editButtonColorFamilyOverride = _a.editButtonColorFamilyOverride, _d = _a.deleteButtonColorFamily, deleteButtonColorFamily = _d === void 0 ? ButtonColorFamilyEnum.ButtonColorFamilyEnum.Red : _d, deleteButtonColorFamilyOverride = _a.deleteButtonColorFamilyOverride, helperText = _a.helperText, hideIcon = _a.hideIcon, imageLabel = _a.imageLabel, inline = _a.inline, PlaceholderIcon = _a.PlaceholderIcon, placeholderImageUrl = _a.placeholderImageUrl, _e = _a.placeholderInitials, placeholderInitials = _e === void 0 ? "" : _e, name = _a.name, onChange = _a.onChange, onDeleteButtonClick = _a.onDeleteButtonClick, required = _a.required, _f = _a.showValidationMessage, showValidationMessage = _f === void 0 ? false : _f, sizeLimitKB = _a.sizeLimitKB, themeOverride = _a.themeOverride, validationMessage = _a.validationMessage
|
|
214
|
+
var _b = _a.actionButtonVariant, actionButtonVariant = _b === void 0 ? ButtonVariantEnum.ButtonVariantEnum.Text : _b, actionText = _a.actionText, deleteButton = _a.deleteButton, disabled = _a.disabled, _c = _a.editButtonColorFamily, editButtonColorFamily = _c === void 0 ? ButtonColorFamilyEnum.ButtonColorFamilyEnum.Blue : _c, editButtonColorFamilyOverride = _a.editButtonColorFamilyOverride, _d = _a.deleteButtonColorFamily, deleteButtonColorFamily = _d === void 0 ? ButtonColorFamilyEnum.ButtonColorFamilyEnum.Red : _d, deleteButtonColorFamilyOverride = _a.deleteButtonColorFamilyOverride, helperText = _a.helperText, hideIcon = _a.hideIcon, imageLabel = _a.imageLabel, inline = _a.inline, PlaceholderIcon = _a.PlaceholderIcon, placeholderImageUrl = _a.placeholderImageUrl, _e = _a.placeholderInitials, placeholderInitials = _e === void 0 ? "" : _e, name = _a.name, onChange = _a.onChange, onDeleteButtonClick = _a.onDeleteButtonClick, required = _a.required, _f = _a.showValidationMessage, showValidationMessage = _f === void 0 ? false : _f, sizeLimitKB = _a.sizeLimitKB, themeOverride = _a.themeOverride, validationMessage = _a.validationMessage;
|
|
141
215
|
var theme = styled.useTheme();
|
|
142
216
|
var colorFamilies = theme.colorFamilies;
|
|
143
217
|
var disabledColor = (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.disabledColor) || theme.imagePicker.disabledColor;
|
|
@@ -150,10 +224,11 @@ var ImagePicker = function (_a) {
|
|
|
150
224
|
var _g = React.useState(""), tempFile = _g[0], setTempFile = _g[1];
|
|
151
225
|
var _h = React.useState(""), placeholder = _h[0], setPlaceholder = _h[1];
|
|
152
226
|
var _j = React.useState(""), formattedInitials = _j[0], setFormattedInitials = _j[1];
|
|
227
|
+
var _k = React.useState(false), loading = _k[0], setLoading = _k[1];
|
|
153
228
|
var labelBoxRef = React.useRef(null);
|
|
154
|
-
var
|
|
229
|
+
var _l = useMeasure.useMeasure(), inputGroupRef = _l[0], inputGroupMeasure = _l[1];
|
|
155
230
|
var validationRef = React.useRef(null);
|
|
156
|
-
var
|
|
231
|
+
var _m = React.useState(false), designSwitch = _m[0], setDesignSwitch = _m[1];
|
|
157
232
|
var helperTextVisible = imageLabel ? !showValidationMessage || !designSwitch : !showValidationMessage || !validationMessage;
|
|
158
233
|
var shortestDimension = (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.width) && (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.height) ? Math.min(themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.width, themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.height) : theme.imagePicker.size;
|
|
159
234
|
var showToast = function (_a) {
|
|
@@ -166,6 +241,10 @@ var ImagePicker = function (_a) {
|
|
|
166
241
|
title: title,
|
|
167
242
|
});
|
|
168
243
|
};
|
|
244
|
+
var getFileExtension = function (filename) {
|
|
245
|
+
var parts = filename.split(".");
|
|
246
|
+
return parts.length > 1 ? parts.pop().toLowerCase() : "";
|
|
247
|
+
};
|
|
169
248
|
// This is required when we have an initialValue.
|
|
170
249
|
// This does feel like a hack, but it works.
|
|
171
250
|
React.useEffect(function () {
|
|
@@ -181,32 +260,61 @@ var ImagePicker = function (_a) {
|
|
|
181
260
|
reader.readAsDataURL(placeholderImageUrl);
|
|
182
261
|
}
|
|
183
262
|
}, [placeholderImageUrl]);
|
|
184
|
-
var readURI = function (event) {
|
|
263
|
+
var readURI = function (event) { return _tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
264
|
+
var file, fileExtension, convertedFile, compressedFile, isNotAnImage, fileSizeKB, reader;
|
|
185
265
|
var _a, _b;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
266
|
+
return _tslib.__generator(this, function (_c) {
|
|
267
|
+
switch (_c.label) {
|
|
268
|
+
case 0:
|
|
269
|
+
_c.trys.push([0, 4, , 5]);
|
|
270
|
+
file = (_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0];
|
|
271
|
+
if (!file) {
|
|
272
|
+
throw new Error("Error: file is undefined");
|
|
273
|
+
}
|
|
274
|
+
fileExtension = getFileExtension(file.name);
|
|
275
|
+
if (!(fileExtension === "heic")) return [3 /*break*/, 3];
|
|
276
|
+
return [4 /*yield*/, convertHEICtoPNG(file)];
|
|
277
|
+
case 1:
|
|
278
|
+
convertedFile = _c.sent();
|
|
279
|
+
return [4 /*yield*/, compressImage(convertedFile)];
|
|
280
|
+
case 2:
|
|
281
|
+
compressedFile = _c.sent();
|
|
282
|
+
file = compressedFile;
|
|
283
|
+
_c.label = 3;
|
|
284
|
+
case 3:
|
|
285
|
+
isNotAnImage = !file.type.match(/^image\/+/g);
|
|
286
|
+
fileSizeKB = file.size / 1000;
|
|
287
|
+
if (isNotAnImage) {
|
|
288
|
+
showToast({ text: "Please upload an image file", colorFamily: ButtonColorFamilyEnum.ConnotationColorEnum.Negative, title: "" });
|
|
289
|
+
}
|
|
290
|
+
else if (sizeLimitKB && fileSizeKB > sizeLimitKB) {
|
|
291
|
+
showToast({
|
|
292
|
+
title: "File size exceeded",
|
|
293
|
+
text: "File size of ".concat(formatBytesToString.formatBytesToString({ bytes: file.size }), " exceeds ").concat(sizeLimitKB.toLocaleString(), "kb limit"),
|
|
294
|
+
colorFamily: ButtonColorFamilyEnum.ConnotationColorEnum.Negative,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
reader = new FileReader();
|
|
299
|
+
reader.onload = function (progress) {
|
|
300
|
+
var _a;
|
|
301
|
+
setTempFile((_a = progress === null || progress === void 0 ? void 0 : progress.target) === null || _a === void 0 ? void 0 : _a.result);
|
|
302
|
+
};
|
|
303
|
+
reader.readAsDataURL(file);
|
|
304
|
+
}
|
|
305
|
+
return [2 /*return*/, file];
|
|
306
|
+
case 4:
|
|
307
|
+
_c.sent();
|
|
308
|
+
showToast({
|
|
309
|
+
title: "",
|
|
310
|
+
text: "Error processing FIle",
|
|
311
|
+
colorFamily: ButtonColorFamilyEnum.ConnotationColorEnum.Negative,
|
|
312
|
+
});
|
|
313
|
+
return [3 /*break*/, 5];
|
|
314
|
+
case 5: return [2 /*return*/];
|
|
192
315
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
title: "File size exceeded",
|
|
196
|
-
text: "File size of ".concat(formatBytesToString.formatBytesToString({ bytes: file.size }), " exceeds ").concat(sizeLimitKB.toLocaleString(), "kb limit"),
|
|
197
|
-
colorFamily: ButtonColorFamilyEnum.ConnotationColorEnum.Negative,
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
var reader = new FileReader();
|
|
202
|
-
reader.onload = function (progress) {
|
|
203
|
-
var _a;
|
|
204
|
-
setTempFile((_a = progress === null || progress === void 0 ? void 0 : progress.target) === null || _a === void 0 ? void 0 : _a.result);
|
|
205
|
-
};
|
|
206
|
-
reader.readAsDataURL(file);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
};
|
|
316
|
+
});
|
|
317
|
+
}); };
|
|
210
318
|
React.useEffect(function () {
|
|
211
319
|
var firstTwo = placeholderInitials === null || placeholderInitials === void 0 ? void 0 : placeholderInitials.slice(0, 2);
|
|
212
320
|
setFormattedInitials(firstTwo === null || firstTwo === void 0 ? void 0 : firstTwo.toUpperCase());
|
|
@@ -224,7 +332,7 @@ var ImagePicker = function (_a) {
|
|
|
224
332
|
}
|
|
225
333
|
}, [inputGroupMeasure.width, showValidationMessage, imageLabel, validationMessage]);
|
|
226
334
|
// Clear input
|
|
227
|
-
var inputRef =
|
|
335
|
+
var inputRef = React.useRef(null);
|
|
228
336
|
var clearInput = function () {
|
|
229
337
|
if (inputRef.current) {
|
|
230
338
|
inputRef.current.value = "";
|
|
@@ -245,10 +353,33 @@ var ImagePicker = function (_a) {
|
|
|
245
353
|
labelColor: labelColor,
|
|
246
354
|
htmlFor: "".concat(imageLabel, "_imagePicker"),
|
|
247
355
|
removePaddingRight: required,
|
|
248
|
-
}), required && (jsxRuntime.jsx(Inputs.Asterisk, _tslib.__assign({ "aria-label": "Required", "$asteriskColor": asteriskColor }, { children: "*" }), void 0))] }), void 0)), jsxRuntime.jsxs(PickerBox, _tslib.__assign({ "$disabled": disabled, "$showValidationMessage": showValidationMessage, "$themeOverride": themeOverride }, { children: [loading ? (jsxRuntime.jsx(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
356
|
+
}), required && (jsxRuntime.jsx(Inputs.Asterisk, _tslib.__assign({ "aria-label": "Required", "$asteriskColor": asteriskColor }, { children: "*" }), void 0))] }), void 0)), jsxRuntime.jsxs(PickerBox, _tslib.__assign({ "$disabled": disabled, "$showValidationMessage": showValidationMessage, "$themeOverride": themeOverride }, { children: [loading ? (jsxRuntime.jsx(EllipsisContainer, { children: jsxRuntime.jsx(LoadingEllipsis.LoadingEllipsis, {}, void 0) }, void 0)) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ImageInput, _tslib.__assign({}, (imageLabel ? { id: "".concat(imageLabel, "_imagePicker") } : {}), { accept: "image/*,.heic", disabled: disabled, onChange: function (event) { return _tslib.__awaiter(void 0, void 0, void 0, function () {
|
|
357
|
+
var file, error_2;
|
|
358
|
+
var _a;
|
|
359
|
+
return _tslib.__generator(this, function (_b) {
|
|
360
|
+
switch (_b.label) {
|
|
361
|
+
case 0:
|
|
362
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
363
|
+
setLoading(true);
|
|
364
|
+
return [4 /*yield*/, readURI(event)];
|
|
365
|
+
case 1:
|
|
366
|
+
file = _b.sent();
|
|
367
|
+
if (file && ((_a = event.target.files) === null || _a === void 0 ? void 0 : _a[0])) {
|
|
368
|
+
event.target.files[0] = file;
|
|
369
|
+
}
|
|
370
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
371
|
+
return [3 /*break*/, 4];
|
|
372
|
+
case 2:
|
|
373
|
+
error_2 = _b.sent();
|
|
374
|
+
console.error("Error processing image: ".concat(error_2));
|
|
375
|
+
return [3 /*break*/, 4];
|
|
376
|
+
case 3:
|
|
377
|
+
setLoading(false);
|
|
378
|
+
return [7 /*endfinally*/];
|
|
379
|
+
case 4: return [2 /*return*/];
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}); }, name: name, required: required, "$showValidationMessage": showValidationMessage, "$themeOverride": themeOverride, type: "file" }), void 0), tempFile ? (jsxRuntime.jsx(CenterImage, _tslib.__assign({ "$themeOverride": themeOverride }, { children: jsxRuntime.jsx(LoadedImage, { src: tempFile }, void 0) }), void 0)) : placeholder ? (jsxRuntime.jsx(CenterImage, _tslib.__assign({ "$themeOverride": themeOverride }, { children: jsxRuntime.jsx(LoadedImage, { src: placeholder, "data-testid": "placeholderImage" }, void 0) }), void 0)) : placeholderInitials ? (jsxRuntime.jsx(PlaceholderCircle, _tslib.__assign({ "$themeOverride": themeOverride, "$shortestDimension": shortestDimension }, { children: jsxRuntime.jsx(PlaceholderInitials, _tslib.__assign({ "$themeOverride": themeOverride, "$shortestDimension": shortestDimension }, { children: formattedInitials }), void 0) }), void 0)) : PlaceholderIcon || actionText ? (jsxRuntime.jsxs(CenterGrid, _tslib.__assign({ "$themeOverride": themeOverride }, { children: [jsxRuntime.jsx(PlaceholderIconBox, _tslib.__assign({ "$themeOverride": themeOverride, "$shortestDimension": shortestDimension }, { children: PlaceholderIcon && jsxRuntime.jsx(PlaceholderIcon, {}, void 0) }), void 0), actionText && (jsxRuntime.jsx(ActionTextBox, { children: actionButtonVariant === ButtonVariantEnum.ButtonVariantEnum.Text ? (jsxRuntime.jsx(FakeTextLink, _tslib.__assign({ "$themeOverride": themeOverride }, { children: actionText }), void 0)) : (jsxRuntime.jsx(SingleButton.SingleButton, { variant: actionButtonVariant, text: actionText, onClick: isEmptyObject.noop, clickable: false }, void 0)) }, void 0))] }), void 0)) : null] }, void 0)), !hideIcon && !deleteButton && (jsxRuntime.jsx(EditIconBox, _tslib.__assign({ "$themeOverride": themeOverride, "$bgColor": editIconColorGroup.light }, { children: jsxRuntime.jsx(Edit.Edit, { title: "editIcon", fill: editIconColorGroup.main }, void 0) }), void 0)), deleteButton && (jsxRuntime.jsx(DeleteIconBox, _tslib.__assign({ "$themeOverride": themeOverride }, { children: jsxRuntime.jsx(IconButton.IconButton, { Icon: Delete.Trash, colorFamily: deleteButtonColorFamily, colorFamilyOverride: deleteButtonColorFamilyOverride, preventClick: disabled, size: (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.iconSize) || theme.imagePicker.iconSize, themeOverride: { backgroundColor: deleteIconColorGroup.light }, onClick: clearInput }, void 0) }), void 0))] }), void 0), !inline && validationMessage && (jsxRuntime.jsx(Inputs.ValidationText, _tslib.__assign({ ref: validationRef, "$showValidationMessage": showValidationMessage, "$disabled": disabled, "$failColor": failColor, "$disabledColor": disabledColor, "$designSwitch": designSwitch || !imageLabel }, { children: validationMessage }), void 0)), helperTextVisible && helperText && !inline && (jsxRuntime.jsx(Inputs.HelperText, _tslib.__assign({ "$disabled": disabled, "$helperTextColor": helperTextColor, "$disabledColor": disabledColor }, { children: helperText }), void 0))] }), void 0));
|
|
252
383
|
};
|
|
253
384
|
ImagePicker.defaultProps = {
|
|
254
385
|
editButtonColorFamily: ButtonColorFamilyEnum.ButtonColorFamilyEnum.Blue,
|
|
@@ -256,4 +387,4 @@ ImagePicker.defaultProps = {
|
|
|
256
387
|
};
|
|
257
388
|
|
|
258
389
|
exports.ImagePicker = ImagePicker;
|
|
259
|
-
//# sourceMappingURL=ImagePicker-
|
|
390
|
+
//# sourceMappingURL=ImagePicker-08a324fc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePicker-
|
|
1
|
+
{"version":3,"file":"ImagePicker-08a324fc.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/cjs/ImagePicker.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ImagePicker = require('./ImagePicker-
|
|
5
|
+
var ImagePicker = require('./ImagePicker-08a324fc.js');
|
|
6
6
|
require('./_tslib-955e611e.js');
|
|
7
7
|
require('react/jsx-runtime');
|
|
8
8
|
require('react');
|
|
@@ -16,7 +16,7 @@ require('./Edit.cjs');
|
|
|
16
16
|
require('./formatBytesToString.cjs');
|
|
17
17
|
require('./Inputs-0137c1dc.js');
|
|
18
18
|
require('./ButtonColorFamilyEnum.cjs');
|
|
19
|
-
require('./Toast-
|
|
19
|
+
require('./Toast-2bc00b54.js');
|
|
20
20
|
require('./Close-e95e8120.js');
|
|
21
21
|
require('./TextLink-54c3c4ed.js');
|
|
22
22
|
require('./IndicatorDown.cjs');
|
|
@@ -40,13 +40,13 @@ require('./ButtonVariantEnum.cjs');
|
|
|
40
40
|
require('./CheckmarkCircle.cjs');
|
|
41
41
|
require('./Warning-0428175d.js');
|
|
42
42
|
require('react-dom');
|
|
43
|
+
require('browser-image-compression');
|
|
44
|
+
require('libheif-js/wasm-bundle');
|
|
43
45
|
require('./showLabel-8e3c09f1.js');
|
|
44
46
|
require('./SingleButton-6f14308b.js');
|
|
45
47
|
require('./IconButton-99b9f2dd.js');
|
|
46
48
|
require('./focusAfter.cjs');
|
|
47
49
|
require('./helpers-b07f14f3.js');
|
|
48
|
-
require('./Loading.cjs');
|
|
49
|
-
require('./Scroller.cjs');
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
@@ -4,7 +4,7 @@ var _tslib = require('./_tslib-955e611e.js');
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ReactDOM = require('react-dom');
|
|
7
|
-
var Toast = require('./Toast-
|
|
7
|
+
var Toast = require('./Toast-2bc00b54.js');
|
|
8
8
|
var isEmptyObject = require('./isEmptyObject.cjs');
|
|
9
9
|
var useMeasure = require('./useMeasure-39ee8db4.js');
|
|
10
10
|
var ButtonColorFamilyEnum = require('./ButtonColorFamilyEnum.cjs');
|
|
@@ -264,4 +264,4 @@ var SnackContainer = function (_a) {
|
|
|
264
264
|
};
|
|
265
265
|
|
|
266
266
|
exports.SnackContainer = SnackContainer;
|
|
267
|
-
//# sourceMappingURL=SnackContainer-
|
|
267
|
+
//# sourceMappingURL=SnackContainer-dcea49a1.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnackContainer-
|
|
1
|
+
{"version":3,"file":"SnackContainer-dcea49a1.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,8 +6,8 @@ var _tslib = require('./_tslib-955e611e.js');
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
8
|
var cerebellumTheme = require('./cerebellumTheme.cjs');
|
|
9
|
-
var Toast = require('./Toast-
|
|
10
|
-
var SnackContainer = require('./SnackContainer-
|
|
9
|
+
var Toast = require('./Toast-2bc00b54.js');
|
|
10
|
+
var SnackContainer = require('./SnackContainer-dcea49a1.js');
|
|
11
11
|
require('./colors.cjs');
|
|
12
12
|
require('./ButtonColorFamilyEnum.cjs');
|
|
13
13
|
require('react');
|
|
@@ -161,7 +161,7 @@ var BarBase = styled.styled.section(templateObject_4 || (templateObject_4 = _tsl
|
|
|
161
161
|
var $removingThisOne = _a.$removingThisOne;
|
|
162
162
|
return ($removingThisOne ? 1 : 2);
|
|
163
163
|
});
|
|
164
|
-
var ToastBase = styled.styled.div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"], ["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
164
|
+
var ToastBase = styled.styled.div(templateObject_5 || (templateObject_5 = _tslib.__makeTemplateObject(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n min-width: ", ";\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"], ["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n min-width: ", ";\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
165
165
|
var $bgColor = _a.$bgColor;
|
|
166
166
|
return $bgColor;
|
|
167
167
|
}, function (_a) {
|
|
@@ -189,6 +189,9 @@ var ToastBase = styled.styled.div(templateObject_5 || (templateObject_5 = _tslib
|
|
|
189
189
|
: $slideUp
|
|
190
190
|
? "transform 350ms ease-out 50ms"
|
|
191
191
|
: "opacity 350ms ease-out 50ms";
|
|
192
|
+
}, function (_a) {
|
|
193
|
+
var $themeOverride = _a.$themeOverride;
|
|
194
|
+
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.minToastWidth) ? "".concat($themeOverride.minToastWidth, "px") : "auto");
|
|
192
195
|
});
|
|
193
196
|
styled.styled.div(templateObject_6 || (templateObject_6 = _tslib.__makeTemplateObject(["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: inline-block;\n padding: 15px 30px;\n max-width: 70%;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"], ["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: inline-block;\n padding: 15px 30px;\n max-width: 70%;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
194
197
|
var $bgColor = _a.$bgColor;
|
|
@@ -276,4 +279,4 @@ exports.DialogHandler = DialogHandler$1;
|
|
|
276
279
|
exports.RightSidedToastBox = RightSidedToastBox;
|
|
277
280
|
exports.Toast = Toast;
|
|
278
281
|
exports.connotationColors = connotationColors;
|
|
279
|
-
//# sourceMappingURL=Toast-
|
|
282
|
+
//# sourceMappingURL=Toast-2bc00b54.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast-
|
|
1
|
+
{"version":3,"file":"Toast-2bc00b54.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -46,13 +46,13 @@ var helpers = require('./helpers-b07f14f3.js');
|
|
|
46
46
|
var DrawerDivider = require('./DrawerDivider-8f1e423f.js');
|
|
47
47
|
var EmailInput = require('./EmailInput-ee2e8ac8.js');
|
|
48
48
|
var Footer = require('./Footer.cjs');
|
|
49
|
-
var FormikContainer = require('./FormikContainer-
|
|
49
|
+
var FormikContainer = require('./FormikContainer-cebc6fbe.js');
|
|
50
50
|
var FormFieldTypeEnum = require('./FormFieldTypeEnum.cjs');
|
|
51
51
|
var FiltersBar = require('./FiltersBar-1c53d614.js');
|
|
52
52
|
var HorizontalTabMenu = require('./HorizontalTabMenu-55955f88.js');
|
|
53
53
|
var IconButton = require('./IconButton-99b9f2dd.js');
|
|
54
54
|
var IconTile = require('./IconTile-64cb919a.js');
|
|
55
|
-
var ImagePicker = require('./ImagePicker-
|
|
55
|
+
var ImagePicker = require('./ImagePicker-08a324fc.js');
|
|
56
56
|
var InlineCreditCardInput = require('./InlineCreditCardInput-673b3096.js');
|
|
57
57
|
var InlineCurrencyInput = require('./InlineCurrencyInput-1680f1a4.js');
|
|
58
58
|
var InlineEmailInput = require('./InlineEmailInput-78e3cce8.js');
|
|
@@ -79,7 +79,7 @@ var RadioItem = require('./RadioItem-8d5f6119.js');
|
|
|
79
79
|
var RJSForm = require('./RJSForm-e54c2a95.js');
|
|
80
80
|
require('./types-92e1c1ae.js');
|
|
81
81
|
var RJSFormRenderer = require('./RJSFormRenderer-c2239d6e.js');
|
|
82
|
-
var Toast = require('./Toast-
|
|
82
|
+
var Toast = require('./Toast-2bc00b54.js');
|
|
83
83
|
require('react-dom');
|
|
84
84
|
var ButtonColorFamilyEnum = require('./ButtonColorFamilyEnum.cjs');
|
|
85
85
|
var addOrRemoveById = require('./addOrRemoveById.cjs');
|
|
@@ -288,6 +288,8 @@ require('./useIsomorphicLayoutEffect-e0094154.js');
|
|
|
288
288
|
require('dayjs');
|
|
289
289
|
require('./RadioStyles-12980dcd.js');
|
|
290
290
|
require('formik');
|
|
291
|
+
require('browser-image-compression');
|
|
292
|
+
require('libheif-js/wasm-bundle');
|
|
291
293
|
require('@rjsf/core');
|
|
292
294
|
require('@rjsf/validator-ajv8');
|
|
293
295
|
require('./filtering-43f0db28.js');
|
|
@@ -296,7 +298,7 @@ require('./TableStyles-bfbc4be4.js');
|
|
|
296
298
|
require('immutability-helper');
|
|
297
299
|
require('react-dropzone');
|
|
298
300
|
require('./DropdownInputStyles-13901ba5.js');
|
|
299
|
-
require('./SnackContainer-
|
|
301
|
+
require('./SnackContainer-dcea49a1.js');
|
|
300
302
|
|
|
301
303
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
302
304
|
|
package/lib/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/esm/DialogHandler.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { D as DialogHandler } from './Toast-
|
|
2
|
-
export { S as SnackContainer } from './SnackContainer-
|
|
1
|
+
export { D as DialogHandler } from './Toast-d07ba541.js';
|
|
2
|
+
export { S as SnackContainer } from './SnackContainer-227df6f4.js';
|
|
3
3
|
import './colors.js';
|
|
4
4
|
import './_tslib-1a4c929e.js';
|
|
5
5
|
import 'react/jsx-runtime';
|
package/lib/esm/Form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { F as FormWrapper } from './FormStyles-bf01f03c.js';
|
|
2
|
-
export { F as Form } from './FormikContainer-
|
|
2
|
+
export { F as Form } from './FormikContainer-140aa2e4.js';
|
|
3
3
|
export { FormFieldTypeEnum, RemovableFieldTypeEnum, isAddress, isCheckbox, isCheckboxGroup, isConfigurableInput, isCountrySelect, isCountySelect, isCreditCard, isCurrency, isDatePicker, isDescriptiveDropdownInput, isEmail, isFormFieldType, isImagePicker, isMultiSelect, isNumber, isPassword, isPhone, isRadioGroup, isRemovable, isSectionHeader, isSelect, isSocialSecurity, isSplitLine, isStateSelect, isTextarea, isToggle, isToggleGroup, isZipCode } from './FormFieldTypeEnum.js';
|
|
4
4
|
import './_tslib-1a4c929e.js';
|
|
5
5
|
import 'styled-components';
|
|
@@ -102,14 +102,16 @@ import './DescriptiveDropdownInput-1c8009a6.js';
|
|
|
102
102
|
import './EmailInput-3d43f7fe.js';
|
|
103
103
|
import './InlineEmailInput-b6c8b8b2.js';
|
|
104
104
|
import './Email.js';
|
|
105
|
-
import './ImagePicker-
|
|
105
|
+
import './ImagePicker-a93304aa.js';
|
|
106
106
|
import './Delete-717a8dd0.js';
|
|
107
107
|
import './Edit.js';
|
|
108
|
-
import './Toast-
|
|
108
|
+
import './Toast-d07ba541.js';
|
|
109
109
|
import './Typography-a45f29be.js';
|
|
110
110
|
import './TextVariantEnum.js';
|
|
111
111
|
import './CheckmarkCircle.js';
|
|
112
112
|
import './Warning-09535167.js';
|
|
113
|
+
import 'browser-image-compression';
|
|
114
|
+
import 'libheif-js/wasm-bundle';
|
|
113
115
|
import './SingleButton-4b90fc1f.js';
|
|
114
116
|
import './MultiSelect-fabde188.js';
|
|
115
117
|
import './Clear.js';
|
package/lib/esm/Form.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Form.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -40,7 +40,7 @@ import { SwitchTypeEnum } from './SwitchTypeEnum.js';
|
|
|
40
40
|
import { D as DescriptiveDropdownInput } from './DescriptiveDropdownInput-1c8009a6.js';
|
|
41
41
|
import { E as EmailInput } from './EmailInput-3d43f7fe.js';
|
|
42
42
|
import { I as InlineEmailInput } from './InlineEmailInput-b6c8b8b2.js';
|
|
43
|
-
import { I as ImagePicker } from './ImagePicker-
|
|
43
|
+
import { I as ImagePicker } from './ImagePicker-a93304aa.js';
|
|
44
44
|
import { M as MultiSelect } from './MultiSelect-fabde188.js';
|
|
45
45
|
import { I as InlineInput } from './InlineInput-6e99d8b3.js';
|
|
46
46
|
import { I as Input } from './Input-b6886dba.js';
|
|
@@ -1293,4 +1293,4 @@ FormikContainer.defaultProps = {
|
|
|
1293
1293
|
};
|
|
1294
1294
|
|
|
1295
1295
|
export { FormikContainer as F };
|
|
1296
|
-
//# sourceMappingURL=FormikContainer-
|
|
1296
|
+
//# sourceMappingURL=FormikContainer-140aa2e4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormikContainer-
|
|
1
|
+
{"version":3,"file":"FormikContainer-140aa2e4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __makeTemplateObject, _ as __assign } from './_tslib-1a4c929e.js';
|
|
1
|
+
import { c as __awaiter, d as __generator, a as __makeTemplateObject, _ as __assign } from './_tslib-1a4c929e.js';
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import { styled, useTheme } from 'styled-components';
|
|
@@ -9,21 +9,99 @@ import { Edit } from './Edit.js';
|
|
|
9
9
|
import { formatBytesToString } from './formatBytesToString.js';
|
|
10
10
|
import { L as LabelBox, A as Asterisk, V as ValidationText, H as HelperText } from './Inputs-e6fa30e2.js';
|
|
11
11
|
import { ButtonColorFamilyEnum, ConnotationColorEnum, SnackTypeEnum } from './ButtonColorFamilyEnum.js';
|
|
12
|
-
import { D as DialogHandler } from './Toast-
|
|
12
|
+
import { D as DialogHandler } from './Toast-d07ba541.js';
|
|
13
13
|
import 'react-dom';
|
|
14
14
|
import { noop } from './isEmptyObject.js';
|
|
15
15
|
import { u as useMeasure } from './useMeasure-c4c687e9.js';
|
|
16
|
+
import imageCompression from 'browser-image-compression';
|
|
17
|
+
import libheif from 'libheif-js/wasm-bundle';
|
|
16
18
|
import { s as showLabel } from './showLabel-b80f881c.js';
|
|
17
19
|
import './Button.js';
|
|
18
20
|
import { S as SingleButton } from './SingleButton-4b90fc1f.js';
|
|
19
21
|
import { ButtonVariantEnum } from './ButtonVariantEnum.js';
|
|
20
22
|
import { I as IconButton } from './IconButton-3083ac19.js';
|
|
21
23
|
import { A as ASTERISK_OFFSET_SPACE } from './helpers-e2f33583.js';
|
|
24
|
+
import { L as LoadingEllipsis } from './LoadingEllipsis-505a407e.js';
|
|
22
25
|
import { HeadingH2 } from './BodyLEmphasis.js';
|
|
23
|
-
import { loadingPseudo } from './Loading.js';
|
|
24
|
-
import './Scroller.js';
|
|
25
26
|
import { focusAfter, absoluteFill } from './focusAfter.js';
|
|
26
27
|
|
|
28
|
+
var compressImage = function (file) { return __awaiter(void 0, void 0, void 0, function () {
|
|
29
|
+
var options, compressedFile;
|
|
30
|
+
return __generator(this, function (_a) {
|
|
31
|
+
switch (_a.label) {
|
|
32
|
+
case 0:
|
|
33
|
+
options = {
|
|
34
|
+
maxSizeMB: 2,
|
|
35
|
+
maxWidthOrHeight: 1920,
|
|
36
|
+
useWebWorker: true,
|
|
37
|
+
alwaysKeepResolution: true,
|
|
38
|
+
};
|
|
39
|
+
return [4 /*yield*/, imageCompression(file, options)];
|
|
40
|
+
case 1:
|
|
41
|
+
compressedFile = _a.sent();
|
|
42
|
+
return [2 /*return*/, compressedFile];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}); };
|
|
46
|
+
|
|
47
|
+
function dataURLToBlob(dataUrl) {
|
|
48
|
+
var byteString = atob(dataUrl.split(",")[1]);
|
|
49
|
+
var mimeString = dataUrl.split(",")[0].split(":")[1].split(";")[0];
|
|
50
|
+
var ab = new ArrayBuffer(byteString.length);
|
|
51
|
+
var ia = new Uint8Array(ab);
|
|
52
|
+
for (var i = 0; i < byteString.length; i++) {
|
|
53
|
+
ia[i] = byteString.charCodeAt(i);
|
|
54
|
+
}
|
|
55
|
+
return new Blob([ab], { type: mimeString });
|
|
56
|
+
}
|
|
57
|
+
var convertHEICtoPNG = function (file) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
+
var arrayBuffer, decoder, data, image_1, originalWidth, originalHeight, canvas, context, imageData_1, dataUrl, blob, convertedFile, error_1;
|
|
59
|
+
return __generator(this, function (_a) {
|
|
60
|
+
switch (_a.label) {
|
|
61
|
+
case 0:
|
|
62
|
+
_a.trys.push([0, 3, , 4]);
|
|
63
|
+
return [4 /*yield*/, file.arrayBuffer()];
|
|
64
|
+
case 1:
|
|
65
|
+
arrayBuffer = _a.sent();
|
|
66
|
+
if (!arrayBuffer) {
|
|
67
|
+
throw new Error("Error: arrayBuffer is null or undefined");
|
|
68
|
+
}
|
|
69
|
+
decoder = new libheif.HeifDecoder();
|
|
70
|
+
data = decoder.decode(new Uint8Array(arrayBuffer));
|
|
71
|
+
image_1 = data[0];
|
|
72
|
+
originalWidth = image_1.get_width();
|
|
73
|
+
originalHeight = image_1.get_height();
|
|
74
|
+
canvas = document.createElement("canvas");
|
|
75
|
+
canvas.width = originalWidth;
|
|
76
|
+
canvas.height = originalHeight;
|
|
77
|
+
context = canvas.getContext("2d");
|
|
78
|
+
if (!context) {
|
|
79
|
+
throw new Error("Error: context undefined");
|
|
80
|
+
}
|
|
81
|
+
imageData_1 = context.createImageData(originalWidth, originalHeight);
|
|
82
|
+
return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
83
|
+
image_1.display(imageData_1, function (displayData) {
|
|
84
|
+
if (!displayData) {
|
|
85
|
+
return reject(new Error("HEIF processing error"));
|
|
86
|
+
}
|
|
87
|
+
resolve();
|
|
88
|
+
});
|
|
89
|
+
})];
|
|
90
|
+
case 2:
|
|
91
|
+
_a.sent();
|
|
92
|
+
context.putImageData(imageData_1, 0, 0);
|
|
93
|
+
dataUrl = canvas.toDataURL("image/png");
|
|
94
|
+
blob = dataURLToBlob(dataUrl);
|
|
95
|
+
convertedFile = new File([blob], "image.png", { type: "image/png" });
|
|
96
|
+
return [2 /*return*/, convertedFile];
|
|
97
|
+
case 3:
|
|
98
|
+
error_1 = _a.sent();
|
|
99
|
+
throw new Error("This is the error ".concat(error_1));
|
|
100
|
+
case 4: return [2 /*return*/];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}); };
|
|
104
|
+
|
|
27
105
|
var Base = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n width: ", "px;\n"], ["\n position: relative;\n width: ", "px;\n"])), function (_a) {
|
|
28
106
|
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
29
107
|
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.width) || theme.imagePicker.size;
|
|
@@ -61,16 +139,7 @@ var ImageInput = styled.input(templateObject_3 || (templateObject_3 = __makeTemp
|
|
|
61
139
|
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
62
140
|
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.width) || theme.imagePicker.size) - 2;
|
|
63
141
|
});
|
|
64
|
-
var
|
|
65
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
66
|
-
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.borderRadius) || theme.imagePicker.borderRadius;
|
|
67
|
-
}, function (_a) {
|
|
68
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
69
|
-
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.height) || theme.imagePicker.size) - 2;
|
|
70
|
-
}, function (_a) {
|
|
71
|
-
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
72
|
-
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.width) || theme.imagePicker.size) - 2;
|
|
73
|
-
}, loadingPseudo({}));
|
|
142
|
+
var EllipsisContainer = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n"])));
|
|
74
143
|
var CenterImage = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", ";\n border-radius: ", "px;\n display: flex;\n overflow: hidden;\n padding: ", "px;\n pointer-events: none;\n"], ["\n ", ";\n border-radius: ", "px;\n display: flex;\n overflow: hidden;\n padding: ", "px;\n pointer-events: none;\n"])), absoluteFill({}), function (_a) {
|
|
75
144
|
var $themeOverride = _a.$themeOverride, theme = _a.theme;
|
|
76
145
|
return ($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.borderRadius) || theme.imagePicker.borderRadius - 1;
|
|
@@ -135,7 +204,7 @@ var FakeTextLink = styled.span(templateObject_14 || (templateObject_14 = __makeT
|
|
|
135
204
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14;
|
|
136
205
|
|
|
137
206
|
var ImagePicker = function (_a) {
|
|
138
|
-
var _b = _a.actionButtonVariant, actionButtonVariant = _b === void 0 ? ButtonVariantEnum.Text : _b, actionText = _a.actionText, deleteButton = _a.deleteButton, disabled = _a.disabled, _c = _a.editButtonColorFamily, editButtonColorFamily = _c === void 0 ? ButtonColorFamilyEnum.Blue : _c, editButtonColorFamilyOverride = _a.editButtonColorFamilyOverride, _d = _a.deleteButtonColorFamily, deleteButtonColorFamily = _d === void 0 ? ButtonColorFamilyEnum.Red : _d, deleteButtonColorFamilyOverride = _a.deleteButtonColorFamilyOverride, helperText = _a.helperText, hideIcon = _a.hideIcon, imageLabel = _a.imageLabel, inline = _a.inline, PlaceholderIcon = _a.PlaceholderIcon, placeholderImageUrl = _a.placeholderImageUrl, _e = _a.placeholderInitials, placeholderInitials = _e === void 0 ? "" : _e, name = _a.name, onChange = _a.onChange, onDeleteButtonClick = _a.onDeleteButtonClick, required = _a.required, _f = _a.showValidationMessage, showValidationMessage = _f === void 0 ? false : _f, sizeLimitKB = _a.sizeLimitKB, themeOverride = _a.themeOverride, validationMessage = _a.validationMessage
|
|
207
|
+
var _b = _a.actionButtonVariant, actionButtonVariant = _b === void 0 ? ButtonVariantEnum.Text : _b, actionText = _a.actionText, deleteButton = _a.deleteButton, disabled = _a.disabled, _c = _a.editButtonColorFamily, editButtonColorFamily = _c === void 0 ? ButtonColorFamilyEnum.Blue : _c, editButtonColorFamilyOverride = _a.editButtonColorFamilyOverride, _d = _a.deleteButtonColorFamily, deleteButtonColorFamily = _d === void 0 ? ButtonColorFamilyEnum.Red : _d, deleteButtonColorFamilyOverride = _a.deleteButtonColorFamilyOverride, helperText = _a.helperText, hideIcon = _a.hideIcon, imageLabel = _a.imageLabel, inline = _a.inline, PlaceholderIcon = _a.PlaceholderIcon, placeholderImageUrl = _a.placeholderImageUrl, _e = _a.placeholderInitials, placeholderInitials = _e === void 0 ? "" : _e, name = _a.name, onChange = _a.onChange, onDeleteButtonClick = _a.onDeleteButtonClick, required = _a.required, _f = _a.showValidationMessage, showValidationMessage = _f === void 0 ? false : _f, sizeLimitKB = _a.sizeLimitKB, themeOverride = _a.themeOverride, validationMessage = _a.validationMessage;
|
|
139
208
|
var theme = useTheme();
|
|
140
209
|
var colorFamilies = theme.colorFamilies;
|
|
141
210
|
var disabledColor = (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.disabledColor) || theme.imagePicker.disabledColor;
|
|
@@ -148,10 +217,11 @@ var ImagePicker = function (_a) {
|
|
|
148
217
|
var _g = useState(""), tempFile = _g[0], setTempFile = _g[1];
|
|
149
218
|
var _h = useState(""), placeholder = _h[0], setPlaceholder = _h[1];
|
|
150
219
|
var _j = useState(""), formattedInitials = _j[0], setFormattedInitials = _j[1];
|
|
220
|
+
var _k = useState(false), loading = _k[0], setLoading = _k[1];
|
|
151
221
|
var labelBoxRef = useRef(null);
|
|
152
|
-
var
|
|
222
|
+
var _l = useMeasure(), inputGroupRef = _l[0], inputGroupMeasure = _l[1];
|
|
153
223
|
var validationRef = useRef(null);
|
|
154
|
-
var
|
|
224
|
+
var _m = useState(false), designSwitch = _m[0], setDesignSwitch = _m[1];
|
|
155
225
|
var helperTextVisible = imageLabel ? !showValidationMessage || !designSwitch : !showValidationMessage || !validationMessage;
|
|
156
226
|
var shortestDimension = (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.width) && (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.height) ? Math.min(themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.width, themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.height) : theme.imagePicker.size;
|
|
157
227
|
var showToast = function (_a) {
|
|
@@ -164,6 +234,10 @@ var ImagePicker = function (_a) {
|
|
|
164
234
|
title: title,
|
|
165
235
|
});
|
|
166
236
|
};
|
|
237
|
+
var getFileExtension = function (filename) {
|
|
238
|
+
var parts = filename.split(".");
|
|
239
|
+
return parts.length > 1 ? parts.pop().toLowerCase() : "";
|
|
240
|
+
};
|
|
167
241
|
// This is required when we have an initialValue.
|
|
168
242
|
// This does feel like a hack, but it works.
|
|
169
243
|
useEffect(function () {
|
|
@@ -179,32 +253,61 @@ var ImagePicker = function (_a) {
|
|
|
179
253
|
reader.readAsDataURL(placeholderImageUrl);
|
|
180
254
|
}
|
|
181
255
|
}, [placeholderImageUrl]);
|
|
182
|
-
var readURI = function (event) {
|
|
256
|
+
var readURI = function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
257
|
+
var file, fileExtension, convertedFile, compressedFile, isNotAnImage, fileSizeKB, reader;
|
|
183
258
|
var _a, _b;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
259
|
+
return __generator(this, function (_c) {
|
|
260
|
+
switch (_c.label) {
|
|
261
|
+
case 0:
|
|
262
|
+
_c.trys.push([0, 4, , 5]);
|
|
263
|
+
file = (_b = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0];
|
|
264
|
+
if (!file) {
|
|
265
|
+
throw new Error("Error: file is undefined");
|
|
266
|
+
}
|
|
267
|
+
fileExtension = getFileExtension(file.name);
|
|
268
|
+
if (!(fileExtension === "heic")) return [3 /*break*/, 3];
|
|
269
|
+
return [4 /*yield*/, convertHEICtoPNG(file)];
|
|
270
|
+
case 1:
|
|
271
|
+
convertedFile = _c.sent();
|
|
272
|
+
return [4 /*yield*/, compressImage(convertedFile)];
|
|
273
|
+
case 2:
|
|
274
|
+
compressedFile = _c.sent();
|
|
275
|
+
file = compressedFile;
|
|
276
|
+
_c.label = 3;
|
|
277
|
+
case 3:
|
|
278
|
+
isNotAnImage = !file.type.match(/^image\/+/g);
|
|
279
|
+
fileSizeKB = file.size / 1000;
|
|
280
|
+
if (isNotAnImage) {
|
|
281
|
+
showToast({ text: "Please upload an image file", colorFamily: ConnotationColorEnum.Negative, title: "" });
|
|
282
|
+
}
|
|
283
|
+
else if (sizeLimitKB && fileSizeKB > sizeLimitKB) {
|
|
284
|
+
showToast({
|
|
285
|
+
title: "File size exceeded",
|
|
286
|
+
text: "File size of ".concat(formatBytesToString({ bytes: file.size }), " exceeds ").concat(sizeLimitKB.toLocaleString(), "kb limit"),
|
|
287
|
+
colorFamily: ConnotationColorEnum.Negative,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
reader = new FileReader();
|
|
292
|
+
reader.onload = function (progress) {
|
|
293
|
+
var _a;
|
|
294
|
+
setTempFile((_a = progress === null || progress === void 0 ? void 0 : progress.target) === null || _a === void 0 ? void 0 : _a.result);
|
|
295
|
+
};
|
|
296
|
+
reader.readAsDataURL(file);
|
|
297
|
+
}
|
|
298
|
+
return [2 /*return*/, file];
|
|
299
|
+
case 4:
|
|
300
|
+
_c.sent();
|
|
301
|
+
showToast({
|
|
302
|
+
title: "",
|
|
303
|
+
text: "Error processing FIle",
|
|
304
|
+
colorFamily: ConnotationColorEnum.Negative,
|
|
305
|
+
});
|
|
306
|
+
return [3 /*break*/, 5];
|
|
307
|
+
case 5: return [2 /*return*/];
|
|
197
308
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
reader.onload = function (progress) {
|
|
201
|
-
var _a;
|
|
202
|
-
setTempFile((_a = progress === null || progress === void 0 ? void 0 : progress.target) === null || _a === void 0 ? void 0 : _a.result);
|
|
203
|
-
};
|
|
204
|
-
reader.readAsDataURL(file);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
};
|
|
309
|
+
});
|
|
310
|
+
}); };
|
|
208
311
|
useEffect(function () {
|
|
209
312
|
var firstTwo = placeholderInitials === null || placeholderInitials === void 0 ? void 0 : placeholderInitials.slice(0, 2);
|
|
210
313
|
setFormattedInitials(firstTwo === null || firstTwo === void 0 ? void 0 : firstTwo.toUpperCase());
|
|
@@ -222,7 +325,7 @@ var ImagePicker = function (_a) {
|
|
|
222
325
|
}
|
|
223
326
|
}, [inputGroupMeasure.width, showValidationMessage, imageLabel, validationMessage]);
|
|
224
327
|
// Clear input
|
|
225
|
-
var inputRef =
|
|
328
|
+
var inputRef = useRef(null);
|
|
226
329
|
var clearInput = function () {
|
|
227
330
|
if (inputRef.current) {
|
|
228
331
|
inputRef.current.value = "";
|
|
@@ -243,10 +346,33 @@ var ImagePicker = function (_a) {
|
|
|
243
346
|
labelColor: labelColor,
|
|
244
347
|
htmlFor: "".concat(imageLabel, "_imagePicker"),
|
|
245
348
|
removePaddingRight: required,
|
|
246
|
-
}), required && (jsx(Asterisk, __assign({ "aria-label": "Required", "$asteriskColor": asteriskColor }, { children: "*" }), void 0))] }), void 0)), jsxs(PickerBox, __assign({ "$disabled": disabled, "$showValidationMessage": showValidationMessage, "$themeOverride": themeOverride }, { children: [loading ? (jsx(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
349
|
+
}), required && (jsx(Asterisk, __assign({ "aria-label": "Required", "$asteriskColor": asteriskColor }, { children: "*" }), void 0))] }), void 0)), jsxs(PickerBox, __assign({ "$disabled": disabled, "$showValidationMessage": showValidationMessage, "$themeOverride": themeOverride }, { children: [loading ? (jsx(EllipsisContainer, { children: jsx(LoadingEllipsis, {}, void 0) }, void 0)) : (jsxs(Fragment, { children: [jsx(ImageInput, __assign({}, (imageLabel ? { id: "".concat(imageLabel, "_imagePicker") } : {}), { accept: "image/*,.heic", disabled: disabled, onChange: function (event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
350
|
+
var file, error_2;
|
|
351
|
+
var _a;
|
|
352
|
+
return __generator(this, function (_b) {
|
|
353
|
+
switch (_b.label) {
|
|
354
|
+
case 0:
|
|
355
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
356
|
+
setLoading(true);
|
|
357
|
+
return [4 /*yield*/, readURI(event)];
|
|
358
|
+
case 1:
|
|
359
|
+
file = _b.sent();
|
|
360
|
+
if (file && ((_a = event.target.files) === null || _a === void 0 ? void 0 : _a[0])) {
|
|
361
|
+
event.target.files[0] = file;
|
|
362
|
+
}
|
|
363
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
364
|
+
return [3 /*break*/, 4];
|
|
365
|
+
case 2:
|
|
366
|
+
error_2 = _b.sent();
|
|
367
|
+
console.error("Error processing image: ".concat(error_2));
|
|
368
|
+
return [3 /*break*/, 4];
|
|
369
|
+
case 3:
|
|
370
|
+
setLoading(false);
|
|
371
|
+
return [7 /*endfinally*/];
|
|
372
|
+
case 4: return [2 /*return*/];
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
}); }, name: name, required: required, "$showValidationMessage": showValidationMessage, "$themeOverride": themeOverride, type: "file" }), void 0), tempFile ? (jsx(CenterImage, __assign({ "$themeOverride": themeOverride }, { children: jsx(LoadedImage, { src: tempFile }, void 0) }), void 0)) : placeholder ? (jsx(CenterImage, __assign({ "$themeOverride": themeOverride }, { children: jsx(LoadedImage, { src: placeholder, "data-testid": "placeholderImage" }, void 0) }), void 0)) : placeholderInitials ? (jsx(PlaceholderCircle, __assign({ "$themeOverride": themeOverride, "$shortestDimension": shortestDimension }, { children: jsx(PlaceholderInitials, __assign({ "$themeOverride": themeOverride, "$shortestDimension": shortestDimension }, { children: formattedInitials }), void 0) }), void 0)) : PlaceholderIcon || actionText ? (jsxs(CenterGrid, __assign({ "$themeOverride": themeOverride }, { children: [jsx(PlaceholderIconBox, __assign({ "$themeOverride": themeOverride, "$shortestDimension": shortestDimension }, { children: PlaceholderIcon && jsx(PlaceholderIcon, {}, void 0) }), void 0), actionText && (jsx(ActionTextBox, { children: actionButtonVariant === ButtonVariantEnum.Text ? (jsx(FakeTextLink, __assign({ "$themeOverride": themeOverride }, { children: actionText }), void 0)) : (jsx(SingleButton, { variant: actionButtonVariant, text: actionText, onClick: noop, clickable: false }, void 0)) }, void 0))] }), void 0)) : null] }, void 0)), !hideIcon && !deleteButton && (jsx(EditIconBox, __assign({ "$themeOverride": themeOverride, "$bgColor": editIconColorGroup.light }, { children: jsx(Edit, { title: "editIcon", fill: editIconColorGroup.main }, void 0) }), void 0)), deleteButton && (jsx(DeleteIconBox, __assign({ "$themeOverride": themeOverride }, { children: jsx(IconButton, { Icon: Trash, colorFamily: deleteButtonColorFamily, colorFamilyOverride: deleteButtonColorFamilyOverride, preventClick: disabled, size: (themeOverride === null || themeOverride === void 0 ? void 0 : themeOverride.iconSize) || theme.imagePicker.iconSize, themeOverride: { backgroundColor: deleteIconColorGroup.light }, onClick: clearInput }, void 0) }), void 0))] }), void 0), !inline && validationMessage && (jsx(ValidationText, __assign({ ref: validationRef, "$showValidationMessage": showValidationMessage, "$disabled": disabled, "$failColor": failColor, "$disabledColor": disabledColor, "$designSwitch": designSwitch || !imageLabel }, { children: validationMessage }), void 0)), helperTextVisible && helperText && !inline && (jsx(HelperText, __assign({ "$disabled": disabled, "$helperTextColor": helperTextColor, "$disabledColor": disabledColor }, { children: helperText }), void 0))] }), void 0));
|
|
250
376
|
};
|
|
251
377
|
ImagePicker.defaultProps = {
|
|
252
378
|
editButtonColorFamily: ButtonColorFamilyEnum.Blue,
|
|
@@ -254,4 +380,4 @@ ImagePicker.defaultProps = {
|
|
|
254
380
|
};
|
|
255
381
|
|
|
256
382
|
export { ImagePicker as I };
|
|
257
|
-
//# sourceMappingURL=ImagePicker-
|
|
383
|
+
//# sourceMappingURL=ImagePicker-a93304aa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePicker-
|
|
1
|
+
{"version":3,"file":"ImagePicker-a93304aa.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/esm/ImagePicker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { I as ImagePicker } from './ImagePicker-
|
|
1
|
+
export { I as ImagePicker } from './ImagePicker-a93304aa.js';
|
|
2
2
|
import './_tslib-1a4c929e.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
@@ -12,7 +12,7 @@ import './Edit.js';
|
|
|
12
12
|
import './formatBytesToString.js';
|
|
13
13
|
import './Inputs-e6fa30e2.js';
|
|
14
14
|
import './ButtonColorFamilyEnum.js';
|
|
15
|
-
import './Toast-
|
|
15
|
+
import './Toast-d07ba541.js';
|
|
16
16
|
import './Close-51d14759.js';
|
|
17
17
|
import './TextLink-eff022f2.js';
|
|
18
18
|
import './IndicatorDown.js';
|
|
@@ -36,11 +36,11 @@ import './ButtonVariantEnum.js';
|
|
|
36
36
|
import './CheckmarkCircle.js';
|
|
37
37
|
import './Warning-09535167.js';
|
|
38
38
|
import 'react-dom';
|
|
39
|
+
import 'browser-image-compression';
|
|
40
|
+
import 'libheif-js/wasm-bundle';
|
|
39
41
|
import './showLabel-b80f881c.js';
|
|
40
42
|
import './SingleButton-4b90fc1f.js';
|
|
41
43
|
import './IconButton-3083ac19.js';
|
|
42
44
|
import './focusAfter.js';
|
|
43
45
|
import './helpers-e2f33583.js';
|
|
44
|
-
import './Loading.js';
|
|
45
|
-
import './Scroller.js';
|
|
46
46
|
//# sourceMappingURL=ImagePicker.js.map
|
|
@@ -2,7 +2,7 @@ import { f as __spreadArray, _ as __assign } from './_tslib-1a4c929e.js';
|
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useReducer, useRef, useState, useEffect, useImperativeHandle } from 'react';
|
|
4
4
|
import ReactDOM__default from 'react-dom';
|
|
5
|
-
import { S as SnackActionType, C as CentralToastBox, B as Bar, T as Toast, R as RightSidedToastBox, a as Dialog, c as connotationColors } from './Toast-
|
|
5
|
+
import { S as SnackActionType, C as CentralToastBox, B as Bar, T as Toast, R as RightSidedToastBox, a as Dialog, c as connotationColors } from './Toast-d07ba541.js';
|
|
6
6
|
import { isBrowser } from './isEmptyObject.js';
|
|
7
7
|
import { u as useMeasure } from './useMeasure-c4c687e9.js';
|
|
8
8
|
import { SnackTypeEnum, ConnotationColorEnum } from './ButtonColorFamilyEnum.js';
|
|
@@ -258,4 +258,4 @@ var SnackContainer = function (_a) {
|
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
export { SnackContainer as S };
|
|
261
|
-
//# sourceMappingURL=SnackContainer-
|
|
261
|
+
//# sourceMappingURL=SnackContainer-227df6f4.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnackContainer-
|
|
1
|
+
{"version":3,"file":"SnackContainer-227df6f4.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/esm/ThemeProvider.js
CHANGED
|
@@ -2,8 +2,8 @@ import { _ as __assign } from './_tslib-1a4c929e.js';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { ThemeProvider as ThemeProvider$1 } from 'styled-components';
|
|
4
4
|
import { cerebellumTheme } from './cerebellumTheme.js';
|
|
5
|
-
import { D as DialogHandler } from './Toast-
|
|
6
|
-
import { S as SnackContainer } from './SnackContainer-
|
|
5
|
+
import { D as DialogHandler } from './Toast-d07ba541.js';
|
|
6
|
+
import { S as SnackContainer } from './SnackContainer-227df6f4.js';
|
|
7
7
|
import './colors.js';
|
|
8
8
|
import './ButtonColorFamilyEnum.js';
|
|
9
9
|
import 'react';
|
|
@@ -155,7 +155,7 @@ var BarBase = styled.section(templateObject_4 || (templateObject_4 = __makeTempl
|
|
|
155
155
|
var $removingThisOne = _a.$removingThisOne;
|
|
156
156
|
return ($removingThisOne ? 1 : 2);
|
|
157
157
|
});
|
|
158
|
-
var ToastBase = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"], ["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
158
|
+
var ToastBase = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n min-width: ", ";\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"], ["\n background: ", ";\n border: 1px solid ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: grid;\n place-content: center;\n margin-top: ", "px;\n opacity: ", ";\n overflow: hidden;\n padding: 15px 30px;\n transform: ", ";\n transition: ", ";\n width: fit-content;\n min-width: ", ";\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
159
159
|
var $bgColor = _a.$bgColor;
|
|
160
160
|
return $bgColor;
|
|
161
161
|
}, function (_a) {
|
|
@@ -183,6 +183,9 @@ var ToastBase = styled.div(templateObject_5 || (templateObject_5 = __makeTemplat
|
|
|
183
183
|
: $slideUp
|
|
184
184
|
? "transform 350ms ease-out 50ms"
|
|
185
185
|
: "opacity 350ms ease-out 50ms";
|
|
186
|
+
}, function (_a) {
|
|
187
|
+
var $themeOverride = _a.$themeOverride;
|
|
188
|
+
return (($themeOverride === null || $themeOverride === void 0 ? void 0 : $themeOverride.minToastWidth) ? "".concat($themeOverride.minToastWidth, "px") : "auto");
|
|
186
189
|
});
|
|
187
190
|
styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: inline-block;\n padding: 15px 30px;\n max-width: 70%;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"], ["\n background-color: ", ";\n border: 1px solid;\n border-color: ", ";\n border-radius: 8px;\n box-shadow: ", ";\n color: ", ";\n display: inline-block;\n padding: 15px 30px;\n max-width: 70%;\n @media (max-width: 400px) {\n max-width: 85%;\n padding: 15px 15px;\n }\n @media print {\n display: none;\n }\n"])), function (_a) {
|
|
188
191
|
var $bgColor = _a.$bgColor;
|
|
@@ -264,4 +267,4 @@ var Toast = React__default.forwardRef(function (_a, ref) {
|
|
|
264
267
|
});
|
|
265
268
|
|
|
266
269
|
export { Bar as B, CentralToastBox as C, DialogHandler$1 as D, RightSidedToastBox as R, SnackActionType as S, Toast as T, Dialog as a, connotationColors as c };
|
|
267
|
-
//# sourceMappingURL=Toast-
|
|
270
|
+
//# sourceMappingURL=Toast-d07ba541.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast-
|
|
1
|
+
{"version":3,"file":"Toast-d07ba541.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/lib/esm/index.js
CHANGED
|
@@ -47,13 +47,13 @@ import { A as ASTERISK_OFFSET_SPACE } from './helpers-e2f33583.js';
|
|
|
47
47
|
export { D as DrawerDivider } from './DrawerDivider-5b10a31b.js';
|
|
48
48
|
export { E as EmailInput } from './EmailInput-3d43f7fe.js';
|
|
49
49
|
export { Footer } from './Footer.js';
|
|
50
|
-
export { F as Form } from './FormikContainer-
|
|
50
|
+
export { F as Form } from './FormikContainer-140aa2e4.js';
|
|
51
51
|
export { FormFieldTypeEnum, RemovableFieldTypeEnum, isAddress, isCheckbox, isCheckboxGroup, isConfigurableInput, isCountrySelect, isCountySelect, isCreditCard, isCurrency, isDatePicker, isDescriptiveDropdownInput, isEmail, isFormFieldType, isImagePicker, isMultiSelect, isNumber, isPassword, isPhone, isRadioGroup, isRemovable, isSectionHeader, isSelect, isSocialSecurity, isSplitLine, isStateSelect, isTextarea, isToggle, isToggleGroup, isZipCode } from './FormFieldTypeEnum.js';
|
|
52
52
|
export { F as FiltersBar } from './FiltersBar-25250ff0.js';
|
|
53
53
|
export { H as HorizontalTabMenu } from './HorizontalTabMenu-7f72f11a.js';
|
|
54
54
|
export { I as IconButton } from './IconButton-3083ac19.js';
|
|
55
55
|
export { I as IconTile } from './IconTile-ccdd2d4e.js';
|
|
56
|
-
export { I as ImagePicker } from './ImagePicker-
|
|
56
|
+
export { I as ImagePicker } from './ImagePicker-a93304aa.js';
|
|
57
57
|
export { I as InlineCreditCardInput, a as applyCreditCardMask } from './InlineCreditCardInput-326e0e7f.js';
|
|
58
58
|
export { I as InlineCurrencyInput, a as applyCurrencyMask } from './InlineCurrencyInput-51a48ddd.js';
|
|
59
59
|
export { I as InlineEmailInput } from './InlineEmailInput-b6c8b8b2.js';
|
|
@@ -83,7 +83,7 @@ export { R as RadioItem } from './RadioItem-ff07936b.js';
|
|
|
83
83
|
export { R as RJSForm } from './RJSForm-36c6596e.js';
|
|
84
84
|
import './types-20c5eba5.js';
|
|
85
85
|
export { R as RJSFormRenderer } from './RJSFormRenderer-e4689356.js';
|
|
86
|
-
export { D as DialogHandler } from './Toast-
|
|
86
|
+
export { D as DialogHandler } from './Toast-d07ba541.js';
|
|
87
87
|
import 'react-dom';
|
|
88
88
|
export { ButtonColorFamilyEnum, ConnotationColorEnum, CountryMaskEnum, FileTypeEnum, InputTheme, SnackTypeEnum, TextStyleEnum, USStatesEnum } from './ButtonColorFamilyEnum.js';
|
|
89
89
|
export { addOrRemoveById, addOrRemoveString, getObjectById, makeIdString, removeById, removeByIdArray, removeString, replaceObjectById, setAllKeysToValue, setObjectById, toggleObjectById } from './addOrRemoveById.js';
|
|
@@ -292,6 +292,8 @@ import './useIsomorphicLayoutEffect-02f8ff90.js';
|
|
|
292
292
|
import 'dayjs';
|
|
293
293
|
import './RadioStyles-876d7b0d.js';
|
|
294
294
|
import 'formik';
|
|
295
|
+
import 'browser-image-compression';
|
|
296
|
+
import 'libheif-js/wasm-bundle';
|
|
295
297
|
import '@rjsf/core';
|
|
296
298
|
import '@rjsf/validator-ajv8';
|
|
297
299
|
import './filtering-ce417fc1.js';
|
|
@@ -300,7 +302,7 @@ import './TableStyles-10912ab4.js';
|
|
|
300
302
|
import 'immutability-helper';
|
|
301
303
|
import 'react-dropzone';
|
|
302
304
|
import './DropdownInputStyles-fab99b6a.js';
|
|
303
|
-
import './SnackContainer-
|
|
305
|
+
import './SnackContainer-227df6f4.js';
|
|
304
306
|
|
|
305
307
|
var DesktopSelfie = function (props) {
|
|
306
308
|
var _a = props.boxed, boxed = _a === void 0 ? false : _a, _b = props.boxedSize, boxedSize = _b === void 0 ? 67 : _b, boxColor = props.boxColor, _c = props.fill, fill = _c === void 0 ? "#000000" : _c, _d = props.round, round = _d === void 0 ? false : _d, _e = props.scale, scale = _e === void 0 ? 1 : _e, title = props.title;
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { BaseProps, CenterGridProps, CenterImageProps, DeleteIconBoxProps, EditI
|
|
|
3
3
|
export declare const Base: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, BaseProps>>;
|
|
4
4
|
export declare const PickerBox: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, PickerBoxProps>>;
|
|
5
5
|
export declare const ImageInput: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, ImageInputProps>>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const EllipsisContainer: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
|
|
7
7
|
export declare const CenterImage: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, CenterImageProps>>;
|
|
8
8
|
export declare const LoadedImage: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>>;
|
|
9
9
|
export declare const PlaceholderCircle: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, PlaceholderCircleProps>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeEvent
|
|
1
|
+
import { ChangeEvent } from "react";
|
|
2
2
|
import { ButtonColorFamilyEnum } from "../../sharedTypes/enums";
|
|
3
3
|
import { ColorFamilyType } from "../../sharedTypes/types";
|
|
4
4
|
import { ButtonVariantEnum } from "../Button";
|
|
@@ -50,10 +50,6 @@ export interface ImagePickerType {
|
|
|
50
50
|
themeOverride?: ThemeOverride;
|
|
51
51
|
/** A message for when the input fails validation. Only displays if `showValidationMessage: true` */
|
|
52
52
|
validationMessage?: string;
|
|
53
|
-
/** Used to pass a ref to the ImagePicker component */
|
|
54
|
-
innerRef?: RefObject<HTMLInputElement>;
|
|
55
|
-
/** Displays a loading animation in middle of the component when true */
|
|
56
|
-
loading?: boolean;
|
|
57
53
|
}
|
|
58
54
|
export interface ThemeOverride {
|
|
59
55
|
actionButtonGap?: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const compressImage: (file: File) => Promise<File>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const convertHEICtoPNG: (file: File) => Promise<File>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerebruminc/cerebellum",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.1",
|
|
4
4
|
"description": "Cerebrum's React Component Library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/cjs/index.cjs",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"@testing-library/user-event": "^14.0.0",
|
|
88
88
|
"@types/jest": "^29.5.12",
|
|
89
89
|
"@types/jscodeshift": "^0.11.7",
|
|
90
|
+
"@types/pngjs": "^6.0.5",
|
|
90
91
|
"@types/react": "^18.2.66",
|
|
91
92
|
"@types/react-datepicker": "^6.0.3",
|
|
92
93
|
"@types/react-dom": "^18.2.22",
|
|
@@ -130,11 +131,13 @@
|
|
|
130
131
|
"@rjsf/core": "^5.10.0",
|
|
131
132
|
"@rjsf/utils": "^5.10.0",
|
|
132
133
|
"@rjsf/validator-ajv8": "^5.12.0",
|
|
134
|
+
"browser-image-compression": "^2.0.2",
|
|
133
135
|
"country-flag-icons": "^1.5.11",
|
|
134
136
|
"dayjs": "^1.10.7",
|
|
135
137
|
"dotenv": "^10.0.0",
|
|
136
138
|
"formik": "^2.2.9",
|
|
137
139
|
"immutability-helper": "^3.1.1",
|
|
140
|
+
"libheif-js": "^1.17.1",
|
|
138
141
|
"react-datepicker": "^6.2.0",
|
|
139
142
|
"react-dropzone": "^14.2.2",
|
|
140
143
|
"react-google-autocomplete": "^2.6.1",
|