← All changes
|
backend/views/components/Analytics/components/ui/badge.jsx
+41
-43
1.4.13
→
1.4.21
View file →
| @@ -1,49 +1,47 @@ | ||
| 1 | -import { mergeProps } from "@base-ui/react/merge-props" | |
| 2 | -import { useRender } from "@base-ui/react/use-render" | |
| 3 | -import { cva } from "class-variance-authority"; | |
| 1 | +import { mergeProps } from '@base-ui/react/merge-props'; | |
| 2 | +import { useRender } from '@base-ui/react/use-render'; | |
| 3 | +import { cva } from 'class-variance-authority'; | |
| 4 | 4 | |
| 5 | -import { cn } from "@/lib/utils" | |
| 5 | +import { cn } from '@/lib/utils'; | |
| 6 | 6 | |
| 7 | 7 | const badgeVariants = cva( |
| 8 | - "disco-group/badge disco-inline-flex disco-h-5 disco-w-fit disco-shrink-0 disco-items-center disco-justify-center disco-gap-1 disco-overflow-hidden disco-rounded-4xl disco-border disco-border-transparent disco-px-2 disco-py-0.5 disco-text-xs disco-font-medium disco-whitespace-nowrap disco-transition-all focus-visible:disco-border-ring focus-visible:disco-ring-[3px] focus-visible:disco-ring-ring/50 has-data-[icon=inline-end]:disco-pr-1.5 has-data-[icon=inline-start]:disco-pl-1.5 aria-invalid:disco-border-destructive aria-invalid:disco-ring-destructive/20 dark:aria-invalid:disco-ring-destructive/40 [&>svg]:disco-pointer-events-none [&>svg]:disco-size-3!", | |
| 9 | - { | |
| 10 | - variants: { | |
| 11 | - variant: { | |
| 12 | - default: "disco-bg-primary disco-text-primary-foreground [a]:hover:disco-bg-primary/80", | |
| 13 | - secondary: | |
| 14 | - "disco-bg-secondary disco-text-secondary-foreground [a]:hover:disco-bg-secondary/80", | |
| 15 | - destructive: | |
| 16 | - "disco-bg-destructive/10 disco-text-destructive focus-visible:disco-ring-destructive/20 dark:disco-bg-destructive/20 dark:focus-visible:disco-ring-destructive/40 [a]:hover:disco-bg-destructive/20", | |
| 17 | - outline: | |
| 18 | - "disco-border-border disco-text-foreground [a]:hover:disco-bg-muted [a]:hover:disco-text-muted-foreground", | |
| 19 | - ghost: | |
| 20 | - "hover:disco-bg-muted hover:disco-text-muted-foreground dark:hover:disco-bg-muted/50", | |
| 21 | - link: "disco-text-primary disco-underline-offset-4 hover:disco-underline", | |
| 22 | - }, | |
| 23 | - }, | |
| 24 | - defaultVariants: { | |
| 25 | - variant: "default", | |
| 26 | - }, | |
| 27 | - } | |
| 28 | -) | |
| 8 | + 'disco:group/badge disco:inline-flex disco:h-5 disco:w-fit disco:shrink-0 disco:items-center disco:justify-center disco:gap-1 disco:overflow-hidden disco:rounded-4xl disco:border disco:border-transparent disco:px-2 disco:py-0.5 disco:text-xs disco:font-medium disco:whitespace-nowrap disco:transition-all disco:focus-visible:border-ring disco:focus-visible:ring-[3px] disco:focus-visible:ring-ring/50 disco:has-data-[icon=inline-end]:pr-1.5 disco:has-data-[icon=inline-start]:pl-1.5 disco:aria-invalid:border-destructive disco:aria-invalid:ring-destructive/20 disco:dark:aria-invalid:ring-destructive/40 disco:[&>svg]:pointer-events-none disco:[&>svg]:size-3!', | |
| 9 | + { | |
| 10 | + variants: { | |
| 11 | + variant: { | |
| 12 | + default: | |
| 13 | + ' disco:text-primary-foreground disco:[a]:hover:bg-primary/80', | |
| 14 | + secondary: | |
| 15 | + 'disco:bg-secondary disco:text-secondary-foreground disco:[a]:hover:bg-secondary/80', | |
| 16 | + destructive: | |
| 17 | + 'disco:bg-destructive/10 disco:text-destructive disco:focus-visible:ring-destructive/20 disco:dark:bg-destructive/20 disco:dark:focus-visible:ring-destructive/40 disco:[a]:hover:bg-destructive/20', | |
| 18 | + outline: | |
| 19 | + 'disco:border-border disco:text-foreground disco:[a]:hover:bg-muted disco:[a]:hover:text-muted-foreground', | |
| 20 | + ghost: 'disco:hover:bg-muted disco:hover:text-muted-foreground disco:dark:hover:bg-muted/50', | |
| 21 | + link: 'disco:text-primary disco:underline-offset-4 disco:hover:underline', | |
| 22 | + }, | |
| 23 | + }, | |
| 24 | + defaultVariants: { | |
| 25 | + variant: 'default', | |
| 26 | + }, | |
| 27 | + } | |
| 28 | +); | |
| 29 | 29 | |
| 30 | -function Badge({ | |
| 31 | - className, | |
| 32 | - variant = "default", | |
| 33 | - render, | |
| 34 | - ...props | |
| 35 | -}) { | |
| 36 | - return useRender({ | |
| 37 | - defaultTagName: "span", | |
| 38 | - props: mergeProps({ | |
| 39 | - className: cn(badgeVariants({ variant }), className), | |
| 40 | - }, props), | |
| 41 | - render, | |
| 42 | - state: { | |
| 43 | - slot: "badge", | |
| 44 | - variant, | |
| 45 | - }, | |
| 46 | - }); | |
| 30 | +function Badge({ className, variant = 'default', render, ...props }) { | |
| 31 | + return useRender({ | |
| 32 | + defaultTagName: 'span', | |
| 33 | + props: mergeProps( | |
| 34 | + { | |
| 35 | + className: cn(badgeVariants({ variant }), className), | |
| 36 | + }, | |
| 37 | + props | |
| 38 | + ), | |
| 39 | + render, | |
| 40 | + state: { | |
| 41 | + slot: 'badge', | |
| 42 | + variant, | |
| 43 | + }, | |
| 44 | + }); | |
| 47 | 45 | } |
| 48 | 46 | |
| 49 | -export { Badge, badgeVariants } | |
| 47 | +export { Badge, badgeVariants }; | |