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,228 +0,0 @@
1
- import { mergeProps } from "@base-ui/react/merge-props";
2
- import { useRender } from "@base-ui/react/use-render";
3
- import { tv, type VariantProps } from "../../lib/tv";
4
- import { useThemeFamily } from "../../lib/theme/use-theme";
5
- import type { WithoutChildren } from "../../lib/without-children";
6
-
7
- const BRAILLE_SPINNER_STYLE = `
8
- @keyframes raft-braille-spinner {
9
- 0%,
10
- 9.99% {
11
- content: "⠋";
12
- }
13
- 10%,
14
- 19.99% {
15
- content: "⠙";
16
- }
17
- 20%,
18
- 29.99% {
19
- content: "⠹";
20
- }
21
- 30%,
22
- 39.99% {
23
- content: "⠸";
24
- }
25
- 40%,
26
- 49.99% {
27
- content: "⠼";
28
- }
29
- 50%,
30
- 59.99% {
31
- content: "⠴";
32
- }
33
- 60%,
34
- 69.99% {
35
- content: "⠦";
36
- }
37
- 70%,
38
- 79.99% {
39
- content: "⠧";
40
- }
41
- 80%,
42
- 89.99% {
43
- content: "⠇";
44
- }
45
- 90%,
46
- 100% {
47
- content: "⠏";
48
- }
49
- }
50
-
51
- [data-slot="spinner"] [data-spinner-glyph]::before {
52
- content: "⠋";
53
- animation: raft-braille-spinner 800ms steps(1, end) infinite;
54
- }
55
-
56
- @media (prefers-reduced-motion: reduce) {
57
- [data-slot="spinner"] [data-spinner-glyph]::before {
58
- animation-duration: 1600ms;
59
- }
60
- }
61
- `;
62
-
63
- const ELEGANT_SPINNER_STYLE = `
64
- @keyframes raft-elegant-spinner-spin {
65
- to {
66
- transform: rotate(360deg);
67
- }
68
- }
69
-
70
- @keyframes raft-elegant-spinner-dash {
71
- 0% {
72
- stroke-dasharray: 1 150;
73
- stroke-dashoffset: 0;
74
- }
75
- 50% {
76
- stroke-dasharray: 90 150;
77
- stroke-dashoffset: -35;
78
- }
79
- 100% {
80
- stroke-dasharray: 90 150;
81
- stroke-dashoffset: -124;
82
- }
83
- }
84
-
85
- [data-slot="spinner"] [data-spinner-ring] {
86
- animation: raft-elegant-spinner-spin 1600ms linear infinite;
87
- transform-box: fill-box;
88
- transform-origin: center;
89
- will-change: transform;
90
- }
91
-
92
- [data-slot="spinner"] [data-spinner-arc] {
93
- animation: raft-elegant-spinner-dash 1400ms cubic-bezier(0.42, 0, 0.58, 1) infinite;
94
- stroke-dasharray: 1 150;
95
- stroke-dashoffset: 0;
96
- }
97
-
98
- @media (prefers-reduced-motion: reduce) {
99
- [data-slot="spinner"] [data-spinner-ring] {
100
- animation-duration: 2400ms;
101
- will-change: auto;
102
- }
103
-
104
- [data-slot="spinner"] [data-spinner-arc] {
105
- animation: none;
106
- stroke-dasharray: 72 150;
107
- stroke-dashoffset: -30;
108
- }
109
- }
110
- `;
111
-
112
- const SPINNER_STYLE = `${BRAILLE_SPINNER_STYLE}${ELEGANT_SPINNER_STYLE}`;
113
-
114
- const spinner = tv({
115
- slots: {
116
- root: [
117
- "relative inline-flex shrink-0 items-center justify-center",
118
- "leading-none text-current",
119
- ],
120
- glyph: "inline-block min-w-[1ch] font-mono tabular-nums",
121
- ring: "block size-full shrink-0",
122
- },
123
- variants: {
124
- theme: {
125
- brutal: {},
126
- elegant: {},
127
- },
128
- size: {
129
- sm: {},
130
- lg: {},
131
- },
132
- },
133
- defaultVariants: {
134
- size: "sm",
135
- },
136
- compoundVariants: [
137
- {
138
- theme: "brutal",
139
- size: "sm",
140
- class: { root: "h-4 text-base" },
141
- },
142
- {
143
- theme: "brutal",
144
- size: "lg",
145
- class: { root: "h-6 text-xl" },
146
- },
147
- {
148
- theme: "elegant",
149
- size: "sm",
150
- class: { root: "size-3.5" },
151
- },
152
- {
153
- theme: "elegant",
154
- size: "lg",
155
- class: { root: "size-[18px]" },
156
- },
157
- ],
158
- });
159
-
160
- const spinnerStyle = (
161
- <style href="raft-ui-spinner" precedence="default">
162
- {SPINNER_STYLE}
163
- </style>
164
- );
165
-
166
- export type SpinnerProps = WithoutChildren<useRender.ComponentProps<"span">> &
167
- Omit<VariantProps<typeof spinner>, "theme">;
168
-
169
- export function Spinner({ size = "sm", className, render, ...props }: SpinnerProps) {
170
- const theme = useThemeFamily();
171
- const { root, glyph, ring } = spinner({ theme, size });
172
- const children =
173
- theme === "elegant" ? (
174
- <>
175
- {spinnerStyle}
176
- <svg
177
- data-spinner-ring=""
178
- aria-hidden="true"
179
- className={ring()}
180
- xmlns="http://www.w3.org/2000/svg"
181
- fill="none"
182
- viewBox="0 0 24 24"
183
- >
184
- <circle
185
- className="opacity-20"
186
- cx="12"
187
- cy="12"
188
- r="10"
189
- stroke="currentColor"
190
- strokeWidth="2.5"
191
- />
192
- <circle
193
- data-spinner-arc=""
194
- className="opacity-80"
195
- cx="12"
196
- cy="12"
197
- r="10"
198
- fill="none"
199
- pathLength="150"
200
- stroke="currentColor"
201
- strokeLinecap="round"
202
- strokeWidth="2.5"
203
- />
204
- </svg>
205
- </>
206
- ) : (
207
- <>
208
- {spinnerStyle}
209
- <span data-spinner-glyph="" aria-hidden="true" className={glyph()} />
210
- </>
211
- );
212
- const defaultProps: useRender.ElementProps<"span"> = {
213
- role: "status",
214
- "aria-label": "Loading",
215
- className: root({ className }),
216
- children,
217
- };
218
-
219
- return useRender({
220
- defaultTagName: "span",
221
- render,
222
- props: mergeProps<"span">(defaultProps, props),
223
- state: {
224
- slot: "spinner",
225
- size,
226
- },
227
- });
228
- }
@@ -1,2 +0,0 @@
1
- export { Status } from "./status";
2
- export type { StatusProps } from "./status";
@@ -1,152 +0,0 @@
1
- import { mergeProps } from "@base-ui/react/merge-props";
2
- import { useRender } from "@base-ui/react/use-render";
3
- import { tv, type VariantProps } from "../../lib/tv";
4
- import { useThemeFamily } from "../../lib/theme/use-theme";
5
-
6
- const STATUS_STYLE = `
7
- @keyframes raft-status-pulse-background {
8
- 0% {
9
- box-shadow: 0 0 0 1px color-mix(in oklch, var(--status-color) 42%, transparent);
10
- }
11
- 70%,
12
- 100% {
13
- box-shadow: 0 0 0 8px color-mix(in oklch, var(--status-color) 0%, transparent);
14
- }
15
- }
16
- `;
17
-
18
- const dot = tv({
19
- slots: {
20
- root: ["relative inline-block shrink-0 rounded-full", "[background-color:var(--status-color)]"],
21
- },
22
- variants: {
23
- theme: {
24
- brutal: {
25
- root: "border border-line-strong",
26
- },
27
- elegant: {},
28
- },
29
- variant: {
30
- default: {
31
- root: "[--status-color:var(--color-gray-400)]",
32
- },
33
- primary: {
34
- root: "[--status-color:var(--color-primary-400)]",
35
- },
36
- information: {
37
- root: "[--status-color:var(--color-info-base)]",
38
- },
39
- muted: {
40
- root: "[--status-color:var(--color-secondary-400)]",
41
- },
42
- accent: {
43
- root: "[--status-color:var(--color-accent-400)]",
44
- },
45
- success: {
46
- root: "[--status-color:var(--color-success-base)]",
47
- },
48
- warning: {
49
- root: "[--status-color:var(--color-warning-base)]",
50
- },
51
- danger: {
52
- root: "[--status-color:var(--color-danger-base)]",
53
- },
54
- },
55
- },
56
- defaultVariants: {
57
- variant: "default",
58
- },
59
- });
60
-
61
- const status = tv({
62
- extend: dot,
63
- variants: {
64
- theme: {
65
- brutal: {},
66
- elegant: {},
67
- },
68
- size: {
69
- xs: {
70
- root: "size-1",
71
- },
72
- sm: {
73
- root: "size-2",
74
- },
75
- md: {
76
- root: "size-2.5",
77
- },
78
- lg: {
79
- root: "size-[11px]",
80
- },
81
- },
82
- pulse: {
83
- true: {
84
- root: "",
85
- },
86
- false: {
87
- root: "",
88
- },
89
- },
90
- },
91
- defaultVariants: {
92
- size: "md",
93
- variant: "default",
94
- pulse: false,
95
- },
96
- compoundVariants: [
97
- {
98
- theme: "brutal",
99
- variant: "success",
100
- class: { root: "[--status-color:var(--color-brutal-lime)]" },
101
- },
102
- {
103
- theme: "brutal",
104
- variant: "warning",
105
- class: { root: "[--status-color:var(--color-warning-base)]" },
106
- },
107
- {
108
- theme: "brutal",
109
- pulse: true,
110
- class: { root: "animate-pulse" },
111
- },
112
- {
113
- theme: "elegant",
114
- pulse: true,
115
- class: {
116
- root: "[animation:raft-status-pulse-background_1.4s_ease-out_infinite] motion-reduce:animate-none",
117
- },
118
- },
119
- ],
120
- });
121
-
122
- const statusStyle = (
123
- <style href="raft-ui-status" precedence="default">
124
- {STATUS_STYLE}
125
- </style>
126
- );
127
-
128
- export type StatusProps = Omit<useRender.ComponentProps<"span">, "children"> &
129
- Omit<VariantProps<typeof status>, "theme">;
130
-
131
- function StatusRoot({ size, variant, pulse, className, render, ...props }: StatusProps) {
132
- const theme = useThemeFamily();
133
- const { root } = status({ theme, size, variant, pulse });
134
- const defaultProps: useRender.ElementProps<"span"> = {
135
- className: root({ className }),
136
- children: statusStyle,
137
- };
138
-
139
- return useRender({
140
- defaultTagName: "span",
141
- render,
142
- props: mergeProps<"span">(defaultProps, props),
143
- state: {
144
- slot: "status",
145
- variant,
146
- pulse,
147
- size,
148
- },
149
- });
150
- }
151
-
152
- export const Status = StatusRoot;
@@ -1,24 +0,0 @@
1
- export {
2
- Tabs,
3
- TabsBackground,
4
- TabsIndicator,
5
- TabsLabel,
6
- TabsList,
7
- TabsPanel,
8
- TabsTab,
9
- SortableTabsList,
10
- SortableTabsTab,
11
- useOrderedTabs,
12
- } from "./tabs";
13
- export type {
14
- OrderedTabItem,
15
- SortableTabsListProps,
16
- SortableTabsTabProps,
17
- TabsBackgroundProps,
18
- TabsIndicatorProps,
19
- TabsLabelProps,
20
- TabsListProps,
21
- TabsPanelProps,
22
- TabsProps,
23
- TabsTabProps,
24
- } from "./tabs";