@edifice.io/react 2.0.5 → 2.1.0-develop-b2school.20250204153130
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 -1
- package/dist/components/Attachment/Attachment.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Dropdown/DropdownTrigger.js +5 -1
- package/dist/components/Form/FormContext.js +1 -1
- package/dist/components/Form/FormControl.js +1 -1
- package/dist/components/Layout/components/Header.js +4 -3
- package/dist/components/Layout/components/WidgetApps.js +1 -1
- package/dist/components/List/List.d.ts +9 -1
- package/dist/components/List/List.js +9 -9
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.js +3 -1
- package/dist/hooks/useCheckable/useCheckable.js +1 -1
- package/dist/hooks/useConversation/useConversation.d.ts +1 -1
- package/dist/hooks/useConversation/useConversation.js +13 -17
- package/dist/hooks/useDropdown/useDropdown.js +1 -1
- package/dist/hooks/useDropzone/useDropzone.js +1 -1
- package/dist/hooks/useTrapFocus/useTrapFocus.d.ts +1 -1
- package/dist/hooks/useTrapFocus/useTrapFocus.js +3 -2
- package/dist/hooks/useUploadFiles/useUploadFiles.js +1 -1
- package/dist/icons-apps.js +220 -218
- package/dist/icons.js +116 -112
- package/dist/index.js +106 -106
- package/dist/modules/audience/ReactionModal.Card.js +1 -1
- package/dist/modules/comments/components/Comment.js +10 -7
- package/dist/modules/comments/components/CommentAvatar.js +1 -1
- package/dist/modules/comments/components/DeleteModal.d.ts +7 -0
- package/dist/modules/comments/components/DeleteModal.js +19 -0
- package/dist/modules/comments/context/Context.d.ts +2 -0
- package/dist/modules/comments/hooks/useComments.d.ts +1 -1
- package/dist/modules/comments/hooks/useComments.js +1 -1
- package/dist/modules/comments/hooks/useCommentsContext.d.ts +1 -0
- package/dist/modules/comments/provider/CommentProvider.js +3 -2
- package/dist/modules/comments/types.d.ts +5 -1
- package/dist/modules/editor/components/Editor/Editor.js +1 -1
- package/dist/modules/editor/components/Renderer/AttachmentRenderer.js +12 -7
- package/dist/modules/editor/components/Renderer/AudioRenderer.js +4 -1
- package/dist/modules/editor/components/Renderer/LinkerRenderer.js +1 -1
- package/dist/modules/editor/hooks/useCommentEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useTipTapEditor.d.ts +1 -1
- package/dist/modules/editor/hooks/useTipTapEditor.js +4 -4
- package/dist/modules/icons/components/IconReadMail.d.ts +7 -0
- package/dist/modules/icons/components/IconReadMail.js +16 -0
- package/dist/modules/icons/components/IconUnreadMail.d.ts +7 -0
- package/dist/modules/icons/components/IconUnreadMail.js +16 -0
- package/dist/modules/icons/components/apps/IconAppointments.d.ts +7 -0
- package/dist/modules/icons/components/apps/IconAppointments.js +12 -0
- package/dist/modules/icons/components/apps/index.d.ts +1 -0
- package/dist/modules/icons/components/index.d.ts +2 -0
- package/dist/modules/multimedia/UploadCard/UploadCard.js +2 -2
- package/dist/providers/MockedProvider/MockedProvider.js +1 -1
- package/package.json +30 -30
|
@@ -2,9 +2,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import * as iconsApps from "../../icons-apps.js";
|
|
5
|
+
import useEdificeIcons from "../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
5
6
|
import SvgIconPlaceholder from "../../modules/icons/components/apps/IconPlaceholder.js";
|
|
6
7
|
import Image from "../Image/Image.js";
|
|
7
|
-
import useEdificeIcons from "../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
8
8
|
const AppIcon = /* @__PURE__ */ forwardRef(({
|
|
9
9
|
app,
|
|
10
10
|
size = "24",
|
|
@@ -6,7 +6,7 @@ const Attachment = /* @__PURE__ */ forwardRef(({
|
|
|
6
6
|
name = "Attachment Name",
|
|
7
7
|
options,
|
|
8
8
|
...restProps
|
|
9
|
-
}, ref) => /* @__PURE__ */ jsxs("div", { ref, className: "attachment px-12 py-8", ...restProps, children: [
|
|
9
|
+
}, ref) => /* @__PURE__ */ jsxs("div", { ref, className: "attachment px-12 py-8", ...restProps, tabIndex: 0, children: [
|
|
10
10
|
/* @__PURE__ */ jsxs(Tooltip, { message: name, className: "filename text-truncate d-flex align-items-center gap-8", children: [
|
|
11
11
|
/* @__PURE__ */ jsx(SvgIconPaperclip, { height: 22, width: 22 }),
|
|
12
12
|
/* @__PURE__ */ jsx("div", { className: "filename text-truncate", children: name })
|
|
@@ -24,7 +24,7 @@ const Button = /* @__PURE__ */ forwardRef(({
|
|
|
24
24
|
"btn-lg": size === "lg",
|
|
25
25
|
"btn-sm": size === "sm"
|
|
26
26
|
}, className);
|
|
27
|
-
return /* @__PURE__ */ jsx("button", { ref, className: classes, type, ...restProps,
|
|
27
|
+
return /* @__PURE__ */ jsx("button", { ref, "data-testid": "button", className: classes, type, ...restProps, children: isLoading ? /* @__PURE__ */ jsx(Loading, { isLoading: !0, loadingIcon, loadingPosition, children }) : /* @__PURE__ */ jsxs("span", { children: [
|
|
28
28
|
leftIcon,
|
|
29
29
|
children,
|
|
30
30
|
rightIcon
|
|
@@ -3,6 +3,7 @@ import { forwardRef } from "react";
|
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import SvgIconRafterUp from "../../modules/icons/components/IconRafterUp.js";
|
|
5
5
|
import { useDropdownContext } from "./DropdownContext.js";
|
|
6
|
+
import Badge from "../Badge/Badge.js";
|
|
6
7
|
const DropdownTrigger = /* @__PURE__ */ forwardRef(({
|
|
7
8
|
label,
|
|
8
9
|
icon,
|
|
@@ -26,7 +27,10 @@ const DropdownTrigger = /* @__PURE__ */ forwardRef(({
|
|
|
26
27
|
return /* @__PURE__ */ jsxs("button", { ref: forwardRef2, type: "button", disabled, ...mergedProps, children: [
|
|
27
28
|
icon,
|
|
28
29
|
label,
|
|
29
|
-
badgeContent ? /* @__PURE__ */ jsx(
|
|
30
|
+
badgeContent ? /* @__PURE__ */ jsx(Badge, { variant: {
|
|
31
|
+
level: "info",
|
|
32
|
+
type: "notification"
|
|
33
|
+
}, children: badgeContent }) : !hideCarret && /* @__PURE__ */ jsx(SvgIconRafterUp, { width: 16, height: 16, className: "dropdown-toggle-caret" })
|
|
30
34
|
] });
|
|
31
35
|
});
|
|
32
36
|
export {
|
|
@@ -2,8 +2,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useMemo } from "react";
|
|
3
3
|
import { Context } from "./FormContext.js";
|
|
4
4
|
import FormText from "./FormText.js";
|
|
5
|
-
import Label from "../Label/Label.js";
|
|
6
5
|
import Input from "../Input/Input.js";
|
|
6
|
+
import Label from "../Label/Label.js";
|
|
7
7
|
const Root = /* @__PURE__ */ forwardRef(({
|
|
8
8
|
children,
|
|
9
9
|
className,
|
|
@@ -4,13 +4,14 @@ import { useTranslation } from "react-i18next";
|
|
|
4
4
|
import { useEdificeClient } from "../../../providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
5
5
|
import { useEdificeTheme } from "../../../providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
6
6
|
import SvgIconRafterDown from "../../../modules/icons/components/IconRafterDown.js";
|
|
7
|
-
import SvgIconAssistance from "../../../modules/icons/components/apps/IconAssistance.js";
|
|
8
7
|
import SvgIconCommunity from "../../../modules/icons/components/nav/IconCommunity.js";
|
|
9
8
|
import SvgIconDisconnect from "../../../modules/icons/components/nav/IconDisconnect.js";
|
|
10
9
|
import SvgIconHome from "../../../modules/icons/components/nav/IconHome.js";
|
|
11
10
|
import SvgIconMyApps from "../../../modules/icons/components/nav/IconMyApps.js";
|
|
11
|
+
import SvgIconNeoAssistance from "../../../modules/icons/components/nav/IconNeoAssistance.js";
|
|
12
12
|
import SvgIconNeoMessaging from "../../../modules/icons/components/nav/IconNeoMessaging.js";
|
|
13
13
|
import SvgIconNewRelease from "../../../modules/icons/components/nav/IconNewRelease.js";
|
|
14
|
+
import SvgIconOneAssistance from "../../../modules/icons/components/nav/IconOneAssistance.js";
|
|
14
15
|
import SvgIconOneMessaging from "../../../modules/icons/components/nav/IconOneMessaging.js";
|
|
15
16
|
import SvgIconOneProfile from "../../../modules/icons/components/nav/IconOneProfile.js";
|
|
16
17
|
import SvgIconUserbook from "../../../modules/icons/components/nav/IconUserbook.js";
|
|
@@ -98,7 +99,7 @@ const Header = ({
|
|
|
98
99
|
/* @__PURE__ */ jsxs("button", { className: "nav-link", onClick: () => {
|
|
99
100
|
setIsHelpOpen(!0);
|
|
100
101
|
}, children: [
|
|
101
|
-
/* @__PURE__ */ jsx(
|
|
102
|
+
/* @__PURE__ */ jsx(SvgIconOneAssistance, { className: "icon help" }),
|
|
102
103
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: t("navbar.help") })
|
|
103
104
|
] }),
|
|
104
105
|
/* @__PURE__ */ jsx(Help, { isHelpOpen, setIsHelpOpen, parsedContent, parsedHeadline, error })
|
|
@@ -157,7 +158,7 @@ const Header = ({
|
|
|
157
158
|
/* @__PURE__ */ jsxs("button", { className: "nav-link btn btn-naked", onClick: () => {
|
|
158
159
|
setIsHelpOpen(!0);
|
|
159
160
|
}, children: [
|
|
160
|
-
/* @__PURE__ */ jsx(
|
|
161
|
+
/* @__PURE__ */ jsx(SvgIconNeoAssistance, { color: "#fff" }),
|
|
161
162
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: t("support") })
|
|
162
163
|
] }),
|
|
163
164
|
/* @__PURE__ */ jsx(Help, { isHelpOpen, setIsHelpOpen, parsedContent, parsedHeadline, error })
|
|
@@ -5,6 +5,10 @@ export type ListProps<T> = {
|
|
|
5
5
|
* Toolbar data items
|
|
6
6
|
*/
|
|
7
7
|
items?: ToolbarItem[];
|
|
8
|
+
/**
|
|
9
|
+
* Checkable list
|
|
10
|
+
*/
|
|
11
|
+
isCheckable?: boolean;
|
|
8
12
|
/**
|
|
9
13
|
* Generic data
|
|
10
14
|
*/
|
|
@@ -17,7 +21,11 @@ export type ListProps<T> = {
|
|
|
17
21
|
* Callback to get selected ids
|
|
18
22
|
*/
|
|
19
23
|
onSelectedItems?: (selectedIds: string[]) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Custom class name
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
20
28
|
};
|
|
21
29
|
export declare const List: <T extends {
|
|
22
30
|
_id: string;
|
|
23
|
-
}>({ items, data, renderNode, onSelectedItems, }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
}>({ items, isCheckable, data, renderNode, onSelectedItems, className, }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,9 +7,11 @@ import Checkbox from "../Checkbox/Checkbox.js";
|
|
|
7
7
|
import { Toolbar } from "../Toolbar/Toolbar.js";
|
|
8
8
|
const List = ({
|
|
9
9
|
items,
|
|
10
|
+
isCheckable = !1,
|
|
10
11
|
data,
|
|
11
12
|
renderNode,
|
|
12
|
-
onSelectedItems
|
|
13
|
+
onSelectedItems,
|
|
14
|
+
className
|
|
13
15
|
}) => {
|
|
14
16
|
const {
|
|
15
17
|
selectedItems,
|
|
@@ -21,11 +23,9 @@ const List = ({
|
|
|
21
23
|
return useEffect(() => {
|
|
22
24
|
selectedItems && (onSelectedItems == null || onSelectedItems(selectedItems));
|
|
23
25
|
}, [onSelectedItems, selectedItems]), /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
-
items && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
-
/* @__PURE__ */ jsx("div", { className: clsx("d-flex align-items-center gap-8", {
|
|
26
|
-
"
|
|
27
|
-
}), children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
-
/* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-8", children: [
|
|
26
|
+
(items || isCheckable) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ jsx("div", { className: clsx("list-header d-flex align-items-center gap-8 px-12", className), children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-8 py-12", children: [
|
|
29
29
|
/* @__PURE__ */ jsx(Checkbox, { checked: allItemsSelected, indeterminate: isIndeterminate, onChange: () => handleOnSelectAllItems(allItemsSelected) }),
|
|
30
30
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
31
31
|
"(",
|
|
@@ -33,15 +33,15 @@ const List = ({
|
|
|
33
33
|
")"
|
|
34
34
|
] })
|
|
35
35
|
] }),
|
|
36
|
-
/* @__PURE__ */ jsx(Toolbar, { items, isBlock: !0, align: "left", variant: "no-shadow", className: clsx("gap-4 py-4", {
|
|
36
|
+
items && /* @__PURE__ */ jsx(Toolbar, { items, isBlock: !0, align: "left", variant: "no-shadow", className: clsx("gap-4 py-4", {
|
|
37
37
|
"px-0 ms-auto": !isDesktopDevice
|
|
38
38
|
}) })
|
|
39
39
|
] }) }),
|
|
40
40
|
/* @__PURE__ */ jsx("div", { className: "border-top" })
|
|
41
41
|
] }),
|
|
42
42
|
/* @__PURE__ */ jsx("div", { className: "mt-8", children: data == null ? void 0 : data.map((node) => {
|
|
43
|
-
const
|
|
44
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children: renderNode(node,
|
|
43
|
+
const checked = selectedItems.includes(node._id);
|
|
44
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: renderNode(node, /* @__PURE__ */ jsx(Checkbox, { checked, onChange: () => handleOnSelectItem(node._id), onClick: (event) => event.stopPropagation() }), checked) }, node._id);
|
|
45
45
|
}) })
|
|
46
46
|
] });
|
|
47
47
|
};
|
|
@@ -20,7 +20,7 @@ const Root = /* @__PURE__ */ forwardRef((props, ref) => {
|
|
|
20
20
|
scrollable = !1,
|
|
21
21
|
focusId,
|
|
22
22
|
children
|
|
23
|
-
} = props, ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose), trapRef = useTrapFocus();
|
|
23
|
+
} = props, ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose), trapRef = useTrapFocus(isOpen);
|
|
24
24
|
useKeyPress(onModalClose, ["Escape"]), useEffect(() => {
|
|
25
25
|
if (isOpen && (document.body.style.overflow = "hidden", focusId)) {
|
|
26
26
|
const elem = document.getElementById(focusId);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEvent } from 'react';
|
|
2
2
|
import { Size } from '../../types';
|
|
3
|
-
export interface BaseProps {
|
|
3
|
+
export interface BaseProps extends Omit<React.ComponentPropsWithoutRef<'input'>, 'size'> {
|
|
4
4
|
/**
|
|
5
5
|
* String or Template literal with React i18next namespace
|
|
6
6
|
*/
|
|
@@ -24,10 +24,12 @@ const SearchBar = ({
|
|
|
24
24
|
"ps-48": isVariant
|
|
25
25
|
}), handleClick = () => {
|
|
26
26
|
onClick == null || onClick();
|
|
27
|
+
}, handleKeyDown = (e) => {
|
|
28
|
+
e.key === "Enter" && (e.preventDefault(), handleClick());
|
|
27
29
|
};
|
|
28
30
|
return /* @__PURE__ */ jsxs(FormControl, { id: "search-bar", className: searchbar, children: [
|
|
29
31
|
isVariant && /* @__PURE__ */ jsx("div", { className: "position-absolute z-1 top-50 start-0 translate-middle-y border-0 ps-12 bg-transparent", children: /* @__PURE__ */ jsx(SvgIconSearch, {}) }),
|
|
30
|
-
/* @__PURE__ */ jsx(FormControl.Input, { type: "search", placeholder: t(placeholder), size, noValidationIcon: !0, className: input, onChange, disabled, ...restProps }),
|
|
32
|
+
/* @__PURE__ */ jsx(FormControl.Input, { type: "search", placeholder: t(placeholder), size, noValidationIcon: !0, className: input, onChange, disabled, onKeyDown: handleKeyDown, ...restProps }),
|
|
31
33
|
!isVariant && /* @__PURE__ */ jsx(SearchButton, { type: "submit", "aria-label": t("search"), icon: /* @__PURE__ */ jsx(SvgIconSearch, {}), className: "border-start-0", onClick: handleClick })
|
|
32
34
|
] });
|
|
33
35
|
};
|
|
@@ -7,7 +7,7 @@ const useCheckable = (data) => {
|
|
|
7
7
|
});
|
|
8
8
|
}, handleOnSelectAllItems = (deselect) => {
|
|
9
9
|
setSelectedItems(() => deselect ? [] : (data == null ? void 0 : data.map((item) => item._id)) ?? []);
|
|
10
|
-
}, allItemsSelected = (selectedItems == null ? void 0 : selectedItems.length) === (data == null ? void 0 : data.length), isIndeterminate = data ? (selectedItems == null ? void 0 : selectedItems.length) > 0 && (selectedItems == null ? void 0 : selectedItems.length) < (data == null ? void 0 : data.length) : !1;
|
|
10
|
+
}, allItemsSelected = (selectedItems == null ? void 0 : selectedItems.length) === (data == null ? void 0 : data.length) && (data == null ? void 0 : data.length) > 0, isIndeterminate = data ? (selectedItems == null ? void 0 : selectedItems.length) > 0 && (selectedItems == null ? void 0 : selectedItems.length) < (data == null ? void 0 : data.length) : !1;
|
|
11
11
|
return {
|
|
12
12
|
selectedItems,
|
|
13
13
|
allItemsSelected,
|
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import { useState, useEffect } from "react";
|
|
2
2
|
import { odeServices } from "@edifice.io/client";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
3
4
|
import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
|
|
4
5
|
const useConversation = () => {
|
|
5
|
-
const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [
|
|
6
|
+
const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [msgLink, setMsgLink] = useState(""), queryParams = {
|
|
6
7
|
unread: !0,
|
|
7
8
|
_: (/* @__PURE__ */ new Date()).getTime()
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
console.error(error), setMessages(0);
|
|
19
|
-
}
|
|
20
|
-
}, goToMessagerie = async () => {
|
|
9
|
+
}, {
|
|
10
|
+
data: messages
|
|
11
|
+
} = useQuery({
|
|
12
|
+
queryKey: ["conversation-navbar-count"],
|
|
13
|
+
queryFn: async () => await odeServices.http().get(zimbraWorkflow ? "/zimbra/count/INBOX" : "/conversation/count/INBOX", {
|
|
14
|
+
queryParams
|
|
15
|
+
}),
|
|
16
|
+
staleTime: 5 * 60 * 1e3
|
|
17
|
+
// 5 minutes
|
|
18
|
+
}), goToMessagerie = async () => {
|
|
21
19
|
const defaultLink = "/zimbra/zimbra";
|
|
22
20
|
try {
|
|
23
21
|
const {
|
|
@@ -29,11 +27,9 @@ const useConversation = () => {
|
|
|
29
27
|
}
|
|
30
28
|
};
|
|
31
29
|
return useEffect(() => {
|
|
32
|
-
refreshMails();
|
|
33
|
-
}, []), useEffect(() => {
|
|
34
30
|
goToMessagerie();
|
|
35
31
|
}, []), {
|
|
36
|
-
messages,
|
|
32
|
+
messages: messages ? messages.count : 0,
|
|
37
33
|
msgLink,
|
|
38
34
|
zimbraWorkflow
|
|
39
35
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useId, useState, useRef, useEffect, useCallback } from "react";
|
|
2
|
-
import { useFloating,
|
|
2
|
+
import { useFloating, offset, size, flip, autoUpdate, useHover, safePolygon } from "@floating-ui/react";
|
|
3
3
|
import { mergeRefs } from "../../utilities/refs/ref.js";
|
|
4
4
|
const useDropdown = (placement, extraTriggerKeyDownHandler, isTriggerHovered = !1) => {
|
|
5
5
|
const id = useId(), [visible, setVisible] = useState(!1), [activeIndex, setActiveIndex] = useState(-1), [isFocused, setIsFocused] = useState(null), {
|
|
@@ -30,7 +30,7 @@ const useDropzone = (props) => {
|
|
|
30
30
|
type: file.type
|
|
31
31
|
})
|
|
32
32
|
));
|
|
33
|
-
props != null && props.forceFilters ? (filesToAdd = applyInputFiltersOn(filesToAdd), filesToAdd && filesToAdd.length && setFiles((prevFiles) => [...prevFiles, ...filesToAdd])) : setFiles((prevFiles) => [...prevFiles, ...files2]);
|
|
33
|
+
filesToAdd.reverse(), props != null && props.forceFilters ? (filesToAdd = applyInputFiltersOn(filesToAdd), filesToAdd && filesToAdd.length && setFiles((prevFiles) => [...prevFiles, ...filesToAdd])) : setFiles((prevFiles) => [...prevFiles, ...files2]);
|
|
34
34
|
}, cleanFiles = () => {
|
|
35
35
|
setFiles([]);
|
|
36
36
|
}, handleOnChange = (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useTrapFocus(): import('react').MutableRefObject<HTMLElement | null>;
|
|
1
|
+
export default function useTrapFocus(isActive?: boolean): import('react').MutableRefObject<HTMLElement | null>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useRef, useEffect } from "react";
|
|
2
|
-
function useTrapFocus() {
|
|
2
|
+
function useTrapFocus(isActive) {
|
|
3
3
|
const ref = useRef(null), focusableElements = 'button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
4
4
|
return useEffect(() => {
|
|
5
|
+
if (!isActive) return;
|
|
5
6
|
const node = ref.current, firstFocusableElement = node.querySelectorAll(focusableElements)[0], focusableContent = node.querySelectorAll(focusableElements), lastFocusableElement = ref && (focusableContent == null ? void 0 : focusableContent[focusableContent.length - 1]), handleKeydown = (event) => {
|
|
6
7
|
event.key === "Tab" && (event.shiftKey ? document.activeElement === firstFocusableElement && (lastFocusableElement.focus(), event.preventDefault()) : document.activeElement === lastFocusableElement && (firstFocusableElement.focus(), event.preventDefault()));
|
|
7
8
|
};
|
|
@@ -9,7 +10,7 @@ function useTrapFocus() {
|
|
|
9
10
|
return node.addEventListener("keydown", handleKeydown), () => {
|
|
10
11
|
node.removeEventListener("keydown", handleKeydown);
|
|
11
12
|
};
|
|
12
|
-
}, []), ref;
|
|
13
|
+
}, [isActive]), ref;
|
|
13
14
|
}
|
|
14
15
|
export {
|
|
15
16
|
useTrapFocus as default
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from "react";
|
|
2
2
|
import { ImageResizer, addTimestampToImageUrl } from "@edifice.io/utilities";
|
|
3
3
|
import { useDropzoneContext } from "../../components/Dropzone/DropzoneContext.js";
|
|
4
|
-
import useUpload from "../useUpload/useUpload.js";
|
|
5
4
|
import useWorkspaceFile from "../useWorkspaceFile/useWorkspaceFile.js";
|
|
5
|
+
import useUpload from "../useUpload/useUpload.js";
|
|
6
6
|
const useUploadFiles = ({
|
|
7
7
|
handleOnChange,
|
|
8
8
|
visibility,
|