gooee 0.41.1 → 0.45.1
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 +1 -1
- package/package.json +1 -1
- package/src/components/AnimatedNumber/AnimatedNumber.module.css +3 -3
- package/src/components/Badge/Badge.module.css +1 -1
- package/src/components/Button/Button.module.css +4 -4
- package/src/components/Dial/Dial.module.css +2 -2
- package/src/components/Dialog/Dialog.module.css +10 -4
- package/src/components/HoldToConfirm/HoldToConfirm.module.css +37 -52
- package/src/components/HoldToConfirm/HoldToConfirm.tsx +146 -60
- package/src/components/Kbd/Kbd.module.css +1 -1
- package/src/components/LivePill/LivePill.module.css +211 -31
- package/src/components/LivePill/LivePill.tsx +45 -14
- package/src/components/MorphButton/MorphButton.module.css +8 -4
- package/src/components/PickerWheel/PickerWheel.module.css +1 -1
- package/src/components/Popover/Popover.module.css +11 -3
- package/src/components/Prose/Prose.module.css +4 -2
- package/src/components/RulerScrubber/RulerScrubber.module.css +1 -1
- package/src/components/SegmentedControl/SegmentedControl.module.css +3 -3
- package/src/components/Sheet/Sheet.module.css +10 -3
- package/src/components/Skeleton/Skeleton.module.css +1 -1
- package/src/components/SplitFlap/SplitFlap.module.css +1 -1
- package/src/components/Switch/Switch.module.css +1 -1
- package/src/components/Tabs/Tabs.module.css +34 -33
- package/src/components/Tabs/Tabs.tsx +64 -21
- package/src/components/ThemeToggle/ThemeToggle.module.css +6 -15
- package/src/components/ThemeToggle/ThemeToggle.tsx +108 -9
- package/src/components/Toast/Toast.module.css +6 -3
- package/src/components/Toast/Toast.tsx +2 -2
- package/src/components/Toggle/Toggle.module.css +1 -1
- package/src/internal/liquidMatter.ts +42 -11
- package/src/internal/motion.ts +1 -1
- package/src/internal/themeReveal.ts +63 -0
- package/src/tokens.css +53 -15
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.root {
|
|
2
2
|
/* The row is the pill plus the card's inner padding, so the label keeps its pixels as the card grows round it. */
|
|
3
|
-
--pill-pad: calc(var(--gooee-space-6) - (var(--gooee-hit-min) - var(--gooee-text-sm) * var(--gooee-leading-normal)) / 2);
|
|
3
|
+
--pill-pad: calc(var(--gooee-space-6) - (var(--gooee-hit-min) - round(nearest, var(--gooee-text-sm) * var(--gooee-leading-normal-ratio), 4px)) / 2);
|
|
4
4
|
position: relative;
|
|
5
5
|
inline-size: 100%;
|
|
6
6
|
max-inline-size: var(--gooee-panel-w-sm);
|
|
@@ -32,10 +32,12 @@
|
|
|
32
32
|
--pill-line: var(--gooee-color-border);
|
|
33
33
|
--pill-key: var(--gooee-color-border-strong);
|
|
34
34
|
--pill-edge: color-mix(in srgb, var(--pill-fg) 16%, transparent);
|
|
35
|
-
|
|
36
|
-
--pill-fill-fg: var(--gooee-color-inverse-fg);
|
|
35
|
+
/* As wide as its words, up to the whole row, and centred on the pill so the pill never moves. */
|
|
37
36
|
position: absolute;
|
|
38
|
-
|
|
37
|
+
left: 50%;
|
|
38
|
+
translate: -50% 0;
|
|
39
|
+
inline-size: max-content;
|
|
40
|
+
max-inline-size: 100%;
|
|
39
41
|
display: flex;
|
|
40
42
|
flex-direction: column;
|
|
41
43
|
border-radius: var(--gooee-radius-sheet);
|
|
@@ -53,8 +55,6 @@
|
|
|
53
55
|
--pill-line: color-mix(in srgb, var(--pill-fg) 18%, var(--pill-bg));
|
|
54
56
|
--pill-key: transparent;
|
|
55
57
|
--pill-edge: transparent;
|
|
56
|
-
--pill-fill: var(--gooee-color-surface);
|
|
57
|
-
--pill-fill-fg: var(--gooee-color-fg);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/* Shut, it closes fast and falls away. Open, the surface pours out of the pill on the liquid curve. */
|
|
@@ -78,10 +78,22 @@
|
|
|
78
78
|
visibility: hidden;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
.shell:not([data-measured]):not([data-open]) .button {
|
|
81
|
+
.shell:not([data-measured]):not([data-open]) :is(.button, .lead) {
|
|
82
82
|
visibility: visible;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.root[data-align='start'] .shell {
|
|
86
|
+
left: auto;
|
|
87
|
+
inset-inline-start: calc(var(--pill-pad) * -1);
|
|
88
|
+
translate: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* The card keeps the same inner padding at its start as above the pill, and the pill stays on its spot. */
|
|
92
|
+
.root[data-align='start'] .row {
|
|
93
|
+
justify-content: flex-start;
|
|
94
|
+
padding-inline-start: var(--pill-pad);
|
|
95
|
+
}
|
|
96
|
+
|
|
85
97
|
.root[data-placement='bottom'] .shell {
|
|
86
98
|
bottom: 0;
|
|
87
99
|
flex-direction: column-reverse;
|
|
@@ -125,7 +137,7 @@
|
|
|
125
137
|
-webkit-tap-highlight-color: transparent;
|
|
126
138
|
}
|
|
127
139
|
|
|
128
|
-
/* The outline
|
|
140
|
+
/* The pill's outline, mixed from the text colour. */
|
|
129
141
|
.button::after {
|
|
130
142
|
content: '';
|
|
131
143
|
position: absolute;
|
|
@@ -146,12 +158,7 @@
|
|
|
146
158
|
box-shadow: inset 0 0 0 var(--gooee-line) transparent;
|
|
147
159
|
}
|
|
148
160
|
|
|
149
|
-
.stack {
|
|
150
|
-
display: grid;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
161
|
.face {
|
|
154
|
-
grid-area: 1 / 1;
|
|
155
162
|
display: inline-flex;
|
|
156
163
|
align-items: center;
|
|
157
164
|
gap: var(--gooee-space-3);
|
|
@@ -164,24 +171,6 @@
|
|
|
164
171
|
font-size: var(--gooee-icon-md);
|
|
165
172
|
}
|
|
166
173
|
|
|
167
|
-
/* The pill as its own progress bar: words under the fill turn to the fill's own ink. */
|
|
168
|
-
.over {
|
|
169
|
-
background: var(--pill-fill);
|
|
170
|
-
color: var(--pill-fill-fg);
|
|
171
|
-
clip-path: inset(0 calc(100% - var(--p) * 100%) 0 0);
|
|
172
|
-
transition:
|
|
173
|
-
clip-path var(--gooee-motion-slow) var(--gooee-ease-out),
|
|
174
|
-
opacity var(--gooee-motion-fast) var(--gooee-ease-out);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.over:dir(rtl) {
|
|
178
|
-
clip-path: inset(0 0 0 calc(100% - var(--p) * 100%));
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.shell[data-open] .over {
|
|
182
|
-
opacity: 0;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
174
|
.body {
|
|
186
175
|
padding: var(--gooee-space-2) var(--gooee-space-6) var(--gooee-space-6);
|
|
187
176
|
opacity: 0;
|
|
@@ -205,3 +194,194 @@
|
|
|
205
194
|
clip-path: inset(50%);
|
|
206
195
|
white-space: nowrap;
|
|
207
196
|
}
|
|
197
|
+
|
|
198
|
+
/* With progress, a ring leads the pill. Shut: a 24px ring 10px in from the pill's 22px corner (12 + 10 = 22).
|
|
199
|
+
Open: the same ring at 44px, 12px in from the card's corner, so the card's radius is 22 + 12 = 34.
|
|
200
|
+
Opening, the ring moves from the pill to the card's top start corner and grows; the card's words sit beside it. */
|
|
201
|
+
.root[data-ring] {
|
|
202
|
+
--ring-l: var(--gooee-hit-min);
|
|
203
|
+
--ring-s: var(--gooee-space-7);
|
|
204
|
+
--ring-in: calc((var(--ring-l) - var(--ring-s)) / 2);
|
|
205
|
+
--card-in: var(--gooee-space-4);
|
|
206
|
+
--card-r: calc(var(--ring-l) / 2 + var(--card-in));
|
|
207
|
+
block-size: var(--ring-l);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.root[data-ring] .shell {
|
|
211
|
+
display: grid;
|
|
212
|
+
grid-template-columns: var(--ring-l) minmax(0, auto);
|
|
213
|
+
column-gap: var(--gooee-space-4);
|
|
214
|
+
padding: var(--card-in) var(--gooee-space-7) var(--card-in) var(--card-in);
|
|
215
|
+
border-radius: var(--card-r);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.root[data-ring] .shell[data-open] {
|
|
219
|
+
clip-path: inset(0 0 0 0 round var(--card-r));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.root[data-ring][data-align='start'] .shell {
|
|
223
|
+
inset-inline-start: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.root[data-ring] .row {
|
|
227
|
+
position: absolute;
|
|
228
|
+
inset-inline-start: 0;
|
|
229
|
+
padding: 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Shut, the pill sits where the card's middle (or start) is, the same spot as without a ring. */
|
|
233
|
+
.root[data-ring][data-align='center'] .row {
|
|
234
|
+
left: 50%;
|
|
235
|
+
translate: -50% 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.root[data-ring][data-align='center'] .shell[data-open] .row {
|
|
239
|
+
left: var(--card-in);
|
|
240
|
+
translate: none;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.root[data-ring][data-placement='top'] .row {
|
|
244
|
+
top: 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.root[data-ring][data-placement='bottom'] .row {
|
|
248
|
+
bottom: 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/* Open, the button is the ring: a 44px target that folds the card back. */
|
|
252
|
+
.root[data-ring] .shell[data-open] .row {
|
|
253
|
+
inset-inline-start: var(--card-in);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.root[data-ring][data-placement='top'] .shell[data-open] .row {
|
|
257
|
+
top: var(--card-in);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.root[data-ring][data-placement='bottom'] .shell[data-open] .row {
|
|
261
|
+
bottom: var(--card-in);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.root[data-ring] .shell[data-open] .button {
|
|
265
|
+
inline-size: var(--ring-l);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.slot {
|
|
269
|
+
flex: none;
|
|
270
|
+
inline-size: var(--ring-s);
|
|
271
|
+
block-size: var(--ring-s);
|
|
272
|
+
margin-inline-start: var(--ring-in);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.root[data-ring] .face {
|
|
276
|
+
padding-inline: var(--gooee-space-3) var(--gooee-space-6);
|
|
277
|
+
transition: opacity var(--gooee-motion-base) var(--gooee-ease-out) var(--gooee-motion-fast);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.root[data-ring] .shell[data-open] .face {
|
|
281
|
+
opacity: 0;
|
|
282
|
+
transition: opacity var(--gooee-motion-instant) var(--gooee-ease-in);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.lead {
|
|
286
|
+
--ring-ink: var(--pill-fg);
|
|
287
|
+
position: relative;
|
|
288
|
+
grid-area: 1 / 1;
|
|
289
|
+
inline-size: var(--ring-l);
|
|
290
|
+
block-size: var(--ring-l);
|
|
291
|
+
color: var(--ring-ink);
|
|
292
|
+
/* Shut, the big ring is scaled down onto the pill's ring slot (24 of 44). LivePill measures the move. */
|
|
293
|
+
align-self: start;
|
|
294
|
+
scale: calc(24 / 44);
|
|
295
|
+
translate: var(--ring-x, 0) var(--ring-y, 0);
|
|
296
|
+
transform-origin: 0 0;
|
|
297
|
+
transition:
|
|
298
|
+
scale var(--gooee-motion-fast) var(--gooee-ease-in),
|
|
299
|
+
translate var(--gooee-motion-fast) var(--gooee-ease-in);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.shell[data-open] .lead {
|
|
303
|
+
scale: 1;
|
|
304
|
+
translate: 0 0;
|
|
305
|
+
transition:
|
|
306
|
+
scale var(--gooee-motion-liquid) var(--gooee-ease-liquid),
|
|
307
|
+
translate var(--gooee-motion-liquid) var(--gooee-ease-liquid);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.lead[data-state='stopped'] {
|
|
311
|
+
--ring-ink: var(--gooee-color-danger);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.ring {
|
|
315
|
+
position: absolute;
|
|
316
|
+
inset: 0;
|
|
317
|
+
inline-size: 100%;
|
|
318
|
+
block-size: 100%;
|
|
319
|
+
rotate: -90deg;
|
|
320
|
+
fill: none;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/* Strokes are in the 44px drawing: 5.5 shows as 3px when the ring is shut at 24px, 4 shows as 4px open. */
|
|
324
|
+
.track,
|
|
325
|
+
.arc {
|
|
326
|
+
stroke-width: 5.5;
|
|
327
|
+
transition: stroke-width var(--gooee-motion-fast) var(--gooee-ease-in);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.shell[data-open] :is(.track, .arc) {
|
|
331
|
+
stroke-width: 4;
|
|
332
|
+
transition: stroke-width var(--gooee-motion-liquid) var(--gooee-ease-liquid);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.track {
|
|
336
|
+
stroke: var(--pill-line);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.lead[data-state='stopped'] .track {
|
|
340
|
+
stroke: var(--ring-ink);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.arc {
|
|
344
|
+
stroke: var(--ring-ink);
|
|
345
|
+
stroke-linecap: round;
|
|
346
|
+
transition:
|
|
347
|
+
stroke-width var(--gooee-motion-fast) var(--gooee-ease-in),
|
|
348
|
+
stroke-dasharray var(--gooee-motion-slow) var(--gooee-ease-out);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.mark {
|
|
352
|
+
position: absolute;
|
|
353
|
+
inset: 0;
|
|
354
|
+
margin: auto;
|
|
355
|
+
inline-size: var(--gooee-space-6);
|
|
356
|
+
block-size: var(--gooee-space-6);
|
|
357
|
+
fill: none;
|
|
358
|
+
stroke: currentColor;
|
|
359
|
+
stroke-width: 2.5;
|
|
360
|
+
stroke-linecap: round;
|
|
361
|
+
stroke-linejoin: round;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.pct {
|
|
365
|
+
position: absolute;
|
|
366
|
+
inset: 0;
|
|
367
|
+
display: grid;
|
|
368
|
+
place-items: center;
|
|
369
|
+
font-size: var(--gooee-text-sm);
|
|
370
|
+
font-weight: var(--gooee-weight-semibold);
|
|
371
|
+
font-variant-numeric: tabular-nums;
|
|
372
|
+
letter-spacing: -0.02em;
|
|
373
|
+
line-height: var(--gooee-leading-none);
|
|
374
|
+
opacity: 0;
|
|
375
|
+
transition: opacity var(--gooee-motion-instant) var(--gooee-ease-in);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.shell[data-open] .pct {
|
|
379
|
+
opacity: 1;
|
|
380
|
+
transition: opacity var(--gooee-motion-base) var(--gooee-ease-out) var(--gooee-motion-fast);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.root[data-ring] .body {
|
|
384
|
+
grid-area: 1 / 2;
|
|
385
|
+
align-self: start;
|
|
386
|
+
padding: 0;
|
|
387
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect, useLayoutEffect, useRef, useState, type ComponentPropsWithRef, type CSSProperties, type ReactNode } from 'react'
|
|
4
4
|
import { cx } from '../../internal/cx'
|
|
5
|
+
import { CheckIcon } from '../../internal/icons'
|
|
5
6
|
import { motionMs } from '../../internal/motion'
|
|
6
7
|
import { useControllable } from '../../internal/useControllable'
|
|
7
8
|
import styles from './LivePill.module.css'
|
|
@@ -21,10 +22,14 @@ export type LivePillProps = Omit<ComponentPropsWithRef<'div'>, 'children' | 'tit
|
|
|
21
22
|
onOpenChange?: (open: boolean) => void
|
|
22
23
|
/** Where it sits. At the bottom it is in thumb reach and grows up; at the top it grows down. */
|
|
23
24
|
placement?: 'bottom' | 'top'
|
|
25
|
+
/** "center" keeps the pill in the middle of its row, like a status bar. "start" puts it at the row's start edge, and the card grows from there. */
|
|
26
|
+
align?: 'center' | 'start'
|
|
24
27
|
/** Pins it to the screen edge, clear of the safe area. Leave off to place it yourself. */
|
|
25
28
|
fixed?: boolean
|
|
26
|
-
/** From 0 to 1:
|
|
29
|
+
/** From 0 to 1: a ring at the pill's start shows it. Open, the ring grows on its spot with the percent inside. */
|
|
27
30
|
progress?: number
|
|
31
|
+
/** "done" closes the ring into a tick (also at progress 1). "stopped" turns it red with a mark; say why in the words. */
|
|
32
|
+
status?: 'done' | 'stopped'
|
|
28
33
|
/** "paper" is a light pill with an outline; "ink" is a solid dark one. */
|
|
29
34
|
tone?: 'paper' | 'ink'
|
|
30
35
|
/** News for screen readers, said once each time it changes, such as "Download paused". Never a ticking number. */
|
|
@@ -46,8 +51,10 @@ export function LivePill({
|
|
|
46
51
|
defaultOpen = false,
|
|
47
52
|
onOpenChange,
|
|
48
53
|
placement = 'bottom',
|
|
54
|
+
align = 'center',
|
|
49
55
|
fixed = false,
|
|
50
56
|
progress,
|
|
57
|
+
status,
|
|
51
58
|
tone = 'paper',
|
|
52
59
|
news,
|
|
53
60
|
alert,
|
|
@@ -61,11 +68,16 @@ export function LivePill({
|
|
|
61
68
|
const button = useRef<HTMLButtonElement>(null)
|
|
62
69
|
const [shut, setShut] = useState<string>()
|
|
63
70
|
const [rowH, setRowH] = useState<number>()
|
|
71
|
+
const [ringAt, setRingAt] = useState<[number, number]>()
|
|
72
|
+
const slot = useRef<HTMLSpanElement>(null)
|
|
73
|
+
const lead = useRef<HTMLSpanElement>(null)
|
|
64
74
|
const [byAlert, setByAlert] = useState(false)
|
|
65
75
|
const [held, setHeld] = useState(false)
|
|
66
76
|
const [said, setSaid] = useState('')
|
|
67
77
|
const lastNews = useRef(news)
|
|
68
78
|
const lastAlert = useRef(alert)
|
|
79
|
+
const openNow = useRef(open)
|
|
80
|
+
openNow.current = open
|
|
69
81
|
|
|
70
82
|
// Shut, the card is cut back to the button's own box, so the pill grows out of its own spot.
|
|
71
83
|
useLayoutEffect(() => {
|
|
@@ -73,10 +85,18 @@ export function LivePill({
|
|
|
73
85
|
const b = button.current
|
|
74
86
|
if (!sh || !b) return
|
|
75
87
|
const measure = () => {
|
|
88
|
+
// Open, the pill's button shrinks to the ring; the shut shape is read only while it is shut.
|
|
89
|
+
if (openNow.current) return
|
|
76
90
|
// Real fractions, not whole pixels: a half-pixel miss shows as an outline thin on one side and thick on the other.
|
|
77
91
|
const s = sh.getBoundingClientRect()
|
|
78
92
|
const r = b.getBoundingClientRect()
|
|
79
|
-
|
|
93
|
+
// A page that scales its content (a zoom, an entrance) scales these boxes too; k turns them back into CSS pixels.
|
|
94
|
+
const k = s.width / sh.offsetWidth || 1
|
|
95
|
+
setShut(`inset(${(r.top - s.top) / k}px ${(s.right - r.right) / k}px ${(s.bottom - r.bottom) / k}px ${(r.left - s.left) / k}px round ${r.height / k / 2}px)`)
|
|
96
|
+
// Shut, the card's ring sits on the pill's ring slot: the distance between the two, read from layout.
|
|
97
|
+
const sl = slot.current?.getBoundingClientRect()
|
|
98
|
+
const ld = lead.current
|
|
99
|
+
if (sl && ld) setRingAt([(sl.left - s.left) / k - ld.offsetLeft, (sl.top - s.top) / k - ld.offsetTop])
|
|
80
100
|
const row = b.parentElement as HTMLElement
|
|
81
101
|
setRowH(row.offsetHeight)
|
|
82
102
|
}
|
|
@@ -134,10 +154,12 @@ export function LivePill({
|
|
|
134
154
|
}, [open, byAlert, held, alertMs])
|
|
135
155
|
|
|
136
156
|
const p = progress === undefined ? undefined : Math.min(1, Math.max(0, progress))
|
|
137
|
-
const
|
|
157
|
+
const state = status ?? (p === 1 ? 'done' : undefined)
|
|
158
|
+
const ring = p !== undefined || state !== undefined
|
|
159
|
+
const vars = { '--pill-shut': shut, '--pill-row': rowH === undefined ? undefined : `${rowH}px`, '--ring-x': ringAt && `${ringAt[0]}px`, '--ring-y': ringAt && `${ringAt[1]}px`, ...style } as CSSProperties
|
|
138
160
|
|
|
139
161
|
return (
|
|
140
|
-
<div className={cx(styles.root, className)} data-placement={placement} data-fixed={fixed || undefined} style={vars} {...rest}>
|
|
162
|
+
<div className={cx(styles.root, className)} data-placement={placement} data-align={align} data-ring={ring || undefined} data-fixed={fixed || undefined} style={vars} {...rest}>
|
|
141
163
|
<div
|
|
142
164
|
ref={shell}
|
|
143
165
|
className={styles.shell}
|
|
@@ -156,18 +178,27 @@ export function LivePill({
|
|
|
156
178
|
if (!e.currentTarget.contains(e.relatedTarget as Node)) setHeld(false)
|
|
157
179
|
}}
|
|
158
180
|
>
|
|
159
|
-
|
|
160
|
-
<
|
|
161
|
-
{
|
|
162
|
-
<
|
|
181
|
+
{ring && (
|
|
182
|
+
<span ref={lead} className={styles.lead} data-state={state} aria-hidden="true">
|
|
183
|
+
<svg className={styles.ring} viewBox="0 0 44 44">
|
|
184
|
+
<circle className={styles.track} cx="22" cy="22" r="20" />
|
|
185
|
+
<circle className={styles.arc} cx="22" cy="22" r="20" pathLength={100} strokeDasharray={`${state ? 100 : (p ?? 0) * 100} 100`} />
|
|
186
|
+
</svg>
|
|
187
|
+
{state === 'done' ? (
|
|
188
|
+
<CheckIcon className={styles.mark} />
|
|
189
|
+
) : state === 'stopped' ? (
|
|
190
|
+
<svg className={styles.mark} viewBox="0 0 24 24">
|
|
191
|
+
<path d="M12 7v6M12 17v.01" />
|
|
192
|
+
</svg>
|
|
163
193
|
) : (
|
|
164
|
-
<span className={styles.
|
|
165
|
-
<span className={styles.face}>{compact}</span>
|
|
166
|
-
<span className={cx(styles.face, styles.over)} aria-hidden="true">
|
|
167
|
-
{compact}
|
|
168
|
-
</span>
|
|
169
|
-
</span>
|
|
194
|
+
<span className={styles.pct}>{Math.round((p ?? 0) * 100)}%</span>
|
|
170
195
|
)}
|
|
196
|
+
</span>
|
|
197
|
+
)}
|
|
198
|
+
<div className={styles.row}>
|
|
199
|
+
<button ref={button} type="button" className={styles.button} aria-expanded={open} aria-label={label} onClick={() => (open ? close(false) : setOpen(true))}>
|
|
200
|
+
{ring && <span ref={slot} className={styles.slot} />}
|
|
201
|
+
<span className={styles.face}>{compact}</span>
|
|
171
202
|
</button>
|
|
172
203
|
</div>
|
|
173
204
|
<div className={styles.body} inert={!open} aria-hidden={!open || undefined}>
|
|
@@ -120,13 +120,14 @@
|
|
|
120
120
|
.shell[data-corner^="b"] .panel { padding: var(--gooee-space-6) var(--gooee-space-6) calc(var(--gooee-control-h-lg) + var(--gooee-space-3)); }
|
|
121
121
|
|
|
122
122
|
.close {
|
|
123
|
+
/* On the corner's own centre, so it follows the curve: inset = corner - half its size. */
|
|
123
124
|
position: absolute;
|
|
124
|
-
top: var(--gooee-
|
|
125
|
-
right: var(--gooee-
|
|
125
|
+
top: calc(var(--gooee-radius-panel) - var(--gooee-control-h-sm) / 2);
|
|
126
|
+
right: calc(var(--gooee-radius-panel) - var(--gooee-control-h-sm) / 2);
|
|
126
127
|
display: grid;
|
|
127
128
|
place-items: center;
|
|
128
|
-
width: var(--gooee-
|
|
129
|
-
height: var(--gooee-
|
|
129
|
+
width: var(--gooee-control-h-sm);
|
|
130
|
+
height: var(--gooee-control-h-sm);
|
|
130
131
|
padding: 0;
|
|
131
132
|
border: 0;
|
|
132
133
|
border-radius: var(--gooee-radius-full);
|
|
@@ -135,6 +136,9 @@
|
|
|
135
136
|
cursor: pointer;
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
/* Looks 32px, keeps a 44px touch area. */
|
|
140
|
+
.close::after { content: ""; position: absolute; inset: calc((var(--gooee-control-h-sm) - var(--gooee-hit-min)) / 2); border-radius: inherit; }
|
|
141
|
+
|
|
138
142
|
.close svg {
|
|
139
143
|
width: var(--gooee-icon-md);
|
|
140
144
|
height: var(--gooee-icon-md);
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
align-items: center;
|
|
34
34
|
justify-content: space-between;
|
|
35
35
|
gap: var(--gooee-space-4);
|
|
36
|
-
margin:
|
|
36
|
+
margin: 0 0 var(--gooee-space-3);
|
|
37
|
+
padding-right: calc(var(--gooee-control-h-sm) + var(--gooee-space-3));
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
.title {
|
|
@@ -43,10 +44,14 @@
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
.close {
|
|
47
|
+
/* On the corner's own centre, so it follows the curve: inset = corner - half its size. */
|
|
48
|
+
position: absolute;
|
|
49
|
+
top: calc(var(--gooee-radius-panel) - var(--gooee-control-h-sm) / 2 - var(--gooee-line));
|
|
50
|
+
right: calc(var(--gooee-radius-panel) - var(--gooee-control-h-sm) / 2 - var(--gooee-line));
|
|
46
51
|
display: grid;
|
|
47
52
|
place-items: center;
|
|
48
|
-
width: var(--gooee-
|
|
49
|
-
height: var(--gooee-
|
|
53
|
+
width: var(--gooee-control-h-sm);
|
|
54
|
+
height: var(--gooee-control-h-sm);
|
|
50
55
|
padding: 0;
|
|
51
56
|
border: 0;
|
|
52
57
|
border-radius: var(--gooee-radius-full);
|
|
@@ -57,6 +62,9 @@
|
|
|
57
62
|
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-out), transform var(--gooee-motion-slow) var(--gooee-ease-spring);
|
|
58
63
|
}
|
|
59
64
|
|
|
65
|
+
/* Looks 32px, keeps a 44px touch area. */
|
|
66
|
+
.close::after { content: ""; position: absolute; inset: calc((var(--gooee-control-h-sm) - var(--gooee-hit-min)) / 2); border-radius: inherit; }
|
|
67
|
+
|
|
60
68
|
@media (hover: hover) {
|
|
61
69
|
.close:hover { background: var(--gooee-color-surface-hover); color: var(--gooee-color-fg); }
|
|
62
70
|
}
|
|
@@ -65,7 +65,9 @@
|
|
|
65
65
|
border-radius: var(--gooee-radius-xs);
|
|
66
66
|
background: var(--gooee-color-surface-sunken);
|
|
67
67
|
font-family: var(--gooee-font-mono);
|
|
68
|
-
font-size:
|
|
68
|
+
font-size: var(--gooee-text-sm);
|
|
69
|
+
/* Smaller words on the line's baseline: a tight box keeps them inside the line, so the line stays whole pixels in every browser. */
|
|
70
|
+
line-height: var(--gooee-leading-none);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
.root :where(pre) {
|
|
@@ -78,7 +80,7 @@
|
|
|
78
80
|
line-height: var(--gooee-leading-normal);
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
.root :where(pre) :where(code) { padding: 0; background: none; font-size: inherit; }
|
|
83
|
+
.root :where(pre) :where(code) { padding: 0; background: none; font-size: inherit; line-height: inherit; }
|
|
82
84
|
|
|
83
85
|
.root :where(img, video) {
|
|
84
86
|
display: block;
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
z-index: -1;
|
|
23
23
|
border-radius: var(--gooee-radius-control);
|
|
24
24
|
background: var(--gooee-color-surface-raised);
|
|
25
|
-
box-shadow: var(--gooee-shadow-
|
|
25
|
+
box-shadow: var(--gooee-shadow-thumb), 0 0 0 var(--gooee-line) var(--gooee-color-border);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/* A resize slides the pill plainly. A new choice flows it (internal/liquidMatter.ts useFlow): while
|
|
29
29
|
it flows the pill hides and .liquid draws it, then the pill is back in its place, exact. */
|
|
30
30
|
.pill[data-ready] {
|
|
31
31
|
transition:
|
|
32
|
-
transform var(--gooee-motion-
|
|
33
|
-
width var(--gooee-motion-
|
|
32
|
+
transform var(--gooee-motion-morph-out) var(--gooee-ease-out),
|
|
33
|
+
width var(--gooee-motion-morph-out) var(--gooee-ease-out);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.pill[data-flowing] {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
align-items: flex-start;
|
|
91
91
|
justify-content: space-between;
|
|
92
92
|
gap: var(--gooee-space-4);
|
|
93
|
-
padding: var(--gooee-space-4) var(--gooee-space-
|
|
93
|
+
padding: var(--gooee-space-4) calc(calc(var(--gooee-radius-sheet) - var(--gooee-control-h-sm) / 2) + var(--gooee-control-h-sm) + var(--gooee-space-3)) var(--gooee-space-3) var(--gooee-space-7);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
.titles {
|
|
@@ -115,11 +115,15 @@
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.close {
|
|
118
|
+
/* On the corner's own centre, so it follows the curve: inset = corner - half its size, less the border. */
|
|
119
|
+
position: absolute;
|
|
120
|
+
top: calc(var(--gooee-radius-sheet) - var(--gooee-control-h-sm) / 2 - var(--gooee-line));
|
|
121
|
+
right: calc(var(--gooee-radius-sheet) - var(--gooee-control-h-sm) / 2 - var(--gooee-line));
|
|
118
122
|
display: grid;
|
|
119
123
|
place-items: center;
|
|
120
124
|
flex: none;
|
|
121
|
-
width: var(--gooee-
|
|
122
|
-
height: var(--gooee-
|
|
125
|
+
width: var(--gooee-control-h-sm);
|
|
126
|
+
height: var(--gooee-control-h-sm);
|
|
123
127
|
padding: 0;
|
|
124
128
|
border: 0;
|
|
125
129
|
border-radius: var(--gooee-radius-full);
|
|
@@ -130,6 +134,9 @@
|
|
|
130
134
|
transition: background-color var(--gooee-motion-fast) var(--gooee-ease-out);
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
/* Looks 32px, keeps a 44px touch area. */
|
|
138
|
+
.close::after { content: ""; position: absolute; inset: calc((var(--gooee-control-h-sm) - var(--gooee-hit-min)) / 2); border-radius: inherit; }
|
|
139
|
+
|
|
133
140
|
@media (hover: hover) {
|
|
134
141
|
.close:hover { background: var(--gooee-color-surface-hover); color: var(--gooee-color-fg); }
|
|
135
142
|
}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
animation-delay: calc(var(--i, 0) * var(--gooee-motion-stagger) * 3);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.text { height: 0.8em; border-radius: var(--gooee-radius-xs); }
|
|
25
|
+
.text { height: 0.8em; height: round(nearest, 0.8em, 4px); border-radius: var(--gooee-radius-xs); }
|
|
26
26
|
.rect { width: 100%; height: var(--gooee-skeleton-block); border-radius: var(--gooee-radius-md); }
|
|
27
27
|
.circle { width: var(--gooee-skeleton-avatar); height: var(--gooee-skeleton-avatar); border-radius: var(--gooee-radius-full); }
|
|
28
28
|
|