@luscii-healthtech/web-ui 8.1.2 → 8.2.0
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/MediaPicker/MediaPicker.d.ts +8 -0
- package/dist/index.development.js +36 -14
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/web-ui-tailwind.css +19 -0
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,10 @@ export interface ImagePickerProps {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
acceptedMimeTypes?: string[];
|
|
33
|
+
/**
|
|
34
|
+
* Maximum file size allowed to be uploaded in MB. If undefined, a default limit of 100mb is applied.
|
|
35
|
+
*/
|
|
36
|
+
maxFileSize?: number;
|
|
33
37
|
clearImageIndex?: number;
|
|
34
38
|
type?: "normal" | "compact";
|
|
35
39
|
isDisabled?: boolean;
|
|
@@ -76,6 +80,10 @@ export interface MediaPickerProps {
|
|
|
76
80
|
* ```
|
|
77
81
|
*/
|
|
78
82
|
acceptedMimeTypes?: string[];
|
|
83
|
+
/**
|
|
84
|
+
* Maximum file size allowed to be uploaded in MB. If undefined, a default limit of 100mb is applied.
|
|
85
|
+
*/
|
|
86
|
+
maxFileSize?: number;
|
|
79
87
|
isDisabled?: boolean;
|
|
80
88
|
onChange: (target: TargetProps) => void;
|
|
81
89
|
isUploadButtonVisible?: boolean;
|
|
@@ -208,8 +208,8 @@ const allowedHoverColors = {
|
|
|
208
208
|
white: "hover:ui-text-white"
|
|
209
209
|
};
|
|
210
210
|
const allowedGroupHoverColors = {
|
|
211
|
-
"blue-900": "
|
|
212
|
-
white: "
|
|
211
|
+
"blue-900": "group-hover:ui-text-blue-900",
|
|
212
|
+
white: "group-hover:ui-text-white"
|
|
213
213
|
};
|
|
214
214
|
const Text = (props) => {
|
|
215
215
|
var _a;
|
|
@@ -3155,7 +3155,7 @@ function TableBodyRowDataCell(props) {
|
|
|
3155
3155
|
),
|
|
3156
3156
|
isTableFieldAction(content) && React__namespace.default.createElement("div", { className: classNames__default.default("ui-flex ui-flex-row ui-justify-end", "ui-transition-opacity ui-duration-300 ui-ease-in-out", {
|
|
3157
3157
|
"ui-opacity-0": props.fieldConfig.onlyShowContentOnHovering,
|
|
3158
|
-
"
|
|
3158
|
+
"group-hover:ui-opacity-100": props.fieldConfig.onlyShowContentOnHovering
|
|
3159
3159
|
}) }, content.map((action) => {
|
|
3160
3160
|
if (!action) {
|
|
3161
3161
|
return null;
|
|
@@ -3173,7 +3173,7 @@ function TableBodyRow(props) {
|
|
|
3173
3173
|
event.stopPropagation();
|
|
3174
3174
|
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, props.item);
|
|
3175
3175
|
};
|
|
3176
|
-
return React__namespace.default.createElement("tr", { tabIndex: 0, className: classNames__default.default("group", {
|
|
3176
|
+
return React__namespace.default.createElement("tr", { tabIndex: 0, className: classNames__default.default("ui-group", {
|
|
3177
3177
|
"ui-cursor-pointer ui-transition-colors ui-duration-300 ui-ease-in-out hover:ui-bg-blue-50 focus:ui-outline-primary": props.onClick,
|
|
3178
3178
|
"ui-cursor-default hover:ui-bg-white": !props.onClick
|
|
3179
3179
|
}, props.className), onClick: handleRowClick }, props.fieldConfigurations.map((fieldConfig) => React__namespace.default.createElement(TableBodyRowDataCell, { key: fieldConfig.key, item: props.item, fieldConfig, emptyFieldContentText: props.emptyFieldContentText })));
|
|
@@ -4633,7 +4633,26 @@ const ImageCategory = (props) => {
|
|
|
4633
4633
|
);
|
|
4634
4634
|
};
|
|
4635
4635
|
|
|
4636
|
-
const ImagePickerInner = ({
|
|
4636
|
+
const ImagePickerInner = ({
|
|
4637
|
+
categories,
|
|
4638
|
+
clearImageIndex,
|
|
4639
|
+
handleChange,
|
|
4640
|
+
images,
|
|
4641
|
+
isDisabled = false,
|
|
4642
|
+
name,
|
|
4643
|
+
preselectedImage,
|
|
4644
|
+
preselectedMediaType = "image",
|
|
4645
|
+
acceptedMimeTypes = ["image/svg+xml"],
|
|
4646
|
+
maxFileSize = 100,
|
|
4647
|
+
//100mb
|
|
4648
|
+
type = "normal",
|
|
4649
|
+
isUploadButtonVisible = false,
|
|
4650
|
+
isClearButtonVisible = false,
|
|
4651
|
+
isUploading = false,
|
|
4652
|
+
isErrorUploading = false,
|
|
4653
|
+
localisation,
|
|
4654
|
+
innerRef
|
|
4655
|
+
}) => {
|
|
4637
4656
|
var _a;
|
|
4638
4657
|
const placeholderImage = clearImageIndex !== void 0 && images[clearImageIndex] ? images[clearImageIndex] : img;
|
|
4639
4658
|
const isTypeCompact = type === "compact";
|
|
@@ -4670,6 +4689,7 @@ const ImagePickerInner = ({ categories, clearImageIndex, handleChange, images, i
|
|
|
4670
4689
|
handleDeleteClick();
|
|
4671
4690
|
}
|
|
4672
4691
|
setHighlightedImage(event.currentTarget.src);
|
|
4692
|
+
setError(null);
|
|
4673
4693
|
};
|
|
4674
4694
|
const handleDeleteClick = () => {
|
|
4675
4695
|
handleChange({ target: { name, value: "" } });
|
|
@@ -4679,10 +4699,12 @@ const ImagePickerInner = ({ categories, clearImageIndex, handleChange, images, i
|
|
|
4679
4699
|
setSelectedMedia(placeholderImage);
|
|
4680
4700
|
setSelectedMediaType("image");
|
|
4681
4701
|
setHighlightedImage(null);
|
|
4702
|
+
setError(null);
|
|
4682
4703
|
};
|
|
4683
4704
|
function handleConfirmSelection() {
|
|
4684
4705
|
setSelectedMedia(highlightedImage !== null && highlightedImage !== void 0 ? highlightedImage : placeholderImage);
|
|
4685
4706
|
setSelectedMediaType("image");
|
|
4707
|
+
setError(null);
|
|
4686
4708
|
handleChange({
|
|
4687
4709
|
target: { name, value: highlightedImage }
|
|
4688
4710
|
});
|
|
@@ -4691,14 +4713,14 @@ const ImagePickerInner = ({ categories, clearImageIndex, handleChange, images, i
|
|
|
4691
4713
|
const handleCloseModal = () => {
|
|
4692
4714
|
setIsImagesPanelOpen(false);
|
|
4693
4715
|
};
|
|
4694
|
-
const mediaType = (mimeType) =>
|
|
4695
|
-
|
|
4696
|
-
|
|
4716
|
+
const mediaType = (mimeType) => mimeType.split("/")[0];
|
|
4717
|
+
const maxFileSizeInBytes = maxFileSize * 1e3 * 1e3;
|
|
4718
|
+
const isValidFile = (file) => acceptedMimeTypes.includes(file.type) && file.size < maxFileSizeInBytes;
|
|
4697
4719
|
const uploadImage = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
4698
4720
|
var _b;
|
|
4699
|
-
if (event.currentTarget.files) {
|
|
4721
|
+
if (event.currentTarget.files && event.currentTarget.files.length > 0) {
|
|
4700
4722
|
const file = event.currentTarget.files[0];
|
|
4701
|
-
if (
|
|
4723
|
+
if (isValidFile(file)) {
|
|
4702
4724
|
setSelectedMedia(URL.createObjectURL(file));
|
|
4703
4725
|
setSelectedMediaType(mediaType(file.type));
|
|
4704
4726
|
const data = new FormData();
|
|
@@ -4742,14 +4764,14 @@ const ImagePickerInner = ({ categories, clearImageIndex, handleChange, images, i
|
|
|
4742
4764
|
isUploadButtonVisible && React__namespace.default.createElement(
|
|
4743
4765
|
"span",
|
|
4744
4766
|
{ className: "cweb-imagePicker-upload" },
|
|
4745
|
-
React__namespace.default.createElement(SecondaryButton, { text: localisation.uploadImage, isDisabled, id: `upload-image-${name}`, onClick: () => {
|
|
4767
|
+
React__namespace.default.createElement(SecondaryButton, { text: localisation.uploadImage, isDisabled, isPending: isUploading, id: `upload-image-${name}`, onClick: () => {
|
|
4746
4768
|
var _a2;
|
|
4747
4769
|
setIsImagesPanelOpen(false);
|
|
4748
4770
|
(_a2 = fileInputRef.current) === null || _a2 === void 0 ? void 0 : _a2.click();
|
|
4749
4771
|
} }),
|
|
4750
4772
|
React__namespace.default.createElement("input", { ref: fileInputRef, type: "file", disabled: isDisabled, name: `uploaded-${name}`, accept: acceptedMimeTypes.join(","), onChange: uploadImage, className: "ui-hidden" })
|
|
4751
4773
|
),
|
|
4752
|
-
isClearButtonVisible && selectedMedia !== placeholderImage && React__namespace.default.createElement(SecondaryButton, { text: localisation.clearSelection, isDisabled, onClick: handleDeleteClick })
|
|
4774
|
+
isClearButtonVisible && selectedMedia !== placeholderImage && !isUploading && React__namespace.default.createElement(SecondaryButton, { text: localisation.clearSelection, isDisabled, isPending: isUploading, onClick: handleDeleteClick })
|
|
4753
4775
|
)
|
|
4754
4776
|
),
|
|
4755
4777
|
React__namespace.default.createElement(
|
|
@@ -5313,7 +5335,7 @@ const SortMenu = (props) => {
|
|
|
5313
5335
|
react.Menu.Button,
|
|
5314
5336
|
{ className: "ui-group ui-inline-flex ui-justify-center ui-text-sm ui-font-medium ui-text-slate-700 hover:ui-text-slate-900" },
|
|
5315
5337
|
menuLabel,
|
|
5316
|
-
React__namespace.default.createElement(solid.ChevronDownIcon, { className: "
|
|
5338
|
+
React__namespace.default.createElement(solid.ChevronDownIcon, { className: "-ui-mr-1 ui-ml-1 ui-h-5 ui-w-5 ui-flex-shrink-0 ui-text-slate-400 group-hover:ui-text-slate-500", "aria-hidden": "true" })
|
|
5317
5339
|
)
|
|
5318
5340
|
),
|
|
5319
5341
|
React__namespace.default.createElement(
|
|
@@ -5346,7 +5368,7 @@ const FiltersMenus = (props) => {
|
|
|
5346
5368
|
{ className: "ui-group ui-inline-flex ui-justify-center ui-text-sm ui-font-medium ui-text-slate-700 hover:ui-text-slate-900" },
|
|
5347
5369
|
React__namespace.default.createElement("span", null, categorizedFilter.label),
|
|
5348
5370
|
amountOfCheckedItems > 0 ? React__namespace.default.createElement("span", { className: "ui-ml-1.5 ui-rounded ui-bg-slate-200 ui-px-1.5 ui-py-0.5 ui-text-xs ui-font-semibold ui-tabular-nums ui-text-slate-700" }, amountOfCheckedItems) : null,
|
|
5349
|
-
React__namespace.default.createElement(solid.ChevronDownIcon, { className: "
|
|
5371
|
+
React__namespace.default.createElement(solid.ChevronDownIcon, { className: "-ui-mr-1 ui-ml-1 ui-h-5 ui-w-5 ui-flex-shrink-0 ui-text-slate-400 group-hover:ui-text-slate-500", "aria-hidden": "true" })
|
|
5350
5372
|
),
|
|
5351
5373
|
React__namespace.default.createElement(
|
|
5352
5374
|
react.Transition,
|