@edifice.io/react 2.3.0-develop-pedago.20250915153825 → 2.3.0-develop-pedago.20250925094154
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/RadioCard/RadioCard.d.ts +37 -0
- package/dist/components/RadioCard/index.d.ts +2 -0
- package/dist/modules/modals/ShareModal/ShareBookmarkLine.d.ts +1 -1
- package/dist/modules/modals/ShareModal/ShareBookmarkLine.js +6 -3
- package/dist/modules/modals/ShareModal/hooks/useShareRightVisible.d.ts +11 -0
- package/dist/modules/modals/ShareModal/hooks/useShareRightVisible.js +11 -0
- package/package.json +6 -6
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
export interface RadioCardProps {
|
|
3
|
+
/**
|
|
4
|
+
* The currently selected value in the radio group.
|
|
5
|
+
*/
|
|
6
|
+
selectedValue: string;
|
|
7
|
+
/**
|
|
8
|
+
* The value associated with this specific radio card.
|
|
9
|
+
*/
|
|
10
|
+
value: string;
|
|
11
|
+
/**
|
|
12
|
+
* The main label text for the radio card.
|
|
13
|
+
*/
|
|
14
|
+
label: string;
|
|
15
|
+
/**
|
|
16
|
+
* Callback function triggered when the radio card selection changes.
|
|
17
|
+
*/
|
|
18
|
+
onChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Optional additional CSS class names to apply to the radio card.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional description text displayed below the label.
|
|
25
|
+
*/
|
|
26
|
+
description?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional model value associated with the radio card, can be a string, boolean, or number.
|
|
29
|
+
*/
|
|
30
|
+
model?: string | boolean | number;
|
|
31
|
+
/**
|
|
32
|
+
* Optional name for the radio group, used to group radio cards together.
|
|
33
|
+
*/
|
|
34
|
+
groupName?: string;
|
|
35
|
+
}
|
|
36
|
+
declare const RadioCard: import('react').ForwardRefExoticComponent<RadioCardProps & import('react').RefAttributes<HTMLLabelElement>>;
|
|
37
|
+
export default RadioCard;
|
|
@@ -6,4 +6,4 @@ export declare const ShareBookmarkLine: ({ shareRights, showBookmark, toggleBook
|
|
|
6
6
|
toggleRight: (shareRight: ShareRight, actionName: ShareRightActionDisplayName) => void;
|
|
7
7
|
toggleBookmark: () => void;
|
|
8
8
|
onDeleteRow: (shareRight: ShareRight) => void;
|
|
9
|
-
}) => (false | import("react/jsx-runtime").JSX.Element)[];
|
|
9
|
+
}) => (false | import("react/jsx-runtime").JSX.Element | null)[];
|
|
@@ -7,6 +7,7 @@ import SvgIconUsers from "../../icons/components/IconUsers.js";
|
|
|
7
7
|
import { hasRight } from "./utils/hasRight.js";
|
|
8
8
|
import { showShareRightLine } from "./utils/showShareRightLine.js";
|
|
9
9
|
import { useShareRightDisabled } from "./hooks/useShareRightDisabled.js";
|
|
10
|
+
import { useShareRightVisible } from "./hooks/useShareRightVisible.js";
|
|
10
11
|
import Avatar from "../../../components/Avatar/Avatar.js";
|
|
11
12
|
import Button from "../../../components/Button/Button.js";
|
|
12
13
|
import Checkbox from "../../../components/Checkbox/Checkbox.js";
|
|
@@ -23,14 +24,16 @@ const ShareBookmarkLine = ({
|
|
|
23
24
|
t
|
|
24
25
|
} = useTranslation(), {
|
|
25
26
|
isShareRightDisabled
|
|
26
|
-
} = useShareRightDisabled()
|
|
27
|
+
} = useShareRightDisabled(), {
|
|
28
|
+
isShareRightVisible
|
|
29
|
+
} = useShareRightVisible();
|
|
27
30
|
return shareRights == null ? void 0 : shareRights.rights.map((shareRight) => {
|
|
28
31
|
const selectedAvatar = {
|
|
29
32
|
user: /* @__PURE__ */ jsx(Avatar, { alt: t("explorer.modal.share.avatar.shared.alt"), size: "xs", src: shareRight.avatarUrl, variant: "circle" }),
|
|
30
33
|
group: /* @__PURE__ */ jsx("div", { className: "avatar-xs bg-primary-200 justify-content-center d-flex rounded-circle", children: /* @__PURE__ */ jsx(SvgIconUsers, { width: 16 }) }),
|
|
31
34
|
sharebookmark: /* @__PURE__ */ jsx(SvgIconBookmark, {})
|
|
32
35
|
}[shareRight.type] || null, isTypeBookmark = shareRight.type === "sharebookmark", isTypeUser = shareRight.type === "user", isDisabled = isShareRightDisabled(shareRight, shareRights);
|
|
33
|
-
return showShareRightLine(shareRight, showBookmark) && /* @__PURE__ */ jsxs("tr", { className: shareRight.isBookmarkMember ? "bg-light" : "", children: [
|
|
36
|
+
return isShareRightVisible(shareRight, shareRights) ? showShareRightLine(shareRight, showBookmark) && /* @__PURE__ */ jsxs("tr", { className: shareRight.isBookmarkMember ? "bg-light" : "", children: [
|
|
34
37
|
/* @__PURE__ */ jsx("td", { children: selectedAvatar }),
|
|
35
38
|
/* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs("div", { className: "d-flex", children: [
|
|
36
39
|
isTypeBookmark && /* @__PURE__ */ jsx(Button, { color: "tertiary", rightIcon: /* @__PURE__ */ jsx(SvgIconRafterDown, { title: t("show"), className: "w-16 min-w-0", style: {
|
|
@@ -44,7 +47,7 @@ const ShareBookmarkLine = ({
|
|
|
44
47
|
width: "80px"
|
|
45
48
|
}, className: "text-center text-white", children: /* @__PURE__ */ jsx(Checkbox, { checked: hasRight(shareRight, shareRightAction), onChange: () => toggleRight(shareRight, shareRightAction.id), disabled: isDisabled }) }, shareRightAction.displayName)),
|
|
46
49
|
/* @__PURE__ */ jsx("td", { children: !shareRight.isBookmarkMember && !isDisabled && /* @__PURE__ */ jsx(IconButton, { "aria-label": t("close"), color: "tertiary", icon: /* @__PURE__ */ jsx(SvgIconClose, {}), type: "button", variant: "ghost", title: t("close"), onClick: () => onDeleteRow(shareRight) }) })
|
|
47
|
-
] }, shareRight.id);
|
|
50
|
+
] }, shareRight.id) : null;
|
|
48
51
|
});
|
|
49
52
|
};
|
|
50
53
|
export {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ShareRight, ShareRightWithVisibles } from '@edifice.io/client';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to determine if a share right (group) should be visible in the share UI.
|
|
4
|
+
* Groups containing any label from `HIDDEN_GROUP_LABELS` will be hidden.
|
|
5
|
+
*
|
|
6
|
+
* Returns a function `isShareRightVisible(shareRight, shareRights)` that returns
|
|
7
|
+
* true when the share right must be displayed and false when it must be hidden.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useShareRightVisible: () => {
|
|
10
|
+
isShareRightVisible: (shareRight: ShareRight, shareRights: ShareRightWithVisibles) => boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const HIDDEN_GROUP_LABELS = ["CommunityAdminGroup"], useShareRightVisible = () => ({
|
|
2
|
+
isShareRightVisible: (shareRight, shareRights) => {
|
|
3
|
+
if (shareRight.type !== "group")
|
|
4
|
+
return !0;
|
|
5
|
+
const group = shareRights.visibleGroups.find((g) => g.id === shareRight.id);
|
|
6
|
+
return !group || !group.labels || !Array.isArray(group.labels) ? !0 : !group.labels.some((label) => HIDDEN_GROUP_LABELS.includes(label));
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export {
|
|
10
|
+
useShareRightVisible
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.3.0-develop-pedago.
|
|
3
|
+
"version": "2.3.0-develop-pedago.20250925094154",
|
|
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.3.0-develop-pedago.
|
|
134
|
-
"@edifice.io/tiptap-extensions": "2.3.0-develop-pedago.
|
|
135
|
-
"@edifice.io/utilities": "2.3.0-develop-pedago.
|
|
133
|
+
"@edifice.io/bootstrap": "2.3.0-develop-pedago.20250925094154",
|
|
134
|
+
"@edifice.io/tiptap-extensions": "2.3.0-develop-pedago.20250925094154",
|
|
135
|
+
"@edifice.io/utilities": "2.3.0-develop-pedago.20250925094154"
|
|
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.3.0-develop-pedago.
|
|
167
|
-
"@edifice.io/config": "2.3.0-develop-pedago.
|
|
166
|
+
"@edifice.io/client": "2.3.0-develop-pedago.20250925094154",
|
|
167
|
+
"@edifice.io/config": "2.3.0-develop-pedago.20250925094154"
|
|
168
168
|
},
|
|
169
169
|
"peerDependencies": {
|
|
170
170
|
"@react-spring/web": "^9.7.5",
|