-
-
Notifications
You must be signed in to change notification settings - Fork 45
feat: ✨ add new shadcn components #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
061086b
feat: :sparkles: add base support
Ankan002 802779e
feat: :sparkles: add toggle group and toogle v0 compat
Ankan002 d902313
feat: :sparkles: add tooltip v0 integrations
Ankan002 d2554ab
feat: :sparkles: add sonner v0 integrations
Ankan002 5ce4bba
feat: :sparkles: add popover v0 integrations
Ankan002 a325fee
feat: :sparkles: add popover v0 integrations
Ankan002 0af2a94
fix: :bug: registry issue
Ankan002 41fee80
fix: :bug: registry issue
Ankan002 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| "use client"; | ||
|
|
||
| import * as React from "react"; | ||
| import * as PopoverPrimitive from "@radix-ui/react-popover"; | ||
|
|
||
| import { cn } from "@/lib/utils"; | ||
| import { cva, VariantProps } from "class-variance-authority"; | ||
|
|
||
| const popoverContentVariants = cva( | ||
| "z-50 w-72 rounded-md border bg-primary p-4 text-popover-foreground outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]", | ||
| { | ||
| variants: { | ||
| variant: { | ||
| default: "bg-background", | ||
| primary: "bg-primary", | ||
| }, | ||
| shadow: { | ||
| default: "", | ||
| sm: "shadow-sm", | ||
| md: "shadow-md", | ||
| lg: "shadow-lg", | ||
| }, | ||
| }, | ||
| defaultVariants: { | ||
| variant: "default", | ||
| shadow: "default", | ||
| }, | ||
| }, | ||
| ); | ||
|
|
||
| const Popover = PopoverPrimitive.Root; | ||
|
|
||
| const PopoverTrigger = PopoverPrimitive.Trigger; | ||
|
|
||
| const PopoverAnchor = PopoverPrimitive.Anchor; | ||
|
|
||
| const PopoverContent = React.forwardRef< | ||
| React.ElementRef<typeof PopoverPrimitive.Content>, | ||
| React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> & | ||
| VariantProps<typeof popoverContentVariants> | ||
| >( | ||
| ( | ||
| { | ||
| className, | ||
| align = "center", | ||
| sideOffset = 4, | ||
| variant, | ||
| shadow, | ||
| ...props | ||
| }, | ||
| ref, | ||
| ) => ( | ||
| <PopoverPrimitive.Portal> | ||
| <PopoverPrimitive.Content | ||
| ref={ref} | ||
| align={align} | ||
| sideOffset={sideOffset} | ||
| className={cn( | ||
| popoverContentVariants({ | ||
| variant, | ||
| shadow, | ||
| className, | ||
| }), | ||
| )} | ||
| {...props} | ||
| /> | ||
| </PopoverPrimitive.Portal> | ||
| ), | ||
| ); | ||
| PopoverContent.displayName = PopoverPrimitive.Content.displayName; | ||
|
|
||
| export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }; | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| "use client"; | ||
|
|
||
| import { Toaster as Sonner } from "sonner"; | ||
|
|
||
| type ToasterProps = React.ComponentProps<typeof Sonner>; | ||
Ankan002 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const Toaster = ({ ...props }: ToasterProps) => { | ||
| return ( | ||
| <Sonner | ||
| toastOptions={{ | ||
| classNames: { | ||
| toast: "h-auto w-full p-4 bg-background rounded-md border group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border shadow-lg flex items-center relative", | ||
| description: | ||
| "group-[.toast]:text-muted-foreground ml-2 font-sans", | ||
| actionButton: | ||
| "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground py-1 px-2 shadow-md bg-background border-border border-2 ml-auto h-fit min-w-fit", | ||
| cancelButton: | ||
| "group-[.toast]:bg-muted group-[.toast]:text-foreground py-1 px-2 shadow-md bg-background border-border border-2 ml-auto h-fit min-w-fit", | ||
| title: "ml-2 font-sans", | ||
| closeButton: | ||
| "absolute bg-background shadow-md -top-1 -left-1 rounded-full p-0.5", | ||
| }, | ||
| unstyled: true, | ||
| }} | ||
| {...props} | ||
| /> | ||
Ankan002 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ); | ||
| }; | ||
|
|
||
| export { Toaster }; | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| "use client"; | ||
|
|
||
| import * as React from "react"; | ||
| import * as TogglePrimitive from "@radix-ui/react-toggle"; | ||
| import { cva, type VariantProps } from "class-variance-authority"; | ||
|
|
||
| import { cn } from "@/lib/utils"; | ||
|
|
||
| const toggleVariants = cva( | ||
| "inline-flex items-center justify-center text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground 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 gap-2", | ||
| { | ||
| variants: { | ||
| variant: { | ||
| default: | ||
| "bg-transparent hover:bg-muted/70 hover:text-muted-foreground data-[state=on]:bg-muted", | ||
| outlined: | ||
| "border-2 border-input bg-transparent hover:bg-accent hover:text-accent-foreground/80 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground", | ||
| solid: "border-2 border-input bg-transparent hover:bg-black hover:text-white/90 hover:border-black data-[state=on]:bg-black data-[state=on]:text-white data-[state=on]:border-black", | ||
| "outline-muted": | ||
| "border-2 border-input bg-transparent hover:hover:bg-muted/70 hover:hover:text-muted-foreground data-[state=on]:bg-muted", | ||
| }, | ||
| size: { | ||
| default: "h-10 px-3 min-w-10", | ||
| sm: "h-9 px-2.5 min-w-9", | ||
| lg: "h-11 px-5 min-w-11", | ||
| }, | ||
| }, | ||
| defaultVariants: { | ||
| variant: "default", | ||
| size: "default", | ||
| }, | ||
| }, | ||
| ); | ||
|
|
||
| const Toggle = React.forwardRef< | ||
| React.ElementRef<typeof TogglePrimitive.Root>, | ||
| React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> & | ||
| VariantProps<typeof toggleVariants> | ||
| >(({ className, variant, size, ...props }, ref) => ( | ||
| <TogglePrimitive.Root | ||
| ref={ref} | ||
| className={cn(toggleVariants({ variant, size, className }))} | ||
| {...props} | ||
| /> | ||
| )); | ||
|
|
||
| Toggle.displayName = TogglePrimitive.Root.displayName; | ||
|
|
||
| export { Toggle, toggleVariants }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| "use client"; | ||
|
|
||
| import * as React from "react"; | ||
| import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"; | ||
| import { type VariantProps } from "class-variance-authority"; | ||
|
|
||
| import { cn } from "@/lib/utils"; | ||
| import { toggleVariants } from "./Toggle"; | ||
|
|
||
| const ToggleGroupContext = React.createContext< | ||
| VariantProps<typeof toggleVariants> | ||
| >({ | ||
| size: "default", | ||
| variant: "default", | ||
| }); | ||
|
|
||
| const ToggleGroup = React.forwardRef< | ||
| React.ElementRef<typeof ToggleGroupPrimitive.Root>, | ||
| React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> & | ||
| VariantProps<typeof toggleVariants> | ||
| >(({ className, variant, size, children, ...props }, ref) => ( | ||
| <ToggleGroupPrimitive.Root | ||
| ref={ref} | ||
| className={cn("flex items-center justify-center gap-1", className)} | ||
| {...props} | ||
| > | ||
| <ToggleGroupContext.Provider value={{ variant, size }}> | ||
| {children} | ||
| </ToggleGroupContext.Provider> | ||
| </ToggleGroupPrimitive.Root> | ||
| )); | ||
|
|
||
| ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName; | ||
|
|
||
| const ToggleGroupItem = React.forwardRef< | ||
| React.ElementRef<typeof ToggleGroupPrimitive.Item>, | ||
| React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & | ||
| VariantProps<typeof toggleVariants> | ||
| >(({ className, children, variant, size, ...props }, ref) => { | ||
| const context = React.useContext(ToggleGroupContext); | ||
|
|
||
| return ( | ||
| <ToggleGroupPrimitive.Item | ||
| ref={ref} | ||
| className={cn( | ||
| toggleVariants({ | ||
| variant: context.variant || variant, | ||
| size: context.size || size, | ||
| }), | ||
| className, | ||
| )} | ||
| {...props} | ||
| > | ||
| {children} | ||
| </ToggleGroupPrimitive.Item> | ||
| ); | ||
| }); | ||
|
|
||
| ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName; | ||
|
|
||
| export { ToggleGroup, ToggleGroupItem }; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| "use client"; | ||
|
|
||
| import * as React from "react"; | ||
| import * as TooltipPrimitive from "@radix-ui/react-tooltip"; | ||
|
|
||
| import { cn } from "@/lib/utils"; | ||
| import { cva, VariantProps } from "class-variance-authority"; | ||
|
|
||
| const tooltipContentVariants = cva( | ||
| "z-50 overflow-hidden border-2 border-border bg-background px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]", | ||
| { | ||
| variants: { | ||
| variant: { | ||
| default: "bg-background text-foreground", | ||
| primary: "bg-primary text-foreground", | ||
| solid: "bg-solid text-solid-foreground", | ||
| }, | ||
| }, | ||
| defaultVariants: { | ||
| variant: "default", | ||
| }, | ||
| }, | ||
| ); | ||
|
|
||
| const TooltipProvider = TooltipPrimitive.Provider; | ||
|
|
||
| const Tooltip = TooltipPrimitive.Root; | ||
|
|
||
| const TooltipTrigger = TooltipPrimitive.Trigger; | ||
|
|
||
| const TooltipContent = React.forwardRef< | ||
| React.ElementRef<typeof TooltipPrimitive.Content>, | ||
| React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & | ||
| VariantProps<typeof tooltipContentVariants> | ||
| >(({ className, sideOffset = 4, variant, ...props }, ref) => ( | ||
| <TooltipPrimitive.Portal> | ||
| <TooltipPrimitive.Content | ||
| ref={ref} | ||
| sideOffset={sideOffset} | ||
| className={cn( | ||
| tooltipContentVariants({ | ||
| variant, | ||
| className, | ||
| }), | ||
| )} | ||
| {...props} | ||
| /> | ||
| </TooltipPrimitive.Portal> | ||
| )); | ||
| TooltipContent.displayName = TooltipPrimitive.Content.displayName; | ||
|
|
||
| export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.