moi-computer 0.11.1-next.0 → 0.11.1-next.2
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/client/AGENTS.md +2 -2
- package/client/components/ui/button.tsx +1 -53
- package/client/components/ui/collapsible.tsx +1 -15
- package/client/components/ui/dialog.tsx +1 -58
- package/client/components/ui/dropdown-menu.tsx +1 -254
- package/client/components/ui/hover-card.tsx +1 -44
- package/client/components/ui/input.tsx +1 -21
- package/client/components/ui/popover.tsx +1 -88
- package/client/components/ui/resizable.tsx +1 -40
- package/client/components/ui/skeleton.tsx +1 -13
- package/client/components/ui/slider.tsx +1 -70
- package/client/components/ui/spinner.tsx +1 -18
- package/client/components/ui/switch.tsx +1 -23
- package/client/components/ui/tabs.tsx +1 -0
- package/client/components/ui/textarea.tsx +1 -18
- package/client/components/ui/tooltip.tsx +1 -51
- package/client/features/chat/ChatPanel.tsx +6 -6
- package/client/features/chat/ChatPopup.tsx +3 -4
- package/client/features/chat/TurnView.tsx +5 -4
- package/client/features/chat/api.ts +5 -14
- package/client/features/chat/chat-frames.ts +9 -7
- package/client/features/chat/chat-send.ts +13 -2
- package/client/features/chat/chat-store.ts +1 -3
- package/client/features/chat/composer/ChatComposer.tsx +5 -1
- package/client/features/chat/composer/ModelPicker.tsx +44 -44
- package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
- package/client/features/chat/composer/model-order.ts +15 -0
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
- package/client/features/chat/group-turns.ts +12 -0
- package/client/features/chat/interleave-notices.ts +7 -11
- package/client/features/chat/session-view.ts +53 -0
- package/client/features/chat/tool-group/ToolCallGroup.tsx +1 -4
- package/client/features/chat/tool-group/format/codex.ts +4 -1
- package/client/features/chat/useChat.ts +10 -9
- package/client/features/dev/ChatStatesPage.tsx +3 -1
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/HarnessDebugPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +834 -0
- package/client/features/dev/UiComponentsPage.tsx +60 -0
- package/client/features/home/WorkspacePreview.tsx +1 -1
- package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +4 -1
- package/client/features/views/ViewManager.tsx +14 -9
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +1 -3
- package/client/features/workspace/WorkspaceScreen.tsx +5 -1
- package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
- package/client/features/workspace/api.ts +2 -4
- package/client/index.css +22 -29
- package/dist/chunk-245wt82v.css +1 -0
- package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
- package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
- package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
- package/dist/chunk-a6jad1a6.js +1 -0
- package/dist/chunk-dghwstd2.js +9 -0
- package/dist/chunk-eg120aca.js +1 -0
- package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
- package/dist/chunk-j7hh2ab4.js +70 -0
- package/dist/chunk-w482ew2c.js +546 -0
- package/dist/chunk-y8eyahwx.js +1 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +55 -6
- package/lib/themes.ts +6 -6
- package/lib/types.ts +10 -9
- package/package.json +12 -5
- package/registry.json +643 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +26 -30
- package/server/applets.ts +30 -29
- package/server/bundler/applet-css.ts +7 -107
- package/server/bundler/build-applet.ts +5 -1
- package/server/bundler/build-worker.ts +178 -0
- package/server/cli-ui-components.ts +28 -33
- package/server/cli.ts +6 -11
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +41 -48
- package/server/harness/acp/NOTES.md +426 -0
- package/server/harness/acp/discovery.ts +27 -30
- package/server/harness/acp/model-state.ts +57 -0
- package/server/harness/acp/session.ts +18 -6
- package/server/harness/claude-code/NOTES.md +47 -12
- package/server/harness/claude-code/cli.ts +40 -0
- package/server/harness/claude-code/index.ts +11 -5
- package/server/harness/claude-code/models.ts +72 -19
- package/server/harness/claude-code/session.ts +408 -299
- package/server/harness/codex/NOTES.md +222 -350
- package/server/harness/codex/adapter.ts +94 -45
- package/server/harness/codex/auth.ts +1 -3
- package/server/harness/codex/client.ts +169 -249
- package/server/harness/codex/discovery.ts +9 -17
- package/server/harness/codex/index.ts +2 -1
- package/server/harness/codex/pagination.ts +24 -0
- package/server/harness/codex/permissions.ts +31 -7
- package/server/harness/codex/probe.ts +10 -13
- package/server/harness/codex/session.ts +549 -136
- package/server/harness/codex/transport.ts +184 -0
- package/server/harness/debug.ts +1 -1
- package/server/harness/hermes/NOTES.md +18 -0
- package/server/harness/hermes/discovery.ts +20 -0
- package/server/harness/hermes/index.ts +9 -0
- package/server/harness/hermes/models.ts +28 -8
- package/server/harness/types.ts +4 -2
- package/server/moi-scaffold.ts +1 -1
- package/server/preview.ts +3 -1
- package/server/registry.ts +63 -41
- package/server/tldraw-package.d.ts +4 -0
- package/server/ui-components.ts +101 -434
- package/server/view-builders.ts +2 -1
- package/server/web.ts +12 -5
- package/server/workspace-env.ts +3 -2
- package/tsconfig.json +0 -1
- package/ui-components/accordion.tsx +71 -0
- package/ui-components/alert-dialog.tsx +165 -0
- package/ui-components/alert.tsx +68 -0
- package/ui-components/attachment.tsx +195 -0
- package/ui-components/avatar.tsx +90 -0
- package/ui-components/badge.tsx +49 -0
- package/ui-components/button-group.tsx +78 -0
- package/ui-components/button.tsx +55 -0
- package/ui-components/calendar.tsx +180 -0
- package/ui-components/card.tsx +84 -0
- package/ui-components/carousel.tsx +235 -0
- package/ui-components/chart.tsx +338 -0
- package/ui-components/checkbox.tsx +28 -0
- package/ui-components/collapsible.tsx +15 -0
- package/ui-components/combobox.tsx +267 -0
- package/ui-components/context-menu.tsx +244 -0
- package/ui-components/dialog.tsx +138 -0
- package/ui-components/docs/accordion.md +463 -0
- package/ui-components/docs/alert-dialog.md +481 -0
- package/ui-components/docs/alert.md +301 -0
- package/ui-components/docs/attachment.md +689 -0
- package/ui-components/docs/avatar.md +495 -0
- package/ui-components/docs/badge.md +258 -0
- package/ui-components/docs/button-group.md +879 -0
- package/ui-components/docs/button.md +26 -0
- package/ui-components/docs/calendar.md +862 -0
- package/ui-components/docs/card.md +265 -0
- package/ui-components/docs/carousel.md +627 -0
- package/ui-components/docs/chart.md +1256 -0
- package/ui-components/docs/checkbox.md +477 -0
- package/ui-components/docs/collapsible.md +446 -0
- package/ui-components/docs/combobox.md +1003 -0
- package/ui-components/docs/context-menu.md +860 -0
- package/ui-components/docs/data-table.md +1580 -0
- package/ui-components/docs/date-picker.md +614 -0
- package/ui-components/docs/dialog.md +414 -0
- package/ui-components/docs/drawer.md +51 -0
- package/ui-components/docs/dropdown-menu.md +1000 -0
- package/ui-components/docs/field.md +1192 -0
- package/ui-components/docs/hover-card.md +275 -0
- package/ui-components/docs/input-group.md +866 -0
- package/ui-components/docs/input.md +456 -0
- package/ui-components/docs/label.md +295 -0
- package/ui-components/docs/pagination.md +416 -0
- package/ui-components/docs/popover.md +348 -0
- package/ui-components/docs/progress.md +214 -0
- package/ui-components/docs/radio-group.md +389 -0
- package/ui-components/docs/resizable.md +265 -0
- package/ui-components/docs/select.md +616 -0
- package/ui-components/docs/separator.md +216 -0
- package/ui-components/docs/skeleton.md +205 -0
- package/ui-components/docs/slider.md +226 -0
- package/ui-components/docs/spinner.md +332 -0
- package/ui-components/docs/switch.md +236 -0
- package/ui-components/docs/table.md +551 -0
- package/ui-components/docs/tabs.md +379 -0
- package/ui-components/docs/textarea.md +187 -0
- package/ui-components/docs/toggle-group.md +370 -0
- package/ui-components/docs/toggle.md +91 -0
- package/ui-components/docs/tooltip.md +290 -0
- package/ui-components/drawer.tsx +213 -0
- package/ui-components/dropdown-menu.tsx +263 -0
- package/ui-components/field.tsx +224 -0
- package/ui-components/hover-card.tsx +46 -0
- package/ui-components/input-group.tsx +146 -0
- package/ui-components/input.tsx +20 -0
- package/ui-components/label.tsx +17 -0
- package/ui-components/pagination.tsx +124 -0
- package/ui-components/popover.tsx +81 -0
- package/ui-components/progress.tsx +63 -0
- package/ui-components/radio-group.tsx +38 -0
- package/ui-components/resizable.tsx +40 -0
- package/ui-components/scoped-portal.tsx +31 -0
- package/ui-components/select.tsx +195 -0
- package/ui-components/separator.tsx +18 -0
- package/ui-components/skeleton.tsx +15 -0
- package/ui-components/slider.tsx +75 -0
- package/ui-components/spinner.tsx +20 -0
- package/ui-components/switch.tsx +27 -0
- package/ui-components/table.tsx +86 -0
- package/ui-components/tabs.tsx +75 -0
- package/ui-components/textarea.tsx +17 -0
- package/ui-components/toggle-group.tsx +85 -0
- package/ui-components/toggle.tsx +42 -0
- package/ui-components/tooltip.tsx +61 -0
- package/ui-components/utils.ts +8 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
- package/dist/chunk-59zf0m6n.js +0 -1
- package/dist/chunk-bj3akjs2.js +0 -1
- package/dist/chunk-j2w2vak4.js +0 -546
- package/dist/chunk-k2r9c95m.js +0 -10
- package/dist/chunk-kmbxhgwv.js +0 -1
- package/dist/chunk-p1yqa71k.js +0 -83
- package/dist/chunk-r5xrenjy.css +0 -1
package/server/web.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { api } from './api'
|
|
|
6
6
|
import { PORT } from './constants'
|
|
7
7
|
import { control } from './control'
|
|
8
8
|
import { EVENTS_TOPIC, publishEvent, setEventServer } from './events'
|
|
9
|
+
import { killBuildWorkers } from './bundler/build-worker'
|
|
9
10
|
import { killAllWorkers } from './functions'
|
|
10
11
|
import { startScratchpadSweeper } from './scratchpad'
|
|
11
12
|
import { resolveScratchOp } from './scratchpad-relay'
|
|
@@ -83,6 +84,9 @@ function upgrade(server: Upgradable, req: Request, data: WsData) {
|
|
|
83
84
|
export const app = Bun.serve<WsData>({
|
|
84
85
|
port: PORT,
|
|
85
86
|
hostname: process.env.HOST ?? '127.0.0.1',
|
|
87
|
+
// Agent startup/discovery can outlast Bun's 10s HTTP default. Allow the
|
|
88
|
+
// harness's 30s RPC timeout to return an error before the socket closes.
|
|
89
|
+
idleTimeout: 60,
|
|
86
90
|
// HMR only in dev; prod serves prebuilt static assets (no bundler).
|
|
87
91
|
development: prebuilt ? false : { hmr: true },
|
|
88
92
|
routes: {
|
|
@@ -96,10 +100,10 @@ export const app = Bun.serve<WsData>({
|
|
|
96
100
|
|
|
97
101
|
// Locally-vendored React ESM (offline; no CDN). The importmap in
|
|
98
102
|
// client/index.html points here; the handler picks dev/prod per env.
|
|
99
|
-
'/vendor/react/*': req => serveVendorReact(req),
|
|
103
|
+
'/vendor/react/*': (req: Request) => serveVendorReact(req),
|
|
100
104
|
|
|
101
105
|
// Vendored emojibase-data for the settings emoji picker (offline; no CDN).
|
|
102
|
-
'/vendor/emojibase/*': req => serveVendorEmojibase(req),
|
|
106
|
+
'/vendor/emojibase/*': (req: Request) => serveVendorEmojibase(req),
|
|
103
107
|
|
|
104
108
|
// Client-side routes — serve the SPA shell.
|
|
105
109
|
'/': shell,
|
|
@@ -109,12 +113,13 @@ export const app = Bun.serve<WsData>({
|
|
|
109
113
|
|
|
110
114
|
// Chat websocket — app-wide (one per client, not per workspace). Each chat
|
|
111
115
|
// frame carries its own workspaceId.
|
|
112
|
-
'/ws': (req
|
|
116
|
+
'/ws': (req: Request, server: Bun.Server<WsData>) =>
|
|
117
|
+
upgrade(server, req, { channel: 'chat', workspaceId: '' }),
|
|
113
118
|
|
|
114
119
|
// Live widget-event stream (build/refresh pushes). A static path, so Bun
|
|
115
120
|
// routes it ahead of the Hono-served `/api/workspaces/:id`; the upgrade
|
|
116
121
|
// happens in-handler via the route's `server` argument.
|
|
117
|
-
'/api/workspaces/ws': (req, server) =>
|
|
122
|
+
'/api/workspaces/ws': (req: Request, server: Bun.Server<WsData>) =>
|
|
118
123
|
upgrade(server, req, { channel: 'events', workspaceId: '' })
|
|
119
124
|
},
|
|
120
125
|
// Anything not matched above (the whole HTTP API + prod static assets + 404)
|
|
@@ -215,7 +220,8 @@ startServiceLogMaintenance()
|
|
|
215
220
|
|
|
216
221
|
// Graceful shutdown. In dev the supervisor sends SIGTERM on server-file
|
|
217
222
|
// changes; in any context Ctrl-C sends SIGINT. Close both servers and kill the
|
|
218
|
-
// per-workspace function workers
|
|
223
|
+
// per-workspace function workers and any in-flight applet build child so no
|
|
224
|
+
// child processes are orphaned.
|
|
219
225
|
function shutdown() {
|
|
220
226
|
try {
|
|
221
227
|
app.stop(true)
|
|
@@ -225,6 +231,7 @@ function shutdown() {
|
|
|
225
231
|
} catch {}
|
|
226
232
|
for (const h of allHarnesses()) h.shutdown?.()
|
|
227
233
|
killAllWorkers()
|
|
234
|
+
killBuildWorkers()
|
|
228
235
|
process.exit()
|
|
229
236
|
}
|
|
230
237
|
process.on('SIGTERM', shutdown)
|
package/server/workspace-env.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { chmod, mkdir, rename } from 'node:fs/promises'
|
|
|
18
18
|
import { dirname, join, resolve } from 'node:path'
|
|
19
19
|
import { parseEnv } from 'node:util'
|
|
20
20
|
|
|
21
|
-
import type { WorkspaceEnvView } from '@/lib/types'
|
|
21
|
+
import type { WorkspaceEnvVar, WorkspaceEnvView } from '@/lib/types'
|
|
22
22
|
|
|
23
23
|
import { DATA_DIR } from './data-dir'
|
|
24
24
|
|
|
@@ -373,7 +373,8 @@ export async function getWorkspaceEnvView(
|
|
|
373
373
|
const vars = [...keys].sort().map(key => {
|
|
374
374
|
const inCustom = key in secrets
|
|
375
375
|
const fromDotenv = key in dotenv
|
|
376
|
-
const source
|
|
376
|
+
const source: WorkspaceEnvVar['source'] =
|
|
377
|
+
inCustom && fromDotenv ? 'both' : inCustom ? 'custom' : 'dotenv'
|
|
377
378
|
return {
|
|
378
379
|
key,
|
|
379
380
|
source,
|
package/tsconfig.json
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Accordion as AccordionPrimitive } from '@base-ui/react/accordion'
|
|
2
|
+
import { cn } from './utils'
|
|
3
|
+
import { IconChevronDown, IconChevronUp } from '@tabler/icons-react'
|
|
4
|
+
|
|
5
|
+
function Accordion({ className, ...props }: AccordionPrimitive.Root.Props) {
|
|
6
|
+
return (
|
|
7
|
+
<AccordionPrimitive.Root
|
|
8
|
+
data-slot="accordion"
|
|
9
|
+
className={cn('flex w-full flex-col', className)}
|
|
10
|
+
{...props}
|
|
11
|
+
/>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function AccordionItem({ className, ...props }: AccordionPrimitive.Item.Props) {
|
|
16
|
+
return (
|
|
17
|
+
<AccordionPrimitive.Item
|
|
18
|
+
data-slot="accordion-item"
|
|
19
|
+
className={cn('not-last:border-b', className)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function AccordionTrigger({ className, children, ...props }: AccordionPrimitive.Trigger.Props) {
|
|
26
|
+
return (
|
|
27
|
+
<AccordionPrimitive.Header className="flex">
|
|
28
|
+
<AccordionPrimitive.Trigger
|
|
29
|
+
data-slot="accordion-trigger"
|
|
30
|
+
className={cn(
|
|
31
|
+
'group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground',
|
|
32
|
+
className
|
|
33
|
+
)}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
<IconChevronDown
|
|
38
|
+
stroke={1.75}
|
|
39
|
+
data-slot="accordion-trigger-icon"
|
|
40
|
+
className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
|
|
41
|
+
/>
|
|
42
|
+
<IconChevronUp
|
|
43
|
+
stroke={1.75}
|
|
44
|
+
data-slot="accordion-trigger-icon"
|
|
45
|
+
className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
|
|
46
|
+
/>
|
|
47
|
+
</AccordionPrimitive.Trigger>
|
|
48
|
+
</AccordionPrimitive.Header>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function AccordionContent({ className, children, ...props }: AccordionPrimitive.Panel.Props) {
|
|
53
|
+
return (
|
|
54
|
+
<AccordionPrimitive.Panel
|
|
55
|
+
data-slot="accordion-content"
|
|
56
|
+
className="overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up"
|
|
57
|
+
{...props}
|
|
58
|
+
>
|
|
59
|
+
<div
|
|
60
|
+
className={cn(
|
|
61
|
+
'h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',
|
|
62
|
+
className
|
|
63
|
+
)}
|
|
64
|
+
>
|
|
65
|
+
{children}
|
|
66
|
+
</div>
|
|
67
|
+
</AccordionPrimitive.Panel>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog'
|
|
5
|
+
import { cn } from './utils'
|
|
6
|
+
|
|
7
|
+
import { Button } from './button'
|
|
8
|
+
import { ScopedPortal } from './scoped-portal'
|
|
9
|
+
|
|
10
|
+
function AlertDialog({ ...props }: AlertDialogPrimitive.Root.Props) {
|
|
11
|
+
return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function AlertDialogTrigger({ ...props }: AlertDialogPrimitive.Trigger.Props) {
|
|
15
|
+
return <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function AlertDialogPortal({ ...props }: AlertDialogPrimitive.Portal.Props) {
|
|
19
|
+
return (
|
|
20
|
+
<ScopedPortal portal={AlertDialogPrimitive.Portal} data-slot="alert-dialog-portal" {...props} />
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function AlertDialogOverlay({ className, ...props }: AlertDialogPrimitive.Backdrop.Props) {
|
|
25
|
+
return (
|
|
26
|
+
<AlertDialogPrimitive.Backdrop
|
|
27
|
+
data-slot="alert-dialog-overlay"
|
|
28
|
+
className={cn(
|
|
29
|
+
'fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0',
|
|
30
|
+
className
|
|
31
|
+
)}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function AlertDialogContent({
|
|
38
|
+
className,
|
|
39
|
+
size = 'default',
|
|
40
|
+
...props
|
|
41
|
+
}: AlertDialogPrimitive.Popup.Props & {
|
|
42
|
+
size?: 'default' | 'sm'
|
|
43
|
+
}) {
|
|
44
|
+
return (
|
|
45
|
+
<AlertDialogPortal>
|
|
46
|
+
<AlertDialogOverlay />
|
|
47
|
+
<AlertDialogPrimitive.Popup
|
|
48
|
+
data-slot="alert-dialog-content"
|
|
49
|
+
data-size={size}
|
|
50
|
+
className={cn(
|
|
51
|
+
'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-4 rounded-xl bg-popover p-6 text-sm text-popover-foreground shadow-xl duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm 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',
|
|
52
|
+
className
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
</AlertDialogPortal>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
data-slot="alert-dialog-header"
|
|
64
|
+
className={cn(
|
|
65
|
+
'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-4 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]',
|
|
66
|
+
className
|
|
67
|
+
)}
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
74
|
+
return (
|
|
75
|
+
<div
|
|
76
|
+
data-slot="alert-dialog-footer"
|
|
77
|
+
className={cn(
|
|
78
|
+
'-mx-6 -mb-6 flex flex-col-reverse gap-2 rounded-b-xl p-6 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end',
|
|
79
|
+
className
|
|
80
|
+
)}
|
|
81
|
+
{...props}
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>) {
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
data-slot="alert-dialog-media"
|
|
90
|
+
className={cn(
|
|
91
|
+
"mb-2 inline-flex size-10 items-center justify-center rounded-md bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",
|
|
92
|
+
className
|
|
93
|
+
)}
|
|
94
|
+
{...props}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function AlertDialogTitle({
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
|
|
103
|
+
return (
|
|
104
|
+
<AlertDialogPrimitive.Title
|
|
105
|
+
data-slot="alert-dialog-title"
|
|
106
|
+
className={cn(
|
|
107
|
+
'text-base font-medium sm:group-data-[size=default]/alert-dialog-content:[:where([class~="group/alert-dialog-content"]):has([data-slot=alert-dialog-media])_&]:col-start-2',
|
|
108
|
+
className
|
|
109
|
+
)}
|
|
110
|
+
{...props}
|
|
111
|
+
/>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function AlertDialogDescription({
|
|
116
|
+
className,
|
|
117
|
+
...props
|
|
118
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
|
|
119
|
+
return (
|
|
120
|
+
<AlertDialogPrimitive.Description
|
|
121
|
+
data-slot="alert-dialog-description"
|
|
122
|
+
className={cn(
|
|
123
|
+
'text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',
|
|
124
|
+
className
|
|
125
|
+
)}
|
|
126
|
+
{...props}
|
|
127
|
+
/>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof Button>) {
|
|
132
|
+
return <Button data-slot="alert-dialog-action" className={cn(className)} {...props} />
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function AlertDialogCancel({
|
|
136
|
+
className,
|
|
137
|
+
variant = 'outline',
|
|
138
|
+
size = 'default',
|
|
139
|
+
...props
|
|
140
|
+
}: AlertDialogPrimitive.Close.Props &
|
|
141
|
+
Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>) {
|
|
142
|
+
return (
|
|
143
|
+
<AlertDialogPrimitive.Close
|
|
144
|
+
data-slot="alert-dialog-cancel"
|
|
145
|
+
className={cn(className)}
|
|
146
|
+
render={<Button variant={variant} size={size} />}
|
|
147
|
+
{...props}
|
|
148
|
+
/>
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export {
|
|
153
|
+
AlertDialog,
|
|
154
|
+
AlertDialogAction,
|
|
155
|
+
AlertDialogCancel,
|
|
156
|
+
AlertDialogContent,
|
|
157
|
+
AlertDialogDescription,
|
|
158
|
+
AlertDialogFooter,
|
|
159
|
+
AlertDialogHeader,
|
|
160
|
+
AlertDialogMedia,
|
|
161
|
+
AlertDialogOverlay,
|
|
162
|
+
AlertDialogPortal,
|
|
163
|
+
AlertDialogTitle,
|
|
164
|
+
AlertDialogTrigger
|
|
165
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import { cn } from './utils'
|
|
4
|
+
|
|
5
|
+
const alertVariants = cva(
|
|
6
|
+
"group/alert relative grid w-full gap-0.5 rounded-lg px-2.5 py-2 text-left text-sm ring-1 ring-border has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: 'bg-card text-card-foreground',
|
|
11
|
+
destructive:
|
|
12
|
+
'bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current'
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: 'default'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
function Alert({
|
|
22
|
+
className,
|
|
23
|
+
variant,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-slot="alert"
|
|
29
|
+
role="alert"
|
|
30
|
+
className={cn(alertVariants({ variant }), className)}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function AlertTitle({ className, ...props }: React.ComponentProps<'div'>) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-slot="alert-title"
|
|
40
|
+
className={cn(
|
|
41
|
+
'font-medium [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [:where([class~="group/alert"]):has(>svg)_&]:col-start-2',
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function AlertDescription({ className, ...props }: React.ComponentProps<'div'>) {
|
|
50
|
+
return (
|
|
51
|
+
<div
|
|
52
|
+
data-slot="alert-description"
|
|
53
|
+
className={cn(
|
|
54
|
+
'text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4',
|
|
55
|
+
className
|
|
56
|
+
)}
|
|
57
|
+
{...props}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function AlertAction({ className, ...props }: React.ComponentProps<'div'>) {
|
|
63
|
+
return (
|
|
64
|
+
<div data-slot="alert-action" className={cn('absolute top-2 right-2', className)} {...props} />
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { Alert, AlertTitle, AlertDescription, AlertAction }
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { mergeProps } from '@base-ui/react/merge-props'
|
|
3
|
+
import { useRender } from '@base-ui/react/use-render'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
import { cn } from './utils'
|
|
6
|
+
|
|
7
|
+
import { Button } from './button'
|
|
8
|
+
|
|
9
|
+
const attachmentVariants = cva(
|
|
10
|
+
'group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed',
|
|
11
|
+
{
|
|
12
|
+
variants: {
|
|
13
|
+
size: {
|
|
14
|
+
default:
|
|
15
|
+
'gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2',
|
|
16
|
+
sm: 'gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5',
|
|
17
|
+
xs: 'gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1'
|
|
18
|
+
},
|
|
19
|
+
orientation: {
|
|
20
|
+
horizontal: 'min-w-40 items-center',
|
|
21
|
+
vertical: 'w-24 flex-col has-data-[slot=attachment-content]:w-30'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
function Attachment({
|
|
28
|
+
className,
|
|
29
|
+
state = 'done',
|
|
30
|
+
size = 'default',
|
|
31
|
+
orientation = 'horizontal',
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<'div'> &
|
|
34
|
+
VariantProps<typeof attachmentVariants> & {
|
|
35
|
+
state?: 'idle' | 'uploading' | 'processing' | 'error' | 'done'
|
|
36
|
+
}) {
|
|
37
|
+
return (
|
|
38
|
+
<div
|
|
39
|
+
data-slot="attachment"
|
|
40
|
+
data-state={state}
|
|
41
|
+
data-size={size}
|
|
42
|
+
data-orientation={orientation}
|
|
43
|
+
className={cn(attachmentVariants({ size, orientation }), className)}
|
|
44
|
+
{...props}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const attachmentMediaVariants = cva(
|
|
50
|
+
"relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5",
|
|
51
|
+
{
|
|
52
|
+
variants: {
|
|
53
|
+
variant: {
|
|
54
|
+
icon: '',
|
|
55
|
+
image:
|
|
56
|
+
'opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover'
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
variant: 'icon'
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
function AttachmentMedia({
|
|
66
|
+
className,
|
|
67
|
+
variant = 'icon',
|
|
68
|
+
...props
|
|
69
|
+
}: React.ComponentProps<'div'> & VariantProps<typeof attachmentMediaVariants>) {
|
|
70
|
+
return (
|
|
71
|
+
<div
|
|
72
|
+
data-slot="attachment-media"
|
|
73
|
+
data-variant={variant}
|
|
74
|
+
className={cn(attachmentMediaVariants({ variant }), className)}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function AttachmentContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
81
|
+
return (
|
|
82
|
+
<div
|
|
83
|
+
data-slot="attachment-content"
|
|
84
|
+
className={cn(
|
|
85
|
+
'max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1',
|
|
86
|
+
className
|
|
87
|
+
)}
|
|
88
|
+
{...props}
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function AttachmentTitle({ className, ...props }: React.ComponentProps<'span'>) {
|
|
94
|
+
return (
|
|
95
|
+
<span
|
|
96
|
+
data-slot="attachment-title"
|
|
97
|
+
className={cn(
|
|
98
|
+
'block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer',
|
|
99
|
+
className
|
|
100
|
+
)}
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function AttachmentDescription({ className, ...props }: React.ComponentProps<'span'>) {
|
|
107
|
+
return (
|
|
108
|
+
<span
|
|
109
|
+
data-slot="attachment-description"
|
|
110
|
+
className={cn(
|
|
111
|
+
'mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80',
|
|
112
|
+
'max-w-full',
|
|
113
|
+
className
|
|
114
|
+
)}
|
|
115
|
+
{...props}
|
|
116
|
+
/>
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function AttachmentActions({ className, ...props }: React.ComponentProps<'div'>) {
|
|
121
|
+
return (
|
|
122
|
+
<div
|
|
123
|
+
data-slot="attachment-actions"
|
|
124
|
+
className={cn(
|
|
125
|
+
'relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1',
|
|
126
|
+
className
|
|
127
|
+
)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function AttachmentAction({
|
|
134
|
+
className,
|
|
135
|
+
variant,
|
|
136
|
+
size = 'icon-xs',
|
|
137
|
+
...props
|
|
138
|
+
}: React.ComponentProps<typeof Button>) {
|
|
139
|
+
return (
|
|
140
|
+
<Button
|
|
141
|
+
data-slot="attachment-action"
|
|
142
|
+
variant={variant ?? 'ghost'}
|
|
143
|
+
size={size}
|
|
144
|
+
className={cn(className)}
|
|
145
|
+
{...props}
|
|
146
|
+
/>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function AttachmentTrigger({
|
|
151
|
+
className,
|
|
152
|
+
render,
|
|
153
|
+
type,
|
|
154
|
+
...props
|
|
155
|
+
}: useRender.ComponentProps<'button'>) {
|
|
156
|
+
return useRender({
|
|
157
|
+
defaultTagName: 'button',
|
|
158
|
+
props: mergeProps<'button'>(
|
|
159
|
+
{
|
|
160
|
+
type: render ? type : (type ?? 'button'),
|
|
161
|
+
className: cn('absolute inset-0 z-10 outline-none', className)
|
|
162
|
+
},
|
|
163
|
+
props
|
|
164
|
+
),
|
|
165
|
+
render,
|
|
166
|
+
state: {
|
|
167
|
+
slot: 'attachment-trigger'
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function AttachmentGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
173
|
+
return (
|
|
174
|
+
<div
|
|
175
|
+
data-slot="attachment-group"
|
|
176
|
+
className={cn(
|
|
177
|
+
'flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start',
|
|
178
|
+
className
|
|
179
|
+
)}
|
|
180
|
+
{...props}
|
|
181
|
+
/>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export {
|
|
186
|
+
Attachment,
|
|
187
|
+
AttachmentGroup,
|
|
188
|
+
AttachmentMedia,
|
|
189
|
+
AttachmentContent,
|
|
190
|
+
AttachmentTitle,
|
|
191
|
+
AttachmentDescription,
|
|
192
|
+
AttachmentActions,
|
|
193
|
+
AttachmentAction,
|
|
194
|
+
AttachmentTrigger
|
|
195
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar'
|
|
3
|
+
import { cn } from './utils'
|
|
4
|
+
|
|
5
|
+
function Avatar({
|
|
6
|
+
className,
|
|
7
|
+
size = 'default',
|
|
8
|
+
...props
|
|
9
|
+
}: AvatarPrimitive.Root.Props & {
|
|
10
|
+
size?: 'default' | 'sm' | 'lg'
|
|
11
|
+
}) {
|
|
12
|
+
return (
|
|
13
|
+
<AvatarPrimitive.Root
|
|
14
|
+
data-slot="avatar"
|
|
15
|
+
data-size={size}
|
|
16
|
+
className={cn(
|
|
17
|
+
'group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten',
|
|
18
|
+
className
|
|
19
|
+
)}
|
|
20
|
+
{...props}
|
|
21
|
+
/>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function AvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
|
|
26
|
+
return (
|
|
27
|
+
<AvatarPrimitive.Image
|
|
28
|
+
data-slot="avatar-image"
|
|
29
|
+
className={cn('aspect-square size-full rounded-full object-cover', className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function AvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props) {
|
|
36
|
+
return (
|
|
37
|
+
<AvatarPrimitive.Fallback
|
|
38
|
+
data-slot="avatar-fallback"
|
|
39
|
+
className={cn(
|
|
40
|
+
'flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs',
|
|
41
|
+
className
|
|
42
|
+
)}
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function AvatarBadge({ className, ...props }: React.ComponentProps<'span'>) {
|
|
49
|
+
return (
|
|
50
|
+
<span
|
|
51
|
+
data-slot="avatar-badge"
|
|
52
|
+
className={cn(
|
|
53
|
+
'absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none',
|
|
54
|
+
'group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden',
|
|
55
|
+
'group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2',
|
|
56
|
+
'group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2',
|
|
57
|
+
className
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function AvatarGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
data-slot="avatar-group"
|
|
68
|
+
className={cn(
|
|
69
|
+
'group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background',
|
|
70
|
+
className
|
|
71
|
+
)}
|
|
72
|
+
{...props}
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function AvatarGroupCount({ className, ...props }: React.ComponentProps<'div'>) {
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
data-slot="avatar-group-count"
|
|
81
|
+
className={cn(
|
|
82
|
+
'relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background [&>svg]:size-4 [:where([class~="group/avatar-group"]):has([data-size=lg])_&]:size-10 [:where([class~="group/avatar-group"]):has([data-size=lg])_&]:[&>svg]:size-5 [:where([class~="group/avatar-group"]):has([data-size=sm])_&]:size-6 [:where([class~="group/avatar-group"]):has([data-size=sm])_&]:[&>svg]:size-3',
|
|
83
|
+
className
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { Avatar, AvatarImage, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarBadge }
|