@rebasepro/ui 0.4.0 → 0.5.0
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
CHANGED
|
@@ -1,84 +1,142 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
**Rebase UI** is a high quality set of components that you can use to build your own custom views. You can
|
|
5
|
-
use these components to build your own Rebase views, or in any other React application. You just need to install
|
|
6
|
-
`tailwindcss` and the `@rebasepro/ui` package.
|
|
7
|
-
|
|
8
|
-
### Why build this UI kit?
|
|
9
|
-
Rebase was using MUI until version 3.0. MUI provides ready to use components with intuitive APIs, but it also
|
|
10
|
-
comes with a lot of complexity and overhead. We wanted to build a simpler and more flexible UI kit that could be used
|
|
11
|
-
in any React project, not just in Rebase.
|
|
12
|
-
We also wanted to make it easy to transition from MUI to our new UI kit, so we kept the API as similar as possible.
|
|
13
|
-
The result it a set of components that are easy to use, easy to customize, **much more performant** and with a smaller bundle size.
|
|
14
|
-
|
|
15
|
-
The components are primarily built using **Radix UI** primitives and **tailwindcss**. This means that you can easily customize them
|
|
16
|
-
using tailwindcss classes or override the styles using CSS.
|
|
17
|
-
|
|
18
|
-
See the full list of components in https://rebase.pro/docs/components
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
> All the components are exported from the `@rebasepro/ui` package. These are the same components used internally in **Rebase**.
|
|
1
|
+
# @rebasepro/ui
|
|
22
2
|
|
|
3
|
+
React component library and design system for the Rebase ecosystem. Built on Radix UI primitives, Tailwind CSS, and lucide-react icons.
|
|
23
4
|
|
|
24
5
|
## Installation
|
|
25
6
|
|
|
26
|
-
If you are using Rebase, you don't need to install this package, as it is already included, and
|
|
27
|
-
configured for you.
|
|
28
|
-
|
|
29
|
-
To use the components in your own project, you need to install the `@rebasepro/ui` package:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
yarn add @rebasepro/ui
|
|
33
|
-
```
|
|
34
|
-
or
|
|
35
7
|
```bash
|
|
36
|
-
|
|
8
|
+
pnpm add @rebasepro/ui
|
|
37
9
|
```
|
|
38
10
|
|
|
39
|
-
|
|
11
|
+
### Peer Dependencies
|
|
40
12
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
And initialize it in your project:
|
|
13
|
+
- `react` >= 19.0.0
|
|
14
|
+
- `react-dom` >= 19.0.0
|
|
46
15
|
|
|
47
|
-
|
|
48
|
-
npx tailwindcss init
|
|
49
|
-
```
|
|
16
|
+
## What This Package Does
|
|
50
17
|
|
|
51
|
-
|
|
18
|
+
`@rebasepro/ui` provides all the shared UI primitives used across Rebase packages (`@rebasepro/studio`, `@rebasepro/admin`, etc.). It wraps Radix UI components with Rebase's design tokens and Tailwind styling, and re-exports lucide-react icons so other packages don't need direct icon dependencies.
|
|
52
19
|
|
|
53
|
-
|
|
54
|
-
import rebaseConfig from "@rebasepro/ui/tailwind.config.js";
|
|
20
|
+
Import the stylesheet in your app:
|
|
55
21
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
content: [
|
|
59
|
-
"./index.html",
|
|
60
|
-
"./src/**/*.{js,ts,jsx,tsx}",
|
|
61
|
-
"./node_modules/@rebasepro/**/src/**/*.{js,ts,jsx,tsx}"
|
|
62
|
-
]
|
|
63
|
-
};
|
|
22
|
+
```typescript
|
|
23
|
+
import "@rebasepro/ui/index.css";
|
|
64
24
|
```
|
|
65
|
-
(You might need to adjust the paths in the `content` array to match your project structure)
|
|
66
25
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
26
|
+
## Key Exports
|
|
27
|
+
|
|
28
|
+
### Components
|
|
29
|
+
|
|
30
|
+
| Component | Description |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `Alert` | Status messages and notifications |
|
|
33
|
+
| `Autocomplete` | Text input with suggestions |
|
|
34
|
+
| `Avatar` | User avatar display |
|
|
35
|
+
| `Badge` | Small status indicator |
|
|
36
|
+
| `BooleanSwitch` / `BooleanSwitchWithLabel` | Toggle switch |
|
|
37
|
+
| `Button` / `IconButton` / `LoadingButton` | Action buttons |
|
|
38
|
+
| `Card` | Content container card |
|
|
39
|
+
| `CenteredView` | Horizontally/vertically centered layout |
|
|
40
|
+
| `Checkbox` | Checkbox input (Radix) |
|
|
41
|
+
| `Chip` / `FilterChip` | Tag-like chips |
|
|
42
|
+
| `CircularProgress` / `CircularProgressCenter` | Loading spinners |
|
|
43
|
+
| `Collapse` | Collapsible content (Radix) |
|
|
44
|
+
| `ColorPicker` | Color selection input |
|
|
45
|
+
| `Container` | Max-width content wrapper |
|
|
46
|
+
| `DateTimeField` | Date/time picker input |
|
|
47
|
+
| `DebouncedTextField` | Text field with debounced onChange |
|
|
48
|
+
| `Dialog` / `DialogTitle` / `DialogContent` / `DialogActions` | Modal dialogs (Radix) |
|
|
49
|
+
| `ErrorBoundary` | React error boundary |
|
|
50
|
+
| `ExpandablePanel` | Expandable/collapsible panel |
|
|
51
|
+
| `FileUpload` | Drag-and-drop file upload (react-dropzone) |
|
|
52
|
+
| `InputLabel` / `InfoLabel` / `Label` | Form labels |
|
|
53
|
+
| `Markdown` | Markdown renderer (markdown-it) |
|
|
54
|
+
| `Menu` / `Menubar` | Dropdown and menu bar (Radix) |
|
|
55
|
+
| `MultiSelect` | Multi-value select input |
|
|
56
|
+
| `Paper` | Elevated surface |
|
|
57
|
+
| `Popover` | Popover overlay (Radix) |
|
|
58
|
+
| `RadioGroup` | Radio button group (Radix) |
|
|
59
|
+
| `ResizablePanels` | Resizable split panes |
|
|
60
|
+
| `SearchBar` | Search input with icon |
|
|
61
|
+
| `Select` | Single-value select (Radix) |
|
|
62
|
+
| `Separator` | Visual divider (Radix) |
|
|
63
|
+
| `Sheet` | Slide-out panel |
|
|
64
|
+
| `Skeleton` | Loading placeholder |
|
|
65
|
+
| `Slider` | Range slider (Radix) |
|
|
66
|
+
| `Table` / `VirtualTable` | Data tables (VirtualTable uses react-window) |
|
|
67
|
+
| `Tabs` | Tab navigation (Radix) |
|
|
68
|
+
| `TextareaAutosize` | Auto-resizing textarea |
|
|
69
|
+
| `TextField` | Text input field |
|
|
70
|
+
| `ToggleButtonGroup` | Segmented toggle buttons |
|
|
71
|
+
| `Tooltip` | Hover tooltip (Radix) |
|
|
72
|
+
| `Typography` | Text with variant styling |
|
|
73
|
+
|
|
74
|
+
### Re-exported Radix Primitives
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { Portal, PopoverPrimitive, Slot } from "@rebasepro/ui";
|
|
78
|
+
```
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
### Style Mixins
|
|
81
|
+
|
|
82
|
+
Tailwind class-string constants for consistent styling:
|
|
83
|
+
|
|
84
|
+
| Export | Description |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `focusedClasses` | Ring styles for focused elements |
|
|
87
|
+
| `fieldBackgroundMixin` | Standard field background |
|
|
88
|
+
| `fieldBackgroundHoverMixin` | Hover state for fields |
|
|
89
|
+
| `defaultBorderMixin` | Default border color |
|
|
90
|
+
| `paperMixin` | Paper/card surface style |
|
|
91
|
+
| `cardMixin` / `cardClickableMixin` / `cardSelectedMixin` | Card variants |
|
|
92
|
+
|
|
93
|
+
### Utilities
|
|
94
|
+
|
|
95
|
+
| Export | Description |
|
|
96
|
+
|---|---|
|
|
97
|
+
| `cls(...)` | Class name merge utility (wraps `clsx`) |
|
|
98
|
+
| `debounce` | Debounce function |
|
|
99
|
+
| `chipColors` | Color palette for chips |
|
|
100
|
+
| `keyToIconComponent` | Map icon string key to lucide component |
|
|
101
|
+
|
|
102
|
+
### Hooks
|
|
103
|
+
|
|
104
|
+
| Hook | Description |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `useInjectStyles` | Inject CSS into the document head |
|
|
107
|
+
| `useOutsideAlerter` | Detect clicks outside a ref |
|
|
108
|
+
| `useDebouncedCallback` | Debounced callback hook |
|
|
109
|
+
| `useDebounceCallback` | Callback debounce variant |
|
|
110
|
+
| `useDebounceValue` | Debounced value hook |
|
|
111
|
+
| `PortalContainerContext` | Context for portal target container |
|
|
112
|
+
|
|
113
|
+
### Icons
|
|
114
|
+
|
|
115
|
+
Re-exports ~100 individual lucide-react icon components (e.g. `ArrowRightIcon`, `SearchIcon`, `PlusIcon`), the full `lucideIcons` map, the `Icon` component, `GitHubIcon`, `HandleIcon`, `iconKeys`, and `coolIconKeys`.
|
|
116
|
+
|
|
117
|
+
## Quick Start
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { Button, TextField, Typography, cls } from "@rebasepro/ui";
|
|
121
|
+
import { SearchIcon } from "@rebasepro/ui";
|
|
122
|
+
import "@rebasepro/ui/index.css";
|
|
123
|
+
|
|
124
|
+
function MyForm() {
|
|
125
|
+
return (
|
|
126
|
+
<div className={cls("flex flex-col gap-4 p-4")}>
|
|
127
|
+
<Typography variant="h6">Search</Typography>
|
|
128
|
+
<TextField placeholder="Type to search..." />
|
|
129
|
+
<Button variant="filled">
|
|
130
|
+
<SearchIcon size={16} />
|
|
131
|
+
Search
|
|
132
|
+
</Button>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
82
135
|
}
|
|
83
136
|
```
|
|
84
137
|
|
|
138
|
+
## Related Packages
|
|
139
|
+
|
|
140
|
+
- `@rebasepro/studio` — Dev tools layer (depends on this package)
|
|
141
|
+
- `@rebasepro/admin` — CMS layer (depends on this package)
|
|
142
|
+
- `@rebasepro/core` — Core framework (uses this for shared UI)
|
package/dist/index.es.js
CHANGED
|
@@ -869,9 +869,10 @@ const BooleanSwitchWithLabel = function BooleanSwitchWithLabel2({
|
|
|
869
869
|
"min-h-[64px]": size === "large"
|
|
870
870
|
}, size === "small" || size === "smallest" ? "pl-2" : "pl-4", size === "small" || size === "smallest" ? "pr-4" : "pr-6", position === "end" ? "flex-row-reverse" : "flex-row", fullWidth ? "w-full" : "", className), onClick: disabled ? void 0 : (e) => {
|
|
871
871
|
if (props.allowIndeterminate) {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
else
|
|
872
|
+
const onChange = onValueChange;
|
|
873
|
+
if (value === null || value === void 0) onChange?.(true);
|
|
874
|
+
else if (value) onChange?.(false);
|
|
875
|
+
else onChange?.(null);
|
|
875
876
|
} else {
|
|
876
877
|
onValueChange?.(!value);
|
|
877
878
|
}
|