@traky-app/ui 1.0.0 → 1.1.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 (68) hide show
  1. package/README.md +12 -19
  2. package/package.json +48 -3
  3. package/registry/traky/json/command.json +1 -1
  4. package/registry/traky/ui/command.tsx +1 -0
  5. package/src/hooks/use-document-theme.ts +25 -0
  6. package/src/hooks/use-mobile.ts +19 -0
  7. package/src/lib/disable-input-autofill.ts +23 -0
  8. package/src/lib/sidebar-persistence.ts +76 -0
  9. package/src/lib/utils.ts +30 -0
  10. package/src/ui/accordion.tsx +65 -0
  11. package/src/ui/alert-dialog.tsx +163 -0
  12. package/src/ui/alert.tsx +66 -0
  13. package/src/ui/animated-beam.tsx +185 -0
  14. package/src/ui/animated-list.tsx +71 -0
  15. package/src/ui/avatar.tsx +53 -0
  16. package/src/ui/badge.tsx +46 -0
  17. package/src/ui/bento-grid.tsx +109 -0
  18. package/src/ui/breadcrumb.tsx +108 -0
  19. package/src/ui/bubble.tsx +125 -0
  20. package/src/ui/button-group.tsx +83 -0
  21. package/src/ui/button.tsx +64 -0
  22. package/src/ui/calendar.tsx +213 -0
  23. package/src/ui/card.tsx +92 -0
  24. package/src/ui/carousel.tsx +240 -0
  25. package/src/ui/chart.tsx +380 -0
  26. package/src/ui/checkbox.tsx +31 -0
  27. package/src/ui/checkpoint.tsx +94 -0
  28. package/src/ui/code-block.tsx +232 -0
  29. package/src/ui/collapsible.tsx +33 -0
  30. package/src/ui/command.tsx +191 -0
  31. package/src/ui/context-menu.tsx +251 -0
  32. package/src/ui/dialog.tsx +142 -0
  33. package/src/ui/drawer.tsx +135 -0
  34. package/src/ui/dropdown-menu.tsx +256 -0
  35. package/src/ui/empty.tsx +104 -0
  36. package/src/ui/field.tsx +248 -0
  37. package/src/ui/globe.tsx +234 -0
  38. package/src/ui/hover-card.tsx +44 -0
  39. package/src/ui/input-group.tsx +170 -0
  40. package/src/ui/input-otp.tsx +77 -0
  41. package/src/ui/input.tsx +24 -0
  42. package/src/ui/item.tsx +193 -0
  43. package/src/ui/kbd.tsx +28 -0
  44. package/src/ui/label.tsx +24 -0
  45. package/src/ui/map.tsx +2226 -0
  46. package/src/ui/marker.tsx +69 -0
  47. package/src/ui/marquee.tsx +74 -0
  48. package/src/ui/message.tsx +92 -0
  49. package/src/ui/navigation-menu.tsx +169 -0
  50. package/src/ui/number-ticker.tsx +90 -0
  51. package/src/ui/pagination.tsx +122 -0
  52. package/src/ui/popover.tsx +48 -0
  53. package/src/ui/progress.tsx +31 -0
  54. package/src/ui/select.tsx +193 -0
  55. package/src/ui/separator.tsx +28 -0
  56. package/src/ui/sheet.tsx +143 -0
  57. package/src/ui/sidebar.tsx +764 -0
  58. package/src/ui/skeleton.tsx +13 -0
  59. package/src/ui/sonner.tsx +71 -0
  60. package/src/ui/spinner.tsx +15 -0
  61. package/src/ui/switch.tsx +41 -0
  62. package/src/ui/table.tsx +116 -0
  63. package/src/ui/tabs.tsx +66 -0
  64. package/src/ui/textarea.tsx +20 -0
  65. package/src/ui/toggle-group.tsx +83 -0
  66. package/src/ui/toggle.tsx +47 -0
  67. package/src/ui/tooltip.tsx +61 -0
  68. package/src/ui/trace.tsx +165 -0
@@ -0,0 +1,77 @@
1
+ "use client"
2
+
3
+ import { IconMinus } from "@tabler/icons-react";
4
+ import * as React from "react"
5
+ import { OTPInput, OTPInputContext } from "input-otp"
6
+ import { cn } from "../lib/utils"
7
+
8
+ function InputOTP({
9
+ className,
10
+ containerClassName,
11
+ ...props
12
+ }: React.ComponentProps<typeof OTPInput> & {
13
+ containerClassName?: string
14
+ }) {
15
+ return (
16
+ <OTPInput
17
+ data-slot="input-otp"
18
+ data-e2e="auth-otp-input"
19
+ containerClassName={cn(
20
+ "flex items-center gap-2 has-disabled:opacity-50",
21
+ containerClassName
22
+ )}
23
+ className={cn("disabled:cursor-not-allowed", className)}
24
+ {...props}
25
+ />
26
+ )
27
+ }
28
+
29
+ function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
30
+ return (
31
+ <div
32
+ data-slot="input-otp-group"
33
+ className={cn("flex items-center", className)}
34
+ {...props}
35
+ />
36
+ )
37
+ }
38
+
39
+ function InputOTPSlot({
40
+ index,
41
+ className,
42
+ ...props
43
+ }: React.ComponentProps<"div"> & {
44
+ index: number
45
+ }) {
46
+ const inputOTPContext = React.useContext(OTPInputContext)
47
+ const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {}
48
+
49
+ return (
50
+ <div
51
+ data-slot="input-otp-slot"
52
+ data-active={isActive}
53
+ className={cn(
54
+ "relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-[3px] data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
55
+ className
56
+ )}
57
+ {...props}
58
+ >
59
+ {char}
60
+ {hasFakeCaret && (
61
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
62
+ <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
63
+ </div>
64
+ )}
65
+ </div>
66
+ )
67
+ }
68
+
69
+ function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
70
+ return (
71
+ <div data-slot="input-otp-separator" role="separator" {...props}>
72
+ <IconMinus />
73
+ </div>
74
+ )
75
+ }
76
+
77
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
@@ -0,0 +1,24 @@
1
+ import * as React from "react"
2
+
3
+ import { DISABLE_INPUT_AUTOFILL } from "../lib/disable-input-autofill"
4
+ import { cn } from "../lib/utils"
5
+
6
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
7
+ return (
8
+ <input
9
+ type={type}
10
+ data-slot="input"
11
+ // Auth debe pasar autoComplete explícito (email, current-password, …).
12
+ {...DISABLE_INPUT_AUTOFILL}
13
+ className={cn(
14
+ "h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
15
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
16
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ )
22
+ }
23
+
24
+ export { Input }
@@ -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 }