reusify-ui 2.0.0 → 2.1.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 +92 -17
- package/dist/reusify-ui.cjs +1077 -485
- package/dist/reusify-ui.js +1082 -490
- package/dist/styles.css +1 -1
- package/package.json +4 -7
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Reusify UI
|
|
2
|
+
Add [Reusify UI](https://reusify-ui.vercel.app) components to your projects.
|
|
2
3
|
|
|
3
4
|
Reusable, accessible React components with built-in dark mode and CSS-variable theming.
|
|
4
5
|
Works with or without Tailwind CSS.
|
|
@@ -60,9 +61,9 @@ export default function App() {
|
|
|
60
61
|
|
|
61
62
|
| Category | Components |
|
|
62
63
|
| -------------- | -------------------------------------------------------------------------- |
|
|
63
|
-
| Actions | `Button`
|
|
64
|
-
| Forms | `Input`, `Textarea`, `Select`, `Checkbox`, `Radio`, `RadioGroup`, `Switch` |
|
|
65
|
-
| Data display | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `Badge`, `Avatar`, `AvatarGroup`, `Table`, `Divider`, `Kbd` |
|
|
64
|
+
| Actions | `Button`, `ButtonGroup` |
|
|
65
|
+
| Forms | `Input`, `Textarea`, `Select`, `Checkbox`, `Radio`, `RadioGroup`, `Switch`, `Calendar` |
|
|
66
|
+
| Data display | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `Badge`, `Avatar`, `AvatarGroup`, `Table`, `Divider`, `Kbd`, `FrameCard` |
|
|
66
67
|
| Feedback | `Alert`, `ToastProvider` + `useToast`, `Spinner`, `Progress`, `Skeleton` |
|
|
67
68
|
| Overlays | `Modal`, `Drawer`, `Tooltip`, `Dropdown` |
|
|
68
69
|
| Navigation | `Tabs`, `Accordion`, `Pagination`, `Breadcrumbs` |
|
|
@@ -71,24 +72,55 @@ export default function App() {
|
|
|
71
72
|
|
|
72
73
|
### Button
|
|
73
74
|
|
|
75
|
+
Pick a **variant** by emphasis, then a **color** for meaning:
|
|
76
|
+
|
|
77
|
+
| Emphasis | Variants | Use for |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| High | `solid` (default), `brand`, `gradient`, `glossy`, `pixel` | The main action; one brand or gradient hero CTA per page |
|
|
80
|
+
| Medium | `secondary`, `soft`, `outline`, `subtle`, `raised`, `framed` | Partners of the main action, menus, actions in cards |
|
|
81
|
+
| Low | `ghost`, `text`, `link`, `dashed` | Toolbars, "Learn more", inline and "add" actions |
|
|
82
|
+
|
|
83
|
+
Every button also takes **any CSS color**, a text color, a corner radius and a content alignment:
|
|
84
|
+
|
|
85
|
+
```jsx
|
|
86
|
+
<Button variant="pixel" color="#2563eb" justify="between" rightIcon={<TerminalIcon />}>Copy build notes</Button>
|
|
87
|
+
<Button variant="glossy" color="oklch(0.6 0.2 260)" radius="xl">Sign up</Button>
|
|
88
|
+
<Button color="#facc15" textColor="#1c1917" radius={4}>Yellow</Button>
|
|
89
|
+
```
|
|
90
|
+
|
|
74
91
|
```jsx
|
|
75
|
-
<Button>
|
|
76
|
-
<Button variant="
|
|
77
|
-
<Button variant="
|
|
78
|
-
<Button variant="
|
|
79
|
-
<Button variant="
|
|
80
|
-
<Button
|
|
92
|
+
<Button>Save</Button>
|
|
93
|
+
<Button variant="brand" rightIcon={<ArrowRight />}>Start your first lab</Button> {/* emerald, gold in dark mode */}
|
|
94
|
+
<Button variant="gradient" rightIcon={<ArrowRight />}>Get started</Button>
|
|
95
|
+
<Button variant="secondary">Cancel</Button>
|
|
96
|
+
<Button variant="soft" color="success">Approve</Button>
|
|
97
|
+
<Button color="danger" loading>Deleting</Button>
|
|
98
|
+
<Button variant="text">Learn more</Button>
|
|
99
|
+
|
|
100
|
+
<Button iconOnly aria-label="Edit" variant="ghost"><EditIcon /></Button>
|
|
101
|
+
<Button pill leftIcon={<PlusIcon />}>Follow</Button>
|
|
102
|
+
<Button href="/docs">Read the docs</Button> {/* renders an <a> */}
|
|
103
|
+
|
|
104
|
+
<ButtonGroup attached aria-label="Period">
|
|
105
|
+
<Button variant="secondary">Day</Button>
|
|
106
|
+
<Button>Week</Button>
|
|
107
|
+
<Button variant="secondary">Month</Button>
|
|
108
|
+
</ButtonGroup>
|
|
81
109
|
```
|
|
82
110
|
|
|
83
|
-
| Prop | Type
|
|
84
|
-
| ----------- |
|
|
85
|
-
| `variant` | `'
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
111
|
+
| Prop | Type | Default |
|
|
112
|
+
| ----------- | ---- | ------- |
|
|
113
|
+
| `variant` | `'solid' \| 'brand' \| 'gradient' \| 'glossy' \| 'pixel' \| 'secondary' \| 'soft' \| 'outline' \| 'subtle' \| 'raised' \| 'framed' \| 'ghost' \| 'text' \| 'link' \| 'dashed'` | `'solid'` |
|
|
114
|
+
| `color` | `'primary' \| 'secondary' \| 'success' \| 'danger' \| 'warning' \| 'info'` or any CSS color | `'primary'` |
|
|
115
|
+
| `textColor` | CSS color | — |
|
|
116
|
+
| `radius` | `'none' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl' \| 'full'`, a number (px) or a CSS length | size default |
|
|
117
|
+
| `justify` | `'center' \| 'start' \| 'between'` | `'center'` |
|
|
118
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` |
|
|
119
|
+
| `iconOnly`, `pill`, `fullWidth`, `loading` | `boolean` | `false` |
|
|
120
|
+
| `leftIcon`, `rightIcon` | `ReactNode` | — |
|
|
121
|
+
| `href` | `string` (renders an `<a>`) | — |
|
|
90
122
|
|
|
91
|
-
All native `<button>` props are supported too.
|
|
123
|
+
All native `<button>` (or `<a>`) props are supported too. `variant="primary" | "danger" | "success"` from 2.0 still work.
|
|
92
124
|
|
|
93
125
|
### Form controls
|
|
94
126
|
|
|
@@ -175,6 +207,11 @@ Options: `title`, `description`, `variant`, `duration` (ms, `Infinity` keeps it
|
|
|
175
207
|
<Button variant="ghost">Copy</Button>
|
|
176
208
|
</Tooltip>
|
|
177
209
|
|
|
210
|
+
{/* size sm|md|lg, arrow on by default, any colors, open pins it */}
|
|
211
|
+
<Tooltip content="Reusify UI" placement="bottom" size="lg" color="#0a0a0a" textColor="#fff" open>
|
|
212
|
+
<Button variant="raised" iconOnly radius="xl" aria-label="Reusify UI"><Logo /></Button>
|
|
213
|
+
</Tooltip>
|
|
214
|
+
|
|
178
215
|
<Dropdown
|
|
179
216
|
trigger={<Button variant="outline">Actions</Button>}
|
|
180
217
|
align="end"
|
|
@@ -224,6 +261,24 @@ Both support controlled (`value` + `onChange`) and uncontrolled (`defaultValue`)
|
|
|
224
261
|
/>
|
|
225
262
|
```
|
|
226
263
|
|
|
264
|
+
#### Pagination
|
|
265
|
+
|
|
266
|
+
```jsx
|
|
267
|
+
// Client-side: the table slices `data` for you
|
|
268
|
+
<Table rowKey="id" columns={columns} data={users} pagination={{ pageSize: 10, pageSizeOptions: [10, 25, 50] }} />
|
|
269
|
+
|
|
270
|
+
// Server-side: `data` is the current page, totalRows is the full count
|
|
271
|
+
<Table
|
|
272
|
+
rowKey="id"
|
|
273
|
+
columns={columns}
|
|
274
|
+
data={rows}
|
|
275
|
+
loading={loading}
|
|
276
|
+
pagination={{ page, onPageChange: setPage, pageSize: 20, totalRows: total }}
|
|
277
|
+
/>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
`pagination` accepts `true` (10 rows per page) or `{ pageSize, defaultPageSize, pageSizeOptions, onPageSizeChange, page, defaultPage, onPageChange, totalRows, siblingCount }`. The footer shows "Showing 1–10 of 57", an optional rows-per-page select and page buttons.
|
|
281
|
+
|
|
227
282
|
### Other components
|
|
228
283
|
|
|
229
284
|
```jsx
|
|
@@ -237,6 +292,26 @@ Both support controlled (`value` + `onChange`) and uncontrolled (`defaultValue`)
|
|
|
237
292
|
<Pagination page={page} totalPages={20} onChange={setPage} />
|
|
238
293
|
<Breadcrumbs items={[{ label: 'Home', href: '/' }, { label: 'Settings' }]} />
|
|
239
294
|
<Divider label="OR" />
|
|
295
|
+
<Avatar name="Mia Johnson" status="online" badge={1} ring="primary" />
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### FrameCard & Calendar
|
|
299
|
+
|
|
300
|
+
```jsx
|
|
301
|
+
<FrameCard
|
|
302
|
+
title="Tasks Project"
|
|
303
|
+
color="warning" // semantic name or any CSS color
|
|
304
|
+
collapsible
|
|
305
|
+
footer={<button className="ru-frame-card__link">View All Tasks</button>}
|
|
306
|
+
onPrev={prev}
|
|
307
|
+
onNext={next}
|
|
308
|
+
>
|
|
309
|
+
<Checkbox label="Design Homepage" defaultChecked />
|
|
310
|
+
</FrameCard>
|
|
311
|
+
|
|
312
|
+
<FrameCard title="Start Project" color="#2563eb" titlePlacement="frame" onPrev={prev} onNext={next}>
|
|
313
|
+
<Calendar mode="range" value={range} onChange={setRange} color="#2563eb" />
|
|
314
|
+
</FrameCard>
|
|
240
315
|
```
|
|
241
316
|
|
|
242
317
|
## Dark mode
|