raft-ui 0.0.6 → 0.0.8

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