@edifice.io/react 2.5.23-develop.20260623112621 → 2.5.23-develop.20260623175634
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/AppIcon/AppIcon.js +1 -4
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/Avatar/Avatar.js +1 -2
- package/dist/components/Flex/Flex.js +1 -5
- package/dist/components/Logo/index.d.ts +1 -1
- package/dist/components/index.d.ts +0 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/useEdificeIcons/useEdificeIcons.js +9 -10
- package/dist/icons-nav.js +28 -38
- package/dist/index.js +202 -215
- package/dist/modules/icons/components/nav/index.d.ts +0 -5
- package/dist/modules/modals/OnboardingModal/index.d.ts +1 -1
- package/dist/providers/EdificeClientProvider/EdificeClientProvider.d.ts +7 -0
- package/package.json +8 -13
- package/dist/components/BetaSwitch/BetaSwitch.d.ts +0 -13
- package/dist/components/BetaSwitch/BetaSwitch.js +0 -27
- package/dist/components/BetaSwitch/index.d.ts +0 -1
- package/dist/components/ButtonBeta/ButtonBeta.d.ts +0 -47
- package/dist/components/ButtonBeta/ButtonBeta.js +0 -34
- package/dist/components/ButtonBeta/index.d.ts +0 -2
- package/dist/components/LogoBeta/LogoBeta.d.ts +0 -7
- package/dist/components/LogoBeta/LogoBeta.js +0 -14
- package/dist/components/LogoBeta/index.d.ts +0 -2
- package/dist/components/PageLayout/PageLayout.d.ts +0 -45
- package/dist/components/PageLayout/PageLayout.js +0 -94
- package/dist/components/PageLayout/PageLayoutContext.d.ts +0 -14
- package/dist/components/PageLayout/PageLayoutContext.js +0 -8
- package/dist/components/PageLayout/components/PageLayoutBreadcrumb.d.ts +0 -9
- package/dist/components/PageLayout/components/PageLayoutBreadcrumb.js +0 -10
- package/dist/components/PageLayout/components/PageLayoutContent.d.ts +0 -9
- package/dist/components/PageLayout/components/PageLayoutContent.js +0 -18
- package/dist/components/PageLayout/components/PageLayoutHeader.d.ts +0 -10
- package/dist/components/PageLayout/components/PageLayoutHeader.js +0 -18
- package/dist/components/PageLayout/components/PageLayoutOverlay.d.ts +0 -15
- package/dist/components/PageLayout/components/PageLayoutOverlay.js +0 -51
- package/dist/components/PageLayout/components/PageLayoutSidebarLeft.d.ts +0 -9
- package/dist/components/PageLayout/components/PageLayoutSidebarLeft.js +0 -18
- package/dist/components/PageLayout/components/PageLayoutSidebarRight.d.ts +0 -9
- package/dist/components/PageLayout/components/PageLayoutSidebarRight.js +0 -18
- package/dist/components/PageLayout/hook/useOverlay.d.ts +0 -5
- package/dist/components/PageLayout/hook/useOverlay.js +0 -15
- package/dist/components/PageLayout/index.d.ts +0 -4
- package/dist/components/PageLayout/store/overlayStore.d.ts +0 -15
- package/dist/components/PageLayout/store/overlayStore.js +0 -12
- package/dist/homepage.js +0 -34
- package/dist/modules/homepage/components/Favorites/Favorites.d.ts +0 -6
- package/dist/modules/homepage/components/Favorites/Favorites.js +0 -28
- package/dist/modules/homepage/components/Favorites/FavoritesContainer.d.ts +0 -4
- package/dist/modules/homepage/components/Favorites/FavoritesContainer.js +0 -10
- package/dist/modules/homepage/components/Favorites/index.d.ts +0 -2
- package/dist/modules/homepage/components/Header/Header.d.ts +0 -9
- package/dist/modules/homepage/components/Header/Header.js +0 -80
- package/dist/modules/homepage/components/Header/index.d.ts +0 -2
- package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +0 -37
- package/dist/modules/homepage/components/HomeCard/HomeCard.js +0 -17
- package/dist/modules/homepage/components/HomeCard/HomeCardContent.d.ts +0 -7
- package/dist/modules/homepage/components/HomeCard/HomeCardContent.js +0 -10
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +0 -18
- package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +0 -22
- package/dist/modules/homepage/components/HomeCard/index.d.ts +0 -4
- package/dist/modules/homepage/components/LastInfos/LastInfos.d.ts +0 -49
- package/dist/modules/homepage/components/LastInfos/LastInfos.js +0 -58
- package/dist/modules/homepage/components/LastInfos/LastInfosContainer.d.ts +0 -4
- package/dist/modules/homepage/components/LastInfos/LastInfosContainer.js +0 -37
- package/dist/modules/homepage/components/LastInfos/LastInfosList.d.ts +0 -13
- package/dist/modules/homepage/components/LastInfos/LastInfosList.js +0 -31
- package/dist/modules/homepage/components/LastInfos/index.d.ts +0 -4
- package/dist/modules/homepage/components/LastInfos/useLastInfos.d.ts +0 -18
- package/dist/modules/homepage/components/LastInfos/useLastInfos.js +0 -25
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.d.ts +0 -12
- package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +0 -65
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashList.d.ts +0 -12
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashList.js +0 -10
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashListContainer.d.ts +0 -5
- package/dist/modules/homepage/components/MessageFlashList/MessageFlashListContainer.js +0 -14
- package/dist/modules/homepage/components/MessageFlashList/hooks/useMessageFlashList.d.ts +0 -16
- package/dist/modules/homepage/components/MessageFlashList/hooks/useMessageFlashList.js +0 -19
- package/dist/modules/homepage/components/MessageFlashList/index.d.ts +0 -4
- package/dist/modules/homepage/components/MessageFlashList/services/api/index.d.ts +0 -4
- package/dist/modules/homepage/components/MessageFlashList/services/api/index.js +0 -5
- package/dist/modules/homepage/components/MessageFlashList/services/api/messagesFlashService.d.ts +0 -20
- package/dist/modules/homepage/components/MessageFlashList/services/api/messagesFlashService.js +0 -21
- package/dist/modules/homepage/components/MessageFlashList/services/queries/messagesFlash.d.ts +0 -13
- package/dist/modules/homepage/components/MessageFlashList/services/queries/messagesFlash.js +0 -31
- package/dist/modules/homepage/components/Notifications/Notification.d.ts +0 -20
- package/dist/modules/homepage/components/Notifications/Notification.js +0 -16
- package/dist/modules/homepage/components/Notifications/NotificationList.d.ts +0 -18
- package/dist/modules/homepage/components/Notifications/NotificationList.js +0 -44
- package/dist/modules/homepage/components/Notifications/NotificationListContainer.d.ts +0 -9
- package/dist/modules/homepage/components/Notifications/NotificationListContainer.js +0 -20
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.d.ts +0 -5
- package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +0 -17
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.d.ts +0 -3
- package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +0 -19
- package/dist/modules/homepage/components/Notifications/components/NotificationItem.d.ts +0 -24
- package/dist/modules/homepage/components/Notifications/components/NotificationItem.js +0 -28
- package/dist/modules/homepage/components/Notifications/components/NotificationResource.d.ts +0 -15
- package/dist/modules/homepage/components/Notifications/components/NotificationResource.js +0 -19
- package/dist/modules/homepage/components/Notifications/components/SystemNotification.d.ts +0 -15
- package/dist/modules/homepage/components/Notifications/components/SystemNotification.js +0 -20
- package/dist/modules/homepage/components/Notifications/components/UserNotification.d.ts +0 -15
- package/dist/modules/homepage/components/Notifications/components/UserNotification.js +0 -25
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +0 -27
- package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +0 -53
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.d.ts +0 -20
- package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +0 -26
- package/dist/modules/homepage/components/Notifications/index.d.ts +0 -6
- package/dist/modules/homepage/components/Notifications/services/api/index.d.ts +0 -4
- package/dist/modules/homepage/components/Notifications/services/api/index.js +0 -5
- package/dist/modules/homepage/components/Notifications/services/api/notificationService.d.ts +0 -15
- package/dist/modules/homepage/components/Notifications/services/api/notificationService.js +0 -22
- package/dist/modules/homepage/components/Notifications/services/queries/notification.d.ts +0 -20
- package/dist/modules/homepage/components/Notifications/services/queries/notification.js +0 -40
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.d.ts +0 -15
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpace.js +0 -29
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.d.ts +0 -4
- package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +0 -13
- package/dist/modules/homepage/components/SchoolSpace/index.d.ts +0 -3
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.d.ts +0 -6
- package/dist/modules/homepage/components/SchoolSpace/useUserSchools.js +0 -39
- package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +0 -13
- package/dist/modules/homepage/components/UserSpace/UserSpace.js +0 -28
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +0 -7
- package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +0 -19
- package/dist/modules/homepage/components/UserSpace/index.d.ts +0 -3
- package/dist/modules/homepage/components/index.d.ts +0 -8
- package/dist/modules/homepage/hooks/useWidget.d.ts +0 -6
- package/dist/modules/homepage/hooks/useWidget.js +0 -83
- package/dist/modules/homepage/hooks/useWidgetPreferences.d.ts +0 -6
- package/dist/modules/homepage/hooks/useWidgetPreferences.js +0 -34
- package/dist/modules/homepage/index.d.ts +0 -1
- package/dist/modules/icons/components/nav/IconCommunitiesBeta.d.ts +0 -7
- package/dist/modules/icons/components/nav/IconCommunitiesBeta.js +0 -18
- package/dist/modules/icons/components/nav/IconHomeBeta.d.ts +0 -7
- package/dist/modules/icons/components/nav/IconHomeBeta.js +0 -13
- package/dist/modules/icons/components/nav/IconMessagesBeta.d.ts +0 -7
- package/dist/modules/icons/components/nav/IconMessagesBeta.js +0 -18
- package/dist/modules/icons/components/nav/IconMyAppsBeta.d.ts +0 -7
- package/dist/modules/icons/components/nav/IconMyAppsBeta.js +0 -13
- package/dist/modules/icons/components/nav/IconNotificationBeta.d.ts +0 -7
- package/dist/modules/icons/components/nav/IconNotificationBeta.js +0 -14
- package/dist/utilities/create-selectors/createSelectors.d.ts +0 -10
- package/dist/utilities/create-selectors/createSelectors.js +0 -11
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import illuEmptyFavorite from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-favorite.svg";
|
|
4
|
-
import SvgIconArrowRight from "../../../icons/components/IconArrowRight.js";
|
|
5
|
-
import HomeCard from "../HomeCard/HomeCard.js";
|
|
6
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
7
|
-
import AppIcon from "../../../../components/AppIcon/AppIcon.js";
|
|
8
|
-
function Favorites({
|
|
9
|
-
apps,
|
|
10
|
-
onSeeAllClick = () => window.open("/welcome", "_self")
|
|
11
|
-
}) {
|
|
12
|
-
const {
|
|
13
|
-
t
|
|
14
|
-
} = useTranslation(), getAppName = (app) => app.prefix && app.prefix.length > 1 ? t(app.prefix.substring(1)) : t(app.displayName) || "";
|
|
15
|
-
return /* @__PURE__ */ jsxs(HomeCard, { variant: "secondary", children: [
|
|
16
|
-
/* @__PURE__ */ jsx(HomeCard.Header, { title: t("homepage.favorites.title", "Favoris"), actionLabel: t("homepage.favorites.all", "Mes applis"), onActionClick: onSeeAllClick, actionRightIcon: /* @__PURE__ */ jsx(SvgIconArrowRight, {}) }),
|
|
17
|
-
/* @__PURE__ */ jsx(HomeCard.Content, { children: /* @__PURE__ */ jsx("div", { className: "favorites-content", children: apps.length === 0 ? /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "12", children: [
|
|
18
|
-
/* @__PURE__ */ jsx("img", { src: illuEmptyFavorite, alt: "", width: 80, height: 80 }),
|
|
19
|
-
/* @__PURE__ */ jsx("span", { className: "favorites-empty-text", children: t("homepage.favorites.empty", "Ajouter des applications à vos favoris pour les retrouver ici et y accéder rapidement !") })
|
|
20
|
-
] }) : /* @__PURE__ */ jsx(Flex, { wrap: "wrap", gap: "8 16", children: apps.map((app) => {
|
|
21
|
-
const appName = getAppName(app), opensInNewTab = app.isExternal || app.target === "_blank";
|
|
22
|
-
return /* @__PURE__ */ jsx("a", { href: app.address, "aria-label": appName, title: appName, target: opensInNewTab ? "_blank" : void 0, rel: opensInNewTab ? "noopener noreferrer" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "40", variant: "square" }) }, app.name);
|
|
23
|
-
}) }) }) })
|
|
24
|
-
] });
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
Favorites
|
|
28
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Favorites } from "./Favorites.js";
|
|
3
|
-
import useBookmark from "../../../../hooks/useBookmark/useBookmark.js";
|
|
4
|
-
function FavoritesContainer(props) {
|
|
5
|
-
const apps = useBookmark() ?? [];
|
|
6
|
-
return /* @__PURE__ */ jsx(Favorites, { ...props, apps });
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
FavoritesContainer
|
|
10
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { useId } from "react";
|
|
5
|
-
import { Navbar } from "../../../../components/Layout/components/Navbar.js";
|
|
6
|
-
import { NavItem } from "../../../../components/Layout/components/NavItem.js";
|
|
7
|
-
import { NavLink } from "../../../../components/Layout/components/NavLink.js";
|
|
8
|
-
import useHeader from "../../../../components/Layout/hooks/useHeader.js";
|
|
9
|
-
import SvgIconCommunitiesBeta from "../../../icons/components/nav/IconCommunitiesBeta.js";
|
|
10
|
-
import SvgIconDisconnect from "../../../icons/components/nav/IconDisconnect.js";
|
|
11
|
-
import SvgIconHomeBeta from "../../../icons/components/nav/IconHomeBeta.js";
|
|
12
|
-
import SvgIconMessagesBeta from "../../../icons/components/nav/IconMessagesBeta.js";
|
|
13
|
-
import SvgIconMyAppsBeta from "../../../icons/components/nav/IconMyAppsBeta.js";
|
|
14
|
-
import SvgIconNotificationBeta from "../../../icons/components/nav/IconNotificationBeta.js";
|
|
15
|
-
import useConversation from "../../../../hooks/useConversation/useConversation.js";
|
|
16
|
-
import useUser from "../../../../hooks/useUser/useUser.js";
|
|
17
|
-
import useHasWorkflow from "../../../../hooks/useHasWorkflow/useHasWorkflow.js";
|
|
18
|
-
import { useEdificeTheme } from "../../../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
19
|
-
import useHover from "../../../../hooks/useHover/useHover.js";
|
|
20
|
-
import LogoBeta from "../../../../components/LogoBeta/LogoBeta.js";
|
|
21
|
-
import Badge from "../../../../components/Badge/Badge.js";
|
|
22
|
-
import VisuallyHidden from "../../../../components/VisuallyHidden/VisuallyHidden.js";
|
|
23
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
24
|
-
import Avatar from "../../../../components/Avatar/Avatar.js";
|
|
25
|
-
import { Popover, PopoverBody } from "../../../../components/Popover/Popover.js";
|
|
26
|
-
const Header = ({
|
|
27
|
-
src = "",
|
|
28
|
-
onNotificationsClick
|
|
29
|
-
}) => {
|
|
30
|
-
const {
|
|
31
|
-
t
|
|
32
|
-
} = useTranslation(), {
|
|
33
|
-
messages
|
|
34
|
-
} = useConversation(), {
|
|
35
|
-
user,
|
|
36
|
-
avatar
|
|
37
|
-
} = useUser(), hasCarbonioPreauthWorkflow = useHasWorkflow("org.entcore.auth.controllers.CarbonioPreauthController|preauth") || !1, classes = clsx("header-beta d-print-none no-2d no-1d"), {
|
|
38
|
-
userAvatar,
|
|
39
|
-
userName,
|
|
40
|
-
communityWorkflow,
|
|
41
|
-
conversationWorflow
|
|
42
|
-
} = useHeader({
|
|
43
|
-
user,
|
|
44
|
-
avatar
|
|
45
|
-
}), {
|
|
46
|
-
theme
|
|
47
|
-
} = useEdificeTheme(), hasMessages = messages > 0, [userRef, isUserHovered] = useHover(), popoverUserId = useId(), handleNotificationsClick = () => {
|
|
48
|
-
onNotificationsClick == null || onNotificationsClick();
|
|
49
|
-
};
|
|
50
|
-
return /* @__PURE__ */ jsx("header", { className: classes, children: /* @__PURE__ */ jsxs(Navbar, { className: "px-24", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(LogoBeta, { src: `${src}/img/illustrations/logo.png` }),
|
|
52
|
-
/* @__PURE__ */ jsxs("ul", { className: "navbar-nav", children: [
|
|
53
|
-
/* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/timeline/timeline", translate: t("navbar.home"), "data-testid": "header-home-button", children: /* @__PURE__ */ jsx(SvgIconHomeBeta, {}) }) }),
|
|
54
|
-
communityWorkflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/communities", translate: t("navbar.community"), "data-testid": "header-community-button", children: /* @__PURE__ */ jsx(SvgIconCommunitiesBeta, { className: "icon community" }) }) }),
|
|
55
|
-
conversationWorflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsxs(NavLink, { className: "position-relative", link: "/conversation/conversation", translate: t("conversation"), "data-testid": "header-messagerie-button", children: [
|
|
56
|
-
/* @__PURE__ */ jsx(SvgIconMessagesBeta, {}),
|
|
57
|
-
hasMessages && /* @__PURE__ */ jsx(Badge, { variant: {
|
|
58
|
-
type: "notification",
|
|
59
|
-
level: "danger"
|
|
60
|
-
}, className: "position-absolute", children: messages })
|
|
61
|
-
] }) }),
|
|
62
|
-
hasCarbonioPreauthWorkflow && /* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsxs("a", { className: "nav-link position-relative", href: "/auth/carbonio/preauth", target: "_blank", "data-testid": "header-messagerie-button", children: [
|
|
63
|
-
/* @__PURE__ */ jsx(SvgIconMessagesBeta, {}),
|
|
64
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { children: t("conversation") })
|
|
65
|
-
] }) }),
|
|
66
|
-
/* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(NavLink, { link: "/welcome", translate: t("navbar.applications"), "data-testid": "header-my-apps-button", children: /* @__PURE__ */ jsx(SvgIconMyAppsBeta, {}) }) }),
|
|
67
|
-
/* @__PURE__ */ jsx(NavItem, { children: /* @__PURE__ */ jsx(ButtonBeta, { leftIcon: /* @__PURE__ */ jsx(SvgIconNotificationBeta, {}), variant: "ghost", onClick: handleNotificationsClick }) }),
|
|
68
|
-
/* @__PURE__ */ jsxs(NavItem, { className: "position-relative", ref: userRef, id: popoverUserId, "aria-haspopup": "true", "aria-expanded": isUserHovered, "data-testid": "header-user-menu-button", children: [
|
|
69
|
-
/* @__PURE__ */ jsx(NavLink, { link: "/userbook/mon-compte", translate: t("navbar.myaccount"), "data-testid": "header-user-profile-button", children: /* @__PURE__ */ jsx(Avatar, { alt: userName, size: "sm", src: userAvatar, variant: "circle", className: "bg-white", width: "32", height: "32" }) }),
|
|
70
|
-
/* @__PURE__ */ jsx(Popover, { className: "top-100 widget", id: popoverUserId, isVisible: isUserHovered, children: /* @__PURE__ */ jsx(PopoverBody, { children: /* @__PURE__ */ jsxs("a", { href: "/auth/logout?callback=" + ((theme == null ? void 0 : theme.logoutCallback) ?? ""), className: "nav-link d-flex align-items-center gap-8", "data-testid": "header-logout-button", children: [
|
|
71
|
-
/* @__PURE__ */ jsx(SvgIconDisconnect, { className: "icon logout" }),
|
|
72
|
-
/* @__PURE__ */ jsx("span", { id: "logout-label", className: "nav-text", children: t("navbar.disconnect") })
|
|
73
|
-
] }) }) })
|
|
74
|
-
] })
|
|
75
|
-
] })
|
|
76
|
-
] }) });
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
Header as default
|
|
80
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
-
import { HomeCardHeaderProps } from './HomeCardHeader';
|
|
3
|
-
export type HomeCardVariant = 'user' | 'primary' | 'secondary';
|
|
4
|
-
export interface HomeCardProps extends ComponentPropsWithoutRef<'div'> {
|
|
5
|
-
/**
|
|
6
|
-
* Visual variant of the card.
|
|
7
|
-
* - `user` (default): padding 16, gap 16
|
|
8
|
-
* - `primary`: padding 8/16/16/16, gap 8
|
|
9
|
-
* - `secondary`: padding 8/16/16/16, gap 4, grey background, smaller title, no shadowbox
|
|
10
|
-
*/
|
|
11
|
-
variant?: HomeCardVariant;
|
|
12
|
-
/**
|
|
13
|
-
* Children of the card. When omitted, a default `HomeCardHeader` will be
|
|
14
|
-
* rendered using the `headerProps` prop (handy for the common case where the
|
|
15
|
-
* card only needs a header + content slot).
|
|
16
|
-
*/
|
|
17
|
-
children?: ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* Convenience prop: when provided and `children` is empty, a default
|
|
20
|
-
* `HomeCard.Header` is rendered with these props.
|
|
21
|
-
*/
|
|
22
|
-
headerProps?: HomeCardHeaderProps;
|
|
23
|
-
}
|
|
24
|
-
declare const HomeCard: {
|
|
25
|
-
({ variant, children, headerProps, className, ...rest }: HomeCardProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
displayName: string;
|
|
27
|
-
} & {
|
|
28
|
-
Header: {
|
|
29
|
-
({ title, actionLabel, onActionClick, actionLeftIcon, actionRightIcon, className, ...rest }: HomeCardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
displayName: string;
|
|
31
|
-
};
|
|
32
|
-
Content: {
|
|
33
|
-
({ children, className, ...rest }: import('./HomeCardContent').HomeCardContentProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
displayName: string;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export default HomeCard;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import HomeCardContent from "./HomeCardContent.js";
|
|
4
|
-
import HomeCardHeader from "./HomeCardHeader.js";
|
|
5
|
-
const Root = ({
|
|
6
|
-
variant = "user",
|
|
7
|
-
children,
|
|
8
|
-
headerProps,
|
|
9
|
-
className,
|
|
10
|
-
...rest
|
|
11
|
-
}) => /* @__PURE__ */ jsx("div", { "data-testid": "home-card", "data-variant": variant, className: clsx("home-card", `home-card--${variant}`, className), ...rest, children: headerProps && !children ? /* @__PURE__ */ jsx(HomeCardHeader, { ...headerProps }) : children }), HomeCard = Object.assign(Root, {
|
|
12
|
-
Header: HomeCardHeader,
|
|
13
|
-
Content: HomeCardContent
|
|
14
|
-
});
|
|
15
|
-
export {
|
|
16
|
-
HomeCard as default
|
|
17
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
export type HomeCardContentProps = ComponentPropsWithoutRef<'div'>;
|
|
3
|
-
declare const HomeCardContent: {
|
|
4
|
-
({ children, className, ...rest }: HomeCardContentProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
displayName: string;
|
|
6
|
-
};
|
|
7
|
-
export default HomeCardContent;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
const HomeCardContent = ({
|
|
4
|
-
children,
|
|
5
|
-
className,
|
|
6
|
-
...rest
|
|
7
|
-
}) => /* @__PURE__ */ jsx("div", { className: clsx("home-card-content", className), ...rest, children });
|
|
8
|
-
export {
|
|
9
|
-
HomeCardContent as default
|
|
10
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
-
export interface HomeCardHeaderProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
3
|
-
/** Title displayed on the left side of the header. */
|
|
4
|
-
title: ReactNode;
|
|
5
|
-
/** Label of the action button displayed on the right side of the header. */
|
|
6
|
-
actionLabel?: ReactNode;
|
|
7
|
-
/** Callback invoked when the action button is clicked. */
|
|
8
|
-
onActionClick?: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
-
/** Optional left icon of the action button. */
|
|
10
|
-
actionLeftIcon?: ReactNode;
|
|
11
|
-
/** Optional right icon of the action button. */
|
|
12
|
-
actionRightIcon?: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
declare const HomeCardHeader: {
|
|
15
|
-
({ title, actionLabel, onActionClick, actionLeftIcon, actionRightIcon, className, ...rest }: HomeCardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
export default HomeCardHeader;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
4
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
5
|
-
const HomeCardHeader = ({
|
|
6
|
-
title,
|
|
7
|
-
actionLabel,
|
|
8
|
-
onActionClick,
|
|
9
|
-
actionLeftIcon,
|
|
10
|
-
actionRightIcon,
|
|
11
|
-
className,
|
|
12
|
-
...rest
|
|
13
|
-
}) => {
|
|
14
|
-
const hasAction = !!actionLabel && !!onActionClick;
|
|
15
|
-
return /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "between", gap: "8", className: clsx("home-card-header", className), ...rest, children: [
|
|
16
|
-
/* @__PURE__ */ jsx("h3", { className: "home-card-header-title", children: title }),
|
|
17
|
-
hasAction && /* @__PURE__ */ jsx(ButtonBeta, { color: "default", variant: "ghost", onClick: onActionClick, leftIcon: actionLeftIcon, rightIcon: actionRightIcon, "data-testid": "home-card-header-action", children: actionLabel })
|
|
18
|
-
] });
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
HomeCardHeader as default
|
|
22
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export interface LastInfosProps {
|
|
2
|
-
/**
|
|
3
|
-
* ID of the info.
|
|
4
|
-
*/
|
|
5
|
-
id: number | string;
|
|
6
|
-
/**
|
|
7
|
-
* URL of the icon to display in the upper left corner.
|
|
8
|
-
* i.e. "/workspace/document/36a04526-15a2-4e8f-adb6-cca75630e50d"
|
|
9
|
-
*/
|
|
10
|
-
icon: string;
|
|
11
|
-
/**
|
|
12
|
-
* ID of the thread to be displayed next to the icon.
|
|
13
|
-
*/
|
|
14
|
-
threadId: number | string;
|
|
15
|
-
/**
|
|
16
|
-
* Name of the thread to be displayed next to the icon.
|
|
17
|
-
* i.e. "Informations importantes"
|
|
18
|
-
*/
|
|
19
|
-
threadName: string;
|
|
20
|
-
/**
|
|
21
|
-
* Title of the info.
|
|
22
|
-
*/
|
|
23
|
-
title: string;
|
|
24
|
-
/**
|
|
25
|
-
* Content of the info.
|
|
26
|
-
*/
|
|
27
|
-
content: string;
|
|
28
|
-
/**
|
|
29
|
-
* Publication date in ISO format.
|
|
30
|
-
*/
|
|
31
|
-
publicationDate: string;
|
|
32
|
-
/**
|
|
33
|
-
* Whether the info is highlighted.
|
|
34
|
-
*/
|
|
35
|
-
isHeadline: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Name of the user who posted this info.
|
|
38
|
-
*/
|
|
39
|
-
username: string;
|
|
40
|
-
/**
|
|
41
|
-
* Handle the click event.
|
|
42
|
-
*/
|
|
43
|
-
onClick?: (threadId: number | string, id: number | string) => void;
|
|
44
|
-
}
|
|
45
|
-
declare const LastInfos: {
|
|
46
|
-
({ id, icon, threadId, threadName, content, isHeadline, title, onClick, }: LastInfosProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
displayName: string;
|
|
48
|
-
};
|
|
49
|
-
export default LastInfos;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
import SvgIconActualites from "../../../icons/components/apps/IconActualites.js";
|
|
5
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
6
|
-
const LastInfos = ({
|
|
7
|
-
id,
|
|
8
|
-
icon,
|
|
9
|
-
threadId,
|
|
10
|
-
threadName,
|
|
11
|
-
content,
|
|
12
|
-
isHeadline,
|
|
13
|
-
title,
|
|
14
|
-
onClick
|
|
15
|
-
}) => {
|
|
16
|
-
const {
|
|
17
|
-
excerpt,
|
|
18
|
-
images
|
|
19
|
-
} = useMemo(() => {
|
|
20
|
-
if (!content)
|
|
21
|
-
return {
|
|
22
|
-
excerpt: "",
|
|
23
|
-
images: []
|
|
24
|
-
};
|
|
25
|
-
const doc = new DOMParser().parseFromString(content, "text/html"), imageSources = Array.from(doc.querySelectorAll("img")).map((image) => image.getAttribute("src") ?? "").filter((src) => src.trim().length > 0);
|
|
26
|
-
return Array.from(doc.querySelectorAll("img, video, iframe, audio, embed")).forEach((mediaElement) => {
|
|
27
|
-
var _a;
|
|
28
|
-
(_a = mediaElement.parentNode) == null || _a.removeChild(mediaElement);
|
|
29
|
-
}), {
|
|
30
|
-
excerpt: (doc.body.textContent ?? "").trim(),
|
|
31
|
-
images: imageSources
|
|
32
|
-
};
|
|
33
|
-
}, [content]), previewImages = images.slice(0, 3), hasMoreImages = images.length > previewImages.length, remainingImagesCount = Math.max(images.length - previewImages.length, 0), actionLabel = `${threadName} - ${title}`;
|
|
34
|
-
return /* @__PURE__ */ jsxs("article", { className: clsx("last-infos-card", {
|
|
35
|
-
"last-infos-card-headline": isHeadline,
|
|
36
|
-
"last-infos-card-clickable": !!onClick
|
|
37
|
-
}), children: [
|
|
38
|
-
onClick && /* @__PURE__ */ jsx("button", { type: "button", className: "last-infos-card-action", onClick: () => onClick(threadId, id), "aria-label": actionLabel }),
|
|
39
|
-
/* @__PURE__ */ jsx("header", { className: "last-infos-card-header", children: /* @__PURE__ */ jsxs(Flex, { gap: "8", align: "center", justify: "start", className: "last-infos-card-thread", children: [
|
|
40
|
-
icon ? /* @__PURE__ */ jsx("img", { src: icon, alt: threadName, width: 24, height: 24, loading: "lazy", className: "last-infos-card-thread-icon" }) : /* @__PURE__ */ jsx(SvgIconActualites, { width: 24, height: 24, className: "last-infos-card-thread-icon" }),
|
|
41
|
-
/* @__PURE__ */ jsx("span", { className: "last-infos-card-thread-name", children: threadName })
|
|
42
|
-
] }) }),
|
|
43
|
-
/* @__PURE__ */ jsxs(Flex, { gap: "4", direction: "column", className: "last-infos-card-content", children: [
|
|
44
|
-
/* @__PURE__ */ jsx("div", { className: "last-infos-card-title", children: title }),
|
|
45
|
-
/* @__PURE__ */ jsx("p", { className: "last-infos-card-excerpt", children: excerpt }),
|
|
46
|
-
previewImages.length > 0 && /* @__PURE__ */ jsx("div", { className: "last-infos-card-medias", children: previewImages.map((image, index) => /* @__PURE__ */ jsxs("div", { className: "last-infos-card-media", children: [
|
|
47
|
-
/* @__PURE__ */ jsx("img", { src: image, alt: "", className: "last-infos-card-media-image", loading: "lazy" }),
|
|
48
|
-
hasMoreImages && index === 2 && /* @__PURE__ */ jsxs("div", { className: "last-infos-card-media-overlay", children: [
|
|
49
|
-
"+",
|
|
50
|
-
remainingImagesCount
|
|
51
|
-
] })
|
|
52
|
-
] }, `${image}-${index}`)) })
|
|
53
|
-
] })
|
|
54
|
-
] });
|
|
55
|
-
};
|
|
56
|
-
export {
|
|
57
|
-
LastInfos as default
|
|
58
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { LastInfosList } from "./LastInfosList.js";
|
|
3
|
-
import { useLastInfos } from "./useLastInfos.js";
|
|
4
|
-
import TextSkeleton from "../../../../components/Skeleton/TextSkeleton.js";
|
|
5
|
-
function LastInfosContainer() {
|
|
6
|
-
const {
|
|
7
|
-
infos,
|
|
8
|
-
isLoading,
|
|
9
|
-
error
|
|
10
|
-
} = useLastInfos();
|
|
11
|
-
return isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12
|
-
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg" }),
|
|
13
|
-
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg" }),
|
|
14
|
-
/* @__PURE__ */ jsx(TextSkeleton, { size: "lg" })
|
|
15
|
-
] }) : error ? error.message : /* @__PURE__ */ jsx(LastInfosList, { infos: (infos == null ? void 0 : infos.map(({
|
|
16
|
-
id,
|
|
17
|
-
content,
|
|
18
|
-
title,
|
|
19
|
-
username,
|
|
20
|
-
thread,
|
|
21
|
-
modifiedDate,
|
|
22
|
-
headline: isHeadline
|
|
23
|
-
}) => ({
|
|
24
|
-
id,
|
|
25
|
-
content,
|
|
26
|
-
title,
|
|
27
|
-
username,
|
|
28
|
-
icon: thread.icon,
|
|
29
|
-
threadId: thread.id,
|
|
30
|
-
threadName: thread.title,
|
|
31
|
-
publicationDate: modifiedDate,
|
|
32
|
-
isHeadline
|
|
33
|
-
}))) ?? [] });
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
LastInfosContainer
|
|
37
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { LastInfosProps } from './LastInfos';
|
|
2
|
-
export interface LastInfosListProps {
|
|
3
|
-
/** List of Info to display. */
|
|
4
|
-
infos: Array<LastInfosProps>;
|
|
5
|
-
/** Handle a click on an info. If undefined, Actualites will be opened to read the info details. */
|
|
6
|
-
onInfoClick?: (threadId: number | string, id: number | string) => void;
|
|
7
|
-
/** Handle a click on the "See more" button. If undefined, Actualites will be opened. */
|
|
8
|
-
onSeeMoreClick?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare function LastInfosList({ infos, onInfoClick: handleInfoClick, onSeeMoreClick: handleSeeMoreClick, }: LastInfosListProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare namespace LastInfosList {
|
|
12
|
-
var displayName: string;
|
|
13
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import SvgIconArrowRight from "../../../icons/components/IconArrowRight.js";
|
|
4
|
-
import LastInfos from "./LastInfos.js";
|
|
5
|
-
import illuLastInfosEmptyScreen from "@edifice.io/bootstrap/dist/images/homepage/illu-last-infos-beta.svg";
|
|
6
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
7
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
8
|
-
import EmptyScreen from "../../../../components/EmptyScreen/EmptyScreen.js";
|
|
9
|
-
function LastInfosList({
|
|
10
|
-
infos,
|
|
11
|
-
onInfoClick: handleInfoClick = (threadId, id) => {
|
|
12
|
-
window.open(`/actualites/threads/${threadId}?info=${id}`, "_self");
|
|
13
|
-
},
|
|
14
|
-
onSeeMoreClick: handleSeeMoreClick = () => {
|
|
15
|
-
window.open("/actualites", "_self");
|
|
16
|
-
}
|
|
17
|
-
}) {
|
|
18
|
-
const {
|
|
19
|
-
t
|
|
20
|
-
} = useTranslation();
|
|
21
|
-
return /* @__PURE__ */ jsxs(Flex, { gap: "8", direction: "column", className: "last-infos-list", children: [
|
|
22
|
-
/* @__PURE__ */ jsxs(Flex, { justify: "between", align: "center", className: "last-infos-list-header", children: [
|
|
23
|
-
/* @__PURE__ */ jsx("h2", { className: "last-infos-list-title", children: t("homepage.last-infos-list.title") }),
|
|
24
|
-
/* @__PURE__ */ jsx(ButtonBeta, { color: "tertiary", variant: "ghost", className: "last-infos-list-seemore", rightIcon: /* @__PURE__ */ jsx(SvgIconArrowRight, {}), onClick: handleSeeMoreClick, children: t("homepage.last-infos-list.see.more") })
|
|
25
|
-
] }),
|
|
26
|
-
/* @__PURE__ */ jsx(Flex, { gap: "16", direction: "column", className: "last-infos-list-body", children: infos.length === 0 ? /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuLastInfosEmptyScreen, size: 64, text: t("homepage.last-infos-list.empty") }) : infos.map((infosProps) => /* @__PURE__ */ jsx(LastInfos, { onClick: handleInfoClick, ...infosProps }, infosProps.id)) })
|
|
27
|
-
] });
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
LastInfosList
|
|
31
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface LastInfosModel {
|
|
2
|
-
modifiedDate: string;
|
|
3
|
-
headline: boolean;
|
|
4
|
-
thread: {
|
|
5
|
-
id: number;
|
|
6
|
-
icon: string;
|
|
7
|
-
title: string;
|
|
8
|
-
};
|
|
9
|
-
title: string;
|
|
10
|
-
content: string;
|
|
11
|
-
username: string;
|
|
12
|
-
id: number;
|
|
13
|
-
}
|
|
14
|
-
export declare function useLastInfos(): {
|
|
15
|
-
infos: LastInfosModel[] | undefined;
|
|
16
|
-
isLoading: boolean;
|
|
17
|
-
error: Error | null;
|
|
18
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { odeServices } from "@edifice.io/client";
|
|
2
|
-
import { useQuery, queryOptions } from "@tanstack/react-query";
|
|
3
|
-
function useLastInfos() {
|
|
4
|
-
const {
|
|
5
|
-
data,
|
|
6
|
-
isLoading,
|
|
7
|
-
error
|
|
8
|
-
} = useQuery(queryOptions({
|
|
9
|
-
queryKey: ["infos", "preview", "last", 6],
|
|
10
|
-
queryFn: async () => {
|
|
11
|
-
const http = odeServices.http(), infos = await http.get("/actualites/api/v1/infos/preview/last/6");
|
|
12
|
-
if (http.isResponseError())
|
|
13
|
-
throw new Error(http.latestResponse.statusText);
|
|
14
|
-
return infos;
|
|
15
|
-
}
|
|
16
|
-
}));
|
|
17
|
-
return {
|
|
18
|
-
infos: data,
|
|
19
|
-
isLoading,
|
|
20
|
-
error
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
useLastInfos
|
|
25
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IFlashMessageModel } from '@edifice.io/client';
|
|
2
|
-
export type MessageFlashProps = {
|
|
3
|
-
/** Message to display */
|
|
4
|
-
message: IFlashMessageModel;
|
|
5
|
-
/** Callback when the message is closed */
|
|
6
|
-
onCloseMessage?: (message: IFlashMessageModel) => void;
|
|
7
|
-
};
|
|
8
|
-
declare const MessageFlash: {
|
|
9
|
-
({ message, onCloseMessage }: MessageFlashProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
displayName: string;
|
|
11
|
-
};
|
|
12
|
-
export default MessageFlash;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { useState, useRef, useEffect } from "react";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import SvgIconAlertTriangle from "../../../icons/components/IconAlertTriangle.js";
|
|
6
|
-
import SvgIconClose from "../../../icons/components/IconClose.js";
|
|
7
|
-
import SvgIconInfoCircle from "../../../icons/components/IconInfoCircle.js";
|
|
8
|
-
import { useEdificeClient } from "../../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
9
|
-
import useBreakpoint from "../../../../hooks/useBreakpoint/useBreakpoint.js";
|
|
10
|
-
import IconButton from "../../../../components/Button/IconButton.js";
|
|
11
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
12
|
-
import Card from "../../../../components/Card/Card.js";
|
|
13
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
14
|
-
const MessageFlash = ({
|
|
15
|
-
message,
|
|
16
|
-
onCloseMessage
|
|
17
|
-
}) => {
|
|
18
|
-
const {
|
|
19
|
-
currentLanguage
|
|
20
|
-
} = useEdificeClient(), [isCollapsed, setIsCollapsed] = useState(!0), [hasOverflow, setHasOverflow] = useState(!1), contentRef = useRef(null), checkContentTimeoutRef = useRef(void 0), {
|
|
21
|
-
t
|
|
22
|
-
} = useTranslation(), {
|
|
23
|
-
md
|
|
24
|
-
} = useBreakpoint();
|
|
25
|
-
let content = "";
|
|
26
|
-
message.contents && (currentLanguage && message.contents[currentLanguage] ? content = message.contents[currentLanguage] : message.contents.fr ? content = message.contents.fr : content = Object.keys(message.contents).map((key) => message.contents[key]).filter((cont) => cont !== null)[0]), useEffect(() => {
|
|
27
|
-
const checkOverflow = () => {
|
|
28
|
-
if (contentRef.current) {
|
|
29
|
-
const element = contentRef.current, originalClass = element.className;
|
|
30
|
-
element.className = element.className.replace(/text-truncate(-\d+)?/g, "").trim();
|
|
31
|
-
const computedStyle = window.getComputedStyle(element), lineHeight = parseFloat(computedStyle.lineHeight) || parseFloat(computedStyle.fontSize) * 1.2, contentHeight = element.scrollHeight, twoLinesHeight = lineHeight * 2;
|
|
32
|
-
setHasOverflow(contentHeight > twoLinesHeight + 2), element.className = originalClass;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
content && (checkContentTimeoutRef.current && clearTimeout(checkContentTimeoutRef.current), checkContentTimeoutRef.current = setTimeout(checkOverflow, 0));
|
|
36
|
-
}, [content]), useEffect(() => () => {
|
|
37
|
-
checkContentTimeoutRef.current && clearTimeout(checkContentTimeoutRef.current);
|
|
38
|
-
});
|
|
39
|
-
const classes = clsx("message-flash", message.color ? `message-flash-${message.color}` : null), classesContent = clsx("message-flash-content", isCollapsed ? "text-truncate text-truncate-2" : null), handleCollapse = () => {
|
|
40
|
-
setIsCollapsed((collapsed) => !collapsed);
|
|
41
|
-
};
|
|
42
|
-
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
43
|
-
(hasOverflow && !isCollapsed || !hasOverflow) && /* @__PURE__ */ jsx(IconButton, { variant: "ghost", color: "tertiary", icon: /* @__PURE__ */ jsx(SvgIconClose, {}), onClick: () => {
|
|
44
|
-
onCloseMessage == null || onCloseMessage(message);
|
|
45
|
-
}, className: "message-flash-close-button", "data-testid": "message-flash-close-button", "aria-label": t("close.message", {
|
|
46
|
-
title: message.title
|
|
47
|
-
}), title: t("close.message", {
|
|
48
|
-
title: message.title
|
|
49
|
-
}) }),
|
|
50
|
-
/* @__PURE__ */ jsx("div", { className: "message-flash-icon", role: "img", "aria-label": message.color === "red" ? t("warning") : t("information"), children: message.color && message.color === "red" ? /* @__PURE__ */ jsx(SvgIconAlertTriangle, {}) : /* @__PURE__ */ jsx(SvgIconInfoCircle, {}) }),
|
|
51
|
-
/* @__PURE__ */ jsxs(Flex, { direction: "column", className: "w-100 message-flash-body", children: [
|
|
52
|
-
/* @__PURE__ */ jsx(Card.Title, { children: message.title }),
|
|
53
|
-
/* @__PURE__ */ jsx("div", { ref: contentRef, className: classesContent, dangerouslySetInnerHTML: {
|
|
54
|
-
__html: content
|
|
55
|
-
} }),
|
|
56
|
-
/* @__PURE__ */ jsxs(Flex, { direction: md ? "row" : "column", justify: "between", className: "message-flash-footer", children: [
|
|
57
|
-
/* @__PURE__ */ jsx("div", { className: "fst-italic", children: message.signature || "" }),
|
|
58
|
-
hasOverflow && /* @__PURE__ */ jsx(ButtonBeta, { "data-testid": isCollapsed ? "message-flash-view-more-button" : "message-flash-view-less-button", color: "default", variant: "ghost", onClick: handleCollapse, "aria-controls": `message-flash-${message.id}-content`, "aria-expanded": !isCollapsed, className: "message-flash-collapse-button", children: t(isCollapsed ? "read.more" : "read.less") })
|
|
59
|
-
] })
|
|
60
|
-
] })
|
|
61
|
-
] });
|
|
62
|
-
};
|
|
63
|
-
export {
|
|
64
|
-
MessageFlash as default
|
|
65
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IFlashMessageModel } from '@edifice.io/client';
|
|
2
|
-
export type MessageFlashListProps = {
|
|
3
|
-
/** List of messages to display */
|
|
4
|
-
messages: IFlashMessageModel[];
|
|
5
|
-
/** Callback when the message is closed */
|
|
6
|
-
onCloseMessage?: (message: IFlashMessageModel) => void;
|
|
7
|
-
};
|
|
8
|
-
declare const MessageFlashList: {
|
|
9
|
-
({ messages, onCloseMessage, }: MessageFlashListProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
displayName: string;
|
|
11
|
-
};
|
|
12
|
-
export default MessageFlashList;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import MessageFlash from "./MessageFlash.js";
|
|
3
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
4
|
-
const MessageFlashList = ({
|
|
5
|
-
messages,
|
|
6
|
-
onCloseMessage
|
|
7
|
-
}) => /* @__PURE__ */ jsx("section", { role: "region", className: "message-flash-list", children: /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "16", role: "list", children: messages.map((message) => /* @__PURE__ */ jsx("div", { role: "listitem", children: /* @__PURE__ */ jsx(MessageFlash, { message, onCloseMessage: (msg) => onCloseMessage == null ? void 0 : onCloseMessage(msg) }) }, message.id)) }) });
|
|
8
|
-
export {
|
|
9
|
-
MessageFlashList as default
|
|
10
|
-
};
|