@@ -3,21 +3,27 @@ import { Icon } from "@/components/icon";
33import { cn } from "@/utils/cn" ;
44import type { IconLibrary , IconType } from "@/utils/icon-utils" ;
55
6- type BadgeSize = "xs" | "sm" | "md" | "lg" ;
7- type BadgeShape = "rounded" | "pill" ;
8- type BadgeVariant = "solid" | "outline" ;
9- type BadgeColor =
10- | "gray"
11- | "blue"
12- | "green"
13- | "orange"
14- | "yellow"
15- | "red"
16- | "purple"
17- | "white"
18- | "surface"
19- | "white-destructive"
20- | "surface-destructive" ;
6+ const BADGE_COLORS = [
7+ "gray" ,
8+ "blue" ,
9+ "green" ,
10+ "orange" ,
11+ "yellow" ,
12+ "red" ,
13+ "purple" ,
14+ "white" ,
15+ "surface" ,
16+ "white-destructive" ,
17+ "surface-destructive" ,
18+ ] as const ;
19+ const BADGE_SHAPES = [ "rounded" , "pill" ] as const ;
20+ const BADGE_SIZES = [ "xs" , "sm" , "md" , "lg" ] as const ;
21+ const BADGE_VARIANTS = [ "solid" , "outline" ] as const ;
22+
23+ type BadgeSize = ( typeof BADGE_SIZES ) [ number ] ;
24+ type BadgeShape = ( typeof BADGE_SHAPES ) [ number ] ;
25+ type BadgeVariant = ( typeof BADGE_VARIANTS ) [ number ] ;
26+ type BadgeColor = ( typeof BADGE_COLORS ) [ number ] ;
2127
2228const sizeVariants : Record < BadgeSize , string > = {
2329 lg : 'gap-1 py-1 pl-2.5 pr-2.5 [&_svg]:size-3.5 text-sm tracking-[-0.1px] data-[shape="rounded"]:rounded-[8px]' ,
@@ -170,5 +176,13 @@ const Badge = ({
170176 return < span { ...commonProps } > { content } </ span > ;
171177} ;
172178
173- export { Badge } ;
179+ export {
180+ Badge ,
181+ BADGE_COLORS ,
182+ BADGE_SHAPES ,
183+ BADGE_SIZES ,
184+ BADGE_VARIANTS ,
185+ colorVariants ,
186+ sizeVariants ,
187+ } ;
174188export type { BadgeSize , BadgeProps , BadgeShape , BadgeVariant , BadgeColor } ;
0 commit comments