@srcroot/ui 0.0.54 → 0.0.56
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.
- package/README.md +151 -151
- package/dist/index.d.ts +0 -0
- package/dist/index.js +55 -1
- package/package.json +7 -2
- package/src/registry/analytics/google-analytics.tsx +36 -39
- package/src/registry/analytics/google-tag-manager.tsx +62 -65
- package/src/registry/analytics/meta-pixel.tsx +44 -47
- package/src/registry/analytics/microsoft-clarity.tsx +31 -34
- package/src/registry/analytics/tiktok-pixel.tsx +34 -37
- package/src/registry/lib/utils.ts +0 -0
- package/src/registry/themes/v3/blue.css +157 -157
- package/src/registry/themes/v3/glass.css +153 -153
- package/src/registry/themes/v3/gray.css +157 -157
- package/src/registry/themes/v3/green.css +157 -157
- package/src/registry/themes/v3/neutral.css +157 -157
- package/src/registry/themes/v3/orange.css +157 -157
- package/src/registry/themes/v3/rose.css +157 -157
- package/src/registry/themes/v3/slate.css +157 -157
- package/src/registry/themes/v3/stone.css +157 -157
- package/src/registry/themes/v3/violet.css +186 -186
- package/src/registry/themes/v3/zinc.css +157 -157
- package/src/registry/themes/v4/blue.css +184 -184
- package/src/registry/themes/v4/glass.css +180 -180
- package/src/registry/themes/v4/gray.css +184 -184
- package/src/registry/themes/v4/green.css +184 -184
- package/src/registry/themes/v4/neutral.css +184 -184
- package/src/registry/themes/v4/orange.css +184 -184
- package/src/registry/themes/v4/rose.css +184 -184
- package/src/registry/themes/v4/slate.css +184 -184
- package/src/registry/themes/v4/stone.css +184 -184
- package/src/registry/themes/v4/violet.css +184 -184
- package/src/registry/themes/v4/zinc.css +184 -184
- package/src/registry/ui/accordion.tsx +164 -165
- package/src/registry/ui/alert-dialog.tsx +213 -214
- package/src/registry/ui/alert.tsx +73 -76
- package/src/registry/ui/aspect-ratio.tsx +44 -47
- package/src/registry/ui/avatar.tsx +96 -97
- package/src/registry/ui/badge.tsx +52 -55
- package/src/registry/ui/breadcrumb.tsx +147 -150
- package/src/registry/ui/button-group.tsx +64 -67
- package/src/registry/ui/button.tsx +71 -72
- package/src/registry/ui/calendar.tsx +514 -515
- package/src/registry/ui/card.tsx +88 -91
- package/src/registry/ui/carousel.tsx +214 -214
- package/src/registry/ui/chart.tsx +373 -373
- package/src/registry/ui/chatbot.tsx +86 -13
- package/src/registry/ui/checkbox.tsx +93 -94
- package/src/registry/ui/collapsible.tsx +107 -108
- package/src/registry/ui/combobox.tsx +171 -171
- package/src/registry/ui/command.tsx +300 -300
- package/src/registry/ui/container.tsx +44 -47
- package/src/registry/ui/context-menu.tsx +221 -221
- package/src/registry/ui/date-picker.tsx +228 -228
- package/src/registry/ui/dialog.tsx +269 -270
- package/src/registry/ui/drawer.tsx +10 -4
- package/src/registry/ui/dropdown-menu.tsx +529 -530
- package/src/registry/ui/empty-state.tsx +0 -2
- package/src/registry/ui/file-upload.tsx +0 -0
- package/src/registry/ui/floating-dock.tsx +0 -0
- package/src/registry/ui/form-field.tsx +91 -94
- package/src/registry/ui/google-analytics.tsx +38 -0
- package/src/registry/ui/google-tag-manager.tsx +64 -0
- package/src/registry/ui/hover-card.tsx +223 -223
- package/src/registry/ui/image.tsx +144 -147
- package/src/registry/ui/input-group.tsx +82 -85
- package/src/registry/ui/input.tsx +125 -125
- package/src/registry/ui/kbd.tsx +60 -63
- package/src/registry/ui/label.tsx +36 -37
- package/src/registry/ui/loading-spinner.tsx +108 -111
- package/src/registry/ui/map.tsx +0 -0
- package/src/registry/ui/marquee.tsx +2 -0
- package/src/registry/ui/menubar.tsx +246 -246
- package/src/registry/ui/meta-pixel.tsx +46 -0
- package/src/registry/ui/microsoft-clarity.tsx +33 -0
- package/src/registry/ui/native-select.tsx +49 -52
- package/src/registry/ui/otp-input.tsx +152 -155
- package/src/registry/ui/pagination.tsx +149 -152
- package/src/registry/ui/patterns.tsx +28 -0
- package/src/registry/ui/popover.tsx +226 -227
- package/src/registry/ui/progress.tsx +51 -52
- package/src/registry/ui/radio.tsx +99 -102
- package/src/registry/ui/resizable.tsx +314 -314
- package/src/registry/ui/scroll-animation.tsx +45 -0
- package/src/registry/ui/scroll-area.tsx +121 -122
- package/src/registry/ui/scroll-to-top.tsx +0 -0
- package/src/registry/ui/search.tsx +147 -150
- package/src/registry/ui/select.tsx +292 -293
- package/src/registry/ui/separator.tsx +46 -47
- package/src/registry/ui/sheet.tsx +6 -3
- package/src/registry/ui/sidebar.tsx +628 -628
- package/src/registry/ui/skeleton.tsx +26 -29
- package/src/registry/ui/slider.tsx +196 -197
- package/src/registry/ui/slot.tsx +69 -72
- package/src/registry/ui/star-rating.tsx +131 -134
- package/src/registry/ui/switch.tsx +72 -73
- package/src/registry/ui/table-of-contents.tsx +96 -96
- package/src/registry/ui/table.tsx +138 -139
- package/src/registry/ui/tabs.tsx +124 -125
- package/src/registry/ui/text.tsx +61 -64
- package/src/registry/ui/textarea.tsx +41 -42
- package/src/registry/ui/theme-switcher.tsx +66 -66
- package/src/registry/ui/tiktok-pixel.tsx +36 -0
- package/src/registry/ui/toast.tsx +97 -98
- package/src/registry/ui/toggle-group.tsx +129 -129
- package/src/registry/ui/toggle.tsx +72 -72
- package/src/registry/ui/tooltip.tsx +143 -144
- package/src/registry/ui/whatsapp.tsx +0 -0
|
@@ -1,165 +1,164 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as React from "react"
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
|
|
6
|
-
interface AccordionContextValue {
|
|
7
|
-
value: string[]
|
|
8
|
-
onValueChange: (value: string[]) => void
|
|
9
|
-
type: "single" | "multiple"
|
|
10
|
-
collapsible: boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const AccordionContext = React.createContext<AccordionContextValue | null>(null)
|
|
14
|
-
|
|
15
|
-
interface AccordionItemContextValue {
|
|
16
|
-
value: string
|
|
17
|
-
isOpen: boolean
|
|
18
|
-
toggle: () => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const AccordionItemContext = React.createContext<AccordionItemContextValue | null>(null)
|
|
22
|
-
|
|
23
|
-
interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
24
|
-
type?: "single" | "multiple"
|
|
25
|
-
value?: string[]
|
|
26
|
-
onValueChange?: (value: string[]) => void
|
|
27
|
-
defaultValue?: string[]
|
|
28
|
-
collapsible?: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Accordion component with single/multiple expand modes
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* <Accordion type="single" collapsible>
|
|
36
|
-
* <AccordionItem value="item-1">
|
|
37
|
-
* <AccordionTrigger>Section 1</AccordionTrigger>
|
|
38
|
-
* <AccordionContent>Content 1</AccordionContent>
|
|
39
|
-
* </AccordionItem>
|
|
40
|
-
* </Accordion>
|
|
41
|
-
*/
|
|
42
|
-
const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(
|
|
43
|
-
({ className, type = "single", value: controlledValue, onValueChange, defaultValue = [], collapsible = false, children, ...props }, ref) => {
|
|
44
|
-
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)
|
|
45
|
-
|
|
46
|
-
const value = controlledValue !== undefined ? controlledValue : uncontrolledValue
|
|
47
|
-
const setValue = onValueChange || setUncontrolledValue
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<AccordionContext.Provider value={{ value, onValueChange: setValue, type, collapsible }}>
|
|
51
|
-
<div ref={ref} className={cn("", className)} {...props}>
|
|
52
|
-
{children}
|
|
53
|
-
</div>
|
|
54
|
-
</AccordionContext.Provider>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
Accordion.displayName = "Accordion"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
62
|
-
value: string
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(
|
|
66
|
-
({ className, value, children, ...props }, ref) => {
|
|
67
|
-
const context = React.useContext(AccordionContext)
|
|
68
|
-
if (!context) throw new Error("AccordionItem must be used within Accordion")
|
|
69
|
-
|
|
70
|
-
const isOpen = context.value.includes(value)
|
|
71
|
-
|
|
72
|
-
const toggle = () => {
|
|
73
|
-
if (context.type === "single") {
|
|
74
|
-
// In single mode with collapsible=false, don't allow closing
|
|
75
|
-
if (isOpen && !context.collapsible) return
|
|
76
|
-
context.onValueChange(isOpen ? [] : [value])
|
|
77
|
-
} else {
|
|
78
|
-
context.onValueChange(
|
|
79
|
-
isOpen
|
|
80
|
-
? context.value.filter((v) => v !== value)
|
|
81
|
-
: [...context.value, value]
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<AccordionItemContext.Provider value={{ value, isOpen, toggle }}>
|
|
88
|
-
<div
|
|
89
|
-
ref={ref}
|
|
90
|
-
className={cn("border-b", className)}
|
|
91
|
-
data-state={isOpen ? "open" : "closed"}
|
|
92
|
-
{...props}
|
|
93
|
-
>
|
|
94
|
-
{children}
|
|
95
|
-
</div>
|
|
96
|
-
</AccordionItemContext.Provider>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
AccordionItem.displayName = "AccordionItem"
|
|
101
|
-
|
|
102
|
-
const AccordionTrigger = React.forwardRef<
|
|
103
|
-
HTMLButtonElement,
|
|
104
|
-
React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
105
|
-
>(({ className, children, ...props }, ref) => {
|
|
106
|
-
const context = React.useContext(AccordionItemContext)
|
|
107
|
-
if (!context) throw new Error("AccordionTrigger must be used within AccordionItem")
|
|
108
|
-
|
|
109
|
-
return (
|
|
110
|
-
<h3 className="flex">
|
|
111
|
-
<button
|
|
112
|
-
ref={ref}
|
|
113
|
-
type="button"
|
|
114
|
-
aria-expanded={context.isOpen}
|
|
115
|
-
className={cn(
|
|
116
|
-
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
117
|
-
className
|
|
118
|
-
)}
|
|
119
|
-
data-state={context.isOpen ? "open" : "closed"}
|
|
120
|
-
onClick={context.toggle}
|
|
121
|
-
{...props}
|
|
122
|
-
>
|
|
123
|
-
{children}
|
|
124
|
-
<svg
|
|
125
|
-
className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"
|
|
126
|
-
fill="none"
|
|
127
|
-
viewBox="0 0 24 24"
|
|
128
|
-
stroke="currentColor"
|
|
129
|
-
strokeWidth={2}
|
|
130
|
-
>
|
|
131
|
-
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
|
|
132
|
-
</svg>
|
|
133
|
-
</button>
|
|
134
|
-
</h3>
|
|
135
|
-
)
|
|
136
|
-
})
|
|
137
|
-
AccordionTrigger.displayName = "AccordionTrigger"
|
|
138
|
-
|
|
139
|
-
const AccordionContent = React.forwardRef<
|
|
140
|
-
HTMLDivElement,
|
|
141
|
-
React.HTMLAttributes<HTMLDivElement>
|
|
142
|
-
>(({ className, children, ...props }, ref) => {
|
|
143
|
-
const context = React.useContext(AccordionItemContext)
|
|
144
|
-
if (!context) throw new Error("AccordionContent must be used within AccordionItem")
|
|
145
|
-
|
|
146
|
-
return (
|
|
147
|
-
<div
|
|
148
|
-
ref={ref}
|
|
149
|
-
role="region"
|
|
150
|
-
className={cn(
|
|
151
|
-
"overflow-hidden text-sm",
|
|
152
|
-
context.isOpen ? "animate-accordion-down" : "animate-accordion-up hidden",
|
|
153
|
-
className
|
|
154
|
-
)}
|
|
155
|
-
data-state={context.isOpen ? "open" : "closed"}
|
|
156
|
-
{...props}
|
|
157
|
-
>
|
|
158
|
-
<div className="pb-4 pt-0">{children}</div>
|
|
159
|
-
</div>
|
|
160
|
-
)
|
|
161
|
-
})
|
|
162
|
-
AccordionContent.displayName = "AccordionContent"
|
|
163
|
-
|
|
164
|
-
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
165
|
-
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
interface AccordionContextValue {
|
|
7
|
+
value: string[]
|
|
8
|
+
onValueChange: (value: string[]) => void
|
|
9
|
+
type: "single" | "multiple"
|
|
10
|
+
collapsible: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const AccordionContext = React.createContext<AccordionContextValue | null>(null)
|
|
14
|
+
|
|
15
|
+
interface AccordionItemContextValue {
|
|
16
|
+
value: string
|
|
17
|
+
isOpen: boolean
|
|
18
|
+
toggle: () => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const AccordionItemContext = React.createContext<AccordionItemContextValue | null>(null)
|
|
22
|
+
|
|
23
|
+
interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
24
|
+
type?: "single" | "multiple"
|
|
25
|
+
value?: string[]
|
|
26
|
+
onValueChange?: (value: string[]) => void
|
|
27
|
+
defaultValue?: string[]
|
|
28
|
+
collapsible?: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Accordion component with single/multiple expand modes
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <Accordion type="single" collapsible>
|
|
36
|
+
* <AccordionItem value="item-1">
|
|
37
|
+
* <AccordionTrigger>Section 1</AccordionTrigger>
|
|
38
|
+
* <AccordionContent>Content 1</AccordionContent>
|
|
39
|
+
* </AccordionItem>
|
|
40
|
+
* </Accordion>
|
|
41
|
+
*/
|
|
42
|
+
const Accordion = React.forwardRef<HTMLDivElement, AccordionProps>(
|
|
43
|
+
({ className, type = "single", value: controlledValue, onValueChange, defaultValue = [], collapsible = false, children, ...props }, ref) => {
|
|
44
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState(defaultValue)
|
|
45
|
+
|
|
46
|
+
const value = controlledValue !== undefined ? controlledValue : uncontrolledValue
|
|
47
|
+
const setValue = onValueChange || setUncontrolledValue
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<AccordionContext.Provider value={{ value, onValueChange: setValue, type, collapsible }}>
|
|
51
|
+
<div ref={ref} className={cn("", className)} {...props}>
|
|
52
|
+
{children}
|
|
53
|
+
</div>
|
|
54
|
+
</AccordionContext.Provider>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
Accordion.displayName = "Accordion"
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
62
|
+
value: string
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const AccordionItem = React.forwardRef<HTMLDivElement, AccordionItemProps>(
|
|
66
|
+
({ className, value, children, ...props }, ref) => {
|
|
67
|
+
const context = React.useContext(AccordionContext)
|
|
68
|
+
if (!context) throw new Error("AccordionItem must be used within Accordion")
|
|
69
|
+
|
|
70
|
+
const isOpen = context.value.includes(value)
|
|
71
|
+
|
|
72
|
+
const toggle = () => {
|
|
73
|
+
if (context.type === "single") {
|
|
74
|
+
// In single mode with collapsible=false, don't allow closing
|
|
75
|
+
if (isOpen && !context.collapsible) return
|
|
76
|
+
context.onValueChange(isOpen ? [] : [value])
|
|
77
|
+
} else {
|
|
78
|
+
context.onValueChange(
|
|
79
|
+
isOpen
|
|
80
|
+
? context.value.filter((v) => v !== value)
|
|
81
|
+
: [...context.value, value]
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<AccordionItemContext.Provider value={{ value, isOpen, toggle }}>
|
|
88
|
+
<div
|
|
89
|
+
ref={ref}
|
|
90
|
+
className={cn("border-b", className)}
|
|
91
|
+
data-state={isOpen ? "open" : "closed"}
|
|
92
|
+
{...props}
|
|
93
|
+
>
|
|
94
|
+
{children}
|
|
95
|
+
</div>
|
|
96
|
+
</AccordionItemContext.Provider>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
AccordionItem.displayName = "AccordionItem"
|
|
101
|
+
|
|
102
|
+
const AccordionTrigger = React.forwardRef<
|
|
103
|
+
HTMLButtonElement,
|
|
104
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
105
|
+
>(({ className, children, ...props }, ref) => {
|
|
106
|
+
const context = React.useContext(AccordionItemContext)
|
|
107
|
+
if (!context) throw new Error("AccordionTrigger must be used within AccordionItem")
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<h3 className="flex">
|
|
111
|
+
<button
|
|
112
|
+
ref={ref}
|
|
113
|
+
type="button"
|
|
114
|
+
aria-expanded={context.isOpen}
|
|
115
|
+
className={cn(
|
|
116
|
+
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
117
|
+
className
|
|
118
|
+
)}
|
|
119
|
+
data-state={context.isOpen ? "open" : "closed"}
|
|
120
|
+
onClick={context.toggle}
|
|
121
|
+
{...props}
|
|
122
|
+
>
|
|
123
|
+
{children}
|
|
124
|
+
<svg
|
|
125
|
+
className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"
|
|
126
|
+
fill="none"
|
|
127
|
+
viewBox="0 0 24 24"
|
|
128
|
+
stroke="currentColor"
|
|
129
|
+
strokeWidth={2}
|
|
130
|
+
>
|
|
131
|
+
<path strokeLinecap="round" strokeLinejoin="round" d="M19 9l-7 7-7-7" />
|
|
132
|
+
</svg>
|
|
133
|
+
</button>
|
|
134
|
+
</h3>
|
|
135
|
+
)
|
|
136
|
+
})
|
|
137
|
+
AccordionTrigger.displayName = "AccordionTrigger"
|
|
138
|
+
|
|
139
|
+
const AccordionContent = React.forwardRef<
|
|
140
|
+
HTMLDivElement,
|
|
141
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
142
|
+
>(({ className, children, ...props }, ref) => {
|
|
143
|
+
const context = React.useContext(AccordionItemContext)
|
|
144
|
+
if (!context) throw new Error("AccordionContent must be used within AccordionItem")
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<div
|
|
148
|
+
ref={ref}
|
|
149
|
+
role="region"
|
|
150
|
+
className={cn(
|
|
151
|
+
"overflow-hidden text-sm",
|
|
152
|
+
context.isOpen ? "animate-accordion-down" : "animate-accordion-up hidden",
|
|
153
|
+
className
|
|
154
|
+
)}
|
|
155
|
+
data-state={context.isOpen ? "open" : "closed"}
|
|
156
|
+
{...props}
|
|
157
|
+
>
|
|
158
|
+
<div className="pb-4 pt-0">{children}</div>
|
|
159
|
+
</div>
|
|
160
|
+
)
|
|
161
|
+
})
|
|
162
|
+
AccordionContent.displayName = "AccordionContent"
|
|
163
|
+
|
|
164
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|