@traky-app/ui 1.0.0 → 1.2.0

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 (75) hide show
  1. package/README.md +12 -19
  2. package/package.json +50 -3
  3. package/registry/traky/json/command.json +1 -1
  4. package/registry/traky/json/icon.json +17 -0
  5. package/registry/traky/json/logo.json +17 -0
  6. package/registry/traky/registry.json +20 -0
  7. package/registry/traky/ui/command.tsx +2 -0
  8. package/registry/traky/ui/icon.tsx +71 -0
  9. package/registry/traky/ui/logo.tsx +77 -0
  10. package/src/hooks/use-document-theme.ts +25 -0
  11. package/src/hooks/use-mobile.ts +19 -0
  12. package/src/lib/disable-input-autofill.ts +23 -0
  13. package/src/lib/sidebar-persistence.ts +76 -0
  14. package/src/lib/utils.ts +30 -0
  15. package/src/ui/accordion.tsx +65 -0
  16. package/src/ui/alert-dialog.tsx +163 -0
  17. package/src/ui/alert.tsx +66 -0
  18. package/src/ui/animated-beam.tsx +185 -0
  19. package/src/ui/animated-list.tsx +71 -0
  20. package/src/ui/avatar.tsx +53 -0
  21. package/src/ui/badge.tsx +46 -0
  22. package/src/ui/bento-grid.tsx +109 -0
  23. package/src/ui/breadcrumb.tsx +108 -0
  24. package/src/ui/bubble.tsx +125 -0
  25. package/src/ui/button-group.tsx +83 -0
  26. package/src/ui/button.tsx +64 -0
  27. package/src/ui/calendar.tsx +213 -0
  28. package/src/ui/card.tsx +92 -0
  29. package/src/ui/carousel.tsx +240 -0
  30. package/src/ui/chart.tsx +380 -0
  31. package/src/ui/checkbox.tsx +31 -0
  32. package/src/ui/checkpoint.tsx +94 -0
  33. package/src/ui/code-block.tsx +232 -0
  34. package/src/ui/collapsible.tsx +33 -0
  35. package/src/ui/command.tsx +192 -0
  36. package/src/ui/context-menu.tsx +251 -0
  37. package/src/ui/dialog.tsx +142 -0
  38. package/src/ui/drawer.tsx +135 -0
  39. package/src/ui/dropdown-menu.tsx +256 -0
  40. package/src/ui/empty.tsx +104 -0
  41. package/src/ui/field.tsx +248 -0
  42. package/src/ui/globe.tsx +234 -0
  43. package/src/ui/hover-card.tsx +44 -0
  44. package/src/ui/icon.tsx +71 -0
  45. package/src/ui/input-group.tsx +170 -0
  46. package/src/ui/input-otp.tsx +77 -0
  47. package/src/ui/input.tsx +24 -0
  48. package/src/ui/item.tsx +193 -0
  49. package/src/ui/kbd.tsx +28 -0
  50. package/src/ui/label.tsx +24 -0
  51. package/src/ui/logo.tsx +77 -0
  52. package/src/ui/map.tsx +2226 -0
  53. package/src/ui/marker.tsx +69 -0
  54. package/src/ui/marquee.tsx +74 -0
  55. package/src/ui/message.tsx +92 -0
  56. package/src/ui/navigation-menu.tsx +169 -0
  57. package/src/ui/number-ticker.tsx +90 -0
  58. package/src/ui/pagination.tsx +122 -0
  59. package/src/ui/popover.tsx +48 -0
  60. package/src/ui/progress.tsx +31 -0
  61. package/src/ui/select.tsx +193 -0
  62. package/src/ui/separator.tsx +28 -0
  63. package/src/ui/sheet.tsx +143 -0
  64. package/src/ui/sidebar.tsx +764 -0
  65. package/src/ui/skeleton.tsx +13 -0
  66. package/src/ui/sonner.tsx +71 -0
  67. package/src/ui/spinner.tsx +15 -0
  68. package/src/ui/switch.tsx +41 -0
  69. package/src/ui/table.tsx +116 -0
  70. package/src/ui/tabs.tsx +66 -0
  71. package/src/ui/textarea.tsx +20 -0
  72. package/src/ui/toggle-group.tsx +83 -0
  73. package/src/ui/toggle.tsx +47 -0
  74. package/src/ui/tooltip.tsx +61 -0
  75. package/src/ui/trace.tsx +165 -0
@@ -0,0 +1,193 @@
1
+ "use client"
2
+
3
+ import { IconCheck, IconChevronDown, IconChevronUp } from "@tabler/icons-react";
4
+ import * as React from "react"
5
+ import * as SelectPrimitive from "@radix-ui/react-select"
6
+ import { cn } from "../lib/utils"
7
+
8
+ function Select({
9
+ ...props
10
+ }: React.ComponentProps<typeof SelectPrimitive.Root>) {
11
+ return <SelectPrimitive.Root data-slot="select" {...props} />
12
+ }
13
+
14
+ function SelectGroup({
15
+ ...props
16
+ }: React.ComponentProps<typeof SelectPrimitive.Group>) {
17
+ return <SelectPrimitive.Group data-slot="select-group" {...props} />
18
+ }
19
+
20
+ function SelectValue({
21
+ ...props
22
+ }: React.ComponentProps<typeof SelectPrimitive.Value>) {
23
+ return <SelectPrimitive.Value data-slot="select-value" {...props} />
24
+ }
25
+
26
+ function SelectTrigger({
27
+ className,
28
+ size = "default",
29
+ children,
30
+ ...props
31
+ }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
32
+ size?: "sm" | "default"
33
+ }) {
34
+ return (
35
+ <SelectPrimitive.Trigger
36
+ data-slot="select-trigger"
37
+ data-size={size}
38
+ className={cn(
39
+ "border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
40
+ className
41
+ )}
42
+ {...props}
43
+ >
44
+ {children}
45
+ <SelectPrimitive.Icon asChild>
46
+ <IconChevronDown className="size-4 opacity-50" />
47
+ </SelectPrimitive.Icon>
48
+ </SelectPrimitive.Trigger>
49
+ )
50
+ }
51
+
52
+ function SelectContent({
53
+ className,
54
+ children,
55
+ position = "item-aligned",
56
+ align = "center",
57
+ viewportClassName,
58
+ ...props
59
+ }: React.ComponentProps<typeof SelectPrimitive.Content> & {
60
+ viewportClassName?: string
61
+ }) {
62
+ return (
63
+ <SelectPrimitive.Portal>
64
+ <SelectPrimitive.Content
65
+ data-slot="select-content"
66
+ className={cn(
67
+ "bg-popover text-popover-foreground 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
68
+ position === "popper" &&
69
+ "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
70
+ className
71
+ )}
72
+ position={position}
73
+ align={align}
74
+ {...props}
75
+ >
76
+ <SelectScrollUpButton />
77
+ <SelectPrimitive.Viewport
78
+ className={cn(
79
+ "p-1",
80
+ position === "popper" &&
81
+ "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
82
+ viewportClassName,
83
+ )}
84
+ >
85
+ {children}
86
+ </SelectPrimitive.Viewport>
87
+ <SelectScrollDownButton />
88
+ </SelectPrimitive.Content>
89
+ </SelectPrimitive.Portal>
90
+ )
91
+ }
92
+
93
+ function SelectLabel({
94
+ className,
95
+ ...props
96
+ }: React.ComponentProps<typeof SelectPrimitive.Label>) {
97
+ return (
98
+ <SelectPrimitive.Label
99
+ data-slot="select-label"
100
+ className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ function SelectItem({
107
+ className,
108
+ children,
109
+ ...props
110
+ }: React.ComponentProps<typeof SelectPrimitive.Item>) {
111
+ return (
112
+ <SelectPrimitive.Item
113
+ data-slot="select-item"
114
+ className={cn(
115
+ "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
116
+ className
117
+ )}
118
+ {...props}
119
+ >
120
+ <span
121
+ data-slot="select-item-indicator"
122
+ className="absolute right-2 flex size-3.5 items-center justify-center"
123
+ >
124
+ <SelectPrimitive.ItemIndicator>
125
+ <IconCheck className="size-4" />
126
+ </SelectPrimitive.ItemIndicator>
127
+ </span>
128
+ <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
129
+ </SelectPrimitive.Item>
130
+ )
131
+ }
132
+
133
+ function SelectSeparator({
134
+ className,
135
+ ...props
136
+ }: React.ComponentProps<typeof SelectPrimitive.Separator>) {
137
+ return (
138
+ <SelectPrimitive.Separator
139
+ data-slot="select-separator"
140
+ className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
141
+ {...props}
142
+ />
143
+ )
144
+ }
145
+
146
+ function SelectScrollUpButton({
147
+ className,
148
+ ...props
149
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
150
+ return (
151
+ <SelectPrimitive.ScrollUpButton
152
+ data-slot="select-scroll-up-button"
153
+ className={cn(
154
+ "flex cursor-default items-center justify-center py-1",
155
+ className
156
+ )}
157
+ {...props}
158
+ >
159
+ <IconChevronUp className="size-4" />
160
+ </SelectPrimitive.ScrollUpButton>
161
+ )
162
+ }
163
+
164
+ function SelectScrollDownButton({
165
+ className,
166
+ ...props
167
+ }: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
168
+ return (
169
+ <SelectPrimitive.ScrollDownButton
170
+ data-slot="select-scroll-down-button"
171
+ className={cn(
172
+ "flex cursor-default items-center justify-center py-1",
173
+ className
174
+ )}
175
+ {...props}
176
+ >
177
+ <IconChevronDown className="size-4" />
178
+ </SelectPrimitive.ScrollDownButton>
179
+ )
180
+ }
181
+
182
+ export {
183
+ Select,
184
+ SelectContent,
185
+ SelectGroup,
186
+ SelectItem,
187
+ SelectLabel,
188
+ SelectScrollDownButton,
189
+ SelectScrollUpButton,
190
+ SelectSeparator,
191
+ SelectTrigger,
192
+ SelectValue,
193
+ }
@@ -0,0 +1,28 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Separator as SeparatorPrimitive } from "radix-ui"
5
+
6
+ import { cn } from "../lib/utils"
7
+
8
+ function Separator({
9
+ className,
10
+ orientation = "horizontal",
11
+ decorative = true,
12
+ ...props
13
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
14
+ return (
15
+ <SeparatorPrimitive.Root
16
+ data-slot="separator"
17
+ decorative={decorative}
18
+ orientation={orientation}
19
+ className={cn(
20
+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
21
+ className
22
+ )}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ export { Separator }
@@ -0,0 +1,143 @@
1
+ "use client"
2
+
3
+ import { IconX } from "@tabler/icons-react";
4
+ import * as React from "react"
5
+ import { Dialog as SheetPrimitive } from "radix-ui"
6
+
7
+ import { cn } from "../lib/utils"
8
+
9
+ function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
10
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />
11
+ }
12
+
13
+ function SheetTrigger({
14
+ ...props
15
+ }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
16
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
17
+ }
18
+
19
+ function SheetClose({
20
+ ...props
21
+ }: React.ComponentProps<typeof SheetPrimitive.Close>) {
22
+ return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
23
+ }
24
+
25
+ function SheetPortal({
26
+ ...props
27
+ }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
28
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
29
+ }
30
+
31
+ function SheetOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
35
+ return (
36
+ <SheetPrimitive.Overlay
37
+ data-slot="sheet-overlay"
38
+ className={cn(
39
+ "fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ )
45
+ }
46
+
47
+ function SheetContent({
48
+ className,
49
+ children,
50
+ side = "right",
51
+ showCloseButton = true,
52
+ ...props
53
+ }: React.ComponentProps<typeof SheetPrimitive.Content> & {
54
+ side?: "top" | "right" | "bottom" | "left"
55
+ showCloseButton?: boolean
56
+ }) {
57
+ return (
58
+ <SheetPortal>
59
+ <SheetOverlay />
60
+ <SheetPrimitive.Content
61
+ data-slot="sheet-content"
62
+ className={cn(
63
+ "fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500",
64
+ side === "right" &&
65
+ "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
66
+ side === "left" &&
67
+ "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
68
+ side === "top" &&
69
+ "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
70
+ side === "bottom" &&
71
+ "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
72
+ className
73
+ )}
74
+ {...props}
75
+ >
76
+ {children}
77
+ {showCloseButton && (
78
+ <SheetPrimitive.Close className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary">
79
+ <IconX className="size-4" />
80
+ <span className="sr-only">Close</span>
81
+ </SheetPrimitive.Close>
82
+ )}
83
+ </SheetPrimitive.Content>
84
+ </SheetPortal>
85
+ )
86
+ }
87
+
88
+ function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
89
+ return (
90
+ <div
91
+ data-slot="sheet-header"
92
+ className={cn("flex flex-col gap-1.5 p-4", className)}
93
+ {...props}
94
+ />
95
+ )
96
+ }
97
+
98
+ function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
99
+ return (
100
+ <div
101
+ data-slot="sheet-footer"
102
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
103
+ {...props}
104
+ />
105
+ )
106
+ }
107
+
108
+ function SheetTitle({
109
+ className,
110
+ ...props
111
+ }: React.ComponentProps<typeof SheetPrimitive.Title>) {
112
+ return (
113
+ <SheetPrimitive.Title
114
+ data-slot="sheet-title"
115
+ className={cn("font-semibold text-foreground", className)}
116
+ {...props}
117
+ />
118
+ )
119
+ }
120
+
121
+ function SheetDescription({
122
+ className,
123
+ ...props
124
+ }: React.ComponentProps<typeof SheetPrimitive.Description>) {
125
+ return (
126
+ <SheetPrimitive.Description
127
+ data-slot="sheet-description"
128
+ className={cn("text-sm text-muted-foreground", className)}
129
+ {...props}
130
+ />
131
+ )
132
+ }
133
+
134
+ export {
135
+ Sheet,
136
+ SheetTrigger,
137
+ SheetClose,
138
+ SheetContent,
139
+ SheetHeader,
140
+ SheetFooter,
141
+ SheetTitle,
142
+ SheetDescription,
143
+ }