forked from Weaverse/pilot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Weaverse:main' into main
- Loading branch information
Showing
11 changed files
with
394 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,27 @@ | ||
import { Check } from "@phosphor-icons/react"; | ||
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; | ||
import * as React from "react"; | ||
import { cn } from "~/lib/cn"; | ||
import { IconCheck } from "./icons"; | ||
|
||
interface CheckboxProps | ||
extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> { | ||
label?: string; | ||
label?: React.ReactNode; | ||
} | ||
|
||
const Checkbox = React.forwardRef< | ||
export let Checkbox = React.forwardRef< | ||
React.ElementRef<typeof CheckboxPrimitive.Root>, | ||
CheckboxProps | ||
>(({ className, label, ...props }, ref) => ( | ||
<div className={cn("flex items-center space-x-2.5", className)}> | ||
<div className={cn("flex items-center gap-2.5", className)}> | ||
<CheckboxPrimitive.Root | ||
ref={ref} | ||
className={cn( | ||
"peer w-5 h-5 shrink-0 border ring-offset-background focus-visible:outline-none focus-visible:ring focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-background data-[state=checked]:text-body", | ||
)} | ||
className="w-5 h-5 shrink-0 border border-line focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50" | ||
{...props} | ||
> | ||
<CheckboxPrimitive.Indicator | ||
className={cn("flex items-center justify-center text-current")} | ||
> | ||
<IconCheck className="h-3 w-3" /> | ||
<CheckboxPrimitive.Indicator className="flex items-center justify-center text-current"> | ||
<Check weight="bold" className="h-3 w-3" /> | ||
</CheckboxPrimitive.Indicator> | ||
</CheckboxPrimitive.Root> | ||
{label ? <span>{label}</span> : null} | ||
{label ? typeof label === "string" ? <span>{label}</span> : label : null} | ||
</div> | ||
)); | ||
Checkbox.displayName = CheckboxPrimitive.Root.displayName; | ||
|
||
export { Checkbox }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.