@edifice.io/react 2.2.11-develop-pedago.20250707114038 → 2.2.11-develop-pedago.20250707120933

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.
@@ -1,13 +1,24 @@
1
+ import { ReactNode } from 'react';
1
2
  import { WorkspaceElement } from '@edifice.io/client';
2
3
  import { CardProps } from '../../../components';
3
4
  export interface FileCardProps extends CardProps {
4
5
  /**
5
6
  * WorkspaceElement
6
- * */
7
+ */
7
8
  doc: WorkspaceElement;
9
+ /**
10
+ * Custom icon to override the default based on file type
11
+ * Can be a string or a React node
12
+ */
13
+ customIcon?: ReactNode;
14
+ /**
15
+ * Custom color class to override the default based on file type
16
+ * Example: "bg-purple-300" or any valid CSS class
17
+ */
18
+ customColor?: string;
8
19
  }
9
20
  declare const FileCard: {
10
- ({ doc, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, }: FileCardProps): import("react/jsx-runtime").JSX.Element;
21
+ ({ doc, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: FileCardProps): import("react/jsx-runtime").JSX.Element;
11
22
  displayName: string;
12
23
  };
13
24
  export default FileCard;
@@ -18,11 +18,17 @@ const FileCard = ({
18
18
  className,
19
19
  onSelect,
20
20
  isFocused,
21
- app
21
+ app,
22
+ customIcon,
23
+ customColor
22
24
  }) => {
23
- var _a;
24
25
  const ref = useRef(null), type = DocumentHelper.getRole(doc);
25
26
  function getRoleMap(type2) {
27
+ if (customIcon !== void 0 || customColor !== void 0)
28
+ return {
29
+ icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
30
+ color: customColor || "bg-gray-300"
31
+ };
26
32
  const roleMappings = {
27
33
  csv: {
28
34
  icon: ".CSV",
@@ -75,7 +81,7 @@ const FileCard = ({
75
81
  };
76
82
  return roleMappings[type2] || roleMappings.unknown;
77
83
  }
78
- const file = clsx("file position-relative rounded", ((_a = getRoleMap(type ?? "default")) == null ? void 0 : _a.color) ?? "bg-yellow-200"), mediaSrc = type === "img" || type === "video" ? odeServices.workspace().getThumbnailUrl(doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
84
+ const roleMap = getRoleMap(type ?? "unknown"), file = clsx("file position-relative rounded", (roleMap == null ? void 0 : roleMap.color) ?? "bg-yellow-200"), mediaSrc = type === "img" || type === "video" ? odeServices.workspace().getThumbnailUrl(doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
79
85
  ref
80
86
  }), imageStyles = hasThumbnail && {
81
87
  backgroundImage: `url(${mediaSrc})`,
@@ -85,7 +91,7 @@ const FileCard = ({
85
91
  /* @__PURE__ */ jsx("div", { ref, className: file, style: {
86
92
  aspectRatio: "16/10",
87
93
  ...imageStyles
88
- }, children: type !== "img" || type === "img" && !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap: getRoleMap(type) }) : null }),
94
+ }, children: type !== "img" || type === "img" && !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
89
95
  /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
90
96
  /* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
91
97
  /* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerName })
@@ -1,6 +1,9 @@
1
1
  import { Role } from '@edifice.io/client';
2
2
  declare const FileIcon: ({ type, roleMap, }: {
3
3
  type: Role | "unknown";
4
- roleMap?: Record<string, string | JSX.Element>;
4
+ roleMap?: {
5
+ icon: React.ReactNode | string;
6
+ color: string;
7
+ };
5
8
  }) => import("react/jsx-runtime").JSX.Element;
6
9
  export default FileIcon;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.2.11-develop-pedago.20250707114038",
3
+ "version": "2.2.11-develop-pedago.20250707120933",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -130,9 +130,9 @@
130
130
  "react-slugify": "^3.0.3",
131
131
  "swiper": "^10.1.0",
132
132
  "ua-parser-js": "^1.0.36",
133
- "@edifice.io/bootstrap": "2.2.11-develop-pedago.20250707114038",
134
- "@edifice.io/tiptap-extensions": "2.2.11-develop-pedago.20250707114038",
135
- "@edifice.io/utilities": "2.2.11-develop-pedago.20250707114038"
133
+ "@edifice.io/bootstrap": "2.2.11-develop-pedago.20250707120933",
134
+ "@edifice.io/tiptap-extensions": "2.2.11-develop-pedago.20250707120933",
135
+ "@edifice.io/utilities": "2.2.11-develop-pedago.20250707120933"
136
136
  },
137
137
  "devDependencies": {
138
138
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -163,8 +163,8 @@
163
163
  "vite": "^5.4.11",
164
164
  "vite-plugin-dts": "^4.1.0",
165
165
  "vite-tsconfig-paths": "^5.0.1",
166
- "@edifice.io/client": "2.2.11-develop-pedago.20250707114038",
167
- "@edifice.io/config": "2.2.11-develop-pedago.20250707114038"
166
+ "@edifice.io/client": "2.2.11-develop-pedago.20250707120933",
167
+ "@edifice.io/config": "2.2.11-develop-pedago.20250707120933"
168
168
  },
169
169
  "peerDependencies": {
170
170
  "@react-spring/web": "^9.7.5",