@blakesteve/roster 4.0.0 → 4.2.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 +76 -1
- package/dist/Table-BaJ8qfrV.js +4949 -0
- package/dist/Table-Cqm_mtRS.cjs +566 -0
- package/dist/components/atoms/Eyebrow/Eyebrow.d.ts +29 -0
- package/dist/components/atoms/Eyebrow/eyebrow-variants.d.ts +13 -0
- package/dist/components/atoms/InlineCode/InlineCode.d.ts +9 -0
- package/dist/components/atoms/InlineCode/inline-code-variants.d.ts +10 -0
- package/dist/components/atoms/LabeledDivider/LabeledDivider.d.ts +19 -0
- package/dist/components/atoms/Stat/Stat.d.ts +21 -0
- package/dist/components/atoms/Stat/stat-variants.d.ts +9 -0
- package/dist/components/atoms/ThemeToggle/ThemeToggle.d.ts +31 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +42 -3
- package/dist/components/molecules/DescriptionList/DescriptionList.d.ts +24 -0
- package/dist/components/molecules/DescriptionList/description-list-variants.d.ts +10 -0
- package/dist/components/molecules/Pullquote/Pullquote.d.ts +22 -0
- package/dist/components/molecules/Pullquote/pullquote-variants.d.ts +11 -0
- package/dist/data-table.cjs.js +1 -1
- package/dist/data-table.es.js +6 -5
- package/dist/hooks/useKeySequence.d.ts +39 -0
- package/dist/index.d.ts +13 -0
- package/dist/preflight.cjs.js +1 -1
- package/dist/preflight.es.js +1 -1
- package/dist/roster.cjs.js +2 -2
- package/dist/roster.css +1 -1
- package/dist/roster.es.js +2863 -2528
- package/dist/tokens.cjs.js +1 -1
- package/dist/tokens.es.js +1 -1
- package/dist/utils-D2U2F80P.cjs +1 -0
- package/dist/utils-DtaLkIY8.js +2776 -0
- package/dist/utils.cjs.js +1 -0
- package/dist/utils.d.ts +14 -0
- package/dist/utils.es.js +4 -0
- package/package.json +6 -1
- package/dist/Table-CG6Z6c1A.js +0 -7711
- package/dist/Table-CPAcmkIV.cjs +0 -566
package/README.md
CHANGED
|
@@ -110,6 +110,60 @@ import "@blakesteve/roster/style.css";
|
|
|
110
110
|
Skip it and components render against browser defaults: serif type, bulleted
|
|
111
111
|
lists, and `content-box` sizing.
|
|
112
112
|
|
|
113
|
+
### Dark mode
|
|
114
|
+
|
|
115
|
+
Every component reads a `.dark` class on an ancestor, so dark mode is whatever
|
|
116
|
+
puts that class on your document root. `ThemeToggle` is the component that does
|
|
117
|
+
it, and it persists the choice to `localStorage`:
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import { ThemeToggle } from "@blakesteve/roster";
|
|
121
|
+
|
|
122
|
+
<ThemeToggle />;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
A toggle alone cannot prevent a flash of the wrong theme on first paint, because
|
|
126
|
+
the class has to be on `<html>` before React runs. Add a blocking script to your
|
|
127
|
+
document head:
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<script>
|
|
131
|
+
try {
|
|
132
|
+
var s = localStorage.getItem("roster-theme");
|
|
133
|
+
var dark = s ? s === "dark" : matchMedia("(prefers-color-scheme: dark)").matches;
|
|
134
|
+
if (dark) document.documentElement.classList.add("dark");
|
|
135
|
+
} catch (e) {}
|
|
136
|
+
</script>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
If you pass a custom `storageKey`, change the script to match — a mismatch means
|
|
140
|
+
the script and the toggle disagree, which shows up as a flash on every reload.
|
|
141
|
+
|
|
142
|
+
`Navbar`'s `themeMode` prop is a different thing: it describes what palette the
|
|
143
|
+
bar paints *itself* with. Pair them with `themeMode="auto"` and the nav follows
|
|
144
|
+
whatever `ThemeToggle` sets.
|
|
145
|
+
|
|
146
|
+
### Components that render links
|
|
147
|
+
|
|
148
|
+
`Breadcrumbs` renders a plain `<a>` by default, which is right for a static
|
|
149
|
+
page and wrong inside a router — every hop becomes a full page load. Pass your
|
|
150
|
+
router's link component instead:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import NextLink from "next/link";
|
|
154
|
+
|
|
155
|
+
<Breadcrumbs linkComponent={NextLink} items={items} />;
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
In an app with React Server Components, do that from a client component.
|
|
159
|
+
`linkComponent` is a function, and functions do not cross the RSC boundary —
|
|
160
|
+
passing it from a server component fails the render with *Functions cannot be
|
|
161
|
+
passed directly to Client Components*. A small `"use client"` wrapper binds it
|
|
162
|
+
once, and the pages that use the wrapper stay server-rendered.
|
|
163
|
+
|
|
164
|
+
`Eyebrow` takes the other approach: `as` accepts any element and the props
|
|
165
|
+
follow it, so `<Eyebrow as="a" href="/work">` works, as does `as={NextLink}`.
|
|
166
|
+
|
|
113
167
|
## Quick start
|
|
114
168
|
|
|
115
169
|
```tsx
|
|
@@ -146,7 +200,10 @@ function App() {
|
|
|
146
200
|
| `Card` | Bordered surface container |
|
|
147
201
|
| `Checkbox` | Accessible checkbox with label support |
|
|
148
202
|
| `Disclosure` | Show/hide toggle using HeadlessUI |
|
|
203
|
+
| `Eyebrow` | Small tracked-out uppercase label above a heading or beside a rule; polymorphic via `as` |
|
|
204
|
+
| `InlineCode` | Inline `<code>` for identifiers in running prose |
|
|
149
205
|
| `Input` | Text input with label, error state, and icon slots |
|
|
206
|
+
| `LabeledDivider` | Horizontal rule carrying a label, with an optional trailing count |
|
|
150
207
|
| `Link` | Styled anchor with variant support |
|
|
151
208
|
| `PasswordInput` | Password field with a show/hide reveal toggle |
|
|
152
209
|
| `Pill` | Inline phrase chrome: social proof, live state, applied filters |
|
|
@@ -155,9 +212,11 @@ function App() {
|
|
|
155
212
|
| `LiquidTabs` | Controlled tab strip with a liquid sliding pill indicator: pill and filled variants |
|
|
156
213
|
| `Select` | Dropdown selector |
|
|
157
214
|
| `SegmentBar` | Proportional horizontal bar divided into colored segments with optional legend |
|
|
215
|
+
| `Stat` | A single figure with its label and, optionally, where the figure came from |
|
|
158
216
|
| `Spinner` | Loading indicator |
|
|
159
217
|
| `Switch` | Toggle switch |
|
|
160
218
|
| `Textarea` | Multi-line text input |
|
|
219
|
+
| `ThemeToggle` | Flips class-based dark mode on the document root and remembers the choice; labels and icons are configurable |
|
|
161
220
|
| `Tooltip` | Radix-powered tooltip: hover/focus on desktop, tap-to-toggle on mobile |
|
|
162
221
|
|
|
163
222
|
### Molecules
|
|
@@ -166,11 +225,13 @@ function App() {
|
|
|
166
225
|
|---|---|
|
|
167
226
|
| `Accordion` | Collapsible content sections (single or multi-expand) |
|
|
168
227
|
| `Alert` | Inline notice strip with optional title and dismiss |
|
|
169
|
-
| `Breadcrumbs` | Navigation trail |
|
|
228
|
+
| `Breadcrumbs` | Navigation trail; pass `linkComponent` to keep navigation client-side |
|
|
170
229
|
| `CallToAction` | Prominent hero-style CTA block |
|
|
230
|
+
| `DescriptionList` | Label and value pairs as a real `<dl>`: inline, stacked, or split |
|
|
171
231
|
| `EmptyState` | Zero-data placeholder with icon and action slot |
|
|
172
232
|
| `ErrorState` | Error display with retry action |
|
|
173
233
|
| `MatchupCard` | Head-to-head comparison card |
|
|
234
|
+
| `Pullquote` | A line lifted out of prose, as `<figure>` + `<blockquote>` + `<figcaption>` |
|
|
174
235
|
|
|
175
236
|
### Organisms
|
|
176
237
|
|
|
@@ -211,11 +272,25 @@ argument instead of two. A columns array is heterogeneous, so v9 types each
|
|
|
211
272
|
entry's value as `unknown` and recovers the real type per column through
|
|
212
273
|
`createColumnHelper`.
|
|
213
274
|
|
|
275
|
+
### Server components
|
|
276
|
+
|
|
277
|
+
The main entry carries a `"use client"` directive, because nearly everything in
|
|
278
|
+
it is interactive. That is correct for components and wrong for a plain
|
|
279
|
+
function, so `cn` ships from its own entry with no directive:
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
import { cn } from "@blakesteve/roster/utils";
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Importing `cn` from the package root still works on the client. In a React
|
|
286
|
+
Server Component it typechecks and then throws at render — use `/utils` there.
|
|
287
|
+
|
|
214
288
|
### Hooks
|
|
215
289
|
|
|
216
290
|
| Hook | Description |
|
|
217
291
|
|---|---|
|
|
218
292
|
| `useCountdown` | Countdown timer logic without the UI |
|
|
293
|
+
| `useKeySequence` | Fires a callback when a sequence of keys is typed in order. Ships `KONAMI_CODE` |
|
|
219
294
|
|
|
220
295
|
## Development
|
|
221
296
|
|