@edifice.io/react 2.6.5-develop-b2school.20260914145143 → 2.6.5-develop.20260915170334
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/Form/FormText.js +6 -11
- package/dist/components/Input/Input.d.ts +2 -11
- package/dist/components/Input/Input.js +21 -38
- package/dist/components/Label/Label.js +4 -4
- 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/index.d.ts +0 -2
- package/dist/homepage.js +1 -12
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
- package/dist/hooks/useClickOutside/useClickOutside.js +2 -3
- package/dist/hooks/useUploadFiles/index.d.ts +1 -0
- package/dist/hooks/useUploadFiles/useUploadFiles.d.ts +11 -1
- package/dist/hooks/useUploadFiles/useUploadFiles.js +12 -7
- package/dist/index.js +160 -166
- package/dist/modules/homepage/components/Header/Header.js +4 -11
- package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +8 -18
- package/dist/modules/homepage/components/index.d.ts +0 -1
- package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +34 -7
- package/dist/modules/multimedia/UploadFiles/UploadFiles.d.ts +2 -1
- package/package.json +6 -6
- package/dist/components/LinkPill/LinkPill.d.ts +0 -45
- package/dist/components/LinkPill/LinkPill.js +0 -27
- package/dist/components/LinkPill/index.d.ts +0 -2
- package/dist/components/ModalBeta/ModalBeta.d.ts +0 -47
- package/dist/components/ModalBeta/ModalBeta.js +0 -62
- package/dist/components/ModalBeta/ModalBetaBody.d.ts +0 -19
- package/dist/components/ModalBeta/ModalBetaBody.js +0 -15
- package/dist/components/ModalBeta/ModalBetaContext.d.ts +0 -7
- package/dist/components/ModalBeta/ModalBetaContext.js +0 -15
- package/dist/components/ModalBeta/ModalBetaFooter.d.ts +0 -13
- package/dist/components/ModalBeta/ModalBetaFooter.js +0 -7
- package/dist/components/ModalBeta/ModalBetaHeader.d.ts +0 -23
- package/dist/components/ModalBeta/ModalBetaHeader.js +0 -31
- package/dist/components/ModalBeta/index.d.ts +0 -2
- package/dist/hooks/useUserPreferences/index.d.ts +0 -1
- package/dist/hooks/useUserPreferences/useUserPreferences.d.ts +0 -9
- package/dist/hooks/useUserPreferences/useUserPreferences.js +0 -39
- package/dist/modules/homepage/components/UsefulLinks/LinkForm.d.ts +0 -13
- package/dist/modules/homepage/components/UsefulLinks/LinkForm.js +0 -67
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.d.ts +0 -6
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +0 -29
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.d.ts +0 -1
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.js +0 -40
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.d.ts +0 -11
- package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +0 -65
- package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.d.ts +0 -19
- package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.js +0 -26
- package/dist/modules/homepage/components/UsefulLinks/index.d.ts +0 -5
- package/dist/modules/homepage/components/UsefulLinks/services/api/index.d.ts +0 -6
- package/dist/modules/homepage/components/UsefulLinks/services/api/index.js +0 -5
- package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.d.ts +0 -31
- package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.js +0 -50
- package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.d.ts +0 -20
- package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.js +0 -65
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export type LinkPillIllustrationType = 'icon' | 'img';
|
|
3
|
-
export type LinkPillIllustrationPosition = 'left' | 'right';
|
|
4
|
-
export interface LinkPillProps {
|
|
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
|
-
* Optional class for styling purpose
|
|
34
|
-
*/
|
|
35
|
-
className?: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* LinkPill – design system component used to display a link to an
|
|
39
|
-
* external resource as a small rounded pill.
|
|
40
|
-
*/
|
|
41
|
-
declare const LinkPill: {
|
|
42
|
-
({ href, label, subtitle, illustration, illustrationType, illustrationPosition, className, }: LinkPillProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
-
displayName: string;
|
|
44
|
-
};
|
|
45
|
-
export default LinkPill;
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}) => {
|
|
13
|
-
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: [
|
|
14
|
-
/* @__PURE__ */ jsx("span", { className: "link-pill-label", title: label, children: label }),
|
|
15
|
-
subtitle && /* @__PURE__ */ jsx("span", { className: "link-pill-subtitle", title: subtitle, children: subtitle })
|
|
16
|
-
] });
|
|
17
|
-
return /* @__PURE__ */ jsx("a", { href, target: "_blank", rel: "noopener noreferrer", "data-testid": "link-pill", className: clsx("link-pill", `link-pill--illustration-${illustrationPosition}`, className), children: illustrationPosition === "left" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
-
illustrationNode,
|
|
19
|
-
contentNode
|
|
20
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
-
contentNode,
|
|
22
|
-
illustrationNode
|
|
23
|
-
] }) });
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
LinkPill as default
|
|
27
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
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;
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
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;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
|
-
import { useModalBetaContext } from "./ModalBetaContext.js";
|
|
4
|
-
const ModalBetaBody = ({
|
|
5
|
-
children,
|
|
6
|
-
className
|
|
7
|
-
}) => {
|
|
8
|
-
const {
|
|
9
|
-
ariaDescriptionId
|
|
10
|
-
} = useModalBetaContext();
|
|
11
|
-
return /* @__PURE__ */ jsx("div", { id: ariaDescriptionId, className: clsx("modal-beta-body", className), children });
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
ModalBetaBody as default
|
|
15
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export interface ModalBetaContextProps {
|
|
2
|
-
ariaLabelId: string;
|
|
3
|
-
ariaDescriptionId: string;
|
|
4
|
-
focusId: string | undefined;
|
|
5
|
-
}
|
|
6
|
-
export declare const ModalBetaContext: import('react').Context<ModalBetaContextProps>;
|
|
7
|
-
export declare const useModalBetaContext: () => ModalBetaContextProps;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from "react";
|
|
2
|
-
const ModalBetaContext = /* @__PURE__ */ createContext({
|
|
3
|
-
ariaLabelId: "",
|
|
4
|
-
ariaDescriptionId: "",
|
|
5
|
-
focusId: ""
|
|
6
|
-
}), useModalBetaContext = () => {
|
|
7
|
-
const context = useContext(ModalBetaContext);
|
|
8
|
-
if (!context)
|
|
9
|
-
throw new Error("Cannot be rendered outside the ModalBeta component");
|
|
10
|
-
return context;
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
ModalBetaContext,
|
|
14
|
-
useModalBetaContext
|
|
15
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface ModalBetaFooterProps {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* ModalBeta Footer — right-aligns its children, typically two ButtonBeta
|
|
7
|
-
* (a ghost/tertiary action followed by the primary filled action).
|
|
8
|
-
*/
|
|
9
|
-
declare const ModalBetaFooter: {
|
|
10
|
-
({ children }: ModalBetaFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
displayName: string;
|
|
12
|
-
};
|
|
13
|
-
export default ModalBetaFooter;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface ModalBetaHeaderProps {
|
|
3
|
-
/**
|
|
4
|
-
* Method called on modal close
|
|
5
|
-
*/
|
|
6
|
-
onModalClose: () => void;
|
|
7
|
-
/**
|
|
8
|
-
* Modal title
|
|
9
|
-
*/
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* Optional text displayed below the title
|
|
13
|
-
*/
|
|
14
|
-
subtitle?: ReactNode;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* ModalBeta Header
|
|
18
|
-
*/
|
|
19
|
-
declare const ModalBetaHeader: {
|
|
20
|
-
({ onModalClose, children, subtitle, }: ModalBetaHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
displayName: string;
|
|
22
|
-
};
|
|
23
|
-
export default ModalBetaHeader;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef, useEffect } from "react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import SvgIconClose from "../../modules/icons/components/IconClose.js";
|
|
5
|
-
import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
|
|
6
|
-
import { useModalBetaContext } from "./ModalBetaContext.js";
|
|
7
|
-
const ModalBetaHeader = ({
|
|
8
|
-
onModalClose,
|
|
9
|
-
children,
|
|
10
|
-
subtitle
|
|
11
|
-
}) => {
|
|
12
|
-
const {
|
|
13
|
-
ariaLabelId,
|
|
14
|
-
focusId
|
|
15
|
-
} = useModalBetaContext(), closeButtonRef = useRef(null), {
|
|
16
|
-
t
|
|
17
|
-
} = useTranslation();
|
|
18
|
-
return useEffect(() => {
|
|
19
|
-
var _a;
|
|
20
|
-
focusId || (_a = closeButtonRef.current) == null || _a.focus();
|
|
21
|
-
}, [focusId]), /* @__PURE__ */ jsxs("div", { className: "modal-beta-header", children: [
|
|
22
|
-
/* @__PURE__ */ jsxs("div", { className: "modal-beta-title-row", children: [
|
|
23
|
-
/* @__PURE__ */ jsx("h2", { id: ariaLabelId, className: "modal-beta-title", tabIndex: -1, children }),
|
|
24
|
-
/* @__PURE__ */ jsx(ButtonBeta, { ref: closeButtonRef, "aria-label": t("close"), title: t("close"), type: "button", variant: "ghost", color: "tertiary", leftIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), onClick: onModalClose })
|
|
25
|
-
] }),
|
|
26
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "modal-beta-subtitle", children: subtitle })
|
|
27
|
-
] });
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
ModalBetaHeader as default
|
|
31
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default, useUserPreferences } from './useUserPreferences';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const USER_PREFERENCES_QUERY_KEY: string[];
|
|
2
|
-
export declare function useUserPreferences<T extends Record<string, any> = Record<string, any>>(): {
|
|
3
|
-
preferences: T | undefined;
|
|
4
|
-
isLoading: boolean;
|
|
5
|
-
isError: boolean;
|
|
6
|
-
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<T, Error>>;
|
|
7
|
-
savePreferences: (preferences: T) => Promise<T>;
|
|
8
|
-
};
|
|
9
|
-
export default useUserPreferences;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { odeServices } from "@edifice.io/client";
|
|
2
|
-
import { useQueryClient, useQuery, queryOptions, useMutation } from "@tanstack/react-query";
|
|
3
|
-
const USER_PREFERENCES_QUERY_KEY = ["user", "preferences"];
|
|
4
|
-
function useUserPreferences() {
|
|
5
|
-
const queryClient = useQueryClient(), {
|
|
6
|
-
data: preferences,
|
|
7
|
-
isLoading,
|
|
8
|
-
isError,
|
|
9
|
-
refetch
|
|
10
|
-
} = useQuery(queryOptions({
|
|
11
|
-
queryKey: USER_PREFERENCES_QUERY_KEY,
|
|
12
|
-
queryFn: () => odeServices.conf().getUserPreferences(),
|
|
13
|
-
staleTime: 15e3
|
|
14
|
-
})), mutation = useMutation({
|
|
15
|
-
mutationFn: (preferences2) => odeServices.conf().saveUserPreferences(preferences2),
|
|
16
|
-
onMutate: async (preferences2) => {
|
|
17
|
-
queryClient.setQueryData(USER_PREFERENCES_QUERY_KEY, preferences2);
|
|
18
|
-
},
|
|
19
|
-
onError: () => {
|
|
20
|
-
queryClient.invalidateQueries({
|
|
21
|
-
queryKey: USER_PREFERENCES_QUERY_KEY
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
onSuccess: (preferences2) => {
|
|
25
|
-
queryClient.setQueryData(USER_PREFERENCES_QUERY_KEY, preferences2);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return {
|
|
29
|
-
preferences,
|
|
30
|
-
isLoading,
|
|
31
|
-
isError,
|
|
32
|
-
refetch,
|
|
33
|
-
savePreferences: (preferences2) => mutation.mutateAsync(preferences2)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export {
|
|
37
|
-
USER_PREFERENCES_QUERY_KEY,
|
|
38
|
-
useUserPreferences
|
|
39
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { UsefulLink, UsefulLinkPayload } from '@edifice.io/client';
|
|
2
|
-
export interface LinkFormProps {
|
|
3
|
-
mode: 'add' | 'edit';
|
|
4
|
-
/** Link being edited. Ignored (and required to be undefined) in "add" mode. */
|
|
5
|
-
link?: UsefulLink;
|
|
6
|
-
isSubmitting: boolean;
|
|
7
|
-
/** Closes the form and goes back to the management modal, without saving. */
|
|
8
|
-
onCancel: () => void;
|
|
9
|
-
/** Closes the whole modal stack. */
|
|
10
|
-
onClose: () => void;
|
|
11
|
-
onSubmit: (payload: UsefulLinkPayload) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function LinkForm({ mode, link, isSubmitting, onCancel, onClose, onSubmit, }: LinkFormProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useForm } from "react-hook-form";
|
|
4
|
-
import ModalBeta from "../../../../components/ModalBeta/ModalBeta.js";
|
|
5
|
-
import FormControl from "../../../../components/Form/FormControl.js";
|
|
6
|
-
import Label from "../../../../components/Label/Label.js";
|
|
7
|
-
import Input from "../../../../components/Input/Input.js";
|
|
8
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
9
|
-
const NAME_MAX_LENGTH = 80, URL_PLACEHOLDER = "https://example.fr", URL_PATTERN = /^https?:\/\/.+/i;
|
|
10
|
-
function LinkForm({
|
|
11
|
-
mode,
|
|
12
|
-
link,
|
|
13
|
-
isSubmitting,
|
|
14
|
-
onCancel,
|
|
15
|
-
onClose,
|
|
16
|
-
onSubmit
|
|
17
|
-
}) {
|
|
18
|
-
const {
|
|
19
|
-
t
|
|
20
|
-
} = useTranslation(), formId = "useful-link-form", {
|
|
21
|
-
register,
|
|
22
|
-
handleSubmit,
|
|
23
|
-
formState: {
|
|
24
|
-
errors,
|
|
25
|
-
isDirty,
|
|
26
|
-
isValid
|
|
27
|
-
}
|
|
28
|
-
} = useForm({
|
|
29
|
-
mode: "onChange",
|
|
30
|
-
defaultValues: {
|
|
31
|
-
name: (link == null ? void 0 : link.name) ?? "",
|
|
32
|
-
url: (link == null ? void 0 : link.url) ?? ""
|
|
33
|
-
}
|
|
34
|
-
}), title = mode === "add" ? t("homepage.usefulLinks.form.addTitle", "Ajouter un lien") : t("homepage.usefulLinks.form.editTitle", "Modifier un lien"), handleFormSubmit = (data) => {
|
|
35
|
-
onSubmit({
|
|
36
|
-
name: data.name.trim(),
|
|
37
|
-
url: data.url.trim()
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
return /* @__PURE__ */ jsxs(ModalBeta, { id: "useful-link-modal", isOpen: !0, size: "l", onModalClose: onClose, children: [
|
|
41
|
-
/* @__PURE__ */ jsx(ModalBeta.Header, { onModalClose: onClose, children: title }),
|
|
42
|
-
/* @__PURE__ */ jsx(ModalBeta.Body, { children: /* @__PURE__ */ jsxs("form", { id: formId, onSubmit: handleSubmit(handleFormSubmit), children: [
|
|
43
|
-
/* @__PURE__ */ jsxs(FormControl, { id: "useful-link-name", className: "mb-16", isRequired: !0, children: [
|
|
44
|
-
/* @__PURE__ */ jsx(Label, { children: t("homepage.usefulLinks.form.name", "Nom") }),
|
|
45
|
-
/* @__PURE__ */ jsx(Input, { type: "text", size: "md", maxLength: NAME_MAX_LENGTH, showCounter: !0, clearable: !0, "data-testid": "usefullinks-input-name", placeholder: t("homepage.usefulLinks.form.name.placeholder", "Nom du lien utile"), ...register("name", {
|
|
46
|
-
required: !0,
|
|
47
|
-
maxLength: NAME_MAX_LENGTH
|
|
48
|
-
}) })
|
|
49
|
-
] }),
|
|
50
|
-
/* @__PURE__ */ jsxs(FormControl, { id: "useful-link-url", isRequired: !0, status: errors.url ? "invalid" : void 0, children: [
|
|
51
|
-
/* @__PURE__ */ jsx(Label, { children: t("homepage.usefulLinks.form.url", "Lien") }),
|
|
52
|
-
/* @__PURE__ */ jsx(Input, { type: "text", size: "md", "data-testid": "usefullinks-input-url", placeholder: t("homepage.usefulLinks.form.url.placeholder", URL_PLACEHOLDER), ...register("url", {
|
|
53
|
-
required: !0,
|
|
54
|
-
pattern: URL_PATTERN
|
|
55
|
-
}) }),
|
|
56
|
-
errors.url && /* @__PURE__ */ jsx(FormControl.Text, { children: t("homepage.usefulLinks.form.url.error", "L'adresse doit être une URL valide (ex. https://exemple.fr)") })
|
|
57
|
-
] })
|
|
58
|
-
] }) }),
|
|
59
|
-
/* @__PURE__ */ jsxs(ModalBeta.Footer, { children: [
|
|
60
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", "data-testid": "usefullinks-button-cancel", onClick: onCancel, children: t("homepage.usefulLinks.form.cancel", "Annuler") }),
|
|
61
|
-
/* @__PURE__ */ jsx(ButtonBeta, { form: formId, type: "submit", isLoading: isSubmitting, disabled: !isValid || !isDirty || isSubmitting, "data-testid": "usefullinks-button-save", children: t("homepage.usefulLinks.form.save", "Enregistrer") })
|
|
62
|
-
] })
|
|
63
|
-
] });
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
LinkForm
|
|
67
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import illuEmptyUsefulLinks from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
|
|
4
|
-
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
5
|
-
import HomeCard from "../HomeCard/HomeCard.js";
|
|
6
|
-
import Image from "../../../../components/Image/Image.js";
|
|
7
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
8
|
-
import LinkPill from "../../../../components/LinkPill/LinkPill.js";
|
|
9
|
-
function UsefulLinks({
|
|
10
|
-
links,
|
|
11
|
-
onEditClick
|
|
12
|
-
}) {
|
|
13
|
-
const {
|
|
14
|
-
t
|
|
15
|
-
} = useTranslation();
|
|
16
|
-
return /* @__PURE__ */ jsxs(HomeCard, { variant: "primary", children: [
|
|
17
|
-
/* @__PURE__ */ jsx(HomeCard.Header, { title: t("homepage.usefulLinks.title", "Liens utiles"), actionLabel: t("homepage.usefulLinks.edit", "Éditer"), actionLeftIcon: /* @__PURE__ */ jsx(SvgIconEdit, {}), onActionClick: onEditClick }),
|
|
18
|
-
/* @__PURE__ */ jsx(HomeCard.Content, { children: links.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "useful-links-widget__empty", children: [
|
|
19
|
-
/* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
|
|
20
|
-
width: 160,
|
|
21
|
-
height: 87
|
|
22
|
-
} }),
|
|
23
|
-
/* @__PURE__ */ jsx("p", { className: "useful-links-widget__empty-text", children: t("homepage.usefulLinks.empty", "Gardez à portée de main les sites web que vous utilisez souvent !") })
|
|
24
|
-
] }) : /* @__PURE__ */ jsx(Flex, { direction: "column", gap: "8", children: links.map((link) => /* @__PURE__ */ jsx(LinkPill, { href: link.url, label: link.name }, link.id)) }) })
|
|
25
|
-
] });
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
UsefulLinks
|
|
29
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function UsefulLinksContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { useUsefulLinksContainer } from "./hooks/useUsefulLinksContainer.js";
|
|
4
|
-
import { LinkForm } from "./LinkForm.js";
|
|
5
|
-
import { UsefulLinks } from "./UsefulLinks.js";
|
|
6
|
-
import { UsefulLinksModal } from "./UsefulLinksModal.js";
|
|
7
|
-
function UsefulLinksContainer() {
|
|
8
|
-
const [view, setView] = useState({
|
|
9
|
-
name: "closed"
|
|
10
|
-
}), {
|
|
11
|
-
links,
|
|
12
|
-
canAddLink,
|
|
13
|
-
createLink,
|
|
14
|
-
isCreating,
|
|
15
|
-
updateLink,
|
|
16
|
-
isUpdating,
|
|
17
|
-
deleteLink
|
|
18
|
-
} = useUsefulLinksContainer(), closeAll = () => setView({
|
|
19
|
-
name: "closed"
|
|
20
|
-
}), backToManage = () => setView({
|
|
21
|
-
name: "manage"
|
|
22
|
-
}), handleSubmit = async (payload) => {
|
|
23
|
-
view.name === "edit" ? await updateLink(view.link.id, payload) : await createLink(payload), backToManage();
|
|
24
|
-
};
|
|
25
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26
|
-
/* @__PURE__ */ jsx(UsefulLinks, { links, onEditClick: () => setView({
|
|
27
|
-
name: "manage"
|
|
28
|
-
}) }),
|
|
29
|
-
/* @__PURE__ */ jsx(UsefulLinksModal, { isOpen: view.name === "manage", links, canAddLink, onClose: closeAll, onAddClick: () => setView({
|
|
30
|
-
name: "add"
|
|
31
|
-
}), onEditLink: (link) => setView({
|
|
32
|
-
name: "edit",
|
|
33
|
-
link
|
|
34
|
-
}), onDeleteLink: deleteLink }),
|
|
35
|
-
(view.name === "add" || view.name === "edit") && /* @__PURE__ */ jsx(LinkForm, { mode: view.name, link: view.name === "edit" ? view.link : void 0, isSubmitting: view.name === "edit" ? isUpdating : isCreating, onCancel: backToManage, onClose: closeAll, onSubmit: handleSubmit })
|
|
36
|
-
] });
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
UsefulLinksContainer
|
|
40
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { UsefulLink } from '@edifice.io/client';
|
|
2
|
-
export interface UsefulLinksModalProps {
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
links: UsefulLink[];
|
|
5
|
-
canAddLink: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
onAddClick: () => void;
|
|
8
|
-
onEditLink: (link: UsefulLink) => void;
|
|
9
|
-
onDeleteLink: (id: string) => void;
|
|
10
|
-
}
|
|
11
|
-
export declare function UsefulLinksModal({ isOpen, links, canAddLink, onClose, onAddClick, onEditLink, onDeleteLink, }: UsefulLinksModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from "react-i18next";
|
|
3
|
-
import illuEmptyUsefulLinks from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
|
|
4
|
-
import SvgIconClose from "../../../icons/components/IconClose.js";
|
|
5
|
-
import SvgIconEdit from "../../../icons/components/IconEdit.js";
|
|
6
|
-
import SvgIconPlus from "../../../icons/components/IconPlus.js";
|
|
7
|
-
import useBreakpoint from "../../../../hooks/useBreakpoint/useBreakpoint.js";
|
|
8
|
-
import ButtonBeta from "../../../../components/ButtonBeta/ButtonBeta.js";
|
|
9
|
-
import ModalBeta from "../../../../components/ModalBeta/ModalBeta.js";
|
|
10
|
-
import Flex from "../../../../components/Flex/Flex.js";
|
|
11
|
-
import Image from "../../../../components/Image/Image.js";
|
|
12
|
-
import Table from "../../../../components/Table/components/Table.js";
|
|
13
|
-
function UsefulLinksModal({
|
|
14
|
-
isOpen,
|
|
15
|
-
links,
|
|
16
|
-
canAddLink,
|
|
17
|
-
onClose,
|
|
18
|
-
onAddClick,
|
|
19
|
-
onEditLink,
|
|
20
|
-
onDeleteLink
|
|
21
|
-
}) {
|
|
22
|
-
const {
|
|
23
|
-
t
|
|
24
|
-
} = useTranslation(), {
|
|
25
|
-
md
|
|
26
|
-
} = useBreakpoint(), addLinkButton = /* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "outline", leftIcon: /* @__PURE__ */ jsx(SvgIconPlus, {}), onClick: onAddClick, disabled: !canAddLink, "data-testid": "usefullinks-button-add", children: t("homepage.usefulLinks.modal.add", "Ajouter un lien") });
|
|
27
|
-
return /* @__PURE__ */ jsxs(ModalBeta, { id: "useful-links-modal", isOpen, size: "l", onModalClose: onClose, children: [
|
|
28
|
-
/* @__PURE__ */ jsx(ModalBeta.Header, { onModalClose: onClose, children: t("homepage.usefulLinks.modal.title", "Gérer les liens utiles") }),
|
|
29
|
-
/* @__PURE__ */ jsx(ModalBeta.Body, { children: links.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
-
/* @__PURE__ */ jsx(Flex, { justify: "end", className: "mb-16", children: addLinkButton }),
|
|
31
|
-
/* @__PURE__ */ jsxs("div", { className: "useful-links-modal__empty", children: [
|
|
32
|
-
/* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
|
|
33
|
-
width: 200,
|
|
34
|
-
height: 109
|
|
35
|
-
} }),
|
|
36
|
-
/* @__PURE__ */ jsx("p", { className: "useful-links-modal__empty-title", children: t("homepage.usefulLinks.modal.empty.title", "Pas encore de liens ajoutés") }),
|
|
37
|
-
/* @__PURE__ */ jsx("p", { className: "useful-links-modal__empty-text", children: t("homepage.usefulLinks.modal.empty.text", "Gardez à portée de main les sites web que vous utilisez souvent !") })
|
|
38
|
-
] })
|
|
39
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "useful-links-table", children: /* @__PURE__ */ jsxs(Table, { children: [
|
|
40
|
-
/* @__PURE__ */ jsx(Table.Thead, { children: /* @__PURE__ */ jsxs(Table.Tr, { children: [
|
|
41
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.usefulLinks.modal.table.name", "Nom") }),
|
|
42
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.usefulLinks.modal.table.url", "Adresse URL") }),
|
|
43
|
-
/* @__PURE__ */ jsx(Table.Th, { className: "visually-hidden", children: t("homepage.usefulLinks.modal.table.actions", "Actions") })
|
|
44
|
-
] }) }),
|
|
45
|
-
/* @__PURE__ */ jsxs(Table.Tbody, { children: [
|
|
46
|
-
/* @__PURE__ */ jsx(Table.Tr, { className: "useful-links-table__action-row", children: /* @__PURE__ */ jsx(Table.Td, { colSpan: md ? 3 : 2, children: /* @__PURE__ */ jsx(Flex, { justify: "end", children: addLinkButton }) }) }),
|
|
47
|
-
links.map((link) => /* @__PURE__ */ jsxs(Table.Tr, { "data-testid": `usefullinks-row-${link.id}`, children: [
|
|
48
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "useful-links-table__name", children: link.name }),
|
|
49
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "useful-links-table__url", children: link.url }),
|
|
50
|
-
/* @__PURE__ */ jsx(Table.Td, { className: "useful-links-table__actions", children: /* @__PURE__ */ jsxs(Flex, { gap: "4", justify: "end", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconEdit, {}), "aria-label": t("homepage.usefulLinks.modal.table.edit", "Modifier [[name]]", {
|
|
52
|
-
name: link.name
|
|
53
|
-
}), "data-testid": `usefullinks-button-edit-${link.id}`, onClick: () => onEditLink(link) }),
|
|
54
|
-
/* @__PURE__ */ jsx(ButtonBeta, { type: "button", variant: "ghost", color: "tertiary", size: "sm", leftIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), "aria-label": t("homepage.usefulLinks.modal.table.delete", "Supprimer [[name]]", {
|
|
55
|
-
name: link.name
|
|
56
|
-
}), "data-testid": `usefullinks-button-delete-${link.id}`, onClick: () => onDeleteLink(link.id) })
|
|
57
|
-
] }) })
|
|
58
|
-
] }, link.id))
|
|
59
|
-
] })
|
|
60
|
-
] }) }) })
|
|
61
|
-
] });
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
UsefulLinksModal
|
|
65
|
-
};
|