@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.
- package/README.md +12 -19
- package/package.json +50 -3
- package/registry/traky/json/command.json +1 -1
- package/registry/traky/json/icon.json +17 -0
- package/registry/traky/json/logo.json +17 -0
- package/registry/traky/registry.json +20 -0
- package/registry/traky/ui/command.tsx +2 -0
- package/registry/traky/ui/icon.tsx +71 -0
- package/registry/traky/ui/logo.tsx +77 -0
- package/src/hooks/use-document-theme.ts +25 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/lib/disable-input-autofill.ts +23 -0
- package/src/lib/sidebar-persistence.ts +76 -0
- package/src/lib/utils.ts +30 -0
- package/src/ui/accordion.tsx +65 -0
- package/src/ui/alert-dialog.tsx +163 -0
- package/src/ui/alert.tsx +66 -0
- package/src/ui/animated-beam.tsx +185 -0
- package/src/ui/animated-list.tsx +71 -0
- package/src/ui/avatar.tsx +53 -0
- package/src/ui/badge.tsx +46 -0
- package/src/ui/bento-grid.tsx +109 -0
- package/src/ui/breadcrumb.tsx +108 -0
- package/src/ui/bubble.tsx +125 -0
- package/src/ui/button-group.tsx +83 -0
- package/src/ui/button.tsx +64 -0
- package/src/ui/calendar.tsx +213 -0
- package/src/ui/card.tsx +92 -0
- package/src/ui/carousel.tsx +240 -0
- package/src/ui/chart.tsx +380 -0
- package/src/ui/checkbox.tsx +31 -0
- package/src/ui/checkpoint.tsx +94 -0
- package/src/ui/code-block.tsx +232 -0
- package/src/ui/collapsible.tsx +33 -0
- package/src/ui/command.tsx +192 -0
- package/src/ui/context-menu.tsx +251 -0
- package/src/ui/dialog.tsx +142 -0
- package/src/ui/drawer.tsx +135 -0
- package/src/ui/dropdown-menu.tsx +256 -0
- package/src/ui/empty.tsx +104 -0
- package/src/ui/field.tsx +248 -0
- package/src/ui/globe.tsx +234 -0
- package/src/ui/hover-card.tsx +44 -0
- package/src/ui/icon.tsx +71 -0
- package/src/ui/input-group.tsx +170 -0
- package/src/ui/input-otp.tsx +77 -0
- package/src/ui/input.tsx +24 -0
- package/src/ui/item.tsx +193 -0
- package/src/ui/kbd.tsx +28 -0
- package/src/ui/label.tsx +24 -0
- package/src/ui/logo.tsx +77 -0
- package/src/ui/map.tsx +2226 -0
- package/src/ui/marker.tsx +69 -0
- package/src/ui/marquee.tsx +74 -0
- package/src/ui/message.tsx +92 -0
- package/src/ui/navigation-menu.tsx +169 -0
- package/src/ui/number-ticker.tsx +90 -0
- package/src/ui/pagination.tsx +122 -0
- package/src/ui/popover.tsx +48 -0
- package/src/ui/progress.tsx +31 -0
- package/src/ui/select.tsx +193 -0
- package/src/ui/separator.tsx +28 -0
- package/src/ui/sheet.tsx +143 -0
- package/src/ui/sidebar.tsx +764 -0
- package/src/ui/skeleton.tsx +13 -0
- package/src/ui/sonner.tsx +71 -0
- package/src/ui/spinner.tsx +15 -0
- package/src/ui/switch.tsx +41 -0
- package/src/ui/table.tsx +116 -0
- package/src/ui/tabs.tsx +66 -0
- package/src/ui/textarea.tsx +20 -0
- package/src/ui/toggle-group.tsx +83 -0
- package/src/ui/toggle.tsx +47 -0
- package/src/ui/tooltip.tsx +61 -0
- package/src/ui/trace.tsx +165 -0
package/src/ui/trace.tsx
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { IconChevronRight } from "@tabler/icons-react"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../lib/utils"
|
|
7
|
+
import {
|
|
8
|
+
Collapsible,
|
|
9
|
+
CollapsibleContent,
|
|
10
|
+
CollapsibleTrigger,
|
|
11
|
+
} from "./collapsible"
|
|
12
|
+
|
|
13
|
+
function Trace({ className, ...props }: React.ComponentProps<"div">) {
|
|
14
|
+
return (
|
|
15
|
+
<div
|
|
16
|
+
data-slot="trace"
|
|
17
|
+
className={cn(
|
|
18
|
+
"flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50",
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
{...props}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function TraceLine({
|
|
27
|
+
className,
|
|
28
|
+
status,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<"span"> & {
|
|
31
|
+
status?: "running" | "error" | "pending"
|
|
32
|
+
}) {
|
|
33
|
+
return (
|
|
34
|
+
<span
|
|
35
|
+
data-slot="trace-line"
|
|
36
|
+
data-status={status}
|
|
37
|
+
className={cn(
|
|
38
|
+
"flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer",
|
|
39
|
+
className
|
|
40
|
+
)}
|
|
41
|
+
{...props}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function TraceIcon({ className, ...props }: React.ComponentProps<"span">) {
|
|
47
|
+
return (
|
|
48
|
+
<span
|
|
49
|
+
data-slot="trace-icon"
|
|
50
|
+
aria-hidden="true"
|
|
51
|
+
className={cn(
|
|
52
|
+
"flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1",
|
|
53
|
+
className
|
|
54
|
+
)}
|
|
55
|
+
{...props}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function TraceTitle({ className, ...props }: React.ComponentProps<"span">) {
|
|
61
|
+
return (
|
|
62
|
+
<span
|
|
63
|
+
data-slot="trace-title"
|
|
64
|
+
className={cn("min-w-0 truncate motion-reduce:shimmer-none", className)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function TraceDescription({
|
|
71
|
+
className,
|
|
72
|
+
...props
|
|
73
|
+
}: React.ComponentProps<"span">) {
|
|
74
|
+
return (
|
|
75
|
+
<span
|
|
76
|
+
data-slot="trace-description"
|
|
77
|
+
className={cn(
|
|
78
|
+
"shrink-0 text-muted-foreground/70 tabular-nums",
|
|
79
|
+
className
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function TraceCollapsible({
|
|
87
|
+
className,
|
|
88
|
+
...props
|
|
89
|
+
}: Omit<React.ComponentProps<typeof Collapsible>, "open"> &
|
|
90
|
+
(
|
|
91
|
+
| { open?: undefined }
|
|
92
|
+
| {
|
|
93
|
+
open: boolean
|
|
94
|
+
onOpenChange: NonNullable<
|
|
95
|
+
React.ComponentProps<typeof Collapsible>["onOpenChange"]
|
|
96
|
+
>
|
|
97
|
+
}
|
|
98
|
+
)) {
|
|
99
|
+
return (
|
|
100
|
+
<Collapsible
|
|
101
|
+
data-slot="trace-collapsible"
|
|
102
|
+
className={cn("flex w-full min-w-0 flex-col", className)}
|
|
103
|
+
{...props}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function TraceCollapsibleTrigger({
|
|
109
|
+
className,
|
|
110
|
+
children,
|
|
111
|
+
...props
|
|
112
|
+
}: React.ComponentProps<typeof CollapsibleTrigger>) {
|
|
113
|
+
return (
|
|
114
|
+
<CollapsibleTrigger
|
|
115
|
+
data-slot="trace-collapsible-trigger"
|
|
116
|
+
className={cn(
|
|
117
|
+
"group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive",
|
|
118
|
+
className
|
|
119
|
+
)}
|
|
120
|
+
{...props}
|
|
121
|
+
>
|
|
122
|
+
{children}
|
|
123
|
+
<TraceIcon className="transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90">
|
|
124
|
+
<IconChevronRight />
|
|
125
|
+
</TraceIcon>
|
|
126
|
+
</CollapsibleTrigger>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function TraceCollapsibleContent({
|
|
131
|
+
className,
|
|
132
|
+
children,
|
|
133
|
+
...props
|
|
134
|
+
}: React.ComponentProps<typeof CollapsibleContent>) {
|
|
135
|
+
return (
|
|
136
|
+
<CollapsibleContent
|
|
137
|
+
data-slot="trace-collapsible-content"
|
|
138
|
+
className="min-w-0 overflow-hidden duration-200 data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
139
|
+
{...props}
|
|
140
|
+
>
|
|
141
|
+
<div
|
|
142
|
+
data-slot="trace-collapsible-content-inner"
|
|
143
|
+
className={cn(
|
|
144
|
+
"mt-2 mb-1 ml-[calc(var(--spacing)*2-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground",
|
|
145
|
+
// CodeBlock define su propio color (docs Trace); no heredar muted.
|
|
146
|
+
"[&_[data-slot=code-block]]:text-foreground [&_[data-slot=code-block][data-variant=destructive]]:text-destructive",
|
|
147
|
+
className
|
|
148
|
+
)}
|
|
149
|
+
>
|
|
150
|
+
{children}
|
|
151
|
+
</div>
|
|
152
|
+
</CollapsibleContent>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export {
|
|
157
|
+
Trace,
|
|
158
|
+
TraceLine,
|
|
159
|
+
TraceIcon,
|
|
160
|
+
TraceTitle,
|
|
161
|
+
TraceDescription,
|
|
162
|
+
TraceCollapsible,
|
|
163
|
+
TraceCollapsibleTrigger,
|
|
164
|
+
TraceCollapsibleContent,
|
|
165
|
+
}
|