@edifice.io/react 2.6.0-develop.20260727115119 → 2.6.0-develop.20260727122609
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.
|
@@ -27,22 +27,29 @@ export type LinkBadgeVariant = {
|
|
|
27
27
|
type: 'link';
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
* Badge variant :
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
30
|
+
* Badge variant : App Version.
|
|
31
|
+
*
|
|
32
|
+
* Displays a badge showing the app version, for example: BÊTA, ALPHA, NEW or a custom version label.
|
|
33
|
+
*
|
|
34
|
+
* Default label is BÊTA unless a label is provided as a children of the component.
|
|
35
|
+
* Example of usage:
|
|
36
|
+
* <Badge variant={{ type: 'appVersion', app: myApp }}>NEW</Badge>
|
|
37
|
+
*
|
|
38
|
+
* The color prop allows to customize the badge color to match the app color (Defaults to black if not provided).
|
|
39
|
+
* Example of usage:
|
|
40
|
+
* <Badge variant={{ type: 'appVersion', color: '#823AA1' }} />
|
|
41
|
+
*
|
|
42
|
+
* If app prop is provided, the color of the App Version Badge is derived from the application colors,
|
|
43
|
+
* for example if the app provided is Blog then the Badge will have the same color as Blog app.
|
|
44
|
+
* Example of usage:
|
|
45
|
+
* <Badge variant={{ type: 'appVersion', app: blog }} />
|
|
39
46
|
*/
|
|
40
|
-
export type
|
|
41
|
-
type: '
|
|
47
|
+
export type AppVersionBadgeVariant = {
|
|
48
|
+
type: 'appVersion';
|
|
42
49
|
color?: string;
|
|
43
50
|
app?: IWebApp;
|
|
44
51
|
};
|
|
45
|
-
export type BadgeVariants = NotificationBadgeVariant | ContentBadgeVariant | ProfileBadgeVariant | ChipBadgeVariant | LinkBadgeVariant |
|
|
52
|
+
export type BadgeVariants = NotificationBadgeVariant | ContentBadgeVariant | ProfileBadgeVariant | ChipBadgeVariant | LinkBadgeVariant | AppVersionBadgeVariant;
|
|
46
53
|
export interface BadgeProps extends React.ComponentPropsWithRef<'span'> {
|
|
47
54
|
/**
|
|
48
55
|
* Badge variant : notification, link or profile (Teacher|Student|Relative|Personnel)
|
|
@@ -51,7 +58,6 @@ export interface BadgeProps extends React.ComponentPropsWithRef<'span'> {
|
|
|
51
58
|
variant?: BadgeVariants;
|
|
52
59
|
/**
|
|
53
60
|
* Text or icon (or whatever) to render as children elements.
|
|
54
|
-
* Defaults to 'BÊTA' for beta variant.
|
|
55
61
|
*/
|
|
56
62
|
children?: ReactNode;
|
|
57
63
|
/**
|
|
@@ -16,16 +16,16 @@ const Badge = /* @__PURE__ */ forwardRef(({
|
|
|
16
16
|
getBackgroundLightIconClass,
|
|
17
17
|
getBorderIconClass
|
|
18
18
|
} = useEdificeIcons();
|
|
19
|
-
let
|
|
20
|
-
if (variant.type === "
|
|
19
|
+
let appVersionBadgeColorClassName = "";
|
|
20
|
+
if (variant.type === "appVersion" && variant.app) {
|
|
21
21
|
const colorAppClassName = getIconClass(variant.app), backgroundLightAppClassName = getBackgroundLightIconClass(variant.app), borderAppClassName = getBorderIconClass(variant.app);
|
|
22
|
-
|
|
22
|
+
appVersionBadgeColorClassName = `${colorAppClassName} ${backgroundLightAppClassName} ${borderAppClassName}`;
|
|
23
23
|
}
|
|
24
|
-
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 === "
|
|
24
|
+
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 === "appVersion" && appVersionBadgeColorClassName, className);
|
|
25
25
|
return /* @__PURE__ */ jsxs("span", { ref, className: classes, ...restProps, children: [
|
|
26
26
|
variant.type === "chip" && /* @__PURE__ */ jsx("div", { className: "d-flex fw-800 align-items-center", children }),
|
|
27
|
-
variant.type === "
|
|
28
|
-
variant.type !== "chip" && variant.type !== "
|
|
27
|
+
variant.type === "appVersion" && (children ?? "BÊTA"),
|
|
28
|
+
variant.type !== "chip" && variant.type !== "appVersion" && children
|
|
29
29
|
] });
|
|
30
30
|
});
|
|
31
31
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.6.0-develop.
|
|
3
|
+
"version": "2.6.0-develop.20260727122609",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -140,9 +140,9 @@
|
|
|
140
140
|
"swiper": "10.1.0",
|
|
141
141
|
"ua-parser-js": "1.0.36",
|
|
142
142
|
"zustand": "4.5.7",
|
|
143
|
-
"@edifice.io/bootstrap": "2.6.0-develop.
|
|
144
|
-
"@edifice.io/tiptap-extensions": "2.6.0-develop.
|
|
145
|
-
"@edifice.io/utilities": "2.6.0-develop.
|
|
143
|
+
"@edifice.io/bootstrap": "2.6.0-develop.20260727122609",
|
|
144
|
+
"@edifice.io/tiptap-extensions": "2.6.0-develop.20260727122609",
|
|
145
|
+
"@edifice.io/utilities": "2.6.0-develop.20260727122609"
|
|
146
146
|
},
|
|
147
147
|
"devDependencies": {
|
|
148
148
|
"@babel/plugin-transform-react-pure-annotations": "7.27.1",
|
|
@@ -173,8 +173,8 @@
|
|
|
173
173
|
"vite": "5.4.14",
|
|
174
174
|
"vite-plugin-dts": "4.5.4",
|
|
175
175
|
"vite-tsconfig-paths": "5.1.4",
|
|
176
|
-
"@edifice.io/client": "2.6.0-develop.
|
|
177
|
-
"@edifice.io/config": "2.6.0-develop.
|
|
176
|
+
"@edifice.io/client": "2.6.0-develop.20260727122609",
|
|
177
|
+
"@edifice.io/config": "2.6.0-develop.20260727122609"
|
|
178
178
|
},
|
|
179
179
|
"peerDependencies": {
|
|
180
180
|
"@react-spring/web": "9.7.5",
|