tokka 0.2.0 → 0.2.2

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 (80) hide show
  1. package/compiler/generators/css.ts +146 -0
  2. package/compiler/generators/figma.ts +147 -0
  3. package/compiler/generators/tailwind.ts +106 -0
  4. package/compiler/generators/typescript.ts +113 -0
  5. package/compiler/index.ts +45 -0
  6. package/compiler/loader.ts +92 -0
  7. package/compiler/resolver.ts +177 -0
  8. package/compiler/types.ts +118 -0
  9. package/compiler/validator.ts +194 -0
  10. package/components/accordion.tsx +55 -0
  11. package/components/alert-dialog.tsx +138 -0
  12. package/components/alert.tsx +58 -0
  13. package/components/aspect-ratio.tsx +5 -0
  14. package/components/avatar.tsx +47 -0
  15. package/components/badge.tsx +35 -0
  16. package/components/breadcrumb.tsx +114 -0
  17. package/components/button.tsx +56 -0
  18. package/components/calendar.tsx +63 -0
  19. package/components/card.tsx +74 -0
  20. package/components/carousel.tsx +259 -0
  21. package/components/chart.tsx +9 -0
  22. package/components/checkbox.tsx +27 -0
  23. package/components/collapsible.tsx +9 -0
  24. package/components/combobox.tsx +8 -0
  25. package/components/command.tsx +152 -0
  26. package/components/context-menu.tsx +197 -0
  27. package/components/data-table.tsx +9 -0
  28. package/components/date-picker.tsx +8 -0
  29. package/components/dialog.tsx +119 -0
  30. package/components/drawer.tsx +115 -0
  31. package/components/dropdown-menu.tsx +197 -0
  32. package/components/form.tsx +175 -0
  33. package/components/hover-card.tsx +26 -0
  34. package/components/input-otp.tsx +68 -0
  35. package/components/input.tsx +48 -0
  36. package/components/label.tsx +23 -0
  37. package/components/lib/utils.ts +6 -0
  38. package/components/menubar.tsx +233 -0
  39. package/components/native-select.tsx +29 -0
  40. package/components/navigation-menu.tsx +127 -0
  41. package/components/pagination.tsx +116 -0
  42. package/components/popover.tsx +28 -0
  43. package/components/progress.tsx +25 -0
  44. package/components/radio-group.tsx +41 -0
  45. package/components/resizable.tsx +42 -0
  46. package/components/scroll-area.tsx +45 -0
  47. package/components/select.tsx +157 -0
  48. package/components/separator.tsx +28 -0
  49. package/components/sheet.tsx +137 -0
  50. package/components/sidebar.tsx +249 -0
  51. package/components/skeleton.tsx +15 -0
  52. package/components/slider.tsx +25 -0
  53. package/components/sonner.tsx +25 -0
  54. package/components/spinner.tsx +33 -0
  55. package/components/switch.tsx +26 -0
  56. package/components/table.tsx +116 -0
  57. package/components/tabs.tsx +52 -0
  58. package/components/textarea.tsx +23 -0
  59. package/components/toggle-group.tsx +58 -0
  60. package/components/toggle.tsx +42 -0
  61. package/components/tooltip.tsx +27 -0
  62. package/package.json +5 -3
  63. package/systems/README.md +56 -0
  64. package/systems/accessible/system.json +17 -0
  65. package/systems/accessible/tokens/primitives.json +9 -0
  66. package/systems/accessible/tokens/semantics.json +11 -0
  67. package/systems/brutalist/system.json +17 -0
  68. package/systems/brutalist/tokens/primitives.json +10 -0
  69. package/systems/brutalist/tokens/semantics.json +12 -0
  70. package/systems/corporate/system.json +20 -0
  71. package/systems/corporate/tokens/primitives.json +60 -0
  72. package/systems/corporate/tokens/semantics.json +68 -0
  73. package/systems/dark-mode/system.json +17 -0
  74. package/systems/dark-mode/tokens/primitives.json +10 -0
  75. package/systems/dark-mode/tokens/semantics.json +11 -0
  76. package/systems/package.json +14 -0
  77. package/systems/soft-saas/system.json +20 -0
  78. package/systems/soft-saas/tokens/primitives.json +235 -0
  79. package/systems/soft-saas/tokens/semantics.json +190 -0
  80. package/dist/index.js +0 -434
@@ -0,0 +1,58 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const alertVariants = cva(
6
+ "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-background text-foreground",
11
+ destructive:
12
+ "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ variant: "default",
17
+ },
18
+ }
19
+ )
20
+
21
+ const Alert = React.forwardRef<
22
+ HTMLDivElement,
23
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
24
+ >(({ className, variant, ...props }, ref) => (
25
+ <div
26
+ ref={ref}
27
+ role="alert"
28
+ className={cn(alertVariants({ variant }), className)}
29
+ {...props}
30
+ />
31
+ ))
32
+ Alert.displayName = "Alert"
33
+
34
+ const AlertTitle = React.forwardRef<
35
+ HTMLParagraphElement,
36
+ React.HTMLAttributes<HTMLHeadingElement>
37
+ >(({ className, ...props }, ref) => (
38
+ <h5
39
+ ref={ref}
40
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
41
+ {...props}
42
+ />
43
+ ))
44
+ AlertTitle.displayName = "AlertTitle"
45
+
46
+ const AlertDescription = React.forwardRef<
47
+ HTMLParagraphElement,
48
+ React.HTMLAttributes<HTMLParagraphElement>
49
+ >(({ className, ...props }, ref) => (
50
+ <div
51
+ ref={ref}
52
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
53
+ {...props}
54
+ />
55
+ ))
56
+ AlertDescription.displayName = "AlertDescription"
57
+
58
+ export { Alert, AlertTitle, AlertDescription }
@@ -0,0 +1,5 @@
1
+ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
2
+
3
+ const AspectRatio = AspectRatioPrimitive.Root
4
+
5
+ export { AspectRatio }
@@ -0,0 +1,47 @@
1
+ import * as React from "react"
2
+ import * as AvatarPrimitive from "@radix-ui/react-avatar"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const Avatar = React.forwardRef<
6
+ React.ElementRef<typeof AvatarPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
8
+ >(({ className, ...props }, ref) => (
9
+ <AvatarPrimitive.Root
10
+ ref={ref}
11
+ className={cn(
12
+ "relative flex size-10 shrink-0 overflow-hidden rounded-full",
13
+ className
14
+ )}
15
+ {...props}
16
+ />
17
+ ))
18
+ Avatar.displayName = AvatarPrimitive.Root.displayName
19
+
20
+ const AvatarImage = React.forwardRef<
21
+ React.ElementRef<typeof AvatarPrimitive.Image>,
22
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
23
+ >(({ className, ...props }, ref) => (
24
+ <AvatarPrimitive.Image
25
+ ref={ref}
26
+ className={cn("aspect-square size-full", className)}
27
+ {...props}
28
+ />
29
+ ))
30
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName
31
+
32
+ const AvatarFallback = React.forwardRef<
33
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
34
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
35
+ >(({ className, ...props }, ref) => (
36
+ <AvatarPrimitive.Fallback
37
+ ref={ref}
38
+ className={cn(
39
+ "flex size-full items-center justify-center rounded-full bg-muted",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ ))
45
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
46
+
47
+ export { Avatar, AvatarImage, AvatarFallback }
@@ -0,0 +1,35 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+ import { cn } from "./lib/utils"
4
+
5
+ const badgeVariants = cva(
6
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
7
+ {
8
+ variants: {
9
+ variant: {
10
+ default:
11
+ "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
12
+ secondary:
13
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
14
+ destructive:
15
+ "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
16
+ outline: "text-foreground",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ variant: "default",
21
+ },
22
+ }
23
+ )
24
+
25
+ export interface BadgeProps
26
+ extends React.HTMLAttributes<HTMLDivElement>,
27
+ VariantProps<typeof badgeVariants> {}
28
+
29
+ function Badge({ className, variant, ...props }: BadgeProps) {
30
+ return (
31
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
32
+ )
33
+ }
34
+
35
+ export { Badge, badgeVariants }
@@ -0,0 +1,114 @@
1
+ import * as React from "react"
2
+ import { ChevronRight, MoreHorizontal } from "lucide-react"
3
+ import { Slot } from "@radix-ui/react-slot"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const Breadcrumb = React.forwardRef<
7
+ HTMLElement,
8
+ React.ComponentPropsWithoutRef<"nav"> & {
9
+ separator?: React.ReactNode
10
+ }
11
+ >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
12
+ Breadcrumb.displayName = "Breadcrumb"
13
+
14
+ const BreadcrumbList = React.forwardRef<
15
+ HTMLOListElement,
16
+ React.ComponentPropsWithoutRef<"ol">
17
+ >(({ className, ...props }, ref) => (
18
+ <ol
19
+ ref={ref}
20
+ className={cn(
21
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
22
+ className
23
+ )}
24
+ {...props}
25
+ />
26
+ ))
27
+ BreadcrumbList.displayName = "BreadcrumbList"
28
+
29
+ const BreadcrumbItem = React.forwardRef<
30
+ HTMLLIElement,
31
+ React.ComponentPropsWithoutRef<"li">
32
+ >(({ className, ...props }, ref) => (
33
+ <li
34
+ ref={ref}
35
+ className={cn("inline-flex items-center gap-1.5", className)}
36
+ {...props}
37
+ />
38
+ ))
39
+ BreadcrumbItem.displayName = "BreadcrumbItem"
40
+
41
+ const BreadcrumbLink = React.forwardRef<
42
+ HTMLAnchorElement,
43
+ React.ComponentPropsWithoutRef<"a"> & {
44
+ asChild?: boolean
45
+ }
46
+ >(({ asChild, className, ...props }, ref) => {
47
+ const Comp = asChild ? Slot : "a"
48
+
49
+ return (
50
+ <Comp
51
+ ref={ref}
52
+ className={cn("transition-colors hover:text-foreground", className)}
53
+ {...props}
54
+ />
55
+ )
56
+ })
57
+ BreadcrumbLink.displayName = "BreadcrumbLink"
58
+
59
+ const BreadcrumbPage = React.forwardRef<
60
+ HTMLSpanElement,
61
+ React.ComponentPropsWithoutRef<"span">
62
+ >(({ className, ...props }, ref) => (
63
+ <span
64
+ ref={ref}
65
+ role="link"
66
+ aria-disabled="true"
67
+ aria-current="page"
68
+ className={cn("font-normal text-foreground", className)}
69
+ {...props}
70
+ />
71
+ ))
72
+ BreadcrumbPage.displayName = "BreadcrumbPage"
73
+
74
+ const BreadcrumbSeparator = ({
75
+ children,
76
+ className,
77
+ ...props
78
+ }: React.ComponentProps<"li">) => (
79
+ <li
80
+ role="presentation"
81
+ aria-hidden="true"
82
+ className={cn("[&>svg]:size-3.5", className)}
83
+ {...props}
84
+ >
85
+ {children ?? <ChevronRight />}
86
+ </li>
87
+ )
88
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
89
+
90
+ const BreadcrumbEllipsis = ({
91
+ className,
92
+ ...props
93
+ }: React.ComponentProps<"span">) => (
94
+ <span
95
+ role="presentation"
96
+ aria-hidden="true"
97
+ className={cn("flex size-9 items-center justify-center", className)}
98
+ {...props}
99
+ >
100
+ <MoreHorizontal className="size-4" />
101
+ <span className="sr-only">More</span>
102
+ </span>
103
+ )
104
+ BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
105
+
106
+ export {
107
+ Breadcrumb,
108
+ BreadcrumbList,
109
+ BreadcrumbItem,
110
+ BreadcrumbLink,
111
+ BreadcrumbPage,
112
+ BreadcrumbSeparator,
113
+ BreadcrumbEllipsis,
114
+ }
@@ -0,0 +1,56 @@
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+ import { cn } from "./lib/utils"
5
+
6
+ const buttonVariants = cva(
7
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium 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",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
12
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
13
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
14
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
15
+ ghost: "hover:bg-accent hover:text-accent-foreground",
16
+ link: "text-primary underline-offset-4 hover:underline",
17
+ },
18
+ size: {
19
+ default: "h-10 px-4 py-2",
20
+ sm: "h-9 rounded-md px-3",
21
+ lg: "h-11 rounded-md px-8",
22
+ icon: "size-10",
23
+ },
24
+ },
25
+ defaultVariants: {
26
+ variant: "default",
27
+ size: "default",
28
+ },
29
+ }
30
+ )
31
+
32
+ export interface ButtonProps
33
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
34
+ VariantProps<typeof buttonVariants> {
35
+ asChild?: boolean
36
+ icon?: React.ReactNode
37
+ }
38
+
39
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
40
+ ({ className, variant, size, asChild = false, icon, children, ...props }, ref) => {
41
+ const Comp = asChild ? Slot : "button"
42
+ return (
43
+ <Comp
44
+ className={cn(buttonVariants({ variant, size, className }))}
45
+ ref={ref}
46
+ {...props}
47
+ >
48
+ {icon}
49
+ {children}
50
+ </Comp>
51
+ )
52
+ }
53
+ )
54
+ Button.displayName = "Button"
55
+
56
+ export { Button, buttonVariants }
@@ -0,0 +1,63 @@
1
+ import * as React from "react"
2
+ import { DayPicker } from "react-day-picker"
3
+ import { ChevronLeft, ChevronRight } from "lucide-react"
4
+ import { cn } from "./lib/utils"
5
+ import { buttonVariants } from "./button"
6
+
7
+ export type CalendarProps = React.ComponentProps<typeof DayPicker>
8
+
9
+ function Calendar({
10
+ className,
11
+ classNames,
12
+ showOutsideDays = true,
13
+ ...props
14
+ }: CalendarProps) {
15
+ return (
16
+ <DayPicker
17
+ showOutsideDays={showOutsideDays}
18
+ className={cn("p-3", className)}
19
+ classNames={{
20
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
21
+ month: "space-y-4",
22
+ caption: "flex justify-center pt-1 relative items-center",
23
+ caption_label: "text-sm font-medium",
24
+ nav: "space-x-1 flex items-center",
25
+ nav_button: cn(
26
+ buttonVariants({ variant: "outline" }),
27
+ "size-7 bg-transparent p-0 opacity-50 hover:opacity-100"
28
+ ),
29
+ nav_button_previous: "absolute left-1",
30
+ nav_button_next: "absolute right-1",
31
+ table: "w-full border-collapse space-y-1",
32
+ head_row: "flex",
33
+ head_cell:
34
+ "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
35
+ row: "flex w-full mt-2",
36
+ cell: "size-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
37
+ day: cn(
38
+ buttonVariants({ variant: "ghost" }),
39
+ "size-9 p-0 font-normal aria-selected:opacity-100"
40
+ ),
41
+ day_range_end: "day-range-end",
42
+ day_selected:
43
+ "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
44
+ day_today: "bg-accent text-accent-foreground",
45
+ day_outside:
46
+ "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
47
+ day_disabled: "text-muted-foreground opacity-50",
48
+ day_range_middle:
49
+ "aria-selected:bg-accent aria-selected:text-accent-foreground",
50
+ day_hidden: "invisible",
51
+ ...classNames,
52
+ }}
53
+ components={{
54
+ IconLeft: () => <ChevronLeft className="size-4" />,
55
+ IconRight: () => <ChevronRight className="size-4" />,
56
+ }}
57
+ {...props}
58
+ />
59
+ )
60
+ }
61
+ Calendar.displayName = "Calendar"
62
+
63
+ export { Calendar }
@@ -0,0 +1,74 @@
1
+ import * as React from "react"
2
+ import { cn } from "./lib/utils"
3
+
4
+ const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
5
+ ({ className, ...props }, ref) => (
6
+ <div
7
+ ref={ref}
8
+ className={cn(
9
+ "rounded-lg border bg-card text-card-foreground shadow-sm",
10
+ className
11
+ )}
12
+ {...props}
13
+ />
14
+ )
15
+ )
16
+ Card.displayName = "Card"
17
+
18
+ const CardHeader = React.forwardRef<
19
+ HTMLDivElement,
20
+ React.HTMLAttributes<HTMLDivElement>
21
+ >(({ className, ...props }, ref) => (
22
+ <div
23
+ ref={ref}
24
+ className={cn("flex flex-col space-y-1.5 p-6", className)}
25
+ {...props}
26
+ />
27
+ ))
28
+ CardHeader.displayName = "CardHeader"
29
+
30
+ const CardTitle = React.forwardRef<
31
+ HTMLParagraphElement,
32
+ React.HTMLAttributes<HTMLHeadingElement>
33
+ >(({ className, ...props }, ref) => (
34
+ <h3
35
+ ref={ref}
36
+ className={cn("text-2xl font-semibold leading-none tracking-tight", className)}
37
+ {...props}
38
+ />
39
+ ))
40
+ CardTitle.displayName = "CardTitle"
41
+
42
+ const CardDescription = React.forwardRef<
43
+ HTMLParagraphElement,
44
+ React.HTMLAttributes<HTMLParagraphElement>
45
+ >(({ className, ...props }, ref) => (
46
+ <p
47
+ ref={ref}
48
+ className={cn("text-sm text-muted-foreground", className)}
49
+ {...props}
50
+ />
51
+ ))
52
+ CardDescription.displayName = "CardDescription"
53
+
54
+ const CardContent = React.forwardRef<
55
+ HTMLDivElement,
56
+ React.HTMLAttributes<HTMLDivElement>
57
+ >(({ className, ...props }, ref) => (
58
+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
59
+ ))
60
+ CardContent.displayName = "CardContent"
61
+
62
+ const CardFooter = React.forwardRef<
63
+ HTMLDivElement,
64
+ React.HTMLAttributes<HTMLDivElement>
65
+ >(({ className, ...props }, ref) => (
66
+ <div
67
+ ref={ref}
68
+ className={cn("flex items-center p-6 pt-0", className)}
69
+ {...props}
70
+ />
71
+ ))
72
+ CardFooter.displayName = "CardFooter"
73
+
74
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }