@srcroot/ui 0.0.55 → 0.0.58

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 (107) hide show
  1. package/README.md +151 -151
  2. package/dist/index.d.ts +0 -0
  3. package/dist/index.js +120 -93
  4. package/package.json +7 -2
  5. package/src/registry/analytics/google-analytics.tsx +36 -39
  6. package/src/registry/analytics/google-tag-manager.tsx +62 -65
  7. package/src/registry/analytics/meta-pixel.tsx +44 -47
  8. package/src/registry/analytics/microsoft-clarity.tsx +31 -34
  9. package/src/registry/analytics/tiktok-pixel.tsx +34 -37
  10. package/src/registry/lib/utils.ts +0 -0
  11. package/src/registry/themes/v3/blue.css +157 -157
  12. package/src/registry/themes/v3/glass.css +153 -153
  13. package/src/registry/themes/v3/gray.css +157 -157
  14. package/src/registry/themes/v3/green.css +157 -157
  15. package/src/registry/themes/v3/neutral.css +157 -157
  16. package/src/registry/themes/v3/orange.css +157 -157
  17. package/src/registry/themes/v3/rose.css +157 -157
  18. package/src/registry/themes/v3/slate.css +157 -157
  19. package/src/registry/themes/v3/stone.css +157 -157
  20. package/src/registry/themes/v3/violet.css +186 -186
  21. package/src/registry/themes/v3/zinc.css +157 -157
  22. package/src/registry/themes/v4/blue.css +184 -184
  23. package/src/registry/themes/v4/glass.css +180 -180
  24. package/src/registry/themes/v4/gray.css +184 -184
  25. package/src/registry/themes/v4/green.css +184 -184
  26. package/src/registry/themes/v4/neutral.css +184 -184
  27. package/src/registry/themes/v4/orange.css +184 -184
  28. package/src/registry/themes/v4/rose.css +184 -184
  29. package/src/registry/themes/v4/slate.css +184 -184
  30. package/src/registry/themes/v4/stone.css +184 -184
  31. package/src/registry/themes/v4/violet.css +184 -184
  32. package/src/registry/themes/v4/zinc.css +184 -184
  33. package/src/registry/ui/accordion.tsx +164 -165
  34. package/src/registry/ui/alert-dialog.tsx +213 -214
  35. package/src/registry/ui/alert.tsx +73 -76
  36. package/src/registry/ui/aspect-ratio.tsx +44 -47
  37. package/src/registry/ui/avatar.tsx +96 -97
  38. package/src/registry/ui/badge.tsx +52 -55
  39. package/src/registry/ui/breadcrumb.tsx +147 -150
  40. package/src/registry/ui/button-group.tsx +64 -67
  41. package/src/registry/ui/button.tsx +71 -72
  42. package/src/registry/ui/calendar.tsx +514 -515
  43. package/src/registry/ui/card.tsx +88 -91
  44. package/src/registry/ui/carousel.tsx +214 -214
  45. package/src/registry/ui/chart.tsx +373 -373
  46. package/src/registry/ui/chatbot.tsx +86 -13
  47. package/src/registry/ui/checkbox.tsx +93 -94
  48. package/src/registry/ui/collapsible.tsx +107 -108
  49. package/src/registry/ui/combobox.tsx +171 -171
  50. package/src/registry/ui/command.tsx +300 -300
  51. package/src/registry/ui/container.tsx +44 -47
  52. package/src/registry/ui/context-menu.tsx +221 -221
  53. package/src/registry/ui/date-picker.tsx +228 -228
  54. package/src/registry/ui/dialog.tsx +269 -270
  55. package/src/registry/ui/drawer.tsx +10 -4
  56. package/src/registry/ui/dropdown-menu.tsx +529 -530
  57. package/src/registry/ui/empty-state.tsx +0 -2
  58. package/src/registry/ui/file-upload.tsx +0 -0
  59. package/src/registry/ui/floating-dock.tsx +0 -0
  60. package/src/registry/ui/form-field.tsx +91 -94
  61. package/src/registry/ui/google-analytics.tsx +38 -0
  62. package/src/registry/ui/google-tag-manager.tsx +64 -0
  63. package/src/registry/ui/hover-card.tsx +223 -223
  64. package/src/registry/ui/image.tsx +144 -147
  65. package/src/registry/ui/input-group.tsx +82 -85
  66. package/src/registry/ui/input.tsx +125 -125
  67. package/src/registry/ui/kbd.tsx +60 -63
  68. package/src/registry/ui/label.tsx +36 -37
  69. package/src/registry/ui/loading-spinner.tsx +108 -111
  70. package/src/registry/ui/map.tsx +0 -0
  71. package/src/registry/ui/marquee.tsx +2 -0
  72. package/src/registry/ui/menubar.tsx +246 -246
  73. package/src/registry/ui/meta-pixel.tsx +46 -0
  74. package/src/registry/ui/microsoft-clarity.tsx +33 -0
  75. package/src/registry/ui/native-select.tsx +49 -52
  76. package/src/registry/ui/otp-input.tsx +163 -155
  77. package/src/registry/ui/pagination.tsx +149 -152
  78. package/src/registry/ui/patterns.tsx +28 -0
  79. package/src/registry/ui/popover.tsx +226 -227
  80. package/src/registry/ui/progress.tsx +51 -52
  81. package/src/registry/ui/radio.tsx +99 -102
  82. package/src/registry/ui/resizable.tsx +314 -314
  83. package/src/registry/ui/scroll-animation.tsx +45 -0
  84. package/src/registry/ui/scroll-area.tsx +121 -122
  85. package/src/registry/ui/scroll-to-top.tsx +0 -0
  86. package/src/registry/ui/search.tsx +162 -150
  87. package/src/registry/ui/select.tsx +292 -293
  88. package/src/registry/ui/separator.tsx +46 -47
  89. package/src/registry/ui/sheet.tsx +6 -3
  90. package/src/registry/ui/sidebar.tsx +628 -628
  91. package/src/registry/ui/skeleton.tsx +26 -29
  92. package/src/registry/ui/slider.tsx +196 -197
  93. package/src/registry/ui/slot.tsx +69 -72
  94. package/src/registry/ui/star-rating.tsx +146 -134
  95. package/src/registry/ui/switch.tsx +72 -73
  96. package/src/registry/ui/table-of-contents.tsx +96 -96
  97. package/src/registry/ui/table.tsx +138 -139
  98. package/src/registry/ui/tabs.tsx +124 -125
  99. package/src/registry/ui/text.tsx +61 -64
  100. package/src/registry/ui/textarea.tsx +41 -42
  101. package/src/registry/ui/theme-switcher.tsx +66 -66
  102. package/src/registry/ui/tiktok-pixel.tsx +36 -0
  103. package/src/registry/ui/toast.tsx +97 -98
  104. package/src/registry/ui/toggle-group.tsx +129 -129
  105. package/src/registry/ui/toggle.tsx +72 -72
  106. package/src/registry/ui/tooltip.tsx +143 -144
  107. package/src/registry/ui/whatsapp.tsx +0 -0
@@ -1,139 +1,138 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { cn } from "@/lib/utils"
5
-
6
- /**
7
- * Table components for data display
8
- *
9
- * @example
10
- * <Table>
11
- * <TableHeader>
12
- * <TableRow>
13
- * <TableHead>Name</TableHead>
14
- * <TableHead>Email</TableHead>
15
- * </TableRow>
16
- * </TableHeader>
17
- * <TableBody>
18
- * <TableRow>
19
- * <TableCell>John Doe</TableCell>
20
- * <TableCell>john@example.com</TableCell>
21
- * </TableRow>
22
- * </TableBody>
23
- * </Table>
24
- */
25
-
26
- const Table = React.forwardRef<
27
- HTMLTableElement,
28
- React.HTMLAttributes<HTMLTableElement> & { containerClassName?: string }
29
- >(({ className, containerClassName, ...props }, ref) => (
30
- <div className={cn("relative w-full overflow-auto", containerClassName)}>
31
- <table
32
- ref={ref}
33
- className={cn("w-full caption-bottom text-sm", className)}
34
- {...props}
35
- />
36
- </div>
37
- ))
38
- Table.displayName = "Table"
39
-
40
- const TableHeader = React.forwardRef<
41
- HTMLTableSectionElement,
42
- React.HTMLAttributes<HTMLTableSectionElement>
43
- >(({ className, ...props }, ref) => (
44
- <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
45
- ))
46
- TableHeader.displayName = "TableHeader"
47
-
48
- const TableBody = React.forwardRef<
49
- HTMLTableSectionElement,
50
- React.HTMLAttributes<HTMLTableSectionElement>
51
- >(({ className, ...props }, ref) => (
52
- <tbody
53
- ref={ref}
54
- className={cn("[&_tr:last-child]:border-0", className)}
55
- {...props}
56
- />
57
- ))
58
- TableBody.displayName = "TableBody"
59
-
60
- const TableFooter = React.forwardRef<
61
- HTMLTableSectionElement,
62
- React.HTMLAttributes<HTMLTableSectionElement>
63
- >(({ className, ...props }, ref) => (
64
- <tfoot
65
- ref={ref}
66
- className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)}
67
- {...props}
68
- />
69
- ))
70
- TableFooter.displayName = "TableFooter"
71
-
72
- const TableRow = React.forwardRef<
73
- HTMLTableRowElement,
74
- React.HTMLAttributes<HTMLTableRowElement>
75
- >(({ className, ...props }, ref) => (
76
- <tr
77
- ref={ref}
78
- className={cn(
79
- "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
80
- className
81
- )}
82
- {...props}
83
- />
84
- ))
85
- TableRow.displayName = "TableRow"
86
-
87
- const TableHead = React.forwardRef<
88
- HTMLTableCellElement,
89
- React.ThHTMLAttributes<HTMLTableCellElement>
90
- >(({ className, ...props }, ref) => (
91
- <th
92
- ref={ref}
93
- className={cn(
94
- "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
95
- className
96
- )}
97
- {...props}
98
- />
99
- ))
100
- TableHead.displayName = "TableHead"
101
-
102
- const TableCell = React.forwardRef<
103
- HTMLTableCellElement,
104
- React.TdHTMLAttributes<HTMLTableCellElement>
105
- >(({ className, ...props }, ref) => (
106
- <td
107
- ref={ref}
108
- className={cn(
109
- "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
110
- className
111
- )}
112
- {...props}
113
- />
114
- ))
115
- TableCell.displayName = "TableCell"
116
-
117
- const TableCaption = React.forwardRef<
118
- HTMLTableCaptionElement,
119
- React.HTMLAttributes<HTMLTableCaptionElement>
120
- >(({ className, ...props }, ref) => (
121
- <caption
122
- ref={ref}
123
- className={cn("mt-4 text-sm text-muted-foreground", className)}
124
- {...props}
125
- />
126
- ))
127
- TableCaption.displayName = "TableCaption"
128
-
129
- export {
130
- Table,
131
- TableHeader,
132
- TableBody,
133
- TableFooter,
134
- TableHead,
135
- TableRow,
136
- TableCell,
137
- TableCaption,
138
- }
139
-
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "@/lib/utils"
5
+
6
+ /**
7
+ * Table components for data display
8
+ *
9
+ * @example
10
+ * <Table>
11
+ * <TableHeader>
12
+ * <TableRow>
13
+ * <TableHead>Name</TableHead>
14
+ * <TableHead>Email</TableHead>
15
+ * </TableRow>
16
+ * </TableHeader>
17
+ * <TableBody>
18
+ * <TableRow>
19
+ * <TableCell>John Doe</TableCell>
20
+ * <TableCell>john@example.com</TableCell>
21
+ * </TableRow>
22
+ * </TableBody>
23
+ * </Table>
24
+ */
25
+
26
+ const Table = React.forwardRef<
27
+ HTMLTableElement,
28
+ React.HTMLAttributes<HTMLTableElement> & { containerClassName?: string }
29
+ >(({ className, containerClassName, ...props }, ref) => (
30
+ <div className={cn("relative w-full overflow-auto", containerClassName)}>
31
+ <table
32
+ ref={ref}
33
+ className={cn("w-full caption-bottom text-sm", className)}
34
+ {...props}
35
+ />
36
+ </div>
37
+ ))
38
+ Table.displayName = "Table"
39
+
40
+ const TableHeader = React.forwardRef<
41
+ HTMLTableSectionElement,
42
+ React.HTMLAttributes<HTMLTableSectionElement>
43
+ >(({ className, ...props }, ref) => (
44
+ <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
45
+ ))
46
+ TableHeader.displayName = "TableHeader"
47
+
48
+ const TableBody = React.forwardRef<
49
+ HTMLTableSectionElement,
50
+ React.HTMLAttributes<HTMLTableSectionElement>
51
+ >(({ className, ...props }, ref) => (
52
+ <tbody
53
+ ref={ref}
54
+ className={cn("[&_tr:last-child]:border-0", className)}
55
+ {...props}
56
+ />
57
+ ))
58
+ TableBody.displayName = "TableBody"
59
+
60
+ const TableFooter = React.forwardRef<
61
+ HTMLTableSectionElement,
62
+ React.HTMLAttributes<HTMLTableSectionElement>
63
+ >(({ className, ...props }, ref) => (
64
+ <tfoot
65
+ ref={ref}
66
+ className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)}
67
+ {...props}
68
+ />
69
+ ))
70
+ TableFooter.displayName = "TableFooter"
71
+
72
+ const TableRow = React.forwardRef<
73
+ HTMLTableRowElement,
74
+ React.HTMLAttributes<HTMLTableRowElement>
75
+ >(({ className, ...props }, ref) => (
76
+ <tr
77
+ ref={ref}
78
+ className={cn(
79
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
80
+ className
81
+ )}
82
+ {...props}
83
+ />
84
+ ))
85
+ TableRow.displayName = "TableRow"
86
+
87
+ const TableHead = React.forwardRef<
88
+ HTMLTableCellElement,
89
+ React.ThHTMLAttributes<HTMLTableCellElement>
90
+ >(({ className, ...props }, ref) => (
91
+ <th
92
+ ref={ref}
93
+ className={cn(
94
+ "h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
95
+ className
96
+ )}
97
+ {...props}
98
+ />
99
+ ))
100
+ TableHead.displayName = "TableHead"
101
+
102
+ const TableCell = React.forwardRef<
103
+ HTMLTableCellElement,
104
+ React.TdHTMLAttributes<HTMLTableCellElement>
105
+ >(({ className, ...props }, ref) => (
106
+ <td
107
+ ref={ref}
108
+ className={cn(
109
+ "p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
110
+ className
111
+ )}
112
+ {...props}
113
+ />
114
+ ))
115
+ TableCell.displayName = "TableCell"
116
+
117
+ const TableCaption = React.forwardRef<
118
+ HTMLTableCaptionElement,
119
+ React.HTMLAttributes<HTMLTableCaptionElement>
120
+ >(({ className, ...props }, ref) => (
121
+ <caption
122
+ ref={ref}
123
+ className={cn("mt-4 text-sm text-muted-foreground", className)}
124
+ {...props}
125
+ />
126
+ ))
127
+ TableCaption.displayName = "TableCaption"
128
+
129
+ export {
130
+ Table,
131
+ TableHeader,
132
+ TableBody,
133
+ TableFooter,
134
+ TableHead,
135
+ TableRow,
136
+ TableCell,
137
+ TableCaption,
138
+ }
@@ -1,125 +1,124 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { cn } from "@/lib/utils"
5
-
6
- interface TabsContextValue {
7
- value: string
8
- onValueChange: (value: string) => void
9
- }
10
-
11
- const TabsContext = React.createContext<TabsContextValue | null>(null)
12
-
13
- interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
14
- value?: string
15
- onValueChange?: (value: string) => void
16
- defaultValue?: string
17
- }
18
-
19
- /**
20
- * Tabs component with keyboard navigation
21
- *
22
- * @example
23
- * <Tabs defaultValue="tab1">
24
- * <TabsList>
25
- * <TabsTrigger value="tab1">Tab 1</TabsTrigger>
26
- * <TabsTrigger value="tab2">Tab 2</TabsTrigger>
27
- * </TabsList>
28
- * <TabsContent value="tab1">Content 1</TabsContent>
29
- * <TabsContent value="tab2">Content 2</TabsContent>
30
- * </Tabs>
31
- */
32
- const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
33
- ({ className, value: controlledValue, onValueChange, defaultValue = "", children, ...props }, ref) => {
34
- const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)
35
-
36
- const value = controlledValue !== undefined ? controlledValue : uncontrolledValue
37
- const setValue = onValueChange || setUncontrolledValue
38
-
39
- return (
40
- <TabsContext.Provider value={{ value, onValueChange: setValue }}>
41
- <div ref={ref} className={cn("", className)} {...props}>
42
- {children}
43
- </div>
44
- </TabsContext.Provider>
45
- )
46
- }
47
- )
48
- Tabs.displayName = "Tabs"
49
-
50
- const TabsList = React.forwardRef<
51
- HTMLDivElement,
52
- React.HTMLAttributes<HTMLDivElement>
53
- >(({ className, ...props }, ref) => (
54
- <div
55
- ref={ref}
56
- role="tablist"
57
- className={cn(
58
- "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
59
- className
60
- )}
61
- {...props}
62
- />
63
- ))
64
- TabsList.displayName = "TabsList"
65
-
66
- interface TabsTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
67
- value: string
68
- }
69
-
70
- const TabsTrigger = React.forwardRef<HTMLButtonElement, TabsTriggerProps>(
71
- ({ className, value, ...props }, ref) => {
72
- const context = React.useContext(TabsContext)
73
- if (!context) throw new Error("TabsTrigger must be used within Tabs")
74
-
75
- const isSelected = context.value === value
76
-
77
- return (
78
- <button
79
- ref={ref}
80
- type="button"
81
- role="tab"
82
- aria-selected={isSelected}
83
- tabIndex={isSelected ? 0 : -1}
84
- className={cn(
85
- "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
86
- isSelected && "bg-background text-foreground shadow",
87
- className
88
- )}
89
- onClick={() => context.onValueChange(value)}
90
- {...props}
91
- />
92
- )
93
- }
94
- )
95
- TabsTrigger.displayName = "TabsTrigger"
96
-
97
- interface TabsContentProps extends React.HTMLAttributes<HTMLDivElement> {
98
- value: string
99
- }
100
-
101
- const TabsContent = React.forwardRef<HTMLDivElement, TabsContentProps>(
102
- ({ className, value, ...props }, ref) => {
103
- const context = React.useContext(TabsContext)
104
- if (!context) throw new Error("TabsContent must be used within Tabs")
105
-
106
- if (context.value !== value) return null
107
-
108
- return (
109
- <div
110
- ref={ref}
111
- role="tabpanel"
112
- tabIndex={0}
113
- className={cn(
114
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
115
- className
116
- )}
117
- {...props}
118
- />
119
- )
120
- }
121
- )
122
- TabsContent.displayName = "TabsContent"
123
-
124
- export { Tabs, TabsList, TabsTrigger, TabsContent }
125
-
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { cn } from "@/lib/utils"
5
+
6
+ interface TabsContextValue {
7
+ value: string
8
+ onValueChange: (value: string) => void
9
+ }
10
+
11
+ const TabsContext = React.createContext<TabsContextValue | null>(null)
12
+
13
+ interface TabsProps extends React.HTMLAttributes<HTMLDivElement> {
14
+ value?: string
15
+ onValueChange?: (value: string) => void
16
+ defaultValue?: string
17
+ }
18
+
19
+ /**
20
+ * Tabs component with keyboard navigation
21
+ *
22
+ * @example
23
+ * <Tabs defaultValue="tab1">
24
+ * <TabsList>
25
+ * <TabsTrigger value="tab1">Tab 1</TabsTrigger>
26
+ * <TabsTrigger value="tab2">Tab 2</TabsTrigger>
27
+ * </TabsList>
28
+ * <TabsContent value="tab1">Content 1</TabsContent>
29
+ * <TabsContent value="tab2">Content 2</TabsContent>
30
+ * </Tabs>
31
+ */
32
+ const Tabs = React.forwardRef<HTMLDivElement, TabsProps>(
33
+ ({ className, value: controlledValue, onValueChange, defaultValue = "", children, ...props }, ref) => {
34
+ const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)
35
+
36
+ const value = controlledValue !== undefined ? controlledValue : uncontrolledValue
37
+ const setValue = onValueChange || setUncontrolledValue
38
+
39
+ return (
40
+ <TabsContext.Provider value={{ value, onValueChange: setValue }}>
41
+ <div ref={ref} className={cn("", className)} {...props}>
42
+ {children}
43
+ </div>
44
+ </TabsContext.Provider>
45
+ )
46
+ }
47
+ )
48
+ Tabs.displayName = "Tabs"
49
+
50
+ const TabsList = React.forwardRef<
51
+ HTMLDivElement,
52
+ React.HTMLAttributes<HTMLDivElement>
53
+ >(({ className, ...props }, ref) => (
54
+ <div
55
+ ref={ref}
56
+ role="tablist"
57
+ className={cn(
58
+ "inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
59
+ className
60
+ )}
61
+ {...props}
62
+ />
63
+ ))
64
+ TabsList.displayName = "TabsList"
65
+
66
+ interface TabsTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
67
+ value: string
68
+ }
69
+
70
+ const TabsTrigger = React.forwardRef<HTMLButtonElement, TabsTriggerProps>(
71
+ ({ className, value, ...props }, ref) => {
72
+ const context = React.useContext(TabsContext)
73
+ if (!context) throw new Error("TabsTrigger must be used within Tabs")
74
+
75
+ const isSelected = context.value === value
76
+
77
+ return (
78
+ <button
79
+ ref={ref}
80
+ type="button"
81
+ role="tab"
82
+ aria-selected={isSelected}
83
+ tabIndex={isSelected ? 0 : -1}
84
+ className={cn(
85
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
86
+ isSelected && "bg-background text-foreground shadow",
87
+ className
88
+ )}
89
+ onClick={() => context.onValueChange(value)}
90
+ {...props}
91
+ />
92
+ )
93
+ }
94
+ )
95
+ TabsTrigger.displayName = "TabsTrigger"
96
+
97
+ interface TabsContentProps extends React.HTMLAttributes<HTMLDivElement> {
98
+ value: string
99
+ }
100
+
101
+ const TabsContent = React.forwardRef<HTMLDivElement, TabsContentProps>(
102
+ ({ className, value, ...props }, ref) => {
103
+ const context = React.useContext(TabsContext)
104
+ if (!context) throw new Error("TabsContent must be used within Tabs")
105
+
106
+ if (context.value !== value) return null
107
+
108
+ return (
109
+ <div
110
+ ref={ref}
111
+ role="tabpanel"
112
+ tabIndex={0}
113
+ className={cn(
114
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
115
+ className
116
+ )}
117
+ {...props}
118
+ />
119
+ )
120
+ }
121
+ )
122
+ TabsContent.displayName = "TabsContent"
123
+
124
+ export { Tabs, TabsList, TabsTrigger, TabsContent }
@@ -1,64 +1,61 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { cva, type VariantProps } from "class-variance-authority"
5
- import { cn } from "@/lib/utils"
6
-
7
- const textVariants = cva("", {
8
- variants: {
9
- variant: {
10
- h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",
11
- h2: "scroll-m-20 text-3xl font-semibold tracking-tight",
12
- h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
13
- h4: "scroll-m-20 text-xl font-semibold tracking-tight",
14
- h5: "scroll-m-20 text-lg font-semibold tracking-tight",
15
- h6: "scroll-m-20 text-base font-semibold tracking-tight",
16
- p: "leading-7 [&:not(:first-child)]:mt-6",
17
- lead: "text-xl text-muted-foreground",
18
- large: "text-lg font-semibold",
19
- small: "text-sm font-medium leading-none",
20
- muted: "text-sm text-muted-foreground",
21
- code: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
22
- },
23
- },
24
- defaultVariants: {
25
- variant: "p",
26
- },
27
- })
28
-
29
- type TextVariants = VariantProps<typeof textVariants>
30
-
31
- interface TextProps extends TextVariants {
32
- className?: string
33
- children?: React.ReactNode
34
- as?: "p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label"
35
- }
36
-
37
- /**
38
- * Text component for typography
39
- *
40
- * @example
41
- * // As a heading
42
- * <Text as="h1" variant="h1">Page Title</Text>
43
- *
44
- * // Using heading styles on a different element
45
- * <Text as="span" variant="h2">Styled as H2</Text>
46
- *
47
- * // Muted text
48
- * <Text variant="muted">Secondary information</Text>
49
- */
50
- const Text = React.forwardRef<HTMLElement, TextProps>(
51
- ({ as: Component = "p", className, variant, ...props }, ref) => {
52
- return (
53
- <Component
54
- ref={ref as any}
55
- className={cn(textVariants({ variant }), className)}
56
- {...props}
57
- />
58
- )
59
- }
60
- )
61
- Text.displayName = "Text"
62
-
63
- export { Text, textVariants }
64
-
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { cn } from "@/lib/utils"
4
+
5
+ const textVariants = cva("", {
6
+ variants: {
7
+ variant: {
8
+ h1: "scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl",
9
+ h2: "scroll-m-20 text-3xl font-semibold tracking-tight",
10
+ h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
11
+ h4: "scroll-m-20 text-xl font-semibold tracking-tight",
12
+ h5: "scroll-m-20 text-lg font-semibold tracking-tight",
13
+ h6: "scroll-m-20 text-base font-semibold tracking-tight",
14
+ p: "leading-7 [&:not(:first-child)]:mt-6",
15
+ lead: "text-xl text-muted-foreground",
16
+ large: "text-lg font-semibold",
17
+ small: "text-sm font-medium leading-none",
18
+ muted: "text-sm text-muted-foreground",
19
+ code: "relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "p",
24
+ },
25
+ })
26
+
27
+ type TextVariants = VariantProps<typeof textVariants>
28
+
29
+ interface TextProps extends TextVariants {
30
+ className?: string
31
+ children?: React.ReactNode
32
+ as?: "p" | "span" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label"
33
+ }
34
+
35
+ /**
36
+ * Text component for typography
37
+ *
38
+ * @example
39
+ * // As a heading
40
+ * <Text as="h1" variant="h1">Page Title</Text>
41
+ *
42
+ * // Using heading styles on a different element
43
+ * <Text as="span" variant="h2">Styled as H2</Text>
44
+ *
45
+ * // Muted text
46
+ * <Text variant="muted">Secondary information</Text>
47
+ */
48
+ const Text = React.forwardRef<HTMLElement, TextProps>(
49
+ ({ as: Component = "p", className, variant, ...props }, ref) => {
50
+ return (
51
+ <Component
52
+ ref={ref as any}
53
+ className={cn(textVariants({ variant }), className)}
54
+ {...props}
55
+ />
56
+ )
57
+ }
58
+ )
59
+ Text.displayName = "Text"
60
+
61
+ export { Text, textVariants }