@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
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "../lib/utils"
6
+ import { Separator } from "./separator"
7
+
8
+ function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
9
+ return (
10
+ <div
11
+ role="list"
12
+ data-slot="item-group"
13
+ className={cn("group/item-group flex flex-col", className)}
14
+ {...props}
15
+ />
16
+ )
17
+ }
18
+
19
+ function ItemSeparator({
20
+ className,
21
+ ...props
22
+ }: React.ComponentProps<typeof Separator>) {
23
+ return (
24
+ <Separator
25
+ data-slot="item-separator"
26
+ orientation="horizontal"
27
+ className={cn("my-0", className)}
28
+ {...props}
29
+ />
30
+ )
31
+ }
32
+
33
+ const itemVariants = cva(
34
+ "group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
35
+ {
36
+ variants: {
37
+ variant: {
38
+ default: "bg-transparent",
39
+ outline: "border-border",
40
+ muted: "bg-muted/50",
41
+ },
42
+ size: {
43
+ default: "p-4 gap-4 ",
44
+ sm: "py-3 px-4 gap-2.5",
45
+ },
46
+ },
47
+ defaultVariants: {
48
+ variant: "default",
49
+ size: "default",
50
+ },
51
+ }
52
+ )
53
+
54
+ function Item({
55
+ className,
56
+ variant = "default",
57
+ size = "default",
58
+ asChild = false,
59
+ ...props
60
+ }: React.ComponentProps<"div"> &
61
+ VariantProps<typeof itemVariants> & { asChild?: boolean }) {
62
+ const Comp = asChild ? Slot : "div"
63
+ return (
64
+ <Comp
65
+ data-slot="item"
66
+ data-variant={variant}
67
+ data-size={size}
68
+ className={cn(itemVariants({ variant, size, className }))}
69
+ {...props}
70
+ />
71
+ )
72
+ }
73
+
74
+ const itemMediaVariants = cva(
75
+ "flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5",
76
+ {
77
+ variants: {
78
+ variant: {
79
+ default: "bg-transparent",
80
+ icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
81
+ image:
82
+ "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover",
83
+ },
84
+ },
85
+ defaultVariants: {
86
+ variant: "default",
87
+ },
88
+ }
89
+ )
90
+
91
+ function ItemMedia({
92
+ className,
93
+ variant = "default",
94
+ ...props
95
+ }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
96
+ return (
97
+ <div
98
+ data-slot="item-media"
99
+ data-variant={variant}
100
+ className={cn(itemMediaVariants({ variant, className }))}
101
+ {...props}
102
+ />
103
+ )
104
+ }
105
+
106
+ function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
107
+ return (
108
+ <div
109
+ data-slot="item-content"
110
+ className={cn(
111
+ "flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none",
112
+ className
113
+ )}
114
+ {...props}
115
+ />
116
+ )
117
+ }
118
+
119
+ function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
120
+ return (
121
+ <div
122
+ data-slot="item-title"
123
+ className={cn(
124
+ "flex w-fit items-center gap-2 text-sm leading-snug font-medium",
125
+ className
126
+ )}
127
+ {...props}
128
+ />
129
+ )
130
+ }
131
+
132
+ function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
133
+ return (
134
+ <p
135
+ data-slot="item-description"
136
+ className={cn(
137
+ "text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance",
138
+ "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
139
+ className
140
+ )}
141
+ {...props}
142
+ />
143
+ )
144
+ }
145
+
146
+ function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
147
+ return (
148
+ <div
149
+ data-slot="item-actions"
150
+ className={cn("flex items-center gap-2", className)}
151
+ {...props}
152
+ />
153
+ )
154
+ }
155
+
156
+ function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
157
+ return (
158
+ <div
159
+ data-slot="item-header"
160
+ className={cn(
161
+ "flex basis-full items-center justify-between gap-2",
162
+ className
163
+ )}
164
+ {...props}
165
+ />
166
+ )
167
+ }
168
+
169
+ function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
170
+ return (
171
+ <div
172
+ data-slot="item-footer"
173
+ className={cn(
174
+ "flex basis-full items-center justify-between gap-2",
175
+ className
176
+ )}
177
+ {...props}
178
+ />
179
+ )
180
+ }
181
+
182
+ export {
183
+ Item,
184
+ ItemMedia,
185
+ ItemContent,
186
+ ItemActions,
187
+ ItemGroup,
188
+ ItemSeparator,
189
+ ItemTitle,
190
+ ItemDescription,
191
+ ItemHeader,
192
+ ItemFooter,
193
+ }
package/src/ui/kbd.tsx ADDED
@@ -0,0 +1,28 @@
1
+ import { cn } from "../lib/utils"
2
+
3
+ function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
4
+ return (
5
+ <kbd
6
+ data-slot="kbd"
7
+ className={cn(
8
+ "bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
9
+ "[&_svg:not([class*='size-'])]:size-3",
10
+ "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
19
+ return (
20
+ <kbd
21
+ data-slot="kbd-group"
22
+ className={cn("inline-flex items-center gap-1", className)}
23
+ {...props}
24
+ />
25
+ )
26
+ }
27
+
28
+ export { Kbd, KbdGroup }
@@ -0,0 +1,24 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as LabelPrimitive from "@radix-ui/react-label"
5
+
6
+ import { cn } from "../lib/utils"
7
+
8
+ function Label({
9
+ className,
10
+ ...props
11
+ }: React.ComponentProps<typeof LabelPrimitive.Root>) {
12
+ return (
13
+ <LabelPrimitive.Root
14
+ data-slot="label"
15
+ className={cn(
16
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ )
22
+ }
23
+
24
+ export { Label }
@@ -0,0 +1,77 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "../lib/utils"
5
+
6
+ const logoVariants = cva("inline-flex items-start", {
7
+ variants: {
8
+ variant: {
9
+ green: "text-[#a5dd64]",
10
+ blue: "text-[#000b27]",
11
+ white: "text-white",
12
+ },
13
+ size: {
14
+ xs: "[&_svg]:h-6",
15
+ sm: "[&_svg]:h-10",
16
+ md: "[&_svg]:h-14",
17
+ lg: "[&_svg]:h-20",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "green",
22
+ size: "md",
23
+ },
24
+ })
25
+
26
+ const LOGO_PATHS = [
27
+ "M259.89,30.16l-12,44.79h-5.2c-14.45,0-17.26-8.8-14.36-19.61l6.76-25.24h-14.21l-6.76,25.24c-5,18.65,6.11,33.82,24.76,33.82h5.2l-1.84,6.08c-2.9,10.81-14.06,19.61-24.87,19.61h-16.38l-3.81,14.21h16.38c18.65,0,37.89-15.17,42.88-33.82l17.65-65.08h-14.21Z",
28
+ "M15.4,55.45l2.72-10.15h28.64l4-14.91h-28.64L30.26,0h-14.21L1.2,55.45c-5,18.65,6.11,33.82,24.76,33.82h9.02l3.81-14.21h-9.02c-10.82,0-17.26-8.8-14.36-19.62Z",
29
+ "M186.36,56.58l25.6-16.04,2.71-10.11h-10.01l-38.7,24.32,6.53-24.38h-13.6l-15.77,58.85h13.6l5.47-20.43h10.6c10.56,0,16.85,8.59,14.02,19.15l-.33,1.23h13.87l.33-1.23c3.91-14.61-2.31-27.01-14.32-31.35Z",
30
+ "M122.83,28.78c-11.62,0-23.48,6.65-31.07,16.33l3.78-14.1h-4.37c-7.07,0-14.34,2.25-20.93,6.04l1.78-6.64h-15.15l-4.06,15.15h6.4c-5.58,5.6-9.85,12.4-11.81,19.68l-6.52,24.33h14.98s6.63-24.74,6.63-24.74c2.9-10.81,14.06-19.61,24.87-19.61h4.32c-3.18,4.09-5.62,8.7-6.93,13.6-4.44,16.56,5.43,30.03,21.99,30.03,6.5,0,13.07-2.1,18.94-5.62l-1.59,5.92h12.45s8-29.31,8.28-30.33c4.44-16.56-5.43-30.03-21.99-30.03ZM110.45,74.99c-8.91,0-14.22-7.25-11.84-16.17,2.39-8.91,11.59-16.17,20.5-16.17s14.22,7.25,11.84,16.17c-2.39,8.91-11.59,16.17-20.5,16.17Z",
31
+ ] as const
32
+
33
+ type LogoProps = React.ComponentProps<"span"> &
34
+ VariantProps<typeof logoVariants> & {
35
+ /** Muestra ® junto al wordmark. */
36
+ registered?: boolean
37
+ }
38
+
39
+ function Logo({
40
+ className,
41
+ variant = "green",
42
+ size = "md",
43
+ registered = false,
44
+ ...props
45
+ }: LogoProps) {
46
+ return (
47
+ <span
48
+ data-slot="logo"
49
+ data-variant={variant}
50
+ data-size={size}
51
+ className={cn(logoVariants({ variant, size }), className)}
52
+ {...props}
53
+ >
54
+ <svg
55
+ viewBox="0 0 274.1 129.06"
56
+ role="img"
57
+ aria-label="Traky"
58
+ className="block w-auto fill-current"
59
+ >
60
+ {LOGO_PATHS.map((d) => (
61
+ <path key={d.slice(0, 12)} d={d} />
62
+ ))}
63
+ </svg>
64
+ {registered ? (
65
+ <sup
66
+ className="ml-0.5 text-[0.55em] leading-none font-semibold select-none opacity-80"
67
+ aria-hidden
68
+ >
69
+ ®
70
+ </sup>
71
+ ) : null}
72
+ </span>
73
+ )
74
+ }
75
+
76
+ export { Logo, logoVariants }
77
+ export type { LogoProps }