Skip to content

Commit ce065f2

Browse files
committed
chore: Formatting
1 parent 7d9262f commit ce065f2

File tree

10 files changed

+125
-184
lines changed

10 files changed

+125
-184
lines changed

eslint.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const config: any[] = [
1818
"**/releases/**",
1919
"packages/styles/dist.css",
2020
"packages/angular/**",
21+
"packages/shadcn/public",
2122
]),
2223
...tseslint.configs.recommended,
2324
{
@@ -33,7 +34,7 @@ const config: any[] = [
3334
},
3435
{
3536
// React package specific rules
36-
files: ["packages/react/src/**/*.{ts,tsx}"],
37+
files: ["packages/react/src/**/*.{ts,tsx}", "packages/shadcn/src/**/*.{ts,tsx}"],
3738
plugins: { react: pluginReact, "react-hooks": pluginReactHooks },
3839
languageOptions: {
3940
parserOptions: {

packages/shadcn/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
## Building the registry
44

5-
To build the registry, run the `build` script:
5+
To build the registry, run the `registry:build` script:
66

77
```
8-
pnpm build
8+
pnpm registry:build
99
```
1010

1111
Note, the script run (`build.ts`) expects a domain, which replaces the `{{ DOMAIN }}` field within the

packages/shadcn/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsx build.ts https://ui.firebase.com",
8+
"registry:build": "tsx build.ts https://ui.firebase.com",
99
"lint": "eslint .",
1010
"preview": "vite preview"
1111
},
Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as React from "react"
2-
import { Slot } from "@radix-ui/react-slot"
3-
import { cva, type VariantProps } from "class-variance-authority"
1+
import * as React from "react";
2+
import { Slot } from "@radix-ui/react-slot";
3+
import { cva, type VariantProps } from "class-variance-authority";
44

5-
import { cn } from "@/lib/utils"
5+
import { cn } from "@/lib/utils";
66

77
const buttonVariants = cva(
88
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
@@ -14,10 +14,8 @@ const buttonVariants = cva(
1414
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
1515
outline:
1616
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
17-
secondary:
18-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
19-
ghost:
20-
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
17+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
18+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
2119
link: "text-primary underline-offset-4 hover:underline",
2220
},
2321
size: {
@@ -34,7 +32,7 @@ const buttonVariants = cva(
3432
size: "default",
3533
},
3634
}
37-
)
35+
);
3836

3937
function Button({
4038
className,
@@ -44,17 +42,11 @@ function Button({
4442
...props
4543
}: React.ComponentProps<"button"> &
4644
VariantProps<typeof buttonVariants> & {
47-
asChild?: boolean
45+
asChild?: boolean;
4846
}) {
49-
const Comp = asChild ? Slot : "button"
47+
const Comp = asChild ? Slot : "button";
5048

51-
return (
52-
<Comp
53-
data-slot="button"
54-
className={cn(buttonVariants({ variant, size, className }))}
55-
{...props}
56-
/>
57-
)
49+
return <Comp data-slot="button" className={cn(buttonVariants({ variant, size, className }))} {...props} />;
5850
}
5951

60-
export { Button, buttonVariants }
52+
export { Button, buttonVariants };
Lines changed: 48 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { useMemo } from "react"
2-
import { cva, type VariantProps } from "class-variance-authority"
1+
import { useMemo } from "react";
2+
import { cva, type VariantProps } from "class-variance-authority";
33

4-
import { cn } from "@/lib/utils"
5-
import { Label } from "@/components/ui/label"
6-
import { Separator } from "@/components/ui/separator"
4+
import { cn } from "@/lib/utils";
5+
import { Label } from "@/components/ui/label";
6+
import { Separator } from "@/components/ui/separator";
77

88
function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
99
return (
@@ -16,7 +16,7 @@ function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
1616
)}
1717
{...props}
1818
/>
19-
)
19+
);
2020
}
2121

2222
function FieldLegend({
@@ -28,15 +28,10 @@ function FieldLegend({
2828
<legend
2929
data-slot="field-legend"
3030
data-variant={variant}
31-
className={cn(
32-
"mb-3 font-medium",
33-
"data-[variant=legend]:text-base",
34-
"data-[variant=label]:text-sm",
35-
className
36-
)}
31+
className={cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className)}
3732
{...props}
3833
/>
39-
)
34+
);
4035
}
4136

4237
function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
@@ -49,32 +44,29 @@ function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
4944
)}
5045
{...props}
5146
/>
52-
)
47+
);
5348
}
5449

55-
const fieldVariants = cva(
56-
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
57-
{
58-
variants: {
59-
orientation: {
60-
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
61-
horizontal: [
62-
"flex-row items-center",
63-
"[&>[data-slot=field-label]]:flex-auto",
64-
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
65-
],
66-
responsive: [
67-
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
68-
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
69-
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
70-
],
71-
},
72-
},
73-
defaultVariants: {
74-
orientation: "vertical",
50+
const fieldVariants = cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
51+
variants: {
52+
orientation: {
53+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
54+
horizontal: [
55+
"flex-row items-center",
56+
"[&>[data-slot=field-label]]:flex-auto",
57+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
58+
],
59+
responsive: [
60+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
61+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
62+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
63+
],
7564
},
76-
}
77-
)
65+
},
66+
defaultVariants: {
67+
orientation: "vertical",
68+
},
69+
});
7870

7971
function Field({
8072
className,
@@ -89,26 +81,20 @@ function Field({
8981
className={cn(fieldVariants({ orientation }), className)}
9082
{...props}
9183
/>
92-
)
84+
);
9385
}
9486

9587
function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
9688
return (
9789
<div
9890
data-slot="field-content"
99-
className={cn(
100-
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
101-
className
102-
)}
91+
className={cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className)}
10392
{...props}
10493
/>
105-
)
94+
);
10695
}
10796

108-
function FieldLabel({
109-
className,
110-
...props
111-
}: React.ComponentProps<typeof Label>) {
97+
function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {
11298
return (
11399
<Label
114100
data-slot="field-label"
@@ -120,7 +106,7 @@ function FieldLabel({
120106
)}
121107
{...props}
122108
/>
123-
)
109+
);
124110
}
125111

126112
function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
@@ -133,7 +119,7 @@ function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
133119
)}
134120
{...props}
135121
/>
136-
)
122+
);
137123
}
138124

139125
function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
@@ -148,24 +134,21 @@ function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
148134
)}
149135
{...props}
150136
/>
151-
)
137+
);
152138
}
153139

154140
function FieldSeparator({
155141
children,
156142
className,
157143
...props
158144
}: React.ComponentProps<"div"> & {
159-
children?: React.ReactNode
145+
children?: React.ReactNode;
160146
}) {
161147
return (
162148
<div
163149
data-slot="field-separator"
164150
data-content={!!children}
165-
className={cn(
166-
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
167-
className
168-
)}
151+
className={cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className)}
169152
{...props}
170153
>
171154
<Separator className="absolute inset-0 top-1/2" />
@@ -178,7 +161,7 @@ function FieldSeparator({
178161
</span>
179162
)}
180163
</div>
181-
)
164+
);
182165
}
183166

184167
function FieldError({
@@ -187,33 +170,30 @@ function FieldError({
187170
errors,
188171
...props
189172
}: React.ComponentProps<"div"> & {
190-
errors?: Array<{ message?: string } | undefined>
173+
errors?: Array<{ message?: string } | undefined>;
191174
}) {
192175
const content = useMemo(() => {
193176
if (children) {
194-
return children
177+
return children;
195178
}
196179

197180
if (!errors) {
198-
return null
181+
return null;
199182
}
200183

201184
if (errors?.length === 1 && errors[0]?.message) {
202-
return errors[0].message
185+
return errors[0].message;
203186
}
204187

205188
return (
206189
<ul className="ml-4 flex list-disc flex-col gap-1">
207-
{errors.map(
208-
(error, index) =>
209-
error?.message && <li key={index}>{error.message}</li>
210-
)}
190+
{errors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}
211191
</ul>
212-
)
213-
}, [children, errors])
192+
);
193+
}, [children, errors]);
214194

215195
if (!content) {
216-
return null
196+
return null;
217197
}
218198

219199
return (
@@ -225,7 +205,7 @@ function FieldError({
225205
>
226206
{content}
227207
</div>
228-
)
208+
);
229209
}
230210

231211
export {
@@ -239,4 +219,4 @@ export {
239219
FieldSet,
240220
FieldContent,
241221
FieldTitle,
242-
}
222+
};

0 commit comments

Comments
 (0)