feat: add UI components for skeleton, slider, sonner, spinner, switch, table, tabs, textarea, toggle group, toggle, tooltip, and mobile hook

- Implemented Skeleton component for loading placeholders.
- Created Slider component with customizable properties.
- Added Sonner component for toast notifications with icons.
- Developed Spinner component for loading indicators.
- Introduced Switch component for toggle functionality.
- Built Table component with header, body, footer, and cell subcomponents.
- Added Tabs component with list, trigger, and content subcomponents.
- Created Textarea component for user input.
- Implemented ToggleGroup and Toggle components for grouped toggle functionality.
- Developed Tooltip component with provider, trigger, and content subcomponents.
- Added useIsMobile hook to detect mobile device viewport.
This commit is contained in:
asepharyana
2026-07-23 11:16:34 +07:00
parent 5acb138f96
commit 18bf58be1a
62 changed files with 7481 additions and 1 deletions
+55
View File
@@ -0,0 +1,55 @@
"use client"
import * as React from "react"
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
import { cn } from "@/lib/utils"
function ScrollArea({
className,
children,
...props
}: ScrollAreaPrimitive.Root.Props) {
return (
<ScrollAreaPrimitive.Root
data-slot="scroll-area"
className={cn("relative", className)}
{...props}
>
<ScrollAreaPrimitive.Viewport
data-slot="scroll-area-viewport"
className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
>
{children}
</ScrollAreaPrimitive.Viewport>
<ScrollBar />
<ScrollAreaPrimitive.Corner />
</ScrollAreaPrimitive.Root>
)
}
function ScrollBar({
className,
orientation = "vertical",
...props
}: ScrollAreaPrimitive.Scrollbar.Props) {
return (
<ScrollAreaPrimitive.Scrollbar
data-slot="scroll-area-scrollbar"
data-orientation={orientation}
orientation={orientation}
className={cn(
"flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
className
)}
{...props}
>
<ScrollAreaPrimitive.Thumb
data-slot="scroll-area-thumb"
className="relative flex-1 rounded-full bg-border"
/>
</ScrollAreaPrimitive.Scrollbar>
)
}
export { ScrollArea, ScrollBar }