@luscii-healthtech/web-ui 42.0.0 → 42.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/index.development.js +132 -131
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/Page/CRUDPage.types.d.ts +20 -0
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -4130,13 +4130,15 @@ const PageHeader = ({ navigation, breadcrumbs, dataTestId, accessories, isPollin
|
|
|
4130
4130
|
}), children: [banner && jsxRuntime.jsx(NotificationBanner, { noBorder: banner.noBorder, color: banner.color, "data-test-id": `page-header-banner-${title}`, className: "ui:mb-m", icon: banner.icon, children: jsxRuntime.jsxs("div", { className: "ui:flex ui:flex-col", children: [banner.title && jsxRuntime.jsx(Text, { color: "current", variant: "strong", children: banner.title }), jsxRuntime.jsx(Text, { color: "current", containsDangerousHtml: banner.text.isHTML, children: banner.text.content })] }) }), jsxRuntime.jsxs("div", { className: classNames__default.default({ "ui:flex ui:flex-col": !contained }), children: [!!(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) && jsxRuntime.jsx("div", { className: classNames__default.default("ui:mb-m", withContained), children: jsxRuntime.jsx(Breadcrumbs, { crumbs: breadcrumbs, truncateAfter: truncateBreadcrumbsAfter, renderItem: renderBreadcrumbItem }) }), jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-row ui:items-center ui:justify-between", withContained), children: [jsxRuntime.jsxs("div", { className: "ui:flex ui:flex-row ui:items-center ui:gap-xxs", children: [typeof title === "string" ? jsxRuntime.jsx(PageTitle, { "data-test-id": `${dataTestId}-title`, children: title }) : jsxRuntime.jsx(Box, { width: "full", children: title }), isPolling && jsxRuntime.jsx(LoadingIndicator, { asSpinner: true, className: "page-spinner", spinnerColor: "gray" })] }), accessories && jsxRuntime.jsx("div", { "data-test-id": "page-header-accessories", children: accessories })] })] }), navigation && jsxRuntime.jsx(Tabbar, Object.assign({}, navigation, { className: classNames__default.default(navigation.className, withContained) }))] }), jsxRuntime.jsx(Divider, { version: "v2" })] });
|
|
4131
4131
|
};
|
|
4132
4132
|
|
|
4133
|
-
const CRUDPage = ({ submitButtonProps, cancelButtonProps, className, children, isLoading, isSubmitting, dataTestId = "page", title, header, steps, isMobileFriendly, belowHeader }) => {
|
|
4133
|
+
const CRUDPage = ({ submitButtonProps, cancelButtonProps, className, children, isLoading, isSubmitting, dataTestId = "page", title, header, steps, isMobileFriendly, belowHeader, accessory }) => {
|
|
4134
4134
|
const mergedClasses = classNames__default.default("cweb-crud-page", "ui:w-full ui:mb-0 ui:mx-auto ui:pb-8", className);
|
|
4135
|
-
const submitButton = submitButtonProps && jsxRuntime.jsx(PrimaryButton, Object.assign({ "data-test-id": "submit-button", role: "primary", isPending: isSubmitting }, submitButtonProps), "submit-button");
|
|
4136
|
-
const cancelButton = cancelButtonProps && jsxRuntime.jsx(TertiaryButton, Object.assign({ "data-test-id": "cancel-button", role: "secondary" }, cancelButtonProps), "cancel-button");
|
|
4135
|
+
const submitButton = accessory !== null && accessory !== void 0 ? accessory : submitButtonProps && jsxRuntime.jsx(PrimaryButton, Object.assign({ "data-test-id": "submit-button", role: "primary", isPending: isSubmitting }, submitButtonProps), "submit-button");
|
|
4136
|
+
const cancelButton = accessory !== null && accessory !== void 0 ? accessory : cancelButtonProps && jsxRuntime.jsx(TertiaryButton, Object.assign({ "data-test-id": "cancel-button", role: "secondary" }, cancelButtonProps), "cancel-button");
|
|
4137
4137
|
if (isLoading) {
|
|
4138
4138
|
return jsxRuntime.jsx("div", { className: "cweb-crud-page-container", "data-test-id": dataTestId, children: jsxRuntime.jsxs("div", { className: classNames__default.default(mergedClasses, "ui:relative ui:overflow-y-hidden", "cweb-crud-page-loading-container"), style: { height: "90vh" }, children: [jsxRuntime.jsx(PageHeaderBlock, { header, title }), jsxRuntime.jsx(LoadingIndicator, { className: classNames__default.default("crud-page-loader", "ui:absolute ui:bottom-0 ui:left-0 ui:right-0 ui:top-0 ui:m-auto ui:h-12 ui:w-12"), asModal: false })] }) });
|
|
4139
4139
|
}
|
|
4140
|
+
const accessoriesAreArray = Array.isArray(accessory);
|
|
4141
|
+
const accessoriesToRender = accessoriesAreArray ? accessory : [accessory];
|
|
4140
4142
|
return jsxRuntime.jsx("div", { className: classNames__default.default("cweb-crud-page-container", {
|
|
4141
4143
|
"ui:h-screen ui:overflow-y-auto": isMobileFriendly
|
|
4142
4144
|
}), "data-test-id": dataTestId, children: jsxRuntime.jsxs("div", { className: mergedClasses, "data-test-id": dataTestId, children: [jsxRuntime.jsx(PageHeaderBlock, { header, title }), belowHeader, jsxRuntime.jsx("div", { className: "ui:flex ui:justify-center", children: jsxRuntime.jsxs("div", { className: classNames__default.default(
|
|
@@ -4147,7 +4149,7 @@ const CRUDPage = ({ submitButtonProps, cancelButtonProps, className, children, i
|
|
|
4147
4149
|
* since the spacing needed will be occupied by the `belowHeader` component itself.
|
|
4148
4150
|
*/
|
|
4149
4151
|
{ "ui:mt-xl": !belowHeader }
|
|
4150
|
-
), children: [steps && jsxRuntime.jsx(Steps, { className: "ui:mb-4", orderedStepTitles: steps.titles, currentStep: steps.currentStep, localization: steps.localization }), children, jsxRuntime.jsx(Line, { left: [submitButton, cancelButton], className: classNames__default.default("cweb-crud-page-button-line", "ui:mt-4 ui:border-t ui:border-solid ui:border-color-divider ui:pt-4") })] }) })] }) });
|
|
4152
|
+
), children: [steps && jsxRuntime.jsx(Steps, { className: "ui:mb-4", orderedStepTitles: steps.titles, currentStep: steps.currentStep, localization: steps.localization }), children, jsxRuntime.jsx(Line, { left: accessoriesToRender !== null && accessoriesToRender !== void 0 ? accessoriesToRender : [submitButton, cancelButton], className: classNames__default.default("cweb-crud-page-button-line", "ui:mt-4 ui:border-t ui:border-solid ui:border-color-divider ui:pt-4") })] }) })] }) });
|
|
4151
4153
|
};
|
|
4152
4154
|
const PageHeaderBlock = ({ header, title }) => {
|
|
4153
4155
|
if (!title && !header) {
|
|
@@ -4611,6 +4613,113 @@ const Switch = (props) => {
|
|
|
4611
4613
|
}), children: jsxRuntime.jsx(RadixSwitch__namespace.Thumb, { className: classNames__default.default("ui:h-[20px] ui:w-[20px]", "ui:bg-white", "ui:transition-transform ui:duration-100 ui:will-change-transform", "ui:translate-x-1 ui:data-[state=checked]:translate-x-[32px]", "ui:block ui:rounded-full") }) });
|
|
4612
4614
|
};
|
|
4613
4615
|
|
|
4616
|
+
const context$3 = React.createContext({
|
|
4617
|
+
$dialog: null
|
|
4618
|
+
});
|
|
4619
|
+
const useModalDialog = () => React.useContext(context$3);
|
|
4620
|
+
const ModalDialog = (_a) => {
|
|
4621
|
+
var { open, className, size, onClose, children, variant = "centered-dialog", keepChildrenMountedWhenClosed = false } = _a, rest = __rest(_a, ["open", "className", "size", "onClose", "children", "variant", "keepChildrenMountedWhenClosed"]);
|
|
4622
|
+
const dialog = React.useRef(null);
|
|
4623
|
+
const transitionsClasses = classNames__default.default("ui:transition-discrete ui:transition-[display,overlay,opacity,scale,translate] ui:duration-[300ms] ui:motion-reduce:duration-[0ms] ui:delay-100", "ui:backdrop:transition-[display,overlay,opacity] ui:backdrop:duration-[300ms] ui:motion-reduce:backdrop:duration-[0ms] ui:delay-0", "ui:opacity-0 ui:open:starting:opacity-0", "ui:open:opacity-100", "ui:backdrop:opacity-0 ui:open:backdrop:starting:opacity-0", "ui:open:backdrop:opacity-100", {
|
|
4624
|
+
"ui:translate-y-[-5px] ui:open:starting:translate-y-[-5px] ui:open:translate-y-0": variant !== "side-modal",
|
|
4625
|
+
"ui:scale-[0.98] ui:open:starting:scale-[0.98] ui:open:scale-100": variant !== "side-modal"
|
|
4626
|
+
}, {
|
|
4627
|
+
"ui:translate-x-[50px] ui:open:starting:translate-x-[50px] ui:open:translate-x-0": variant === "side-modal",
|
|
4628
|
+
"ui:scale-[0.98] ui:open:starting:scale-[0.98] ui:open:scale-100": variant !== "side-modal"
|
|
4629
|
+
});
|
|
4630
|
+
const classes = classNames__default.default("ui:bg-transparent", {
|
|
4631
|
+
"ui:max-w-[calc(100dvw-(var(--ui-spacing-xl)))]": variant !== "full-screen"
|
|
4632
|
+
}, {
|
|
4633
|
+
"ui:my-xl": variant === "centered-dialog",
|
|
4634
|
+
"ui:mx-auto": variant === "centered-dialog"
|
|
4635
|
+
}, "ui:top-0", "ui:bottom-auto", {
|
|
4636
|
+
"ui:md:w-80": size === "s",
|
|
4637
|
+
"ui:md:w-132": size === "m",
|
|
4638
|
+
"ui:md:w-216": size === "l"
|
|
4639
|
+
}, {
|
|
4640
|
+
"ui:right-0": variant === "side-modal",
|
|
4641
|
+
"ui:left-auto": variant === "side-modal",
|
|
4642
|
+
"ui:bottom-0": variant === "side-modal",
|
|
4643
|
+
"ui:max-h-full": variant === "side-modal"
|
|
4644
|
+
}, {
|
|
4645
|
+
"ui:fixed ui:top-0 ui:bottom-0 ui:left-0 ui:right-0": variant === "full-screen",
|
|
4646
|
+
"ui:p-0": variant === "full-screen",
|
|
4647
|
+
"ui:w-screen ui:h-screen": variant === "full-screen",
|
|
4648
|
+
"ui:max-w-screen ui:max-h-screen": variant === "full-screen"
|
|
4649
|
+
}, transitionsClasses, className);
|
|
4650
|
+
React.useEffect(() => {
|
|
4651
|
+
var _a2, _b;
|
|
4652
|
+
if (open) {
|
|
4653
|
+
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.showModal();
|
|
4654
|
+
} else {
|
|
4655
|
+
(_b = dialog.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
4656
|
+
}
|
|
4657
|
+
}, [open]);
|
|
4658
|
+
const [isTransitioning, setIsTransitioning] = React.useState(false);
|
|
4659
|
+
const createSetIsTransitioning = (yesOrNo) => (event) => {
|
|
4660
|
+
if (event.target !== dialog.current) {
|
|
4661
|
+
return;
|
|
4662
|
+
}
|
|
4663
|
+
setIsTransitioning(yesOrNo);
|
|
4664
|
+
};
|
|
4665
|
+
React.useEffect(() => {
|
|
4666
|
+
const transitionStartEvents = ["transitionrun", "close", "cancel"];
|
|
4667
|
+
const transitionStopEvents = ["transitioncancel", "transitionend"];
|
|
4668
|
+
const setIsTransitioningTrue = createSetIsTransitioning(true);
|
|
4669
|
+
const setIsTransitioningFalse = createSetIsTransitioning(false);
|
|
4670
|
+
transitionStartEvents.forEach((event) => {
|
|
4671
|
+
var _a2;
|
|
4672
|
+
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.addEventListener(event, setIsTransitioningTrue);
|
|
4673
|
+
});
|
|
4674
|
+
transitionStopEvents.forEach((event) => {
|
|
4675
|
+
var _a2;
|
|
4676
|
+
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.addEventListener(event, setIsTransitioningFalse);
|
|
4677
|
+
});
|
|
4678
|
+
return () => {
|
|
4679
|
+
transitionStartEvents.forEach((event) => {
|
|
4680
|
+
var _a2;
|
|
4681
|
+
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.removeEventListener(event, setIsTransitioningTrue);
|
|
4682
|
+
});
|
|
4683
|
+
transitionStopEvents.forEach((event) => {
|
|
4684
|
+
var _a2;
|
|
4685
|
+
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.removeEventListener(event, setIsTransitioningFalse);
|
|
4686
|
+
});
|
|
4687
|
+
};
|
|
4688
|
+
}, []);
|
|
4689
|
+
const shouldRenderChildren = isTransitioning || open || keepChildrenMountedWhenClosed;
|
|
4690
|
+
return jsxRuntime.jsx(context$3.Provider, { value: { $dialog: dialog.current }, children: jsxRuntime.jsx("dialog", Object.assign({ ref: dialog, className: classes, onClose }, rest, { children: shouldRenderChildren && jsxRuntime.jsx(Stack, { width: "full", align: "stretch", backgroundColor: "surface", borderRadiusLeft: variant === "side-modal" ? "m" : "none", borderRadius: variant === "centered-dialog" ? "m" : "none", className: classNames__default.default({
|
|
4691
|
+
"ui:max-h-[calc(100dvh-(var(--ui-spacing-xl))*2)]": variant === "centered-dialog",
|
|
4692
|
+
"ui:h-screen": variant === "side-modal" || variant === "full-screen",
|
|
4693
|
+
"ui:w-screen": variant === "full-screen"
|
|
4694
|
+
}), children }) })) });
|
|
4695
|
+
};
|
|
4696
|
+
const Body = (_a) => {
|
|
4697
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
4698
|
+
const classes = classNames__default.default(className, "ui:overflow-y-auto ui:flex-1");
|
|
4699
|
+
return jsxRuntime.jsx(Box, Object.assign({ className: classes, p: "m" }, rest));
|
|
4700
|
+
};
|
|
4701
|
+
const Header$1 = (props) => {
|
|
4702
|
+
return jsxRuntime.jsx(Stack, Object.assign({ axis: "x", justify: "between", align: "center", gap: "m", p: "m" }, props));
|
|
4703
|
+
};
|
|
4704
|
+
const Footer = (props) => {
|
|
4705
|
+
return jsxRuntime.jsx(Stack, Object.assign({ as: "footer", p: "m", backgroundColor: "background", className: "ui:rounded-b-[inherit]" }, props));
|
|
4706
|
+
};
|
|
4707
|
+
const CloseButton = (props) => {
|
|
4708
|
+
return jsxRuntime.jsx(TertiaryButton, Object.assign({ leadingIcon: jsxRuntime.jsx(CrossIcon, {}) }, props));
|
|
4709
|
+
};
|
|
4710
|
+
const Actions = (_a) => {
|
|
4711
|
+
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
4712
|
+
const classes = classNames__default.default(className, "ui:self-end");
|
|
4713
|
+
return jsxRuntime.jsx(Stack, Object.assign({ axis: "x", gap: "xs", className: classes }, rest));
|
|
4714
|
+
};
|
|
4715
|
+
ModalDialog.Header = Header$1;
|
|
4716
|
+
ModalDialog.Title = Card.Title;
|
|
4717
|
+
ModalDialog.CloseButton = CloseButton;
|
|
4718
|
+
ModalDialog.Body = Body;
|
|
4719
|
+
ModalDialog.Footer = Footer;
|
|
4720
|
+
ModalDialog.Actions = Actions;
|
|
4721
|
+
ModalDialog.useModalDialog = useModalDialog;
|
|
4722
|
+
|
|
4614
4723
|
const ImageCategory = (props) => {
|
|
4615
4724
|
return jsxRuntime.jsxs("div", { className: "ui:mt-4 ui:w-full", children: [jsxRuntime.jsx(Text, { text: props.category.key }), jsxRuntime.jsx("div", { className: "ui:flex ui:flex-row ui:flex-wrap", children: props.images.map((option, index) => {
|
|
4616
4725
|
const isSelected = option === props.highlightedImage;
|
|
@@ -4656,7 +4765,7 @@ const ImagePickerInner = ({
|
|
|
4656
4765
|
const [error, setError] = React.useState(null);
|
|
4657
4766
|
const fileInputRef = React.useRef(null);
|
|
4658
4767
|
React.useEffect(() => {
|
|
4659
|
-
if (preselectedImage
|
|
4768
|
+
if (preselectedImage) {
|
|
4660
4769
|
setSelectedMedia(preselectedImage);
|
|
4661
4770
|
setSelectedMediaType(preselectedMediaType);
|
|
4662
4771
|
}
|
|
@@ -4675,6 +4784,7 @@ const ImagePickerInner = ({
|
|
|
4675
4784
|
};
|
|
4676
4785
|
const handleImageClick = (event) => {
|
|
4677
4786
|
var _a2;
|
|
4787
|
+
event.preventDefault();
|
|
4678
4788
|
const datasetIndex = (_a2 = event.currentTarget) === null || _a2 === void 0 ? void 0 : _a2.dataset["index"];
|
|
4679
4789
|
if (datasetIndex && parseInt(datasetIndex, 10) === clearImageIndex) {
|
|
4680
4790
|
handleDeleteClick();
|
|
@@ -4699,16 +4809,17 @@ const ImagePickerInner = ({
|
|
|
4699
4809
|
fileInput.value = "";
|
|
4700
4810
|
}
|
|
4701
4811
|
};
|
|
4702
|
-
function handleConfirmSelection() {
|
|
4812
|
+
function handleConfirmSelection(event) {
|
|
4703
4813
|
setSelectedMedia(highlightedImage !== null && highlightedImage !== void 0 ? highlightedImage : placeholderImage);
|
|
4704
4814
|
setSelectedMediaType("image");
|
|
4705
4815
|
setError(null);
|
|
4706
4816
|
handleChange({
|
|
4707
4817
|
target: { name, value: highlightedImage }
|
|
4708
4818
|
});
|
|
4709
|
-
handleCloseModal();
|
|
4819
|
+
handleCloseModal(event);
|
|
4710
4820
|
}
|
|
4711
|
-
const handleCloseModal = () => {
|
|
4821
|
+
const handleCloseModal = (event) => {
|
|
4822
|
+
event.stopPropagation();
|
|
4712
4823
|
setIsImagesPanelOpen(false);
|
|
4713
4824
|
};
|
|
4714
4825
|
const mediaType = (mimeType) => mimeType.split("/")[0];
|
|
@@ -4731,7 +4842,7 @@ const ImagePickerInner = ({
|
|
|
4731
4842
|
}
|
|
4732
4843
|
}
|
|
4733
4844
|
});
|
|
4734
|
-
return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(FlexContainer, { type: isTypeCompact ? "row" : "column", horizontalSpacing: isTypeCompact ? "small" : "none", verticalSpacing:
|
|
4845
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(FlexContainer, { type: isTypeCompact ? "row" : "column", horizontalSpacing: isTypeCompact ? "small" : "none", verticalSpacing: isTypeCompact ? "none" : "small", children: [selectedMedia && jsxRuntime.jsxs("div", { className: classNames__default.default({
|
|
4735
4846
|
"ui:h-11 ui:w-11 ui:shrink-0 ui:rounded-full ui:bg-secondary ui:p-3": isTypeCompact,
|
|
4736
4847
|
"ui:h-44 ui:w-full": !isTypeCompact
|
|
4737
4848
|
}), children: [isUploading && jsxRuntime.jsx(LoadingIndicator, { className: "ui:my-16" }), !isUploading && selectedMediaType === "image" && jsxRuntime.jsx(Image$1, { className: classNames__default.default("ui:h-full ui:w-full", {
|
|
@@ -4741,14 +4852,11 @@ const ImagePickerInner = ({
|
|
|
4741
4852
|
}) }), !isUploading && !isErrorUploading && selectedMediaType === "video" && jsxRuntime.jsx("video", { className: classNames__default.default("ui:h-full", {
|
|
4742
4853
|
"ui:w-full ui:rounded ui:bg-secondary ui:object-contain ui:p-3": !isTypeCompact,
|
|
4743
4854
|
"ui:w-full": isTypeCompact
|
|
4744
|
-
}), src: selectedMedia, playsInline: true, controls: true, disablePictureInPicture: true, preload: "none", poster: placeholderImage, children: "There is a video, but your browser doesn't support showing the video." }), selectedMediaType !== "image" && selectedMediaType !== "video" && jsxRuntime.jsx(NotificationBanner, { color: "blue", icon: InfoIcon, children: jsxRuntime.jsx(Text, { children: (_a = localisation.unsupportedMediaType) !== null && _a !== void 0 ? _a : "File uploaded successfully but preview not supported." }) })] }), error && jsxRuntime.jsx(NotificationBanner, { color: "red", icon: ExclamationMarkIcon, children: jsxRuntime.jsx(Text, { children: error }) }), jsxRuntime.jsxs(FlexRow, { spacing: "small", children: [jsxRuntime.jsx(SecondaryButton, { "data-test-id": `image-picker-${name}`, id: `image-picker-${name}`, isDisabled, className: "cweb-imagePicker-change",
|
|
4855
|
+
}), src: selectedMedia, playsInline: true, controls: true, disablePictureInPicture: true, preload: "none", poster: placeholderImage, children: "There is a video, but your browser doesn't support showing the video." }), selectedMediaType !== "image" && selectedMediaType !== "video" && jsxRuntime.jsx(NotificationBanner, { color: "blue", icon: InfoIcon, children: jsxRuntime.jsx(Text, { children: (_a = localisation.unsupportedMediaType) !== null && _a !== void 0 ? _a : "File uploaded successfully but preview not supported." }) })] }), error && jsxRuntime.jsx(NotificationBanner, { color: "red", icon: ExclamationMarkIcon, children: jsxRuntime.jsx(Text, { children: error }) }), jsxRuntime.jsxs(FlexRow, { spacing: "small", children: [jsxRuntime.jsx(SecondaryButton, { "data-test-id": `image-picker-${name}`, id: `image-picker-${name}`, disabled: isDisabled, className: "cweb-imagePicker-change", onClick: () => setIsImagesPanelOpen(true), ref: innerRef, children: localisation.openModalButton }), isUploadButtonVisible && jsxRuntime.jsxs("span", { className: "cweb-imagePicker-upload", children: [jsxRuntime.jsx(SecondaryButton, { disabled: isDisabled, isPending: isUploading, id: `upload-image-${name}`, onClick: () => {
|
|
4745
4856
|
var _a2;
|
|
4746
4857
|
setIsImagesPanelOpen(false);
|
|
4747
4858
|
(_a2 = fileInputRef.current) === null || _a2 === void 0 ? void 0 : _a2.click();
|
|
4748
|
-
} }), jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", disabled: isDisabled, name: `uploaded-${name}`, accept: acceptedMimeTypes.join(","), onChange: uploadImage, className: "ui:hidden" })] }), isClearButtonVisible && selectedMedia !== placeholderImage && !isUploading && jsxRuntime.jsx(SecondaryButton, { text: localisation.clearSelection, isDisabled, isPending: isUploading, onClick: handleDeleteClick })] })] }), jsxRuntime.jsxs(
|
|
4749
|
-
primaryButton: jsxRuntime.jsx(PrimaryButton, { dataTestId: "modal-footer-trailing-primary-button", onClick: handleConfirmSelection, children: localisation.selectButton }),
|
|
4750
|
-
secondaryButton: jsxRuntime.jsx(SecondaryButton, { dataTestId: "modal-footer-trailing-secondary-button", onClick: handleCloseModal, children: localisation.cancel })
|
|
4751
|
-
}, isOpen: isImagesPanelOpen, title: localisation.modalTitle, children: [jsxRuntime.jsx(SearchInput, { name: "searchImages", className: "ui:w-full", value: search, placeholder: localisation.search, onChange: handleSearchChange }), jsxRuntime.jsx("div", { className: "ui:flex ui:w-full ui:flex-row ui:flex-wrap ui:items-center", children: filteredCategories === null || filteredCategories === void 0 ? void 0 : filteredCategories.map((category) => jsxRuntime.jsx(ImageCategory, { category, images: images === null || images === void 0 ? void 0 : images.filter((categoryImage) => categoryImage.includes(category.folder)), highlightedImage, handleImageClick, isTypeCompact }, category.folder)) })] })] });
|
|
4859
|
+
}, children: localisation.uploadImage }), jsxRuntime.jsx("input", { ref: fileInputRef, type: "file", disabled: isDisabled, name: `uploaded-${name}`, accept: acceptedMimeTypes.join(","), onChange: uploadImage, className: "ui:hidden" })] }), isClearButtonVisible && selectedMedia !== placeholderImage && !isUploading && jsxRuntime.jsx(SecondaryButton, { text: localisation.clearSelection, isDisabled, isPending: isUploading, onClick: handleDeleteClick })] })] }), jsxRuntime.jsxs(ModalDialog, { open: isImagesPanelOpen, onClose: handleCloseModal, variant: "centered-dialog", size: "l", children: [jsxRuntime.jsxs(ModalDialog.Header, { children: [jsxRuntime.jsx(ModalDialog.Title, { children: localisation.modalTitle }), jsxRuntime.jsx(ModalDialog.CloseButton, { onClick: handleCloseModal })] }), jsxRuntime.jsx(Divider, {}), jsxRuntime.jsx(ModalDialog.Body, { children: jsxRuntime.jsxs(Stack, { axis: "y", gap: "m", width: "full", className: "ui:max-h-135", children: [jsxRuntime.jsx(SearchInput, { name: "searchImages", className: "ui:w-full", value: search, placeholder: localisation.search, onChange: handleSearchChange }), jsxRuntime.jsx("div", { className: "ui:flex ui:w-full ui:flex-row ui:flex-wrap ui:items-center", children: filteredCategories === null || filteredCategories === void 0 ? void 0 : filteredCategories.map((category) => jsxRuntime.jsx(ImageCategory, { category, images: images === null || images === void 0 ? void 0 : images.filter((categoryImage) => categoryImage.includes(category.folder)), highlightedImage, handleImageClick, isTypeCompact }, category.folder)) })] }) }), jsxRuntime.jsx(ModalDialog.Footer, { children: jsxRuntime.jsx(ModalDialog.Actions, { width: "full", children: jsxRuntime.jsxs(Stack, { axis: "x", gap: "s", justify: "end", width: "full", children: [jsxRuntime.jsx(SecondaryButton, { dataTestId: "modal-footer-trailing-secondary-button", onClick: handleCloseModal, children: localisation.cancel }), jsxRuntime.jsx(PrimaryButton, { dataTestId: "modal-footer-trailing-primary-button", onClick: handleConfirmSelection, children: localisation.selectButton })] }) }) })] })] });
|
|
4752
4860
|
};
|
|
4753
4861
|
const MediaPicker = React__namespace.default.forwardRef((props, ref) => {
|
|
4754
4862
|
var _a, _b;
|
|
@@ -4978,12 +5086,12 @@ const FullPageModal = ({ children, dataTestId, isOpen = false, onCloseClick, pri
|
|
|
4978
5086
|
FullPageModal.Actions = FullPageModalActions;
|
|
4979
5087
|
FullPageModal.setAppElement = ReactModal__default.default.setAppElement;
|
|
4980
5088
|
|
|
4981
|
-
const context$
|
|
5089
|
+
const context$2 = React.createContext({ isOpen: false });
|
|
4982
5090
|
const DetailsDisclosure = (_a) => {
|
|
4983
5091
|
var { children, onToggleDetails, name, onToggle, openByDefault, open } = _a, rest = __rest(_a, ["children", "onToggleDetails", "name", "onToggle", "openByDefault", "open"]);
|
|
4984
5092
|
const [internalIsOpen, setInternalIsOpen] = React.useState(openByDefault !== null && openByDefault !== void 0 ? openByDefault : false);
|
|
4985
5093
|
const isOpen = open !== null && open !== void 0 ? open : internalIsOpen;
|
|
4986
|
-
return jsxRuntime.jsx(context$
|
|
5094
|
+
return jsxRuntime.jsx(context$2.Provider, { value: { isOpen }, children: jsxRuntime.jsx(Box, Object.assign({
|
|
4987
5095
|
as: "details",
|
|
4988
5096
|
/**
|
|
4989
5097
|
* This "name" attribute triggers a type-error on "details" eventhough it should be valid
|
|
@@ -5005,18 +5113,18 @@ const DefaultOpenIndicator = ({ isOpen }) => {
|
|
|
5005
5113
|
}) });
|
|
5006
5114
|
};
|
|
5007
5115
|
const OpenIndicator = ({ component: Component = DefaultOpenIndicator }) => {
|
|
5008
|
-
const { isOpen } = React.useContext(context$
|
|
5116
|
+
const { isOpen } = React.useContext(context$2);
|
|
5009
5117
|
return jsxRuntime.jsx(Component, { isOpen });
|
|
5010
5118
|
};
|
|
5011
5119
|
const Summary = (_a) => {
|
|
5012
5120
|
var { children, omitOpenIndicator = false } = _a, rest = __rest(_a, ["children", "omitOpenIndicator"]);
|
|
5013
|
-
const { isOpen } = React.useContext(context$
|
|
5121
|
+
const { isOpen } = React.useContext(context$2);
|
|
5014
5122
|
return jsxRuntime.jsx(Stack, Object.assign({ as: "summary", pl: "s", hoverBackgroundColor: "blue", cursor: "pointer" }, rest, { children: jsxRuntime.jsx(Stack, { axis: "x", justify: "between", align: "center", width: "full", children: jsxRuntime.jsxs(Stack, { axis: "x", width: "full", align: "center", gap: "xxs", children: [!omitOpenIndicator && jsxRuntime.jsx(DefaultOpenIndicator, { isOpen }), jsxRuntime.jsx(Box, { width: "full", children })] }) }) }));
|
|
5015
5123
|
};
|
|
5016
5124
|
DetailsDisclosure.Summary = Summary;
|
|
5017
5125
|
Summary.OpenIndicator = OpenIndicator;
|
|
5018
5126
|
|
|
5019
|
-
const context$
|
|
5127
|
+
const context$1 = React.createContext({
|
|
5020
5128
|
variant: "primary"
|
|
5021
5129
|
});
|
|
5022
5130
|
const VerticalMenu = (props) => {
|
|
@@ -5026,7 +5134,7 @@ const VerticalMenu = (props) => {
|
|
|
5026
5134
|
const shouldShowCollapseButton = localization && Boolean(onCollapseButtonClick);
|
|
5027
5135
|
const hasHeaderContent = title || shouldShowCollapseButton;
|
|
5028
5136
|
const contextValue = React.useMemo(() => ({ variant }), [variant]);
|
|
5029
|
-
return jsxRuntime.jsx(context$
|
|
5137
|
+
return jsxRuntime.jsx(context$1.Provider, { value: contextValue, children: jsxRuntime.jsxs(Stack, Object.assign({ as: "div", px: "xxs", py: "m", align: "normal", className: classNames__default.default("ui:max-w-full ui:text-slate-800", className) }, rest, { children: [header && jsxRuntime.jsx("div", { children: header }), jsxRuntime.jsxs(Stack, { axis: "x", gap: "xxs", p: hasHeaderContent ? "m" : void 0, align: "start", justify: "between", width: "full", children: [title && jsxRuntime.jsx(Box, { children: jsxRuntime.jsx(Text, { variant: "lg-strong", children: title }) }), shouldShowCollapseButton && jsxRuntime.jsx(
|
|
5030
5138
|
Box,
|
|
5031
5139
|
{
|
|
5032
5140
|
/**
|
|
@@ -5062,11 +5170,11 @@ VerticalMenu.NotificationBubble = MenuItemNotificationBubble;
|
|
|
5062
5170
|
VerticalMenu.ItemGroup = MenuItemGroup;
|
|
5063
5171
|
VerticalMenu.SectionTitle = SectionTitle;
|
|
5064
5172
|
function MenuItemText(props) {
|
|
5065
|
-
const { variant: menuVariant } = React.useContext(context$
|
|
5173
|
+
const { variant: menuVariant } = React.useContext(context$1);
|
|
5066
5174
|
return jsxRuntime.jsx(Text, Object.assign({ as: "span", color: "current", variant: menuVariant === "primary" ? "base" : props.variant }, props, { className: classNames__default.default("ui:sm:leading-[24px]", props.className) }));
|
|
5067
5175
|
}
|
|
5068
5176
|
const useGetClassName = () => {
|
|
5069
|
-
const { variant } = React.useContext(context$
|
|
5177
|
+
const { variant } = React.useContext(context$1);
|
|
5070
5178
|
return React.useCallback(
|
|
5071
5179
|
// eslint-disable-next-line consistent-return
|
|
5072
5180
|
({ isActive = false, classNameProp = "" } = {}) => {
|
|
@@ -5109,7 +5217,7 @@ function MenuItem(props) {
|
|
|
5109
5217
|
return (_a = props.render) === null || _a === void 0 ? void 0 : _a.call(props, { getClassName });
|
|
5110
5218
|
}
|
|
5111
5219
|
function MenuItemLayout(props) {
|
|
5112
|
-
const { variant } = React.useContext(context$
|
|
5220
|
+
const { variant } = React.useContext(context$1);
|
|
5113
5221
|
const { icon, text, aside, notificationBubbleText, className, children } = props;
|
|
5114
5222
|
const isCollapsed = variant === "primary-collapsed";
|
|
5115
5223
|
if (children) {
|
|
@@ -5124,7 +5232,7 @@ function MenuItemLayout(props) {
|
|
|
5124
5232
|
jsxRuntime.jsx("span", { "aria-label": itemIsTextOrNumber ? String(text) : void 0, children: icon }), text && !isCollapsed && jsxRuntime.jsx(MenuItemText, { children: text }), aside && jsxRuntime.jsx("span", { className: "ui:ml-auto", children: aside }), notificationBubbleText && !isCollapsed && jsxRuntime.jsx("span", { className: "ui:ml-auto", children: jsxRuntime.jsx(MenuItemNotificationBubble, { children: notificationBubbleText }) }), notificationBubbleText && isCollapsed && jsxRuntime.jsx("span", { "aria-label": notificationBubbleText, className: "ui:absolute ui:right-[-8px] ui:top-[-4px] ui:h-[8px] ui:w-[8px] ui:rounded-full ui:bg-red-500" })] });
|
|
5125
5233
|
}
|
|
5126
5234
|
function MenuItemPadding(props) {
|
|
5127
|
-
const { variant } = React.useContext(context$
|
|
5235
|
+
const { variant } = React.useContext(context$1);
|
|
5128
5236
|
const { children, className, paddingX = variant === "primary", paddingY = true } = props;
|
|
5129
5237
|
return jsxRuntime.jsx("div", { className: classNames__default.default({
|
|
5130
5238
|
"ui:px-m": paddingX,
|
|
@@ -5633,113 +5741,6 @@ const Collapse = (props) => {
|
|
|
5633
5741
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("button", { className: buttonClassName, onClick, "aria-expanded": !isCollapsed, children: [jsxRuntime.jsx("div", { className: contentClassName, children }), isCollapsed && showMoreIndicator && moreIndicator] }) });
|
|
5634
5742
|
};
|
|
5635
5743
|
|
|
5636
|
-
const context$1 = React.createContext({
|
|
5637
|
-
$dialog: null
|
|
5638
|
-
});
|
|
5639
|
-
const useModalDialog = () => React.useContext(context$1);
|
|
5640
|
-
const ModalDialog = (_a) => {
|
|
5641
|
-
var { open, className, size, onClose, children, variant = "centered-dialog", keepChildrenMountedWhenClosed = false } = _a, rest = __rest(_a, ["open", "className", "size", "onClose", "children", "variant", "keepChildrenMountedWhenClosed"]);
|
|
5642
|
-
const dialog = React.useRef(null);
|
|
5643
|
-
const transitionsClasses = classNames__default.default("ui:transition-discrete ui:transition-[display,overlay,opacity,scale,translate] ui:duration-[300ms] ui:motion-reduce:duration-[0ms] ui:delay-100", "ui:backdrop:transition-[display,overlay,opacity] ui:backdrop:duration-[300ms] ui:motion-reduce:backdrop:duration-[0ms] ui:delay-0", "ui:opacity-0 ui:open:starting:opacity-0", "ui:open:opacity-100", "ui:backdrop:opacity-0 ui:open:backdrop:starting:opacity-0", "ui:open:backdrop:opacity-100", {
|
|
5644
|
-
"ui:translate-y-[-5px] ui:open:starting:translate-y-[-5px] ui:open:translate-y-0": variant !== "side-modal",
|
|
5645
|
-
"ui:scale-[0.98] ui:open:starting:scale-[0.98] ui:open:scale-100": variant !== "side-modal"
|
|
5646
|
-
}, {
|
|
5647
|
-
"ui:translate-x-[50px] ui:open:starting:translate-x-[50px] ui:open:translate-x-0": variant === "side-modal",
|
|
5648
|
-
"ui:scale-[0.98] ui:open:starting:scale-[0.98] ui:open:scale-100": variant !== "side-modal"
|
|
5649
|
-
});
|
|
5650
|
-
const classes = classNames__default.default("ui:bg-transparent", {
|
|
5651
|
-
"ui:max-w-[calc(100dvw-(var(--ui-spacing-xl)))]": variant !== "full-screen"
|
|
5652
|
-
}, {
|
|
5653
|
-
"ui:my-xl": variant === "centered-dialog",
|
|
5654
|
-
"ui:mx-auto": variant === "centered-dialog"
|
|
5655
|
-
}, "ui:top-0", "ui:bottom-auto", {
|
|
5656
|
-
"ui:md:w-80": size === "s",
|
|
5657
|
-
"ui:md:w-132": size === "m",
|
|
5658
|
-
"ui:md:w-216": size === "l"
|
|
5659
|
-
}, {
|
|
5660
|
-
"ui:right-0": variant === "side-modal",
|
|
5661
|
-
"ui:left-auto": variant === "side-modal",
|
|
5662
|
-
"ui:bottom-0": variant === "side-modal",
|
|
5663
|
-
"ui:max-h-full": variant === "side-modal"
|
|
5664
|
-
}, {
|
|
5665
|
-
"ui:fixed ui:top-0 ui:bottom-0 ui:left-0 ui:right-0": variant === "full-screen",
|
|
5666
|
-
"ui:p-0": variant === "full-screen",
|
|
5667
|
-
"ui:w-screen ui:h-screen": variant === "full-screen",
|
|
5668
|
-
"ui:max-w-screen ui:max-h-screen": variant === "full-screen"
|
|
5669
|
-
}, transitionsClasses, className);
|
|
5670
|
-
React.useEffect(() => {
|
|
5671
|
-
var _a2, _b;
|
|
5672
|
-
if (open) {
|
|
5673
|
-
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.showModal();
|
|
5674
|
-
} else {
|
|
5675
|
-
(_b = dialog.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
5676
|
-
}
|
|
5677
|
-
}, [open]);
|
|
5678
|
-
const [isTransitioning, setIsTransitioning] = React.useState(false);
|
|
5679
|
-
const createSetIsTransitioning = (yesOrNo) => (event) => {
|
|
5680
|
-
if (event.target !== dialog.current) {
|
|
5681
|
-
return;
|
|
5682
|
-
}
|
|
5683
|
-
setIsTransitioning(yesOrNo);
|
|
5684
|
-
};
|
|
5685
|
-
React.useEffect(() => {
|
|
5686
|
-
const transitionStartEvents = ["transitionrun", "close", "cancel"];
|
|
5687
|
-
const transitionStopEvents = ["transitioncancel", "transitionend"];
|
|
5688
|
-
const setIsTransitioningTrue = createSetIsTransitioning(true);
|
|
5689
|
-
const setIsTransitioningFalse = createSetIsTransitioning(false);
|
|
5690
|
-
transitionStartEvents.forEach((event) => {
|
|
5691
|
-
var _a2;
|
|
5692
|
-
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.addEventListener(event, setIsTransitioningTrue);
|
|
5693
|
-
});
|
|
5694
|
-
transitionStopEvents.forEach((event) => {
|
|
5695
|
-
var _a2;
|
|
5696
|
-
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.addEventListener(event, setIsTransitioningFalse);
|
|
5697
|
-
});
|
|
5698
|
-
return () => {
|
|
5699
|
-
transitionStartEvents.forEach((event) => {
|
|
5700
|
-
var _a2;
|
|
5701
|
-
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.removeEventListener(event, setIsTransitioningTrue);
|
|
5702
|
-
});
|
|
5703
|
-
transitionStopEvents.forEach((event) => {
|
|
5704
|
-
var _a2;
|
|
5705
|
-
(_a2 = dialog.current) === null || _a2 === void 0 ? void 0 : _a2.removeEventListener(event, setIsTransitioningFalse);
|
|
5706
|
-
});
|
|
5707
|
-
};
|
|
5708
|
-
}, []);
|
|
5709
|
-
const shouldRenderChildren = isTransitioning || open || keepChildrenMountedWhenClosed;
|
|
5710
|
-
return jsxRuntime.jsx(context$1.Provider, { value: { $dialog: dialog.current }, children: jsxRuntime.jsx("dialog", Object.assign({ ref: dialog, className: classes, onClose }, rest, { children: shouldRenderChildren && jsxRuntime.jsx(Stack, { width: "full", align: "stretch", backgroundColor: "surface", borderRadiusLeft: variant === "side-modal" ? "m" : "none", borderRadius: variant === "centered-dialog" ? "m" : "none", className: classNames__default.default({
|
|
5711
|
-
"ui:max-h-[calc(100dvh-(var(--ui-spacing-xl))*2)]": variant === "centered-dialog",
|
|
5712
|
-
"ui:h-screen": variant === "side-modal" || variant === "full-screen",
|
|
5713
|
-
"ui:w-screen": variant === "full-screen"
|
|
5714
|
-
}), children }) })) });
|
|
5715
|
-
};
|
|
5716
|
-
const Body = (_a) => {
|
|
5717
|
-
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
5718
|
-
const classes = classNames__default.default(className, "ui:overflow-y-auto ui:flex-1");
|
|
5719
|
-
return jsxRuntime.jsx(Box, Object.assign({ className: classes, p: "m" }, rest));
|
|
5720
|
-
};
|
|
5721
|
-
const Header$1 = (props) => {
|
|
5722
|
-
return jsxRuntime.jsx(Stack, Object.assign({ axis: "x", justify: "between", align: "center", gap: "m", p: "m" }, props));
|
|
5723
|
-
};
|
|
5724
|
-
const Footer = (props) => {
|
|
5725
|
-
return jsxRuntime.jsx(Stack, Object.assign({ as: "footer", p: "m", backgroundColor: "background", className: "ui:rounded-b-[inherit]" }, props));
|
|
5726
|
-
};
|
|
5727
|
-
const CloseButton = (props) => {
|
|
5728
|
-
return jsxRuntime.jsx(TertiaryButton, Object.assign({ leadingIcon: jsxRuntime.jsx(CrossIcon, {}) }, props));
|
|
5729
|
-
};
|
|
5730
|
-
const Actions = (_a) => {
|
|
5731
|
-
var { className } = _a, rest = __rest(_a, ["className"]);
|
|
5732
|
-
const classes = classNames__default.default(className, "ui:self-end");
|
|
5733
|
-
return jsxRuntime.jsx(Stack, Object.assign({ axis: "x", gap: "xs", className: classes }, rest));
|
|
5734
|
-
};
|
|
5735
|
-
ModalDialog.Header = Header$1;
|
|
5736
|
-
ModalDialog.Title = Card.Title;
|
|
5737
|
-
ModalDialog.CloseButton = CloseButton;
|
|
5738
|
-
ModalDialog.Body = Body;
|
|
5739
|
-
ModalDialog.Footer = Footer;
|
|
5740
|
-
ModalDialog.Actions = Actions;
|
|
5741
|
-
ModalDialog.useModalDialog = useModalDialog;
|
|
5742
|
-
|
|
5743
5744
|
const AsideLayout = (_a) => {
|
|
5744
5745
|
var { aside, children } = _a, rest = __rest(_a, ["aside", "children"]);
|
|
5745
5746
|
const containerClasses = classNames__default.default("ui:flex-col ui:md:flex-row");
|