Skip to content

Commit 02cb06e

Browse files
fix: adjusted class names in badge variants
1 parent eca5fdd commit 02cb06e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

apps/ui/public/r/badge.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"files": [
99
{
1010
"path": "registry/default/ui/badge.tsx",
11-
"content": "\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@/registry/default/lib/utils\";\n\nconst badgeVariants = cva(\n \"relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button,a&]:cursor-pointer [button,a&]:pointer-coarse:after:absolute [button,a&]:pointer-coarse:after:size-full [button,a&]:pointer-coarse:after:min-h-11 [button,a&]:pointer-coarse:after:min-w-11\",\n {\n defaultVariants: {\n size: \"default\",\n variant: \"default\",\n },\n variants: {\n size: {\n default:\n \"h-5.5 min-w-5.5 px-[calc(--spacing(1)-1px)] text-sm sm:h-4.5 sm:min-w-4.5 sm:text-xs\",\n lg: \"h-6.5 min-w-6.5 px-[calc(--spacing(1.5)-1px)] text-base sm:h-5.5 sm:min-w-5.5 sm:text-sm\",\n sm: \"h-5 min-w-5 rounded-[calc(var(--radius-sm)-2px)] px-[calc(--spacing(1)-1px)] text-xs sm:h-4 sm:min-w-4 sm:text-[.625rem]\",\n },\n variant: {\n default:\n \"bg-primary text-primary-foreground [button,a&]:hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-white [button,a&]:hover:bg-destructive/90\",\n error:\n \"bg-destructive/8 text-destructive-foreground dark:bg-destructive/16\",\n info: \"bg-info/8 text-info-foreground dark:bg-info/16\",\n outline:\n \"border-input bg-background text-foreground dark:bg-input/32 [button,a&]:hover:bg-accent/50 dark:[button,a&]:hover:bg-input/48\",\n secondary:\n \"bg-secondary text-secondary-foreground [button,a&]:hover:bg-secondary/90\",\n success: \"bg-success/8 text-success-foreground dark:bg-success/16\",\n warning: \"bg-warning/8 text-warning-foreground dark:bg-warning/16\",\n },\n },\n },\n);\n\ninterface BadgeProps extends useRender.ComponentProps<\"span\"> {\n variant?: VariantProps<typeof badgeVariants>[\"variant\"];\n size?: VariantProps<typeof badgeVariants>[\"size\"];\n}\n\nfunction Badge({ className, variant, size, render, ...props }: BadgeProps) {\n const defaultProps = {\n className: cn(badgeVariants({ className, size, variant })),\n \"data-slot\": \"badge\",\n };\n\n return useRender({\n defaultTagName: \"span\",\n props: mergeProps<\"span\">(defaultProps, props),\n render,\n });\n}\n\nexport { Badge, badgeVariants };\n",
11+
"content": "\"use client\";\n\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@/registry/default/lib/utils\";\n\nconst badgeVariants = cva(\n \"relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button&,a&]:cursor-pointer [button&,a&]:pointer-coarse:after:absolute [button&,a&]:pointer-coarse:after:size-full [button&,a&]:pointer-coarse:after:min-h-11 [button&,a&]:pointer-coarse:after:min-w-11\",\n {\n defaultVariants: {\n size: \"default\",\n variant: \"default\",\n },\n variants: {\n size: {\n default:\n \"h-5.5 min-w-5.5 px-[calc(--spacing(1)-1px)] text-sm sm:h-4.5 sm:min-w-4.5 sm:text-xs\",\n lg: \"h-6.5 min-w-6.5 px-[calc(--spacing(1.5)-1px)] text-base sm:h-5.5 sm:min-w-5.5 sm:text-sm\",\n sm: \"h-5 min-w-5 rounded-[calc(var(--radius-sm)-2px)] px-[calc(--spacing(1)-1px)] text-xs sm:h-4 sm:min-w-4 sm:text-[.625rem]\",\n },\n variant: {\n default:\n \"bg-primary text-primary-foreground [button&,a&]:hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-white [button&,a&]:hover:bg-destructive/90\",\n error:\n \"bg-destructive/8 text-destructive-foreground dark:bg-destructive/16\",\n info: \"bg-info/8 text-info-foreground dark:bg-info/16\",\n outline:\n \"border-input bg-background text-foreground dark:bg-input/32 [button&,a&]:hover:bg-accent/50 dark:[button&,a&]:hover:bg-input/48\",\n secondary:\n \"bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90\",\n success: \"bg-success/8 text-success-foreground dark:bg-success/16\",\n warning: \"bg-warning/8 text-warning-foreground dark:bg-warning/16\",\n },\n },\n },\n);\n\ninterface BadgeProps extends useRender.ComponentProps<\"span\"> {\n variant?: VariantProps<typeof badgeVariants>[\"variant\"];\n size?: VariantProps<typeof badgeVariants>[\"size\"];\n}\n\nfunction Badge({ className, variant, size, render, ...props }: BadgeProps) {\n const defaultProps = {\n className: cn(badgeVariants({ className, size, variant })),\n \"data-slot\": \"badge\",\n };\n\n return useRender({\n defaultTagName: \"span\",\n props: mergeProps<\"span\">(defaultProps, props),\n render,\n });\n}\n\nexport { Badge, badgeVariants };\n",
1212
"type": "registry:ui"
1313
}
1414
],

apps/ui/registry/default/ui/badge.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { cva, type VariantProps } from "class-variance-authority";
77
import { cn } from "@/registry/default/lib/utils";
88

99
const badgeVariants = cva(
10-
"relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button,a&]:cursor-pointer [button,a&]:pointer-coarse:after:absolute [button,a&]:pointer-coarse:after:size-full [button,a&]:pointer-coarse:after:min-h-11 [button,a&]:pointer-coarse:after:min-w-11",
10+
"relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button&,a&]:cursor-pointer [button&,a&]:pointer-coarse:after:absolute [button&,a&]:pointer-coarse:after:size-full [button&,a&]:pointer-coarse:after:min-h-11 [button&,a&]:pointer-coarse:after:min-w-11",
1111
{
1212
defaultVariants: {
1313
size: "default",
@@ -22,16 +22,16 @@ const badgeVariants = cva(
2222
},
2323
variant: {
2424
default:
25-
"bg-primary text-primary-foreground [button,a&]:hover:bg-primary/90",
25+
"bg-primary text-primary-foreground [button&,a&]:hover:bg-primary/90",
2626
destructive:
27-
"bg-destructive text-white [button,a&]:hover:bg-destructive/90",
27+
"bg-destructive text-white [button&,a&]:hover:bg-destructive/90",
2828
error:
2929
"bg-destructive/8 text-destructive-foreground dark:bg-destructive/16",
3030
info: "bg-info/8 text-info-foreground dark:bg-info/16",
3131
outline:
32-
"border-input bg-background text-foreground dark:bg-input/32 [button,a&]:hover:bg-accent/50 dark:[button,a&]:hover:bg-input/48",
32+
"border-input bg-background text-foreground dark:bg-input/32 [button&,a&]:hover:bg-accent/50 dark:[button&,a&]:hover:bg-input/48",
3333
secondary:
34-
"bg-secondary text-secondary-foreground [button,a&]:hover:bg-secondary/90",
34+
"bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90",
3535
success: "bg-success/8 text-success-foreground dark:bg-success/16",
3636
warning: "bg-warning/8 text-warning-foreground dark:bg-warning/16",
3737
},

packages/ui/src/components/badge.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { cva, type VariantProps } from "class-variance-authority";
77
import { cn } from "@coss/ui/lib/utils";
88

99
const badgeVariants = cva(
10-
"relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button,a&]:cursor-pointer [button,a&]:pointer-coarse:after:absolute [button,a&]:pointer-coarse:after:size-full [button,a&]:pointer-coarse:after:min-h-11 [button,a&]:pointer-coarse:after:min-w-11",
10+
"relative inline-flex shrink-0 items-center justify-center gap-1 whitespace-nowrap rounded-sm border border-transparent font-medium outline-none transition-shadow focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-3.5 sm:[&_svg:not([class*='size-'])]:size-3 [&_svg]:pointer-events-none [&_svg]:shrink-0 [button&,a&]:cursor-pointer [button&,a&]:pointer-coarse:after:absolute [button&,a&]:pointer-coarse:after:size-full [button&,a&]:pointer-coarse:after:min-h-11 [button&,a&]:pointer-coarse:after:min-w-11",
1111
{
1212
defaultVariants: {
1313
size: "default",
@@ -22,16 +22,16 @@ const badgeVariants = cva(
2222
},
2323
variant: {
2424
default:
25-
"bg-primary text-primary-foreground [button,a&]:hover:bg-primary/90",
25+
"bg-primary text-primary-foreground [button&,a&]:hover:bg-primary/90",
2626
destructive:
27-
"bg-destructive text-white [button,a&]:hover:bg-destructive/90",
27+
"bg-destructive text-white [button&,a&]:hover:bg-destructive/90",
2828
error:
2929
"bg-destructive/8 text-destructive-foreground dark:bg-destructive/16",
3030
info: "bg-info/8 text-info-foreground dark:bg-info/16",
3131
outline:
32-
"border-input bg-background text-foreground dark:bg-input/32 [button,a&]:hover:bg-accent/50 dark:[button,a&]:hover:bg-input/48",
32+
"border-input bg-background text-foreground dark:bg-input/32 [button&,a&]:hover:bg-accent/50 dark:[button&,a&]:hover:bg-input/48",
3333
secondary:
34-
"bg-secondary text-secondary-foreground [button,a&]:hover:bg-secondary/90",
34+
"bg-secondary text-secondary-foreground [button&,a&]:hover:bg-secondary/90",
3535
success: "bg-success/8 text-success-foreground dark:bg-success/16",
3636
warning: "bg-warning/8 text-warning-foreground dark:bg-warning/16",
3737
},

0 commit comments

Comments
 (0)