@keystone-sites/marketing-design-system 1.0.15 → 1.0.17
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/lib/use-grader-search.ts +10 -4
- package/package.json +1 -1
- package/primitives/prose.css +18 -4
- package/primitives/prose.tsx +2 -2
- package/primitives/report.css +37 -3
- package/primitives/report.tsx +20 -0
package/lib/use-grader-search.ts
CHANGED
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
import { useEffect, useMemo, useState } from "react";
|
|
9
9
|
import { fetchGraderGroup, type GraderSearchGroup, type GraderSuggestion } from "./grader";
|
|
10
10
|
|
|
11
|
-
/** Keystroke settle time before a request goes out
|
|
12
|
-
|
|
11
|
+
/** Keystroke settle time before a request goes out: long enough that a
|
|
12
|
+
* name typed at speed is one or two searches, not one per letter. */
|
|
13
|
+
const DEBOUNCE_MS = 350;
|
|
14
|
+
/** Letters before a search is worth asking for — a single one matches
|
|
15
|
+
* everything and nothing. */
|
|
16
|
+
const MIN_QUERY = 2;
|
|
13
17
|
/** Rows offered per group. */
|
|
14
18
|
const MAX: Record<GraderSearchGroup, number> = { places: 5, web: 3 };
|
|
15
19
|
const GROUPS: GraderSearchGroup[] = ["places", "web"];
|
|
@@ -88,9 +92,11 @@ function state(
|
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
/** `enabled` false parks the search (no fetch, `idle`) — the island uses
|
|
91
|
-
* it once a business is chosen, so the chosen name is never looked up.
|
|
95
|
+
* it once a business is chosen, so the chosen name is never looked up. A
|
|
96
|
+
* query shorter than `MIN_QUERY` is idle too. */
|
|
92
97
|
export function useGraderSearch(query: string, enabled = true): GraderSearchState {
|
|
93
|
-
const
|
|
98
|
+
const trimmed = query.trim();
|
|
99
|
+
const q = enabled && trimmed.length >= MIN_QUERY ? trimmed : "";
|
|
94
100
|
const [answer, setAnswer] = useState<Answer>(EMPTY_ANSWER);
|
|
95
101
|
|
|
96
102
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keystone-sites/marketing-design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Keystone's marketing design system: tokens, the tick grid, type, primitives, site chrome, and the landing kit. Source-shipped CSS and TSX for Next.js consumers.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
package/primitives/prose.css
CHANGED
|
@@ -47,12 +47,19 @@
|
|
|
47
47
|
text-overflow: ellipsis;
|
|
48
48
|
white-space: nowrap;
|
|
49
49
|
}
|
|
50
|
-
.copy[data-clip="2"]
|
|
50
|
+
.copy[data-clip="2"],
|
|
51
|
+
.copy[data-clip="3"] {
|
|
51
52
|
display: -webkit-box;
|
|
52
53
|
-webkit-box-orient: vertical;
|
|
53
|
-
-webkit-line-clamp:
|
|
54
|
+
-webkit-line-clamp: var(--copy-clip);
|
|
54
55
|
white-space: normal;
|
|
55
56
|
}
|
|
57
|
+
.copy[data-clip="2"] {
|
|
58
|
+
--copy-clip: 2;
|
|
59
|
+
}
|
|
60
|
+
.copy[data-clip="3"] {
|
|
61
|
+
--copy-clip: 3;
|
|
62
|
+
}
|
|
56
63
|
.copy-num {
|
|
57
64
|
font-variant-numeric: tabular-nums;
|
|
58
65
|
}
|
|
@@ -62,12 +69,19 @@
|
|
|
62
69
|
text-overflow: ellipsis;
|
|
63
70
|
white-space: nowrap;
|
|
64
71
|
}
|
|
65
|
-
.copy-clip-2
|
|
72
|
+
.copy-clip-2,
|
|
73
|
+
.copy-clip-3 {
|
|
66
74
|
display: -webkit-box;
|
|
67
75
|
-webkit-box-orient: vertical;
|
|
68
|
-
-webkit-line-clamp:
|
|
76
|
+
-webkit-line-clamp: var(--copy-clip);
|
|
69
77
|
overflow: hidden;
|
|
70
78
|
}
|
|
79
|
+
.copy-clip-2 {
|
|
80
|
+
--copy-clip: 2;
|
|
81
|
+
}
|
|
82
|
+
.copy-clip-3 {
|
|
83
|
+
--copy-clip: 3;
|
|
84
|
+
}
|
|
71
85
|
.copy-break {
|
|
72
86
|
word-break: break-all;
|
|
73
87
|
}
|
package/primitives/prose.tsx
CHANGED
|
@@ -39,7 +39,7 @@ const COPY_STEP: Record<CopySize, Record<CopyWeight, string>> = {
|
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
/** Body copy. Size and weight pick the step; tone tints; `clip` keeps
|
|
42
|
-
* one line (or two) with an ellipsis; `num` sets tabular figures. */
|
|
42
|
+
* one line (or two, or three) with an ellipsis; `num` sets tabular figures. */
|
|
43
43
|
export function Copy({
|
|
44
44
|
as: Tag = "p",
|
|
45
45
|
size = "sm",
|
|
@@ -55,7 +55,7 @@ export function Copy({
|
|
|
55
55
|
size?: CopySize;
|
|
56
56
|
weight?: CopyWeight;
|
|
57
57
|
tone?: "poor" | "teal";
|
|
58
|
-
clip?: 1 | 2;
|
|
58
|
+
clip?: 1 | 2 | 3;
|
|
59
59
|
num?: boolean;
|
|
60
60
|
/** Break anywhere (URLs, identifiers). */
|
|
61
61
|
breakAll?: boolean;
|
package/primitives/report.css
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
--rpt-grade-col: 112px;
|
|
18
18
|
--rpt-score-col-phone: 44px;
|
|
19
19
|
--rpt-grade-col-phone: 100px;
|
|
20
|
+
/* The row's chevron is the medium chevron icon; the head holds its
|
|
21
|
+
width so the column heads sit over the values. */
|
|
22
|
+
--rpt-row-chevron: 16px;
|
|
20
23
|
--rpt-finding-number: 28px;
|
|
21
24
|
--rpt-row-body-measure: 600px;
|
|
22
25
|
--rpt-finding-measure: 680px;
|
|
@@ -342,9 +345,21 @@ a.rpt-area:focus-visible {
|
|
|
342
345
|
.rpt-score-row {
|
|
343
346
|
border-top: 1px solid var(--color-border-000);
|
|
344
347
|
}
|
|
345
|
-
.rpt-score-row:first-child
|
|
348
|
+
.rpt-score-row:first-child,
|
|
349
|
+
.rpt-score-head + .rpt-score-row {
|
|
346
350
|
border-top: 0;
|
|
347
351
|
}
|
|
352
|
+
/* The column heads over a list of rows share its columns and gaps. */
|
|
353
|
+
.rpt-score-head {
|
|
354
|
+
border-bottom: 1px solid var(--color-border-000);
|
|
355
|
+
color: var(--color-text-500);
|
|
356
|
+
}
|
|
357
|
+
.rpt-score-head::after {
|
|
358
|
+
content: "";
|
|
359
|
+
flex: none;
|
|
360
|
+
width: var(--rpt-row-chevron);
|
|
361
|
+
}
|
|
362
|
+
.rpt-score-head,
|
|
348
363
|
.rpt-score-row:not(details),
|
|
349
364
|
.rpt-score-summary {
|
|
350
365
|
display: flex;
|
|
@@ -361,29 +376,42 @@ a.rpt-area:focus-visible {
|
|
|
361
376
|
.rpt-score-summary::-webkit-details-marker {
|
|
362
377
|
display: none;
|
|
363
378
|
}
|
|
379
|
+
.rpt-score-head > :first-child,
|
|
364
380
|
.rpt-score-area {
|
|
365
381
|
flex: 1 1 auto;
|
|
366
382
|
min-width: 0;
|
|
383
|
+
}
|
|
384
|
+
.rpt-score-area {
|
|
367
385
|
color: var(--color-text-000);
|
|
368
386
|
--font: var(--ts-text-md-regular-font);
|
|
369
387
|
--ls: var(--ts-text-md-regular-ls);
|
|
370
388
|
--opsz: var(--ts-text-md-regular-opsz);
|
|
371
389
|
}
|
|
390
|
+
.rpt-score-head-value,
|
|
372
391
|
.rpt-score-value {
|
|
373
392
|
flex: none;
|
|
374
393
|
width: var(--rpt-score-col-phone);
|
|
375
|
-
color: var(--color-text-000);
|
|
376
394
|
text-align: right;
|
|
395
|
+
}
|
|
396
|
+
.rpt-score-value {
|
|
397
|
+
color: var(--color-text-000);
|
|
377
398
|
font-variant-numeric: tabular-nums;
|
|
378
399
|
}
|
|
400
|
+
.rpt-score-head-grade,
|
|
379
401
|
.rpt-score-grade {
|
|
380
402
|
flex: none;
|
|
403
|
+
width: var(--rpt-grade-col-phone);
|
|
404
|
+
}
|
|
405
|
+
.rpt-score-head-grade {
|
|
406
|
+
text-align: right;
|
|
407
|
+
}
|
|
408
|
+
.rpt-score-grade {
|
|
381
409
|
display: flex;
|
|
382
410
|
justify-content: flex-end;
|
|
383
|
-
width: var(--rpt-grade-col-phone);
|
|
384
411
|
}
|
|
385
412
|
.rpt-row-chevron {
|
|
386
413
|
flex: none;
|
|
414
|
+
width: var(--rpt-row-chevron);
|
|
387
415
|
color: var(--color-border-300);
|
|
388
416
|
transition: rotate var(--motion-drawer-duration) var(--motion-drawer-ease);
|
|
389
417
|
}
|
|
@@ -396,9 +424,13 @@ details[open] > summary .rpt-row-chevron {
|
|
|
396
424
|
box-shadow: inset 0 0 0 var(--ring-w) var(--color-border-200);
|
|
397
425
|
}
|
|
398
426
|
@container (--rt) {
|
|
427
|
+
.rpt-score-head,
|
|
399
428
|
.rpt-score-row:not(details),
|
|
400
429
|
.rpt-score-summary {
|
|
401
430
|
gap: var(--space-2xl);
|
|
431
|
+
}
|
|
432
|
+
.rpt-score-row:not(details),
|
|
433
|
+
.rpt-score-summary {
|
|
402
434
|
min-height: 60px;
|
|
403
435
|
}
|
|
404
436
|
.rpt-score-area {
|
|
@@ -406,9 +438,11 @@ details[open] > summary .rpt-row-chevron {
|
|
|
406
438
|
--ls: var(--ts-text-lg-regular-ls);
|
|
407
439
|
--opsz: var(--ts-text-lg-regular-opsz);
|
|
408
440
|
}
|
|
441
|
+
.rpt-score-head-value,
|
|
409
442
|
.rpt-score-value {
|
|
410
443
|
width: var(--rpt-score-col);
|
|
411
444
|
}
|
|
445
|
+
.rpt-score-head-grade,
|
|
412
446
|
.rpt-score-grade {
|
|
413
447
|
width: var(--rpt-grade-col);
|
|
414
448
|
}
|
package/primitives/report.tsx
CHANGED
|
@@ -220,6 +220,26 @@ export function AreaCards({ children }: { children: ReactNode }) {
|
|
|
220
220
|
return <div className="rpt-areas">{children}</div>;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
/** The column heads over a list of score rows, on the rows' columns. The
|
|
224
|
+
* heads are decoration for a sighted reader; each row says its own. */
|
|
225
|
+
export function ScoreRowHead({
|
|
226
|
+
area,
|
|
227
|
+
score,
|
|
228
|
+
grade,
|
|
229
|
+
}: {
|
|
230
|
+
area: ReactNode;
|
|
231
|
+
score: ReactNode;
|
|
232
|
+
grade: ReactNode;
|
|
233
|
+
}) {
|
|
234
|
+
return (
|
|
235
|
+
<div className="rpt-score-head" aria-hidden="true">
|
|
236
|
+
<span className="type type-fixed ts-text-xs-light">{area}</span>
|
|
237
|
+
<span className="type type-fixed ts-text-xs-light rpt-score-head-value">{score}</span>
|
|
238
|
+
<span className="type type-fixed ts-text-xs-light rpt-score-head-grade">{grade}</span>
|
|
239
|
+
</div>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
223
243
|
/** A row in the nine-area list: area, score, grade, and — when it opens
|
|
224
244
|
* — the finding and first fix beneath. `score` null is unmeasured: the
|
|
225
245
|
* slot stays empty and the pill says so. */
|