@edifice.io/react 2.5.4-develop-pedago.20260108110738 → 2.5.4-develop-pedago.20260108180832

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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.5.4-develop-pedago.20260108110738",
3
+ "version": "2.5.4-develop-pedago.20260108180832",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -134,9 +134,9 @@
134
134
  "react-slugify": "^3.0.3",
135
135
  "swiper": "^10.1.0",
136
136
  "ua-parser-js": "^1.0.36",
137
- "@edifice.io/bootstrap": "2.5.4-develop-pedago.20260108110738",
138
- "@edifice.io/tiptap-extensions": "2.5.4-develop-pedago.20260108110738",
139
- "@edifice.io/utilities": "2.5.4-develop-pedago.20260108110738"
137
+ "@edifice.io/bootstrap": "2.5.4-develop-pedago.20260108180832",
138
+ "@edifice.io/tiptap-extensions": "2.5.4-develop-pedago.20260108180832",
139
+ "@edifice.io/utilities": "2.5.4-develop-pedago.20260108180832"
140
140
  },
141
141
  "devDependencies": {
142
142
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -167,8 +167,8 @@
167
167
  "vite": "^5.4.11",
168
168
  "vite-plugin-dts": "^4.1.0",
169
169
  "vite-tsconfig-paths": "^5.0.1",
170
- "@edifice.io/client": "2.5.4-develop-pedago.20260108110738",
171
- "@edifice.io/config": "2.5.4-develop-pedago.20260108110738"
170
+ "@edifice.io/client": "2.5.4-develop-pedago.20260108180832",
171
+ "@edifice.io/config": "2.5.4-develop-pedago.20260108180832"
172
172
  },
173
173
  "peerDependencies": {
174
174
  "@react-spring/web": "^9.7.5",