@traky-app/ui 0.0.0-stage → 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 (195) hide show
  1. package/README.md +23 -2
  2. package/package.json +71 -4
  3. package/registry/registry.json +6 -0
  4. package/registry/traky/hooks/use-mobile.ts +19 -0
  5. package/registry/traky/json/accordion.json +18 -0
  6. package/registry/traky/json/alert-dialog.json +20 -0
  7. package/registry/traky/json/alert.json +17 -0
  8. package/registry/traky/json/animated-beam.json +14 -0
  9. package/registry/traky/json/animated-list.json +14 -0
  10. package/registry/traky/json/avatar.json +17 -0
  11. package/registry/traky/json/badge.json +18 -0
  12. package/registry/traky/json/bento-grid.json +20 -0
  13. package/registry/traky/json/breadcrumb.json +18 -0
  14. package/registry/traky/json/bubble.json +18 -0
  15. package/registry/traky/json/button-group.json +21 -0
  16. package/registry/traky/json/button.json +18 -0
  17. package/registry/traky/json/calendar.json +21 -0
  18. package/registry/traky/json/card.json +14 -0
  19. package/registry/traky/json/carousel.json +21 -0
  20. package/registry/traky/json/chart.json +17 -0
  21. package/registry/traky/json/checkbox.json +18 -0
  22. package/registry/traky/json/checkpoint.json +22 -0
  23. package/registry/traky/json/code-block.json +21 -0
  24. package/registry/traky/json/collapsible.json +17 -0
  25. package/registry/traky/json/command.json +22 -0
  26. package/registry/traky/json/context-menu.json +18 -0
  27. package/registry/traky/json/dialog.json +18 -0
  28. package/registry/traky/json/drawer.json +17 -0
  29. package/registry/traky/json/dropdown-menu.json +18 -0
  30. package/registry/traky/json/empty.json +17 -0
  31. package/registry/traky/json/field.json +21 -0
  32. package/registry/traky/json/globe.json +17 -0
  33. package/registry/traky/json/hook-use-mobile.json +14 -0
  34. package/registry/traky/json/hover-card.json +17 -0
  35. package/registry/traky/json/input-group.json +22 -0
  36. package/registry/traky/json/input-otp.json +18 -0
  37. package/registry/traky/json/input.json +17 -0
  38. package/registry/traky/json/item.json +21 -0
  39. package/registry/traky/json/kbd.json +14 -0
  40. package/registry/traky/json/label.json +17 -0
  41. package/registry/traky/json/lib-disable-input-autofill.json +14 -0
  42. package/registry/traky/json/lib-sidebar-persistence.json +14 -0
  43. package/registry/traky/json/lib-utils.json +18 -0
  44. package/registry/traky/json/map.json +19 -0
  45. package/registry/traky/json/marker.json +18 -0
  46. package/registry/traky/json/marquee.json +14 -0
  47. package/registry/traky/json/message.json +14 -0
  48. package/registry/traky/json/navigation-menu.json +19 -0
  49. package/registry/traky/json/number-ticker.json +14 -0
  50. package/registry/traky/json/pagination.json +20 -0
  51. package/registry/traky/json/popover.json +17 -0
  52. package/registry/traky/json/progress.json +17 -0
  53. package/registry/traky/json/select.json +18 -0
  54. package/registry/traky/json/separator.json +17 -0
  55. package/registry/traky/json/sheet.json +18 -0
  56. package/registry/traky/json/sidebar.json +29 -0
  57. package/registry/traky/json/skeleton.json +14 -0
  58. package/registry/traky/json/sonner.json +18 -0
  59. package/registry/traky/json/spinner.json +17 -0
  60. package/registry/traky/json/switch.json +17 -0
  61. package/registry/traky/json/table.json +14 -0
  62. package/registry/traky/json/tabs.json +17 -0
  63. package/registry/traky/json/textarea.json +17 -0
  64. package/registry/traky/json/toggle-group.json +21 -0
  65. package/registry/traky/json/toggle.json +18 -0
  66. package/registry/traky/json/tooltip.json +17 -0
  67. package/registry/traky/json/trace.json +20 -0
  68. package/registry/traky/lib/disable-input-autofill.ts +23 -0
  69. package/registry/traky/lib/sidebar-persistence.ts +76 -0
  70. package/registry/traky/lib/utils.ts +6 -0
  71. package/registry/traky/registry.json +637 -0
  72. package/registry/traky/ui/accordion.tsx +65 -0
  73. package/registry/traky/ui/alert-dialog.tsx +163 -0
  74. package/registry/traky/ui/alert.tsx +66 -0
  75. package/registry/traky/ui/animated-beam.tsx +185 -0
  76. package/registry/traky/ui/animated-list.tsx +71 -0
  77. package/registry/traky/ui/avatar.tsx +53 -0
  78. package/registry/traky/ui/badge.tsx +46 -0
  79. package/registry/traky/ui/bento-grid.tsx +109 -0
  80. package/registry/traky/ui/breadcrumb.tsx +108 -0
  81. package/registry/traky/ui/bubble.tsx +125 -0
  82. package/registry/traky/ui/button-group.tsx +83 -0
  83. package/registry/traky/ui/button.tsx +64 -0
  84. package/registry/traky/ui/calendar.tsx +213 -0
  85. package/registry/traky/ui/card.tsx +92 -0
  86. package/registry/traky/ui/carousel.tsx +240 -0
  87. package/registry/traky/ui/chart.tsx +380 -0
  88. package/registry/traky/ui/checkbox.tsx +31 -0
  89. package/registry/traky/ui/checkpoint.tsx +94 -0
  90. package/registry/traky/ui/code-block.tsx +232 -0
  91. package/registry/traky/ui/collapsible.tsx +33 -0
  92. package/registry/traky/ui/command.tsx +191 -0
  93. package/registry/traky/ui/context-menu.tsx +251 -0
  94. package/registry/traky/ui/dialog.tsx +142 -0
  95. package/registry/traky/ui/drawer.tsx +135 -0
  96. package/registry/traky/ui/dropdown-menu.tsx +256 -0
  97. package/registry/traky/ui/empty.tsx +104 -0
  98. package/registry/traky/ui/field.tsx +248 -0
  99. package/registry/traky/ui/globe.tsx +234 -0
  100. package/registry/traky/ui/hover-card.tsx +44 -0
  101. package/registry/traky/ui/input-group.tsx +170 -0
  102. package/registry/traky/ui/input-otp.tsx +77 -0
  103. package/registry/traky/ui/input.tsx +24 -0
  104. package/registry/traky/ui/item.tsx +193 -0
  105. package/registry/traky/ui/kbd.tsx +28 -0
  106. package/registry/traky/ui/label.tsx +24 -0
  107. package/registry/traky/ui/map.tsx +2226 -0
  108. package/registry/traky/ui/marker.tsx +69 -0
  109. package/registry/traky/ui/marquee.tsx +74 -0
  110. package/registry/traky/ui/message.tsx +92 -0
  111. package/registry/traky/ui/navigation-menu.tsx +169 -0
  112. package/registry/traky/ui/number-ticker.tsx +90 -0
  113. package/registry/traky/ui/pagination.tsx +122 -0
  114. package/registry/traky/ui/popover.tsx +48 -0
  115. package/registry/traky/ui/progress.tsx +31 -0
  116. package/registry/traky/ui/select.tsx +193 -0
  117. package/registry/traky/ui/separator.tsx +28 -0
  118. package/registry/traky/ui/sheet.tsx +143 -0
  119. package/registry/traky/ui/sidebar.tsx +764 -0
  120. package/registry/traky/ui/skeleton.tsx +13 -0
  121. package/registry/traky/ui/sonner.tsx +71 -0
  122. package/registry/traky/ui/spinner.tsx +15 -0
  123. package/registry/traky/ui/switch.tsx +41 -0
  124. package/registry/traky/ui/table.tsx +116 -0
  125. package/registry/traky/ui/tabs.tsx +66 -0
  126. package/registry/traky/ui/textarea.tsx +20 -0
  127. package/registry/traky/ui/toggle-group.tsx +83 -0
  128. package/registry/traky/ui/toggle.tsx +47 -0
  129. package/registry/traky/ui/tooltip.tsx +61 -0
  130. package/registry/traky/ui/trace.tsx +165 -0
  131. package/schema/components.json +24 -0
  132. package/src/hooks/use-document-theme.ts +25 -0
  133. package/src/hooks/use-mobile.ts +19 -0
  134. package/src/lib/disable-input-autofill.ts +23 -0
  135. package/src/lib/sidebar-persistence.ts +76 -0
  136. package/src/lib/utils.ts +30 -0
  137. package/src/ui/accordion.tsx +65 -0
  138. package/src/ui/alert-dialog.tsx +163 -0
  139. package/src/ui/alert.tsx +66 -0
  140. package/src/ui/animated-beam.tsx +185 -0
  141. package/src/ui/animated-list.tsx +71 -0
  142. package/src/ui/avatar.tsx +53 -0
  143. package/src/ui/badge.tsx +46 -0
  144. package/src/ui/bento-grid.tsx +109 -0
  145. package/src/ui/breadcrumb.tsx +108 -0
  146. package/src/ui/bubble.tsx +125 -0
  147. package/src/ui/button-group.tsx +83 -0
  148. package/src/ui/button.tsx +64 -0
  149. package/src/ui/calendar.tsx +213 -0
  150. package/src/ui/card.tsx +92 -0
  151. package/src/ui/carousel.tsx +240 -0
  152. package/src/ui/chart.tsx +380 -0
  153. package/src/ui/checkbox.tsx +31 -0
  154. package/src/ui/checkpoint.tsx +94 -0
  155. package/src/ui/code-block.tsx +232 -0
  156. package/src/ui/collapsible.tsx +33 -0
  157. package/src/ui/command.tsx +191 -0
  158. package/src/ui/context-menu.tsx +251 -0
  159. package/src/ui/dialog.tsx +142 -0
  160. package/src/ui/drawer.tsx +135 -0
  161. package/src/ui/dropdown-menu.tsx +256 -0
  162. package/src/ui/empty.tsx +104 -0
  163. package/src/ui/field.tsx +248 -0
  164. package/src/ui/globe.tsx +234 -0
  165. package/src/ui/hover-card.tsx +44 -0
  166. package/src/ui/input-group.tsx +170 -0
  167. package/src/ui/input-otp.tsx +77 -0
  168. package/src/ui/input.tsx +24 -0
  169. package/src/ui/item.tsx +193 -0
  170. package/src/ui/kbd.tsx +28 -0
  171. package/src/ui/label.tsx +24 -0
  172. package/src/ui/map.tsx +2226 -0
  173. package/src/ui/marker.tsx +69 -0
  174. package/src/ui/marquee.tsx +74 -0
  175. package/src/ui/message.tsx +92 -0
  176. package/src/ui/navigation-menu.tsx +169 -0
  177. package/src/ui/number-ticker.tsx +90 -0
  178. package/src/ui/pagination.tsx +122 -0
  179. package/src/ui/popover.tsx +48 -0
  180. package/src/ui/progress.tsx +31 -0
  181. package/src/ui/select.tsx +193 -0
  182. package/src/ui/separator.tsx +28 -0
  183. package/src/ui/sheet.tsx +143 -0
  184. package/src/ui/sidebar.tsx +764 -0
  185. package/src/ui/skeleton.tsx +13 -0
  186. package/src/ui/sonner.tsx +71 -0
  187. package/src/ui/spinner.tsx +15 -0
  188. package/src/ui/switch.tsx +41 -0
  189. package/src/ui/table.tsx +116 -0
  190. package/src/ui/tabs.tsx +66 -0
  191. package/src/ui/textarea.tsx +20 -0
  192. package/src/ui/toggle-group.tsx +83 -0
  193. package/src/ui/toggle.tsx +47 -0
  194. package/src/ui/tooltip.tsx +61 -0
  195. package/src/ui/trace.tsx +165 -0
@@ -0,0 +1,232 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { IconCheck, IconCopy } from "@tabler/icons-react"
5
+ import { cva, type VariantProps } from "class-variance-authority"
6
+
7
+ import { cn } from "../lib/utils"
8
+ import { Button } from "./button"
9
+
10
+ const codeBlockVariants = cva(
11
+ "group/code-block relative flex w-full min-w-0 flex-col overflow-hidden rounded-lg text-sm has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 data-[size=sm]:text-xs",
12
+ {
13
+ variants: {
14
+ variant: {
15
+ default:
16
+ "border border-input bg-background text-foreground has-[>[data-slot=code-block-content]:focus-visible]:border-ring dark:bg-input/30",
17
+ destructive:
18
+ "border border-destructive/30 bg-background text-destructive dark:border-destructive/40",
19
+ },
20
+ },
21
+ defaultVariants: {
22
+ variant: "default",
23
+ },
24
+ }
25
+ )
26
+
27
+ function CodeBlock({
28
+ className,
29
+ variant = "default",
30
+ size = "default",
31
+ ...props
32
+ }: React.ComponentProps<"div"> &
33
+ VariantProps<typeof codeBlockVariants> & { size?: "default" | "sm" }) {
34
+ return (
35
+ <div
36
+ data-slot="code-block"
37
+ data-variant={variant}
38
+ data-size={size}
39
+ className={cn(codeBlockVariants({ variant }), className)}
40
+ {...props}
41
+ />
42
+ )
43
+ }
44
+
45
+ function CodeBlockHeader({ className, ...props }: React.ComponentProps<"div">) {
46
+ return (
47
+ <div
48
+ data-slot="code-block-header"
49
+ className={cn(
50
+ "flex min-w-0 shrink-0 items-center gap-2 px-3 pt-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pt-2.5 group-data-[variant=destructive]/code-block:text-destructive *:has-[>[data-slot=code-block-title]]:min-w-0",
51
+ className
52
+ )}
53
+ {...props}
54
+ />
55
+ )
56
+ }
57
+
58
+ function CodeBlockTitle({ className, ...props }: React.ComponentProps<"div">) {
59
+ return (
60
+ <div
61
+ data-slot="code-block-title"
62
+ className={cn(
63
+ "min-w-0 truncate font-sans text-sm font-medium text-foreground group-data-[size=sm]/code-block:text-xs group-data-[variant=destructive]/code-block:text-destructive [&_svg]:pointer-events-none [&_svg]:inline-block [&_svg]:align-middle [&_svg:not([class*='size-'])]:size-3.5 *:[svg]:me-1.5",
64
+ className
65
+ )}
66
+ {...props}
67
+ />
68
+ )
69
+ }
70
+
71
+ function CodeBlockActions({
72
+ className,
73
+ ...props
74
+ }: React.ComponentProps<"div">) {
75
+ return (
76
+ <div
77
+ data-slot="code-block-actions"
78
+ className={cn(
79
+ "-my-1 ms-auto -me-1.5 flex shrink-0 items-center gap-1 [[data-slot=code-block]>&]:absolute [[data-slot=code-block]>&]:end-2 [[data-slot=code-block]>&]:top-2 [[data-slot=code-block]>&]:z-10 [[data-slot=code-block]>&]:m-0 [[data-slot=code-block]>&]:opacity-0 [[data-slot=code-block]>&]:transition-opacity [[data-slot=code-block]>&]:group-focus-within/code-block:opacity-100 [[data-slot=code-block]>&]:group-hover/code-block:opacity-100 group-data-[size=sm]/code-block:-me-1",
80
+ className
81
+ )}
82
+ {...props}
83
+ />
84
+ )
85
+ }
86
+
87
+ function CodeBlockCopyButton({
88
+ value,
89
+ className,
90
+ ...props
91
+ }: Omit<React.ComponentProps<typeof Button>, "children" | "onClick"> & {
92
+ value: string
93
+ }) {
94
+ const [copied, setCopied] = React.useState(false)
95
+
96
+ return (
97
+ <>
98
+ <Button
99
+ type="button"
100
+ variant="ghost"
101
+ size="icon-xs"
102
+ className={cn("text-muted-foreground", className)}
103
+ onClick={async () => {
104
+ try {
105
+ await navigator.clipboard.writeText(value)
106
+ setCopied(true)
107
+ window.setTimeout(() => setCopied(false), 1500)
108
+ } catch {
109
+ // ignore
110
+ }
111
+ }}
112
+ {...props}
113
+ >
114
+ {copied ? <IconCheck /> : <IconCopy />}
115
+ </Button>
116
+ <span aria-live="polite" className="sr-only">
117
+ {copied ? "Copied" : ""}
118
+ </span>
119
+ </>
120
+ )
121
+ }
122
+
123
+ function CodeBlockContent({
124
+ className,
125
+ children,
126
+ style,
127
+ wrap = false,
128
+ lineNumbers = false,
129
+ startLine = 1,
130
+ ...props
131
+ }: React.ComponentProps<"pre"> & {
132
+ wrap?: boolean
133
+ lineNumbers?: boolean
134
+ startLine?: number
135
+ }) {
136
+ return (
137
+ <pre
138
+ data-slot="code-block-content"
139
+ data-wrap={wrap || undefined}
140
+ data-numbered={lineNumbers || undefined}
141
+ dir="ltr"
142
+ tabIndex={0}
143
+ style={{ counterReset: `line ${startLine - 1}`, ...style }}
144
+ className={cn(
145
+ "min-h-0 min-w-0 overflow-auto px-3 py-3 text-start font-mono leading-relaxed outline-none group-has-data-[slot=code-block-footer]/code-block:pb-2 group-has-data-[slot=code-block-header]/code-block:pt-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap",
146
+ className
147
+ )}
148
+ {...props}
149
+ >
150
+ <code
151
+ data-slot="code-block-code"
152
+ className="grid min-h-lh min-w-max content-start in-data-wrap:min-w-0"
153
+ >
154
+ {lineNumbers && typeof children === "string"
155
+ ? children
156
+ .replace(/\n$/, "")
157
+ .split("\n")
158
+ .map((line, index) => (
159
+ <CodeBlockLine key={index}>{line}</CodeBlockLine>
160
+ ))
161
+ : children}
162
+ </code>
163
+ </pre>
164
+ )
165
+ }
166
+
167
+ const codeBlockLineVariants = cva(
168
+ "relative -mx-3 block min-h-lh px-3 group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 before:min-w-6 before:text-end before:text-muted-foreground after:absolute after:start-1 after:top-0 after:text-muted-foreground after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:gap-x-3 in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none",
169
+ {
170
+ variants: {
171
+ variant: {
172
+ default: "",
173
+ added: "bg-muted after:content-['+']",
174
+ removed: "bg-destructive/10 after:text-destructive after:content-['−']",
175
+ highlighted: "bg-muted",
176
+ },
177
+ },
178
+ defaultVariants: {
179
+ variant: "default",
180
+ },
181
+ }
182
+ )
183
+
184
+ function CodeBlockLine({
185
+ className,
186
+ variant = "default",
187
+ children,
188
+ ...props
189
+ }: React.ComponentProps<"span"> & VariantProps<typeof codeBlockLineVariants>) {
190
+ const empty =
191
+ children === undefined ||
192
+ children === null ||
193
+ children === "" ||
194
+ (Array.isArray(children) && children.length === 0)
195
+
196
+ return (
197
+ <span
198
+ data-slot="code-block-line"
199
+ data-variant={variant}
200
+ className={cn(codeBlockLineVariants({ variant }), className)}
201
+ {...props}
202
+ >
203
+ <span data-slot="code-block-line-content" className="min-w-0">
204
+ {empty ? "\n" : children}
205
+ </span>
206
+ </span>
207
+ )
208
+ }
209
+
210
+ function CodeBlockFooter({ className, ...props }: React.ComponentProps<"div">) {
211
+ return (
212
+ <div
213
+ data-slot="code-block-footer"
214
+ className={cn(
215
+ "flex min-w-0 shrink-0 items-center gap-2 px-3 pb-3 text-muted-foreground group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:pb-2.5",
216
+ className
217
+ )}
218
+ {...props}
219
+ />
220
+ )
221
+ }
222
+
223
+ export {
224
+ CodeBlock,
225
+ CodeBlockHeader,
226
+ CodeBlockTitle,
227
+ CodeBlockActions,
228
+ CodeBlockCopyButton,
229
+ CodeBlockContent,
230
+ CodeBlockLine,
231
+ CodeBlockFooter,
232
+ }
@@ -0,0 +1,33 @@
1
+ "use client"
2
+
3
+ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
4
+
5
+ function Collapsible({
6
+ ...props
7
+ }: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
8
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
9
+ }
10
+
11
+ function CollapsibleTrigger({
12
+ ...props
13
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
14
+ return (
15
+ <CollapsiblePrimitive.CollapsibleTrigger
16
+ data-slot="collapsible-trigger"
17
+ {...props}
18
+ />
19
+ )
20
+ }
21
+
22
+ function CollapsibleContent({
23
+ ...props
24
+ }: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
25
+ return (
26
+ <CollapsiblePrimitive.CollapsibleContent
27
+ data-slot="collapsible-content"
28
+ {...props}
29
+ />
30
+ )
31
+ }
32
+
33
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
@@ -0,0 +1,191 @@
1
+ "use client"
2
+
3
+ import { IconSearch } from "@tabler/icons-react";
4
+ import * as React from "react"
5
+ import { Command as CommandPrimitive } from "cmdk"
6
+ import { DISABLE_INPUT_AUTOFILL } from "../lib/disable-input-autofill"
7
+ import { cn } from "../lib/utils"
8
+ import {
9
+ Dialog,
10
+ DialogContent,
11
+ DialogDescription,
12
+ DialogHeader,
13
+ DialogTitle,
14
+ } from "./dialog"
15
+
16
+ function Command({
17
+ className,
18
+ ...props
19
+ }: React.ComponentProps<typeof CommandPrimitive>) {
20
+ return (
21
+ <CommandPrimitive
22
+ data-slot="command"
23
+ className={cn(
24
+ "bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ )
30
+ }
31
+
32
+ function CommandDialog({
33
+ title = "Command Palette",
34
+ description = "Search for a command to run...",
35
+ children,
36
+ className,
37
+ showCloseButton = true,
38
+ ...props
39
+ }: React.ComponentProps<typeof Dialog> & {
40
+ title?: string
41
+ description?: string
42
+ className?: string
43
+ showCloseButton?: boolean
44
+ }) {
45
+ return (
46
+ <Dialog {...props}>
47
+ <DialogHeader className="sr-only">
48
+ <DialogTitle>{title}</DialogTitle>
49
+ <DialogDescription>{description}</DialogDescription>
50
+ </DialogHeader>
51
+ <DialogContent
52
+ className={cn("overflow-hidden p-0", className)}
53
+ showCloseButton={showCloseButton}
54
+ >
55
+ <Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
56
+ {children}
57
+ </Command>
58
+ </DialogContent>
59
+ </Dialog>
60
+ )
61
+ }
62
+
63
+ function CommandInput({
64
+ className,
65
+ name,
66
+ ...props
67
+ }: React.ComponentProps<typeof CommandPrimitive.Input>) {
68
+ return (
69
+ <div
70
+ data-slot="command-input-wrapper"
71
+ className="flex h-9 items-center gap-2 border-b px-3"
72
+ >
73
+ <IconSearch className="size-4 shrink-0 opacity-50" />
74
+ <CommandPrimitive.Input
75
+ data-slot="command-input"
76
+ // type=search + anti-autofill: evita iCloud Password / gestores
77
+ // en “Buscar usuario”, “Buscar dirección”, etc.
78
+ {...DISABLE_INPUT_AUTOFILL}
79
+ type="search"
80
+ enterKeyHint="search"
81
+ name={name ?? "traky-command-search"}
82
+ className={cn(
83
+ "placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
84
+ className
85
+ )}
86
+ {...props}
87
+ />
88
+ </div>
89
+ )
90
+ }
91
+
92
+ function CommandList({
93
+ className,
94
+ ...props
95
+ }: React.ComponentProps<typeof CommandPrimitive.List>) {
96
+ return (
97
+ <CommandPrimitive.List
98
+ data-slot="command-list"
99
+ className={cn(
100
+ "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
101
+ className
102
+ )}
103
+ {...props}
104
+ />
105
+ )
106
+ }
107
+
108
+ function CommandEmpty({
109
+ ...props
110
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
111
+ return (
112
+ <CommandPrimitive.Empty
113
+ data-slot="command-empty"
114
+ className="py-6 text-center text-sm"
115
+ {...props}
116
+ />
117
+ )
118
+ }
119
+
120
+ function CommandGroup({
121
+ className,
122
+ ...props
123
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
124
+ return (
125
+ <CommandPrimitive.Group
126
+ data-slot="command-group"
127
+ className={cn(
128
+ "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
129
+ className
130
+ )}
131
+ {...props}
132
+ />
133
+ )
134
+ }
135
+
136
+ function CommandSeparator({
137
+ className,
138
+ ...props
139
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
140
+ return (
141
+ <CommandPrimitive.Separator
142
+ data-slot="command-separator"
143
+ className={cn("bg-border -mx-1 h-px", className)}
144
+ {...props}
145
+ />
146
+ )
147
+ }
148
+
149
+ function CommandItem({
150
+ className,
151
+ ...props
152
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) {
153
+ return (
154
+ <CommandPrimitive.Item
155
+ data-slot="command-item"
156
+ className={cn(
157
+ "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
158
+ className
159
+ )}
160
+ {...props}
161
+ />
162
+ )
163
+ }
164
+
165
+ function CommandShortcut({
166
+ className,
167
+ ...props
168
+ }: React.ComponentProps<"span">) {
169
+ return (
170
+ <span
171
+ data-slot="command-shortcut"
172
+ className={cn(
173
+ "text-muted-foreground ml-auto text-xs tracking-widest",
174
+ className
175
+ )}
176
+ {...props}
177
+ />
178
+ )
179
+ }
180
+
181
+ export {
182
+ Command,
183
+ CommandDialog,
184
+ CommandInput,
185
+ CommandList,
186
+ CommandEmpty,
187
+ CommandGroup,
188
+ CommandItem,
189
+ CommandShortcut,
190
+ CommandSeparator,
191
+ }
@@ -0,0 +1,251 @@
1
+ "use client";
2
+
3
+ import { IconCheck, IconChevronRight, IconCircle } from "@tabler/icons-react";
4
+ import * as React from "react";
5
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
6
+ import { cn } from "../lib/utils";
7
+
8
+ function ContextMenu({
9
+ ...props
10
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
11
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
12
+ }
13
+
14
+ function ContextMenuTrigger({
15
+ ...props
16
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
17
+ return (
18
+ <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" {...props} />
19
+ );
20
+ }
21
+
22
+ function ContextMenuGroup({
23
+ ...props
24
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
25
+ return (
26
+ <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
27
+ );
28
+ }
29
+
30
+ function ContextMenuPortal({
31
+ ...props
32
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
33
+ return (
34
+ <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
35
+ );
36
+ }
37
+
38
+ function ContextMenuSub({
39
+ ...props
40
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
41
+ return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />;
42
+ }
43
+
44
+ function ContextMenuRadioGroup({
45
+ ...props
46
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
47
+ return (
48
+ <ContextMenuPrimitive.RadioGroup
49
+ data-slot="context-menu-radio-group"
50
+ {...props}
51
+ />
52
+ );
53
+ }
54
+
55
+ function ContextMenuSubTrigger({
56
+ className,
57
+ inset,
58
+ children,
59
+ ...props
60
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
61
+ inset?: boolean;
62
+ }) {
63
+ return (
64
+ <ContextMenuPrimitive.SubTrigger
65
+ data-slot="context-menu-sub-trigger"
66
+ data-inset={inset}
67
+ className={cn(
68
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
69
+ className,
70
+ )}
71
+ {...props}
72
+ >
73
+ {children}
74
+ <IconChevronRight className="ml-auto size-4" />
75
+ </ContextMenuPrimitive.SubTrigger>
76
+ );
77
+ }
78
+
79
+ function ContextMenuSubContent({
80
+ className,
81
+ ...props
82
+ }: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
83
+ return (
84
+ <ContextMenuPrimitive.SubContent
85
+ data-slot="context-menu-sub-content"
86
+ className={cn(
87
+ "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 z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
88
+ className,
89
+ )}
90
+ {...props}
91
+ />
92
+ );
93
+ }
94
+
95
+ function ContextMenuContent({
96
+ className,
97
+ ...props
98
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Content>) {
99
+ return (
100
+ <ContextMenuPrimitive.Portal>
101
+ <ContextMenuPrimitive.Content
102
+ data-slot="context-menu-content"
103
+ className={cn(
104
+ "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 z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
105
+ className,
106
+ )}
107
+ {...props}
108
+ />
109
+ </ContextMenuPrimitive.Portal>
110
+ );
111
+ }
112
+
113
+ function ContextMenuItem({
114
+ className,
115
+ inset,
116
+ variant = "default",
117
+ ...props
118
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
119
+ inset?: boolean;
120
+ variant?: "default" | "destructive";
121
+ }) {
122
+ return (
123
+ <ContextMenuPrimitive.Item
124
+ data-slot="context-menu-item"
125
+ data-inset={inset}
126
+ data-variant={variant}
127
+ className={cn(
128
+ "focus:bg-accent/30 focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
129
+ className,
130
+ )}
131
+ {...props}
132
+ />
133
+ );
134
+ }
135
+
136
+ function ContextMenuCheckboxItem({
137
+ className,
138
+ children,
139
+ checked,
140
+ ...props
141
+ }: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>) {
142
+ return (
143
+ <ContextMenuPrimitive.CheckboxItem
144
+ data-slot="context-menu-checkbox-item"
145
+ className={cn(
146
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
147
+ className,
148
+ )}
149
+ checked={checked}
150
+ {...props}
151
+ >
152
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
153
+ <ContextMenuPrimitive.ItemIndicator>
154
+ <IconCheck className="size-4" />
155
+ </ContextMenuPrimitive.ItemIndicator>
156
+ </span>
157
+ {children}
158
+ </ContextMenuPrimitive.CheckboxItem>
159
+ );
160
+ }
161
+
162
+ function ContextMenuRadioItem({
163
+ className,
164
+ children,
165
+ ...props
166
+ }: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem>) {
167
+ return (
168
+ <ContextMenuPrimitive.RadioItem
169
+ data-slot="context-menu-radio-item"
170
+ className={cn(
171
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 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",
172
+ className,
173
+ )}
174
+ {...props}
175
+ >
176
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
177
+ <ContextMenuPrimitive.ItemIndicator>
178
+ <IconCircle className="size-2 fill-current" />
179
+ </ContextMenuPrimitive.ItemIndicator>
180
+ </span>
181
+ {children}
182
+ </ContextMenuPrimitive.RadioItem>
183
+ );
184
+ }
185
+
186
+ function ContextMenuLabel({
187
+ className,
188
+ inset,
189
+ ...props
190
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
191
+ inset?: boolean;
192
+ }) {
193
+ return (
194
+ <ContextMenuPrimitive.Label
195
+ data-slot="context-menu-label"
196
+ data-inset={inset}
197
+ className={cn(
198
+ "text-foreground px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
199
+ className,
200
+ )}
201
+ {...props}
202
+ />
203
+ );
204
+ }
205
+
206
+ function ContextMenuSeparator({
207
+ className,
208
+ ...props
209
+ }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
210
+ return (
211
+ <ContextMenuPrimitive.Separator
212
+ data-slot="context-menu-separator"
213
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
214
+ {...props}
215
+ />
216
+ );
217
+ }
218
+
219
+ function ContextMenuShortcut({
220
+ className,
221
+ ...props
222
+ }: React.ComponentProps<"span">) {
223
+ return (
224
+ <span
225
+ data-slot="context-menu-shortcut"
226
+ className={cn(
227
+ "text-muted-foreground ml-auto text-xs tracking-widest",
228
+ className,
229
+ )}
230
+ {...props}
231
+ />
232
+ );
233
+ }
234
+
235
+ export {
236
+ ContextMenu,
237
+ ContextMenuTrigger,
238
+ ContextMenuContent,
239
+ ContextMenuItem,
240
+ ContextMenuCheckboxItem,
241
+ ContextMenuRadioItem,
242
+ ContextMenuLabel,
243
+ ContextMenuSeparator,
244
+ ContextMenuShortcut,
245
+ ContextMenuGroup,
246
+ ContextMenuPortal,
247
+ ContextMenuSub,
248
+ ContextMenuSubContent,
249
+ ContextMenuSubTrigger,
250
+ ContextMenuRadioGroup,
251
+ };