@edifice.io/react 2.5.5-develop-pedago.20260115154750 → 2.5.5-develop-b2school.20260116160825
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/Badge/Badge.d.ts +4 -7
- package/dist/components/Badge/Badge.js +11 -14
- package/dist/components/DatePicker/DatePicker.d.ts +57 -0
- package/dist/components/DatePicker/DatePicker.js +6 -3
- package/dist/components/Modal/Modal.d.ts +4 -0
- package/dist/components/Modal/Modal.js +13 -12
- package/dist/components/index.d.ts +0 -1
- package/dist/hooks/useDropzone/useDropzone.js +21 -16
- package/dist/hooks/useEdificeIcons/useEdificeIcons.d.ts +0 -1
- package/dist/hooks/useEdificeIcons/useEdificeIcons.js +0 -5
- package/dist/index.js +154 -156
- package/dist/modules/comments/components/Comment.js +4 -4
- package/dist/modules/comments/components/CommentDate.js +7 -10
- package/dist/modules/comments/components/CommentDeleted.js +1 -1
- package/dist/modules/comments/components/CommentForm.d.ts +1 -1
- package/dist/modules/comments/components/CommentForm.js +6 -6
- package/dist/modules/comments/components/CommentTitle.js +1 -1
- package/dist/modules/comments/provider/CommentProvider.js +3 -3
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +5 -5
- package/dist/utilities/mime-types/index.d.ts +1 -0
- package/dist/utilities/mime-types/mime-types-utils.d.ts +1 -0
- package/dist/utilities/mime-types/mime-types-utils.js +4 -0
- package/package.json +6 -7
- package/dist/components/MediaViewer/MediaViewer.d.ts +0 -17
- package/dist/components/MediaViewer/MediaViewer.js +0 -36
- package/dist/components/MediaViewer/MediaWrapper.d.ts +0 -7
- package/dist/components/MediaViewer/MediaWrapper.js +0 -72
- package/dist/components/MediaViewer/PdfViewer.d.ts +0 -4
- package/dist/components/MediaViewer/PdfViewer.js +0 -26
- package/dist/components/MediaViewer/ToolbarViewer.d.ts +0 -7
- package/dist/components/MediaViewer/ToolbarViewer.js +0 -41
- package/dist/components/MediaViewer/ToolbarZoom.d.ts +0 -4
- package/dist/components/MediaViewer/ToolbarZoom.js +0 -19
- package/dist/components/MediaViewer/index.d.ts +0 -2
- package/dist/components/SmartEllipsis/SmartEllipsis.d.ts +0 -5
- package/dist/components/SmartEllipsis/SmartEllipsis.js +0 -21
- package/dist/components/SmartEllipsis/index.d.ts +0 -2
- package/dist/hooks/useZoom/index.d.ts +0 -1
- package/dist/hooks/useZoom/useZoom.d.ts +0 -7
- package/dist/hooks/useZoom/useZoom.js +0 -14
- package/dist/modules/comments/components/CommentHeader.d.ts +0 -3
- package/dist/modules/comments/components/CommentHeader.js +0 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { UserProfile } from '@edifice.io/client';
|
|
3
3
|
export type BadgeRef = HTMLSpanElement;
|
|
4
4
|
/** Badge variant : notification */
|
|
5
5
|
export type NotificationBadgeVariant = {
|
|
@@ -29,15 +29,12 @@ export type LinkBadgeVariant = {
|
|
|
29
29
|
/**
|
|
30
30
|
* Badge variant : beta.
|
|
31
31
|
* Beta Badge is used to indicate that a feature is in beta phase.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* Example:
|
|
35
|
-
* <Badge variant={{ type: 'beta', app: myApp }} />
|
|
36
|
-
* where myApp is of type IWebApp.
|
|
32
|
+
* The color prop allows to customize the badge color to match the app color.
|
|
33
|
+
* Defaults to black if not provided.
|
|
37
34
|
*/
|
|
38
35
|
export type BetaBadgeVariant = {
|
|
39
36
|
type: 'beta';
|
|
40
|
-
|
|
37
|
+
color?: string;
|
|
41
38
|
};
|
|
42
39
|
export type BadgeVariants = NotificationBadgeVariant | ContentBadgeVariant | ProfileBadgeVariant | ChipBadgeVariant | LinkBadgeVariant | BetaBadgeVariant;
|
|
43
40
|
export interface BadgeProps extends React.ComponentPropsWithRef<'span'> {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import useEdificeIcons from "../../hooks/useEdificeIcons/useEdificeIcons.js";
|
|
5
4
|
const Badge = /* @__PURE__ */ forwardRef(({
|
|
6
5
|
className,
|
|
7
6
|
variant = {
|
|
@@ -11,19 +10,17 @@ const Badge = /* @__PURE__ */ forwardRef(({
|
|
|
11
10
|
children,
|
|
12
11
|
...restProps
|
|
13
12
|
}, ref) => {
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const classes = clsx("badge rounded-pill", (variant.type === "content" || variant.type === "user") && "background" in variant ? "bg-gray-200" : (variant.type === "content" || variant.type === "user") && !("background" in variant) ? "border border-0" : "", variant.type === "content" && `text-${variant.level}`, variant.type === "notification" && `badge-notification bg-${variant.level} text-light border border-0`, variant.type === "user" && `badge-profile-${variant.profile.toLowerCase()}`, variant.type === "link" && "badge-link border border-0", variant.type === "chip" && "bg-gray-200", variant.type === "beta" && badgeColorClassName, className);
|
|
26
|
-
return /* @__PURE__ */ jsxs("span", { ref, className: classes, ...restProps, children: [
|
|
13
|
+
const classes = clsx("badge rounded-pill", (variant.type === "content" || variant.type === "user") && "background" in variant ? "bg-gray-200" : (variant.type === "content" || variant.type === "user") && !("background" in variant) ? "border border-0" : "", variant.type === "content" && `text-${variant.level}`, variant.type === "notification" && `badge-notification bg-${variant.level} text-light border border-0`, variant.type === "user" && `badge-profile-${variant.profile.toLowerCase()}`, variant.type === "link" && "badge-link border border-0", variant.type === "chip" && "bg-gray-200", className);
|
|
14
|
+
return /* @__PURE__ */ jsxs("span", { ref, className: classes, style: (() => {
|
|
15
|
+
if (variant.type !== "beta") return;
|
|
16
|
+
const color = variant.color ?? "#000000";
|
|
17
|
+
return {
|
|
18
|
+
borderColor: color,
|
|
19
|
+
color,
|
|
20
|
+
backgroundColor: `${color}10`
|
|
21
|
+
// the 2 last hexadecimal numbers are for opacity
|
|
22
|
+
};
|
|
23
|
+
})(), ...restProps, children: [
|
|
27
24
|
variant.type === "chip" && /* @__PURE__ */ jsx("div", { className: "d-flex fw-800 align-items-center", children }),
|
|
28
25
|
variant.type === "beta" && (children ?? "BÊTA"),
|
|
29
26
|
variant.type !== "chip" && variant.type !== "beta" && children
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DatePicker component props
|
|
3
|
+
*
|
|
4
|
+
* Minimal interface that only exposes what is necessary.
|
|
5
|
+
* Ant Design implementation is hidden and no Ant Design-specific props are exposed.
|
|
6
|
+
* Standard HTML div attributes are supported (passed through to the underlying DOM element).
|
|
7
|
+
*/
|
|
8
|
+
export interface DatePickerProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange' | 'value' | 'defaultValue'> {
|
|
9
|
+
/**
|
|
10
|
+
* Selected date values
|
|
11
|
+
* @default today's date is setted by ant design if no value is provided
|
|
12
|
+
*/
|
|
13
|
+
value?: Date;
|
|
14
|
+
/**
|
|
15
|
+
* Callback called when date changes
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (date?: Date) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Date format to display in the picker
|
|
20
|
+
* @default 'DD / MM / YYYY'
|
|
21
|
+
*/
|
|
22
|
+
dateFormat?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Minimum selectable date
|
|
25
|
+
*/
|
|
26
|
+
minDate?: Date;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum selectable date
|
|
29
|
+
*/
|
|
30
|
+
maxDate?: Date;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Type for DatePicker ref
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* DatePicker component
|
|
37
|
+
*
|
|
38
|
+
* Date picker component for selecting a date.
|
|
39
|
+
*
|
|
40
|
+
* **Note:** This component uses Ant Design's DatePicker component internally.
|
|
41
|
+
* Only the props defined in DatePickerProps are allowed to prevent
|
|
42
|
+
* dependency on Ant Design-specific features. To replace the implementation,
|
|
43
|
+
* modify the component body below.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <DatePicker
|
|
48
|
+
* value={date}
|
|
49
|
+
* onChange={(date) => setDate(date)}
|
|
50
|
+
* dateFormat="YYYY-MM-DD"
|
|
51
|
+
* minDate={new Date(today.setDate(today.getDate() - 2))}
|
|
52
|
+
* maxDate={new Date(today.setDate(today.getDate() + 3))}
|
|
53
|
+
* />
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare const DatePicker: import('react').ForwardRefExoticComponent<DatePickerProps & import('react').RefAttributes<HTMLElement>>;
|
|
57
|
+
export default DatePicker;
|
|
@@ -16,7 +16,8 @@ const DatePicker = /* @__PURE__ */ forwardRef(({
|
|
|
16
16
|
onChange,
|
|
17
17
|
dateFormat = "DD / MM / YYYY",
|
|
18
18
|
minDate,
|
|
19
|
-
maxDate
|
|
19
|
+
maxDate,
|
|
20
|
+
...htmlProps
|
|
20
21
|
}, ref) => {
|
|
21
22
|
const handleChange = (date) => {
|
|
22
23
|
onChange == null || onChange(date ? date.toDate() : void 0);
|
|
@@ -26,9 +27,11 @@ const DatePicker = /* @__PURE__ */ forwardRef(({
|
|
|
26
27
|
format: dateFormat,
|
|
27
28
|
minDate: minDate ? dayjs(minDate) : void 0,
|
|
28
29
|
maxDate: maxDate ? dayjs(maxDate) : void 0,
|
|
29
|
-
ref
|
|
30
|
+
ref,
|
|
31
|
+
// Cast necessary because AntDatePicker expects a specific type, but our API exposes only HTMLElement to avoid dependency on Ant Design-specific features.
|
|
32
|
+
...htmlProps
|
|
30
33
|
};
|
|
31
|
-
return /* @__PURE__ */ jsx(DatePicker$1, { ...antProps });
|
|
34
|
+
return /* @__PURE__ */ jsx(DatePicker$1, { ...antProps, getPopupContainer: (triggerNode) => triggerNode.parentElement || document.body });
|
|
32
35
|
});
|
|
33
36
|
export {
|
|
34
37
|
DatePicker as default
|
|
@@ -10,17 +10,18 @@ import ModalSubtitle from "./ModalSubtitle.js";
|
|
|
10
10
|
import useClickOutside from "../../hooks/useClickOutside/useClickOutside.js";
|
|
11
11
|
import useTrapFocus from "../../hooks/useTrapFocus/useTrapFocus.js";
|
|
12
12
|
import useKeyPress from "../../hooks/useKeyPress/useKeyPress.js";
|
|
13
|
-
const Root = /* @__PURE__ */ forwardRef((
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
const Root = /* @__PURE__ */ forwardRef(({
|
|
14
|
+
id,
|
|
15
|
+
isOpen,
|
|
16
|
+
onModalClose,
|
|
17
|
+
size = "md",
|
|
18
|
+
viewport = !1,
|
|
19
|
+
scrollable = !1,
|
|
20
|
+
focusId,
|
|
21
|
+
children,
|
|
22
|
+
...otherDivProps
|
|
23
|
+
}, ref) => {
|
|
24
|
+
const ariaLabelId = `aria_label_${id}`, ariaDescriptionId = `aria_desc_${id}`, modalRef = useClickOutside(onModalClose), trapRef = useTrapFocus(isOpen);
|
|
24
25
|
useKeyPress(onModalClose, ["Escape"]), useEffect(() => {
|
|
25
26
|
if (isOpen && (document.body.style.overflow = "hidden", focusId)) {
|
|
26
27
|
const elem = document.getElementById(focusId);
|
|
@@ -54,7 +55,7 @@ const Root = /* @__PURE__ */ forwardRef((props, ref) => {
|
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
return /* @__PURE__ */ jsx(ModalContext.Provider, { value: modalContextValue, children: transition((style, isOpen2) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
|
-
isOpen2 && /* @__PURE__ */ jsx(animated.div, { id, ref, role: "dialog", "aria-modal": "true", "aria-labelledby": ariaLabelId, "aria-describedby": ariaDescriptionId, className: modalClasses, style, tabIndex: -1, children: /* @__PURE__ */ jsx("div", { id: `${id}_ref`, ref: (node) => {
|
|
58
|
+
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: (node) => {
|
|
58
59
|
modalRef.current = node, isOpen2 && (trapRef.current = node);
|
|
59
60
|
}, className: dialogClasses, children: /* @__PURE__ */ jsx("div", { className: "modal-content", children }) }) }),
|
|
60
61
|
isOpen2 && /* @__PURE__ */ jsx(animated.div, { className: "modal-backdrop fade show", style: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useRef } from "react";
|
|
2
|
-
import
|
|
2
|
+
import { HEIC_MIME_TYPES } from "../../utilities/mime-types/mime-types-utils.js";
|
|
3
3
|
const useDropzone = (props) => {
|
|
4
4
|
const [dragging, setDragging] = useState(!1), [files, setFiles] = useState([]), inputRef = useRef(null), addFile = (file) => {
|
|
5
5
|
addFiles([file]);
|
|
@@ -32,21 +32,26 @@ const useDropzone = (props) => {
|
|
|
32
32
|
})
|
|
33
33
|
));
|
|
34
34
|
filesToAdd.reverse(), props != null && props.forceFilters ? (filesToAdd = applyInputFiltersOn(filesToAdd), filesToAdd && filesToAdd.length && setFiles((prevFiles) => [...prevFiles, ...filesToAdd])) : setFiles((prevFiles) => [...prevFiles, ...files2]);
|
|
35
|
-
}, convertHEICImages = async (files2) =>
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
}, convertHEICImages = async (files2) => {
|
|
36
|
+
if (files2 === null || files2.length === 0)
|
|
37
|
+
return [];
|
|
38
|
+
let heic2any;
|
|
39
|
+
return files2.some((file) => HEIC_MIME_TYPES.includes(file.type)) && (heic2any = (await import("heic2any")).default), Promise.all(files2.map(async (file) => {
|
|
40
|
+
if (HEIC_MIME_TYPES.includes(file.type) && heic2any)
|
|
41
|
+
try {
|
|
42
|
+
const converted = await heic2any({
|
|
43
|
+
blob: file,
|
|
44
|
+
toType: "image/jpeg"
|
|
45
|
+
});
|
|
46
|
+
return new File([converted], file.name.replace(/\.(heic|heif)$/i, ".jpeg"), {
|
|
47
|
+
type: "image/jpeg"
|
|
48
|
+
});
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return console.error(`Failed to convert HEIC image: ${file.name}`, error), file;
|
|
51
|
+
}
|
|
52
|
+
return file;
|
|
53
|
+
}));
|
|
54
|
+
}, cleanFiles = () => {
|
|
50
55
|
setFiles([]);
|
|
51
56
|
}, handleOnChange = (event) => {
|
|
52
57
|
const files2 = event.target.files;
|
|
@@ -3,7 +3,6 @@ export default function useEdificeIcons(): {
|
|
|
3
3
|
getIconClass: (app: IWebApp | string) => string;
|
|
4
4
|
getBackgroundIconClass: (app: IWebApp | string) => string;
|
|
5
5
|
getBackgroundLightIconClass: (app: IWebApp | string) => string;
|
|
6
|
-
getBorderIconClass: (app: IWebApp | string) => string;
|
|
7
6
|
getIconCode: (app: IWebApp | string | undefined) => string;
|
|
8
7
|
getWidgetIconClass: (widget: IWidget) => string;
|
|
9
8
|
isIconUrl: (icon: string) => string | boolean;
|
|
@@ -78,10 +78,6 @@ function useEdificeIcons() {
|
|
|
78
78
|
const appCode = getIconCode(app);
|
|
79
79
|
return appCode ? `bg-light-${appCode}` : "bg-light-placeholder";
|
|
80
80
|
}
|
|
81
|
-
function getBorderIconClass(app) {
|
|
82
|
-
const appCode = getIconCode(app);
|
|
83
|
-
return appCode ? `border-app-${appCode}` : "border-app-placeholder";
|
|
84
|
-
}
|
|
85
81
|
function getWidgetIconClass(widget) {
|
|
86
82
|
return iconOfWidget[widget.platformConf.name];
|
|
87
83
|
}
|
|
@@ -89,7 +85,6 @@ function useEdificeIcons() {
|
|
|
89
85
|
getIconClass,
|
|
90
86
|
getBackgroundIconClass,
|
|
91
87
|
getBackgroundLightIconClass,
|
|
92
|
-
getBorderIconClass,
|
|
93
88
|
getIconCode,
|
|
94
89
|
getWidgetIconClass,
|
|
95
90
|
isIconUrl
|