@blakesteve/roster 2.9.5 → 4.0.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 +113 -14
- package/dist/Table-CG6Z6c1A.js +7711 -0
- package/dist/Table-CPAcmkIV.cjs +566 -0
- package/dist/components/atoms/Button/Button.d.ts +10 -0
- package/dist/components/atoms/PasswordInput/PasswordInput.d.ts +30 -0
- package/dist/components/atoms/Pill/Pill.d.ts +22 -0
- package/dist/components/atoms/Pill/pill-variants.d.ts +25 -0
- package/dist/components/molecules/Alert/Alert.d.ts +25 -0
- package/dist/components/molecules/Alert/alert-variants.d.ts +11 -0
- package/dist/components/organisms/DataTable/DataTable.d.ts +39 -4
- package/dist/components/organisms/Navbar/Navbar.d.ts +46 -7
- package/dist/data-table.cjs.js +1 -0
- package/dist/data-table.d.ts +21 -0
- package/dist/data-table.es.js +155 -0
- package/dist/index.d.ts +5 -1
- package/dist/preflight.cjs.js +1 -0
- package/dist/preflight.css +1 -0
- package/dist/preflight.d.ts +0 -0
- package/dist/preflight.es.js +1 -0
- package/dist/roster.cjs.js +2 -570
- package/dist/roster.css +1 -1
- package/dist/roster.es.js +5987 -15192
- package/package.json +20 -4
package/README.md
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
A production-grade atomic component library built with **React 19**, **TypeScript**, **Tailwind CSS v4**, and **Vite**.
|
|
4
4
|
|
|
5
|
-
Roster ships a curated set of accessible, theme-aware components organized around the Atomic Design methodology
|
|
5
|
+
Roster ships a curated set of accessible, theme-aware components organized around the Atomic Design methodology (atoms, molecules, and organisms), each with Storybook documentation and full test coverage.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **Atomic Design
|
|
10
|
-
- **TypeScript first
|
|
11
|
-
- **Adaptive dark mode
|
|
12
|
-
- **`"use client"` pre-bundled
|
|
13
|
-
- **Accessible
|
|
14
|
-
- **Tree-shakeable
|
|
9
|
+
- **Atomic Design**: components organized as atoms, molecules, and organisms
|
|
10
|
+
- **TypeScript first**: fully typed props with exported variant types for maximum DX
|
|
11
|
+
- **Adaptive dark mode**: class-based toggling (`.dark`) independent of OS preferences
|
|
12
|
+
- **`"use client"` pre-bundled**: all outputs include the directive for seamless Next.js App Router integration
|
|
13
|
+
- **Accessible**: interactive components powered by [`@headlessui/react`](https://headlessui.com) and [`@radix-ui`](https://radix-ui.com)
|
|
14
|
+
- **Tree-shakeable**: import only what you need
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ Roster ships a curated set of accessible, theme-aware components organized aroun
|
|
|
19
19
|
npm install @blakesteve/roster
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Roster ships pre-compiled CSS
|
|
22
|
+
Roster ships pre-compiled CSS, so you do not need Tailwind installed in your host app to use it.
|
|
23
23
|
|
|
24
24
|
### Peer dependencies
|
|
25
25
|
|
|
@@ -30,12 +30,31 @@ Roster ships pre-compiled CSS — you do not need Tailwind installed in your hos
|
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
`DataTable` additionally needs TanStack Table v9, declared as an **optional**
|
|
34
|
+
peer. It ships from its own entry point so that peer stays genuinely optional:
|
|
35
|
+
importing anything from `@blakesteve/roster` never pulls TanStack in, because a
|
|
36
|
+
bundler resolves imports before it tree-shakes. Install it only if you use
|
|
37
|
+
`DataTable`; every other component works without it.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install @tanstack/react-table
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { DataTable, type RosterTableFeatures } from "@blakesteve/roster/data-table";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
It is a peer rather than a bundled dependency because v9 types column
|
|
48
|
+
definitions against the feature set that built the table. Two copies of the
|
|
49
|
+
package would mean two incompatible sets of those types, so roster and your
|
|
50
|
+
app have to resolve the same one.
|
|
51
|
+
|
|
33
52
|
## Setup
|
|
34
53
|
|
|
35
54
|
Import Roster's CSS once at the root of your application (`layout.tsx`, `main.tsx`, or `App.tsx`):
|
|
36
55
|
|
|
37
56
|
```tsx
|
|
38
|
-
// Compiled component styles
|
|
57
|
+
// Compiled component styles (always required)
|
|
39
58
|
import "@blakesteve/roster/style.css";
|
|
40
59
|
|
|
41
60
|
// Default design tokens (color palette, spacing, radius)
|
|
@@ -43,6 +62,54 @@ import "@blakesteve/roster/style.css";
|
|
|
43
62
|
import "@blakesteve/roster/tokens.css";
|
|
44
63
|
```
|
|
45
64
|
|
|
65
|
+
### Cascade layers
|
|
66
|
+
|
|
67
|
+
Roster ships its styles inside a `roster` cascade layer and declares the full
|
|
68
|
+
layer order in its own stylesheet, so importing it is normally enough:
|
|
69
|
+
|
|
70
|
+
```css
|
|
71
|
+
/* globals.css */
|
|
72
|
+
@import "@blakesteve/roster/tokens.css";
|
|
73
|
+
@import "@blakesteve/roster/style.css";
|
|
74
|
+
@import "tailwindcss";
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The order Roster declares is:
|
|
78
|
+
|
|
79
|
+
```css
|
|
80
|
+
@layer roster-preflight, theme, base, components, roster, utilities;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
`roster` has to sit in that exact slot. **Above `base`**, because Tailwind's
|
|
84
|
+
preflight resets `*{margin:0;padding:0;border:0 solid}` — put Roster below it
|
|
85
|
+
and that reset outranks Roster's own spacing and border utilities, silently
|
|
86
|
+
stripping padding off buttons and turning `border-transparent` into a visible
|
|
87
|
+
1px line. **Below `utilities`**, so your app's classes and variants such as
|
|
88
|
+
`dark:hidden` still win.
|
|
89
|
+
|
|
90
|
+
Layers are ordered by *first registration*, so importing Roster before Tailwind
|
|
91
|
+
is the reliable arrangement. If you would rather not depend on import order at
|
|
92
|
+
all, declare the same line yourself at the top of your global stylesheet and it
|
|
93
|
+
holds regardless.
|
|
94
|
+
|
|
95
|
+
### The global reset is opt-in
|
|
96
|
+
|
|
97
|
+
Roster ships **no** preflight. A component library has no business resetting
|
|
98
|
+
its host's document, so importing Roster will not change your headings, lists,
|
|
99
|
+
or box sizing.
|
|
100
|
+
|
|
101
|
+
Roster's components do assume that normalization exists, though. If your app
|
|
102
|
+
runs Tailwind, you already have it and there is nothing to do. If it does not,
|
|
103
|
+
opt in, before the component styles:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import "@blakesteve/roster/preflight.css";
|
|
107
|
+
import "@blakesteve/roster/style.css";
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Skip it and components render against browser defaults: serif type, bulleted
|
|
111
|
+
lists, and `content-box` sizing.
|
|
112
|
+
|
|
46
113
|
## Quick start
|
|
47
114
|
|
|
48
115
|
```tsx
|
|
@@ -75,27 +142,30 @@ function App() {
|
|
|
75
142
|
|---|---|
|
|
76
143
|
| `Avatar` | User avatar with image, initials fallback, and optional popover |
|
|
77
144
|
| `Badge` | Status label with semantic color schemes and fill variants |
|
|
78
|
-
| `Button` | Primary interactive element
|
|
145
|
+
| `Button` | Primary interactive element: solid, soft, outline, ghost, link variants |
|
|
79
146
|
| `Card` | Bordered surface container |
|
|
80
147
|
| `Checkbox` | Accessible checkbox with label support |
|
|
81
148
|
| `Disclosure` | Show/hide toggle using HeadlessUI |
|
|
82
149
|
| `Input` | Text input with label, error state, and icon slots |
|
|
83
150
|
| `Link` | Styled anchor with variant support |
|
|
151
|
+
| `PasswordInput` | Password field with a show/hide reveal toggle |
|
|
152
|
+
| `Pill` | Inline phrase chrome: social proof, live state, applied filters |
|
|
84
153
|
| `AvatarStrip` | Stacked avatar row with overflow chip, dismiss button, trailing slot, and label area |
|
|
85
154
|
| `CollapsibleSection` | Clamps any content (prose, chips, image grids) to a fixed height with a fade and expand/collapse toggle |
|
|
86
|
-
| `LiquidTabs` | Controlled tab strip with a liquid sliding pill indicator
|
|
155
|
+
| `LiquidTabs` | Controlled tab strip with a liquid sliding pill indicator: pill and filled variants |
|
|
87
156
|
| `Select` | Dropdown selector |
|
|
88
157
|
| `SegmentBar` | Proportional horizontal bar divided into colored segments with optional legend |
|
|
89
158
|
| `Spinner` | Loading indicator |
|
|
90
159
|
| `Switch` | Toggle switch |
|
|
91
160
|
| `Textarea` | Multi-line text input |
|
|
92
|
-
| `Tooltip` | Radix-powered tooltip
|
|
161
|
+
| `Tooltip` | Radix-powered tooltip: hover/focus on desktop, tap-to-toggle on mobile |
|
|
93
162
|
|
|
94
163
|
### Molecules
|
|
95
164
|
|
|
96
165
|
| Component | Description |
|
|
97
166
|
|---|---|
|
|
98
167
|
| `Accordion` | Collapsible content sections (single or multi-expand) |
|
|
168
|
+
| `Alert` | Inline notice strip with optional title and dismiss |
|
|
99
169
|
| `Breadcrumbs` | Navigation trail |
|
|
100
170
|
| `CallToAction` | Prominent hero-style CTA block |
|
|
101
171
|
| `EmptyState` | Zero-data placeholder with icon and action slot |
|
|
@@ -108,12 +178,39 @@ function App() {
|
|
|
108
178
|
|---|---|
|
|
109
179
|
| `ActionBar` | Sticky bottom action strip |
|
|
110
180
|
| `Countdown` | Live countdown timer |
|
|
111
|
-
| `DataTable` | Full-featured table with sorting and pagination via TanStack Table |
|
|
181
|
+
| `DataTable` | Full-featured table with sorting and pagination via TanStack Table v9. Imported from `@blakesteve/roster/data-table` (see [DataTable columns](#datatable-columns)) |
|
|
112
182
|
| `Dialog` | Modal dialog |
|
|
113
183
|
| `Footer` | Site footer |
|
|
114
184
|
| `Navbar` | Responsive navigation bar with mobile slide-out |
|
|
115
185
|
| `Table` | Static data table |
|
|
116
186
|
|
|
187
|
+
### DataTable columns
|
|
188
|
+
|
|
189
|
+
TanStack Table v9 types column definitions against the feature set that built
|
|
190
|
+
the table. `DataTable` registers sorting and pagination and exports that set as
|
|
191
|
+
`RosterTableFeatures`, so your columns name it:
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { DataTable, type RosterTableFeatures } from "@blakesteve/roster/data-table";
|
|
195
|
+
import { createColumnHelper, type ColumnDef } from "@tanstack/react-table";
|
|
196
|
+
|
|
197
|
+
type Player = { name: string; points: number };
|
|
198
|
+
|
|
199
|
+
const columns: ColumnDef<RosterTableFeatures, Player>[] = [
|
|
200
|
+
{ accessorKey: "name", header: "Player" },
|
|
201
|
+
{ accessorKey: "points", header: "Points" },
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
// Or, to keep each column's value type:
|
|
205
|
+
const helper = createColumnHelper<RosterTableFeatures, Player>();
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Upgrading from roster 2.x: `ColumnDef<Player, unknown>` becomes
|
|
209
|
+
`ColumnDef<RosterTableFeatures, Player>`, and `DataTableProps` takes one type
|
|
210
|
+
argument instead of two. A columns array is heterogeneous, so v9 types each
|
|
211
|
+
entry's value as `unknown` and recovers the real type per column through
|
|
212
|
+
`createColumnHelper`.
|
|
213
|
+
|
|
117
214
|
### Hooks
|
|
118
215
|
|
|
119
216
|
| Hook | Description |
|
|
@@ -155,8 +252,10 @@ Output in `dist/`:
|
|
|
155
252
|
|---|---|
|
|
156
253
|
| `roster.es.js` | ES module bundle |
|
|
157
254
|
| `roster.umd.js` | UMD bundle |
|
|
158
|
-
| `
|
|
255
|
+
| `data-table.es.js` | DataTable entry, keeping the TanStack import out of the main bundle |
|
|
256
|
+
| `roster.css` | Compiled component styles, in the `roster` cascade layer |
|
|
159
257
|
| `tokens.css` | Design token CSS variables |
|
|
258
|
+
| `preflight.css` | Optional global reset (see Setup) |
|
|
160
259
|
| `index.d.ts` | TypeScript definitions |
|
|
161
260
|
|
|
162
261
|
## Contributing
|