Skip to content

Commit 680a723

Browse files
committed
Work on tailwind prefixing
1 parent d629808 commit 680a723

14 files changed

+476
-427
lines changed

components.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"css": "src/index.css",
99
"baseColor": "neutral",
1010
"cssVariables": true,
11-
"prefix": ""
11+
"prefix": "rfs-"
1212
},
1313
"aliases": {
1414
"components": "@/components",

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
"@elastic/react-search-ui-views": "^1.22.0",
3131
"@elastic/search-ui": "^1.22.0",
3232
"@elastic/search-ui-elasticsearch-connector": "^1.22.0",
33-
"@radix-ui/react-checkbox": "^1.1.2",
33+
"@radix-ui/react-checkbox": "^1.1.3",
3434
"@radix-ui/react-dialog": "^1.1.4",
35-
"@radix-ui/react-dropdown-menu": "^2.1.2",
36-
"@radix-ui/react-label": "^2.1.0",
37-
"@radix-ui/react-popover": "^1.1.2",
38-
"@radix-ui/react-select": "^2.1.2",
39-
"@radix-ui/react-slot": "^1.1.0",
35+
"@radix-ui/react-dropdown-menu": "^2.1.4",
36+
"@radix-ui/react-label": "^2.1.1",
37+
"@radix-ui/react-popover": "^1.1.4",
38+
"@radix-ui/react-select": "^2.1.4",
39+
"@radix-ui/react-slot": "^1.1.1",
4040
"@types/luxon": "^3.4.2",
4141
"@xyflow/react": "^12.3.6",
4242
"class-variance-authority": "^0.7.1",

src/components/ui/badge.tsx

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
import { cn } from "@/lib/utils"
1+
import * as React from "react"
22
import { cva, type VariantProps } from "class-variance-authority"
33

4-
import * as React from "react"
4+
import { cn } from "@/lib/utils"
55

66
const badgeVariants = cva(
7-
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8-
{
9-
variants: {
10-
variant: {
11-
default:
12-
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13-
secondary:
14-
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15-
destructive:
16-
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
17-
outline: "text-foreground"
18-
}
19-
},
20-
defaultVariants: {
21-
variant: "default"
22-
}
23-
}
7+
"rfs-inline-flex rfs-items-center rfs-rounded-full rfs-border rfs-px-2.5 rfs-py-0.5 rfs-text-xs rfs-font-semibold rfs-transition-colors focus:rfs-outline-none focus:rfs-ring-2 focus:rfs-ring-ring focus:rfs-ring-offset-2",
8+
{
9+
variants: {
10+
variant: {
11+
default:
12+
"rfs-border-transparent rfs-bg-primary rfs-text-primary-foreground hover:rfs-bg-primary/80",
13+
secondary:
14+
"rfs-border-transparent rfs-bg-secondary rfs-text-secondary-foreground hover:rfs-bg-secondary/80",
15+
destructive:
16+
"rfs-border-transparent rfs-bg-destructive rfs-text-destructive-foreground hover:rfs-bg-destructive/80",
17+
outline: "rfs-text-foreground",
18+
},
19+
},
20+
defaultVariants: {
21+
variant: "default",
22+
},
23+
}
2424
)
2525

2626
export interface BadgeProps
27-
extends React.HTMLAttributes<HTMLDivElement>,
28-
VariantProps<typeof badgeVariants> {}
27+
extends React.HTMLAttributes<HTMLDivElement>,
28+
VariantProps<typeof badgeVariants> {}
2929

3030
function Badge({ className, variant, ...props }: BadgeProps) {
31-
return <div className={cn(badgeVariants({ variant }), className)} {...props} />
31+
return (
32+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
33+
)
3234
}
3335

3436
export { Badge, badgeVariants }

src/components/ui/button.tsx

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,55 @@
1-
import { cn } from "@/lib/utils"
1+
import * as React from "react"
22
import { Slot } from "@radix-ui/react-slot"
33
import { cva, type VariantProps } from "class-variance-authority"
44

5-
import * as React from "react"
5+
import { cn } from "@/lib/utils"
66

77
const buttonVariants = cva(
8-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9-
{
10-
variants: {
11-
variant: {
12-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
13-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14-
outline:
15-
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
16-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
17-
ghost: "hover:bg-accent hover:text-accent-foreground",
18-
link: "text-primary underline-offset-4 hover:underline"
19-
},
20-
size: {
21-
default: "h-10 px-4 py-2",
22-
sm: "h-9 rounded-md px-3",
23-
lg: "h-11 rounded-md px-8",
24-
icon: "size-10"
25-
}
26-
},
27-
defaultVariants: {
28-
variant: "default",
29-
size: "default"
30-
}
31-
}
8+
"rfs-inline-flex rfs-items-center rfs-justify-center rfs-gap-2 rfs-whitespace-nowrap rfs-rounded-md rfs-text-sm rfs-font-medium rfs-ring-offset-background rfs-transition-colors focus-visible:rfs-outline-none focus-visible:rfs-ring-2 focus-visible:rfs-ring-ring focus-visible:rfs-ring-offset-2 disabled:rfs-pointer-events-none disabled:rfs-opacity-50 [&_svg]:rfs-pointer-events-none [&_svg]:rfs-size-4 [&_svg]:rfs-shrink-0",
9+
{
10+
variants: {
11+
variant: {
12+
default: "rfs-bg-primary rfs-text-primary-foreground hover:rfs-bg-primary/90",
13+
destructive:
14+
"rfs-bg-destructive rfs-text-destructive-foreground hover:rfs-bg-destructive/90",
15+
outline:
16+
"rfs-border rfs-border-input rfs-bg-background hover:rfs-bg-accent hover:rfs-text-accent-foreground",
17+
secondary:
18+
"rfs-bg-secondary rfs-text-secondary-foreground hover:rfs-bg-secondary/80",
19+
ghost: "hover:rfs-bg-accent hover:rfs-text-accent-foreground",
20+
link: "rfs-text-primary rfs-underline-offset-4 hover:rfs-underline",
21+
},
22+
size: {
23+
default: "rfs-h-10 rfs-px-4 rfs-py-2",
24+
sm: "rfs-h-9 rfs-rounded-md rfs-px-3",
25+
lg: "rfs-h-11 rfs-rounded-md rfs-px-8",
26+
icon: "rfs-h-10 rfs-w-10",
27+
},
28+
},
29+
defaultVariants: {
30+
variant: "default",
31+
size: "default",
32+
},
33+
}
3234
)
3335

3436
export interface ButtonProps
35-
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
36-
VariantProps<typeof buttonVariants> {
37-
asChild?: boolean
37+
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38+
VariantProps<typeof buttonVariants> {
39+
asChild?: boolean
3840
}
3941

4042
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
41-
({ className, variant, size, asChild = false, ...props }, ref) => {
42-
const Comp = asChild ? Slot : "button"
43-
return (
44-
<Comp
45-
className={cn(buttonVariants({ variant, size, className }))}
46-
ref={ref}
47-
{...props}
48-
/>
49-
)
50-
}
43+
({ className, variant, size, asChild = false, ...props }, ref) => {
44+
const Comp = asChild ? Slot : "button"
45+
return (
46+
<Comp
47+
className={cn(buttonVariants({ variant, size, className }))}
48+
ref={ref}
49+
{...props}
50+
/>
51+
)
52+
}
5153
)
5254
Button.displayName = "Button"
5355

src/components/ui/checkbox.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import { cn } from "@/lib/utils"
1+
import * as React from "react"
22
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
33
import { Check } from "lucide-react"
44

5-
import * as React from "react"
5+
import { cn } from "@/lib/utils"
66

77
const Checkbox = React.forwardRef<
8-
React.ElementRef<typeof CheckboxPrimitive.Root>,
9-
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
8+
React.ElementRef<typeof CheckboxPrimitive.Root>,
9+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
1010
>(({ className, ...props }, ref) => (
11-
<CheckboxPrimitive.Root
12-
ref={ref}
13-
className={cn(
14-
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
15-
className
16-
)}
17-
{...props}
11+
<CheckboxPrimitive.Root
12+
ref={ref}
13+
className={cn(
14+
"rfs-peer rfs-h-4 rfs-w-4 rfs-shrink-0 rfs-rounded-sm rfs-border rfs-border-primary rfs-ring-offset-background focus-visible:rfs-outline-none focus-visible:rfs-ring-2 focus-visible:rfs-ring-ring focus-visible:rfs-ring-offset-2 disabled:rfs-cursor-not-allowed disabled:rfs-opacity-50 data-[state=checked]:rfs-bg-primary data-[state=checked]:rfs-text-primary-foreground",
15+
className
16+
)}
17+
{...props}
18+
>
19+
<CheckboxPrimitive.Indicator
20+
className={cn("rfs-flex rfs-items-center rfs-justify-center rfs-text-current")}
1821
>
19-
<CheckboxPrimitive.Indicator
20-
className={cn("flex items-center justify-center text-current")}
21-
>
22-
<Check className="size-4" />
23-
</CheckboxPrimitive.Indicator>
24-
</CheckboxPrimitive.Root>
22+
<Check className="rfs-h-4 rfs-w-4" />
23+
</CheckboxPrimitive.Indicator>
24+
</CheckboxPrimitive.Root>
2525
))
2626
Checkbox.displayName = CheckboxPrimitive.Root.displayName
2727

0 commit comments

Comments
 (0)