@rise-x/apps-sdk 0.8.0 → 0.11.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 +209 -21
- package/build/rsbuild/index.d.ts +36 -0
- package/build/rsbuild/index.js +225 -0
- package/build/ui/classes.json +209 -0
- package/build/ui/components/ai.d.ts +33 -1
- package/build/ui/components/app-frame.d.ts +19 -0
- package/build/ui/components/chat-input.d.ts +28 -0
- package/build/ui/components/message-scroller.d.ts +34 -10
- package/build/ui/components/nav.d.ts +2 -1
- package/build/ui/components/sheet.d.ts +10 -0
- package/build/ui/components/thinking-rings.d.ts +4 -0
- package/build/ui/demo.html +26794 -0
- package/build/ui/index.d.ts +3 -0
- package/build/ui/standalone.js +59 -58
- package/build/ui/styles.css +1 -1
- package/package.json +24 -3
- package/rsbuild/package.json +8 -0
- package/template/AGENTS.md +18 -10
- package/template/README.md +5 -5
- package/template/package.json +8 -9
- package/template/rsbuild.config.mts +17 -0
- package/template/src/App.tsx +21 -11
- package/template/tsconfig.json +3 -1
- package/build/ui/reference/README.md +0 -11
- package/build/ui/reference/components/accordion.tsx +0 -85
- package/build/ui/reference/components/ai.tsx +0 -291
- package/build/ui/reference/components/alert-dialog.tsx +0 -213
- package/build/ui/reference/components/alert.tsx +0 -112
- package/build/ui/reference/components/aspect-ratio.tsx +0 -28
- package/build/ui/reference/components/avatar.tsx +0 -158
- package/build/ui/reference/components/badge.tsx +0 -160
- package/build/ui/reference/components/button-group.tsx +0 -77
- package/build/ui/reference/components/button.tsx +0 -107
- package/build/ui/reference/components/calendar.tsx +0 -119
- package/build/ui/reference/components/card.tsx +0 -144
- package/build/ui/reference/components/carousel.tsx +0 -248
- package/build/ui/reference/components/chart.tsx +0 -704
- package/build/ui/reference/components/checkbox.tsx +0 -44
- package/build/ui/reference/components/collapsible.tsx +0 -43
- package/build/ui/reference/components/combobox.tsx +0 -141
- package/build/ui/reference/components/command.tsx +0 -181
- package/build/ui/reference/components/context-menu.tsx +0 -243
- package/build/ui/reference/components/data-table.tsx +0 -650
- package/build/ui/reference/components/date-picker.tsx +0 -218
- package/build/ui/reference/components/dialog.tsx +0 -172
- package/build/ui/reference/components/direction.tsx +0 -22
- package/build/ui/reference/components/dropdown-menu.tsx +0 -245
- package/build/ui/reference/components/empty-state.tsx +0 -63
- package/build/ui/reference/components/field.tsx +0 -252
- package/build/ui/reference/components/file-upload.tsx +0 -116
- package/build/ui/reference/components/hover-card.tsx +0 -64
- package/build/ui/reference/components/input-group.tsx +0 -157
- package/build/ui/reference/components/input-otp.tsx +0 -106
- package/build/ui/reference/components/input.tsx +0 -86
- package/build/ui/reference/components/item.tsx +0 -188
- package/build/ui/reference/components/kbd.tsx +0 -43
- package/build/ui/reference/components/label.tsx +0 -19
- package/build/ui/reference/components/list.tsx +0 -191
- package/build/ui/reference/components/map.css +0 -251
- package/build/ui/reference/components/map.tsx +0 -294
- package/build/ui/reference/components/menubar.tsx +0 -275
- package/build/ui/reference/components/message-scroller.tsx +0 -141
- package/build/ui/reference/components/message.tsx +0 -171
- package/build/ui/reference/components/nav.tsx +0 -122
- package/build/ui/reference/components/navigation-menu.tsx +0 -191
- package/build/ui/reference/components/page-header.tsx +0 -245
- package/build/ui/reference/components/popover.tsx +0 -76
- package/build/ui/reference/components/progress.tsx +0 -31
- package/build/ui/reference/components/radio.tsx +0 -65
- package/build/ui/reference/components/resizable.tsx +0 -40
- package/build/ui/reference/components/scroll-area.tsx +0 -55
- package/build/ui/reference/components/segmented.tsx +0 -45
- package/build/ui/reference/components/select.tsx +0 -188
- package/build/ui/reference/components/separator.tsx +0 -26
- package/build/ui/reference/components/sheet.tsx +0 -184
- package/build/ui/reference/components/skeleton.tsx +0 -15
- package/build/ui/reference/components/slider.tsx +0 -161
- package/build/ui/reference/components/snackbar.tsx +0 -27
- package/build/ui/reference/components/sonner.tsx +0 -43
- package/build/ui/reference/components/spinner.tsx +0 -27
- package/build/ui/reference/components/statistic.tsx +0 -122
- package/build/ui/reference/components/stepper.tsx +0 -138
- package/build/ui/reference/components/switch.tsx +0 -47
- package/build/ui/reference/components/table.tsx +0 -246
- package/build/ui/reference/components/textarea.tsx +0 -28
- package/build/ui/reference/components/timeline.tsx +0 -101
- package/build/ui/reference/components/toggle-group.tsx +0 -86
- package/build/ui/reference/components/toggle.tsx +0 -46
- package/build/ui/reference/components/tooltip.tsx +0 -53
- package/build/ui/reference/index.ts +0 -68
- package/build/ui/reference/lib/utils.ts +0 -34
- package/template/webpack.config.js +0 -112
- package/template/webpack.local.config.js +0 -68
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
5
|
-
|
|
6
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
7
|
-
|
|
8
|
-
/*
|
|
9
|
-
* THE AI LAYER. One rule governs everything here:
|
|
10
|
-
*
|
|
11
|
-
* BERRY MARKS ACTIVITY, NOT AUTHORSHIP.
|
|
12
|
-
*
|
|
13
|
-
* Colour appears while Diana is *doing* something — thinking, inferring,
|
|
14
|
-
* proposing — and the gradient is what carries that. Flat berry marks
|
|
15
|
-
* provenance ("this value came from Diana"). A FINISHED ANSWER GETS NOTHING:
|
|
16
|
-
* no bubble, no tint, no border. AI answers are long, and a tinted block the
|
|
17
|
-
* height of the viewport is a wall, not an accent. The four tiers:
|
|
18
|
-
*
|
|
19
|
-
* gradient pill → working / thinking (AiWorking)
|
|
20
|
-
* gradient sweep → a value being computed (AiShimmer)
|
|
21
|
-
* flat berry → provenance, already settled (AiMark, AiNote, AiRow)
|
|
22
|
-
* no colour → the finished answer itself (MessageBubble variant="ai")
|
|
23
|
-
*
|
|
24
|
-
* Berry is also absent from the chart ramp for the same reason: a colour cannot
|
|
25
|
-
* mean "Diana did this" and "held records" in the same product.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/* ---- provenance ---------------------------------------------------------- */
|
|
29
|
-
|
|
30
|
-
function AiMark({ className, ...props }: React.ComponentProps<'span'>) {
|
|
31
|
-
return (
|
|
32
|
-
<span
|
|
33
|
-
data-slot="ai-mark"
|
|
34
|
-
aria-hidden
|
|
35
|
-
className={cn(
|
|
36
|
-
'inline-grid size-[15px] shrink-0 place-items-center text-ai-text [&_svg]:size-[15px]',
|
|
37
|
-
className,
|
|
38
|
-
)}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Secondary label, e.g. "AI matched". Sits beside the data, never on it. */
|
|
45
|
-
function AiNote({ className, ...props }: React.ComponentProps<'span'>) {
|
|
46
|
-
return (
|
|
47
|
-
<span
|
|
48
|
-
data-slot="ai-note"
|
|
49
|
-
className={cn(
|
|
50
|
-
'inline-flex items-center gap-1.5 text-micro text-ai-text [&>svg]:size-3',
|
|
51
|
-
className,
|
|
52
|
-
)}
|
|
53
|
-
{...props}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Wash for a row or card Diana touched. 2.5% — enough to group the row once the
|
|
60
|
-
* glyph and label are present, and deliberately not enough to compete with the
|
|
61
|
-
* data. No edge stripe: an edge reads as something stuck on the row.
|
|
62
|
-
*/
|
|
63
|
-
function AiRow({ className, ...props }: React.ComponentProps<'div'>) {
|
|
64
|
-
return <div data-slot="ai-row" className={cn('bg-ai-wash', className)} {...props} />;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/* ---- activity ------------------------------------------------------------ */
|
|
68
|
-
|
|
69
|
-
/** Diana is working. The gradient is the signal; it stops when the work does. */
|
|
70
|
-
function AiWorking({ className, children, ...props }: React.ComponentProps<'span'>) {
|
|
71
|
-
return (
|
|
72
|
-
<span
|
|
73
|
-
data-slot="ai-working"
|
|
74
|
-
className={cn(
|
|
75
|
-
'inline-flex items-center gap-1 rounded-full bg-ai/9 px-[11px] py-2 text-ui text-ai-text',
|
|
76
|
-
className,
|
|
77
|
-
)}
|
|
78
|
-
{...props}
|
|
79
|
-
>
|
|
80
|
-
<span aria-hidden className="flex gap-1">
|
|
81
|
-
{[0, 1, 2].map((i) => (
|
|
82
|
-
<i
|
|
83
|
-
key={i}
|
|
84
|
-
className="size-[5px] rounded-full bg-[image:var(--ai-grad)] motion-safe:animate-[aiBlip_1.1s_ease-in-out_infinite]"
|
|
85
|
-
style={{ animationDelay: `${i * 0.15}s` }}
|
|
86
|
-
/>
|
|
87
|
-
))}
|
|
88
|
-
</span>
|
|
89
|
-
{children}
|
|
90
|
-
</span>
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* A value being computed. Replaces the text entirely — a half-rendered number
|
|
96
|
-
* is worse than no number — and stops the moment there is a value.
|
|
97
|
-
* `prefers-reduced-motion` freezes the sweep rather than looping it.
|
|
98
|
-
*/
|
|
99
|
-
function AiShimmer({ className, children, ...props }: React.ComponentProps<'span'>) {
|
|
100
|
-
return (
|
|
101
|
-
<span
|
|
102
|
-
data-slot="ai-shimmer"
|
|
103
|
-
aria-busy
|
|
104
|
-
className={cn(
|
|
105
|
-
'relative inline-block overflow-hidden rounded-sm bg-fill-1 text-transparent!',
|
|
106
|
-
'after:absolute after:inset-0 after:bg-[linear-gradient(90deg,transparent_0%,color-mix(in_srgb,var(--berry)_26%,transparent)_42%,color-mix(in_srgb,var(--blue)_22%,transparent)_62%,transparent_100%)] after:motion-safe:animate-[aiSweep_1.5s_var(--ease)_infinite]',
|
|
107
|
-
className,
|
|
108
|
-
)}
|
|
109
|
-
{...props}
|
|
110
|
-
>
|
|
111
|
-
{children}
|
|
112
|
-
</span>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/* ---- confidence --------------------------------------------------------- */
|
|
117
|
-
|
|
118
|
-
const confidenceVariants = cva(
|
|
119
|
-
'inline-flex h-5 items-center gap-1.5 rounded-sm border border-transparent px-[7px] text-micro font-medium',
|
|
120
|
-
{
|
|
121
|
-
variants: {
|
|
122
|
-
level: {
|
|
123
|
-
high: 'bg-success/13 text-success-text',
|
|
124
|
-
medium: 'bg-warning/15 text-warning-text',
|
|
125
|
-
low: 'bg-error/12 text-error-text',
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
defaultVariants: { level: 'high' },
|
|
129
|
-
},
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
const SEGMENTS = { high: 3, medium: 2, low: 1 } as const;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* A THREE-SEGMENT METER plus the number, in a tinted pill — signal-bars, not a
|
|
136
|
-
* continuous progress bar. Two reasons: the segments are legible at a glance
|
|
137
|
-
* from across a table where a 52px bar is not, and a continuous bar invites
|
|
138
|
-
* comparison of 73% against 71% when the underlying score does not support that
|
|
139
|
-
* precision.
|
|
140
|
-
*
|
|
141
|
-
* Whenever there IS a figure the word ships with it, because "Medium" alone
|
|
142
|
-
* tells a reviewer nothing actionable. But a run may report only a level — no
|
|
143
|
-
* percentage is invented to fill the gap: omit `value` and the label reads
|
|
144
|
-
* "Medium confidence", segments unchanged.
|
|
145
|
-
*/
|
|
146
|
-
function AiConfidence({
|
|
147
|
-
className,
|
|
148
|
-
level = 'high',
|
|
149
|
-
value,
|
|
150
|
-
showLabel = true,
|
|
151
|
-
...props
|
|
152
|
-
}: React.ComponentProps<'span'> &
|
|
153
|
-
VariantProps<typeof confidenceVariants> & { value?: number; showLabel?: boolean }) {
|
|
154
|
-
const lit = SEGMENTS[level ?? 'high'];
|
|
155
|
-
const word = level === 'high' ? 'High' : level === 'medium' ? 'Medium' : 'Low';
|
|
156
|
-
return (
|
|
157
|
-
<span
|
|
158
|
-
data-slot="ai-confidence"
|
|
159
|
-
data-level={level}
|
|
160
|
-
className={cn(confidenceVariants({ level }), className)}
|
|
161
|
-
{...props}
|
|
162
|
-
>
|
|
163
|
-
<span aria-hidden className="inline-flex gap-[2px]">
|
|
164
|
-
{[0, 1, 2].map((i) => (
|
|
165
|
-
<b
|
|
166
|
-
key={i}
|
|
167
|
-
className={cn(
|
|
168
|
-
'h-[9px] w-[3px] rounded-[1.5px] bg-current',
|
|
169
|
-
i < lit ? 'opacity-100' : 'opacity-[0.22]',
|
|
170
|
-
)}
|
|
171
|
-
/>
|
|
172
|
-
))}
|
|
173
|
-
</span>
|
|
174
|
-
<span className="tabular-nums">
|
|
175
|
-
{/* No figure → the word carries the whole label, so `showLabel` has
|
|
176
|
-
* nothing left to hide. */}
|
|
177
|
-
{value === undefined ? `${word} confidence` : `${showLabel ? `${word} · ` : ''}${value}%`}
|
|
178
|
-
</span>
|
|
179
|
-
</span>
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/* ---- validation result -------------------------------------------------- */
|
|
184
|
-
|
|
185
|
-
const validationVariants = cva(
|
|
186
|
-
'grid size-4 shrink-0 place-items-center rounded-sm [&_svg]:size-[11px]',
|
|
187
|
-
{
|
|
188
|
-
variants: {
|
|
189
|
-
result: {
|
|
190
|
-
passed: 'bg-success/13 text-success-text',
|
|
191
|
-
warning: 'bg-warning/16 text-warning-text',
|
|
192
|
-
failed: 'bg-error/14 text-error-text',
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
defaultVariants: { result: 'passed' },
|
|
196
|
-
},
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
/* A small tinted glyph, not a coloured badge — three stacked badges turn a
|
|
200
|
-
* detail region into confetti. */
|
|
201
|
-
function AiValidation({
|
|
202
|
-
className,
|
|
203
|
-
result = 'passed',
|
|
204
|
-
...props
|
|
205
|
-
}: React.ComponentProps<'span'> & VariantProps<typeof validationVariants>) {
|
|
206
|
-
return (
|
|
207
|
-
<span
|
|
208
|
-
data-slot="ai-validation"
|
|
209
|
-
data-result={result}
|
|
210
|
-
className={cn(validationVariants({ result }), className)}
|
|
211
|
-
{...props}
|
|
212
|
-
/>
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/* ---- suggested action --------------------------------------------------- */
|
|
217
|
-
|
|
218
|
-
function AiSuggestion({ className, ...props }: React.ComponentProps<'div'>) {
|
|
219
|
-
return (
|
|
220
|
-
<div
|
|
221
|
-
data-slot="ai-suggestion"
|
|
222
|
-
className={cn(
|
|
223
|
-
// Diana is proposing — activity, so the gradient edge is allowed
|
|
224
|
-
'flex items-start gap-2.5 rounded-lg border border-ai-edge bg-ai-tint p-3 text-xs [&>svg]:mt-px [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-ai-text',
|
|
225
|
-
className,
|
|
226
|
-
)}
|
|
227
|
-
{...props}
|
|
228
|
-
/>
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/* ---- explain affordance ------------------------------------------------- */
|
|
233
|
-
|
|
234
|
-
/** Reasoning stays collapsed by default: an explanation nobody asked for is
|
|
235
|
-
* noise, and one nobody can find is a black box. */
|
|
236
|
-
function AiExplain({ className, ...props }: React.ComponentProps<'details'>) {
|
|
237
|
-
return (
|
|
238
|
-
<details data-slot="ai-explain" className={cn('group/explain text-xs', className)} {...props} />
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function AiExplainSummary({ className, children, ...props }: React.ComponentProps<'summary'>) {
|
|
243
|
-
return (
|
|
244
|
-
<summary
|
|
245
|
-
data-slot="ai-explain-summary"
|
|
246
|
-
className={cn(
|
|
247
|
-
'flex cursor-pointer list-none items-center gap-1.5 rounded-md py-1 text-micro text-muted-foreground transition-colors marker:content-none hover:text-foreground [&::-webkit-details-marker]:hidden',
|
|
248
|
-
className,
|
|
249
|
-
)}
|
|
250
|
-
{...props}
|
|
251
|
-
>
|
|
252
|
-
{children}
|
|
253
|
-
<svg
|
|
254
|
-
aria-hidden
|
|
255
|
-
viewBox="0 0 24 24"
|
|
256
|
-
fill="none"
|
|
257
|
-
stroke="currentColor"
|
|
258
|
-
strokeWidth={2.5}
|
|
259
|
-
className="size-3 transition-transform duration-150 ease-decelerate group-open/explain:rotate-90"
|
|
260
|
-
>
|
|
261
|
-
<path d="M9 6l6 6-6 6" strokeLinecap="round" />
|
|
262
|
-
</svg>
|
|
263
|
-
</summary>
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function AiExplainBody({ className, ...props }: React.ComponentProps<'div'>) {
|
|
268
|
-
return (
|
|
269
|
-
<div
|
|
270
|
-
data-slot="ai-explain-body"
|
|
271
|
-
className={cn('mt-1.5 flex flex-col gap-1.5 text-xs text-muted-foreground', className)}
|
|
272
|
-
{...props}
|
|
273
|
-
/>
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export {
|
|
278
|
-
AiMark,
|
|
279
|
-
AiNote,
|
|
280
|
-
AiRow,
|
|
281
|
-
AiWorking,
|
|
282
|
-
AiShimmer,
|
|
283
|
-
AiConfidence,
|
|
284
|
-
AiValidation,
|
|
285
|
-
AiSuggestion,
|
|
286
|
-
AiExplain,
|
|
287
|
-
AiExplainSummary,
|
|
288
|
-
AiExplainBody,
|
|
289
|
-
confidenceVariants,
|
|
290
|
-
validationVariants,
|
|
291
|
-
};
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { AlertDialog as AlertDialogPrimitive } from 'radix-ui';
|
|
5
|
-
|
|
6
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
7
|
-
import { Button } from '@rise-x/ui/components/button';
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* forwardRef throughout, for the same reason button.tsx uses it (see the comment
|
|
11
|
-
* there): the classic React 18 host renders these components too, and React 18
|
|
12
|
-
* strips `ref` from a plain function component instead of passing it as a prop.
|
|
13
|
-
*
|
|
14
|
-
* This is not only about refs a caller passes. Radix refs the overlay ITSELF:
|
|
15
|
-
* AlertDialogContent puts <AlertDialogOverlay /> inside the portal, and radix's
|
|
16
|
-
* Portal wraps each child in Presence + `Primitive.div asChild`, whose Slot
|
|
17
|
-
* hands the child a composed ref. Under React 18 a plain-function overlay drops
|
|
18
|
-
* it, so Presence never sees the overlay node and closes it without its
|
|
19
|
-
* exit animation — plus a "Function components cannot be given refs" warning on
|
|
20
|
-
* every open. Only AlertDialog (Root) and AlertDialogPortal are left as plain
|
|
21
|
-
* functions: neither renders a DOM node, and radix's own are plain too.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
|
|
25
|
-
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const AlertDialogTrigger = React.forwardRef<
|
|
29
|
-
HTMLButtonElement,
|
|
30
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Trigger>
|
|
31
|
-
>(function AlertDialogTrigger({ ...props }, ref) {
|
|
32
|
-
return <AlertDialogPrimitive.Trigger ref={ref} data-slot="alert-dialog-trigger" {...props} />;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
|
|
36
|
-
return <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const AlertDialogOverlay = React.forwardRef<
|
|
40
|
-
HTMLDivElement,
|
|
41
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
42
|
-
>(function AlertDialogOverlay({ className, ...props }, ref) {
|
|
43
|
-
return (
|
|
44
|
-
<AlertDialogPrimitive.Overlay
|
|
45
|
-
ref={ref}
|
|
46
|
-
data-slot="alert-dialog-overlay"
|
|
47
|
-
className={cn(
|
|
48
|
-
'fixed inset-0 z-50 bg-black/30 duration-100 supports-backdrop-filter:backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
|
|
49
|
-
className,
|
|
50
|
-
)}
|
|
51
|
-
{...props}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const AlertDialogContent = React.forwardRef<
|
|
57
|
-
HTMLDivElement,
|
|
58
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content> & {
|
|
59
|
-
size?: 'default' | 'sm';
|
|
60
|
-
}
|
|
61
|
-
>(function AlertDialogContent({ className, size = 'default', ...props }, ref) {
|
|
62
|
-
return (
|
|
63
|
-
<AlertDialogPortal>
|
|
64
|
-
<AlertDialogOverlay />
|
|
65
|
-
<AlertDialogPrimitive.Content
|
|
66
|
-
ref={ref}
|
|
67
|
-
data-slot="alert-dialog-content"
|
|
68
|
-
data-size={size}
|
|
69
|
-
className={cn(
|
|
70
|
-
'group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-2xl bg-popover p-6 text-popover-foreground shadow-pop duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',
|
|
71
|
-
/* min() folds dialog.tsx's viewport-gutter clamp into the size cap —
|
|
72
|
-
* a separate bare max-w-* would lose to these data-variants on
|
|
73
|
-
* specificity, and without it the xs cap sits flush against the
|
|
74
|
-
* screen edge on viewports at or under 320px. */
|
|
75
|
-
'data-[size=default]:max-w-[min(var(--container-xs),calc(100%-(var(--spacing)*8)))] data-[size=sm]:max-w-[min(var(--container-xs),calc(100%-(var(--spacing)*8)))] data-[size=default]:sm:max-w-md',
|
|
76
|
-
className,
|
|
77
|
-
)}
|
|
78
|
-
{...props}
|
|
79
|
-
/>
|
|
80
|
-
</AlertDialogPortal>
|
|
81
|
-
);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const AlertDialogHeader = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
|
|
85
|
-
function AlertDialogHeader({ className, ...props }, ref) {
|
|
86
|
-
return (
|
|
87
|
-
<div
|
|
88
|
-
ref={ref}
|
|
89
|
-
data-slot="alert-dialog-header"
|
|
90
|
-
className={cn(
|
|
91
|
-
'grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]',
|
|
92
|
-
className,
|
|
93
|
-
)}
|
|
94
|
-
{...props}
|
|
95
|
-
/>
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const AlertDialogFooter = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
|
|
101
|
-
function AlertDialogFooter({ className, ...props }, ref) {
|
|
102
|
-
return (
|
|
103
|
-
<div
|
|
104
|
-
ref={ref}
|
|
105
|
-
data-slot="alert-dialog-footer"
|
|
106
|
-
className={cn(
|
|
107
|
-
'flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',
|
|
108
|
-
className,
|
|
109
|
-
)}
|
|
110
|
-
{...props}
|
|
111
|
-
/>
|
|
112
|
-
);
|
|
113
|
-
},
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
const AlertDialogMedia = React.forwardRef<HTMLDivElement, React.ComponentPropsWithoutRef<'div'>>(
|
|
117
|
-
function AlertDialogMedia({ className, ...props }, ref) {
|
|
118
|
-
return (
|
|
119
|
-
<div
|
|
120
|
-
ref={ref}
|
|
121
|
-
data-slot="alert-dialog-media"
|
|
122
|
-
className={cn(
|
|
123
|
-
"mb-2 inline-flex size-16 items-center justify-center rounded-full bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-8",
|
|
124
|
-
className,
|
|
125
|
-
)}
|
|
126
|
-
{...props}
|
|
127
|
-
/>
|
|
128
|
-
);
|
|
129
|
-
},
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
const AlertDialogTitle = React.forwardRef<
|
|
133
|
-
HTMLHeadingElement,
|
|
134
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
135
|
-
>(function AlertDialogTitle({ className, ...props }, ref) {
|
|
136
|
-
return (
|
|
137
|
-
<AlertDialogPrimitive.Title
|
|
138
|
-
ref={ref}
|
|
139
|
-
data-slot="alert-dialog-title"
|
|
140
|
-
className={cn(
|
|
141
|
-
'font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2',
|
|
142
|
-
className,
|
|
143
|
-
)}
|
|
144
|
-
{...props}
|
|
145
|
-
/>
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
const AlertDialogDescription = React.forwardRef<
|
|
150
|
-
HTMLParagraphElement,
|
|
151
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
152
|
-
>(function AlertDialogDescription({ className, ...props }, ref) {
|
|
153
|
-
return (
|
|
154
|
-
<AlertDialogPrimitive.Description
|
|
155
|
-
ref={ref}
|
|
156
|
-
data-slot="alert-dialog-description"
|
|
157
|
-
className={cn(
|
|
158
|
-
'text-ui text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
|
|
159
|
-
className,
|
|
160
|
-
)}
|
|
161
|
-
{...props}
|
|
162
|
-
/>
|
|
163
|
-
);
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
const AlertDialogAction = React.forwardRef<
|
|
167
|
-
HTMLButtonElement,
|
|
168
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action> &
|
|
169
|
-
Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>
|
|
170
|
-
>(function AlertDialogAction({ className, variant = 'default', size = 'default', ...props }, ref) {
|
|
171
|
-
return (
|
|
172
|
-
<Button variant={variant} size={size} asChild>
|
|
173
|
-
<AlertDialogPrimitive.Action
|
|
174
|
-
ref={ref}
|
|
175
|
-
data-slot="alert-dialog-action"
|
|
176
|
-
className={cn(className)}
|
|
177
|
-
{...props}
|
|
178
|
-
/>
|
|
179
|
-
</Button>
|
|
180
|
-
);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
const AlertDialogCancel = React.forwardRef<
|
|
184
|
-
HTMLButtonElement,
|
|
185
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel> &
|
|
186
|
-
Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>
|
|
187
|
-
>(function AlertDialogCancel({ className, variant = 'outline', size = 'default', ...props }, ref) {
|
|
188
|
-
return (
|
|
189
|
-
<Button variant={variant} size={size} asChild>
|
|
190
|
-
<AlertDialogPrimitive.Cancel
|
|
191
|
-
ref={ref}
|
|
192
|
-
data-slot="alert-dialog-cancel"
|
|
193
|
-
className={cn(className)}
|
|
194
|
-
{...props}
|
|
195
|
-
/>
|
|
196
|
-
</Button>
|
|
197
|
-
);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
export {
|
|
201
|
-
AlertDialog,
|
|
202
|
-
AlertDialogAction,
|
|
203
|
-
AlertDialogCancel,
|
|
204
|
-
AlertDialogContent,
|
|
205
|
-
AlertDialogDescription,
|
|
206
|
-
AlertDialogFooter,
|
|
207
|
-
AlertDialogHeader,
|
|
208
|
-
AlertDialogMedia,
|
|
209
|
-
AlertDialogOverlay,
|
|
210
|
-
AlertDialogPortal,
|
|
211
|
-
AlertDialogTitle,
|
|
212
|
-
AlertDialogTrigger,
|
|
213
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Alert (in-flow, bordered) and Banner (full-width, tinted). Both put tone in
|
|
8
|
-
* the ICON and the text, not in a coloured left edge — an edge stripe reads as
|
|
9
|
-
* something stuck on, a glyph reads as part of the message.
|
|
10
|
-
*/
|
|
11
|
-
const alertVariants = cva(
|
|
12
|
-
'flex gap-[9px] rounded-lg border px-3 py-2.5 text-xs [&>svg]:mt-px [&>svg]:size-3.5 [&>svg]:shrink-0',
|
|
13
|
-
{
|
|
14
|
-
variants: {
|
|
15
|
-
tone: {
|
|
16
|
-
neutral: 'border-border bg-card [&>svg]:text-muted-foreground',
|
|
17
|
-
success: 'border-success/25 bg-success/8 [&>svg]:text-success-text',
|
|
18
|
-
warning: 'border-warning/30 bg-warning/10 [&>svg]:text-warning-text',
|
|
19
|
-
error: 'border-error/25 bg-error/8 [&>svg]:text-error-text',
|
|
20
|
-
info: 'border-info/25 bg-info/8 [&>svg]:text-info-text',
|
|
21
|
-
ai: 'border-ai-edge bg-ai-tint [&>svg]:text-ai-text',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
defaultVariants: { tone: 'neutral' },
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
function Alert({
|
|
29
|
-
className,
|
|
30
|
-
tone = 'neutral',
|
|
31
|
-
...props
|
|
32
|
-
}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
|
|
33
|
-
return (
|
|
34
|
-
<div
|
|
35
|
-
data-slot="alert"
|
|
36
|
-
role="status"
|
|
37
|
-
className={cn(alertVariants({ tone }), className)}
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
data-slot="alert-title"
|
|
47
|
-
className={cn('mb-px text-ui font-medium', className)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
54
|
-
return (
|
|
55
|
-
<div
|
|
56
|
-
data-slot="alert-description"
|
|
57
|
-
className={cn('text-xs text-muted-foreground', className)}
|
|
58
|
-
{...props}
|
|
59
|
-
/>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function Banner({
|
|
64
|
-
className,
|
|
65
|
-
tone = 'neutral',
|
|
66
|
-
...props
|
|
67
|
-
}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
|
|
68
|
-
return (
|
|
69
|
-
<div
|
|
70
|
-
data-slot="banner"
|
|
71
|
-
role="status"
|
|
72
|
-
className={cn(
|
|
73
|
-
alertVariants({ tone }),
|
|
74
|
-
'items-center px-3.5 py-2.5 [&>svg]:mt-0 [&>[data-slot=button]]:ml-auto',
|
|
75
|
-
className,
|
|
76
|
-
)}
|
|
77
|
-
{...props}
|
|
78
|
-
/>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* Inline message: the smallest form — a 12px glyph and a line of text, for
|
|
83
|
-
* where even a bordered alert is too much furniture (under a field, in a cell). */
|
|
84
|
-
const inlineVariants = cva('inline-flex items-center gap-1.5 text-micro [&>svg]:size-3', {
|
|
85
|
-
variants: {
|
|
86
|
-
tone: {
|
|
87
|
-
neutral: 'text-muted-foreground',
|
|
88
|
-
success: 'text-success-text',
|
|
89
|
-
warning: 'text-warning-text',
|
|
90
|
-
error: 'text-error-text',
|
|
91
|
-
info: 'text-info-text',
|
|
92
|
-
ai: 'text-ai-text',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
defaultVariants: { tone: 'neutral' },
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
function InlineMessage({
|
|
99
|
-
className,
|
|
100
|
-
tone = 'neutral',
|
|
101
|
-
...props
|
|
102
|
-
}: React.ComponentProps<'span'> & VariantProps<typeof inlineVariants>) {
|
|
103
|
-
return (
|
|
104
|
-
<span
|
|
105
|
-
data-slot="inline-message"
|
|
106
|
-
className={cn(inlineVariants({ tone }), className)}
|
|
107
|
-
{...props}
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export { Alert, AlertTitle, AlertDescription, Banner, InlineMessage, alertVariants };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { AspectRatio as AspectRatioPrimitive } from 'radix-ui';
|
|
3
|
-
|
|
4
|
-
import { cn } from '@rise-x/ui/lib/utils';
|
|
5
|
-
|
|
6
|
-
/*
|
|
7
|
-
* Holds a box at a fixed ratio so media cannot shift the layout while it loads.
|
|
8
|
-
* Deliberately carries no surface, radius or border of its own — the caller
|
|
9
|
-
* decides whether the thing inside is a thumbnail (10px) or a card (14px), and a
|
|
10
|
-
* radius here would clip at the wrong step.
|
|
11
|
-
*
|
|
12
|
-
* Use `MediaThumb` instead for a fixed-size square in a gallery; this is for the
|
|
13
|
-
* responsive case where the width is unknown and only the ratio is fixed.
|
|
14
|
-
*/
|
|
15
|
-
function AspectRatio({
|
|
16
|
-
className,
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
|
|
19
|
-
return (
|
|
20
|
-
<AspectRatioPrimitive.Root
|
|
21
|
-
data-slot="aspect-ratio"
|
|
22
|
-
className={cn('[&>img]:size-full [&>img]:object-cover [&>video]:size-full', className)}
|
|
23
|
-
{...props}
|
|
24
|
-
/>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { AspectRatio };
|