infinity-ui-elements 1.14.21 → 1.14.22
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.
|
@@ -22,6 +22,14 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, Varian
|
|
|
22
22
|
* The color variant of the badge
|
|
23
23
|
*/
|
|
24
24
|
color?: "primary" | "positive" | "negative" | "notice" | "info" | "neutral";
|
|
25
|
+
/**
|
|
26
|
+
* Leading icon to display before the badge content
|
|
27
|
+
*/
|
|
28
|
+
leadingIcon?: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Trailing icon to display after the badge content
|
|
31
|
+
*/
|
|
32
|
+
trailingIcon?: React.ReactNode;
|
|
25
33
|
}
|
|
26
34
|
declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
35
|
export { Badge, badgeVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;;;mFAoGlB,CAAC;AAEF,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,QAAA,MAAM,aAAa;;;;mFAoGlB,CAAC;AAEF,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAC5C,YAAY,CAAC,OAAO,aAAa,CAAC;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IAC5E;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC;AAED,QAAA,MAAM,KAAK,mFAwDV,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1249,7 +1249,7 @@ const badgeVariants = cva("inline-flex items-center whitespace-nowrap transition
|
|
|
1249
1249
|
size: "medium",
|
|
1250
1250
|
},
|
|
1251
1251
|
});
|
|
1252
|
-
const Badge = React.forwardRef(({ className, variant, size, color, showDot = false, children, ...props }, ref) => {
|
|
1252
|
+
const Badge = React.forwardRef(({ className, variant, size, color, showDot = false, leadingIcon, trailingIcon, children, ...props }, ref) => {
|
|
1253
1253
|
const getDotColor = () => {
|
|
1254
1254
|
if (variant === "filled") {
|
|
1255
1255
|
return "bg-action-ink-on-primary-normal";
|
|
@@ -1281,7 +1281,7 @@ const Badge = React.forwardRef(({ className, variant, size, color, showDot = fal
|
|
|
1281
1281
|
}
|
|
1282
1282
|
return "h-3 w-3";
|
|
1283
1283
|
};
|
|
1284
|
-
return (jsxs("div", { ref: ref, className: cn(badgeVariants({ variant, size, color }), className), ...props, children: [showDot && (jsx("span", { className: cn("rounded-full", getDotColor(), getDotSize()), "aria-hidden": "true" })), children] }));
|
|
1284
|
+
return (jsxs("div", { ref: ref, className: cn(badgeVariants({ variant, size, color }), className), ...props, children: [showDot && (jsx("span", { className: cn("rounded-full", getDotColor(), getDotSize()), "aria-hidden": "true" })), leadingIcon && jsx("span", { className: "inline-flex", children: leadingIcon }), children, trailingIcon && jsx("span", { className: "inline-flex", children: trailingIcon })] }));
|
|
1285
1285
|
});
|
|
1286
1286
|
Badge.displayName = "Badge";
|
|
1287
1287
|
|