@windrun-huaiin/base-ui 3.3.0 → 3.5.0

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.
Files changed (60) hide show
  1. package/dist/index.d.mts +2 -38
  2. package/dist/index.d.ts +2 -38
  3. package/dist/index.js +187 -4263
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +184 -4037
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/ui/index.d.mts +37 -711
  8. package/dist/ui/index.d.ts +37 -711
  9. package/dist/ui/index.js +172 -4248
  10. package/dist/ui/index.js.map +1 -1
  11. package/dist/ui/index.mjs +171 -4024
  12. package/dist/ui/index.mjs.map +1 -1
  13. package/package.json +2 -36
  14. package/src/ui/index.ts +2 -48
  15. package/src/ui/accordion.tsx +0 -58
  16. package/src/ui/alert.tsx +0 -59
  17. package/src/ui/aspect-ratio.tsx +0 -7
  18. package/src/ui/avatar.tsx +0 -50
  19. package/src/ui/badge.tsx +0 -36
  20. package/src/ui/breadcrumb.tsx +0 -115
  21. package/src/ui/calendar.tsx +0 -66
  22. package/src/ui/card.tsx +0 -79
  23. package/src/ui/carousel.tsx +0 -262
  24. package/src/ui/chart.tsx +0 -365
  25. package/src/ui/checkbox.tsx +0 -30
  26. package/src/ui/collapsible.tsx +0 -11
  27. package/src/ui/command.tsx +0 -153
  28. package/src/ui/context-menu.tsx +0 -200
  29. package/src/ui/dialog.tsx +0 -122
  30. package/src/ui/drawer.tsx +0 -118
  31. package/src/ui/form.tsx +0 -178
  32. package/src/ui/hover-card.tsx +0 -29
  33. package/src/ui/input-otp.tsx +0 -71
  34. package/src/ui/input.tsx +0 -22
  35. package/src/ui/menubar.tsx +0 -236
  36. package/src/ui/navigation-menu.tsx +0 -128
  37. package/src/ui/pagination.tsx +0 -117
  38. package/src/ui/popover.tsx +0 -31
  39. package/src/ui/progress.tsx +0 -28
  40. package/src/ui/radio-group.tsx +0 -44
  41. package/src/ui/resizable.tsx +0 -45
  42. package/src/ui/scroll-area.tsx +0 -48
  43. package/src/ui/select.tsx +0 -160
  44. package/src/ui/separator.tsx +0 -31
  45. package/src/ui/sheet.tsx +0 -140
  46. package/src/ui/sidebar.tsx +0 -763
  47. package/src/ui/skeleton.tsx +0 -15
  48. package/src/ui/slider.tsx +0 -28
  49. package/src/ui/sonner.tsx +0 -31
  50. package/src/ui/switch.tsx +0 -29
  51. package/src/ui/table.tsx +0 -117
  52. package/src/ui/tabs.tsx +0 -55
  53. package/src/ui/textarea.tsx +0 -22
  54. package/src/ui/toast.tsx +0 -129
  55. package/src/ui/toaster.tsx +0 -35
  56. package/src/ui/toggle-group.tsx +0 -61
  57. package/src/ui/toggle.tsx +0 -45
  58. package/src/ui/tooltip.tsx +0 -30
  59. package/src/ui/use-mobile.tsx +0 -19
  60. package/src/ui/use-toast.ts +0 -194
@@ -1,15 +0,0 @@
1
- import { cn } from "@lib/utils"
2
-
3
- function Skeleton({
4
- className,
5
- ...props
6
- }: React.HTMLAttributes<HTMLDivElement>) {
7
- return (
8
- <div
9
- className={cn("animate-pulse rounded-md bg-muted", className)}
10
- {...props}
11
- />
12
- )
13
- }
14
-
15
- export { Skeleton }
package/src/ui/slider.tsx DELETED
@@ -1,28 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as SliderPrimitive from "@radix-ui/react-slider"
5
-
6
- import { cn } from "@lib/utils"
7
-
8
- const Slider = React.forwardRef<
9
- React.ElementRef<typeof SliderPrimitive.Root>,
10
- React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
11
- >(({ className, ...props }, ref) => (
12
- <SliderPrimitive.Root
13
- ref={ref}
14
- className={cn(
15
- "relative flex w-full touch-none select-none items-center",
16
- className
17
- )}
18
- {...props}
19
- >
20
- <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
21
- <SliderPrimitive.Range className="absolute h-full bg-primary" />
22
- </SliderPrimitive.Track>
23
- <SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
24
- </SliderPrimitive.Root>
25
- ))
26
- Slider.displayName = SliderPrimitive.Root.displayName
27
-
28
- export { Slider }
package/src/ui/sonner.tsx DELETED
@@ -1,31 +0,0 @@
1
- "use client"
2
-
3
- import { useTheme } from "next-themes"
4
- import { Toaster as Sonner } from "sonner"
5
-
6
- type ToasterProps = React.ComponentProps<typeof Sonner>
7
-
8
- const Toaster = ({ ...props }: ToasterProps) => {
9
- const { theme = "system" } = useTheme()
10
-
11
- return (
12
- <Sonner
13
- theme={theme as ToasterProps["theme"]}
14
- className="toaster group"
15
- toastOptions={{
16
- classNames: {
17
- toast:
18
- "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
19
- description: "group-[.toast]:text-muted-foreground",
20
- actionButton:
21
- "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
22
- cancelButton:
23
- "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
24
- },
25
- }}
26
- {...props}
27
- />
28
- )
29
- }
30
-
31
- export { Toaster }
package/src/ui/switch.tsx DELETED
@@ -1,29 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as SwitchPrimitives from "@radix-ui/react-switch"
5
-
6
- import { cn } from "@lib/utils"
7
-
8
- const Switch = React.forwardRef<
9
- React.ElementRef<typeof SwitchPrimitives.Root>,
10
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
11
- >(({ className, ...props }, ref) => (
12
- <SwitchPrimitives.Root
13
- className={cn(
14
- "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
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 data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
23
- )}
24
- />
25
- </SwitchPrimitives.Root>
26
- ))
27
- Switch.displayName = SwitchPrimitives.Root.displayName
28
-
29
- export { Switch }
package/src/ui/table.tsx DELETED
@@ -1,117 +0,0 @@
1
- import * as React from "react"
2
-
3
- import { cn } from "@lib/utils"
4
-
5
- const Table = React.forwardRef<
6
- HTMLTableElement,
7
- React.HTMLAttributes<HTMLTableElement>
8
- >(({ className, ...props }, ref) => (
9
- <div className="relative w-full overflow-auto">
10
- <table
11
- ref={ref}
12
- className={cn("w-full caption-bottom text-sm", className)}
13
- {...props}
14
- />
15
- </div>
16
- ))
17
- Table.displayName = "Table"
18
-
19
- const TableHeader = React.forwardRef<
20
- HTMLTableSectionElement,
21
- React.HTMLAttributes<HTMLTableSectionElement>
22
- >(({ className, ...props }, ref) => (
23
- <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
24
- ))
25
- TableHeader.displayName = "TableHeader"
26
-
27
- const TableBody = React.forwardRef<
28
- HTMLTableSectionElement,
29
- React.HTMLAttributes<HTMLTableSectionElement>
30
- >(({ className, ...props }, ref) => (
31
- <tbody
32
- ref={ref}
33
- className={cn("[&_tr:last-child]:border-0", className)}
34
- {...props}
35
- />
36
- ))
37
- TableBody.displayName = "TableBody"
38
-
39
- const TableFooter = React.forwardRef<
40
- HTMLTableSectionElement,
41
- React.HTMLAttributes<HTMLTableSectionElement>
42
- >(({ className, ...props }, ref) => (
43
- <tfoot
44
- ref={ref}
45
- className={cn(
46
- "border-t bg-muted/50 font-medium last:[&>tr]:border-b-0",
47
- className
48
- )}
49
- {...props}
50
- />
51
- ))
52
- TableFooter.displayName = "TableFooter"
53
-
54
- const TableRow = React.forwardRef<
55
- HTMLTableRowElement,
56
- React.HTMLAttributes<HTMLTableRowElement>
57
- >(({ className, ...props }, ref) => (
58
- <tr
59
- ref={ref}
60
- className={cn(
61
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
62
- className
63
- )}
64
- {...props}
65
- />
66
- ))
67
- TableRow.displayName = "TableRow"
68
-
69
- const TableHead = React.forwardRef<
70
- HTMLTableCellElement,
71
- React.ThHTMLAttributes<HTMLTableCellElement>
72
- >(({ className, ...props }, ref) => (
73
- <th
74
- ref={ref}
75
- className={cn(
76
- "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
77
- className
78
- )}
79
- {...props}
80
- />
81
- ))
82
- TableHead.displayName = "TableHead"
83
-
84
- const TableCell = React.forwardRef<
85
- HTMLTableCellElement,
86
- React.TdHTMLAttributes<HTMLTableCellElement>
87
- >(({ className, ...props }, ref) => (
88
- <td
89
- ref={ref}
90
- className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
91
- {...props}
92
- />
93
- ))
94
- TableCell.displayName = "TableCell"
95
-
96
- const TableCaption = React.forwardRef<
97
- HTMLTableCaptionElement,
98
- React.HTMLAttributes<HTMLTableCaptionElement>
99
- >(({ className, ...props }, ref) => (
100
- <caption
101
- ref={ref}
102
- className={cn("mt-4 text-sm text-muted-foreground", className)}
103
- {...props}
104
- />
105
- ))
106
- TableCaption.displayName = "TableCaption"
107
-
108
- export {
109
- Table,
110
- TableHeader,
111
- TableBody,
112
- TableFooter,
113
- TableHead,
114
- TableRow,
115
- TableCell,
116
- TableCaption,
117
- }
package/src/ui/tabs.tsx DELETED
@@ -1,55 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as TabsPrimitive from "@radix-ui/react-tabs"
5
-
6
- import { cn } from "@lib/utils"
7
-
8
- const Tabs = TabsPrimitive.Root
9
-
10
- const TabsList = React.forwardRef<
11
- React.ElementRef<typeof TabsPrimitive.List>,
12
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
13
- >(({ className, ...props }, ref) => (
14
- <TabsPrimitive.List
15
- ref={ref}
16
- className={cn(
17
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
18
- className
19
- )}
20
- {...props}
21
- />
22
- ))
23
- TabsList.displayName = TabsPrimitive.List.displayName
24
-
25
- const TabsTrigger = React.forwardRef<
26
- React.ElementRef<typeof TabsPrimitive.Trigger>,
27
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
28
- >(({ className, ...props }, ref) => (
29
- <TabsPrimitive.Trigger
30
- ref={ref}
31
- className={cn(
32
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs",
33
- className
34
- )}
35
- {...props}
36
- />
37
- ))
38
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
39
-
40
- const TabsContent = React.forwardRef<
41
- React.ElementRef<typeof TabsPrimitive.Content>,
42
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
43
- >(({ className, ...props }, ref) => (
44
- <TabsPrimitive.Content
45
- ref={ref}
46
- className={cn(
47
- "mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
48
- className
49
- )}
50
- {...props}
51
- />
52
- ))
53
- TabsContent.displayName = TabsPrimitive.Content.displayName
54
-
55
- export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -1,22 +0,0 @@
1
- import * as React from "react"
2
-
3
- import { cn } from "@lib/utils"
4
-
5
- const Textarea = React.forwardRef<
6
- HTMLTextAreaElement,
7
- React.ComponentProps<"textarea">
8
- >(({ className, ...props }, ref) => {
9
- return (
10
- <textarea
11
- className={cn(
12
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
13
- className
14
- )}
15
- ref={ref}
16
- {...props}
17
- />
18
- )
19
- })
20
- Textarea.displayName = "Textarea"
21
-
22
- export { Textarea }
package/src/ui/toast.tsx DELETED
@@ -1,129 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as ToastPrimitives from "@radix-ui/react-toast"
5
- import { cva, type VariantProps } from "class-variance-authority"
6
- import { globalLucideIcons as icons } from "@base-ui/components/global-icon"
7
-
8
- import { cn } from "@lib/utils"
9
-
10
- const ToastProvider = ToastPrimitives.Provider
11
-
12
- const ToastViewport = React.forwardRef<
13
- React.ElementRef<typeof ToastPrimitives.Viewport>,
14
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>
15
- >(({ className, ...props }, ref) => (
16
- <ToastPrimitives.Viewport
17
- ref={ref}
18
- className={cn(
19
- "fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
20
- className
21
- )}
22
- {...props}
23
- />
24
- ))
25
- ToastViewport.displayName = ToastPrimitives.Viewport.displayName
26
-
27
- const toastVariants = cva(
28
- "group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full",
29
- {
30
- variants: {
31
- variant: {
32
- default: "border bg-background text-foreground",
33
- destructive:
34
- "destructive group border-destructive bg-destructive text-destructive-foreground",
35
- },
36
- },
37
- defaultVariants: {
38
- variant: "default",
39
- },
40
- }
41
- )
42
-
43
- const Toast = React.forwardRef<
44
- React.ElementRef<typeof ToastPrimitives.Root>,
45
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &
46
- VariantProps<typeof toastVariants>
47
- >(({ className, variant, ...props }, ref) => {
48
- return (
49
- <ToastPrimitives.Root
50
- ref={ref}
51
- className={cn(toastVariants({ variant }), className)}
52
- {...props}
53
- />
54
- )
55
- })
56
- Toast.displayName = ToastPrimitives.Root.displayName
57
-
58
- const ToastAction = React.forwardRef<
59
- React.ElementRef<typeof ToastPrimitives.Action>,
60
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>
61
- >(({ className, ...props }, ref) => (
62
- <ToastPrimitives.Action
63
- ref={ref}
64
- className={cn(
65
- "inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive",
66
- className
67
- )}
68
- {...props}
69
- />
70
- ))
71
- ToastAction.displayName = ToastPrimitives.Action.displayName
72
-
73
- const ToastClose = React.forwardRef<
74
- React.ElementRef<typeof ToastPrimitives.Close>,
75
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>
76
- >(({ className, ...props }, ref) => (
77
- <ToastPrimitives.Close
78
- ref={ref}
79
- className={cn(
80
- "absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600",
81
- className
82
- )}
83
- toast-close=""
84
- {...props}
85
- >
86
- <icons.X className="h-4 w-4" />
87
- </ToastPrimitives.Close>
88
- ))
89
- ToastClose.displayName = ToastPrimitives.Close.displayName
90
-
91
- const ToastTitle = React.forwardRef<
92
- React.ElementRef<typeof ToastPrimitives.Title>,
93
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>
94
- >(({ className, ...props }, ref) => (
95
- <ToastPrimitives.Title
96
- ref={ref}
97
- className={cn("text-sm font-semibold", className)}
98
- {...props}
99
- />
100
- ))
101
- ToastTitle.displayName = ToastPrimitives.Title.displayName
102
-
103
- const ToastDescription = React.forwardRef<
104
- React.ElementRef<typeof ToastPrimitives.Description>,
105
- React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>
106
- >(({ className, ...props }, ref) => (
107
- <ToastPrimitives.Description
108
- ref={ref}
109
- className={cn("text-sm opacity-90", className)}
110
- {...props}
111
- />
112
- ))
113
- ToastDescription.displayName = ToastPrimitives.Description.displayName
114
-
115
- type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>
116
-
117
- type ToastActionElement = React.ReactElement<typeof ToastAction>
118
-
119
- export {
120
- type ToastProps,
121
- type ToastActionElement,
122
- ToastProvider,
123
- ToastViewport,
124
- Toast,
125
- ToastTitle,
126
- ToastDescription,
127
- ToastClose,
128
- ToastAction,
129
- }
@@ -1,35 +0,0 @@
1
- "use client"
2
-
3
- import { useToast } from "@base-ui/ui/use-toast"
4
- import {
5
- Toast,
6
- ToastClose,
7
- ToastDescription,
8
- ToastProvider,
9
- ToastTitle,
10
- ToastViewport,
11
- } from "@base-ui/ui/toast"
12
-
13
- export function Toaster() {
14
- const { toasts } = useToast()
15
-
16
- return (
17
- <ToastProvider>
18
- {toasts.map(function ({ id, title, description, action, ...props }) {
19
- return (
20
- <Toast key={id} {...props}>
21
- <div className="grid gap-1">
22
- {title && <ToastTitle>{title}</ToastTitle>}
23
- {description && (
24
- <ToastDescription>{description}</ToastDescription>
25
- )}
26
- </div>
27
- {action}
28
- <ToastClose />
29
- </Toast>
30
- )
31
- })}
32
- <ToastViewport />
33
- </ToastProvider>
34
- )
35
- }
@@ -1,61 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
5
- import { type VariantProps } from "class-variance-authority"
6
-
7
- import { cn } from "@lib/utils"
8
- import { toggleVariants } from "@base-ui/ui/toggle"
9
-
10
- const ToggleGroupContext = React.createContext<
11
- VariantProps<typeof toggleVariants>
12
- >({
13
- size: "default",
14
- variant: "default",
15
- })
16
-
17
- const ToggleGroup = React.forwardRef<
18
- React.ElementRef<typeof ToggleGroupPrimitive.Root>,
19
- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
20
- VariantProps<typeof toggleVariants>
21
- >(({ className, variant, size, children, ...props }, ref) => (
22
- <ToggleGroupPrimitive.Root
23
- ref={ref}
24
- className={cn("flex items-center justify-center gap-1", className)}
25
- {...props}
26
- >
27
- <ToggleGroupContext.Provider value={{ variant, size }}>
28
- {children}
29
- </ToggleGroupContext.Provider>
30
- </ToggleGroupPrimitive.Root>
31
- ))
32
-
33
- ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
34
-
35
- const ToggleGroupItem = React.forwardRef<
36
- React.ElementRef<typeof ToggleGroupPrimitive.Item>,
37
- React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
38
- VariantProps<typeof toggleVariants>
39
- >(({ className, children, variant, size, ...props }, ref) => {
40
- const context = React.useContext(ToggleGroupContext)
41
-
42
- return (
43
- <ToggleGroupPrimitive.Item
44
- ref={ref}
45
- className={cn(
46
- toggleVariants({
47
- variant: context.variant || variant,
48
- size: context.size || size,
49
- }),
50
- className
51
- )}
52
- {...props}
53
- >
54
- {children}
55
- </ToggleGroupPrimitive.Item>
56
- )
57
- })
58
-
59
- ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
60
-
61
- export { ToggleGroup, ToggleGroupItem }
package/src/ui/toggle.tsx DELETED
@@ -1,45 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as TogglePrimitive from "@radix-ui/react-toggle"
5
- import { cva, type VariantProps } from "class-variance-authority"
6
-
7
- import { cn } from "@lib/utils"
8
-
9
- const toggleVariants = cva(
10
- "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 gap-2",
11
- {
12
- variants: {
13
- variant: {
14
- default: "bg-transparent",
15
- outline:
16
- "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
17
- },
18
- size: {
19
- default: "h-10 px-3 min-w-10",
20
- sm: "h-9 px-2.5 min-w-9",
21
- lg: "h-11 px-5 min-w-11",
22
- },
23
- },
24
- defaultVariants: {
25
- variant: "default",
26
- size: "default",
27
- },
28
- }
29
- )
30
-
31
- const Toggle = React.forwardRef<
32
- React.ElementRef<typeof TogglePrimitive.Root>,
33
- React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
34
- VariantProps<typeof toggleVariants>
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 }
@@ -1,30 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as TooltipPrimitive from "@radix-ui/react-tooltip"
5
-
6
- import { cn } from "@lib/utils"
7
-
8
- const TooltipProvider = TooltipPrimitive.Provider
9
-
10
- const Tooltip = TooltipPrimitive.Root
11
-
12
- const TooltipTrigger = TooltipPrimitive.Trigger
13
-
14
- const TooltipContent = React.forwardRef<
15
- React.ElementRef<typeof TooltipPrimitive.Content>,
16
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
17
- >(({ className, sideOffset = 4, ...props }, ref) => (
18
- <TooltipPrimitive.Content
19
- ref={ref}
20
- sideOffset={sideOffset}
21
- className={cn(
22
- "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",
23
- className
24
- )}
25
- {...props}
26
- />
27
- ))
28
- TooltipContent.displayName = TooltipPrimitive.Content.displayName
29
-
30
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
@@ -1,19 +0,0 @@
1
- import * as React from "react"
2
-
3
- const MOBILE_BREAKPOINT = 768
4
-
5
- export function useIsMobile() {
6
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
7
-
8
- React.useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
12
- }
13
- mql.addEventListener("change", onChange)
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
15
- return () => mql.removeEventListener("change", onChange)
16
- }, [])
17
-
18
- return !!isMobile
19
- }