@edifice.io/react 2.6.7-feat-INTEG-1924-port-react-nextcloud-filetree.20260929125646 → 2.6.8-develop-enabling.20261007103744
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/Alert/Alert.js +47 -23
- package/dist/components/AppIcon/AppIcon.js +11 -5
- package/dist/components/Form/FormText.js +11 -6
- package/dist/components/Image/Image.js +5 -2
- package/dist/components/Input/Input.d.ts +11 -2
- package/dist/components/Input/Input.js +43 -21
- package/dist/components/Label/Label.js +4 -4
- package/dist/components/Layout/Layout.js +15 -11
- package/dist/components/LinkPill/LinkPill.d.ts +41 -0
- package/dist/components/LinkPill/LinkPill.js +28 -0
- package/dist/components/LinkPill/index.d.ts +2 -0
- package/dist/components/ModalBeta/ModalBeta.d.ts +47 -0
- package/dist/components/ModalBeta/ModalBeta.js +62 -0
- package/dist/components/ModalBeta/ModalBetaBody.d.ts +19 -0
- package/dist/components/ModalBeta/ModalBetaBody.js +15 -0
- package/dist/components/ModalBeta/ModalBetaContext.d.ts +7 -0
- package/dist/components/ModalBeta/ModalBetaContext.js +15 -0
- package/dist/components/ModalBeta/ModalBetaFooter.d.ts +13 -0
- package/dist/components/ModalBeta/ModalBetaFooter.js +7 -0
- package/dist/components/ModalBeta/ModalBetaHeader.d.ts +23 -0
- package/dist/components/ModalBeta/ModalBetaHeader.js +31 -0
- package/dist/components/ModalBeta/index.d.ts +2 -0
- package/dist/components/PageLayout/PageLayout.d.ts +4 -0
- package/dist/components/PageLayout/PageLayout.js +37 -14
- package/dist/components/PageLayout/components/PageLayoutContent.js +5 -1
- package/dist/components/PageLayout/components/PageLayoutHelpZone.d.ts +12 -0
- package/dist/components/PageLayout/components/PageLayoutHelpZone.js +6 -0
- package/dist/components/Table/components/Table.d.ts +2 -2
- package/dist/components/Table/components/TableTd.d.ts +1 -1
- package/dist/components/Table/components/TableTh.d.ts +1 -1
- package/dist/components/Tree/utilities/tree.js +1 -21
- package/dist/components/index.d.ts +2 -0
- package/dist/homepage.js +12 -1
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/useBackground/index.d.ts +1 -0
- package/dist/hooks/useBackground/useBackground.d.ts +8 -0
- package/dist/hooks/useBackground/useBackground.js +18 -0
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.js +3 -2
- package/dist/hooks/useToast/useToast.d.ts +1 -0
- package/dist/hooks/useToast/useToast.js +12 -9
- package/dist/hooks/useUserPreferences/index.d.ts +1 -0
- package/dist/hooks/useUserPreferences/useUserPreferences.d.ts +9 -0
- package/dist/hooks/useUserPreferences/useUserPreferences.js +40 -0
- package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +14 -2
- package/dist/hooks/useZendeskGuide/useZendeskGuide.js +51 -24
- package/dist/index.js +60 -58
- package/dist/modules/HelpZone/HelpZone.d.ts +13 -0
- package/dist/modules/HelpZone/HelpZone.js +52 -0
- package/dist/modules/HelpZone/HelpZoneContainer.d.ts +4 -0
- package/dist/modules/HelpZone/HelpZoneContainer.js +18 -0
- package/dist/modules/HelpZone/index.d.ts +3 -0
- package/dist/modules/homepage/components/Favorites/Favorites.js +2 -2
- package/dist/modules/homepage/components/Header/Header.js +11 -4
- package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +1 -1
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +15 -1
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +2 -1
- package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +36 -26
- package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +1 -1
- package/dist/modules/homepage/components/Notifications/services/queries/notification.js +9 -2
- package/dist/modules/homepage/components/UsefulLinks/LinkForm.d.ts +13 -0
- package/dist/modules/homepage/components/UsefulLinks/LinkForm.js +67 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.d.ts +6 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +31 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.d.ts +1 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.js +40 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.d.ts +11 -0
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +65 -0
- package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.d.ts +19 -0
- package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.js +26 -0
- package/dist/modules/homepage/components/UsefulLinks/index.d.ts +5 -0
- package/dist/modules/homepage/components/UsefulLinks/services/api/index.d.ts +6 -0
- package/dist/modules/homepage/components/UsefulLinks/services/api/index.js +5 -0
- package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.d.ts +31 -0
- package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.js +50 -0
- package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.d.ts +20 -0
- package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.js +65 -0
- package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +18 -8
- package/dist/modules/homepage/components/index.d.ts +1 -0
- package/dist/modules/icons/components/logo/IconLogoEdificeFull.d.ts +7 -0
- package/dist/modules/icons/components/logo/IconLogoEdificeFull.js +26 -0
- package/dist/modules/icons/components/logo/IconLogoEdificeSmall.d.ts +7 -0
- package/dist/modules/icons/components/logo/IconLogoEdificeSmall.js +17 -0
- package/dist/modules/icons/components/logo/index.d.ts +2 -0
- package/dist/modules/multimedia/FileCard/index.d.ts +0 -2
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -7
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +0 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
- package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +11 -36
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +0 -2
- package/dist/modules/multimedia/Workspace/Workspace.js +5 -8
- package/dist/modules/multimedia/index.d.ts +0 -1
- package/dist/modules/widgets/index.d.ts +1 -1
- package/dist/multimedia.js +12 -16
- package/package.json +6 -6
- package/dist/hooks/useNextcloudSearch/index.d.ts +0 -1
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +0 -14
- package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +0 -64
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +0 -25
- package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +0 -102
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +0 -48
- package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +0 -24
- package/dist/modules/multimedia/Nextcloud/Nextcloud.js +0 -124
- package/dist/modules/multimedia/Nextcloud/index.d.ts +0 -2
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useState, useRef, useCallback, useImperativeHandle, useLayoutEffect
|
|
2
|
+
import { forwardRef, useState, useRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import
|
|
5
|
+
import SvgIconAlertTriangle from "../../modules/icons/components/IconAlertTriangle.js";
|
|
6
|
+
import SvgIconClose from "../../modules/icons/components/IconClose.js";
|
|
6
7
|
import SvgIconError from "../../modules/icons/components/IconError.js";
|
|
7
8
|
import SvgIconInfoCircle from "../../modules/icons/components/IconInfoCircle.js";
|
|
8
9
|
import SvgIconSuccessOutline from "../../modules/icons/components/IconSuccessOutline.js";
|
|
9
|
-
import
|
|
10
|
-
const Alert = /* @__PURE__ */ forwardRef(({
|
|
10
|
+
import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
|
|
11
|
+
const TOAST_EXIT_ANIMATION_DURATION = 240, getToastAnimationClass = (position, isClosing) => position === "top-left" || position === "bottom-left" ? isClosing ? "alert-slide-out-left" : "alert-slide-in-left" : position === "top-right" || position === "bottom-right" ? isClosing ? "alert-slide-out-right" : "alert-slide-in-right" : isClosing ? "alert-fade-out" : "alert-fade-in", Alert = /* @__PURE__ */ forwardRef(({
|
|
11
12
|
type = "success",
|
|
12
13
|
className = "",
|
|
13
14
|
children,
|
|
@@ -21,31 +22,53 @@ const Alert = /* @__PURE__ */ forwardRef(({
|
|
|
21
22
|
onClose,
|
|
22
23
|
onVisibilityChange
|
|
23
24
|
}, ref) => {
|
|
24
|
-
const [isVisible, setVisibleStatus] = useState(!0), refAlert = useRef(null), {
|
|
25
|
+
const [isVisible, setVisibleStatus] = useState(!0), [isClosing, setIsClosing] = useState(!1), refAlert = useRef(null), {
|
|
25
26
|
t
|
|
26
27
|
} = useTranslation(), hide = useCallback(() => {
|
|
28
|
+
if (isToast) {
|
|
29
|
+
setIsClosing(!0);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
27
32
|
setVisibleStatus(!1), onClose == null || onClose();
|
|
28
|
-
}, [onClose]);
|
|
33
|
+
}, [isToast, onClose]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!isClosing)
|
|
36
|
+
return;
|
|
37
|
+
const timeoutId = setTimeout(() => {
|
|
38
|
+
setVisibleStatus(!1), onClose == null || onClose();
|
|
39
|
+
}, TOAST_EXIT_ANIMATION_DURATION);
|
|
40
|
+
return () => clearTimeout(timeoutId);
|
|
41
|
+
}, [isClosing, onClose]);
|
|
42
|
+
const handleToastClick = () => {
|
|
43
|
+
isToast && !isConfirm && hide();
|
|
44
|
+
};
|
|
29
45
|
useImperativeHandle(ref, () => ({
|
|
30
46
|
show,
|
|
31
47
|
hide,
|
|
32
48
|
...refAlert.current
|
|
33
49
|
})), useLayoutEffect(() => {
|
|
34
50
|
onVisibilityChange == null || onVisibilityChange(isVisible);
|
|
35
|
-
}, [isVisible, onVisibilityChange])
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
}, [isVisible, onVisibilityChange]);
|
|
52
|
+
const shouldAutoClose = autoClose && isVisible && !isClosing, showProgress = autoClose && isToast && !isDismissible && !isClosing, remainingRef = useRef(autoCloseDelay), timeoutRef = useRef(), startedAtRef = useRef(0), [isPaused, setIsPaused] = useState(!1), clearAutoCloseTimeout = useCallback(() => {
|
|
53
|
+
timeoutRef.current && (clearTimeout(timeoutRef.current), timeoutRef.current = void 0);
|
|
54
|
+
}, []);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (shouldAutoClose)
|
|
57
|
+
return remainingRef.current = autoCloseDelay, startedAtRef.current = Date.now(), timeoutRef.current = setTimeout(hide, autoCloseDelay), clearAutoCloseTimeout;
|
|
58
|
+
}, [shouldAutoClose, autoCloseDelay, hide, clearAutoCloseTimeout]);
|
|
59
|
+
const handleMouseEnter = () => {
|
|
60
|
+
!shouldAutoClose || isPaused || (clearAutoCloseTimeout(), remainingRef.current = Math.max(remainingRef.current - (Date.now() - startedAtRef.current), 0), setIsPaused(!0));
|
|
61
|
+
}, handleMouseLeave = () => {
|
|
62
|
+
!shouldAutoClose || !isPaused || (startedAtRef.current = Date.now(), timeoutRef.current = setTimeout(hide, remainingRef.current), setIsPaused(!1));
|
|
63
|
+
}, show = () => {
|
|
64
|
+
setIsClosing(!1), setVisibleStatus(!0);
|
|
42
65
|
}, mapping = {
|
|
43
66
|
success: {
|
|
44
67
|
icon: /* @__PURE__ */ jsx(SvgIconSuccessOutline, {}),
|
|
45
68
|
classModifier: "alert-success"
|
|
46
69
|
},
|
|
47
70
|
warning: {
|
|
48
|
-
icon: /* @__PURE__ */ jsx(
|
|
71
|
+
icon: /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}),
|
|
49
72
|
classModifier: "alert-warning"
|
|
50
73
|
},
|
|
51
74
|
info: {
|
|
@@ -58,21 +81,22 @@ const Alert = /* @__PURE__ */ forwardRef(({
|
|
|
58
81
|
}
|
|
59
82
|
}, toastClasses = {
|
|
60
83
|
"is-dismissible": isDismissible,
|
|
61
|
-
"is-toast
|
|
84
|
+
"is-toast": isToast
|
|
62
85
|
}, confirmClasses = {
|
|
63
86
|
"is-confirm": isConfirm
|
|
64
|
-
}, divContainerClasses = clsx("alert gap-12", mapping[type].classModifier, toastClasses, confirmClasses, position, className);
|
|
65
|
-
return /* @__PURE__ */ jsx(Fragment, { children: isVisible ? /* @__PURE__ */ jsxs("div", { ref: refAlert, className: divContainerClasses, role: "alert", children: [
|
|
87
|
+
}, divContainerClasses = clsx("alert gap-12", mapping[type].classModifier, toastClasses, confirmClasses, position, isToast && getToastAnimationClass(position, isClosing), className);
|
|
88
|
+
return /* @__PURE__ */ jsx(Fragment, { children: isVisible ? /* @__PURE__ */ jsxs("div", { ref: refAlert, className: divContainerClasses, role: "alert", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: handleToastClick, children: [
|
|
66
89
|
!isConfirm && mapping[type].icon,
|
|
67
90
|
/* @__PURE__ */ jsx("div", { className: "alert-content small flex-grow-1", children }),
|
|
68
|
-
button && /* @__PURE__ */ jsxs("div", { className: "
|
|
91
|
+
button && /* @__PURE__ */ jsxs("div", { className: "alert-actions", onClick: (e) => e.stopPropagation(), children: [
|
|
69
92
|
button,
|
|
70
|
-
"
|
|
71
|
-
isConfirm && /* @__PURE__ */ jsx(Button, { onClick: hide, children: t("close") })
|
|
93
|
+
isConfirm && /* @__PURE__ */ jsx(ButtonBeta, { onClick: hide, children: t("close") })
|
|
72
94
|
] }),
|
|
73
|
-
(isDismissible || isConfirm) && /* @__PURE__ */ jsx("div", { className: "btn-close-container", children: /* @__PURE__ */ jsx(
|
|
74
|
-
|
|
75
|
-
|
|
95
|
+
(isDismissible || isConfirm) && /* @__PURE__ */ jsx("div", { className: "btn-close-container", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(ButtonBeta, { type: "button", leftIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), variant: "ghost", color: "tertiary", "aria-label": t("close"), title: t("close"), onClick: hide }) }),
|
|
96
|
+
showProgress && /* @__PURE__ */ jsx("div", { className: clsx("alert-progress", {
|
|
97
|
+
"is-paused": isPaused
|
|
98
|
+
}), style: {
|
|
99
|
+
"--alert-progress-duration": `${autoCloseDelay}ms`
|
|
76
100
|
} })
|
|
77
101
|
] }) : null });
|
|
78
102
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
2
|
+
import { forwardRef, useState, useEffect } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import * as iconsApps from "../../icons-apps.js";
|
|
5
5
|
import useEdificeIcons from "../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
@@ -15,7 +15,7 @@ const AppIcon = /* @__PURE__ */ forwardRef(({
|
|
|
15
15
|
const {
|
|
16
16
|
isIconUrl,
|
|
17
17
|
getIconCode
|
|
18
|
-
} = useEdificeIcons(), isSquare = variant === "square", isRounded = variant === "rounded", isCircle = variant === "circle", isContain = iconFit === "contain", isRatio = iconFit === "ratio", iconSizes = {
|
|
18
|
+
} = useEdificeIcons(), [imageLoadFailed, setImageLoadFailed] = useState(!1), isSquare = variant === "square", isRounded = variant === "rounded", isCircle = variant === "circle", isContain = iconFit === "contain", isRatio = iconFit === "ratio", iconSizes = {
|
|
19
19
|
"icon-xs": size === "24",
|
|
20
20
|
"icon-sm": size === "40",
|
|
21
21
|
"icon-md": size === "48",
|
|
@@ -28,7 +28,11 @@ const AppIcon = /* @__PURE__ */ forwardRef(({
|
|
|
28
28
|
}, iconFits = {
|
|
29
29
|
"icon-contain": isContain,
|
|
30
30
|
"icon-ratio": isRatio
|
|
31
|
-
}, icon = typeof app == "string" ? app : (app == null ? void 0 : app.icon) !== void 0 ? app.icon : "placeholder", displayName = typeof app != "string" && (app == null ? void 0 : app.displayName)
|
|
31
|
+
}, icon = typeof app == "string" ? app : (app == null ? void 0 : app.icon) !== void 0 ? app.icon : "placeholder", displayName = typeof app != "string" && ((app == null ? void 0 : app.displayName) || (app == null ? void 0 : app.name)) || "", code = app ? getIconCode(app) : "", iconIsUrl = !!isIconUrl(icon), isIconURL = iconIsUrl && !imageLoadFailed, showLetterFallback = iconIsUrl && imageLoadFailed && !!displayName;
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setImageLoadFailed(!1);
|
|
34
|
+
}, [icon]);
|
|
35
|
+
const appCode = iconIsUrl ? "placeholder" : code || "placeholder", classes = clsx("app-icon", {
|
|
32
36
|
...iconSizes,
|
|
33
37
|
...iconVariant,
|
|
34
38
|
...iconFits,
|
|
@@ -42,12 +46,14 @@ const AppIcon = /* @__PURE__ */ forwardRef(({
|
|
|
42
46
|
const classes2 = clsx("h-full", className);
|
|
43
47
|
return /* @__PURE__ */ jsx(Image, { src: icon, alt: displayName, objectFit: "contain", width: size, height: size, className: classes2, style: {
|
|
44
48
|
minWidth: size + "px"
|
|
45
|
-
} });
|
|
49
|
+
}, onError: () => setImageLoadFailed(!0) });
|
|
46
50
|
}
|
|
47
51
|
return /* @__PURE__ */ jsx("div", { ref, className: classes, style: {
|
|
48
52
|
width: size + "px",
|
|
49
53
|
height: size + "px"
|
|
50
|
-
}, children: /* @__PURE__ */ jsx(
|
|
54
|
+
}, children: showLetterFallback ? /* @__PURE__ */ jsx("span", { className: "app-icon-letter", style: {
|
|
55
|
+
fontSize: size + "px"
|
|
56
|
+
}, children: displayName.charAt(0).toUpperCase() }) : /* @__PURE__ */ jsx(IconComponent, { width: size, height: size }) });
|
|
51
57
|
});
|
|
52
58
|
export {
|
|
53
59
|
AppIcon as default
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
+
import SvgIconError from "../../modules/icons/components/IconError.js";
|
|
4
|
+
import SvgIconSuccessOutline from "../../modules/icons/components/IconSuccessOutline.js";
|
|
3
5
|
import { useFormControl } from "./FormContext.js";
|
|
4
6
|
const FormText = ({
|
|
5
7
|
children
|
|
6
8
|
}) => {
|
|
7
9
|
const {
|
|
8
10
|
status
|
|
9
|
-
} = useFormControl(), classes = clsx("
|
|
10
|
-
"
|
|
11
|
-
valid: status === "valid"
|
|
12
|
-
});
|
|
13
|
-
return /* @__PURE__ */
|
|
11
|
+
} = useFormControl(), classes = clsx("input-message", {
|
|
12
|
+
"input-message--invalid": status === "invalid",
|
|
13
|
+
"input-message--valid": status === "valid"
|
|
14
|
+
}), Icon = status === "invalid" ? SvgIconError : status === "valid" ? SvgIconSuccessOutline : null;
|
|
15
|
+
return /* @__PURE__ */ jsxs("p", { className: classes, children: [
|
|
16
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "input-message__icon", "aria-hidden": "true" }),
|
|
17
|
+
children
|
|
18
|
+
] });
|
|
14
19
|
};
|
|
15
20
|
export {
|
|
16
21
|
FormText as default
|
|
@@ -10,6 +10,7 @@ const Image = /* @__PURE__ */ forwardRef(({
|
|
|
10
10
|
ratio,
|
|
11
11
|
objectFit,
|
|
12
12
|
className,
|
|
13
|
+
onError: onErrorProp,
|
|
13
14
|
...restProps
|
|
14
15
|
}, ref) => {
|
|
15
16
|
const placeholder = imgPlaceholder ?? commonPlaceholder, {
|
|
@@ -18,7 +19,9 @@ const Image = /* @__PURE__ */ forwardRef(({
|
|
|
18
19
|
} = useImage({
|
|
19
20
|
src,
|
|
20
21
|
placeholder
|
|
21
|
-
}),
|
|
22
|
+
}), handleError = (event) => {
|
|
23
|
+
onError(), onErrorProp == null || onErrorProp(event);
|
|
24
|
+
}, ratioImage = {
|
|
22
25
|
"ratio ratio-1x1": ratio === "1",
|
|
23
26
|
"ratio ratio-4x3": ratio === "4",
|
|
24
27
|
"ratio ratio-16x9": ratio === "16",
|
|
@@ -33,7 +36,7 @@ const Image = /* @__PURE__ */ forwardRef(({
|
|
|
33
36
|
...ratioImage
|
|
34
37
|
}), classes = clsx({
|
|
35
38
|
...objectImage
|
|
36
|
-
}, className), renderImage = /* @__PURE__ */ jsx("img", { alt, onError, ref, src: imgSrc, className: classes, ...restProps });
|
|
39
|
+
}, className), renderImage = /* @__PURE__ */ jsx("img", { alt, onError: handleError, ref, src: imgSrc, className: classes, ...restProps });
|
|
37
40
|
return ratio ? /* @__PURE__ */ jsx("div", { className: ratioClasses, children: renderImage }) : renderImage;
|
|
38
41
|
});
|
|
39
42
|
export {
|
|
@@ -2,7 +2,8 @@ import { Size } from '../../types';
|
|
|
2
2
|
export type OmitInputProps = 'disabled' | 'required' | 'size' | 'id' | 'readOnly';
|
|
3
3
|
export interface InputProps extends Omit<React.ComponentPropsWithRef<'input'>, OmitInputProps> {
|
|
4
4
|
/**
|
|
5
|
-
* Control size of input
|
|
5
|
+
* Control size of input. `sm` and `md` share the same visual size
|
|
6
|
+
* ("Medium" in the design system); only `lg` ("Big") differs.
|
|
6
7
|
*/
|
|
7
8
|
size: Size;
|
|
8
9
|
/**
|
|
@@ -18,7 +19,8 @@ export interface InputProps extends Omit<React.ComponentPropsWithRef<'input'>, O
|
|
|
18
19
|
*/
|
|
19
20
|
disabled?: boolean;
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* @deprecated Validation icons no longer render inside the field —
|
|
23
|
+
* this prop has no effect and will be removed in a future major version.
|
|
22
24
|
*/
|
|
23
25
|
noValidationIcon?: boolean;
|
|
24
26
|
/**
|
|
@@ -33,6 +35,13 @@ export interface InputProps extends Omit<React.ComponentPropsWithRef<'input'>, O
|
|
|
33
35
|
* Browser autocomplete feature
|
|
34
36
|
*/
|
|
35
37
|
autoComplete?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Show a built-in clear (×) button while the field is focused. Opt-in:
|
|
40
|
+
* several consumers render their own clear affordance already (e.g.
|
|
41
|
+
* `SearchBar`), and a broad audit of every `Input` usage hasn't been done
|
|
42
|
+
* yet — see INPUT-MIGRATION-PLAN.md §07.
|
|
43
|
+
*/
|
|
44
|
+
clearable?: boolean;
|
|
36
45
|
}
|
|
37
46
|
/**
|
|
38
47
|
* Input Form Component
|
|
@@ -1,40 +1,62 @@
|
|
|
1
|
-
import { jsxs,
|
|
2
|
-
import { forwardRef, useState } from "react";
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef, useState, useLayoutEffect } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import SvgIconClose from "../../modules/icons/components/IconClose.js";
|
|
4
6
|
import { useFormControl } from "../Form/FormContext.js";
|
|
5
|
-
import Textcounter from "../TextCounter/TextCounter.js";
|
|
6
7
|
const Input = /* @__PURE__ */ forwardRef(({
|
|
7
|
-
noValidationIcon,
|
|
8
8
|
placeholder,
|
|
9
9
|
size = "md",
|
|
10
10
|
type = "text",
|
|
11
11
|
className,
|
|
12
12
|
showCounter = !1,
|
|
13
13
|
autoComplete = "off",
|
|
14
|
+
clearable = !1,
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
+
noValidationIcon,
|
|
14
17
|
...restProps
|
|
15
|
-
},
|
|
18
|
+
}, forwardedRef) => {
|
|
16
19
|
var _a;
|
|
17
20
|
const {
|
|
18
21
|
id,
|
|
19
22
|
isRequired,
|
|
20
23
|
isReadOnly,
|
|
21
24
|
status
|
|
22
|
-
} = useFormControl(),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
} = useFormControl(), {
|
|
26
|
+
t
|
|
27
|
+
} = useTranslation(), inputRef = useRef(null), [currentLength, setCurrentLength] = useState(((_a = restProps.defaultValue) == null ? void 0 : _a.toString().length) || 0);
|
|
28
|
+
useLayoutEffect(() => {
|
|
29
|
+
inputRef.current && setCurrentLength(inputRef.current.value.length);
|
|
30
|
+
}, []);
|
|
31
|
+
const setRefs = (node) => {
|
|
32
|
+
inputRef.current = node, typeof forwardedRef == "function" ? forwardedRef(node) : forwardedRef && (forwardedRef.current = node);
|
|
33
|
+
}, wrapperClasses = clsx("input", {
|
|
34
|
+
"input--lg": size === "lg",
|
|
35
|
+
"input--invalid": status === "invalid",
|
|
36
|
+
"input--valid": status === "valid",
|
|
37
|
+
"input--plaintext": isReadOnly
|
|
38
|
+
}, className), handleChange = (e) => {
|
|
39
|
+
var _a2;
|
|
40
|
+
setCurrentLength(e.target.value.length), (_a2 = restProps.onChange) == null || _a2.call(restProps, e);
|
|
41
|
+
}, handleClear = () => {
|
|
42
|
+
var _a2;
|
|
43
|
+
const node = inputRef.current;
|
|
44
|
+
if (!node) return;
|
|
45
|
+
const nativeSetter = (_a2 = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")) == null ? void 0 : _a2.set;
|
|
46
|
+
nativeSetter == null || nativeSetter.call(node, ""), node.dispatchEvent(new Event("input", {
|
|
47
|
+
bubbles: !0
|
|
48
|
+
})), node.focus();
|
|
49
|
+
}, maxLength = restProps.maxLength ?? 0;
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", { className: wrapperClasses, children: [
|
|
51
|
+
/* @__PURE__ */ jsx("input", { ref: setRefs, id, className: "input__field", type, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps, onChange: handleChange, autoComplete }),
|
|
52
|
+
clearable && !isReadOnly && /* @__PURE__ */ jsx("button", { type: "button", className: "input__clear", onClick: handleClear, "aria-label": t("clear"), children: /* @__PURE__ */ jsx(SvgIconClose, {}) }),
|
|
53
|
+
showCounter && /* @__PURE__ */ jsxs("span", { className: clsx("input__counter", {
|
|
54
|
+
"input__counter--max": currentLength === maxLength
|
|
55
|
+
}), children: [
|
|
56
|
+
currentLength,
|
|
57
|
+
" / ",
|
|
58
|
+
maxLength
|
|
59
|
+
] })
|
|
38
60
|
] });
|
|
39
61
|
});
|
|
40
62
|
export {
|
|
@@ -16,8 +16,8 @@ const Label = /* @__PURE__ */ forwardRef(({
|
|
|
16
16
|
isRequired
|
|
17
17
|
} = useFormControl(), {
|
|
18
18
|
t
|
|
19
|
-
} = useTranslation(), classes = clsx("
|
|
20
|
-
"has-icon": leftIcon
|
|
19
|
+
} = useTranslation(), classes = clsx("input-label", {
|
|
20
|
+
"input-label--has-icon": leftIcon
|
|
21
21
|
}, className), optionalState = isOptional && !isRequired, requiredState = isRequired && !isOptional;
|
|
22
22
|
return useEffect(() => {
|
|
23
23
|
if (isOptional && isRequired)
|
|
@@ -25,11 +25,11 @@ const Label = /* @__PURE__ */ forwardRef(({
|
|
|
25
25
|
}, [isOptional, isRequired]), /* @__PURE__ */ jsxs("label", { ref, htmlFor: id, className: classes, children: [
|
|
26
26
|
leftIcon,
|
|
27
27
|
children,
|
|
28
|
-
optionalState && /* @__PURE__ */ jsxs("em", { className: "
|
|
28
|
+
optionalState && /* @__PURE__ */ jsxs("em", { className: "input-label__optional", children: [
|
|
29
29
|
"- ",
|
|
30
30
|
optionalText ?? t("explorer.optional")
|
|
31
31
|
] }),
|
|
32
|
-
requiredState && /* @__PURE__ */ jsx("em", { className: "
|
|
32
|
+
requiredState && /* @__PURE__ */ jsx("em", { className: "input-label__required", children: requiredText })
|
|
33
33
|
] });
|
|
34
34
|
});
|
|
35
35
|
export {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Suspense, lazy } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { Toaster } from "react-hot-toast";
|
|
5
4
|
import { useTranslation } from "react-i18next";
|
|
6
5
|
import { useEdificeTheme } from "../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
6
|
+
import { useOverlay } from "../PageLayout/hook/useOverlay.js";
|
|
7
7
|
import Header from "./components/Header.js";
|
|
8
8
|
import HeaderNotificationsOverlay from "./components/HeaderNotificationsOverlay.js";
|
|
9
|
-
import { useOverlay } from "../PageLayout/hook/useOverlay.js";
|
|
10
9
|
import useUiOverride from "../../hooks/useUiOverride/useUiOverride.js";
|
|
10
|
+
import useBackground from "../../hooks/useBackground/useBackground.js";
|
|
11
|
+
import useToast from "../../hooks/useToast/useToast.js";
|
|
11
12
|
import useCookiesConsent from "../../hooks/useCookiesConsent/useCookiesConsent.js";
|
|
12
13
|
import useZendeskGuide from "../../hooks/useZendeskGuide/useZendeskGuide.js";
|
|
13
14
|
import useCantoo from "../../hooks/useCantoo/useCantoo.js";
|
|
14
15
|
import Alert from "../Alert/Alert.js";
|
|
15
|
-
import
|
|
16
|
+
import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
|
|
16
17
|
const HeaderV2 = /* @__PURE__ */ lazy(() => import("../../modules/homepage/components/Header/Header.js")), Layout = ({
|
|
17
18
|
children,
|
|
18
19
|
headless = !1,
|
|
@@ -22,9 +23,14 @@ const HeaderV2 = /* @__PURE__ */ lazy(() => import("../../modules/homepage/compo
|
|
|
22
23
|
}) => {
|
|
23
24
|
const {
|
|
24
25
|
theme
|
|
25
|
-
} = useEdificeTheme(), override = useUiOverride("layout.header"), isHeaderV2 = (override == null ? void 0 : override.variant) === "v2",
|
|
26
|
+
} = useEdificeTheme(), override = useUiOverride("layout.header"), isHeaderV2 = (override == null ? void 0 : override.variant) === "v2", {
|
|
27
|
+
productOverride,
|
|
28
|
+
background,
|
|
29
|
+
isBackgroundImageOverridden,
|
|
30
|
+
betaEnabled
|
|
31
|
+
} = useBackground(), {
|
|
26
32
|
toggleOverlay
|
|
27
|
-
} = useOverlay(), {
|
|
33
|
+
} = useOverlay(), toast = useToast(), {
|
|
28
34
|
t
|
|
29
35
|
} = useTranslation(), {
|
|
30
36
|
showCookiesConsent,
|
|
@@ -37,12 +43,10 @@ const HeaderV2 = /* @__PURE__ */ lazy(() => import("../../modules/homepage/compo
|
|
|
37
43
|
"container-fluid": !headless,
|
|
38
44
|
"rounded-4 border": (theme == null ? void 0 : theme.is1d) && !headless,
|
|
39
45
|
"mt-24": (theme == null ? void 0 : theme.is1d) && !headless
|
|
40
|
-
}, className), renderHeader = headless ? null : isHeaderV2 ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(HeaderV2, { src: theme == null ? void 0 : theme.basePath, dataProduct: override == null ? void 0 : override.theme, onNotificationsClick: toggleOverlay }) }) : /* @__PURE__ */ jsx(Header, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderNotificationsOverlay = !headless && isHeaderV2 && /* @__PURE__ */ jsx(HeaderNotificationsOverlay, {}), renderCookies = showCookiesConsent && /* @__PURE__ */ jsx(Alert, { type: "info", className: "m-12 rgpd", isConfirm: !0, position: "bottom-right", button: /* @__PURE__ */ jsx(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"layout-has-background-image": hasBackgroundImage
|
|
45
|
-
}), "data-product": hasBackgroundImage ? backgroundOverride == null ? void 0 : backgroundOverride.theme : void 0, children: [
|
|
46
|
+
}, className), renderHeader = headless ? null : isHeaderV2 ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(HeaderV2, { src: theme == null ? void 0 : theme.basePath, dataProduct: override == null ? void 0 : override.theme, onNotificationsClick: toggleOverlay }) }) : /* @__PURE__ */ jsx(Header, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderNotificationsOverlay = !headless && isHeaderV2 && /* @__PURE__ */ jsx(HeaderNotificationsOverlay, {}), renderCookies = showCookiesConsent && /* @__PURE__ */ jsx(Alert, { type: "info", className: "m-12 rgpd", isConfirm: !0, position: "bottom-right", button: /* @__PURE__ */ jsx(ButtonBeta, { variant: "outline", onClick: handleConsultCookies, children: t("rgpd.cookies.banner.button.consult") }), onClose: handleCloseCookiesConsent, children: t("rgpd.cookies.banner.text1") }), renderToaster = toast.renderToaster(), isBackgroundHidden = !!(theme != null && theme.is1d || !betaEnabled);
|
|
47
|
+
return /* @__PURE__ */ jsxs("div", { "data-product": productOverride, "data-background": isBackgroundHidden ? void 0 : background, className: clsx("layout", {
|
|
48
|
+
"layout-has-background-image": isBackgroundImageOverridden
|
|
49
|
+
}), children: [
|
|
46
50
|
renderHeader,
|
|
47
51
|
renderNotificationsOverlay,
|
|
48
52
|
/* @__PURE__ */ jsx("main", { className: classes, ...restProps, children }),
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
export type LinkPillIllustrationType = 'icon' | 'img';
|
|
3
|
+
export type LinkPillIllustrationPosition = 'left' | 'right';
|
|
4
|
+
export interface LinkPillProps extends ComponentPropsWithoutRef<'a'> {
|
|
5
|
+
/**
|
|
6
|
+
* URL opened in a new tab when the pill is clicked.
|
|
7
|
+
*/
|
|
8
|
+
href: string;
|
|
9
|
+
/**
|
|
10
|
+
* Text displayed inside the pill (single line, ellipsis on overflow).
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional second line displayed below the label (single line, ellipsis
|
|
15
|
+
* on overflow). Does not affect the label's font size.
|
|
16
|
+
*/
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Illustration node. Defaults to `<IconLink />` for the `icon` type.
|
|
20
|
+
* For the `img` type, the caller must provide an `<img>` element.
|
|
21
|
+
*/
|
|
22
|
+
illustration?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* `icon` (default): illustration wrapped in a small rounded box.
|
|
25
|
+
* `img`: illustration rendered as a 36x36 rounded square (e.g. a favicon).
|
|
26
|
+
*/
|
|
27
|
+
illustrationType?: LinkPillIllustrationType;
|
|
28
|
+
/**
|
|
29
|
+
* Side the illustration is displayed on.
|
|
30
|
+
*/
|
|
31
|
+
illustrationPosition?: LinkPillIllustrationPosition;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* LinkPill – design system component used to display a link to an
|
|
35
|
+
* external resource as a small rounded pill.
|
|
36
|
+
*/
|
|
37
|
+
declare const LinkPill: {
|
|
38
|
+
({ href, label, subtitle, illustration, illustrationType, illustrationPosition, className, ...restProps }: LinkPillProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
displayName: string;
|
|
40
|
+
};
|
|
41
|
+
export default LinkPill;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import SvgIconLink from "../../modules/icons/components/IconLink.js";
|
|
4
|
+
const LinkPill = ({
|
|
5
|
+
href,
|
|
6
|
+
label,
|
|
7
|
+
subtitle,
|
|
8
|
+
illustration,
|
|
9
|
+
illustrationType = "icon",
|
|
10
|
+
illustrationPosition = "left",
|
|
11
|
+
className,
|
|
12
|
+
...restProps
|
|
13
|
+
}) => {
|
|
14
|
+
const illustrationNode = illustrationType === "icon" ? /* @__PURE__ */ jsx("span", { className: "link-pill-icon", children: illustration ?? /* @__PURE__ */ jsx(SvgIconLink, {}) }) : /* @__PURE__ */ jsx("span", { className: "link-pill-image", children: illustration }), contentNode = /* @__PURE__ */ jsxs("span", { className: "link-pill-content", children: [
|
|
15
|
+
/* @__PURE__ */ jsx("span", { className: "link-pill-label", title: label, children: label }),
|
|
16
|
+
subtitle && /* @__PURE__ */ jsx("span", { className: "link-pill-subtitle", title: subtitle, children: subtitle })
|
|
17
|
+
] });
|
|
18
|
+
return /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", "data-testid": "link-pill", className: clsx("link-pill", `link-pill--illustration-${illustrationPosition}`, className), ...restProps, children: illustrationPosition === "left" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
|
+
illustrationNode,
|
|
20
|
+
contentNode
|
|
21
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22
|
+
contentNode,
|
|
23
|
+
illustrationNode
|
|
24
|
+
] }) });
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
LinkPill as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type ModalBetaElement = HTMLDivElement;
|
|
2
|
+
export type ModalBetaSize = 's' | 'm' | 'l' | 'xl';
|
|
3
|
+
export interface ModalBetaProps {
|
|
4
|
+
/**
|
|
5
|
+
* Modal id (useful when multiple modal on the same page)
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Modal testid
|
|
10
|
+
*/
|
|
11
|
+
['data-testid']?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Is Modal Open
|
|
14
|
+
*/
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Function to call when closing modal
|
|
18
|
+
*/
|
|
19
|
+
onModalClose: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Size of the modal (width, padding and corner radius)
|
|
22
|
+
*/
|
|
23
|
+
size?: ModalBetaSize;
|
|
24
|
+
/**
|
|
25
|
+
* ID of the HTML element to receive focus when modal is active.
|
|
26
|
+
*/
|
|
27
|
+
focusId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Children
|
|
30
|
+
*/
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
declare const ModalBeta: import('react').ForwardRefExoticComponent<ModalBetaProps & import('react').RefAttributes<HTMLDivElement>> & {
|
|
34
|
+
Header: {
|
|
35
|
+
({ onModalClose, children, subtitle, }: import('./ModalBetaHeader').ModalBetaHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
38
|
+
Body: {
|
|
39
|
+
({ children, className }: import('./ModalBetaBody').ModalBetaBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
Footer: {
|
|
43
|
+
({ children }: import('./ModalBetaFooter').ModalBetaFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
displayName: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export default ModalBeta;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useCallback, useEffect } from "react";
|
|
3
|
+
import { useTransition, animated } from "@react-spring/web";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import ModalBetaBody from "./ModalBetaBody.js";
|
|
6
|
+
import { ModalBetaContext } from "./ModalBetaContext.js";
|
|
7
|
+
import ModalBetaFooter from "./ModalBetaFooter.js";
|
|
8
|
+
import ModalBetaHeader from "./ModalBetaHeader.js";
|
|
9
|
+
import useClickOutside from "../../hooks/useClickOutside/useClickOutside.js";
|
|
10
|
+
import useTrapFocus from "../../hooks/useTrapFocus/useTrapFocus.js";
|
|
11
|
+
import useKeyPress from "../../hooks/useKeyPress/useKeyPress.js";
|
|
12
|
+
const Root = /* @__PURE__ */ forwardRef(({
|
|
13
|
+
id,
|
|
14
|
+
isOpen,
|
|
15
|
+
onModalClose,
|
|
16
|
+
size = "m",
|
|
17
|
+
focusId,
|
|
18
|
+
children,
|
|
19
|
+
...otherDivProps
|
|
20
|
+
}, ref) => {
|
|
21
|
+
const ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose, void 0, void 0, isOpen), trapRef = useTrapFocus(isOpen), setDialogRef = useCallback((node) => {
|
|
22
|
+
modalRef.current = node, trapRef.current = node;
|
|
23
|
+
}, [modalRef, trapRef]);
|
|
24
|
+
useKeyPress(onModalClose, ["Escape"]), useEffect(() => {
|
|
25
|
+
if (isOpen && (document.body.style.overflow = "hidden", focusId)) {
|
|
26
|
+
const elem = document.getElementById(focusId);
|
|
27
|
+
elem == null || elem.focus();
|
|
28
|
+
}
|
|
29
|
+
return () => {
|
|
30
|
+
document.body.style.overflow = "";
|
|
31
|
+
};
|
|
32
|
+
}, [focusId, isOpen]);
|
|
33
|
+
const modalClasses = clsx("modal-beta", `modal-beta--${size}`), modalContextValue = {
|
|
34
|
+
ariaLabelId,
|
|
35
|
+
ariaDescriptionId,
|
|
36
|
+
focusId
|
|
37
|
+
}, transition = useTransition(isOpen, {
|
|
38
|
+
from: {
|
|
39
|
+
y: -20,
|
|
40
|
+
opacity: 0
|
|
41
|
+
},
|
|
42
|
+
enter: {
|
|
43
|
+
y: 0,
|
|
44
|
+
opacity: 1
|
|
45
|
+
},
|
|
46
|
+
leave: {
|
|
47
|
+
y: 20,
|
|
48
|
+
opacity: 0
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return /* @__PURE__ */ jsx(ModalBetaContext.Provider, { value: modalContextValue, children: transition((style, isOpen2) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
+
isOpen2 && /* @__PURE__ */ jsx(animated.div, { id, ref, role: "dialog", "aria-modal": "true", "aria-labelledby": ariaLabelId, "aria-describedby": ariaDescriptionId, className: modalClasses, style, tabIndex: -1, ...otherDivProps, children: /* @__PURE__ */ jsx("div", { id: `${id}_ref`, ref: setDialogRef, className: "modal-beta-dialog", children: /* @__PURE__ */ jsx("div", { className: "modal-beta-content", children }) }) }),
|
|
53
|
+
isOpen2 && /* @__PURE__ */ jsx("div", { className: "modal-beta-backdrop" })
|
|
54
|
+
] })) });
|
|
55
|
+
}), ModalBeta = Object.assign(Root, {
|
|
56
|
+
Header: ModalBetaHeader,
|
|
57
|
+
Body: ModalBetaBody,
|
|
58
|
+
Footer: ModalBetaFooter
|
|
59
|
+
});
|
|
60
|
+
export {
|
|
61
|
+
ModalBeta as default
|
|
62
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ModalBetaBodyProps {
|
|
3
|
+
/**
|
|
4
|
+
* Children
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Optional class for styling purpose
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* ModalBeta Body
|
|
14
|
+
*/
|
|
15
|
+
declare const ModalBetaBody: {
|
|
16
|
+
({ children, className }: ModalBetaBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
export default ModalBetaBody;
|