@editio-ui/react 0.0.0-stage → 0.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.
Files changed (44) hide show
  1. package/dist/components/button/button.d.ts +17 -0
  2. package/dist/components/button/button.js +11 -0
  3. package/dist/components/button/index.d.ts +2 -0
  4. package/dist/components/checkbox/checkbox.d.ts +23 -0
  5. package/dist/components/checkbox/checkbox.js +19 -0
  6. package/dist/components/checkbox/index.d.ts +2 -0
  7. package/dist/components/input/index.d.ts +2 -0
  8. package/dist/components/input/input.d.ts +15 -0
  9. package/dist/components/input/input.js +14 -0
  10. package/dist/components/objects/index.d.ts +18 -0
  11. package/dist/components/objects/index.js +220 -0
  12. package/dist/components/radio-group/index.d.ts +2 -0
  13. package/dist/components/radio-group/radio-group.d.ts +31 -0
  14. package/dist/components/radio-group/radio-group.js +47 -0
  15. package/dist/components/separator/index.d.ts +2 -0
  16. package/dist/components/separator/separator.d.ts +18 -0
  17. package/dist/components/separator/separator.js +13 -0
  18. package/dist/components/studies/index.d.ts +25 -0
  19. package/dist/components/studies/index.js +140 -0
  20. package/dist/components/switch/index.d.ts +2 -0
  21. package/dist/components/switch/switch.d.ts +7 -0
  22. package/dist/components/switch/switch.js +12 -0
  23. package/dist/components/textarea/index.d.ts +2 -0
  24. package/dist/components/textarea/textarea.d.ts +15 -0
  25. package/dist/components/textarea/textarea.js +14 -0
  26. package/dist/editorial/backgrounds.css +203 -0
  27. package/dist/editorial/buttons.css +223 -0
  28. package/dist/editorial/choices.css +374 -0
  29. package/dist/editorial/disclosure.css +365 -0
  30. package/dist/editorial/feedback.css +278 -0
  31. package/dist/editorial/fields.css +221 -0
  32. package/dist/editorial/motion.css +188 -0
  33. package/dist/editorial/objects.css +1 -0
  34. package/dist/editorial/redesign.css +132 -0
  35. package/dist/editorial/showcase.css +401 -0
  36. package/dist/editorial/studies.css +10 -0
  37. package/dist/editorial/tokens.css +129 -0
  38. package/dist/editorial/type.css +387 -0
  39. package/dist/editorial-fonts.css +4 -0
  40. package/dist/editorial.css +2926 -0
  41. package/dist/index.d.ts +17 -0
  42. package/dist/index.js +10 -0
  43. package/package.json +71 -3
  44. package/README.md +0 -3
@@ -0,0 +1,374 @@
1
+ /* ==========================================================================
2
+ Checkboxes, switches, radios. All three are native inputs with
3
+ appearance: none, so keyboard, forms and labels keep working.
4
+ ========================================================================== */
5
+
6
+ /* @variant choices/base */
7
+ .ed-field {
8
+ display: inline-flex;
9
+ align-items: center;
10
+ gap: 0.75em;
11
+ font: 500 1.0625rem/1.3 var(--ed-font-text);
12
+ color: var(--ed-ink);
13
+ cursor: pointer;
14
+ }
15
+ .ed-check,
16
+ .ed-radio,
17
+ .ed-switch {
18
+ appearance: none;
19
+ -webkit-appearance: none;
20
+ position: relative;
21
+ flex: none;
22
+ margin: 0;
23
+ color: var(--ed-ink);
24
+ background: transparent;
25
+ cursor: pointer;
26
+ overflow: visible;
27
+ transition: background-color 0.25s, border-color 0.25s, box-shadow 0.25s, --ed-r 0.35s var(--ed-ease);
28
+ }
29
+ .ed-check::before, .ed-check::after,
30
+ .ed-radio::before, .ed-radio::after,
31
+ .ed-switch::before, .ed-switch::after { content: ""; position: absolute; }
32
+ .ed-check:focus-visible,
33
+ .ed-radio:focus-visible,
34
+ .ed-switch:focus-visible { outline: 2px solid var(--ed-accent); outline-offset: 4px; }
35
+ .ed-check:disabled,
36
+ .ed-radio:disabled,
37
+ .ed-switch:disabled { opacity: 0.38; cursor: not-allowed; }
38
+ .ed-check:disabled ~ *, .ed-radio:disabled ~ *, .ed-switch:disabled ~ * { opacity: 0.55; }
39
+
40
+ /* Layout helpers: stack = vertical list, row = wrapping inline set. */
41
+ .ed-stack { display: grid; gap: 1rem; justify-items: start; }
42
+ .ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; }
43
+
44
+ /* Wrapper for choices whose face is text (chips, tabs, plans). The input
45
+ covers the label so the whole thing is one hit target. */
46
+ .ed-choice { position: relative; display: inline-flex; cursor: pointer; }
47
+ .ed-choice > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
48
+ .ed-choice > input:focus-visible + span { outline: 2px solid var(--ed-accent); outline-offset: 3px; }
49
+
50
+ .ed-field { min-height: 44px; font: 400 .9375rem/1.45 var(--ed-font-display); gap: .85rem; }
51
+ .ed-check:focus-visible, .ed-radio:focus-visible, .ed-switch:focus-visible, .ed-choice > input:focus-visible + span { outline-color: var(--ed-ink); }
52
+ .ed-stack { gap: .5rem; }
53
+ .ed-choice > span { box-sizing: border-box; }
54
+ @media (prefers-reduced-motion: reduce) { .ed-check, .ed-radio, .ed-switch, .ed-choice > span, .ed-check::before, .ed-check::after, .ed-radio::before, .ed-radio::after, .ed-switch::before, .ed-switch::after { transition-duration: .01ms !important; } }
55
+ /* @end */
56
+
57
+ /* ---------- checkboxes ---------- */
58
+
59
+ /* @variant checkboxes/base */
60
+ .ed-check {
61
+ width: 1.5rem;
62
+ height: 1.5rem;
63
+ border: 1.5px solid currentColor;
64
+ border-radius: var(--ed-radius);
65
+ }
66
+
67
+ .ed-check { border-width: 1px; }
68
+ /* @end */
69
+
70
+ /* @variant checkboxes/tick */
71
+ /* Solid ink square, square-cap tick. Mixed state shows a dash. */
72
+ .ed-check[data-variant="tick"]::after {
73
+ inset: 0;
74
+ background: var(--ed-paper);
75
+ -webkit-mask: var(--ed-i-check) center / 74% no-repeat;
76
+ mask: var(--ed-i-check) center / 74% no-repeat;
77
+ transform: scale(0);
78
+ transition: transform 0.22s var(--ed-ease);
79
+ }
80
+ .ed-check[data-variant="tick"]:checked,
81
+ .ed-check[data-variant="tick"]:indeterminate { background: var(--ed-ink); }
82
+ .ed-check[data-variant="tick"]:checked::after { transform: scale(1); }
83
+ .ed-check[data-variant="tick"]:indeterminate::after {
84
+ -webkit-mask: linear-gradient(#000 0 0) center / 52% 2.5px no-repeat;
85
+ mask: linear-gradient(#000 0 0) center / 52% 2.5px no-repeat;
86
+ transform: scale(1);
87
+ }
88
+ /* @end */
89
+
90
+ /* @variant checkboxes/proof */
91
+ /* A pen X that overshoots the box, like marking up a proof. */
92
+ .ed-check[data-variant="proof"]::before,
93
+ .ed-check[data-variant="proof"]::after {
94
+ left: 50%;
95
+ top: 50%;
96
+ width: 150%;
97
+ height: 3px;
98
+ background: var(--ed-accent);
99
+ transform: translate(-50%, -50%) rotate(45deg) scaleX(0);
100
+ transition: transform 0.26s var(--ed-ease);
101
+ }
102
+ .ed-check[data-variant="proof"]::after { transform: translate(-50%, -50%) rotate(-45deg) scaleX(0); transition-delay: 0.09s; }
103
+ .ed-check[data-variant="proof"]:checked::before { transform: translate(-50%, -50%) rotate(45deg) scaleX(1); }
104
+ .ed-check[data-variant="proof"]:checked::after { transform: translate(-50%, -50%) rotate(-45deg) scaleX(1); }
105
+ /* @end */
106
+
107
+ /* @variant checkboxes/strike */
108
+ /* Done items get struck through in the accent colour. Put the label text in the span. */
109
+ .ed-check[data-variant="strike"] { width: 1.15rem; height: 1.15rem; }
110
+ .ed-check[data-variant="strike"]::after {
111
+ inset: 3px;
112
+ background: var(--ed-ink);
113
+ transform: scale(0);
114
+ transition: transform 0.2s var(--ed-ease);
115
+ }
116
+ .ed-check[data-variant="strike"]:checked::after { transform: scale(1); }
117
+ .ed-check[data-variant="strike"] + span {
118
+ background: linear-gradient(var(--ed-accent), var(--ed-accent)) 0 54% / 0% 3px no-repeat;
119
+ transition: background-size 0.4s var(--ed-ease), color 0.3s;
120
+ }
121
+ .ed-check[data-variant="strike"]:checked + span { background-size: 100% 3px; color: var(--ed-ink-2); }
122
+ /* @end */
123
+
124
+ /* @variant checkboxes/circled */
125
+ /* Ellipse that gets circled in marker when ticked. */
126
+ .ed-check[data-variant="circled"] { width: 2.4rem; height: 1.7rem; border-radius: 50%; }
127
+ .ed-check[data-variant="circled"]::before {
128
+ inset: -14% -9%;
129
+ background: var(--ed-accent);
130
+ -webkit-mask: var(--ed-i-scribble) center / 100% 100% no-repeat;
131
+ mask: var(--ed-i-scribble) center / 100% 100% no-repeat;
132
+ clip-path: inset(0 100% 0 0);
133
+ transition: clip-path 0.5s var(--ed-ease);
134
+ }
135
+ .ed-check[data-variant="circled"]:checked::before { clip-path: inset(0 0 0 0); }
136
+ /* @end */
137
+
138
+ /* @variant checkboxes/dots */
139
+ /* Halftone fill. The dots swell until the box reads as solid. */
140
+ .ed-check[data-variant="dots"] {
141
+ --ed-r: 0px;
142
+ background: radial-gradient(circle at center, var(--ed-ink) var(--ed-r), transparent calc(var(--ed-r) + 0.5px)) center / 5px 5px;
143
+ }
144
+ .ed-check[data-variant="dots"]:checked { --ed-r: 3px; }
145
+ .ed-check[data-variant="dots"]:indeterminate { --ed-r: 1.2px; }
146
+ /* @end */
147
+
148
+ /* @variant checkboxes/bracket */
149
+ /* Typewriter brackets. [ ] becomes [×]. */
150
+ .ed-check[data-variant="bracket"] { width: 2.9rem; height: 1.5rem; border: 0; }
151
+ .ed-check[data-variant="bracket"]::before {
152
+ inset: 0;
153
+ display: grid;
154
+ place-items: center;
155
+ content: "[ ]";
156
+ font: 700 1.1rem/1 var(--ed-font-mono);
157
+ white-space: pre;
158
+ }
159
+ .ed-check[data-variant="bracket"]:checked::before { content: "[×]"; color: var(--ed-accent); }
160
+ .ed-check[data-variant="bracket"]:indeterminate::before { content: "[–]"; }
161
+ /* @end */
162
+
163
+ /* @variant checkboxes/chip */
164
+ /* A topic filter. Wrap input and span in .ed-choice. */
165
+ .ed-check[data-variant="chip"] { width: 100%; height: 100%; border: 0; opacity: 0; }
166
+ .ed-check[data-variant="chip"] + span {
167
+ display: inline-block;
168
+ padding: 0.55em 1.05em;
169
+ font: 700 0.75rem/1 var(--ed-font-display);
170
+ letter-spacing: 0.09em;
171
+ text-transform: uppercase;
172
+ color: var(--ed-ink);
173
+ border: 1.5px solid var(--ed-ink);
174
+ border-radius: 999px;
175
+ transition: background-color 0.2s, color 0.2s;
176
+ }
177
+ .ed-choice:hover > .ed-check[data-variant="chip"] + span { background: var(--ed-paper-2); }
178
+ .ed-check[data-variant="chip"]:checked + span { background: var(--ed-ink); color: var(--ed-paper); }
179
+
180
+ .ed-check[data-variant="chip"] + span { min-height: 44px; display: inline-flex; align-items: center; font-weight: 500; letter-spacing: .025em; }
181
+ /* @end */
182
+
183
+ /* ---------- switches ---------- */
184
+
185
+ /* @variant switches/slug */
186
+ /* Newspaper slug: a block slides across a boxed ON/OFF. */
187
+ .ed-switch[data-variant="slug"] { width: 4.9rem; height: 2.1rem; border: 1.5px solid currentColor; border-radius: var(--ed-radius); }
188
+ .ed-switch[data-variant="slug"]::before {
189
+ top: 2px;
190
+ bottom: 2px;
191
+ left: 2px;
192
+ width: calc(50% - 2px);
193
+ background: var(--ed-ink);
194
+ transition: transform 0.3s var(--ed-ease);
195
+ }
196
+ .ed-switch[data-variant="slug"]::after {
197
+ content: "OFF";
198
+ top: 0;
199
+ bottom: 0;
200
+ right: 0;
201
+ width: 50%;
202
+ display: grid;
203
+ place-items: center;
204
+ font: 800 0.66rem/1 var(--ed-font-mono);
205
+ letter-spacing: 0.12em;
206
+ }
207
+ .ed-switch[data-variant="slug"]:checked { background: var(--ed-accent); border-color: var(--ed-ink); color: var(--ed-on-accent); }
208
+ .ed-switch[data-variant="slug"]:checked::before { transform: translateX(100%); background: var(--ed-on-accent); }
209
+ .ed-switch[data-variant="slug"]:checked::after { content: "ON"; right: auto; left: 0; }
210
+ /* @end */
211
+
212
+ /* @variant switches/rule */
213
+ /* A hairline with a square slider. */
214
+ .ed-switch[data-variant="rule"] {
215
+ width: 3rem;
216
+ height: 1.5rem;
217
+ background: linear-gradient(currentColor 0 0) center / 100% var(--ed-hair) no-repeat;
218
+ }
219
+ .ed-switch[data-variant="rule"]::after {
220
+ top: 50%;
221
+ left: 0;
222
+ width: 1.05rem;
223
+ height: 1.05rem;
224
+ background: var(--ed-ink);
225
+ transform: translate(0, -50%);
226
+ transition: transform 0.3s var(--ed-ease), background-color 0.25s;
227
+ }
228
+ .ed-switch[data-variant="rule"]:checked::after { transform: translate(1.95rem, -50%); background: var(--ed-accent); box-shadow: 0 0 0 1.5px var(--ed-ink); }
229
+ /* @end */
230
+
231
+ /* @variant switches/plate */
232
+ /* Boxed track with a hard offset shadow, like a printing plate. */
233
+ .ed-switch[data-variant="plate"] {
234
+ width: 3.7rem;
235
+ height: 1.9rem;
236
+ border: 1.5px solid currentColor;
237
+ border-radius: var(--ed-radius);
238
+ box-shadow: 3px 3px 0 var(--ed-ink);
239
+ }
240
+ .ed-switch[data-variant="plate"]::after {
241
+ top: 3px;
242
+ left: 3px;
243
+ width: calc(1.9rem - 9px);
244
+ height: calc(1.9rem - 9px);
245
+ background: var(--ed-ink);
246
+ transition: transform 0.3s var(--ed-ease), background-color 0.25s;
247
+ }
248
+ .ed-switch[data-variant="plate"]:checked { background: var(--ed-accent); }
249
+ .ed-switch[data-variant="plate"]:checked::after { transform: translateX(1.8rem); }
250
+ /* @end */
251
+
252
+ /* @variant switches/dots */
253
+ /* Empty when off. Halftone fills the track when on. */
254
+ .ed-switch[data-variant="dots"] {
255
+ --ed-r: 0px;
256
+ width: 3.7rem;
257
+ height: 1.9rem;
258
+ border: 1.5px solid currentColor;
259
+ border-radius: 999px;
260
+ background: radial-gradient(circle at center, var(--ed-ink) var(--ed-r), transparent calc(var(--ed-r) + 0.5px)) 0 0 / 5px 5px;
261
+ }
262
+ .ed-switch[data-variant="dots"]::after {
263
+ top: 3px;
264
+ left: 3px;
265
+ width: calc(1.9rem - 9px);
266
+ height: calc(1.9rem - 9px);
267
+ border-radius: 50%;
268
+ background: var(--ed-paper);
269
+ box-shadow: 0 0 0 1.5px var(--ed-ink);
270
+ transition: transform 0.3s var(--ed-ease);
271
+ }
272
+ .ed-switch[data-variant="dots"]:checked { --ed-r: 3px; }
273
+ .ed-switch[data-variant="dots"]:checked::after { transform: translateX(1.8rem); }
274
+ /* @end */
275
+
276
+ /* ---------- radios ---------- */
277
+
278
+ /* @variant radios/base */
279
+ .ed-radio { width: 1.55rem; height: 1.55rem; border: 1.5px solid currentColor; border-radius: 50%; }
280
+ /* @end */
281
+
282
+ /* @variant radios/ring */
283
+ /* Plain ring and dot. The dot is the accent colour with an ink halo. */
284
+ .ed-radio[data-variant="ring"]::after {
285
+ inset: 4px;
286
+ border-radius: 50%;
287
+ background: var(--ed-ink);
288
+ transform: scale(0);
289
+ transition: transform 0.22s var(--ed-ease);
290
+ }
291
+ .ed-radio[data-variant="ring"]:checked::after { transform: scale(1); }
292
+ /* @end */
293
+
294
+ /* @variant radios/numeral */
295
+ /* Roman numerals in italic Didone. Set data-n on each input. */
296
+ .ed-radio[data-variant="numeral"] { width: 2.7rem; height: 2.7rem; border-width: 1px; border-radius: var(--ed-radius); }
297
+ .ed-radio[data-variant="numeral"]::before {
298
+ inset: 0;
299
+ display: grid;
300
+ place-items: center;
301
+ content: attr(data-n);
302
+ font: italic 500 1.3rem/1 var(--ed-font-swash);
303
+ color: var(--ed-ink);
304
+ transition: color 0.2s;
305
+ }
306
+ .ed-radio[data-variant="numeral"]:hover { background: var(--ed-paper-2); }
307
+ .ed-radio[data-variant="numeral"]:checked { background: var(--ed-ink); }
308
+ .ed-radio[data-variant="numeral"]:checked::before { color: var(--ed-paper); }
309
+ /* @end */
310
+
311
+ /* @variant radios/target */
312
+ /* Registration target. Crosshair appears when selected. */
313
+ .ed-radio[data-variant="target"] { width: 1.9rem; height: 1.9rem; }
314
+ .ed-radio[data-variant="target"]::before {
315
+ inset: 50% -5px auto;
316
+ height: 1.5px;
317
+ background: var(--ed-ink);
318
+ transform: scaleX(0);
319
+ transition: transform 0.25s var(--ed-ease);
320
+ }
321
+ .ed-radio[data-variant="target"]::after {
322
+ inset: 6px;
323
+ border-radius: 50%;
324
+ background: var(--ed-accent);
325
+ box-shadow: 0 0 0 1.5px var(--ed-ink);
326
+ transform: scale(0);
327
+ transition: transform 0.25s var(--ed-ease);
328
+ }
329
+ .ed-radio[data-variant="target"]:checked::before { transform: scaleX(1); }
330
+ .ed-radio[data-variant="target"]:checked::after { transform: scale(1); }
331
+ /* @end */
332
+
333
+ /* @variant radios/tab */
334
+ /* Section tabs. Heavy underline marks the current edition. */
335
+ .ed-radio[data-variant="tab"] { width: 100%; height: 100%; border: 0; border-radius: 0; opacity: 0; }
336
+ .ed-radio[data-variant="tab"] + span {
337
+ display: block;
338
+ padding: 0.7em 0.1em 0.6em;
339
+ font: 800 0.8125rem/1 var(--ed-font-display);
340
+ font-stretch: 105%;
341
+ letter-spacing: 0.1em;
342
+ text-transform: uppercase;
343
+ color: var(--ed-ink-2);
344
+ border-bottom: 4px solid transparent;
345
+ transition: color 0.2s, border-color 0.25s;
346
+ }
347
+ .ed-choice:hover > .ed-radio[data-variant="tab"] + span { color: var(--ed-ink); }
348
+ .ed-radio[data-variant="tab"]:checked + span { color: var(--ed-ink); border-bottom-color: var(--ed-accent); }
349
+ /* @end */
350
+
351
+ /* @variant radios/plan */
352
+ /* Selectable tier cards. Selected card inverts and picks up the offset shadow. */
353
+ .ed-radio[data-variant="plan"] { width: 100%; height: 100%; border: 0; border-radius: 0; opacity: 0; }
354
+ .ed-radio[data-variant="plan"] + span {
355
+ display: grid;
356
+ gap: 0.35em;
357
+ min-width: 9.5rem;
358
+ padding: 1rem 1.1rem 1.1rem;
359
+ border: 1.5px solid var(--ed-ink);
360
+ border-radius: var(--ed-radius);
361
+ background: var(--ed-paper);
362
+ color: var(--ed-ink);
363
+ transition: transform 0.25s var(--ed-ease), box-shadow 0.25s var(--ed-ease), background-color 0.2s, color 0.2s;
364
+ }
365
+ .ed-radio[data-variant="plan"] + span b { font: 800 0.75rem/1 var(--ed-font-display); letter-spacing: 0.12em; text-transform: uppercase; }
366
+ .ed-radio[data-variant="plan"] + span i { font: italic 500 1.9rem/1 var(--ed-font-swash); }
367
+ .ed-radio[data-variant="plan"] + span small { font: 500 0.75rem/1.3 var(--ed-font-mono); opacity: 0.7; }
368
+ .ed-choice:hover > .ed-radio[data-variant="plan"] + span { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ed-ink); }
369
+ .ed-radio[data-variant="plan"]:checked + span { background: var(--ed-ink); color: var(--ed-paper); box-shadow: 5px 5px 0 var(--ed-accent); transform: translate(-3px, -3px); }
370
+
371
+ .ed-radio[data-variant="plan"] + span { border-width: 1px; }
372
+ .ed-choice:hover > .ed-radio[data-variant="plan"] + span { transform: none; box-shadow: inset 0 -2px var(--ed-ink); }
373
+ .ed-radio[data-variant="plan"]:checked + span { transform: none; box-shadow: inset 0 -3px var(--ed-accent); }
374
+ /* @end */