@alpic-ai/ui 0.0.0-dev.c660552 → 0.0.0-dev.c6b023d

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 (44) hide show
  1. package/dist/components/avatar.d.mts +1 -1
  2. package/dist/components/badge.d.mts +1 -1
  3. package/dist/components/button.d.mts +3 -1
  4. package/dist/components/button.mjs +20 -6
  5. package/dist/components/form.d.mts +36 -1
  6. package/dist/components/form.mjs +114 -4
  7. package/dist/components/github-button.d.mts +13 -0
  8. package/dist/components/github-button.mjs +24 -0
  9. package/dist/components/page-loader.d.mts +11 -0
  10. package/dist/components/page-loader.mjs +122 -0
  11. package/dist/components/shimmer-text.d.mts +12 -0
  12. package/dist/components/shimmer-text.mjs +22 -0
  13. package/dist/components/sidebar.mjs +61 -17
  14. package/dist/components/spinner.d.mts +2 -2
  15. package/dist/components/table.d.mts +10 -1
  16. package/dist/components/table.mjs +4 -4
  17. package/dist/components/tabs.mjs +4 -4
  18. package/dist/components/task-progress.d.mts +27 -0
  19. package/dist/components/task-progress.mjs +66 -0
  20. package/dist/components/tooltip.mjs +1 -1
  21. package/dist/components/wizard.d.mts +34 -0
  22. package/dist/components/wizard.mjs +46 -0
  23. package/package.json +13 -13
  24. package/src/components/button.tsx +13 -9
  25. package/src/components/combobox.tsx +18 -6
  26. package/src/components/form.tsx +164 -3
  27. package/src/components/github-button.tsx +34 -0
  28. package/src/components/page-loader.tsx +59 -0
  29. package/src/components/shimmer-text.tsx +23 -0
  30. package/src/components/sidebar.tsx +59 -20
  31. package/src/components/table.tsx +17 -4
  32. package/src/components/tabs.tsx +4 -4
  33. package/src/components/task-progress.tsx +107 -0
  34. package/src/components/tooltip.tsx +1 -1
  35. package/src/components/wizard.tsx +69 -0
  36. package/src/hooks/use-copy-to-clipboard.ts +6 -2
  37. package/src/stories/button.stories.tsx +23 -1
  38. package/src/stories/form.stories.tsx +64 -2
  39. package/src/stories/sidebar.stories.tsx +6 -3
  40. package/src/stories/table.stories.tsx +2 -2
  41. package/src/stories/tabs.stories.tsx +4 -2
  42. package/src/stories/task-progress.stories.tsx +81 -0
  43. package/src/stories/wizard.stories.tsx +64 -0
  44. package/src/styles/tokens.css +217 -0
@@ -14,8 +14,10 @@ import {
14
14
  } from "react-hook-form";
15
15
 
16
16
  import { cn } from "../lib/cn";
17
+ import { Checkbox } from "./checkbox";
17
18
  import { Input, type InputProps } from "./input";
18
19
  import { Label } from "./label";
20
+ import { RadioGroup, RadioGroupItem } from "./radio-group";
19
21
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select";
20
22
  import { Textarea, type TextareaProps } from "./textarea";
21
23
  import { Tooltip, TooltipContent, TooltipTrigger } from "./tooltip";
@@ -141,7 +143,7 @@ function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
141
143
  <p
142
144
  data-slot="form-description"
143
145
  id={formDescriptionId}
144
- className={cn("text-muted-foreground text-sm", className)}
146
+ className={cn("text-muted-foreground type-text-sm whitespace-pre-line", className)}
145
147
  {...props}
146
148
  />
147
149
  );
@@ -220,10 +222,10 @@ function InputField<TFieldValues extends FieldValues, TName extends FieldPath<TF
220
222
  {label}
221
223
  </FormLabel>
222
224
  )}
225
+ {description && <FormDescription>{description}</FormDescription>}
223
226
  <FormControl>
224
227
  <Input {...inputProps} {...field} />
225
228
  </FormControl>
226
- {description && <FormDescription>{description}</FormDescription>}
227
229
  <FormMessage />
228
230
  </FormItem>
229
231
  )}
@@ -257,10 +259,10 @@ function TextareaField<TFieldValues extends FieldValues, TName extends FieldPath
257
259
  {label}
258
260
  </FormLabel>
259
261
  )}
262
+ {description && <FormDescription>{description}</FormDescription>}
260
263
  <FormControl>
261
264
  <Textarea {...textareaProps} {...field} />
262
265
  </FormControl>
263
- {description && <FormDescription>{description}</FormDescription>}
264
266
  <FormMessage />
265
267
  </FormItem>
266
268
  )}
@@ -303,6 +305,7 @@ function SelectField<TFieldValues extends FieldValues, TName extends FieldPath<T
303
305
  {label}
304
306
  </FormLabel>
305
307
  )}
308
+ {description && <FormDescription>{description}</FormDescription>}
306
309
  <Select value={field.value} onValueChange={field.onChange}>
307
310
  <FormControl>
308
311
  <SelectTrigger>
@@ -317,7 +320,56 @@ function SelectField<TFieldValues extends FieldValues, TName extends FieldPath<T
317
320
  ))}
318
321
  </SelectContent>
319
322
  </Select>
323
+ <FormMessage />
324
+ </FormItem>
325
+ )}
326
+ />
327
+ );
328
+ }
329
+
330
+ interface RadioFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>
331
+ extends FormFieldBaseProps<TFieldValues, TName> {
332
+ options: SelectFieldOption[];
333
+ }
334
+
335
+ function RadioField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
336
+ control,
337
+ name,
338
+ rules,
339
+ required,
340
+ label,
341
+ description,
342
+ tooltip,
343
+ options,
344
+ }: RadioFieldProps<TFieldValues, TName>) {
345
+ return (
346
+ <FormField
347
+ control={control}
348
+ name={name}
349
+ rules={rules}
350
+ render={({ field }) => (
351
+ <FormItem>
352
+ {label && (
353
+ <FormLabel required={required} tooltip={tooltip}>
354
+ {label}
355
+ </FormLabel>
356
+ )}
320
357
  {description && <FormDescription>{description}</FormDescription>}
358
+ <FormControl>
359
+ <RadioGroup value={field.value ?? ""} onValueChange={field.onChange} onBlur={field.onBlur}>
360
+ {options.map((option) => {
361
+ const itemId = `${field.name}-${option.value}`;
362
+ return (
363
+ <div key={option.value} className="flex items-center gap-2">
364
+ <RadioGroupItem id={itemId} value={option.value} disabled={option.disabled} />
365
+ <Label htmlFor={itemId} className="type-text-sm font-normal">
366
+ {option.label}
367
+ </Label>
368
+ </div>
369
+ );
370
+ })}
371
+ </RadioGroup>
372
+ </FormControl>
321
373
  <FormMessage />
322
374
  </FormItem>
323
375
  )}
@@ -325,8 +377,116 @@ function SelectField<TFieldValues extends FieldValues, TName extends FieldPath<T
325
377
  );
326
378
  }
327
379
 
380
+ interface ChecklistFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>
381
+ extends FormFieldBaseProps<TFieldValues, TName> {
382
+ options: SelectFieldOption[];
383
+ }
384
+
385
+ function ChecklistField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
386
+ control,
387
+ name,
388
+ rules,
389
+ required,
390
+ label,
391
+ description,
392
+ tooltip,
393
+ options,
394
+ }: ChecklistFieldProps<TFieldValues, TName>) {
395
+ return (
396
+ <FormField
397
+ control={control}
398
+ name={name}
399
+ rules={rules}
400
+ render={({ field }) => {
401
+ const selected: string[] = Array.isArray(field.value) ? field.value : [];
402
+ const toggle = (value: string, checked: boolean) => {
403
+ if (checked) {
404
+ field.onChange([...selected, value]);
405
+ } else {
406
+ field.onChange(selected.filter((existing) => existing !== value));
407
+ }
408
+ };
409
+ return (
410
+ <FormItem>
411
+ {label && (
412
+ <FormLabel required={required} tooltip={tooltip}>
413
+ {label}
414
+ </FormLabel>
415
+ )}
416
+ {description && <FormDescription>{description}</FormDescription>}
417
+ <FormControl>
418
+ <fieldset className="m-0 flex flex-col gap-2 border-0 p-0" onBlur={field.onBlur}>
419
+ {options.map((option) => {
420
+ const itemId = `${field.name}-${option.value}`;
421
+ const checked = selected.includes(option.value);
422
+ return (
423
+ <div key={option.value} className="flex items-start gap-2">
424
+ <Checkbox
425
+ id={itemId}
426
+ checked={checked}
427
+ onCheckedChange={(next) => toggle(option.value, Boolean(next))}
428
+ disabled={option.disabled}
429
+ />
430
+ <Label htmlFor={itemId} className="type-text-sm font-normal leading-tight">
431
+ {option.label}
432
+ </Label>
433
+ </div>
434
+ );
435
+ })}
436
+ </fieldset>
437
+ </FormControl>
438
+ <FormMessage />
439
+ </FormItem>
440
+ );
441
+ }}
442
+ />
443
+ );
444
+ }
445
+
446
+ interface CheckboxFieldProps<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>
447
+ extends Omit<FormFieldBaseProps<TFieldValues, TName>, "required"> {}
448
+
449
+ function CheckboxField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues>>({
450
+ control,
451
+ name,
452
+ rules,
453
+ label,
454
+ description,
455
+ tooltip,
456
+ }: CheckboxFieldProps<TFieldValues, TName>) {
457
+ return (
458
+ <FormField
459
+ control={control}
460
+ name={name}
461
+ rules={rules}
462
+ render={({ field }) => (
463
+ <FormItem className="gap-1.5">
464
+ <div className="flex items-start gap-2">
465
+ <FormControl>
466
+ <Checkbox
467
+ checked={field.value ?? false}
468
+ onCheckedChange={(next) => field.onChange(Boolean(next))}
469
+ onBlur={field.onBlur}
470
+ />
471
+ </FormControl>
472
+ {label && (
473
+ <FormLabel tooltip={tooltip} className="font-normal">
474
+ {label}
475
+ </FormLabel>
476
+ )}
477
+ </div>
478
+ {description && <FormDescription className="ml-6">{description}</FormDescription>}
479
+ <FormMessage className="ml-6" />
480
+ </FormItem>
481
+ )}
482
+ />
483
+ );
484
+ }
485
+
328
486
  export type { SelectFieldOption };
329
487
  export {
488
+ CheckboxField,
489
+ ChecklistField,
330
490
  Form,
331
491
  FormControl,
332
492
  FormDescription,
@@ -337,6 +497,7 @@ export {
337
497
  FormLabel,
338
498
  FormMessage,
339
499
  InputField,
500
+ RadioField,
340
501
  SelectField,
341
502
  TextareaField,
342
503
  useFormField,
@@ -0,0 +1,34 @@
1
+ "use client";
2
+
3
+ import type { ComponentProps } from "react";
4
+
5
+ import { cn } from "../lib/cn";
6
+ import { Button } from "./button";
7
+
8
+ const GITHUB_ICON_PATH =
9
+ "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12";
10
+
11
+ function GitHubIcon() {
12
+ return (
13
+ <svg fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
14
+ <path d={GITHUB_ICON_PATH} />
15
+ </svg>
16
+ );
17
+ }
18
+
19
+ type GitHubButtonProps = Omit<ComponentProps<typeof Button>, "variant" | "icon">;
20
+
21
+ function GitHubButton({ className, children, ...props }: GitHubButtonProps) {
22
+ return (
23
+ <Button
24
+ {...props}
25
+ icon={<GitHubIcon />}
26
+ className={cn("bg-foreground text-background [@media(hover:hover)]:hover:bg-foreground/90", className)}
27
+ >
28
+ {children}
29
+ </Button>
30
+ );
31
+ }
32
+
33
+ export type { GitHubButtonProps };
34
+ export { GitHubButton };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+
3
+ import { cn } from "../lib/cn";
4
+
5
+ const CABLE_CAR_SVG = (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ viewBox="0 0 120 130"
9
+ width="240"
10
+ height="260"
11
+ aria-hidden="true"
12
+ className="block h-auto w-full"
13
+ >
14
+ <line x1="60" y1="3" x2="60" y2="58" stroke="#333" strokeWidth="4" />
15
+ <circle cx="60" cy="11" r="10" fill="#555" />
16
+ <rect x="5" y="58" width="110" height="64" rx="4" fill="#e90060" />
17
+ <rect x="5" y="58" width="110" height="20" rx="4" fill="#F5F0E8" />
18
+ <rect x="5" y="68" width="110" height="10" fill="#F5F0E8" />
19
+ <rect x="14" y="66" width="26" height="30" rx="2" fill="#5B8EC9" stroke="#C4B9A8" strokeWidth="1.5" />
20
+ <rect x="47" y="66" width="26" height="30" rx="2" fill="#5B8EC9" stroke="#C4B9A8" strokeWidth="1.5" />
21
+ <rect x="80" y="66" width="26" height="30" rx="2" fill="#5B8EC9" stroke="#C4B9A8" strokeWidth="1.5" />
22
+ <rect x="5" y="115" width="110" height="7" rx="3" fill="#9f0042" />
23
+ </svg>
24
+ );
25
+
26
+ interface PageLoaderProps {
27
+ className?: string;
28
+ }
29
+
30
+ function PageLoader({ className }: PageLoaderProps) {
31
+ return (
32
+ <div
33
+ className={cn("flex min-h-screen items-center justify-center bg-background", className)}
34
+ role="status"
35
+ aria-label="Loading Alpic…"
36
+ >
37
+ <div className="relative h-[120px] w-[200px]">
38
+ <div
39
+ className="absolute top-[30px] left-0 h-[3px] w-full rounded-sm bg-[#6c6c77]"
40
+ style={{ transform: "rotate(-15deg)", transformOrigin: "left center" }}
41
+ />
42
+ <div className="absolute top-[33px] -left-[45px] w-[45px] motion-safe:animate-[alpic-ride_4s_linear_infinite]">
43
+ {CABLE_CAR_SVG}
44
+ </div>
45
+ <div
46
+ className="pointer-events-none absolute -top-[40px] -left-[45px] z-10 h-[200px] w-[95px]"
47
+ style={{ background: "linear-gradient(to right, var(--color-background) 47%, transparent)" }}
48
+ />
49
+ <div
50
+ className="pointer-events-none absolute -top-[40px] left-[142px] z-10 h-[200px] w-[95px]"
51
+ style={{ background: "linear-gradient(to right, transparent, var(--color-background) 53%)" }}
52
+ />
53
+ </div>
54
+ </div>
55
+ );
56
+ }
57
+
58
+ export type { PageLoaderProps };
59
+ export { PageLoader };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+
3
+ import type React from "react";
4
+
5
+ import { cn } from "../lib/cn";
6
+
7
+ const shimmerStyle: React.CSSProperties = {
8
+ background: `linear-gradient(90deg, #0000 calc(50% - 60px), var(--color-foreground), #0000 calc(50% + 60px)), linear-gradient(color-mix(in oklab, var(--color-muted-foreground) 70%, transparent), color-mix(in oklab, var(--color-muted-foreground) 70%, transparent))`,
9
+ backgroundSize: "250% 100%, auto",
10
+ backgroundRepeat: "no-repeat, padding-box",
11
+ WebkitBackgroundClip: "text",
12
+ WebkitTextFillColor: "transparent",
13
+ backgroundClip: "text",
14
+ animation: "shimmer-text 2.5s linear infinite",
15
+ };
16
+
17
+ export function ShimmerText({ children, className }: { children: string | number; className?: string }) {
18
+ return (
19
+ <span className={cn(className)} style={shimmerStyle}>
20
+ {children}
21
+ </span>
22
+ );
23
+ }
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { Slot } from "@radix-ui/react-slot";
4
4
  import { cva, type VariantProps } from "class-variance-authority";
5
- import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
6
5
  import * as React from "react";
7
6
 
8
7
  import { useIsMobile } from "../hooks/use-mobile";
@@ -20,6 +19,19 @@ const SIDEBAR_WIDTH_MOBILE = "16rem";
20
19
  const SIDEBAR_WIDTH_ICON = "3.5rem";
21
20
  const SIDEBAR_KEYBOARD_SHORTCUT = "b";
22
21
 
22
+ const INTERACTIVE_SIDEBAR_ELEMENT_SELECTOR = [
23
+ "a",
24
+ "button",
25
+ "input",
26
+ "select",
27
+ "textarea",
28
+ "[role='button']",
29
+ "[role='link']",
30
+ "[role='menuitem']",
31
+ "[contenteditable='true']",
32
+ "[tabindex]:not([tabindex='-1'])",
33
+ ].join(", ");
34
+
23
35
  type SidebarContextProps = {
24
36
  state: "expanded" | "collapsed";
25
37
  open: boolean;
@@ -143,13 +155,31 @@ function Sidebar({
143
155
  variant?: "sidebar" | "floating" | "inset";
144
156
  collapsible?: "offcanvas" | "icon" | "none";
145
157
  }) {
146
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
158
+ const { isMobile, state, openMobile, setOpenMobile, open, setOpen } = useSidebar();
159
+
160
+ function handleSurfaceClickCapture(event: React.MouseEvent<HTMLDivElement>) {
161
+ const clickedInteractiveElement =
162
+ event.target instanceof Element && event.target.closest(INTERACTIVE_SIDEBAR_ELEMENT_SELECTOR);
163
+
164
+ if (clickedInteractiveElement) {
165
+ return;
166
+ }
167
+
168
+ if (!open) {
169
+ event.preventDefault();
170
+ event.stopPropagation();
171
+ setOpen(true);
172
+ return;
173
+ }
174
+
175
+ setOpen(false);
176
+ }
147
177
 
148
178
  if (collapsible === "none") {
149
179
  return (
150
180
  <div
151
181
  data-slot="sidebar"
152
- className={cn("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className)}
182
+ className={cn("bg-sidebar-surface text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", className)}
153
183
  {...props}
154
184
  >
155
185
  {children}
@@ -164,7 +194,7 @@ function Sidebar({
164
194
  data-sidebar="sidebar"
165
195
  data-slot="sidebar"
166
196
  data-mobile="true"
167
- className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
197
+ className="bg-sidebar-surface text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
168
198
  style={
169
199
  {
170
200
  "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
@@ -213,7 +243,7 @@ function Sidebar({
213
243
  // Adjust the padding for floating and inset variants.
214
244
  variant === "floating" || variant === "inset"
215
245
  ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
216
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
246
+ : "border-sidebar-border group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
217
247
  className,
218
248
  )}
219
249
  {...props}
@@ -221,7 +251,8 @@ function Sidebar({
221
251
  <div
222
252
  data-sidebar="sidebar"
223
253
  data-slot="sidebar-inner"
224
- className="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"
254
+ className="bg-sidebar-surface group-data-[variant=floating]:border-sidebar-border flex h-full w-full cursor-pointer flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"
255
+ onClickCapture={handleSurfaceClickCapture}
225
256
  >
226
257
  {children}
227
258
  </div>
@@ -231,9 +262,7 @@ function Sidebar({
231
262
  }
232
263
 
233
264
  function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
234
- const { state, isMobile, openMobile, toggleSidebar } = useSidebar();
235
-
236
- const isOpen = isMobile ? openMobile : state === "expanded";
265
+ const { toggleSidebar } = useSidebar();
237
266
 
238
267
  return (
239
268
  <Button
@@ -248,12 +277,21 @@ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<t
248
277
  }}
249
278
  {...props}
250
279
  >
251
- {isOpen ? <PanelLeftClose className="size-4.5" /> : <PanelLeftOpen className="size-4.5" />}
280
+ <SidebarToggleIcon className="size-4.5" />
252
281
  <span className="sr-only">Toggle Sidebar</span>
253
282
  </Button>
254
283
  );
255
284
  }
256
285
 
286
+ function SidebarToggleIcon({ className, ...props }: React.ComponentProps<"svg">) {
287
+ return (
288
+ <svg viewBox="0 0 20 20" fill="none" aria-hidden="true" className={className} {...props}>
289
+ <rect x="2.75" y="2.75" width="14.5" height="14.5" rx="4" stroke="currentColor" strokeWidth="1.5" />
290
+ <path d="M10 4.75V15.25" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" />
291
+ </svg>
292
+ );
293
+ }
294
+
257
295
  function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
258
296
  const { toggleSidebar } = useSidebar();
259
297
 
@@ -266,9 +304,7 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
266
304
  onClick={toggleSidebar}
267
305
  title="Toggle Sidebar"
268
306
  className={cn(
269
- "[@media(hover:hover)]:hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
270
- "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
271
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
307
+ "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
272
308
  "[@media(hover:hover)]:hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
273
309
  "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
274
310
  "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
@@ -316,16 +352,19 @@ function SidebarHeader({ className, icon, title, children, ...props }: SidebarHe
316
352
  <div
317
353
  data-slot="sidebar-header"
318
354
  data-sidebar="header"
319
- className={cn("flex flex-col gap-2 p-2", className)}
355
+ className={cn("flex flex-col gap-2 py-2", className)}
320
356
  {...props}
321
357
  >
322
358
  <div className="flex h-8 items-center gap-2 px-3">
323
- <div className="relative shrink-0">
324
- <span className="transition-opacity group-data-[collapsible=icon]:group-hover:opacity-0">{icon}</span>
325
- <div className="absolute inset-0 flex items-center justify-center opacity-0 transition-opacity group-data-[collapsible=icon]:group-hover:opacity-100">
326
- <SidebarTrigger />
327
- </div>
328
- </div>
359
+ <span className="relative flex size-8 shrink-0 items-center justify-center">
360
+ <span className="transition-opacity duration-200 group-data-[collapsible=icon]:group-hover:opacity-0">
361
+ {icon}
362
+ </span>
363
+ <SidebarTrigger
364
+ tabIndex={-1}
365
+ className="absolute inset-0 opacity-0 transition-opacity duration-200 group-data-[collapsible=icon]:group-hover:opacity-100"
366
+ />
367
+ </span>
329
368
  <span className="text-foreground text-md min-w-0 truncate font-medium group-data-[collapsible=icon]:hidden">
330
369
  {title}
331
370
  </span>
@@ -44,7 +44,6 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
44
44
  "border-b border-border-secondary transition-colors",
45
45
  "data-[state=selected]:bg-muted",
46
46
  "[@media(hover:hover)]:hover:bg-background-hover dark:[@media(hover:hover)]:hover:bg-muted",
47
- "[@media(hover:hover)]:[&:hover_button:hover]:bg-subtle",
48
47
  className,
49
48
  )}
50
49
  {...props}
@@ -58,7 +57,7 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
58
57
  data-slot="table-head"
59
58
  className={cn(
60
59
  "h-11 px-6 py-3 bg-muted text-left align-middle type-text-xs font-semibold text-placeholder dark:text-subtle-foreground whitespace-nowrap",
61
- "[&:has([role=checkbox])]:w-px [&:has([role=checkbox])]:pr-3",
60
+ "[&:has([role=checkbox])]:w-px [&:has([role=checkbox])]:px-0",
62
61
  className,
63
62
  )}
64
63
  {...props}
@@ -66,11 +65,25 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
66
65
  );
67
66
  }
68
67
 
69
- function TableCell({ className, ...props }: React.ComponentProps<"td">) {
68
+ interface TableCellProps extends React.ComponentProps<"td"> {
69
+ /**
70
+ * When true, the cell renders edge-to-edge so the child can act as the
71
+ * interactive surface (e.g. a button or popover trigger filling the cell).
72
+ * Defaults to false (standard padded cell).
73
+ */
74
+ interactive?: boolean;
75
+ }
76
+
77
+ function TableCell({ className, interactive = false, ...props }: TableCellProps) {
70
78
  return (
71
79
  <td
72
80
  data-slot="table-cell"
73
- className={cn("px-6 py-2 align-middle", "[&:has([role=checkbox])]:w-px [&:has([role=checkbox])]:pr-3", className)}
81
+ className={cn(
82
+ "align-middle",
83
+ interactive ? "h-px p-0" : "px-6 py-2",
84
+ "[&:has([role=checkbox])]:w-px [&:has([role=checkbox])]:px-0",
85
+ className,
86
+ )}
74
87
  {...props}
75
88
  />
76
89
  );
@@ -44,10 +44,10 @@ const tabsTriggerVariants = cva(
44
44
  "data-[state=active]:border-b-2 data-[state=active]:border-foreground data-[state=active]:text-foreground",
45
45
  ],
46
46
  pill: [
47
- "rounded-lg px-4 py-2",
48
- "text-muted-foreground",
49
- "[@media(hover:hover)]:hover:bg-accent [@media(hover:hover)]:hover:text-accent-foreground",
50
- "data-[state=active]:bg-accent data-[state=active]:text-accent-foreground",
47
+ "rounded-md px-2 py-1.5",
48
+ "text-quaternary-foreground",
49
+ "[@media(hover:hover)]:hover:bg-accent [@media(hover:hover)]:hover:text-muted-foreground",
50
+ "data-[state=active]:bg-accent data-[state=active]:text-muted-foreground",
51
51
  ],
52
52
  },
53
53
  },
@@ -0,0 +1,107 @@
1
+ "use client";
2
+
3
+ /*
4
+ * TaskProgress — multi-step async progress primitive.
5
+ *
6
+ * Dumb component: the consumer owns orchestration (timer, websocket, polling) and
7
+ * passes `steps` with each step's status. Renders a percentage bar at the top
8
+ * and one row per step with done/running/pending state badges.
9
+ *
10
+ * `trailingLabel` is for "still working on something not in the step list" —
11
+ * shows after the last step as a running row that isn't counted in the percent.
12
+ */
13
+
14
+ import { CheckIcon } from "lucide-react";
15
+
16
+ import { cn } from "../lib/cn";
17
+ import { Separator } from "./separator";
18
+
19
+ type TaskProgressStatus = "pending" | "running" | "done";
20
+
21
+ interface TaskProgressStep {
22
+ id: string;
23
+ label: string;
24
+ status: TaskProgressStatus;
25
+ }
26
+
27
+ interface TaskProgressProps extends Omit<React.ComponentProps<"div">, "children"> {
28
+ steps: readonly TaskProgressStep[];
29
+ trailingLabel?: string;
30
+ /**
31
+ * Optional mount-time stagger: each row fades + slides in with `animation-delay = index × stepRevealDelayMs`.
32
+ * Pure CSS, runs once on mount. Omit for no animation.
33
+ */
34
+ stepRevealDelayMs?: number;
35
+ }
36
+
37
+ const REVEAL_CLASSES = "animate-in fade-in slide-in-from-bottom-2 duration-300";
38
+
39
+ function TaskProgress({ steps, trailingLabel, stepRevealDelayMs, className, ...props }: TaskProgressProps) {
40
+ const total = steps.length;
41
+ const doneCount = steps.filter((step) => step.status === "done").length;
42
+ const percent = total > 0 ? Math.round((doneCount / total) * 100) : 0;
43
+ const stagger = stepRevealDelayMs != null;
44
+
45
+ return (
46
+ <div className={cn("flex flex-col gap-4", className)} {...props}>
47
+ <div className="bg-muted h-2 w-full overflow-hidden rounded-full">
48
+ <div className="h-full rounded-full bg-success transition-all duration-500" style={{ width: `${percent}%` }} />
49
+ </div>
50
+ <div>
51
+ {steps.map((step, idx) => (
52
+ <div
53
+ key={step.id}
54
+ className={stagger ? REVEAL_CLASSES : undefined}
55
+ style={
56
+ stagger ? { animationDelay: `${idx * (stepRevealDelayMs ?? 0)}ms`, animationFillMode: "both" } : undefined
57
+ }
58
+ >
59
+ <TaskProgressRow label={step.label} status={step.status} />
60
+ {idx < steps.length - 1 && <Separator />}
61
+ </div>
62
+ ))}
63
+ {trailingLabel && (
64
+ <div className={stagger ? REVEAL_CLASSES : undefined}>
65
+ <Separator />
66
+ <TaskProgressRow label={trailingLabel} status="running" muted />
67
+ </div>
68
+ )}
69
+ </div>
70
+ </div>
71
+ );
72
+ }
73
+
74
+ interface TaskProgressRowProps {
75
+ label: string;
76
+ status: TaskProgressStatus;
77
+ muted?: boolean;
78
+ }
79
+
80
+ function TaskProgressRow({ label, status, muted }: TaskProgressRowProps) {
81
+ return (
82
+ <div className="flex items-center justify-between py-2">
83
+ <span className={cn("type-text-sm", muted && "text-muted-foreground")}>{label}</span>
84
+ {status === "done" && (
85
+ <span className="flex items-center gap-1 type-text-sm text-success">
86
+ <CheckIcon className="size-3.5" />
87
+ <span>done</span>
88
+ </span>
89
+ )}
90
+ {status === "running" && (
91
+ <span className="flex items-center gap-1.5 type-text-sm text-warning">
92
+ <span className="size-2 rounded-full bg-warning" />
93
+ <span>running…</span>
94
+ </span>
95
+ )}
96
+ {status === "pending" && (
97
+ <span className="flex items-center gap-1.5 type-text-sm text-muted-foreground">
98
+ <span className="size-2 rounded-full border border-muted-foreground" />
99
+ <span>pending</span>
100
+ </span>
101
+ )}
102
+ </div>
103
+ );
104
+ }
105
+
106
+ export type { TaskProgressStatus, TaskProgressStep };
107
+ export { TaskProgress };