tokka 0.2.0 → 0.2.1
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/components/accordion.tsx +55 -0
- package/components/alert-dialog.tsx +138 -0
- package/components/alert.tsx +58 -0
- package/components/aspect-ratio.tsx +5 -0
- package/components/avatar.tsx +47 -0
- package/components/badge.tsx +35 -0
- package/components/breadcrumb.tsx +114 -0
- package/components/button.tsx +56 -0
- package/components/calendar.tsx +63 -0
- package/components/card.tsx +74 -0
- package/components/carousel.tsx +259 -0
- package/components/chart.tsx +9 -0
- package/components/checkbox.tsx +27 -0
- package/components/collapsible.tsx +9 -0
- package/components/combobox.tsx +8 -0
- package/components/command.tsx +152 -0
- package/components/context-menu.tsx +197 -0
- package/components/data-table.tsx +9 -0
- package/components/date-picker.tsx +8 -0
- package/components/dialog.tsx +119 -0
- package/components/drawer.tsx +115 -0
- package/components/dropdown-menu.tsx +197 -0
- package/components/form.tsx +175 -0
- package/components/hover-card.tsx +26 -0
- package/components/input-otp.tsx +68 -0
- package/components/input.tsx +48 -0
- package/components/label.tsx +23 -0
- package/components/lib/utils.ts +6 -0
- package/components/menubar.tsx +233 -0
- package/components/native-select.tsx +29 -0
- package/components/navigation-menu.tsx +127 -0
- package/components/pagination.tsx +116 -0
- package/components/popover.tsx +28 -0
- package/components/progress.tsx +25 -0
- package/components/radio-group.tsx +41 -0
- package/components/resizable.tsx +42 -0
- package/components/scroll-area.tsx +45 -0
- package/components/select.tsx +157 -0
- package/components/separator.tsx +28 -0
- package/components/sheet.tsx +137 -0
- package/components/sidebar.tsx +249 -0
- package/components/skeleton.tsx +15 -0
- package/components/slider.tsx +25 -0
- package/components/sonner.tsx +25 -0
- package/components/spinner.tsx +33 -0
- package/components/switch.tsx +26 -0
- package/components/table.tsx +116 -0
- package/components/tabs.tsx +52 -0
- package/components/textarea.tsx +23 -0
- package/components/toggle-group.tsx +58 -0
- package/components/toggle.tsx +42 -0
- package/components/tooltip.tsx +27 -0
- package/dist/index.js +49 -2
- package/package.json +4 -2
- package/systems/README.md +56 -0
- package/systems/accessible/system.json +17 -0
- package/systems/accessible/tokens/primitives.json +9 -0
- package/systems/accessible/tokens/semantics.json +11 -0
- package/systems/brutalist/system.json +17 -0
- package/systems/brutalist/tokens/primitives.json +10 -0
- package/systems/brutalist/tokens/semantics.json +12 -0
- package/systems/corporate/system.json +20 -0
- package/systems/corporate/tokens/primitives.json +60 -0
- package/systems/corporate/tokens/semantics.json +68 -0
- package/systems/dark-mode/system.json +17 -0
- package/systems/dark-mode/tokens/primitives.json +10 -0
- package/systems/dark-mode/tokens/semantics.json +11 -0
- package/systems/package.json +14 -0
- package/systems/soft-saas/system.json +20 -0
- package/systems/soft-saas/tokens/primitives.json +235 -0
- package/systems/soft-saas/tokens/semantics.json +190 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import useEmblaCarousel, {
|
|
3
|
+
type UseEmblaCarouselType,
|
|
4
|
+
} from "embla-carousel-react"
|
|
5
|
+
import { ArrowLeft, ArrowRight } from "lucide-react"
|
|
6
|
+
import { cn } from "./lib/utils"
|
|
7
|
+
import { Button } from "./button"
|
|
8
|
+
|
|
9
|
+
type CarouselApi = UseEmblaCarouselType[1]
|
|
10
|
+
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
|
|
11
|
+
type CarouselOptions = UseCarouselParameters[0]
|
|
12
|
+
type CarouselPlugin = UseCarouselParameters[1]
|
|
13
|
+
|
|
14
|
+
type CarouselProps = {
|
|
15
|
+
opts?: CarouselOptions
|
|
16
|
+
plugins?: CarouselPlugin
|
|
17
|
+
orientation?: "horizontal" | "vertical"
|
|
18
|
+
setApi?: (api: CarouselApi) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type CarouselContextProps = {
|
|
22
|
+
carouselRef: ReturnType<typeof useEmblaCarousel>[0]
|
|
23
|
+
api: ReturnType<typeof useEmblaCarousel>[1]
|
|
24
|
+
scrollPrev: () => void
|
|
25
|
+
scrollNext: () => void
|
|
26
|
+
canScrollPrev: boolean
|
|
27
|
+
canScrollNext: boolean
|
|
28
|
+
} & CarouselProps
|
|
29
|
+
|
|
30
|
+
const CarouselContext = React.createContext<CarouselContextProps | null>(null)
|
|
31
|
+
|
|
32
|
+
function useCarousel() {
|
|
33
|
+
const context = React.useContext(CarouselContext)
|
|
34
|
+
|
|
35
|
+
if (!context) {
|
|
36
|
+
throw new Error("useCarousel must be used within a <Carousel />")
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return context
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const Carousel = React.forwardRef<
|
|
43
|
+
HTMLDivElement,
|
|
44
|
+
React.HTMLAttributes<HTMLDivElement> & CarouselProps
|
|
45
|
+
>(
|
|
46
|
+
(
|
|
47
|
+
{
|
|
48
|
+
orientation = "horizontal",
|
|
49
|
+
opts,
|
|
50
|
+
setApi,
|
|
51
|
+
plugins,
|
|
52
|
+
className,
|
|
53
|
+
children,
|
|
54
|
+
...props
|
|
55
|
+
},
|
|
56
|
+
ref
|
|
57
|
+
) => {
|
|
58
|
+
const [carouselRef, api] = useEmblaCarousel(
|
|
59
|
+
{
|
|
60
|
+
...opts,
|
|
61
|
+
axis: orientation === "horizontal" ? "x" : "y",
|
|
62
|
+
},
|
|
63
|
+
plugins
|
|
64
|
+
)
|
|
65
|
+
const [canScrollPrev, setCanScrollPrev] = React.useState(false)
|
|
66
|
+
const [canScrollNext, setCanScrollNext] = React.useState(false)
|
|
67
|
+
|
|
68
|
+
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
69
|
+
if (!api) {
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setCanScrollPrev(api.canScrollPrev())
|
|
74
|
+
setCanScrollNext(api.canScrollNext())
|
|
75
|
+
}, [])
|
|
76
|
+
|
|
77
|
+
const scrollPrev = React.useCallback(() => {
|
|
78
|
+
api?.scrollPrev()
|
|
79
|
+
}, [api])
|
|
80
|
+
|
|
81
|
+
const scrollNext = React.useCallback(() => {
|
|
82
|
+
api?.scrollNext()
|
|
83
|
+
}, [api])
|
|
84
|
+
|
|
85
|
+
const handleKeyDown = React.useCallback(
|
|
86
|
+
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
87
|
+
if (event.key === "ArrowLeft") {
|
|
88
|
+
event.preventDefault()
|
|
89
|
+
scrollPrev()
|
|
90
|
+
} else if (event.key === "ArrowRight") {
|
|
91
|
+
event.preventDefault()
|
|
92
|
+
scrollNext()
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
[scrollPrev, scrollNext]
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
if (!api || !setApi) {
|
|
100
|
+
return
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setApi(api)
|
|
104
|
+
}, [api, setApi])
|
|
105
|
+
|
|
106
|
+
React.useEffect(() => {
|
|
107
|
+
if (!api) {
|
|
108
|
+
return
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
onSelect(api)
|
|
112
|
+
api.on("reInit", onSelect)
|
|
113
|
+
api.on("select", onSelect)
|
|
114
|
+
|
|
115
|
+
return () => {
|
|
116
|
+
api?.off("select", onSelect)
|
|
117
|
+
}
|
|
118
|
+
}, [api, onSelect])
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<CarouselContext.Provider
|
|
122
|
+
value={{
|
|
123
|
+
carouselRef,
|
|
124
|
+
api: api,
|
|
125
|
+
opts,
|
|
126
|
+
orientation:
|
|
127
|
+
orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
|
|
128
|
+
scrollPrev,
|
|
129
|
+
scrollNext,
|
|
130
|
+
canScrollPrev,
|
|
131
|
+
canScrollNext,
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<div
|
|
135
|
+
ref={ref}
|
|
136
|
+
onKeyDownCapture={handleKeyDown}
|
|
137
|
+
className={cn("relative", className)}
|
|
138
|
+
role="region"
|
|
139
|
+
aria-roledescription="carousel"
|
|
140
|
+
{...props}
|
|
141
|
+
>
|
|
142
|
+
{children}
|
|
143
|
+
</div>
|
|
144
|
+
</CarouselContext.Provider>
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
Carousel.displayName = "Carousel"
|
|
149
|
+
|
|
150
|
+
const CarouselContent = React.forwardRef<
|
|
151
|
+
HTMLDivElement,
|
|
152
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
153
|
+
>(({ className, ...props }, ref) => {
|
|
154
|
+
const { carouselRef, orientation } = useCarousel()
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div ref={carouselRef} className="overflow-hidden">
|
|
158
|
+
<div
|
|
159
|
+
ref={ref}
|
|
160
|
+
className={cn(
|
|
161
|
+
"flex",
|
|
162
|
+
orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
|
|
163
|
+
className
|
|
164
|
+
)}
|
|
165
|
+
{...props}
|
|
166
|
+
/>
|
|
167
|
+
</div>
|
|
168
|
+
)
|
|
169
|
+
})
|
|
170
|
+
CarouselContent.displayName = "CarouselContent"
|
|
171
|
+
|
|
172
|
+
const CarouselItem = React.forwardRef<
|
|
173
|
+
HTMLDivElement,
|
|
174
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
175
|
+
>(({ className, ...props }, ref) => {
|
|
176
|
+
const { orientation } = useCarousel()
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<div
|
|
180
|
+
ref={ref}
|
|
181
|
+
role="group"
|
|
182
|
+
aria-roledescription="slide"
|
|
183
|
+
className={cn(
|
|
184
|
+
"min-w-0 shrink-0 grow-0 basis-full",
|
|
185
|
+
orientation === "horizontal" ? "pl-4" : "pt-4",
|
|
186
|
+
className
|
|
187
|
+
)}
|
|
188
|
+
{...props}
|
|
189
|
+
/>
|
|
190
|
+
)
|
|
191
|
+
})
|
|
192
|
+
CarouselItem.displayName = "CarouselItem"
|
|
193
|
+
|
|
194
|
+
const CarouselPrevious = React.forwardRef<
|
|
195
|
+
HTMLButtonElement,
|
|
196
|
+
React.ComponentProps<typeof Button>
|
|
197
|
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
|
198
|
+
const { orientation, scrollPrev, canScrollPrev } = useCarousel()
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<Button
|
|
202
|
+
ref={ref}
|
|
203
|
+
variant={variant}
|
|
204
|
+
size={size}
|
|
205
|
+
className={cn(
|
|
206
|
+
"absolute size-8 rounded-full",
|
|
207
|
+
orientation === "horizontal"
|
|
208
|
+
? "-left-12 top-1/2 -translate-y-1/2"
|
|
209
|
+
: "-top-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
210
|
+
className
|
|
211
|
+
)}
|
|
212
|
+
disabled={!canScrollPrev}
|
|
213
|
+
onClick={scrollPrev}
|
|
214
|
+
{...props}
|
|
215
|
+
>
|
|
216
|
+
<ArrowLeft className="size-4" />
|
|
217
|
+
<span className="sr-only">Previous slide</span>
|
|
218
|
+
</Button>
|
|
219
|
+
)
|
|
220
|
+
})
|
|
221
|
+
CarouselPrevious.displayName = "CarouselPrevious"
|
|
222
|
+
|
|
223
|
+
const CarouselNext = React.forwardRef<
|
|
224
|
+
HTMLButtonElement,
|
|
225
|
+
React.ComponentProps<typeof Button>
|
|
226
|
+
>(({ className, variant = "outline", size = "icon", ...props }, ref) => {
|
|
227
|
+
const { orientation, scrollNext, canScrollNext } = useCarousel()
|
|
228
|
+
|
|
229
|
+
return (
|
|
230
|
+
<Button
|
|
231
|
+
ref={ref}
|
|
232
|
+
variant={variant}
|
|
233
|
+
size={size}
|
|
234
|
+
className={cn(
|
|
235
|
+
"absolute size-8 rounded-full",
|
|
236
|
+
orientation === "horizontal"
|
|
237
|
+
? "-right-12 top-1/2 -translate-y-1/2"
|
|
238
|
+
: "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
|
|
239
|
+
className
|
|
240
|
+
)}
|
|
241
|
+
disabled={!canScrollNext}
|
|
242
|
+
onClick={scrollNext}
|
|
243
|
+
{...props}
|
|
244
|
+
>
|
|
245
|
+
<ArrowRight className="size-4" />
|
|
246
|
+
<span className="sr-only">Next slide</span>
|
|
247
|
+
</Button>
|
|
248
|
+
)
|
|
249
|
+
})
|
|
250
|
+
CarouselNext.displayName = "CarouselNext"
|
|
251
|
+
|
|
252
|
+
export {
|
|
253
|
+
type CarouselApi,
|
|
254
|
+
Carousel,
|
|
255
|
+
CarouselContent,
|
|
256
|
+
CarouselItem,
|
|
257
|
+
CarouselPrevious,
|
|
258
|
+
CarouselNext,
|
|
259
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Note: Chart is a comprehensive component built on recharts
|
|
2
|
+
// This is a placeholder export. Full implementation would be very large.
|
|
3
|
+
// Users should refer to https://ui.shadcn.com/docs/components/chart for the complete implementation.
|
|
4
|
+
|
|
5
|
+
// Re-export recharts for users who want to build charts
|
|
6
|
+
export * from "recharts"
|
|
7
|
+
|
|
8
|
+
// The chart component in shadcn is actually a pattern/example rather than a single component
|
|
9
|
+
// It demonstrates how to build charts with recharts + tailwind styling
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
|
|
3
|
+
import { Check } from "lucide-react"
|
|
4
|
+
import { cn } from "./lib/utils"
|
|
5
|
+
|
|
6
|
+
const Checkbox = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof CheckboxPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<CheckboxPrimitive.Root
|
|
11
|
+
ref={ref}
|
|
12
|
+
className={cn(
|
|
13
|
+
"peer size-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<CheckboxPrimitive.Indicator
|
|
19
|
+
className={cn("flex items-center justify-center text-current")}
|
|
20
|
+
>
|
|
21
|
+
<Check className="size-4" />
|
|
22
|
+
</CheckboxPrimitive.Indicator>
|
|
23
|
+
</CheckboxPrimitive.Root>
|
|
24
|
+
))
|
|
25
|
+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
|
|
26
|
+
|
|
27
|
+
export { Checkbox }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
|
|
2
|
+
|
|
3
|
+
const Collapsible = CollapsiblePrimitive.Root
|
|
4
|
+
|
|
5
|
+
const CollapsibleTrigger = CollapsiblePrimitive.Trigger
|
|
6
|
+
|
|
7
|
+
const CollapsibleContent = CollapsiblePrimitive.Content
|
|
8
|
+
|
|
9
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Combobox is a composition of Command + Popover
|
|
2
|
+
// This provides the building blocks - users compose them together
|
|
3
|
+
|
|
4
|
+
export * from "./command"
|
|
5
|
+
export * from "./popover"
|
|
6
|
+
|
|
7
|
+
// Example usage documented at: https://ui.shadcn.com/docs/components/combobox
|
|
8
|
+
// Combobox = Popover + Command + custom state management
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { type DialogProps } from "@radix-ui/react-dialog"
|
|
3
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
4
|
+
import { Search } from "lucide-react"
|
|
5
|
+
import { cn } from "./lib/utils"
|
|
6
|
+
import { Dialog, DialogContent } from "./dialog"
|
|
7
|
+
|
|
8
|
+
const Command = React.forwardRef<
|
|
9
|
+
React.ElementRef<typeof CommandPrimitive>,
|
|
10
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive>
|
|
11
|
+
>(({ className, ...props }, ref) => (
|
|
12
|
+
<CommandPrimitive
|
|
13
|
+
ref={ref}
|
|
14
|
+
className={cn(
|
|
15
|
+
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
16
|
+
className
|
|
17
|
+
)}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
))
|
|
21
|
+
Command.displayName = CommandPrimitive.displayName
|
|
22
|
+
|
|
23
|
+
interface CommandDialogProps extends DialogProps {}
|
|
24
|
+
|
|
25
|
+
const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
|
|
26
|
+
return (
|
|
27
|
+
<Dialog {...props}>
|
|
28
|
+
<DialogContent className="overflow-hidden p-0 shadow-lg">
|
|
29
|
+
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5">
|
|
30
|
+
{children}
|
|
31
|
+
</Command>
|
|
32
|
+
</DialogContent>
|
|
33
|
+
</Dialog>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const CommandInput = React.forwardRef<
|
|
38
|
+
React.ElementRef<typeof CommandPrimitive.Input>,
|
|
39
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
|
|
40
|
+
>(({ className, ...props }, ref) => (
|
|
41
|
+
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
|
|
42
|
+
<Search className="mr-2 size-4 shrink-0 opacity-50" />
|
|
43
|
+
<CommandPrimitive.Input
|
|
44
|
+
ref={ref}
|
|
45
|
+
className={cn(
|
|
46
|
+
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
))
|
|
53
|
+
|
|
54
|
+
CommandInput.displayName = CommandPrimitive.Input.displayName
|
|
55
|
+
|
|
56
|
+
const CommandList = React.forwardRef<
|
|
57
|
+
React.ElementRef<typeof CommandPrimitive.List>,
|
|
58
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
|
|
59
|
+
>(({ className, ...props }, ref) => (
|
|
60
|
+
<CommandPrimitive.List
|
|
61
|
+
ref={ref}
|
|
62
|
+
className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
))
|
|
66
|
+
|
|
67
|
+
CommandList.displayName = CommandPrimitive.List.displayName
|
|
68
|
+
|
|
69
|
+
const CommandEmpty = React.forwardRef<
|
|
70
|
+
React.ElementRef<typeof CommandPrimitive.Empty>,
|
|
71
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
72
|
+
>((props, ref) => (
|
|
73
|
+
<CommandPrimitive.Empty
|
|
74
|
+
ref={ref}
|
|
75
|
+
className="py-6 text-center text-sm"
|
|
76
|
+
{...props}
|
|
77
|
+
/>
|
|
78
|
+
))
|
|
79
|
+
|
|
80
|
+
CommandEmpty.displayName = CommandPrimitive.Empty.displayName
|
|
81
|
+
|
|
82
|
+
const CommandGroup = React.forwardRef<
|
|
83
|
+
React.ElementRef<typeof CommandPrimitive.Group>,
|
|
84
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
|
|
85
|
+
>(({ className, ...props }, ref) => (
|
|
86
|
+
<CommandPrimitive.Group
|
|
87
|
+
ref={ref}
|
|
88
|
+
className={cn(
|
|
89
|
+
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
90
|
+
className
|
|
91
|
+
)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
))
|
|
95
|
+
|
|
96
|
+
CommandGroup.displayName = CommandPrimitive.Group.displayName
|
|
97
|
+
|
|
98
|
+
const CommandSeparator = React.forwardRef<
|
|
99
|
+
React.ElementRef<typeof CommandPrimitive.Separator>,
|
|
100
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
|
|
101
|
+
>(({ className, ...props }, ref) => (
|
|
102
|
+
<CommandPrimitive.Separator
|
|
103
|
+
ref={ref}
|
|
104
|
+
className={cn("-mx-1 h-px bg-border", className)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
))
|
|
108
|
+
CommandSeparator.displayName = CommandPrimitive.Separator.displayName
|
|
109
|
+
|
|
110
|
+
const CommandItem = React.forwardRef<
|
|
111
|
+
React.ElementRef<typeof CommandPrimitive.Item>,
|
|
112
|
+
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
|
|
113
|
+
>(({ className, ...props }, ref) => (
|
|
114
|
+
<CommandPrimitive.Item
|
|
115
|
+
ref={ref}
|
|
116
|
+
className={cn(
|
|
117
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
118
|
+
className
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
/>
|
|
122
|
+
))
|
|
123
|
+
|
|
124
|
+
CommandItem.displayName = CommandPrimitive.Item.displayName
|
|
125
|
+
|
|
126
|
+
const CommandShortcut = ({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
130
|
+
return (
|
|
131
|
+
<span
|
|
132
|
+
className={cn(
|
|
133
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
134
|
+
className
|
|
135
|
+
)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
CommandShortcut.displayName = "CommandShortcut"
|
|
141
|
+
|
|
142
|
+
export {
|
|
143
|
+
Command,
|
|
144
|
+
CommandDialog,
|
|
145
|
+
CommandInput,
|
|
146
|
+
CommandList,
|
|
147
|
+
CommandEmpty,
|
|
148
|
+
CommandGroup,
|
|
149
|
+
CommandItem,
|
|
150
|
+
CommandShortcut,
|
|
151
|
+
CommandSeparator,
|
|
152
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
|
|
3
|
+
import { Check, ChevronRight, Circle } from "lucide-react"
|
|
4
|
+
import { cn } from "./lib/utils"
|
|
5
|
+
|
|
6
|
+
const ContextMenu = ContextMenuPrimitive.Root
|
|
7
|
+
|
|
8
|
+
const ContextMenuTrigger = ContextMenuPrimitive.Trigger
|
|
9
|
+
|
|
10
|
+
const ContextMenuGroup = ContextMenuPrimitive.Group
|
|
11
|
+
|
|
12
|
+
const ContextMenuPortal = ContextMenuPrimitive.Portal
|
|
13
|
+
|
|
14
|
+
const ContextMenuSub = ContextMenuPrimitive.Sub
|
|
15
|
+
|
|
16
|
+
const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
|
|
17
|
+
|
|
18
|
+
const ContextMenuSubTrigger = React.forwardRef<
|
|
19
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
|
|
20
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
|
|
21
|
+
inset?: boolean
|
|
22
|
+
}
|
|
23
|
+
>(({ className, inset, children, ...props }, ref) => (
|
|
24
|
+
<ContextMenuPrimitive.SubTrigger
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={cn(
|
|
27
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
|
28
|
+
inset && "pl-8",
|
|
29
|
+
className
|
|
30
|
+
)}
|
|
31
|
+
{...props}
|
|
32
|
+
>
|
|
33
|
+
{children}
|
|
34
|
+
<ChevronRight className="ml-auto size-4" />
|
|
35
|
+
</ContextMenuPrimitive.SubTrigger>
|
|
36
|
+
))
|
|
37
|
+
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
|
|
38
|
+
|
|
39
|
+
const ContextMenuSubContent = React.forwardRef<
|
|
40
|
+
React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
|
|
41
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
|
|
42
|
+
>(({ className, ...props }, ref) => (
|
|
43
|
+
<ContextMenuPrimitive.SubContent
|
|
44
|
+
ref={ref}
|
|
45
|
+
className={cn(
|
|
46
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
))
|
|
52
|
+
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
|
|
53
|
+
|
|
54
|
+
const ContextMenuContent = React.forwardRef<
|
|
55
|
+
React.ElementRef<typeof ContextMenuPrimitive.Content>,
|
|
56
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
|
57
|
+
>(({ className, ...props }, ref) => (
|
|
58
|
+
<ContextMenuPrimitive.Portal>
|
|
59
|
+
<ContextMenuPrimitive.Content
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cn(
|
|
62
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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",
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
</ContextMenuPrimitive.Portal>
|
|
68
|
+
))
|
|
69
|
+
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
|
|
70
|
+
|
|
71
|
+
const ContextMenuItem = React.forwardRef<
|
|
72
|
+
React.ElementRef<typeof ContextMenuPrimitive.Item>,
|
|
73
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
|
|
74
|
+
inset?: boolean
|
|
75
|
+
}
|
|
76
|
+
>(({ className, inset, ...props }, ref) => (
|
|
77
|
+
<ContextMenuPrimitive.Item
|
|
78
|
+
ref={ref}
|
|
79
|
+
className={cn(
|
|
80
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
81
|
+
inset && "pl-8",
|
|
82
|
+
className
|
|
83
|
+
)}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
))
|
|
87
|
+
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
|
|
88
|
+
|
|
89
|
+
const ContextMenuCheckboxItem = React.forwardRef<
|
|
90
|
+
React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
|
|
91
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
|
|
92
|
+
>(({ className, children, checked, ...props }, ref) => (
|
|
93
|
+
<ContextMenuPrimitive.CheckboxItem
|
|
94
|
+
ref={ref}
|
|
95
|
+
className={cn(
|
|
96
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
97
|
+
className
|
|
98
|
+
)}
|
|
99
|
+
checked={checked}
|
|
100
|
+
{...props}
|
|
101
|
+
>
|
|
102
|
+
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
103
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
104
|
+
<Check className="size-4" />
|
|
105
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
106
|
+
</span>
|
|
107
|
+
{children}
|
|
108
|
+
</ContextMenuPrimitive.CheckboxItem>
|
|
109
|
+
))
|
|
110
|
+
ContextMenuCheckboxItem.displayName =
|
|
111
|
+
ContextMenuPrimitive.CheckboxItem.displayName
|
|
112
|
+
|
|
113
|
+
const ContextMenuRadioItem = React.forwardRef<
|
|
114
|
+
React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
|
|
115
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
|
|
116
|
+
>(({ className, children, ...props }, ref) => (
|
|
117
|
+
<ContextMenuPrimitive.RadioItem
|
|
118
|
+
ref={ref}
|
|
119
|
+
className={cn(
|
|
120
|
+
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
121
|
+
className
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
>
|
|
125
|
+
<span className="absolute left-2 flex size-3.5 items-center justify-center">
|
|
126
|
+
<ContextMenuPrimitive.ItemIndicator>
|
|
127
|
+
<Circle className="size-2 fill-current" />
|
|
128
|
+
</ContextMenuPrimitive.ItemIndicator>
|
|
129
|
+
</span>
|
|
130
|
+
{children}
|
|
131
|
+
</ContextMenuPrimitive.RadioItem>
|
|
132
|
+
))
|
|
133
|
+
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
|
|
134
|
+
|
|
135
|
+
const ContextMenuLabel = React.forwardRef<
|
|
136
|
+
React.ElementRef<typeof ContextMenuPrimitive.Label>,
|
|
137
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
|
|
138
|
+
inset?: boolean
|
|
139
|
+
}
|
|
140
|
+
>(({ className, inset, ...props }, ref) => (
|
|
141
|
+
<ContextMenuPrimitive.Label
|
|
142
|
+
ref={ref}
|
|
143
|
+
className={cn(
|
|
144
|
+
"px-2 py-1.5 text-sm font-semibold text-foreground",
|
|
145
|
+
inset && "pl-8",
|
|
146
|
+
className
|
|
147
|
+
)}
|
|
148
|
+
{...props}
|
|
149
|
+
/>
|
|
150
|
+
))
|
|
151
|
+
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
|
|
152
|
+
|
|
153
|
+
const ContextMenuSeparator = React.forwardRef<
|
|
154
|
+
React.ElementRef<typeof ContextMenuPrimitive.Separator>,
|
|
155
|
+
React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
|
|
156
|
+
>(({ className, ...props }, ref) => (
|
|
157
|
+
<ContextMenuPrimitive.Separator
|
|
158
|
+
ref={ref}
|
|
159
|
+
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
160
|
+
{...props}
|
|
161
|
+
/>
|
|
162
|
+
))
|
|
163
|
+
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
|
|
164
|
+
|
|
165
|
+
const ContextMenuShortcut = ({
|
|
166
|
+
className,
|
|
167
|
+
...props
|
|
168
|
+
}: React.HTMLAttributes<HTMLSpanElement>) => {
|
|
169
|
+
return (
|
|
170
|
+
<span
|
|
171
|
+
className={cn(
|
|
172
|
+
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
173
|
+
className
|
|
174
|
+
)}
|
|
175
|
+
{...props}
|
|
176
|
+
/>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
ContextMenuShortcut.displayName = "ContextMenuShortcut"
|
|
180
|
+
|
|
181
|
+
export {
|
|
182
|
+
ContextMenu,
|
|
183
|
+
ContextMenuTrigger,
|
|
184
|
+
ContextMenuContent,
|
|
185
|
+
ContextMenuItem,
|
|
186
|
+
ContextMenuCheckboxItem,
|
|
187
|
+
ContextMenuRadioItem,
|
|
188
|
+
ContextMenuLabel,
|
|
189
|
+
ContextMenuSeparator,
|
|
190
|
+
ContextMenuShortcut,
|
|
191
|
+
ContextMenuGroup,
|
|
192
|
+
ContextMenuPortal,
|
|
193
|
+
ContextMenuSub,
|
|
194
|
+
ContextMenuSubContent,
|
|
195
|
+
ContextMenuSubTrigger,
|
|
196
|
+
ContextMenuRadioGroup,
|
|
197
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Note: Data Table is a pattern that combines Table with @tanstack/react-table
|
|
2
|
+
// This is a simplified placeholder. Full implementation would be very large.
|
|
3
|
+
// Users should refer to https://ui.shadcn.com/docs/components/data-table for the complete pattern.
|
|
4
|
+
|
|
5
|
+
export * from "./table"
|
|
6
|
+
|
|
7
|
+
// Re-export table components as data-table components
|
|
8
|
+
// The data table pattern is documented separately as it's a comprehensive example
|
|
9
|
+
// rather than a single component
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Date Picker is a composition of Calendar + Popover
|
|
2
|
+
// This provides the building blocks - users compose them together
|
|
3
|
+
|
|
4
|
+
export * from "./calendar"
|
|
5
|
+
export * from "./popover"
|
|
6
|
+
|
|
7
|
+
// Example usage documented at: https://ui.shadcn.com/docs/components/date-picker
|
|
8
|
+
// DatePicker = Popover + Calendar + Button
|