@stagewise/ui 0.9.0 → 0.10.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/package.json +1 -1
- package/src/components/ui/dialog.tsx +3 -1
- package/src/components/ui/trace.tsx +183 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
|
@@ -46,14 +46,16 @@ function DialogContent({
|
|
|
46
46
|
children,
|
|
47
47
|
showCloseButton = true,
|
|
48
48
|
keepMounted = false,
|
|
49
|
+
overlayClassName,
|
|
49
50
|
...props
|
|
50
51
|
}: DialogPrimitive.Popup.Props & {
|
|
51
52
|
showCloseButton?: boolean;
|
|
52
53
|
keepMounted?: boolean;
|
|
54
|
+
overlayClassName?: string;
|
|
53
55
|
}) {
|
|
54
56
|
return (
|
|
55
57
|
<DialogPortal keepMounted={keepMounted}>
|
|
56
|
-
<DialogOverlay />
|
|
58
|
+
<DialogOverlay className={overlayClassName} />
|
|
57
59
|
<DialogPrimitive.Popup
|
|
58
60
|
data-slot="dialog-content"
|
|
59
61
|
className={cn(
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Spinner } from './spinner';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Collapsible,
|
|
7
|
+
CollapsibleContent,
|
|
8
|
+
CollapsibleTrigger,
|
|
9
|
+
} from './collapsible';
|
|
10
|
+
import { IconChevronRightOutline18 } from '../../icons';
|
|
11
|
+
|
|
12
|
+
function Trace({ className, ...props }: React.ComponentProps<'div'>) {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
data-slot="trace"
|
|
16
|
+
className={cn(
|
|
17
|
+
'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',
|
|
18
|
+
className,
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function TraceLine({
|
|
26
|
+
className,
|
|
27
|
+
status,
|
|
28
|
+
...props
|
|
29
|
+
}: React.ComponentProps<'span'> & {
|
|
30
|
+
status?: 'running' | 'error' | 'pending';
|
|
31
|
+
}) {
|
|
32
|
+
return (
|
|
33
|
+
<span
|
|
34
|
+
data-slot="trace-line"
|
|
35
|
+
data-status={status}
|
|
36
|
+
className={cn(
|
|
37
|
+
'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',
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function TraceIcon({ className, ...props }: React.ComponentProps<'span'>) {
|
|
46
|
+
return (
|
|
47
|
+
<span
|
|
48
|
+
data-slot="trace-icon"
|
|
49
|
+
aria-hidden="true"
|
|
50
|
+
className={cn(
|
|
51
|
+
"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",
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function TraceTitle({ className, ...props }: React.ComponentProps<'span'>) {
|
|
60
|
+
return (
|
|
61
|
+
<span
|
|
62
|
+
data-slot="trace-title"
|
|
63
|
+
className={cn('min-w-0 truncate', className)}
|
|
64
|
+
{...props}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function TraceDescription({
|
|
70
|
+
className,
|
|
71
|
+
...props
|
|
72
|
+
}: React.ComponentProps<'span'>) {
|
|
73
|
+
return (
|
|
74
|
+
<span
|
|
75
|
+
data-slot="trace-description"
|
|
76
|
+
className={cn(
|
|
77
|
+
'shrink-0 text-muted-foreground/70 tabular-nums',
|
|
78
|
+
className,
|
|
79
|
+
)}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function TraceCollapsible({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: Omit<React.ComponentProps<typeof Collapsible>, 'open'> &
|
|
89
|
+
(
|
|
90
|
+
| { open?: undefined }
|
|
91
|
+
| {
|
|
92
|
+
open: boolean;
|
|
93
|
+
onOpenChange: NonNullable<
|
|
94
|
+
React.ComponentProps<typeof Collapsible>['onOpenChange']
|
|
95
|
+
>;
|
|
96
|
+
}
|
|
97
|
+
)) {
|
|
98
|
+
return (
|
|
99
|
+
<Collapsible
|
|
100
|
+
data-slot="trace-collapsible"
|
|
101
|
+
className={cn('flex w-full min-w-0 flex-col', className)}
|
|
102
|
+
{...props}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function TraceCollapsibleTrigger({
|
|
108
|
+
className,
|
|
109
|
+
children,
|
|
110
|
+
loading = false,
|
|
111
|
+
...props
|
|
112
|
+
}: React.ComponentProps<typeof CollapsibleTrigger> & { loading?: boolean }) {
|
|
113
|
+
return (
|
|
114
|
+
<CollapsibleTrigger
|
|
115
|
+
data-slot="trace-collapsible-trigger"
|
|
116
|
+
aria-busy={loading || undefined}
|
|
117
|
+
className={cn(
|
|
118
|
+
'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',
|
|
119
|
+
className,
|
|
120
|
+
)}
|
|
121
|
+
{...props}
|
|
122
|
+
>
|
|
123
|
+
{children}
|
|
124
|
+
<TraceIcon
|
|
125
|
+
aria-hidden={!loading}
|
|
126
|
+
className={cn(
|
|
127
|
+
'size-2.5 transition-transform duration-200 ease-out motion-reduce:transition-none',
|
|
128
|
+
!loading && 'group-aria-expanded/trace-collapsible-trigger:rotate-90',
|
|
129
|
+
)}
|
|
130
|
+
>
|
|
131
|
+
{loading ? (
|
|
132
|
+
<Spinner
|
|
133
|
+
aria-label="Loading details"
|
|
134
|
+
className="size-2.5 motion-reduce:animate-none"
|
|
135
|
+
/>
|
|
136
|
+
) : (
|
|
137
|
+
<IconChevronRightOutline18 className="size-2.5" />
|
|
138
|
+
)}
|
|
139
|
+
</TraceIcon>
|
|
140
|
+
</CollapsibleTrigger>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function TraceCollapsibleContent({
|
|
145
|
+
className,
|
|
146
|
+
panelClassName,
|
|
147
|
+
children,
|
|
148
|
+
...props
|
|
149
|
+
}: React.ComponentProps<typeof CollapsibleContent> & {
|
|
150
|
+
panelClassName?: string;
|
|
151
|
+
}) {
|
|
152
|
+
return (
|
|
153
|
+
<CollapsibleContent
|
|
154
|
+
data-slot="trace-collapsible-content"
|
|
155
|
+
className={cn(
|
|
156
|
+
'h-(--collapsible-panel-height) min-w-0 overflow-hidden transition-[height] duration-200 motion-reduce:transition-none data-ending-style:h-0 data-starting-style:h-0',
|
|
157
|
+
panelClassName,
|
|
158
|
+
)}
|
|
159
|
+
{...props}
|
|
160
|
+
>
|
|
161
|
+
<div
|
|
162
|
+
data-slot="trace-collapsible-content-inner"
|
|
163
|
+
className={cn(
|
|
164
|
+
'mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground',
|
|
165
|
+
className,
|
|
166
|
+
)}
|
|
167
|
+
>
|
|
168
|
+
{children}
|
|
169
|
+
</div>
|
|
170
|
+
</CollapsibleContent>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
Trace,
|
|
176
|
+
TraceLine,
|
|
177
|
+
TraceIcon,
|
|
178
|
+
TraceTitle,
|
|
179
|
+
TraceDescription,
|
|
180
|
+
TraceCollapsible,
|
|
181
|
+
TraceCollapsibleTrigger,
|
|
182
|
+
TraceCollapsibleContent,
|
|
183
|
+
};
|
package/src/index.ts
CHANGED