raft-ui 0.0.6 → 0.0.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.
- package/CHANGELOG.md +2 -8
- package/{src → dist}/styles.css +0 -2
- package/package.json +3 -4
- package/src/components/alert-dialog/alert-dialog.tsx +0 -215
- package/src/components/alert-dialog/index.ts +0 -30
- package/src/components/avatar/avatar.tsx +0 -375
- package/src/components/avatar/index.ts +0 -17
- package/src/components/badge/badge.tsx +0 -393
- package/src/components/badge/index.ts +0 -2
- package/src/components/banner/banner.tsx +0 -269
- package/src/components/banner/index.ts +0 -8
- package/src/components/bottom-sheet/bottom-sheet.tsx +0 -152
- package/src/components/bottom-sheet/index.ts +0 -22
- package/src/components/button/button.tsx +0 -499
- package/src/components/button/index.ts +0 -2
- package/src/components/checkbox/checkbox-indicator.tsx +0 -128
- package/src/components/checkbox/checkbox.tsx +0 -350
- package/src/components/checkbox/index.ts +0 -2
- package/src/components/combobox/combobox.tsx +0 -603
- package/src/components/combobox/index.ts +0 -52
- package/src/components/context-menu/context-menu.tsx +0 -380
- package/src/components/context-menu/index.ts +0 -34
- package/src/components/conversation-preview-card/conversation-preview-card.tsx +0 -336
- package/src/components/conversation-preview-card/index.ts +0 -32
- package/src/components/description-list/description-list.tsx +0 -116
- package/src/components/description-list/index.ts +0 -14
- package/src/components/dialog/dialog.tsx +0 -152
- package/src/components/dialog/index.ts +0 -26
- package/src/components/dropdown-menu/dropdown-menu.tsx +0 -405
- package/src/components/dropdown-menu/index.ts +0 -38
- package/src/components/empty-state/empty-state.tsx +0 -177
- package/src/components/empty-state/index.ts +0 -16
- package/src/components/field/field.tsx +0 -125
- package/src/components/field/index.ts +0 -18
- package/src/components/inline-code/index.ts +0 -2
- package/src/components/inline-code/inline-code.tsx +0 -35
- package/src/components/input/index.ts +0 -2
- package/src/components/input/input.tsx +0 -76
- package/src/components/input-group/index.ts +0 -7
- package/src/components/input-group/input-group.tsx +0 -215
- package/src/components/kbd/index.ts +0 -2
- package/src/components/kbd/kbd.tsx +0 -43
- package/src/components/label/index.ts +0 -2
- package/src/components/label/label.tsx +0 -99
- package/src/components/lightbox/index.ts +0 -24
- package/src/components/lightbox/lightbox.tsx +0 -245
- package/src/components/list-item/index.ts +0 -20
- package/src/components/list-item/list-item.tsx +0 -263
- package/src/components/media-list-item/index.ts +0 -20
- package/src/components/media-list-item/media-list-item.tsx +0 -169
- package/src/components/notification-center/index.ts +0 -39
- package/src/components/notification-center/notification-center.tsx +0 -558
- package/src/components/panel-header/index.ts +0 -22
- package/src/components/panel-header/panel-header.tsx +0 -199
- package/src/components/popover/index.ts +0 -30
- package/src/components/popover/popover.tsx +0 -248
- package/src/components/preview-shell/index.ts +0 -2
- package/src/components/preview-shell/preview-shell.tsx +0 -51
- package/src/components/quoted-message-card/index.ts +0 -36
- package/src/components/quoted-message-card/quoted-message-card.tsx +0 -391
- package/src/components/radio-group/index.ts +0 -2
- package/src/components/radio-group/radio-group.tsx +0 -119
- package/src/components/section-header/index.ts +0 -16
- package/src/components/section-header/section-header.tsx +0 -117
- package/src/components/section-label/index.ts +0 -2
- package/src/components/section-label/section-label.tsx +0 -38
- package/src/components/segmented-control/index.ts +0 -12
- package/src/components/segmented-control/segmented-control.tsx +0 -129
- package/src/components/select/index.ts +0 -40
- package/src/components/select/select.tsx +0 -382
- package/src/components/separator/index.ts +0 -2
- package/src/components/separator/separator.tsx +0 -40
- package/src/components/spinner/index.ts +0 -2
- package/src/components/spinner/spinner.tsx +0 -228
- package/src/components/status/index.ts +0 -2
- package/src/components/status/status.tsx +0 -152
- package/src/components/tabs/index.ts +0 -24
- package/src/components/tabs/tabs.tsx +0 -451
- package/src/components/text/index.ts +0 -2
- package/src/components/text/text.tsx +0 -131
- package/src/components/textarea/index.ts +0 -2
- package/src/components/textarea/textarea.tsx +0 -136
- package/src/components/toggle-group/index.ts +0 -7
- package/src/components/toggle-group/toggle-group.tsx +0 -111
- package/src/components/tooltip/index.ts +0 -8
- package/src/components/tooltip/tooltip.tsx +0 -212
- package/src/index.ts +0 -429
- package/src/legacy/AttentionDot.tsx +0 -28
- package/src/legacy/AvatarListRow.tsx +0 -87
- package/src/legacy/AvatarSlot.tsx +0 -157
- package/src/legacy/Badge.tsx +0 -95
- package/src/legacy/Banner.tsx +0 -74
- package/src/legacy/BottomSheet.tsx +0 -76
- package/src/legacy/CheckMarker.tsx +0 -72
- package/src/legacy/Checkbox.tsx +0 -81
- package/src/legacy/ConversationPreviewCard.tsx +0 -169
- package/src/legacy/DismissBackdrop.tsx +0 -68
- package/src/legacy/EmptyState.tsx +0 -63
- package/src/legacy/ExperimentalBadge.tsx +0 -19
- package/src/legacy/FormField.tsx +0 -106
- package/src/legacy/KeyValueRow.tsx +0 -67
- package/src/legacy/Lightbox.tsx +0 -119
- package/src/legacy/NotificationCenter.tsx +0 -217
- package/src/legacy/PanelHeader.tsx +0 -94
- package/src/legacy/PreviewShell.tsx +0 -40
- package/src/legacy/QuotedMessageCard.tsx +0 -181
- package/src/legacy/ReorderablePanelTabs.tsx +0 -156
- package/src/legacy/SandboxedPreviewFrame.tsx +0 -59
- package/src/legacy/SearchInput.tsx +0 -23
- package/src/legacy/SectionEyebrow.tsx +0 -60
- package/src/legacy/SectionHeader.tsx +0 -68
- package/src/legacy/SegmentedControl.tsx +0 -74
- package/src/legacy/SlugInput.tsx +0 -29
- package/src/legacy/Spinner.tsx +0 -89
- package/src/legacy/StatusDot.tsx +0 -51
- package/src/legacy/SurfaceListItem.tsx +0 -32
- package/src/legacy/Textarea.tsx +0 -137
- package/src/legacy/button.tsx +0 -100
- package/src/legacy/context-menu-divider.tsx +0 -12
- package/src/legacy/menu-item.tsx +0 -66
- package/src/legacy/selection-popover.tsx +0 -212
- package/src/legacy/server-switcher-menu.tsx +0 -203
- package/src/legacy/source.css +0 -240
- package/src/lib/cn.ts +0 -1
- package/src/lib/styled-props.ts +0 -11
- package/src/lib/theme/theme-context.ts +0 -28
- package/src/lib/theme/theme-provider.tsx +0 -181
- package/src/lib/theme/use-theme.ts +0 -12
- package/src/lib/tv.ts +0 -29
- package/src/lib/without-children.ts +0 -6
- package/src/wip.ts +0 -291
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
## [0.0.
|
|
2
|
-
|
|
3
|
-
### Features
|
|
4
|
-
|
|
5
|
-
- **alert-dialog:** add destructive confirmation component ([f3507ae](https://github.com/botiverse/rui/commit/f3507ae0d462575ab67d4b814f7c9a3fb4f94547))
|
|
6
|
-
- **dialog:** add dialog component ([e789e11](https://github.com/botiverse/rui/commit/e789e11e11f909ce8195599baa93a75bee0e38be))
|
|
7
|
-
- **separator:** add separator component ([bd098c9](https://github.com/botiverse/rui/commit/bd098c90b352477ec6ac16f84f4ffe7633dba9ce))
|
|
1
|
+
## [0.0.7](https://github.com/botiverse/rui/compare/v0.0.6...v0.0.7) (2026-06-25)
|
|
8
2
|
|
|
9
3
|
### Bug Fixes
|
|
10
4
|
|
|
11
|
-
- **ui:**
|
|
5
|
+
- **ui:** publish styles from dist ([1fed16f](https://github.com/botiverse/rui/commit/1fed16f7bc0f0982523fbe3de337d1ece926737c))
|
package/{src → dist}/styles.css
RENAMED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "raft-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "React UI components for Raft.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"CHANGELOG.md",
|
|
13
|
-
"dist"
|
|
14
|
-
"src"
|
|
13
|
+
"dist"
|
|
15
14
|
],
|
|
16
15
|
"type": "module",
|
|
17
16
|
"exports": {
|
|
@@ -27,7 +26,7 @@
|
|
|
27
26
|
"types": "./dist/wip.d.mts",
|
|
28
27
|
"default": "./dist/wip.mjs"
|
|
29
28
|
},
|
|
30
|
-
"./styles.css": "./
|
|
29
|
+
"./styles.css": "./dist/styles.css",
|
|
31
30
|
"./package.json": "./package.json"
|
|
32
31
|
},
|
|
33
32
|
"publishConfig": {
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { Dialog as BaseDialog } from "@base-ui/react/dialog";
|
|
2
|
-
import type { ComponentPropsWithRef } from "react";
|
|
3
|
-
import { tv } from "../../lib/tv";
|
|
4
|
-
import type { StyledProps } from "../../lib/styled-props";
|
|
5
|
-
import { useThemeFamily } from "../../lib/theme/use-theme";
|
|
6
|
-
import { Button, type ButtonProps } from "../button/index";
|
|
7
|
-
|
|
8
|
-
const alertDialog = tv({
|
|
9
|
-
slots: {
|
|
10
|
-
overlay: [
|
|
11
|
-
"fixed inset-0 z-50",
|
|
12
|
-
"transition-opacity duration-100",
|
|
13
|
-
"data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
|
|
14
|
-
],
|
|
15
|
-
content: [
|
|
16
|
-
"fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2",
|
|
17
|
-
"outline-none transition-[opacity,transform] duration-100",
|
|
18
|
-
"data-[starting-style]:scale-95 data-[starting-style]:opacity-0",
|
|
19
|
-
"data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
|
|
20
|
-
],
|
|
21
|
-
header: ["grid min-w-0 gap-1"],
|
|
22
|
-
media: ["flex size-10 shrink-0 items-center justify-center"],
|
|
23
|
-
body: ["min-w-0"],
|
|
24
|
-
footer: ["flex items-center justify-end gap-3"],
|
|
25
|
-
title: ["m-0 min-w-0 text-foreground-strong"],
|
|
26
|
-
description: ["m-0 text-foreground-muted"],
|
|
27
|
-
},
|
|
28
|
-
variants: {
|
|
29
|
-
theme: {
|
|
30
|
-
brutal: {
|
|
31
|
-
overlay: ["bg-black/60"],
|
|
32
|
-
content: ["gap-4 border-2 border-line-strong bg-layer-panel p-6 shadow-xl"],
|
|
33
|
-
media: ["border-2 border-line-strong bg-warning-base text-foreground-inverse"],
|
|
34
|
-
title: ["font-heading text-lg leading-none font-bold uppercase"],
|
|
35
|
-
description: ["font-sans text-sm leading-5 text-foreground/60"],
|
|
36
|
-
},
|
|
37
|
-
elegant: {
|
|
38
|
-
overlay: ["bg-black/20"],
|
|
39
|
-
content: [
|
|
40
|
-
"gap-5 rounded-lg bg-layer-popover p-5",
|
|
41
|
-
"shadow-[0_24px_48px_-24px_oklch(0.21_0.006_285_/_0.30),0_0_0_1px_oklch(0.21_0.006_285_/_0.08),0_1px_2px_oklch(0.21_0.006_285_/_0.08)]",
|
|
42
|
-
],
|
|
43
|
-
media: ["rounded-md bg-danger-lighter text-danger-base"],
|
|
44
|
-
title: ["font-sans text-base leading-5 font-medium tracking-[-0.005em]"],
|
|
45
|
-
description: [
|
|
46
|
-
"font-sans text-sm leading-5 text-[oklch(0.48_0_0)] dark:text-[oklch(0.76_0_0)]",
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
size: {
|
|
51
|
-
sm: {
|
|
52
|
-
content: ["max-w-sm"],
|
|
53
|
-
},
|
|
54
|
-
md: {
|
|
55
|
-
content: ["max-w-md"],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
defaultVariants: {
|
|
60
|
-
size: "sm",
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
export type AlertDialogProps = BaseDialog.Root.Props;
|
|
65
|
-
|
|
66
|
-
export function AlertDialog(props: AlertDialogProps) {
|
|
67
|
-
return <BaseDialog.Root data-slot="alert-dialog" {...props} />;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type AlertDialogTriggerProps = BaseDialog.Trigger.Props;
|
|
71
|
-
|
|
72
|
-
export function AlertDialogTrigger(props: AlertDialogTriggerProps) {
|
|
73
|
-
return <BaseDialog.Trigger data-slot="alert-dialog-trigger" {...props} />;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type AlertDialogPortalProps = BaseDialog.Portal.Props;
|
|
77
|
-
|
|
78
|
-
export function AlertDialogPortal(props: AlertDialogPortalProps) {
|
|
79
|
-
return <BaseDialog.Portal data-slot="alert-dialog-portal" {...props} />;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export type AlertDialogOverlayProps = StyledProps<BaseDialog.Backdrop.Props>;
|
|
83
|
-
|
|
84
|
-
export function AlertDialogOverlay({ className, ...props }: AlertDialogOverlayProps) {
|
|
85
|
-
const theme = useThemeFamily();
|
|
86
|
-
const { overlay } = alertDialog({ theme });
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<BaseDialog.Backdrop
|
|
90
|
-
data-slot="alert-dialog-overlay"
|
|
91
|
-
className={overlay({ className })}
|
|
92
|
-
{...props}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export type AlertDialogContentProps = StyledProps<BaseDialog.Popup.Props> & {
|
|
98
|
-
portalProps?: AlertDialogPortalProps;
|
|
99
|
-
overlay?: false | AlertDialogOverlayProps;
|
|
100
|
-
size?: "sm" | "md";
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export function AlertDialogContent({
|
|
104
|
-
className,
|
|
105
|
-
children,
|
|
106
|
-
portalProps,
|
|
107
|
-
overlay,
|
|
108
|
-
size,
|
|
109
|
-
...props
|
|
110
|
-
}: AlertDialogContentProps) {
|
|
111
|
-
const theme = useThemeFamily();
|
|
112
|
-
const { content } = alertDialog({ theme, size });
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<AlertDialogPortal {...portalProps}>
|
|
116
|
-
{overlay === false ? null : <AlertDialogOverlay {...overlay} />}
|
|
117
|
-
<BaseDialog.Popup
|
|
118
|
-
data-slot="alert-dialog-content"
|
|
119
|
-
className={content({ className })}
|
|
120
|
-
{...props}
|
|
121
|
-
role="alertdialog"
|
|
122
|
-
>
|
|
123
|
-
{children}
|
|
124
|
-
</BaseDialog.Popup>
|
|
125
|
-
</AlertDialogPortal>
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export type AlertDialogHeaderProps = ComponentPropsWithRef<"div">;
|
|
130
|
-
|
|
131
|
-
export function AlertDialogHeader({ className, ...props }: AlertDialogHeaderProps) {
|
|
132
|
-
const theme = useThemeFamily();
|
|
133
|
-
const { header } = alertDialog({ theme });
|
|
134
|
-
|
|
135
|
-
return <div data-slot="alert-dialog-header" className={header({ className })} {...props} />;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export type AlertDialogMediaProps = ComponentPropsWithRef<"div">;
|
|
139
|
-
|
|
140
|
-
export function AlertDialogMedia({ className, ...props }: AlertDialogMediaProps) {
|
|
141
|
-
const theme = useThemeFamily();
|
|
142
|
-
const { media } = alertDialog({ theme });
|
|
143
|
-
|
|
144
|
-
return <div data-slot="alert-dialog-media" className={media({ className })} {...props} />;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export type AlertDialogBodyProps = ComponentPropsWithRef<"div">;
|
|
148
|
-
|
|
149
|
-
export function AlertDialogBody({ className, ...props }: AlertDialogBodyProps) {
|
|
150
|
-
const theme = useThemeFamily();
|
|
151
|
-
const { body } = alertDialog({ theme });
|
|
152
|
-
|
|
153
|
-
return <div data-slot="alert-dialog-body" className={body({ className })} {...props} />;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export type AlertDialogFooterProps = ComponentPropsWithRef<"div">;
|
|
157
|
-
|
|
158
|
-
export function AlertDialogFooter({ className, ...props }: AlertDialogFooterProps) {
|
|
159
|
-
const theme = useThemeFamily();
|
|
160
|
-
const { footer } = alertDialog({ theme });
|
|
161
|
-
|
|
162
|
-
return <div data-slot="alert-dialog-footer" className={footer({ className })} {...props} />;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export type AlertDialogTitleProps = StyledProps<BaseDialog.Title.Props>;
|
|
166
|
-
|
|
167
|
-
export function AlertDialogTitle({ className, ...props }: AlertDialogTitleProps) {
|
|
168
|
-
const theme = useThemeFamily();
|
|
169
|
-
const { title } = alertDialog({ theme });
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<BaseDialog.Title data-slot="alert-dialog-title" className={title({ className })} {...props} />
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export type AlertDialogDescriptionProps = StyledProps<BaseDialog.Description.Props>;
|
|
177
|
-
|
|
178
|
-
export function AlertDialogDescription({ className, ...props }: AlertDialogDescriptionProps) {
|
|
179
|
-
const theme = useThemeFamily();
|
|
180
|
-
const { description } = alertDialog({ theme });
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<BaseDialog.Description
|
|
184
|
-
data-slot="alert-dialog-description"
|
|
185
|
-
className={description({ className })}
|
|
186
|
-
{...props}
|
|
187
|
-
/>
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export type AlertDialogActionProps = ButtonProps;
|
|
192
|
-
|
|
193
|
-
export function AlertDialogAction(props: AlertDialogActionProps) {
|
|
194
|
-
return <Button data-slot="alert-dialog-action" {...props} />;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export type AlertDialogCancelProps = Omit<BaseDialog.Close.Props, "render"> &
|
|
198
|
-
Pick<ButtonProps, "variant" | "size"> & {
|
|
199
|
-
className?: string;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export function AlertDialogCancel({
|
|
203
|
-
className,
|
|
204
|
-
variant = "outline",
|
|
205
|
-
size = "sm",
|
|
206
|
-
...props
|
|
207
|
-
}: AlertDialogCancelProps) {
|
|
208
|
-
return (
|
|
209
|
-
<BaseDialog.Close
|
|
210
|
-
data-slot="alert-dialog-cancel"
|
|
211
|
-
render={<Button className={className} variant={variant} size={size} />}
|
|
212
|
-
{...props}
|
|
213
|
-
/>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
AlertDialog,
|
|
3
|
-
AlertDialogAction,
|
|
4
|
-
AlertDialogBody,
|
|
5
|
-
AlertDialogCancel,
|
|
6
|
-
AlertDialogContent,
|
|
7
|
-
AlertDialogDescription,
|
|
8
|
-
AlertDialogFooter,
|
|
9
|
-
AlertDialogHeader,
|
|
10
|
-
AlertDialogMedia,
|
|
11
|
-
AlertDialogOverlay,
|
|
12
|
-
AlertDialogPortal,
|
|
13
|
-
AlertDialogTitle,
|
|
14
|
-
AlertDialogTrigger,
|
|
15
|
-
} from "./alert-dialog";
|
|
16
|
-
export type {
|
|
17
|
-
AlertDialogActionProps,
|
|
18
|
-
AlertDialogBodyProps,
|
|
19
|
-
AlertDialogCancelProps,
|
|
20
|
-
AlertDialogContentProps,
|
|
21
|
-
AlertDialogDescriptionProps,
|
|
22
|
-
AlertDialogFooterProps,
|
|
23
|
-
AlertDialogHeaderProps,
|
|
24
|
-
AlertDialogMediaProps,
|
|
25
|
-
AlertDialogOverlayProps,
|
|
26
|
-
AlertDialogPortalProps,
|
|
27
|
-
AlertDialogProps,
|
|
28
|
-
AlertDialogTitleProps,
|
|
29
|
-
AlertDialogTriggerProps,
|
|
30
|
-
} from "./alert-dialog";
|
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef } from "react";
|
|
2
|
-
import { Avatar as AvatarPrimitive } from "@base-ui/react";
|
|
3
|
-
import { tv, type VariantProps } from "../../lib/tv";
|
|
4
|
-
import { useThemeFamily } from "../../lib/theme/use-theme";
|
|
5
|
-
import type { StyledProps } from "../../lib/styled-props";
|
|
6
|
-
|
|
7
|
-
// Avatar family built on Base UI's Avatar primitive. Compose `<AvatarImage>`,
|
|
8
|
-
// `<AvatarFallback>`, and `<AvatarBadge>` as children; with no children a
|
|
9
|
-
// default `<AvatarFallback>` renders the placeholder. All parts share one
|
|
10
|
-
// `tv()` slots config so theme / type / size styling lives in a single place.
|
|
11
|
-
//
|
|
12
|
-
// The original's avatar fetching (`AgentAvatar` / `GravatarAvatar`, app domain)
|
|
13
|
-
// is dropped: pass a URL via `<AvatarImage src>` and a custom fallback node via
|
|
14
|
-
// `<AvatarFallback>`.
|
|
15
|
-
//
|
|
16
|
-
// `size` is a compact t-shirt scale distilled from the original call-site
|
|
17
|
-
// contexts: xl profile/detail (64), lg mention/large identity (48), md panel
|
|
18
|
-
// header (36), sm list rows (32), xs compact/sidebar rows (20), and 2xs inline
|
|
19
|
-
// preview chips (14). One-off source contexts such as account-tile, members-row,
|
|
20
|
-
// and creator-link no longer get public size names.
|
|
21
|
-
// Brutal border weight follows size: >=32px frames use `border-2`, smaller ones
|
|
22
|
-
// `border`; elegant uses a pseudo-element hairline. `AvatarFallback` /
|
|
23
|
-
// `AvatarBadge` auto-scale to the parent via its `data-size` + `group/avatar`
|
|
24
|
-
// hook; keep their per-step selectors in sync with the `size` scale.
|
|
25
|
-
const avatar = tv({
|
|
26
|
-
slots: {
|
|
27
|
-
root: ["group/avatar relative flex shrink-0 items-center justify-center select-none"],
|
|
28
|
-
image: ["size-full object-cover"],
|
|
29
|
-
fallback: [
|
|
30
|
-
"flex size-full items-center justify-center",
|
|
31
|
-
"[&>svg]:size-4",
|
|
32
|
-
"group-data-[size=xl]/avatar:[&>svg]:size-6",
|
|
33
|
-
"group-data-[size=lg]/avatar:[&>svg]:size-6",
|
|
34
|
-
"group-data-[size=md]/avatar:[&>svg]:size-[18px]",
|
|
35
|
-
"group-data-[size=sm]/avatar:[&>svg]:size-4",
|
|
36
|
-
"group-data-[size=xs]/avatar:[&>svg]:size-3",
|
|
37
|
-
"group-data-[size=2xs]/avatar:[&>svg]:size-2.5",
|
|
38
|
-
],
|
|
39
|
-
badge: [
|
|
40
|
-
"absolute right-0 bottom-0 z-10 translate-x-1/4 translate-y-1/4 select-none",
|
|
41
|
-
"inline-flex items-center justify-center rounded-full outline-2 outline-white",
|
|
42
|
-
"size-2 [&>svg]:hidden",
|
|
43
|
-
"group-data-[size=xl]/avatar:size-3.5 group-data-[size=xl]/avatar:[&>svg]:size-2 group-data-[size=xl]/avatar:[&>svg]:block",
|
|
44
|
-
"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2 group-data-[size=lg]/avatar:[&>svg]:block",
|
|
45
|
-
"group-data-[size=md]/avatar:size-2.5 group-data-[size=md]/avatar:[&>svg]:size-1.5 group-data-[size=md]/avatar:[&>svg]:block",
|
|
46
|
-
"group-data-[size=sm]/avatar:size-2",
|
|
47
|
-
"group-data-[size=xs]/avatar:size-1.5 group-data-[size=xs]/avatar:outline",
|
|
48
|
-
"group-data-[size=2xs]/avatar:size-1.5 group-data-[size=2xs]/avatar:outline",
|
|
49
|
-
],
|
|
50
|
-
group: ["group/avatar-group flex items-center"],
|
|
51
|
-
},
|
|
52
|
-
variants: {
|
|
53
|
-
theme: {
|
|
54
|
-
brutal: {
|
|
55
|
-
root: "border-line-strong",
|
|
56
|
-
fallback: "text-black",
|
|
57
|
-
badge: ["bg-success-base text-foreground-strong"],
|
|
58
|
-
group: [
|
|
59
|
-
"-space-x-1.5",
|
|
60
|
-
"*:data-[slot=avatar]:outline *:data-[slot=avatar]:outline-2 *:data-[slot=avatar]:outline-primary-50",
|
|
61
|
-
"*:data-[slot=avatar-group-count]:outline *:data-[slot=avatar-group-count]:outline-2 *:data-[slot=avatar-group-count]:outline-primary-50",
|
|
62
|
-
],
|
|
63
|
-
},
|
|
64
|
-
elegant: {
|
|
65
|
-
root: ["bg-layer-muted"],
|
|
66
|
-
image: ["rounded-full"],
|
|
67
|
-
fallback: [
|
|
68
|
-
"overflow-hidden bg-layer-muted text-foreground-placeholder/70 text-sm",
|
|
69
|
-
"rounded-full",
|
|
70
|
-
"group-data-[size=xs]/avatar:text-xs",
|
|
71
|
-
"group-data-[size=2xs]/avatar:text-[10px]",
|
|
72
|
-
],
|
|
73
|
-
badge: [
|
|
74
|
-
"translate-x-0 translate-y-0 bg-success-base text-foreground-inverse",
|
|
75
|
-
"right-0.5 bottom-0.5",
|
|
76
|
-
"group-data-[size=xl]/avatar:right-1 group-data-[size=xl]/avatar:bottom-1",
|
|
77
|
-
"group-data-[size=lg]/avatar:right-0.75 group-data-[size=lg]/avatar:bottom-0.75",
|
|
78
|
-
],
|
|
79
|
-
group: [
|
|
80
|
-
"-space-x-2",
|
|
81
|
-
"*:data-[slot=avatar]:outline *:data-[slot=avatar]:outline-2 *:data-[slot=avatar]:outline-background",
|
|
82
|
-
"*:data-[slot=avatar-group-count]:outline *:data-[slot=avatar-group-count]:outline-2 *:data-[slot=avatar-group-count]:outline-background",
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
type: {
|
|
87
|
-
agent: {},
|
|
88
|
-
human: {},
|
|
89
|
-
},
|
|
90
|
-
size: {
|
|
91
|
-
xl: { root: "size-16" },
|
|
92
|
-
lg: { root: "size-12" },
|
|
93
|
-
md: { root: "size-9" },
|
|
94
|
-
sm: { root: "size-8" },
|
|
95
|
-
xs: { root: "size-5" },
|
|
96
|
-
"2xs": { root: "size-[14px]" },
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
compoundVariants: [
|
|
100
|
-
{
|
|
101
|
-
theme: "brutal",
|
|
102
|
-
size: ["xl", "lg", "md", "sm"],
|
|
103
|
-
class: { root: "border-2" },
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
theme: "brutal",
|
|
107
|
-
size: ["xs", "2xs"],
|
|
108
|
-
class: { root: "border" },
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
theme: "brutal",
|
|
112
|
-
type: "agent",
|
|
113
|
-
class: { root: "bg-info-base" },
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
theme: "brutal",
|
|
117
|
-
type: "human",
|
|
118
|
-
class: { root: "bg-brutal-purple text-foreground-strong" },
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
theme: "elegant",
|
|
122
|
-
size: "xl",
|
|
123
|
-
class: {
|
|
124
|
-
root: "rounded-full",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
theme: "elegant",
|
|
129
|
-
size: "lg",
|
|
130
|
-
class: {
|
|
131
|
-
root: "rounded-full",
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
theme: "elegant",
|
|
136
|
-
size: ["md", "sm"],
|
|
137
|
-
class: {
|
|
138
|
-
root: "rounded-full",
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
theme: "elegant",
|
|
143
|
-
size: "xs",
|
|
144
|
-
class: {
|
|
145
|
-
root: "rounded-full",
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
theme: "elegant",
|
|
150
|
-
size: "2xs",
|
|
151
|
-
class: {
|
|
152
|
-
root: "rounded-full",
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
theme: "elegant",
|
|
157
|
-
type: "agent",
|
|
158
|
-
class: { root: "text-foreground-muted" },
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
theme: "elegant",
|
|
162
|
-
type: "human",
|
|
163
|
-
class: { root: "text-foreground-muted" },
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
export type AvatarSize = NonNullable<VariantProps<typeof avatar>["size"]>;
|
|
169
|
-
|
|
170
|
-
export type AvatarProps = StyledProps<AvatarPrimitive.Root.Props> &
|
|
171
|
-
Required<Pick<VariantProps<typeof avatar>, "size" | "type">>;
|
|
172
|
-
|
|
173
|
-
export function Avatar({ size, type, className, children, ...props }: AvatarProps) {
|
|
174
|
-
const theme = useThemeFamily();
|
|
175
|
-
const { root } = avatar({ theme, type, size });
|
|
176
|
-
return (
|
|
177
|
-
<AvatarPrimitive.Root
|
|
178
|
-
data-slot="avatar"
|
|
179
|
-
data-size={size}
|
|
180
|
-
className={root({ className })}
|
|
181
|
-
{...props}
|
|
182
|
-
>
|
|
183
|
-
{children ?? <AvatarFallback />}
|
|
184
|
-
</AvatarPrimitive.Root>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export type AvatarImageProps = StyledProps<AvatarPrimitive.Image.Props>;
|
|
189
|
-
|
|
190
|
-
// Managed avatar image. Base UI tracks its load state and hides it (revealing the
|
|
191
|
-
// fallback) while loading or on error. Fills the frame edge-to-edge.
|
|
192
|
-
export function AvatarImage({ className, ...props }: AvatarImageProps) {
|
|
193
|
-
const theme = useThemeFamily();
|
|
194
|
-
const { image } = avatar({ theme });
|
|
195
|
-
return (
|
|
196
|
-
<AvatarPrimitive.Image data-slot="avatar-image" className={image({ className })} {...props} />
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export type AvatarFallbackProps = StyledProps<AvatarPrimitive.Fallback.Props>;
|
|
201
|
-
|
|
202
|
-
function AvatarFallbackIcon() {
|
|
203
|
-
return (
|
|
204
|
-
<svg
|
|
205
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
206
|
-
width="18"
|
|
207
|
-
height="18"
|
|
208
|
-
viewBox="0 0 18 18"
|
|
209
|
-
aria-hidden="true"
|
|
210
|
-
focusable="false"
|
|
211
|
-
>
|
|
212
|
-
<g
|
|
213
|
-
fill="none"
|
|
214
|
-
strokeLinecap="round"
|
|
215
|
-
strokeLinejoin="round"
|
|
216
|
-
strokeWidth="1"
|
|
217
|
-
stroke="currentColor"
|
|
218
|
-
>
|
|
219
|
-
<circle cx="9" cy="7.75" r="2" />
|
|
220
|
-
<path d="M9,16.25c1.407,0,2.716-.407,3.827-1.101-.481-1.67-2.003-2.899-3.827-2.899s-3.347,1.229-3.827,2.899c1.112,.694,2.42,1.101,3.827,1.101Z" />
|
|
221
|
-
<circle
|
|
222
|
-
cx="1.889"
|
|
223
|
-
cy="10.414"
|
|
224
|
-
r=".75"
|
|
225
|
-
fill="currentColor"
|
|
226
|
-
data-stroke="none"
|
|
227
|
-
stroke="none"
|
|
228
|
-
/>
|
|
229
|
-
<circle
|
|
230
|
-
cx="2.971"
|
|
231
|
-
cy="4.972"
|
|
232
|
-
r=".75"
|
|
233
|
-
fill="currentColor"
|
|
234
|
-
data-stroke="none"
|
|
235
|
-
stroke="none"
|
|
236
|
-
/>
|
|
237
|
-
<circle
|
|
238
|
-
cx="2.972"
|
|
239
|
-
cy="13.027"
|
|
240
|
-
r=".75"
|
|
241
|
-
fill="currentColor"
|
|
242
|
-
data-stroke="none"
|
|
243
|
-
stroke="none"
|
|
244
|
-
/>
|
|
245
|
-
<circle cx="1.89" cy="7.586" r=".75" fill="currentColor" data-stroke="none" stroke="none" />
|
|
246
|
-
<circle
|
|
247
|
-
cx="4.973"
|
|
248
|
-
cy="2.972"
|
|
249
|
-
r=".75"
|
|
250
|
-
fill="currentColor"
|
|
251
|
-
data-stroke="none"
|
|
252
|
-
stroke="none"
|
|
253
|
-
/>
|
|
254
|
-
<circle
|
|
255
|
-
cx="7.586"
|
|
256
|
-
cy="1.889"
|
|
257
|
-
r=".75"
|
|
258
|
-
fill="currentColor"
|
|
259
|
-
data-stroke="none"
|
|
260
|
-
stroke="none"
|
|
261
|
-
/>
|
|
262
|
-
<circle
|
|
263
|
-
cx="15.029"
|
|
264
|
-
cy="13.028"
|
|
265
|
-
r=".75"
|
|
266
|
-
fill="currentColor"
|
|
267
|
-
data-stroke="none"
|
|
268
|
-
stroke="none"
|
|
269
|
-
/>
|
|
270
|
-
<circle
|
|
271
|
-
cx="16.111"
|
|
272
|
-
cy="7.586"
|
|
273
|
-
r=".75"
|
|
274
|
-
fill="currentColor"
|
|
275
|
-
data-stroke="none"
|
|
276
|
-
stroke="none"
|
|
277
|
-
/>
|
|
278
|
-
<circle
|
|
279
|
-
cx="13.028"
|
|
280
|
-
cy="2.971"
|
|
281
|
-
r=".75"
|
|
282
|
-
fill="currentColor"
|
|
283
|
-
data-stroke="none"
|
|
284
|
-
stroke="none"
|
|
285
|
-
/>
|
|
286
|
-
<circle
|
|
287
|
-
cx="16.11"
|
|
288
|
-
cy="10.414"
|
|
289
|
-
r=".75"
|
|
290
|
-
fill="currentColor"
|
|
291
|
-
data-stroke="none"
|
|
292
|
-
stroke="none"
|
|
293
|
-
/>
|
|
294
|
-
<circle
|
|
295
|
-
cx="15.028"
|
|
296
|
-
cy="4.973"
|
|
297
|
-
r=".75"
|
|
298
|
-
fill="currentColor"
|
|
299
|
-
data-stroke="none"
|
|
300
|
-
stroke="none"
|
|
301
|
-
/>
|
|
302
|
-
<circle
|
|
303
|
-
cx="10.414"
|
|
304
|
-
cy="1.89"
|
|
305
|
-
r=".75"
|
|
306
|
-
fill="currentColor"
|
|
307
|
-
data-stroke="none"
|
|
308
|
-
stroke="none"
|
|
309
|
-
/>
|
|
310
|
-
</g>
|
|
311
|
-
</svg>
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// Shown when no AvatarImage has loaded. With no children it renders the
|
|
316
|
-
// placeholder user icon, auto-scaled via the parent's `data-size` hook.
|
|
317
|
-
export function AvatarFallback({ className, children, ...props }: AvatarFallbackProps) {
|
|
318
|
-
const theme = useThemeFamily();
|
|
319
|
-
const { fallback } = avatar({ theme });
|
|
320
|
-
return (
|
|
321
|
-
<AvatarPrimitive.Fallback
|
|
322
|
-
data-slot="avatar-fallback"
|
|
323
|
-
className={fallback({ className })}
|
|
324
|
-
{...props}
|
|
325
|
-
>
|
|
326
|
-
{children ?? <AvatarFallbackIcon />}
|
|
327
|
-
</AvatarPrimitive.Fallback>
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
export type AvatarBadgeProps = ComponentPropsWithRef<"span">;
|
|
332
|
-
|
|
333
|
-
// Presence/status badge overlaid in the avatar's bottom-right corner. The root
|
|
334
|
-
// stays overflow-visible so the badge can sit on the frame edge. Default fill is
|
|
335
|
-
// lime; override with a `bg-*` class via className. Optionally wraps a small icon.
|
|
336
|
-
export function AvatarBadge({ className, ...props }: AvatarBadgeProps) {
|
|
337
|
-
const theme = useThemeFamily();
|
|
338
|
-
const { badge } = avatar({ theme });
|
|
339
|
-
return <span data-slot="avatar-badge" className={badge({ className })} {...props} />;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
export type AvatarGroupProps = ComponentPropsWithRef<"div">;
|
|
343
|
-
|
|
344
|
-
// Overlapping stack of avatars (and an optional trailing AvatarGroupCount). The
|
|
345
|
-
// ring color follows the active theme's surface assumptions.
|
|
346
|
-
export function AvatarGroup({ className, ...props }: AvatarGroupProps) {
|
|
347
|
-
const theme = useThemeFamily();
|
|
348
|
-
const { group } = avatar({ theme });
|
|
349
|
-
return <div data-slot="avatar-group" className={group({ className })} {...props} />;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
export type AvatarGroupCountProps = ComponentPropsWithRef<"span"> & {
|
|
353
|
-
/** Matches the frame scale of the sibling avatars. */
|
|
354
|
-
size: AvatarSize;
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
// Trailing "+N" overflow chip for an AvatarGroup. Reuses the Avatar frame but
|
|
358
|
-
// omits `type`, swapping the role fill for a neutral count chip.
|
|
359
|
-
export function AvatarGroupCount({ size, className, ...props }: AvatarGroupCountProps) {
|
|
360
|
-
const theme = useThemeFamily();
|
|
361
|
-
const { root } = avatar({ theme, size });
|
|
362
|
-
const countClassName =
|
|
363
|
-
theme === "elegant"
|
|
364
|
-
? "bg-layer-muted font-medium text-xs leading-none tabular-nums text-foreground-muted"
|
|
365
|
-
: "bg-secondary-400 font-bold text-xs leading-none tabular-nums text-foreground-strong";
|
|
366
|
-
return (
|
|
367
|
-
<span
|
|
368
|
-
data-slot="avatar-group-count"
|
|
369
|
-
className={root({
|
|
370
|
-
class: [countClassName, className],
|
|
371
|
-
})}
|
|
372
|
-
{...props}
|
|
373
|
-
/>
|
|
374
|
-
);
|
|
375
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
Avatar,
|
|
3
|
-
type AvatarSize,
|
|
4
|
-
AvatarImage,
|
|
5
|
-
AvatarFallback,
|
|
6
|
-
AvatarBadge,
|
|
7
|
-
AvatarGroup,
|
|
8
|
-
AvatarGroupCount,
|
|
9
|
-
} from "./avatar";
|
|
10
|
-
export type {
|
|
11
|
-
AvatarProps,
|
|
12
|
-
AvatarImageProps,
|
|
13
|
-
AvatarFallbackProps,
|
|
14
|
-
AvatarBadgeProps,
|
|
15
|
-
AvatarGroupProps,
|
|
16
|
-
AvatarGroupCountProps,
|
|
17
|
-
} from "./avatar";
|