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.
Files changed (134) hide show
  1. package/README.md +24 -0
  2. package/dist/cn.d.mts +2 -0
  3. package/dist/cn.mjs +2 -0
  4. package/dist/index.d.mts +2710 -0
  5. package/dist/index.mjs +4821 -0
  6. package/dist/label-DWq4ia5I.mjs +115 -0
  7. package/dist/styled-props-B3SNekJg.d.mts +16 -0
  8. package/dist/wip.d.mts +1238 -0
  9. package/dist/wip.mjs +1416 -0
  10. package/package.json +70 -0
  11. package/src/components/avatar/avatar.tsx +375 -0
  12. package/src/components/avatar/index.ts +17 -0
  13. package/src/components/badge/badge.tsx +393 -0
  14. package/src/components/badge/index.ts +2 -0
  15. package/src/components/banner/banner.tsx +269 -0
  16. package/src/components/banner/index.ts +8 -0
  17. package/src/components/bottom-sheet/bottom-sheet.tsx +152 -0
  18. package/src/components/bottom-sheet/index.ts +22 -0
  19. package/src/components/button/button.tsx +497 -0
  20. package/src/components/button/index.ts +2 -0
  21. package/src/components/checkbox/checkbox-indicator.tsx +128 -0
  22. package/src/components/checkbox/checkbox.tsx +350 -0
  23. package/src/components/checkbox/index.ts +2 -0
  24. package/src/components/combobox/combobox.tsx +603 -0
  25. package/src/components/combobox/index.ts +52 -0
  26. package/src/components/context-menu/context-menu.tsx +380 -0
  27. package/src/components/context-menu/index.ts +34 -0
  28. package/src/components/conversation-preview-card/conversation-preview-card.tsx +336 -0
  29. package/src/components/conversation-preview-card/index.ts +32 -0
  30. package/src/components/description-list/description-list.tsx +116 -0
  31. package/src/components/description-list/index.ts +14 -0
  32. package/src/components/dropdown-menu/dropdown-menu.tsx +405 -0
  33. package/src/components/dropdown-menu/index.ts +38 -0
  34. package/src/components/empty-state/empty-state.tsx +177 -0
  35. package/src/components/empty-state/index.ts +16 -0
  36. package/src/components/field/field.tsx +125 -0
  37. package/src/components/field/index.ts +18 -0
  38. package/src/components/inline-code/index.ts +2 -0
  39. package/src/components/inline-code/inline-code.tsx +33 -0
  40. package/src/components/input/index.ts +2 -0
  41. package/src/components/input/input.tsx +76 -0
  42. package/src/components/input-group/index.ts +7 -0
  43. package/src/components/input-group/input-group.tsx +215 -0
  44. package/src/components/kbd/index.ts +2 -0
  45. package/src/components/kbd/kbd.tsx +43 -0
  46. package/src/components/label/index.ts +7 -0
  47. package/src/components/label/label.tsx +99 -0
  48. package/src/components/lightbox/index.ts +24 -0
  49. package/src/components/lightbox/lightbox.tsx +245 -0
  50. package/src/components/list-item/index.ts +20 -0
  51. package/src/components/list-item/list-item.tsx +263 -0
  52. package/src/components/media-list-item/index.ts +20 -0
  53. package/src/components/media-list-item/media-list-item.tsx +169 -0
  54. package/src/components/notification-center/index.ts +39 -0
  55. package/src/components/notification-center/notification-center.tsx +558 -0
  56. package/src/components/panel-header/index.ts +22 -0
  57. package/src/components/panel-header/panel-header.tsx +199 -0
  58. package/src/components/popover/index.ts +30 -0
  59. package/src/components/popover/popover.tsx +248 -0
  60. package/src/components/preview-shell/index.ts +2 -0
  61. package/src/components/preview-shell/preview-shell.tsx +51 -0
  62. package/src/components/quoted-message-card/index.ts +36 -0
  63. package/src/components/quoted-message-card/quoted-message-card.tsx +391 -0
  64. package/src/components/radio-group/index.ts +6 -0
  65. package/src/components/radio-group/radio-group.tsx +119 -0
  66. package/src/components/section-header/index.ts +16 -0
  67. package/src/components/section-header/section-header.tsx +117 -0
  68. package/src/components/section-label/index.ts +2 -0
  69. package/src/components/section-label/section-label.tsx +38 -0
  70. package/src/components/segmented-control/index.ts +12 -0
  71. package/src/components/segmented-control/segmented-control.tsx +129 -0
  72. package/src/components/select/index.ts +40 -0
  73. package/src/components/select/select.tsx +382 -0
  74. package/src/components/spinner/index.ts +2 -0
  75. package/src/components/spinner/spinner.tsx +228 -0
  76. package/src/components/status/index.ts +2 -0
  77. package/src/components/status/status.tsx +152 -0
  78. package/src/components/tabs/index.ts +24 -0
  79. package/src/components/tabs/tabs.tsx +417 -0
  80. package/src/components/text/index.ts +2 -0
  81. package/src/components/text/text.tsx +130 -0
  82. package/src/components/textarea/index.ts +2 -0
  83. package/src/components/textarea/textarea.tsx +136 -0
  84. package/src/components/toggle-group/index.ts +12 -0
  85. package/src/components/toggle-group/toggle-group.tsx +111 -0
  86. package/src/components/tooltip/index.ts +14 -0
  87. package/src/components/tooltip/tooltip.tsx +186 -0
  88. package/src/fonts/brutal.css +2 -0
  89. package/src/index.ts +404 -0
  90. package/src/legacy/AttentionDot.tsx +28 -0
  91. package/src/legacy/AvatarListRow.tsx +87 -0
  92. package/src/legacy/AvatarSlot.tsx +157 -0
  93. package/src/legacy/Badge.tsx +95 -0
  94. package/src/legacy/Banner.tsx +74 -0
  95. package/src/legacy/BottomSheet.tsx +76 -0
  96. package/src/legacy/CheckMarker.tsx +72 -0
  97. package/src/legacy/Checkbox.tsx +81 -0
  98. package/src/legacy/ConversationPreviewCard.tsx +169 -0
  99. package/src/legacy/DismissBackdrop.tsx +68 -0
  100. package/src/legacy/EmptyState.tsx +63 -0
  101. package/src/legacy/ExperimentalBadge.tsx +19 -0
  102. package/src/legacy/FormField.tsx +106 -0
  103. package/src/legacy/KeyValueRow.tsx +67 -0
  104. package/src/legacy/Lightbox.tsx +119 -0
  105. package/src/legacy/NotificationCenter.tsx +217 -0
  106. package/src/legacy/PanelHeader.tsx +94 -0
  107. package/src/legacy/PreviewShell.tsx +40 -0
  108. package/src/legacy/QuotedMessageCard.tsx +181 -0
  109. package/src/legacy/ReorderablePanelTabs.tsx +151 -0
  110. package/src/legacy/SandboxedPreviewFrame.tsx +59 -0
  111. package/src/legacy/SearchInput.tsx +23 -0
  112. package/src/legacy/SectionEyebrow.tsx +60 -0
  113. package/src/legacy/SectionHeader.tsx +68 -0
  114. package/src/legacy/SegmentedControl.tsx +74 -0
  115. package/src/legacy/SlugInput.tsx +29 -0
  116. package/src/legacy/Spinner.tsx +89 -0
  117. package/src/legacy/StatusDot.tsx +51 -0
  118. package/src/legacy/SurfaceListItem.tsx +32 -0
  119. package/src/legacy/Textarea.tsx +137 -0
  120. package/src/legacy/button.tsx +100 -0
  121. package/src/legacy/context-menu-divider.tsx +12 -0
  122. package/src/legacy/menu-item.tsx +66 -0
  123. package/src/legacy/selection-popover.tsx +212 -0
  124. package/src/legacy/server-switcher-menu.tsx +203 -0
  125. package/src/legacy/source.css +240 -0
  126. package/src/lib/cn.ts +1 -0
  127. package/src/lib/styled-props.ts +11 -0
  128. package/src/lib/theme/theme-context.ts +28 -0
  129. package/src/lib/theme/theme-provider.tsx +181 -0
  130. package/src/lib/theme/use-theme.ts +12 -0
  131. package/src/lib/tv.ts +29 -0
  132. package/src/lib/without-children.ts +6 -0
  133. package/src/styles.css +467 -0
  134. 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";