@editio-ui/react 0.1.1 → 0.1.2
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 +257 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Editio
|
|
2
|
+
|
|
3
|
+
**An editorial design system for the web.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@editio-ui/react)
|
|
6
|
+
[](https://www.npmjs.com/package/@editio-ui/react)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
Editio brings the visual language of print to the web: mastheads, ink, paper, proof marks, halftones, expressive typography and carefully composed layouts.
|
|
10
|
+
|
|
11
|
+
It pairs headless React primitives with an optional plain-CSS editorial design layer. Use the primitives with your own styles, or use the editorial layer with React or native HTML.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npm install @editio-ui/react
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pnpm add @editio-ui/react
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
yarn add @editio-ui/react
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
bun add @editio-ui/react
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Requires React and React DOM 18 or later, as declared in the package's peer dependencies, and an ES module-compatible build environment. TypeScript declarations are included. No Tailwind CSS required.
|
|
32
|
+
|
|
33
|
+
## Quick start
|
|
34
|
+
|
|
35
|
+
Import the styles once in your application entry point (for example, `src/main.tsx` in Vite):
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import "@editio-ui/react/editorial.css";
|
|
39
|
+
import "@editio-ui/react/fonts.css"; // Optional: loads Google Fonts
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Create an editorial interface:
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { Button, Checkbox, Input } from "@editio-ui/react";
|
|
46
|
+
|
|
47
|
+
export default function App() {
|
|
48
|
+
return (
|
|
49
|
+
<main data-ed-theme="bone" data-ed-surface="paper">
|
|
50
|
+
<h2 className="ed-headline">
|
|
51
|
+
Behind the <em className="ed-swash">Camera</em>
|
|
52
|
+
</h2>
|
|
53
|
+
|
|
54
|
+
<form onSubmit={(event) => event.preventDefault()}>
|
|
55
|
+
<label className="ed-label" htmlFor="email">Email address</label>
|
|
56
|
+
<Input id="email" type="email" className="ed-input"
|
|
57
|
+
data-variant="underline" placeholder="you@example.com" required />
|
|
58
|
+
<label className="ed-field">
|
|
59
|
+
<Checkbox className="ed-check" data-variant="proof" />
|
|
60
|
+
Receive editorial updates
|
|
61
|
+
</label>
|
|
62
|
+
<Button type="submit" className="ed-btn" data-variant="offset">
|
|
63
|
+
Subscribe
|
|
64
|
+
</Button>
|
|
65
|
+
</form>
|
|
66
|
+
</main>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The form is a visual example; connect your own submission handler for real subscriptions.
|
|
72
|
+
|
|
73
|
+
## Two layers, one library
|
|
74
|
+
|
|
75
|
+
### Headless React primitives
|
|
76
|
+
|
|
77
|
+
The React exports provide native element behavior without imposing visual styles. Use `className`, `style`, native attributes and event handlers to customize them.
|
|
78
|
+
|
|
79
|
+
| Export | Purpose |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `Button` | Native button; defaults to `type="button"` |
|
|
82
|
+
| `Checkbox` | Native checkbox with controlled, uncontrolled and indeterminate states |
|
|
83
|
+
| `Switch` | Checkbox-based on/off control with `role="switch"` |
|
|
84
|
+
| `RadioGroup.Root` / `RadioGroup.Item` | Grouped native radio inputs |
|
|
85
|
+
| `Input` | Native input |
|
|
86
|
+
| `Textarea` | Native textarea |
|
|
87
|
+
| `Separator` | Semantic separator |
|
|
88
|
+
|
|
89
|
+
### Editorial CSS
|
|
90
|
+
|
|
91
|
+
The design layer provides 105 gallery plates across 14 categories. These are CSS and markup recipes, not 105 separately exported React components.
|
|
92
|
+
|
|
93
|
+
| Category | Examples |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| Buttons | Offset, rule, highlighter, swash, postmark, crop marks |
|
|
96
|
+
| Checkboxes | Ink tick, proof mark, strike, circled, halftone |
|
|
97
|
+
| Switches | Print-inspired on/off controls |
|
|
98
|
+
| Radios | Numerals, targets, section tabs, tier cards |
|
|
99
|
+
| Fields | Underlined inputs and subscription fields |
|
|
100
|
+
| Textareas | Editorial writing fields |
|
|
101
|
+
| Rules | Masthead, double, dotted and ornamental rules |
|
|
102
|
+
| Backgrounds | Newsprint, halftone, hatching and crop marks |
|
|
103
|
+
| Typography | Headlines, drop caps, columns and footnotes |
|
|
104
|
+
| Layout | Navigation, tickers, cards, lists and pagination |
|
|
105
|
+
| Disclosure | Accordions, tabs, tooltips and menus |
|
|
106
|
+
| Feedback | Notices, progress, skeletons and loaders |
|
|
107
|
+
| Motion | Rising headlines, marquees, counters and typewriters |
|
|
108
|
+
| Showcase | Covers, indexes, carousels, filters, charts and timelines |
|
|
109
|
+
|
|
110
|
+
## Button variants
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { Button } from "@editio-ui/react";
|
|
114
|
+
|
|
115
|
+
<Button className="ed-btn" data-variant="offset">Subscribe</Button>
|
|
116
|
+
<Button className="ed-btn" data-variant="rule">Read the story</Button>
|
|
117
|
+
<Button className="ed-btn" data-variant="highlight">Most read</Button>
|
|
118
|
+
<Button className="ed-btn" data-variant="swash">Join the list</Button>
|
|
119
|
+
<Button className="ed-btn" data-variant="crop">Download PDF</Button>
|
|
120
|
+
<Button className="ed-btn" data-variant="halftone">Print edition</Button>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Some variants require additional markup, such as the postmark SVG, roll label or menu bars. Use the gallery's corresponding HTML or React recipe for those variants.
|
|
124
|
+
|
|
125
|
+
## Controlled components
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import { useState } from "react";
|
|
129
|
+
import { Checkbox, RadioGroup } from "@editio-ui/react";
|
|
130
|
+
|
|
131
|
+
export function Preferences() {
|
|
132
|
+
const [checked, setChecked] = useState(false);
|
|
133
|
+
const [edition, setEdition] = useState("digital");
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<>
|
|
137
|
+
<label className="ed-field">
|
|
138
|
+
<Checkbox className="ed-check" data-variant="tick"
|
|
139
|
+
checked={checked} onCheckedChange={setChecked} />
|
|
140
|
+
Receive updates
|
|
141
|
+
</label>
|
|
142
|
+
<RadioGroup.Root aria-label="Edition" name="edition"
|
|
143
|
+
value={edition} onValueChange={setEdition}>
|
|
144
|
+
<label><RadioGroup.Item value="digital" /> Digital</label>
|
|
145
|
+
<label><RadioGroup.Item value="print" /> Print</label>
|
|
146
|
+
</RadioGroup.Root>
|
|
147
|
+
</>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Use with native HTML
|
|
153
|
+
|
|
154
|
+
The editorial stylesheet does not depend on React component behavior. Load it through your build tool and use the same classes in HTML:
|
|
155
|
+
|
|
156
|
+
```html
|
|
157
|
+
<button class="ed-btn" data-variant="offset">Subscribe</button>
|
|
158
|
+
<label class="ed-field">
|
|
159
|
+
<input type="checkbox" class="ed-check" data-variant="proof" />
|
|
160
|
+
Approved
|
|
161
|
+
</label>
|
|
162
|
+
<div class="ed-bg" data-bg="fade"></div>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Themes
|
|
166
|
+
|
|
167
|
+
Apply `data-ed-theme` to a container to change its palette.
|
|
168
|
+
|
|
169
|
+
| Theme | Character |
|
|
170
|
+
| --- | --- |
|
|
171
|
+
| `mono` | White stock, black ink and grey accents (default) |
|
|
172
|
+
| `graphite` | Near-black stock and off-white ink |
|
|
173
|
+
| `bone` | Warm grey paper and soft black |
|
|
174
|
+
| `slate` | Cool grey and muted blue-grey |
|
|
175
|
+
| `oxide` | Warm paper and brick red |
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
<section data-ed-theme="oxide" data-ed-surface="paper">
|
|
179
|
+
<Button className="ed-btn" data-variant="offset">Read the issue</Button>
|
|
180
|
+
</section>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Use `data-ed-surface="paper"`, `"ink"` or `"accent"` to switch local surface colors. Themes and surfaces can be nested.
|
|
184
|
+
|
|
185
|
+
### Custom tokens
|
|
186
|
+
|
|
187
|
+
Load your overrides after Editio's stylesheet:
|
|
188
|
+
|
|
189
|
+
```css
|
|
190
|
+
[data-ed-theme="oxide"] {
|
|
191
|
+
--ed-p-paper: #f5f0e7;
|
|
192
|
+
--ed-p-ink: #20201d;
|
|
193
|
+
--ed-p-accent: #963b30;
|
|
194
|
+
--ed-p-on-accent: #ffffff;
|
|
195
|
+
--ed-radius: 0px;
|
|
196
|
+
--ed-hair: 1px;
|
|
197
|
+
--ed-thick: 3px;
|
|
198
|
+
--ed-dot: 7px;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Typography is configurable through `--ed-font-display`, `--ed-font-swash`, `--ed-font-text` and `--ed-font-mono`.
|
|
203
|
+
|
|
204
|
+
## Stylesheet imports
|
|
205
|
+
|
|
206
|
+
Import the complete design layer, or choose individual CSS modules. Import tokens first when using individual modules.
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import "@editio-ui/react/editorial/tokens.css";
|
|
210
|
+
import "@editio-ui/react/editorial/buttons.css";
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Available modules: `tokens`, `buttons`, `choices`, `fields`, `backgrounds`, `type`, `disclosure`, `feedback`, `motion` and `showcase` (each with a `.css` extension).
|
|
214
|
+
|
|
215
|
+
The optional `@editio-ui/react/fonts.css` imports Archivo, Bodoni Moda, Newsreader and JetBrains Mono from Google Fonts. Font files are not bundled. Omit this import if you prefer system fallbacks or self-hosted fonts.
|
|
216
|
+
|
|
217
|
+
## Accessibility and motion
|
|
218
|
+
|
|
219
|
+
Editio's primitives use native HTML controls where possible, preserving browser keyboard and form behavior. The editorial layer includes reduced-motion styles. Provide meaningful labels, accessible names and appropriate semantics when composing your own interfaces. Test your finished application for accessibility and browser compatibility.
|
|
220
|
+
|
|
221
|
+
## Updating
|
|
222
|
+
|
|
223
|
+
```sh
|
|
224
|
+
npm install @editio-ui/react@latest
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Development from source
|
|
228
|
+
|
|
229
|
+
The repository uses pnpm workspaces. Its source README specifies Node 22.22.2 or later for development tooling.
|
|
230
|
+
|
|
231
|
+
```sh
|
|
232
|
+
pnpm install
|
|
233
|
+
pnpm --filter @editio-ui/react build
|
|
234
|
+
pnpm --filter gallery dev
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The gallery provides a theme studio and copyable HTML, CSS and React recipes. To run the documentation site:
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
pnpm dev:docs
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
To validate the source:
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
pnpm --filter @editio-ui/react typecheck
|
|
247
|
+
pnpm --filter @editio-ui/react test
|
|
248
|
+
pnpm --filter gallery test
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Project status
|
|
252
|
+
|
|
253
|
+
Editio is in early development. Public APIs and design recipes may evolve before the stable release.
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
MIT, as declared in the package metadata.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
{
|
|
3
3
|
"name": "@editio-ui/react",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "Headless, accessible React components with an editorial design layer for expressive, typography-driven and print-inspired websites.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|