@quarklab/rad-ui 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -7
- package/package.json +3 -5
- package/templates/web/aspect-ratio.tsx +0 -5
- package/templates/web/avatar.tsx +0 -47
- package/templates/web/badge.tsx +0 -35
- package/templates/web/button.tsx +0 -54
- package/templates/web/checkbox.tsx +0 -34
- package/templates/web/field.tsx +0 -291
- package/templates/web/input-group.tsx +0 -209
- package/templates/web/input-otp.tsx +0 -85
- package/templates/web/input.tsx +0 -103
- package/templates/web/kbd.tsx +0 -37
- package/templates/web/label.tsx +0 -23
- package/templates/web/lib/utils.ts +0 -7
- package/templates/web/native-select.tsx +0 -71
- package/templates/web/radio-group.tsx +0 -43
- package/templates/web/separator.tsx +0 -29
- package/templates/web/skeleton.tsx +0 -15
- package/templates/web/slider.tsx +0 -46
- package/templates/web/spinner.tsx +0 -44
- package/templates/web/switch.tsx +0 -32
- package/templates/web/textarea.tsx +0 -28
- package/templates/web/toggle-group.tsx +0 -58
- package/templates/web/toggle.tsx +0 -45
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Loader } from "lucide-react";
|
|
3
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
4
|
-
import { cn } from "../lib/utils";
|
|
5
|
-
|
|
6
|
-
const spinnerVariants = cva("animate-spin", {
|
|
7
|
-
variants: {
|
|
8
|
-
size: {
|
|
9
|
-
sm: "size-4",
|
|
10
|
-
default: "size-6",
|
|
11
|
-
lg: "size-8",
|
|
12
|
-
xl: "size-12",
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
defaultVariants: {
|
|
16
|
-
size: "default",
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export interface SpinnerProps
|
|
21
|
-
extends React.SVGProps<SVGSVGElement>,
|
|
22
|
-
VariantProps<typeof spinnerVariants> {
|
|
23
|
-
srText?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const Spinner = React.forwardRef<SVGSVGElement, SpinnerProps>(
|
|
27
|
-
({ className, size, srText = "Loading...", ...props }, ref) => {
|
|
28
|
-
return (
|
|
29
|
-
<>
|
|
30
|
-
<Loader
|
|
31
|
-
ref={ref}
|
|
32
|
-
className={cn(spinnerVariants({ size }), className)}
|
|
33
|
-
role="status"
|
|
34
|
-
aria-label={srText}
|
|
35
|
-
{...props}
|
|
36
|
-
/>
|
|
37
|
-
<span className="sr-only">{srText}</span>
|
|
38
|
-
</>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
Spinner.displayName = "Spinner";
|
|
43
|
-
|
|
44
|
-
export { Spinner, spinnerVariants };
|
package/templates/web/switch.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
3
|
-
import { cn } from "../lib/utils";
|
|
4
|
-
|
|
5
|
-
const Switch = React.forwardRef<
|
|
6
|
-
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
7
|
-
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
8
|
-
>(({ className, ...props }, ref) => (
|
|
9
|
-
<SwitchPrimitives.Root
|
|
10
|
-
className={cn(
|
|
11
|
-
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors",
|
|
12
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
13
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
14
|
-
"data-[state=checked]:bg-primary data-[state=unchecked]:bg-gray-200",
|
|
15
|
-
className
|
|
16
|
-
)}
|
|
17
|
-
{...props}
|
|
18
|
-
ref={ref}
|
|
19
|
-
>
|
|
20
|
-
<SwitchPrimitives.Thumb
|
|
21
|
-
className={cn(
|
|
22
|
-
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
23
|
-
"data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
|
|
24
|
-
"rtl:data-[state=checked]:-translate-x-5 rtl:data-[state=unchecked]:translate-x-0"
|
|
25
|
-
)}
|
|
26
|
-
/>
|
|
27
|
-
</SwitchPrimitives.Root>
|
|
28
|
-
));
|
|
29
|
-
|
|
30
|
-
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
31
|
-
|
|
32
|
-
export { Switch };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { cn } from "../lib/utils";
|
|
3
|
-
|
|
4
|
-
export interface TextareaProps
|
|
5
|
-
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
|
6
|
-
|
|
7
|
-
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
8
|
-
({ className, ...props }, ref) => {
|
|
9
|
-
return (
|
|
10
|
-
<textarea
|
|
11
|
-
className={cn(
|
|
12
|
-
"flex min-h-[60px] w-full rounded-md border border-border bg-background px-3 py-2 text-sm shadow-sm transition-colors",
|
|
13
|
-
"placeholder:text-muted-foreground",
|
|
14
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",
|
|
15
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
16
|
-
"resize-y",
|
|
17
|
-
className
|
|
18
|
-
)}
|
|
19
|
-
ref={ref}
|
|
20
|
-
{...props}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
Textarea.displayName = "Textarea";
|
|
27
|
-
|
|
28
|
-
export { Textarea };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
3
|
-
import { type VariantProps } from "class-variance-authority";
|
|
4
|
-
import { cn } from "../lib/utils";
|
|
5
|
-
import { toggleVariants } from "./toggle";
|
|
6
|
-
|
|
7
|
-
const ToggleGroupContext = React.createContext<
|
|
8
|
-
VariantProps<typeof toggleVariants>
|
|
9
|
-
>({
|
|
10
|
-
size: "md",
|
|
11
|
-
variant: "default",
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const ToggleGroup = React.forwardRef<
|
|
15
|
-
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
|
|
16
|
-
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
|
|
17
|
-
VariantProps<typeof toggleVariants>
|
|
18
|
-
>(({ className, variant, size, children, ...props }, ref) => (
|
|
19
|
-
<ToggleGroupPrimitive.Root
|
|
20
|
-
ref={ref}
|
|
21
|
-
className={cn("flex items-center justify-center gap-1", className)}
|
|
22
|
-
{...props}
|
|
23
|
-
>
|
|
24
|
-
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
25
|
-
{children}
|
|
26
|
-
</ToggleGroupContext.Provider>
|
|
27
|
-
</ToggleGroupPrimitive.Root>
|
|
28
|
-
));
|
|
29
|
-
|
|
30
|
-
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
31
|
-
|
|
32
|
-
const ToggleGroupItem = React.forwardRef<
|
|
33
|
-
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
|
|
34
|
-
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
|
|
35
|
-
VariantProps<typeof toggleVariants>
|
|
36
|
-
>(({ className, children, variant, size, ...props }, ref) => {
|
|
37
|
-
const context = React.useContext(ToggleGroupContext);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<ToggleGroupPrimitive.Item
|
|
41
|
-
ref={ref}
|
|
42
|
-
className={cn(
|
|
43
|
-
toggleVariants({
|
|
44
|
-
variant: context.variant || variant,
|
|
45
|
-
size: context.size || size,
|
|
46
|
-
}),
|
|
47
|
-
className
|
|
48
|
-
)}
|
|
49
|
-
{...props}
|
|
50
|
-
>
|
|
51
|
-
{children}
|
|
52
|
-
</ToggleGroupPrimitive.Item>
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
57
|
-
|
|
58
|
-
export { ToggleGroup, ToggleGroupItem };
|
package/templates/web/toggle.tsx
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
3
|
-
import { type VariantProps, cva } from "class-variance-authority";
|
|
4
|
-
import { cn } from "../lib/utils";
|
|
5
|
-
|
|
6
|
-
const toggleVariants = cva(
|
|
7
|
-
"inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: "bg-transparent",
|
|
12
|
-
outline:
|
|
13
|
-
"border border-border bg-transparent hover:bg-muted hover:text-foreground",
|
|
14
|
-
},
|
|
15
|
-
size: {
|
|
16
|
-
sm: "h-9 px-2.5 min-w-9 text-xs",
|
|
17
|
-
md: "h-10 px-3 min-w-10",
|
|
18
|
-
lg: "h-11 px-5 min-w-11 text-base",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
defaultVariants: {
|
|
22
|
-
variant: "default",
|
|
23
|
-
size: "md",
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
export interface ToggleProps
|
|
29
|
-
extends React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root>,
|
|
30
|
-
VariantProps<typeof toggleVariants> {}
|
|
31
|
-
|
|
32
|
-
const Toggle = React.forwardRef<
|
|
33
|
-
React.ElementRef<typeof TogglePrimitive.Root>,
|
|
34
|
-
ToggleProps
|
|
35
|
-
>(({ className, variant, size, ...props }, ref) => (
|
|
36
|
-
<TogglePrimitive.Root
|
|
37
|
-
ref={ref}
|
|
38
|
-
className={cn(toggleVariants({ variant, size, className }))}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
));
|
|
42
|
-
|
|
43
|
-
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
44
|
-
|
|
45
|
-
export { Toggle, toggleVariants };
|