raft-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/dist/cn.d.mts +2 -0
- package/dist/cn.mjs +2 -0
- package/dist/index.d.mts +2710 -0
- package/dist/index.mjs +4821 -0
- package/dist/label-DWq4ia5I.mjs +115 -0
- package/dist/styled-props-B3SNekJg.d.mts +16 -0
- package/dist/wip.d.mts +1238 -0
- package/dist/wip.mjs +1416 -0
- package/package.json +70 -0
- package/src/components/avatar/avatar.tsx +375 -0
- package/src/components/avatar/index.ts +17 -0
- package/src/components/badge/badge.tsx +393 -0
- package/src/components/badge/index.ts +2 -0
- package/src/components/banner/banner.tsx +269 -0
- package/src/components/banner/index.ts +8 -0
- package/src/components/bottom-sheet/bottom-sheet.tsx +152 -0
- package/src/components/bottom-sheet/index.ts +22 -0
- package/src/components/button/button.tsx +497 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/checkbox/checkbox-indicator.tsx +128 -0
- package/src/components/checkbox/checkbox.tsx +350 -0
- package/src/components/checkbox/index.ts +2 -0
- package/src/components/combobox/combobox.tsx +603 -0
- package/src/components/combobox/index.ts +52 -0
- package/src/components/context-menu/context-menu.tsx +380 -0
- package/src/components/context-menu/index.ts +34 -0
- package/src/components/conversation-preview-card/conversation-preview-card.tsx +336 -0
- package/src/components/conversation-preview-card/index.ts +32 -0
- package/src/components/description-list/description-list.tsx +116 -0
- package/src/components/description-list/index.ts +14 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +405 -0
- package/src/components/dropdown-menu/index.ts +38 -0
- package/src/components/empty-state/empty-state.tsx +177 -0
- package/src/components/empty-state/index.ts +16 -0
- package/src/components/field/field.tsx +125 -0
- package/src/components/field/index.ts +18 -0
- package/src/components/inline-code/index.ts +2 -0
- package/src/components/inline-code/inline-code.tsx +33 -0
- package/src/components/input/index.ts +2 -0
- package/src/components/input/input.tsx +76 -0
- package/src/components/input-group/index.ts +7 -0
- package/src/components/input-group/input-group.tsx +215 -0
- package/src/components/kbd/index.ts +2 -0
- package/src/components/kbd/kbd.tsx +43 -0
- package/src/components/label/index.ts +7 -0
- package/src/components/label/label.tsx +99 -0
- package/src/components/lightbox/index.ts +24 -0
- package/src/components/lightbox/lightbox.tsx +245 -0
- package/src/components/list-item/index.ts +20 -0
- package/src/components/list-item/list-item.tsx +263 -0
- package/src/components/media-list-item/index.ts +20 -0
- package/src/components/media-list-item/media-list-item.tsx +169 -0
- package/src/components/notification-center/index.ts +39 -0
- package/src/components/notification-center/notification-center.tsx +558 -0
- package/src/components/panel-header/index.ts +22 -0
- package/src/components/panel-header/panel-header.tsx +199 -0
- package/src/components/popover/index.ts +30 -0
- package/src/components/popover/popover.tsx +248 -0
- package/src/components/preview-shell/index.ts +2 -0
- package/src/components/preview-shell/preview-shell.tsx +51 -0
- package/src/components/quoted-message-card/index.ts +36 -0
- package/src/components/quoted-message-card/quoted-message-card.tsx +391 -0
- package/src/components/radio-group/index.ts +6 -0
- package/src/components/radio-group/radio-group.tsx +119 -0
- package/src/components/section-header/index.ts +16 -0
- package/src/components/section-header/section-header.tsx +117 -0
- package/src/components/section-label/index.ts +2 -0
- package/src/components/section-label/section-label.tsx +38 -0
- package/src/components/segmented-control/index.ts +12 -0
- package/src/components/segmented-control/segmented-control.tsx +129 -0
- package/src/components/select/index.ts +40 -0
- package/src/components/select/select.tsx +382 -0
- package/src/components/spinner/index.ts +2 -0
- package/src/components/spinner/spinner.tsx +228 -0
- package/src/components/status/index.ts +2 -0
- package/src/components/status/status.tsx +152 -0
- package/src/components/tabs/index.ts +24 -0
- package/src/components/tabs/tabs.tsx +417 -0
- package/src/components/text/index.ts +2 -0
- package/src/components/text/text.tsx +130 -0
- package/src/components/textarea/index.ts +2 -0
- package/src/components/textarea/textarea.tsx +136 -0
- package/src/components/toggle-group/index.ts +12 -0
- package/src/components/toggle-group/toggle-group.tsx +111 -0
- package/src/components/tooltip/index.ts +14 -0
- package/src/components/tooltip/tooltip.tsx +186 -0
- package/src/fonts/brutal.css +2 -0
- package/src/index.ts +404 -0
- package/src/legacy/AttentionDot.tsx +28 -0
- package/src/legacy/AvatarListRow.tsx +87 -0
- package/src/legacy/AvatarSlot.tsx +157 -0
- package/src/legacy/Badge.tsx +95 -0
- package/src/legacy/Banner.tsx +74 -0
- package/src/legacy/BottomSheet.tsx +76 -0
- package/src/legacy/CheckMarker.tsx +72 -0
- package/src/legacy/Checkbox.tsx +81 -0
- package/src/legacy/ConversationPreviewCard.tsx +169 -0
- package/src/legacy/DismissBackdrop.tsx +68 -0
- package/src/legacy/EmptyState.tsx +63 -0
- package/src/legacy/ExperimentalBadge.tsx +19 -0
- package/src/legacy/FormField.tsx +106 -0
- package/src/legacy/KeyValueRow.tsx +67 -0
- package/src/legacy/Lightbox.tsx +119 -0
- package/src/legacy/NotificationCenter.tsx +217 -0
- package/src/legacy/PanelHeader.tsx +94 -0
- package/src/legacy/PreviewShell.tsx +40 -0
- package/src/legacy/QuotedMessageCard.tsx +181 -0
- package/src/legacy/ReorderablePanelTabs.tsx +151 -0
- package/src/legacy/SandboxedPreviewFrame.tsx +59 -0
- package/src/legacy/SearchInput.tsx +23 -0
- package/src/legacy/SectionEyebrow.tsx +60 -0
- package/src/legacy/SectionHeader.tsx +68 -0
- package/src/legacy/SegmentedControl.tsx +74 -0
- package/src/legacy/SlugInput.tsx +29 -0
- package/src/legacy/Spinner.tsx +89 -0
- package/src/legacy/StatusDot.tsx +51 -0
- package/src/legacy/SurfaceListItem.tsx +32 -0
- package/src/legacy/Textarea.tsx +137 -0
- package/src/legacy/button.tsx +100 -0
- package/src/legacy/context-menu-divider.tsx +12 -0
- package/src/legacy/menu-item.tsx +66 -0
- package/src/legacy/selection-popover.tsx +212 -0
- package/src/legacy/server-switcher-menu.tsx +203 -0
- package/src/legacy/source.css +240 -0
- package/src/lib/cn.ts +1 -0
- package/src/lib/styled-props.ts +11 -0
- package/src/lib/theme/theme-context.ts +28 -0
- package/src/lib/theme/theme-provider.tsx +181 -0
- package/src/lib/theme/use-theme.ts +12 -0
- package/src/lib/tv.ts +29 -0
- package/src/lib/without-children.ts +6 -0
- package/src/styles.css +467 -0
- package/src/wip.ts +255 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from "react";
|
|
2
|
+
import { Button as BaseButton } from "@base-ui/react/button";
|
|
3
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
4
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
|
+
import { tv, type VariantProps } from "../../lib/tv.ts";
|
|
6
|
+
import { cn } from "../../lib/cn.ts";
|
|
7
|
+
import { useThemeFamily } from "../../lib/theme/use-theme.ts";
|
|
8
|
+
import { ListItem, type ListItemProps } from "../list-item/list-item.tsx";
|
|
9
|
+
|
|
10
|
+
const mediaItem = tv({
|
|
11
|
+
slots: {
|
|
12
|
+
row: ["group/media-item flex w-full min-w-0 gap-3"],
|
|
13
|
+
body: [
|
|
14
|
+
"flex min-w-0 flex-1 gap-3",
|
|
15
|
+
"items-center group-data-[align=start]/media-item:items-start",
|
|
16
|
+
],
|
|
17
|
+
text: ["min-w-0 flex-1"],
|
|
18
|
+
textInner: [
|
|
19
|
+
"flex min-w-0 flex-wrap items-baseline gap-x-2",
|
|
20
|
+
"group-data-[align=start]/media-item:flex-col group-data-[align=start]/media-item:flex-nowrap group-data-[align=start]/media-item:items-stretch group-data-[align=start]/media-item:gap-x-1 group-data-[align=start]/media-item:gap-y-1",
|
|
21
|
+
],
|
|
22
|
+
visual: ["shrink-0"],
|
|
23
|
+
title: ["truncate text-sm font-bold"],
|
|
24
|
+
subtitle: [
|
|
25
|
+
"font-mono text-xs",
|
|
26
|
+
"[&_svg]:size-3 [&_svg]:shrink-0",
|
|
27
|
+
"group-data-[align=start]/media-item:flex group-data-[align=start]/media-item:min-w-0 group-data-[align=start]/media-item:flex-wrap group-data-[align=start]/media-item:items-center group-data-[align=start]/media-item:gap-x-2 group-data-[align=start]/media-item:gap-y-1",
|
|
28
|
+
],
|
|
29
|
+
aside: ["flex shrink-0 items-center gap-1.5 self-center", "[&_svg]:size-3.5 [&_svg]:shrink-0"],
|
|
30
|
+
actionGroup: [
|
|
31
|
+
"flex shrink-0 items-center gap-1.5 self-center",
|
|
32
|
+
"[&_svg]:size-3.5 [&_svg]:shrink-0",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
variants: {
|
|
36
|
+
theme: {
|
|
37
|
+
brutal: {
|
|
38
|
+
title: "text-foreground-strong",
|
|
39
|
+
subtitle: "text-foreground/50",
|
|
40
|
+
},
|
|
41
|
+
// Elegant styling is deferred; see the component TODO.
|
|
42
|
+
elegant: {},
|
|
43
|
+
},
|
|
44
|
+
align: {
|
|
45
|
+
start: { row: "items-start" },
|
|
46
|
+
center: { row: "items-center" },
|
|
47
|
+
},
|
|
48
|
+
// The button case only: counteract the `<button>` UA `text-align: center`.
|
|
49
|
+
interactive: {
|
|
50
|
+
true: { body: "text-left" },
|
|
51
|
+
false: { body: "" },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
defaultVariants: {
|
|
55
|
+
align: "center",
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export type MediaListItemProps = Pick<VariantProps<typeof mediaItem>, "align"> &
|
|
60
|
+
Pick<ListItemProps, "selected" | "interactive"> &
|
|
61
|
+
ComponentPropsWithRef<"div">;
|
|
62
|
+
|
|
63
|
+
export function MediaListItem({
|
|
64
|
+
align = "center",
|
|
65
|
+
selected,
|
|
66
|
+
interactive,
|
|
67
|
+
className,
|
|
68
|
+
children,
|
|
69
|
+
...props
|
|
70
|
+
}: MediaListItemProps) {
|
|
71
|
+
const { row } = mediaItem({ align });
|
|
72
|
+
return (
|
|
73
|
+
<ListItem
|
|
74
|
+
data-slot="media-list-item"
|
|
75
|
+
selected={selected}
|
|
76
|
+
interactive={interactive ?? false}
|
|
77
|
+
className={cn(
|
|
78
|
+
"group px-3 py-2 has-[[data-interactive=true]]:hover:border-line-strong has-[[data-interactive=true]]:hover:shadow-sm",
|
|
79
|
+
className,
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
<div data-align={align} className={row()} {...props}>
|
|
83
|
+
{children}
|
|
84
|
+
</div>
|
|
85
|
+
</ListItem>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export type MediaListItemBodyProps = useRender.ComponentProps<"button">;
|
|
90
|
+
|
|
91
|
+
export function MediaListItemBody({
|
|
92
|
+
render,
|
|
93
|
+
onClick,
|
|
94
|
+
className,
|
|
95
|
+
...props
|
|
96
|
+
}: MediaListItemBodyProps) {
|
|
97
|
+
const interactive = onClick !== undefined;
|
|
98
|
+
const { body } = mediaItem({ interactive });
|
|
99
|
+
const defaultProps: useRender.ElementProps<"button"> & {
|
|
100
|
+
"data-slot": string;
|
|
101
|
+
"data-interactive"?: string;
|
|
102
|
+
} = {
|
|
103
|
+
"data-slot": "media-list-item-body",
|
|
104
|
+
"data-interactive": interactive ? "true" : undefined,
|
|
105
|
+
onClick,
|
|
106
|
+
className: body({ className }),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return useRender({
|
|
110
|
+
render: render ?? (interactive ? <BaseButton type="button" /> : <div />),
|
|
111
|
+
props: mergeProps<"button">(defaultProps, props),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type MediaListItemTextProps = ComponentPropsWithRef<"div">;
|
|
116
|
+
|
|
117
|
+
export function MediaListItemText({ className, children, ...props }: MediaListItemTextProps) {
|
|
118
|
+
const { text, textInner } = mediaItem();
|
|
119
|
+
return (
|
|
120
|
+
<div data-slot="media-list-item-text" className={text({ className })} {...props}>
|
|
121
|
+
<div className={textInner()}>{children}</div>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type MediaListItemVisualProps = ComponentPropsWithRef<"div">;
|
|
127
|
+
|
|
128
|
+
export function MediaListItemVisual({ className, ...props }: MediaListItemVisualProps) {
|
|
129
|
+
const { visual } = mediaItem();
|
|
130
|
+
return <div data-slot="media-list-item-visual" className={visual({ className })} {...props} />;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type MediaListItemTitleProps = ComponentPropsWithRef<"span">;
|
|
134
|
+
|
|
135
|
+
export function MediaListItemTitle({ className, ...props }: MediaListItemTitleProps) {
|
|
136
|
+
const theme = useThemeFamily();
|
|
137
|
+
const { title } = mediaItem({ theme });
|
|
138
|
+
return <span data-slot="media-list-item-title" className={title({ className })} {...props} />;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export type MediaListItemSubtitleProps = ComponentPropsWithRef<"span">;
|
|
142
|
+
|
|
143
|
+
export function MediaListItemSubtitle({ className, ...props }: MediaListItemSubtitleProps) {
|
|
144
|
+
const theme = useThemeFamily();
|
|
145
|
+
const { subtitle } = mediaItem({ theme });
|
|
146
|
+
return (
|
|
147
|
+
<span data-slot="media-list-item-subtitle" className={subtitle({ className })} {...props} />
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export type MediaListItemAsideProps = ComponentPropsWithRef<"div">;
|
|
152
|
+
|
|
153
|
+
export function MediaListItemAside({ className, ...props }: MediaListItemAsideProps) {
|
|
154
|
+
const { aside } = mediaItem();
|
|
155
|
+
return <div data-slot="media-list-item-aside" className={aside({ className })} {...props} />;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type MediaListItemActionGroupProps = ComponentPropsWithRef<"div">;
|
|
159
|
+
|
|
160
|
+
export function MediaListItemActionGroup({ className, ...props }: MediaListItemActionGroupProps) {
|
|
161
|
+
const { actionGroup } = mediaItem();
|
|
162
|
+
return (
|
|
163
|
+
<div
|
|
164
|
+
data-slot="media-list-item-action-group"
|
|
165
|
+
className={actionGroup({ className })}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
NotificationCenterActionButtonProps,
|
|
3
|
+
NotificationCenterCountProps,
|
|
4
|
+
NotificationCenterEmptyStateProps,
|
|
5
|
+
NotificationCenterHeaderProps,
|
|
6
|
+
NotificationCenterItemActionsProps,
|
|
7
|
+
NotificationCenterItemBodyProps,
|
|
8
|
+
NotificationCenterItemContentProps,
|
|
9
|
+
NotificationCenterItemIconProps,
|
|
10
|
+
NotificationCenterItemRowProps,
|
|
11
|
+
NotificationCenterItemProps,
|
|
12
|
+
NotificationCenterItemTitleProps,
|
|
13
|
+
NotificationCenterListProps,
|
|
14
|
+
NotificationCenterPopupProps,
|
|
15
|
+
NotificationCenterPortalProps,
|
|
16
|
+
NotificationCenterProps,
|
|
17
|
+
NotificationCenterScrollerProps,
|
|
18
|
+
NotificationCenterTitleProps,
|
|
19
|
+
NotificationCenterTriggerProps,
|
|
20
|
+
} from "./notification-center.tsx";
|
|
21
|
+
export {
|
|
22
|
+
NotificationCenter,
|
|
23
|
+
NotificationCenterActionButton,
|
|
24
|
+
NotificationCenterCount,
|
|
25
|
+
NotificationCenterEmptyState,
|
|
26
|
+
NotificationCenterHeader,
|
|
27
|
+
NotificationCenterItem,
|
|
28
|
+
NotificationCenterItemActions,
|
|
29
|
+
NotificationCenterItemBody,
|
|
30
|
+
NotificationCenterItemContent,
|
|
31
|
+
NotificationCenterItemIcon,
|
|
32
|
+
NotificationCenterItemRow,
|
|
33
|
+
NotificationCenterItemTitle,
|
|
34
|
+
NotificationCenterList,
|
|
35
|
+
NotificationCenterPopup,
|
|
36
|
+
NotificationCenterScroller,
|
|
37
|
+
NotificationCenterTitle,
|
|
38
|
+
NotificationCenterTrigger,
|
|
39
|
+
} from "./notification-center.tsx";
|