tokka 0.1.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 +53 -6
- package/package.json +15 -36
- 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
- package/LICENSE +0 -21
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Toaster as Sonner } from "sonner"
|
|
2
|
+
|
|
3
|
+
type ToasterProps = React.ComponentProps<typeof Sonner>
|
|
4
|
+
|
|
5
|
+
const Toaster = ({ ...props }: ToasterProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<Sonner
|
|
8
|
+
className="toaster group"
|
|
9
|
+
toastOptions={{
|
|
10
|
+
classNames: {
|
|
11
|
+
toast:
|
|
12
|
+
"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
|
|
13
|
+
description: "group-[.toast]:text-muted-foreground",
|
|
14
|
+
actionButton:
|
|
15
|
+
"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
|
|
16
|
+
cancelButton:
|
|
17
|
+
"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
|
|
18
|
+
},
|
|
19
|
+
}}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Toaster }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Loader2 } from "lucide-react"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
import { cn } from "./lib/utils"
|
|
5
|
+
|
|
6
|
+
const spinnerVariants = cva("animate-spin text-muted-foreground", {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
default: "size-4",
|
|
10
|
+
sm: "size-3",
|
|
11
|
+
lg: "size-6",
|
|
12
|
+
xl: "size-8",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
size: "default",
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export interface SpinnerProps
|
|
21
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
22
|
+
VariantProps<typeof spinnerVariants> {}
|
|
23
|
+
|
|
24
|
+
const Spinner = React.forwardRef<HTMLDivElement, SpinnerProps>(
|
|
25
|
+
({ className, size, ...props }, ref) => (
|
|
26
|
+
<div ref={ref} {...props}>
|
|
27
|
+
<Loader2 className={cn(spinnerVariants({ size }), className)} />
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
Spinner.displayName = "Spinner"
|
|
32
|
+
|
|
33
|
+
export { Spinner }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch"
|
|
3
|
+
import { cn } from "./lib/utils"
|
|
4
|
+
|
|
5
|
+
const Switch = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
8
|
+
>(({ className, ...props }, ref) => (
|
|
9
|
+
<SwitchPrimitives.Root
|
|
10
|
+
className={cn(
|
|
11
|
+
"peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none 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",
|
|
12
|
+
className
|
|
13
|
+
)}
|
|
14
|
+
{...props}
|
|
15
|
+
ref={ref}
|
|
16
|
+
>
|
|
17
|
+
<SwitchPrimitives.Thumb
|
|
18
|
+
className={cn(
|
|
19
|
+
"pointer-events-none block size-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"
|
|
20
|
+
)}
|
|
21
|
+
/>
|
|
22
|
+
</SwitchPrimitives.Root>
|
|
23
|
+
))
|
|
24
|
+
Switch.displayName = SwitchPrimitives.Root.displayName
|
|
25
|
+
|
|
26
|
+
export { Switch }
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "./lib/utils"
|
|
3
|
+
|
|
4
|
+
const Table = React.forwardRef<
|
|
5
|
+
HTMLTableElement,
|
|
6
|
+
React.HTMLAttributes<HTMLTableElement>
|
|
7
|
+
>(({ className, ...props }, ref) => (
|
|
8
|
+
<div className="relative w-full overflow-auto">
|
|
9
|
+
<table
|
|
10
|
+
ref={ref}
|
|
11
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
))
|
|
16
|
+
Table.displayName = "Table"
|
|
17
|
+
|
|
18
|
+
const TableHeader = React.forwardRef<
|
|
19
|
+
HTMLTableSectionElement,
|
|
20
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
21
|
+
>(({ className, ...props }, ref) => (
|
|
22
|
+
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
|
|
23
|
+
))
|
|
24
|
+
TableHeader.displayName = "TableHeader"
|
|
25
|
+
|
|
26
|
+
const TableBody = React.forwardRef<
|
|
27
|
+
HTMLTableSectionElement,
|
|
28
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
29
|
+
>(({ className, ...props }, ref) => (
|
|
30
|
+
<tbody
|
|
31
|
+
ref={ref}
|
|
32
|
+
className={cn("[&_tr:last-child]:border-0", className)}
|
|
33
|
+
{...props}
|
|
34
|
+
/>
|
|
35
|
+
))
|
|
36
|
+
TableBody.displayName = "TableBody"
|
|
37
|
+
|
|
38
|
+
const TableFooter = React.forwardRef<
|
|
39
|
+
HTMLTableSectionElement,
|
|
40
|
+
React.HTMLAttributes<HTMLTableSectionElement>
|
|
41
|
+
>(({ className, ...props }, ref) => (
|
|
42
|
+
<tfoot
|
|
43
|
+
ref={ref}
|
|
44
|
+
className={cn(
|
|
45
|
+
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
46
|
+
className
|
|
47
|
+
)}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
))
|
|
51
|
+
TableFooter.displayName = "TableFooter"
|
|
52
|
+
|
|
53
|
+
const TableRow = React.forwardRef<
|
|
54
|
+
HTMLTableRowElement,
|
|
55
|
+
React.HTMLAttributes<HTMLTableRowElement>
|
|
56
|
+
>(({ className, ...props }, ref) => (
|
|
57
|
+
<tr
|
|
58
|
+
ref={ref}
|
|
59
|
+
className={cn(
|
|
60
|
+
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
{...props}
|
|
64
|
+
/>
|
|
65
|
+
))
|
|
66
|
+
TableRow.displayName = "TableRow"
|
|
67
|
+
|
|
68
|
+
const TableHead = React.forwardRef<
|
|
69
|
+
HTMLTableCellElement,
|
|
70
|
+
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
71
|
+
>(({ className, ...props }, ref) => (
|
|
72
|
+
<th
|
|
73
|
+
ref={ref}
|
|
74
|
+
className={cn(
|
|
75
|
+
"h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
76
|
+
className
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
/>
|
|
80
|
+
))
|
|
81
|
+
TableHead.displayName = "TableHead"
|
|
82
|
+
|
|
83
|
+
const TableCell = React.forwardRef<
|
|
84
|
+
HTMLTableCellElement,
|
|
85
|
+
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
86
|
+
>(({ className, ...props }, ref) => (
|
|
87
|
+
<td
|
|
88
|
+
ref={ref}
|
|
89
|
+
className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)}
|
|
90
|
+
{...props}
|
|
91
|
+
/>
|
|
92
|
+
))
|
|
93
|
+
TableCell.displayName = "TableCell"
|
|
94
|
+
|
|
95
|
+
const TableCaption = React.forwardRef<
|
|
96
|
+
HTMLTableCaptionElement,
|
|
97
|
+
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
98
|
+
>(({ className, ...props }, ref) => (
|
|
99
|
+
<caption
|
|
100
|
+
ref={ref}
|
|
101
|
+
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
))
|
|
105
|
+
TableCaption.displayName = "TableCaption"
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
Table,
|
|
109
|
+
TableHeader,
|
|
110
|
+
TableBody,
|
|
111
|
+
TableFooter,
|
|
112
|
+
TableHead,
|
|
113
|
+
TableRow,
|
|
114
|
+
TableCell,
|
|
115
|
+
TableCaption,
|
|
116
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs"
|
|
3
|
+
import { cn } from "./lib/utils"
|
|
4
|
+
|
|
5
|
+
const Tabs = TabsPrimitive.Root
|
|
6
|
+
|
|
7
|
+
const TabsList = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof TabsPrimitive.List>,
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
10
|
+
>(({ className, ...props }, ref) => (
|
|
11
|
+
<TabsPrimitive.List
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn(
|
|
14
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
15
|
+
className
|
|
16
|
+
)}
|
|
17
|
+
{...props}
|
|
18
|
+
/>
|
|
19
|
+
))
|
|
20
|
+
TabsList.displayName = TabsPrimitive.List.displayName
|
|
21
|
+
|
|
22
|
+
const TabsTrigger = React.forwardRef<
|
|
23
|
+
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
24
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
25
|
+
>(({ className, ...props }, ref) => (
|
|
26
|
+
<TabsPrimitive.Trigger
|
|
27
|
+
ref={ref}
|
|
28
|
+
className={cn(
|
|
29
|
+
"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-none 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-sm",
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
))
|
|
35
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
|
|
36
|
+
|
|
37
|
+
const TabsContent = React.forwardRef<
|
|
38
|
+
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
39
|
+
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
40
|
+
>(({ className, ...props }, ref) => (
|
|
41
|
+
<TabsPrimitive.Content
|
|
42
|
+
ref={ref}
|
|
43
|
+
className={cn(
|
|
44
|
+
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
45
|
+
className
|
|
46
|
+
)}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
))
|
|
50
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName
|
|
51
|
+
|
|
52
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "./lib/utils"
|
|
3
|
+
|
|
4
|
+
export interface TextareaProps
|
|
5
|
+
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
|
6
|
+
|
|
7
|
+
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
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-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
ref={ref}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
Textarea.displayName = "Textarea"
|
|
22
|
+
|
|
23
|
+
export { Textarea }
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group"
|
|
3
|
+
import { type VariantProps } from "class-variance-authority"
|
|
4
|
+
import { cn } from "./lib/utils"
|
|
5
|
+
import { toggleVariants } from "./toggle"
|
|
6
|
+
|
|
7
|
+
const ToggleGroupContext = React.createContext<
|
|
8
|
+
VariantProps<typeof toggleVariants>
|
|
9
|
+
>({
|
|
10
|
+
size: "default",
|
|
11
|
+
variant: "default",
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
const ToggleGroup = React.forwardRef<
|
|
15
|
+
React.ElementRef<typeof ToggleGroupPrimitive.Root>,
|
|
16
|
+
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &
|
|
17
|
+
VariantProps<typeof toggleVariants>
|
|
18
|
+
>(({ className, variant, size, children, ...props }, ref) => (
|
|
19
|
+
<ToggleGroupPrimitive.Root
|
|
20
|
+
ref={ref}
|
|
21
|
+
className={cn("flex items-center justify-center gap-1", className)}
|
|
22
|
+
{...props}
|
|
23
|
+
>
|
|
24
|
+
<ToggleGroupContext.Provider value={{ variant, size }}>
|
|
25
|
+
{children}
|
|
26
|
+
</ToggleGroupContext.Provider>
|
|
27
|
+
</ToggleGroupPrimitive.Root>
|
|
28
|
+
))
|
|
29
|
+
|
|
30
|
+
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName
|
|
31
|
+
|
|
32
|
+
const ToggleGroupItem = React.forwardRef<
|
|
33
|
+
React.ElementRef<typeof ToggleGroupPrimitive.Item>,
|
|
34
|
+
React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &
|
|
35
|
+
VariantProps<typeof toggleVariants>
|
|
36
|
+
>(({ className, children, variant, size, ...props }, ref) => {
|
|
37
|
+
const context = React.useContext(ToggleGroupContext)
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<ToggleGroupPrimitive.Item
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cn(
|
|
43
|
+
toggleVariants({
|
|
44
|
+
variant: context.variant || variant,
|
|
45
|
+
size: context.size || size,
|
|
46
|
+
}),
|
|
47
|
+
className
|
|
48
|
+
)}
|
|
49
|
+
{...props}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</ToggleGroupPrimitive.Item>
|
|
53
|
+
)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName
|
|
57
|
+
|
|
58
|
+
export { ToggleGroup, ToggleGroupItem }
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as TogglePrimitive from "@radix-ui/react-toggle"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
import { cn } from "./lib/utils"
|
|
5
|
+
|
|
6
|
+
const toggleVariants = cva(
|
|
7
|
+
"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-none 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",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "bg-transparent",
|
|
12
|
+
outline:
|
|
13
|
+
"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
default: "h-10 px-3",
|
|
17
|
+
sm: "h-9 px-2.5",
|
|
18
|
+
lg: "h-11 px-5",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "default",
|
|
23
|
+
size: "default",
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
const Toggle = React.forwardRef<
|
|
29
|
+
React.ElementRef<typeof TogglePrimitive.Root>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &
|
|
31
|
+
VariantProps<typeof toggleVariants>
|
|
32
|
+
>(({ className, variant, size, ...props }, ref) => (
|
|
33
|
+
<TogglePrimitive.Root
|
|
34
|
+
ref={ref}
|
|
35
|
+
className={cn(toggleVariants({ variant, size, className }))}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
))
|
|
39
|
+
|
|
40
|
+
Toggle.displayName = TogglePrimitive.Root.displayName
|
|
41
|
+
|
|
42
|
+
export { Toggle, toggleVariants }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip"
|
|
3
|
+
import { cn } from "./lib/utils"
|
|
4
|
+
|
|
5
|
+
const TooltipProvider = TooltipPrimitive.Provider
|
|
6
|
+
|
|
7
|
+
const Tooltip = TooltipPrimitive.Root
|
|
8
|
+
|
|
9
|
+
const TooltipTrigger = TooltipPrimitive.Trigger
|
|
10
|
+
|
|
11
|
+
const TooltipContent = React.forwardRef<
|
|
12
|
+
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
13
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
14
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
15
|
+
<TooltipPrimitive.Content
|
|
16
|
+
ref={ref}
|
|
17
|
+
sideOffset={sideOffset}
|
|
18
|
+
className={cn(
|
|
19
|
+
"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",
|
|
20
|
+
className
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
))
|
|
25
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName
|
|
26
|
+
|
|
27
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
|
package/dist/index.js
CHANGED
|
@@ -131,10 +131,57 @@ import kleur2 from "kleur";
|
|
|
131
131
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
132
132
|
var __dirname2 = path2.dirname(__filename2);
|
|
133
133
|
var COMPONENT_REGISTRY = {
|
|
134
|
+
accordion: "accordion.tsx",
|
|
135
|
+
alert: "alert.tsx",
|
|
136
|
+
"alert-dialog": "alert-dialog.tsx",
|
|
137
|
+
"aspect-ratio": "aspect-ratio.tsx",
|
|
138
|
+
avatar: "avatar.tsx",
|
|
139
|
+
badge: "badge.tsx",
|
|
140
|
+
breadcrumb: "breadcrumb.tsx",
|
|
134
141
|
button: "button.tsx",
|
|
142
|
+
calendar: "calendar.tsx",
|
|
143
|
+
card: "card.tsx",
|
|
144
|
+
carousel: "carousel.tsx",
|
|
145
|
+
chart: "chart.tsx",
|
|
146
|
+
checkbox: "checkbox.tsx",
|
|
147
|
+
collapsible: "collapsible.tsx",
|
|
148
|
+
combobox: "combobox.tsx",
|
|
149
|
+
command: "command.tsx",
|
|
150
|
+
"context-menu": "context-menu.tsx",
|
|
151
|
+
"data-table": "data-table.tsx",
|
|
152
|
+
"date-picker": "date-picker.tsx",
|
|
153
|
+
dialog: "dialog.tsx",
|
|
154
|
+
drawer: "drawer.tsx",
|
|
155
|
+
"dropdown-menu": "dropdown-menu.tsx",
|
|
156
|
+
form: "form.tsx",
|
|
157
|
+
"hover-card": "hover-card.tsx",
|
|
135
158
|
input: "input.tsx",
|
|
136
|
-
|
|
137
|
-
|
|
159
|
+
"input-otp": "input-otp.tsx",
|
|
160
|
+
label: "label.tsx",
|
|
161
|
+
menubar: "menubar.tsx",
|
|
162
|
+
"native-select": "native-select.tsx",
|
|
163
|
+
"navigation-menu": "navigation-menu.tsx",
|
|
164
|
+
pagination: "pagination.tsx",
|
|
165
|
+
popover: "popover.tsx",
|
|
166
|
+
progress: "progress.tsx",
|
|
167
|
+
"radio-group": "radio-group.tsx",
|
|
168
|
+
resizable: "resizable.tsx",
|
|
169
|
+
"scroll-area": "scroll-area.tsx",
|
|
170
|
+
select: "select.tsx",
|
|
171
|
+
separator: "separator.tsx",
|
|
172
|
+
sheet: "sheet.tsx",
|
|
173
|
+
sidebar: "sidebar.tsx",
|
|
174
|
+
skeleton: "skeleton.tsx",
|
|
175
|
+
slider: "slider.tsx",
|
|
176
|
+
sonner: "sonner.tsx",
|
|
177
|
+
spinner: "spinner.tsx",
|
|
178
|
+
switch: "switch.tsx",
|
|
179
|
+
table: "table.tsx",
|
|
180
|
+
tabs: "tabs.tsx",
|
|
181
|
+
textarea: "textarea.tsx",
|
|
182
|
+
toggle: "toggle.tsx",
|
|
183
|
+
"toggle-group": "toggle-group.tsx",
|
|
184
|
+
tooltip: "tooltip.tsx"
|
|
138
185
|
};
|
|
139
186
|
async function addCommand(components) {
|
|
140
187
|
const cwd = process.cwd();
|
|
@@ -174,7 +221,7 @@ import fs3 from "fs-extra";
|
|
|
174
221
|
import path3 from "path";
|
|
175
222
|
import ora3 from "ora";
|
|
176
223
|
import kleur3 from "kleur";
|
|
177
|
-
import { compile, generateCSSOutput, generateTailwindOutput, generateTypeScriptOutput } from "tokka
|
|
224
|
+
import { compile, generateCSSOutput, generateTailwindOutput, generateTypeScriptOutput } from "@tokka/compiler";
|
|
178
225
|
async function buildCommand(options) {
|
|
179
226
|
const cwd = process.cwd();
|
|
180
227
|
const spinner = ora3("Building tokens...").start();
|
|
@@ -237,7 +284,7 @@ async function validateCommand() {
|
|
|
237
284
|
process.exit(1);
|
|
238
285
|
}
|
|
239
286
|
console.log(kleur4.cyan("\n\u{1F50D} Validating tokens and manifests...\n"));
|
|
240
|
-
const { compile: compile3, validateTokens, loadTokens, loadSystem } = await import("tokka
|
|
287
|
+
const { compile: compile3, validateTokens, loadTokens, loadSystem } = await import("@tokka/compiler");
|
|
241
288
|
try {
|
|
242
289
|
const tokens = await loadTokens({ cwd });
|
|
243
290
|
const system = await loadSystem({ cwd });
|
|
@@ -264,7 +311,7 @@ import fs5 from "fs-extra";
|
|
|
264
311
|
import path5 from "path";
|
|
265
312
|
import ora4 from "ora";
|
|
266
313
|
import kleur5 from "kleur";
|
|
267
|
-
import { compile as compile2, generateFigmaTokenOutput } from "tokka
|
|
314
|
+
import { compile as compile2, generateFigmaTokenOutput } from "@tokka/compiler";
|
|
268
315
|
async function exportCommand(target, options) {
|
|
269
316
|
if (target !== "figma") {
|
|
270
317
|
console.error(kleur5.red(`\u2716 Unknown export target: ${target}`));
|
|
@@ -422,7 +469,7 @@ async function enableCommand(feature) {
|
|
|
422
469
|
|
|
423
470
|
// src/index.ts
|
|
424
471
|
var program = new Command();
|
|
425
|
-
program.name("tokka").description("A
|
|
472
|
+
program.name("tokka").description("A shadcn-compatible UI foundation with a real token system").version("0.0.1");
|
|
426
473
|
program.command("init").description("Initialize a new tokka project").option("-s, --system <id>", "System to use (soft-saas, corporate, dark-mode, accessible, brutalist)").option("-p, --package-manager <pm>", "Package manager to use", "pnpm").option("--no-demo", "Skip demo app creation").action(initCommand);
|
|
427
474
|
program.command("add").description("Add components to your project").argument("<components...>", "Component names (button, input, card, etc.)").action(addCommand);
|
|
428
475
|
program.command("build").description("Build design tokens and outputs").option("-f, --force", "Force rebuild").action(buildCommand);
|
package/package.json
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokka",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "A
|
|
6
|
-
"
|
|
7
|
-
"design-system",
|
|
8
|
-
"design-tokens",
|
|
9
|
-
"ui-components",
|
|
10
|
-
"react",
|
|
11
|
-
"tailwind",
|
|
12
|
-
"figma",
|
|
13
|
-
"css-variables",
|
|
14
|
-
"theming"
|
|
15
|
-
],
|
|
16
|
-
"homepage": "https://github.com/ccwilson10/tokka#readme",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/ccwilson10/tokka/issues"
|
|
19
|
-
},
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/ccwilson10/tokka.git",
|
|
23
|
-
"directory": "packages/cli"
|
|
24
|
-
},
|
|
25
|
-
"license": "MIT",
|
|
26
|
-
"author": "tokka contributors",
|
|
27
|
-
"bin": {
|
|
28
|
-
"tokka": "./dist/index.js"
|
|
29
|
-
},
|
|
5
|
+
"description": "A shadcn-compatible UI foundation with a real token system and optional Figma exports",
|
|
6
|
+
"bin": "./dist/index.js",
|
|
30
7
|
"exports": {
|
|
31
8
|
".": {
|
|
32
9
|
"types": "./dist/index.d.ts",
|
|
@@ -34,17 +11,25 @@
|
|
|
34
11
|
}
|
|
35
12
|
},
|
|
36
13
|
"files": [
|
|
37
|
-
"dist"
|
|
14
|
+
"dist",
|
|
15
|
+
"systems",
|
|
16
|
+
"components"
|
|
38
17
|
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
20
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"typecheck": "tsc --noEmit"
|
|
23
|
+
},
|
|
39
24
|
"dependencies": {
|
|
25
|
+
"@tokka/compiler": "workspace:*",
|
|
40
26
|
"commander": "^11.1.0",
|
|
41
27
|
"prompts": "^2.4.2",
|
|
42
28
|
"kleur": "^4.1.5",
|
|
43
29
|
"ora": "^8.0.1",
|
|
44
30
|
"fs-extra": "^11.2.0",
|
|
45
31
|
"glob": "^10.3.10",
|
|
46
|
-
"zod": "^3.22.4"
|
|
47
|
-
"tokka-compiler": "0.1.0"
|
|
32
|
+
"zod": "^3.22.4"
|
|
48
33
|
},
|
|
49
34
|
"devDependencies": {
|
|
50
35
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -53,11 +38,5 @@
|
|
|
53
38
|
"tsup": "^8.0.2",
|
|
54
39
|
"typescript": "^5.3.3",
|
|
55
40
|
"vitest": "^1.3.1"
|
|
56
|
-
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
59
|
-
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
60
|
-
"test": "vitest run",
|
|
61
|
-
"typecheck": "tsc --noEmit"
|
|
62
41
|
}
|
|
63
|
-
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Design Systems
|
|
2
|
+
|
|
3
|
+
This directory contains starter design systems for tokka.
|
|
4
|
+
|
|
5
|
+
## v1 Systems
|
|
6
|
+
|
|
7
|
+
1. **soft-saas** (default) - Low contrast, friendly, rounded
|
|
8
|
+
2. **corporate** - High contrast, sharp, dense, professional
|
|
9
|
+
3. **dark-mode** - Dark-first design with vibrant accents
|
|
10
|
+
4. **accessible** - WCAG AAA compliant, high contrast
|
|
11
|
+
5. **brutalist** - Raw aesthetic, no radius, bold
|
|
12
|
+
|
|
13
|
+
## System Structure
|
|
14
|
+
|
|
15
|
+
Each system directory contains:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
system-name/
|
|
19
|
+
├── system.json # System metadata
|
|
20
|
+
├── tokens/
|
|
21
|
+
│ ├── primitives.json # Primitive tokens
|
|
22
|
+
│ ├── semantics.json # Semantic tokens
|
|
23
|
+
│ └── components/ # Component tokens (optional, Tier 2)
|
|
24
|
+
└── preview/ # Preview assets
|
|
25
|
+
├── thumbnail.png
|
|
26
|
+
└── README.md
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Contributing Systems
|
|
30
|
+
|
|
31
|
+
The registry format supports 100+ systems. To contribute:
|
|
32
|
+
|
|
33
|
+
1. Follow the system quality bar:
|
|
34
|
+
- Coherent color strategy (brand + neutrals + semantic states)
|
|
35
|
+
- Typography set (body + heading scales)
|
|
36
|
+
- Spacing, radius, motion, shadow policies
|
|
37
|
+
|
|
38
|
+
2. Test your system:
|
|
39
|
+
```bash
|
|
40
|
+
tokka init --system your-system
|
|
41
|
+
tokka build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. Submit a PR with your system directory
|
|
45
|
+
|
|
46
|
+
## System Quality Bar
|
|
47
|
+
|
|
48
|
+
Each system must include:
|
|
49
|
+
- Brand colors + neutral palette
|
|
50
|
+
- Semantic states (success, warning, error, info)
|
|
51
|
+
- Typography scale
|
|
52
|
+
- Spacing scale
|
|
53
|
+
- Radius policy
|
|
54
|
+
- Motion policy
|
|
55
|
+
- Shadow/elevation policy
|
|
56
|
+
- Both light and dark modes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "accessible",
|
|
3
|
+
"name": "Accessible",
|
|
4
|
+
"description": "WCAG AAA compliant - high contrast, large text, clear focus states",
|
|
5
|
+
"tags": ["accessibility", "wcag", "high-contrast"],
|
|
6
|
+
"modes": ["light", "dark"],
|
|
7
|
+
"policies": {
|
|
8
|
+
"radius": "rounded",
|
|
9
|
+
"density": "spacious",
|
|
10
|
+
"contrast": "high",
|
|
11
|
+
"motion": "none"
|
|
12
|
+
},
|
|
13
|
+
"defaults": {
|
|
14
|
+
"font": "system-ui",
|
|
15
|
+
"iconStyle": "solid"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"tokens": [
|
|
3
|
+
{"id": "color.black", "type": "color", "description": "Black", "source": "primitive", "value": "0 0% 0%"},
|
|
4
|
+
{"id": "color.white", "type": "color", "description": "White", "source": "primitive", "value": "0 0% 100%"},
|
|
5
|
+
{"id": "color.blue.700", "type": "color", "description": "Dark blue", "source": "primitive", "value": "220 90% 35%"},
|
|
6
|
+
{"id": "space.6", "type": "dimension", "description": "Spacious", "source": "primitive", "value": "1.5rem"},
|
|
7
|
+
{"id": "radius.md", "type": "radius", "description": "Medium radius", "source": "primitive", "value": "0.375rem"}
|
|
8
|
+
]
|
|
9
|
+
}
|