@edifice.io/react 2.5.5-develop-b2school.20260109162050 → 2.5.5-develop-b2school.20260112173549

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.
@@ -26,7 +26,17 @@ export type ChipBadgeVariant = {
26
26
  export type LinkBadgeVariant = {
27
27
  type: 'link';
28
28
  };
29
- export type BadgeVariants = NotificationBadgeVariant | ContentBadgeVariant | ProfileBadgeVariant | ChipBadgeVariant | LinkBadgeVariant;
29
+ /**
30
+ * Badge variant : beta.
31
+ * Beta Badge is used to indicate that a feature is in beta phase.
32
+ * The color prop allows to customize the badge color to match the app color.
33
+ * Defaults to black if not provided.
34
+ */
35
+ export type BetaBadgeVariant = {
36
+ type: 'beta';
37
+ color?: string;
38
+ };
39
+ export type BadgeVariants = NotificationBadgeVariant | ContentBadgeVariant | ProfileBadgeVariant | ChipBadgeVariant | LinkBadgeVariant | BetaBadgeVariant;
30
40
  export interface BadgeProps extends React.ComponentPropsWithRef<'span'> {
31
41
  /**
32
42
  * Badge variant : notification, link or profile (Teacher|Student|Relative|Personnel)
@@ -35,6 +45,7 @@ export interface BadgeProps extends React.ComponentPropsWithRef<'span'> {
35
45
  variant?: BadgeVariants;
36
46
  /**
37
47
  * Text or icon (or whatever) to render as children elements.
48
+ * Defaults to 'BÊTA' for beta variant.
38
49
  */
39
50
  children?: ReactNode;
40
51
  /**
@@ -1,4 +1,4 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import clsx from "clsx";
4
4
  const Badge = /* @__PURE__ */ forwardRef(({
@@ -11,7 +11,20 @@ const Badge = /* @__PURE__ */ forwardRef(({
11
11
  ...restProps
12
12
  }, ref) => {
13
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__ */ jsx("span", { ref, className: classes, ...restProps, children: variant.type === "chip" ? /* @__PURE__ */ jsx("div", { className: "d-flex fw-800 align-items-center", children }) : children });
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: [
24
+ variant.type === "chip" && /* @__PURE__ */ jsx("div", { className: "d-flex fw-800 align-items-center", children }),
25
+ variant.type === "beta" && (children ?? "BÊTA"),
26
+ variant.type !== "chip" && variant.type !== "beta" && children
27
+ ] });
15
28
  });
16
29
  export {
17
30
  Badge as default
@@ -17,7 +17,7 @@ declare const useDropzone: (props?: {
17
17
  /** Callback to attach to your drop zone (any HTMLElement). */
18
18
  handleDragLeave: <T extends HTMLElement>(event: React.DragEvent<T>) => void;
19
19
  /** Callback to attach to your drop zone (any HTMLElement). */
20
- handleDrop: <T extends HTMLElement>(event: React.DragEvent<T>) => void;
20
+ handleDrop: <T extends HTMLElement>(event: React.DragEvent<T>) => Promise<void>;
21
21
  /** Replace a file in the `files` list. */
22
22
  replaceFileAt: (index: number, file: File) => void;
23
23
  /** Remove a file from the `files` list. */
@@ -25,7 +25,7 @@ declare const useDropzone: (props?: {
25
25
  /** Add a file to the `files` list. */
26
26
  addFile: (file: File) => void;
27
27
  /** Add many files to the `files` list. */
28
- addFiles: (files: File[]) => void;
28
+ addFiles: (files: File[]) => Promise<void>;
29
29
  /** Empty the `files` list. */
30
30
  cleanFiles: () => void;
31
31
  /** Callback to attach to your `input[type=file]` HTMLElement. */
@@ -1,4 +1,5 @@
1
1
  import { useState, useRef } from "react";
2
+ import heic2any from "heic2any";
2
3
  const useDropzone = (props) => {
3
4
  const [dragging, setDragging] = useState(!1), [files, setFiles] = useState([]), inputRef = useRef(null), addFile = (file) => {
4
5
  addFiles([file]);
@@ -23,15 +24,29 @@ const useDropzone = (props) => {
23
24
  });
24
25
  }
25
26
  return filteredFiles;
26
- }, addFiles = (files2) => {
27
- let filesToAdd = files2.sort((a, b) => b.lastModified - a.lastModified).map((file) => (
27
+ }, addFiles = async (files2) => {
28
+ let filesToAdd = (await convertHEICImages(files2)).sort((a, b) => b.lastModified - a.lastModified).map((file) => (
28
29
  // #WB-3377: Remove special characters from the file name. (it can cause issues with vertx which replace it or remove it)
29
30
  new File([file], file.name.replace(/[!:,;="']/g, ""), {
30
31
  type: file.type
31
32
  })
32
33
  ));
33
34
  filesToAdd.reverse(), props != null && props.forceFilters ? (filesToAdd = applyInputFiltersOn(filesToAdd), filesToAdd && filesToAdd.length && setFiles((prevFiles) => [...prevFiles, ...filesToAdd])) : setFiles((prevFiles) => [...prevFiles, ...files2]);
34
- }, cleanFiles = () => {
35
+ }, convertHEICImages = async (files2) => Promise.all(files2.map(async (file) => {
36
+ if (file.type === "image/heic" || file.type === "image/heif")
37
+ try {
38
+ const converted = await heic2any({
39
+ blob: file,
40
+ toType: "image/jpeg"
41
+ });
42
+ return new File([converted], file.name.replace(/\.(heic|heif)$/i, ".jpeg"), {
43
+ type: "image/jpeg"
44
+ });
45
+ } catch (error) {
46
+ return console.error(`Failed to convert HEIC image: ${file.name}`, error), file;
47
+ }
48
+ return file;
49
+ })), cleanFiles = () => {
35
50
  setFiles([]);
36
51
  }, handleOnChange = (event) => {
37
52
  const files2 = event.target.files;
@@ -53,11 +68,11 @@ const useDropzone = (props) => {
53
68
  /** Callback to attach to your drop zone (any HTMLElement). */
54
69
  handleDragLeave,
55
70
  /** Callback to attach to your drop zone (any HTMLElement). */
56
- handleDrop: (event) => {
71
+ handleDrop: async (event) => {
57
72
  var _a;
58
73
  handleDragLeave(event);
59
74
  const files2 = (_a = event.dataTransfer) == null ? void 0 : _a.files;
60
- files2 && (addFiles([...files2]), inputRef != null && inputRef.current && (inputRef.current.files = files2));
75
+ files2 && (await addFiles([...files2]), inputRef != null && inputRef.current && (inputRef.current.files = files2));
61
76
  },
62
77
  /** Replace a file in the `files` list. */
63
78
  replaceFileAt,
package/dist/index.js CHANGED
@@ -103,10 +103,12 @@ import { default as default101 } from "./modules/multimedia/ImageEditor/componen
103
103
  import { default as default102 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
104
104
  import { default as default103 } from "./modules/multimedia/FileCard/FileCard.js";
105
105
  import { default as default104 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
106
- import { default as default105 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
107
- import { default as default106 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
108
- import { default as default107 } from "./modules/multimedia/Workspace/Workspace.js";
109
- import { default as default108 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
106
+ import { default as default105 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
107
+ import { default as default106 } from "./modules/multimedia/UploadCard/UploadCard.js";
108
+ import { default as default107 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
109
+ import { default as default108 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
110
+ import { default as default109 } from "./modules/multimedia/Workspace/Workspace.js";
111
+ import { default as default110 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
110
112
  import { AccessiblePalette, DefaultPalette } from "./components/ColorPicker/ColorPalette.js";
111
113
  import { DropzoneContext, useDropzoneContext } from "./components/Dropzone/DropzoneContext.js";
112
114
  import { Column, Grid } from "./components/Grid/Grid.js";
@@ -125,6 +127,7 @@ import { useCheckable } from "./hooks/useCheckable/useCheckable.js";
125
127
  import { ResourceModal } from "./modules/modals/ResourceModal/ResourceModal.js";
126
128
  import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
127
129
  import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
130
+ import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
128
131
  import { AntProvider } from "./providers/AntThemeProvider/AntProvider.js";
129
132
  import { EdificeClientProvider } from "./providers/EdificeClientProvider/EdificeClientProvider.js";
130
133
  import { EdificeClientContext } from "./providers/EdificeClientProvider/EdificeClientProvider.context.js";
@@ -227,13 +230,16 @@ export {
227
230
  TreeNode,
228
231
  TreeNodeFolderWrapper,
229
232
  default51 as TreeView,
230
- default105 as VideoEmbed,
231
- default106 as VideoRecorder,
233
+ Upload,
234
+ default106 as UploadCard,
235
+ default105 as UploadFiles,
236
+ default107 as VideoEmbed,
237
+ default108 as VideoRecorder,
232
238
  default52 as VisuallyHidden,
233
239
  WORKSPACE_SHARED_FOLDER_ID,
234
240
  WORKSPACE_USER_FOLDER_ID,
235
- default107 as Workspace,
236
- default108 as WorkspaceFolders,
241
+ default109 as Workspace,
242
+ default110 as WorkspaceFolders,
237
243
  addNode,
238
244
  arrayUnique,
239
245
  buildTree,
@@ -1,3 +1,5 @@
1
1
  export { default as MediaLibrary } from './MediaLibrary';
2
2
  export * from './MediaLibrary';
3
+ export * from './innertabs/Upload';
4
+ export * from '../UploadFiles';
3
5
  export type { InternalLinkTabResult } from './innertabs/InternalLink';
@@ -14,7 +14,7 @@ const acceptedTypes = (type) => {
14
14
  acceptedTypes2.push("video/*");
15
15
  break;
16
16
  case "image":
17
- acceptedTypes2.push("image/png"), acceptedTypes2.push("image/jpeg"), acceptedTypes2.push("image/webp"), acceptedTypes2.push("image/gif"), acceptedTypes2.push("image/avif");
17
+ acceptedTypes2.push("image/png"), acceptedTypes2.push("image/jpeg"), acceptedTypes2.push("image/webp"), acceptedTypes2.push("image/gif"), acceptedTypes2.push("image/avif"), acceptedTypes2.push("image/heic");
18
18
  break;
19
19
  }
20
20
  return acceptedTypes2;
@@ -5,6 +5,7 @@ export * from './ImagePicker';
5
5
  export * from './FileCard';
6
6
  export * from './Linker';
7
7
  export * from './MediaLibrary';
8
+ export * from './UploadCard';
8
9
  export * from './VideoEmbed';
9
10
  export * from './VideoRecorder';
10
11
  export * from './Workspace';
@@ -4,12 +4,15 @@ import { default as default4 } from "./modules/multimedia/ImageEditor/components
4
4
  import { default as default5 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
5
5
  import { default as default6 } from "./modules/multimedia/FileCard/FileCard.js";
6
6
  import { default as default7 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
7
- import { default as default8 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
8
- import { default as default9 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
9
- import { default as default10 } from "./modules/multimedia/Workspace/Workspace.js";
10
- import { default as default11 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
7
+ import { default as default8 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
8
+ import { default as default9 } from "./modules/multimedia/UploadCard/UploadCard.js";
9
+ import { default as default10 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
10
+ import { default as default11 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
11
+ import { default as default12 } from "./modules/multimedia/Workspace/Workspace.js";
12
+ import { default as default13 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
11
13
  import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
12
14
  import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
15
+ import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
13
16
  export {
14
17
  default2 as AudioRecorder,
15
18
  default3 as Embed,
@@ -19,8 +22,11 @@ export {
19
22
  default5 as ImagePicker,
20
23
  InternalLinker,
21
24
  default7 as MediaLibrary,
22
- default8 as VideoEmbed,
23
- default9 as VideoRecorder,
24
- default10 as Workspace,
25
- default11 as WorkspaceFolders
25
+ Upload,
26
+ default9 as UploadCard,
27
+ default8 as UploadFiles,
28
+ default10 as VideoEmbed,
29
+ default11 as VideoRecorder,
30
+ default12 as Workspace,
31
+ default13 as WorkspaceFolders
26
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.5.5-develop-b2school.20260109162050",
3
+ "version": "2.5.5-develop-b2school.20260112173549",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -123,6 +123,7 @@
123
123
  "clsx": "^2.1.1",
124
124
  "dayjs": "1.11.19",
125
125
  "emoji-picker-react": "4.5.2",
126
+ "heic2any": "0.0.4",
126
127
  "html-react-parser": "4.2.1",
127
128
  "ohash": "1.1.3",
128
129
  "pako": "2.1.0",
@@ -133,9 +134,9 @@
133
134
  "react-slugify": "^3.0.3",
134
135
  "swiper": "^10.1.0",
135
136
  "ua-parser-js": "^1.0.36",
136
- "@edifice.io/tiptap-extensions": "2.5.5-develop-b2school.20260109162050",
137
- "@edifice.io/utilities": "2.5.5-develop-b2school.20260109162050",
138
- "@edifice.io/bootstrap": "2.5.5-develop-b2school.20260109162050"
137
+ "@edifice.io/bootstrap": "2.5.5-develop-b2school.20260112173549",
138
+ "@edifice.io/tiptap-extensions": "2.5.5-develop-b2school.20260112173549",
139
+ "@edifice.io/utilities": "2.5.5-develop-b2school.20260112173549"
139
140
  },
140
141
  "devDependencies": {
141
142
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -166,8 +167,8 @@
166
167
  "vite": "^5.4.11",
167
168
  "vite-plugin-dts": "^4.1.0",
168
169
  "vite-tsconfig-paths": "^5.0.1",
169
- "@edifice.io/client": "2.5.5-develop-b2school.20260109162050",
170
- "@edifice.io/config": "2.5.5-develop-b2school.20260109162050"
170
+ "@edifice.io/client": "2.5.5-develop-b2school.20260112173549",
171
+ "@edifice.io/config": "2.5.5-develop-b2school.20260112173549"
171
172
  },
172
173
  "peerDependencies": {
173
174
  "@react-spring/web": "^9.7.5",