@openconsole/shadcn 0.2.5 → 0.2.7

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 (113) hide show
  1. package/components/index.ts +1 -2
  2. package/components/ui/accordion.tsx +66 -66
  3. package/components/ui/alert-dialog.tsx +196 -196
  4. package/components/ui/alert.tsx +66 -66
  5. package/components/ui/aspect-ratio.tsx +11 -11
  6. package/components/ui/avatar.tsx +53 -53
  7. package/components/ui/badge.tsx +46 -46
  8. package/components/ui/breadcrumb.tsx +109 -109
  9. package/components/ui/button-group.tsx +83 -83
  10. package/components/ui/button.tsx +60 -60
  11. package/components/ui/calendar.tsx +219 -219
  12. package/components/ui/card.tsx +92 -92
  13. package/components/ui/carousel.tsx +241 -241
  14. package/components/ui/chart.tsx +374 -374
  15. package/components/ui/checkbox.tsx +32 -32
  16. package/components/ui/collapsible.tsx +33 -33
  17. package/components/ui/command.tsx +184 -184
  18. package/components/ui/context-menu.tsx +252 -252
  19. package/components/ui/dialog.tsx +143 -143
  20. package/components/ui/direction.tsx +22 -22
  21. package/components/ui/drawer.tsx +135 -135
  22. package/components/ui/dropdown-menu.tsx +257 -257
  23. package/components/ui/empty.tsx +104 -104
  24. package/components/ui/field.tsx +248 -248
  25. package/components/ui/form.tsx +167 -167
  26. package/components/ui/hover-card.tsx +44 -44
  27. package/components/ui/index.ts +59 -59
  28. package/components/ui/input-group.tsx +170 -170
  29. package/components/ui/input-otp.tsx +77 -77
  30. package/components/ui/input.tsx +21 -21
  31. package/components/ui/item.tsx +193 -193
  32. package/components/ui/kbd.tsx +28 -28
  33. package/components/ui/label.tsx +24 -24
  34. package/components/ui/menubar.tsx +276 -276
  35. package/components/ui/native-select.tsx +62 -62
  36. package/components/ui/navigation-menu.tsx +168 -168
  37. package/components/ui/pagination.tsx +127 -127
  38. package/components/ui/popover.tsx +89 -89
  39. package/components/ui/progress.tsx +31 -31
  40. package/components/ui/radio-group.tsx +45 -45
  41. package/components/ui/resizable.tsx +53 -53
  42. package/components/ui/scroll-area.tsx +58 -58
  43. package/components/ui/select.tsx +187 -187
  44. package/components/ui/separator.tsx +28 -28
  45. package/components/ui/sheet.tsx +139 -139
  46. package/components/ui/sidebar.tsx +724 -724
  47. package/components/ui/skeleton.tsx +13 -13
  48. package/components/ui/slider.tsx +63 -63
  49. package/components/ui/sonner.tsx +40 -40
  50. package/components/ui/spinner.tsx +16 -16
  51. package/components/ui/switch.tsx +35 -35
  52. package/components/ui/table.tsx +116 -116
  53. package/components/ui/tabs.tsx +66 -66
  54. package/components/ui/textarea.tsx +18 -18
  55. package/components/ui/toggle-group.tsx +83 -83
  56. package/components/ui/toggle.tsx +47 -47
  57. package/components/ui/tooltip.tsx +61 -61
  58. package/hooks/index.ts +1 -1
  59. package/hooks/use-mobile.ts +19 -19
  60. package/index.ts +3 -3
  61. package/lib/index.ts +1 -1
  62. package/lib/utils.ts +6 -6
  63. package/package.json +1 -1
  64. package/styles.css +124 -124
  65. package/components/ai-elements/agent.tsx +0 -141
  66. package/components/ai-elements/artifact.tsx +0 -148
  67. package/components/ai-elements/attachments.tsx +0 -426
  68. package/components/ai-elements/audio-player.tsx +0 -231
  69. package/components/ai-elements/canvas.tsx +0 -26
  70. package/components/ai-elements/chain-of-thought.tsx +0 -222
  71. package/components/ai-elements/checkpoint.tsx +0 -71
  72. package/components/ai-elements/code-block.tsx +0 -562
  73. package/components/ai-elements/commit.tsx +0 -458
  74. package/components/ai-elements/confirmation.tsx +0 -174
  75. package/components/ai-elements/connection.tsx +0 -28
  76. package/components/ai-elements/context.tsx +0 -409
  77. package/components/ai-elements/controls.tsx +0 -18
  78. package/components/ai-elements/conversation.tsx +0 -168
  79. package/components/ai-elements/edge.tsx +0 -143
  80. package/components/ai-elements/environment-variables.tsx +0 -324
  81. package/components/ai-elements/file-tree.tsx +0 -304
  82. package/components/ai-elements/image.tsx +0 -24
  83. package/components/ai-elements/index.ts +0 -51
  84. package/components/ai-elements/inline-citation.tsx +0 -296
  85. package/components/ai-elements/jsx-preview.tsx +0 -310
  86. package/components/ai-elements/message.tsx +0 -360
  87. package/components/ai-elements/mic-selector.tsx +0 -375
  88. package/components/ai-elements/model-selector.tsx +0 -213
  89. package/components/ai-elements/node.tsx +0 -71
  90. package/components/ai-elements/open-in-chat.tsx +0 -370
  91. package/components/ai-elements/package-info.tsx +0 -239
  92. package/components/ai-elements/panel.tsx +0 -15
  93. package/components/ai-elements/persona.tsx +0 -306
  94. package/components/ai-elements/plan.tsx +0 -147
  95. package/components/ai-elements/prompt-input.tsx +0 -1463
  96. package/components/ai-elements/queue.tsx +0 -274
  97. package/components/ai-elements/reasoning.tsx +0 -228
  98. package/components/ai-elements/sandbox.tsx +0 -132
  99. package/components/ai-elements/schema-display.tsx +0 -471
  100. package/components/ai-elements/shimmer.tsx +0 -77
  101. package/components/ai-elements/snippet.tsx +0 -145
  102. package/components/ai-elements/sources.tsx +0 -77
  103. package/components/ai-elements/speech-input.tsx +0 -323
  104. package/components/ai-elements/stack-trace.tsx +0 -528
  105. package/components/ai-elements/suggestion.tsx +0 -57
  106. package/components/ai-elements/task.tsx +0 -87
  107. package/components/ai-elements/terminal.tsx +0 -273
  108. package/components/ai-elements/test-results.tsx +0 -496
  109. package/components/ai-elements/tool.tsx +0 -173
  110. package/components/ai-elements/toolbar.tsx +0 -16
  111. package/components/ai-elements/transcription.tsx +0 -125
  112. package/components/ai-elements/voice-selector.tsx +0 -524
  113. package/components/ai-elements/web-preview.tsx +0 -281
@@ -1,125 +0,0 @@
1
- "use client";
2
-
3
- import { useControllableState } from "@radix-ui/react-use-controllable-state";
4
- import { cn } from "../../lib/utils";
5
- import type { Experimental_TranscriptionResult as TranscriptionResult } from "ai";
6
- import type { ComponentProps, ReactNode } from "react";
7
- import { createContext, useCallback, useContext, useMemo } from "react";
8
-
9
- type TranscriptionSegment = TranscriptionResult["segments"][number];
10
-
11
- interface TranscriptionContextValue {
12
- segments: TranscriptionSegment[];
13
- currentTime: number;
14
- onTimeUpdate: (time: number) => void;
15
- onSeek?: (time: number) => void;
16
- }
17
-
18
- const TranscriptionContext = createContext<TranscriptionContextValue | null>(
19
- null
20
- );
21
-
22
- const useTranscription = () => {
23
- const context = useContext(TranscriptionContext);
24
- if (!context) {
25
- throw new Error(
26
- "Transcription components must be used within Transcription"
27
- );
28
- }
29
- return context;
30
- };
31
-
32
- export type TranscriptionProps = Omit<ComponentProps<"div">, "children"> & {
33
- segments: TranscriptionSegment[];
34
- currentTime?: number;
35
- onSeek?: (time: number) => void;
36
- children: (segment: TranscriptionSegment, index: number) => ReactNode;
37
- };
38
-
39
- export const Transcription = ({
40
- segments,
41
- currentTime: externalCurrentTime,
42
- onSeek,
43
- className,
44
- children,
45
- ...props
46
- }: TranscriptionProps) => {
47
- const [currentTime, setCurrentTime] = useControllableState({
48
- defaultProp: 0,
49
- onChange: onSeek,
50
- prop: externalCurrentTime,
51
- });
52
-
53
- const contextValue = useMemo(
54
- () => ({ currentTime, onSeek, onTimeUpdate: setCurrentTime, segments }),
55
- [currentTime, onSeek, setCurrentTime, segments]
56
- );
57
-
58
- return (
59
- <TranscriptionContext.Provider value={contextValue}>
60
- <div
61
- className={cn(
62
- "flex flex-wrap gap-1 text-sm leading-relaxed",
63
- className
64
- )}
65
- data-slot="transcription"
66
- {...props}
67
- >
68
- {segments
69
- .filter((segment) => segment.text.trim())
70
- .map((segment, index) => children(segment, index))}
71
- </div>
72
- </TranscriptionContext.Provider>
73
- );
74
- };
75
-
76
- export type TranscriptionSegmentProps = ComponentProps<"button"> & {
77
- segment: TranscriptionSegment;
78
- index: number;
79
- };
80
-
81
- export const TranscriptionSegment = ({
82
- segment,
83
- index,
84
- className,
85
- onClick,
86
- ...props
87
- }: TranscriptionSegmentProps) => {
88
- const { currentTime, onSeek } = useTranscription();
89
-
90
- const isActive =
91
- currentTime >= segment.startSecond && currentTime < segment.endSecond;
92
- const isPast = currentTime >= segment.endSecond;
93
-
94
- const handleClick = useCallback(
95
- (event: React.MouseEvent<HTMLButtonElement>) => {
96
- if (onSeek) {
97
- onSeek(segment.startSecond);
98
- }
99
- onClick?.(event);
100
- },
101
- [onSeek, segment.startSecond, onClick]
102
- );
103
-
104
- return (
105
- <button
106
- className={cn(
107
- "inline text-left",
108
- isActive && "text-primary",
109
- isPast && "text-muted-foreground",
110
- !(isActive || isPast) && "text-muted-foreground/60",
111
- onSeek && "cursor-pointer hover:text-foreground",
112
- !onSeek && "cursor-default",
113
- className
114
- )}
115
- data-active={isActive}
116
- data-index={index}
117
- data-slot="transcription-segment"
118
- onClick={handleClick}
119
- type="button"
120
- {...props}
121
- >
122
- {segment.text}
123
- </button>
124
- );
125
- };
@@ -1,524 +0,0 @@
1
- "use client";
2
-
3
- import { useControllableState } from "@radix-ui/react-use-controllable-state";
4
- import { Button } from "../ui/button";
5
- import {
6
- Command,
7
- CommandDialog,
8
- CommandEmpty,
9
- CommandGroup,
10
- CommandInput,
11
- CommandItem,
12
- CommandList,
13
- CommandSeparator,
14
- CommandShortcut,
15
- } from "../ui/command";
16
- import {
17
- Dialog,
18
- DialogContent,
19
- DialogTitle,
20
- DialogTrigger,
21
- } from "../ui/dialog";
22
- import { Spinner } from "../ui/spinner";
23
- import { cn } from "../../lib/utils";
24
- import {
25
- CircleSmallIcon,
26
- MarsIcon,
27
- MarsStrokeIcon,
28
- NonBinaryIcon,
29
- PauseIcon,
30
- PlayIcon,
31
- TransgenderIcon,
32
- VenusAndMarsIcon,
33
- VenusIcon,
34
- } from "lucide-react";
35
- import type { ComponentProps, ReactNode } from "react";
36
- import { createContext, useCallback, useContext, useMemo } from "react";
37
-
38
- interface VoiceSelectorContextValue {
39
- value: string | undefined;
40
- setValue: (value: string | undefined) => void;
41
- open: boolean;
42
- setOpen: (open: boolean) => void;
43
- }
44
-
45
- const VoiceSelectorContext = createContext<VoiceSelectorContextValue | null>(
46
- null
47
- );
48
-
49
- export const useVoiceSelector = () => {
50
- const context = useContext(VoiceSelectorContext);
51
- if (!context) {
52
- throw new Error(
53
- "VoiceSelector components must be used within VoiceSelector"
54
- );
55
- }
56
- return context;
57
- };
58
-
59
- export type VoiceSelectorProps = ComponentProps<typeof Dialog> & {
60
- value?: string;
61
- defaultValue?: string;
62
- onValueChange?: (value: string | undefined) => void;
63
- };
64
-
65
- export const VoiceSelector = ({
66
- value: valueProp,
67
- defaultValue,
68
- onValueChange,
69
- open: openProp,
70
- defaultOpen = false,
71
- onOpenChange,
72
- children,
73
- ...props
74
- }: VoiceSelectorProps) => {
75
- const [value, setValue] = useControllableState({
76
- defaultProp: defaultValue,
77
- onChange: onValueChange,
78
- prop: valueProp,
79
- });
80
-
81
- const [open, setOpen] = useControllableState({
82
- defaultProp: defaultOpen,
83
- onChange: onOpenChange,
84
- prop: openProp,
85
- });
86
-
87
- const voiceSelectorContext = useMemo(
88
- () => ({ open, setOpen, setValue, value }),
89
- [value, setValue, open, setOpen]
90
- );
91
-
92
- return (
93
- <VoiceSelectorContext.Provider value={voiceSelectorContext}>
94
- <Dialog onOpenChange={setOpen} open={open} {...props}>
95
- {children}
96
- </Dialog>
97
- </VoiceSelectorContext.Provider>
98
- );
99
- };
100
-
101
- export type VoiceSelectorTriggerProps = ComponentProps<typeof DialogTrigger>;
102
-
103
- export const VoiceSelectorTrigger = (props: VoiceSelectorTriggerProps) => (
104
- <DialogTrigger {...props} />
105
- );
106
-
107
- export type VoiceSelectorContentProps = ComponentProps<typeof DialogContent> & {
108
- title?: ReactNode;
109
- };
110
-
111
- export const VoiceSelectorContent = ({
112
- className,
113
- children,
114
- title = "Voice Selector",
115
- ...props
116
- }: VoiceSelectorContentProps) => (
117
- <DialogContent
118
- aria-describedby={undefined}
119
- className={cn("p-0", className)}
120
- {...props}
121
- >
122
- <DialogTitle className="sr-only">{title}</DialogTitle>
123
- <Command className="**:data-[slot=command-input-wrapper]:h-auto">
124
- {children}
125
- </Command>
126
- </DialogContent>
127
- );
128
-
129
- export type VoiceSelectorDialogProps = ComponentProps<typeof CommandDialog>;
130
-
131
- export const VoiceSelectorDialog = (props: VoiceSelectorDialogProps) => (
132
- <CommandDialog {...props} />
133
- );
134
-
135
- export type VoiceSelectorInputProps = ComponentProps<typeof CommandInput>;
136
-
137
- export const VoiceSelectorInput = ({
138
- className,
139
- ...props
140
- }: VoiceSelectorInputProps) => (
141
- <CommandInput className={cn("h-auto py-3.5", className)} {...props} />
142
- );
143
-
144
- export type VoiceSelectorListProps = ComponentProps<typeof CommandList>;
145
-
146
- export const VoiceSelectorList = (props: VoiceSelectorListProps) => (
147
- <CommandList {...props} />
148
- );
149
-
150
- export type VoiceSelectorEmptyProps = ComponentProps<typeof CommandEmpty>;
151
-
152
- export const VoiceSelectorEmpty = (props: VoiceSelectorEmptyProps) => (
153
- <CommandEmpty {...props} />
154
- );
155
-
156
- export type VoiceSelectorGroupProps = ComponentProps<typeof CommandGroup>;
157
-
158
- export const VoiceSelectorGroup = (props: VoiceSelectorGroupProps) => (
159
- <CommandGroup {...props} />
160
- );
161
-
162
- export type VoiceSelectorItemProps = ComponentProps<typeof CommandItem>;
163
-
164
- export const VoiceSelectorItem = ({
165
- className,
166
- ...props
167
- }: VoiceSelectorItemProps) => (
168
- <CommandItem className={cn("px-4 py-2", className)} {...props} />
169
- );
170
-
171
- export type VoiceSelectorShortcutProps = ComponentProps<typeof CommandShortcut>;
172
-
173
- export const VoiceSelectorShortcut = (props: VoiceSelectorShortcutProps) => (
174
- <CommandShortcut {...props} />
175
- );
176
-
177
- export type VoiceSelectorSeparatorProps = ComponentProps<
178
- typeof CommandSeparator
179
- >;
180
-
181
- export const VoiceSelectorSeparator = (props: VoiceSelectorSeparatorProps) => (
182
- <CommandSeparator {...props} />
183
- );
184
-
185
- export type VoiceSelectorGenderProps = ComponentProps<"span"> & {
186
- value?:
187
- | "male"
188
- | "female"
189
- | "transgender"
190
- | "androgyne"
191
- | "non-binary"
192
- | "intersex";
193
- };
194
-
195
- export const VoiceSelectorGender = ({
196
- className,
197
- value,
198
- children,
199
- ...props
200
- }: VoiceSelectorGenderProps) => {
201
- let icon: ReactNode | null = null;
202
-
203
- switch (value) {
204
- case "male": {
205
- icon = <MarsIcon className="size-4" />;
206
- break;
207
- }
208
- case "female": {
209
- icon = <VenusIcon className="size-4" />;
210
- break;
211
- }
212
- case "transgender": {
213
- icon = <TransgenderIcon className="size-4" />;
214
- break;
215
- }
216
- case "androgyne": {
217
- icon = <MarsStrokeIcon className="size-4" />;
218
- break;
219
- }
220
- case "non-binary": {
221
- icon = <NonBinaryIcon className="size-4" />;
222
- break;
223
- }
224
- case "intersex": {
225
- icon = <VenusAndMarsIcon className="size-4" />;
226
- break;
227
- }
228
- default: {
229
- icon = <CircleSmallIcon className="size-4" />;
230
- }
231
- }
232
-
233
- return (
234
- <span className={cn("text-muted-foreground text-xs", className)} {...props}>
235
- {children ?? icon}
236
- </span>
237
- );
238
- };
239
-
240
- export type VoiceSelectorAccentProps = ComponentProps<"span"> & {
241
- value?:
242
- | "american"
243
- | "british"
244
- | "australian"
245
- | "canadian"
246
- | "irish"
247
- | "scottish"
248
- | "indian"
249
- | "south-african"
250
- | "new-zealand"
251
- | "spanish"
252
- | "french"
253
- | "german"
254
- | "italian"
255
- | "portuguese"
256
- | "brazilian"
257
- | "mexican"
258
- | "argentinian"
259
- | "japanese"
260
- | "chinese"
261
- | "korean"
262
- | "russian"
263
- | "arabic"
264
- | "dutch"
265
- | "swedish"
266
- | "norwegian"
267
- | "danish"
268
- | "finnish"
269
- | "polish"
270
- | "turkish"
271
- | "greek"
272
- | string;
273
- };
274
-
275
- export const VoiceSelectorAccent = ({
276
- className,
277
- value,
278
- children,
279
- ...props
280
- }: VoiceSelectorAccentProps) => {
281
- let emoji: string | null = null;
282
-
283
- switch (value) {
284
- case "american": {
285
- emoji = "🇺🇸";
286
- break;
287
- }
288
- case "british": {
289
- emoji = "🇬🇧";
290
- break;
291
- }
292
- case "australian": {
293
- emoji = "🇦🇺";
294
- break;
295
- }
296
- case "canadian": {
297
- emoji = "🇨🇦";
298
- break;
299
- }
300
- case "irish": {
301
- emoji = "🇮🇪";
302
- break;
303
- }
304
- case "scottish": {
305
- emoji = "🏴󠁧󠁢󠁳󠁣󠁴󠁿";
306
- break;
307
- }
308
- case "indian": {
309
- emoji = "🇮🇳";
310
- break;
311
- }
312
- case "south-african": {
313
- emoji = "🇿🇦";
314
- break;
315
- }
316
- case "new-zealand": {
317
- emoji = "🇳🇿";
318
- break;
319
- }
320
- case "spanish": {
321
- emoji = "🇪🇸";
322
- break;
323
- }
324
- case "french": {
325
- emoji = "🇫🇷";
326
- break;
327
- }
328
- case "german": {
329
- emoji = "🇩🇪";
330
- break;
331
- }
332
- case "italian": {
333
- emoji = "🇮🇹";
334
- break;
335
- }
336
- case "portuguese": {
337
- emoji = "🇵🇹";
338
- break;
339
- }
340
- case "brazilian": {
341
- emoji = "🇧🇷";
342
- break;
343
- }
344
- case "mexican": {
345
- emoji = "🇲🇽";
346
- break;
347
- }
348
- case "argentinian": {
349
- emoji = "🇦🇷";
350
- break;
351
- }
352
- case "japanese": {
353
- emoji = "🇯🇵";
354
- break;
355
- }
356
- case "chinese": {
357
- emoji = "🇨🇳";
358
- break;
359
- }
360
- case "korean": {
361
- emoji = "🇰🇷";
362
- break;
363
- }
364
- case "russian": {
365
- emoji = "🇷🇺";
366
- break;
367
- }
368
- case "arabic": {
369
- emoji = "🇸🇦";
370
- break;
371
- }
372
- case "dutch": {
373
- emoji = "🇳🇱";
374
- break;
375
- }
376
- case "swedish": {
377
- emoji = "🇸🇪";
378
- break;
379
- }
380
- case "norwegian": {
381
- emoji = "🇳🇴";
382
- break;
383
- }
384
- case "danish": {
385
- emoji = "🇩🇰";
386
- break;
387
- }
388
- case "finnish": {
389
- emoji = "🇫🇮";
390
- break;
391
- }
392
- case "polish": {
393
- emoji = "🇵🇱";
394
- break;
395
- }
396
- case "turkish": {
397
- emoji = "🇹🇷";
398
- break;
399
- }
400
- case "greek": {
401
- emoji = "🇬🇷";
402
- break;
403
- }
404
- default: {
405
- emoji = null;
406
- }
407
- }
408
-
409
- return (
410
- <span className={cn("text-muted-foreground text-xs", className)} {...props}>
411
- {children ?? emoji}
412
- </span>
413
- );
414
- };
415
-
416
- export type VoiceSelectorAgeProps = ComponentProps<"span">;
417
-
418
- export const VoiceSelectorAge = ({
419
- className,
420
- ...props
421
- }: VoiceSelectorAgeProps) => (
422
- <span
423
- className={cn("text-muted-foreground text-xs tabular-nums", className)}
424
- {...props}
425
- />
426
- );
427
-
428
- export type VoiceSelectorNameProps = ComponentProps<"span">;
429
-
430
- export const VoiceSelectorName = ({
431
- className,
432
- ...props
433
- }: VoiceSelectorNameProps) => (
434
- <span
435
- className={cn("flex-1 truncate text-left font-medium", className)}
436
- {...props}
437
- />
438
- );
439
-
440
- export type VoiceSelectorDescriptionProps = ComponentProps<"span">;
441
-
442
- export const VoiceSelectorDescription = ({
443
- className,
444
- ...props
445
- }: VoiceSelectorDescriptionProps) => (
446
- <span className={cn("text-muted-foreground text-xs", className)} {...props} />
447
- );
448
-
449
- export type VoiceSelectorAttributesProps = ComponentProps<"div">;
450
-
451
- export const VoiceSelectorAttributes = ({
452
- className,
453
- children,
454
- ...props
455
- }: VoiceSelectorAttributesProps) => (
456
- <div className={cn("flex items-center text-xs", className)} {...props}>
457
- {children}
458
- </div>
459
- );
460
-
461
- export type VoiceSelectorBulletProps = ComponentProps<"span">;
462
-
463
- export const VoiceSelectorBullet = ({
464
- className,
465
- ...props
466
- }: VoiceSelectorBulletProps) => (
467
- <span
468
- aria-hidden="true"
469
- className={cn("select-none text-border", className)}
470
- {...props}
471
- >
472
- &bull;
473
- </span>
474
- );
475
-
476
- export type VoiceSelectorPreviewProps = Omit<
477
- ComponentProps<"button">,
478
- "children"
479
- > & {
480
- playing?: boolean;
481
- loading?: boolean;
482
- onPlay?: () => void;
483
- };
484
-
485
- export const VoiceSelectorPreview = ({
486
- className,
487
- playing,
488
- loading,
489
- onPlay,
490
- onClick,
491
- ...props
492
- }: VoiceSelectorPreviewProps) => {
493
- const handleClick = useCallback(
494
- (event: React.MouseEvent<HTMLButtonElement>) => {
495
- event.stopPropagation();
496
- onClick?.(event);
497
- onPlay?.();
498
- },
499
- [onClick, onPlay]
500
- );
501
-
502
- let icon = <PlayIcon className="size-3" />;
503
-
504
- if (loading) {
505
- icon = <Spinner className="size-3" />;
506
- } else if (playing) {
507
- icon = <PauseIcon className="size-3" />;
508
- }
509
-
510
- return (
511
- <Button
512
- aria-label={playing ? "Pause preview" : "Play preview"}
513
- className={cn("size-6", className)}
514
- disabled={loading}
515
- onClick={handleClick}
516
- size="icon-sm"
517
- type="button"
518
- variant="outline"
519
- {...props}
520
- >
521
- {icon}
522
- </Button>
523
- );
524
- };