@edifice.io/react 2.2.11-develop-pedago.20250710171345 → 2.2.11-develop-pedago.20250822111402

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,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { Color } from 'src/types/color';
2
3
  export type AvatarVariants = 'square' | 'rounded' | 'circle';
3
4
  export type AvatarSizes = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
@@ -47,6 +48,10 @@ export interface AvatarProps extends React.ComponentPropsWithRef<'img'> {
47
48
  * Outer border offset in pixels
48
49
  */
49
50
  outerBorderOffset?: number;
51
+ /**
52
+ * Cover content for the avatar
53
+ */
54
+ cover?: ReactNode;
50
55
  }
51
56
  declare const Avatar: import('react').ForwardRefExoticComponent<Omit<AvatarProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
52
57
  export default Avatar;
@@ -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
  import noAvatar from "@edifice.io/bootstrap/dist/images/avatar/no-avatar.svg";
@@ -15,6 +15,7 @@ const Avatar = /* @__PURE__ */ forwardRef(({
15
15
  outerBorderColor,
16
16
  outerBorderWidth,
17
17
  outerBorderOffset,
18
+ cover,
18
19
  ...restProps
19
20
  }, ref) => {
20
21
  const placeholder = imgPlaceholder || noAvatar, classes = clsx("avatar", {
@@ -30,6 +31,8 @@ const Avatar = /* @__PURE__ */ forwardRef(({
30
31
  rounded: variant === "rounded",
31
32
  "rounded-circle": variant === "circle"
32
33
  }
34
+ }, {
35
+ "avatar-with-cover": cover
33
36
  }, className), style = {
34
37
  ...outerBorderColor && {
35
38
  outline: `${outerBorderWidth}px solid var(--edifice-${outerBorderColor})`,
@@ -39,7 +42,10 @@ const Avatar = /* @__PURE__ */ forwardRef(({
39
42
  border: `${innerBorderWidth}px solid var(--edifice-${innerBorderColor})`
40
43
  }
41
44
  };
42
- return /* @__PURE__ */ jsx("div", { ref, className: classes, style, children: /* @__PURE__ */ jsx(Image, { src: src || placeholder, alt, imgPlaceholder: placeholder, ...restProps }) });
45
+ return /* @__PURE__ */ jsxs("div", { ref, className: classes, style, children: [
46
+ /* @__PURE__ */ jsx(Image, { src: src || placeholder, alt, imgPlaceholder: placeholder, ...restProps }),
47
+ cover && /* @__PURE__ */ jsx("div", { className: "avatar-cover", children: cover })
48
+ ] });
43
49
  });
44
50
  export {
45
51
  Avatar as default
@@ -1,3 +1,4 @@
1
+ import { ReactNode } from 'react';
1
2
  import { AvatarProps } from '../Avatar';
2
3
  export interface AvatarGroupProps extends Omit<AvatarProps, 'src'> {
3
4
  /**
@@ -19,6 +20,15 @@ export interface AvatarGroupProps extends Omit<AvatarProps, 'src'> {
19
20
  * @default 'leftFirst'
20
21
  */
21
22
  stackingOrder?: 'leftFirst' | 'rightFirst';
23
+ /**
24
+ * Whether to wrap avatars to the next line
25
+ * @default false
26
+ */
27
+ wrap?: boolean;
28
+ /**
29
+ * Cover content for the last avatar
30
+ */
31
+ lastItemCover?: ReactNode;
22
32
  }
23
33
  declare const AvatarGroup: import('react').ForwardRefExoticComponent<Omit<AvatarGroupProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
24
34
  export default AvatarGroup;
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
2
  import clsx from "clsx";
3
+ import { forwardRef } from "react";
4
4
  import StackedGroup from "../StackedGroup/StackedGroup.js";
5
5
  import Avatar from "../Avatar/Avatar.js";
6
6
  const AvatarGroup = /* @__PURE__ */ forwardRef(({
@@ -12,12 +12,12 @@ const AvatarGroup = /* @__PURE__ */ forwardRef(({
12
12
  variant = "circle",
13
13
  alt,
14
14
  stackingOrder = "leftFirst",
15
+ wrap = !1,
16
+ lastItemCover,
15
17
  ...restProps
16
18
  }, ref) => {
17
- const visibleAvatars = src.slice(0, maxAvatars), classes = clsx("avatar-group", className);
18
- return /* @__PURE__ */ jsx("div", { ref, className: classes, style: {
19
- display: "flex"
20
- }, children: /* @__PURE__ */ jsx(StackedGroup, { overlap, stackingOrder, children: visibleAvatars.map((avatarSrc, index) => /* @__PURE__ */ jsx(Avatar, { src: avatarSrc, size, variant, alt: `${alt} ${index + 1}`, ...restProps })) }) });
19
+ const visibleAvatars = src.slice(0, maxAvatars), classes = clsx("avatar-group d-flex", className);
20
+ return /* @__PURE__ */ jsx("div", { ref, className: classes, children: /* @__PURE__ */ jsx(StackedGroup, { overlap, stackingOrder, wrap, children: visibleAvatars.map((avatarSrc, index) => /* @__PURE__ */ jsx(Avatar, { src: avatarSrc, size, variant, alt: `${alt} ${index + 1}`, cover: index === maxAvatars - 1 ? lastItemCover : void 0, ...restProps })) }) });
21
21
  });
22
22
  export {
23
23
  AvatarGroup as default
@@ -18,6 +18,11 @@ export interface StackedGroupProps {
18
18
  * Additional CSS class
19
19
  */
20
20
  className?: string;
21
+ /**
22
+ * Whether to wrap items to the next line
23
+ * @default false
24
+ */
25
+ wrap?: boolean;
21
26
  }
22
27
  declare const StackedGroup: import('react').ForwardRefExoticComponent<StackedGroupProps & import('react').RefAttributes<HTMLDivElement>>;
23
28
  export default StackedGroup;
@@ -1,18 +1,20 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
2
  import clsx from "clsx";
3
+ import { forwardRef } from "react";
4
4
  const StackedGroup = /* @__PURE__ */ forwardRef(({
5
5
  children,
6
6
  overlap = 20,
7
7
  className,
8
- stackingOrder = "leftFirst"
8
+ stackingOrder = "leftFirst",
9
+ wrap = !1
9
10
  }, ref) => {
10
- const classes = clsx("stacked-group", className);
11
- return /* @__PURE__ */ jsx("div", { ref, className: classes, style: {
12
- display: "flex",
13
- alignItems: "center"
14
- }, children: children.map((child, index) => /* @__PURE__ */ jsx("div", { style: {
15
- marginLeft: index === 0 ? 0 : `-${overlap}px`,
11
+ const classes = clsx("stacked-group d-flex align-items-center", className, {
12
+ "flex-wrap": wrap
13
+ });
14
+ return /* @__PURE__ */ jsx("div", { ref, className: classes, style: wrap ? {
15
+ paddingLeft: `${overlap}px`
16
+ } : void 0, children: children.map((child, index) => /* @__PURE__ */ jsx("div", { style: {
17
+ marginLeft: index === 0 && !wrap ? 0 : `-${overlap}px`,
16
18
  zIndex: stackingOrder === "rightFirst" ? children.length - index : index + 1
17
19
  }, children: child }, index)) });
18
20
  });
@@ -21,7 +21,7 @@ function useEdificeIcons() {
21
21
  };
22
22
  function getIconCode(app) {
23
23
  let appCode = "";
24
- switch (typeof app == "string" ? appCode = app : appCode = (app == null ? void 0 : app.icon) !== void 0 ? app == null ? void 0 : app.icon.trim().toLowerCase() : "placeholder", appCode && appCode.length > 0 ? appCode.endsWith("-large") && (appCode = appCode.replace("-large", "")) : typeof app == "object" && (appCode = (app == null ? void 0 : app.displayName) !== void 0 ? app == null ? void 0 : app.displayName.trim().toLowerCase() : ""), console.log(appCode), appCode) {
24
+ switch (typeof app == "string" ? appCode = app : appCode = (app == null ? void 0 : app.icon) !== void 0 ? app == null ? void 0 : app.icon.trim().toLowerCase() : "placeholder", appCode && appCode.length > 0 ? appCode.endsWith("-large") && (appCode = appCode.replace("-large", "")) : typeof app == "object" && (appCode = (app == null ? void 0 : app.displayName) !== void 0 ? app == null ? void 0 : app.displayName.trim().toLowerCase() : ""), appCode) {
25
25
  case "admin.title":
26
26
  appCode = "admin";
27
27
  break;
@@ -47,7 +47,7 @@ interface BaseProps {
47
47
  /** Maximum length for the description textarea */
48
48
  textareaMaxLength?: number;
49
49
  /** Callback when operation succeeds, with operation result as parameter */
50
- onSuccess: (result: CreateResult | UpdateResult) => void;
50
+ onSuccess: (result: CreateResult | UpdateResult, param: CreateParameters | UpdateParameters) => void;
51
51
  /** Callback when operation is cancelled */
52
52
  onCancel: () => void;
53
53
  /** Override application code (uses EdificeClient context by default) */
@@ -77,7 +77,7 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
77
77
  slug: formData.enablePublic && formData.formSlug || "",
78
78
  thumbnail
79
79
  };
80
- let result;
80
+ let result, param;
81
81
  if (isCreating) {
82
82
  const createParams = {
83
83
  ...data,
@@ -85,14 +85,14 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
85
85
  ((_a2 = props.currentFolder) == null ? void 0 : _a2.id) === "default" ? void 0 : parseInt(((_b2 = props.currentFolder) == null ? void 0 : _b2.id) || ""),
86
86
  application
87
87
  };
88
- props.createResource ? result = await props.createResource.mutateAsync(createParams) : result = await odeServices.resource(application).create(createParams);
88
+ param = createParams, props.createResource ? result = await props.createResource.mutateAsync(createParams) : result = await odeServices.resource(application).create(createParams);
89
89
  } else {
90
90
  const updateParams = {
91
91
  ...data,
92
92
  entId: resource.assetId,
93
93
  trashed: resource.trashed
94
94
  };
95
- props.updateResource ? result = await props.updateResource.mutateAsync(updateParams) : result = await odeServices.resource(application).update(updateParams);
95
+ param = updateParams, props.updateResource ? result = await props.updateResource.mutateAsync(updateParams) : result = await odeServices.resource(application).update(updateParams);
96
96
  }
97
97
  toast.success(/* @__PURE__ */ jsxs(Fragment, { children: [
98
98
  /* @__PURE__ */ jsx("strong", { children: t(isCreating ? "explorer.resource.created" : "explorer.resource.updated") }),
@@ -110,7 +110,7 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
110
110
  "Public:",
111
111
  formData.enablePublic ? t("explorer.enable.public.yes") : t("explorer.enable.public.no")
112
112
  ] })
113
- ] })), onSuccess(result);
113
+ ] })), onSuccess(result, param);
114
114
  } catch (e) {
115
115
  console.error(e);
116
116
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.2.11-develop-pedago.20250710171345",
3
+ "version": "2.2.11-develop-pedago.20250822111402",
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.20250710171345",
134
- "@edifice.io/tiptap-extensions": "2.2.11-develop-pedago.20250710171345",
135
- "@edifice.io/utilities": "2.2.11-develop-pedago.20250710171345"
133
+ "@edifice.io/bootstrap": "2.2.11-develop-pedago.20250822111402",
134
+ "@edifice.io/tiptap-extensions": "2.2.11-develop-pedago.20250822111402",
135
+ "@edifice.io/utilities": "2.2.11-develop-pedago.20250822111402"
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.20250710171345",
167
- "@edifice.io/config": "2.2.11-develop-pedago.20250710171345"
166
+ "@edifice.io/client": "2.2.11-develop-pedago.20250822111402",
167
+ "@edifice.io/config": "2.2.11-develop-pedago.20250822111402"
168
168
  },
169
169
  "peerDependencies": {
170
170
  "@react-spring/web": "^9.7.5",