@atelic-action/ui 7.2.0 → 8.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.
- package/README.md +439 -132
- package/bin/atelic-check-sentry.ts +5 -0
- package/dist/gate/middleware.js +15 -1
- package/dist/monitoring/server.d.ts +72 -0
- package/dist/monitoring/server.js +201 -0
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/vite/marketing-config.d.ts +28 -1
- package/dist/vite/marketing-config.js +62 -0
- package/package.json +23 -11
- package/src/app/ErrorFallback.tsx +6 -2
- package/src/app/context/AppContext.tsx +10 -1
- package/src/app/index.ts +0 -1
- package/src/app/layout/AppPage.tsx +36 -7
- package/src/app/layout/DesktopRail.tsx +15 -6
- package/src/app/layout/MobileMenu.tsx +14 -5
- package/src/app/layout/MobileTabBar.tsx +3 -2
- package/src/app/layout/PageError.tsx +7 -4
- package/src/app/layout/PageSkeleton.tsx +33 -26
- package/src/app/layout/SectionCards.tsx +7 -2
- package/src/app/layout/UserMenu.tsx +13 -7
- package/src/app/ui/alert.tsx +42 -12
- package/src/app/ui/badge.tsx +1 -1
- package/src/app/ui/button.tsx +2 -1
- package/src/app/ui/command.tsx +86 -21
- package/src/app/ui/country-dropdown.tsx +26 -47
- package/src/app/ui/form.tsx +48 -9
- package/src/app/ui/pagination.tsx +1 -1
- package/src/app/ui/progress.tsx +26 -12
- package/src/app/ui/search-input.tsx +16 -3
- package/src/app/ui/select.tsx +8 -3
- package/src/app/ui/slider.tsx +62 -15
- package/src/artifact/AppErrorBoundary.tsx +12 -7
- package/src/artifact/ArtifactShell.tsx +5 -1
- package/src/artifact/ErrorFallback.tsx +8 -1
- package/src/artifact/artifactConfig.ts +1 -1
- package/src/chrome/BrandLockup.tsx +102 -17
- package/src/chrome/ClosingBar.tsx +5 -3
- package/src/chrome/ContactDock.tsx +361 -0
- package/src/chrome/Footer.tsx +126 -31
- package/src/chrome/NavBadge.tsx +8 -0
- package/src/chrome/NavMegaPanel.tsx +399 -0
- package/src/chrome/SiteHeader.tsx +268 -23
- package/src/chrome/SiteMenu.tsx +200 -19
- package/src/chrome/SiteShell.tsx +151 -14
- package/src/chrome/StickyCTABar.tsx +60 -2
- package/src/chrome/brandMark.ts +56 -0
- package/src/chrome/icons.ts +58 -0
- package/src/chrome/index.ts +16 -0
- package/src/chrome/navSections.ts +55 -0
- package/src/components/ColumnChart.tsx +27 -2
- package/src/components/DataTable.tsx +104 -85
- package/src/components/Disclosure.tsx +3 -1
- package/src/components/Hint.tsx +3 -24
- package/src/components/NotFound.tsx +7 -3
- package/src/components/StarRating.tsx +45 -19
- package/src/components/ThresholdScale.tsx +36 -26
- package/src/email/atoms.tsx +13 -57
- package/src/email/frame.tsx +4 -6
- package/src/email/index.ts +4 -10
- package/src/email/scoreboard.tsx +107 -186
- package/src/email/text.ts +30 -0
- package/src/email/theme.tsx +76 -9
- package/src/gate/middleware.ts +15 -1
- package/src/hooks/useDismiss.ts +39 -0
- package/src/lib/emailText.tsx +26 -0
- package/src/lib/phoneText.tsx +40 -0
- package/src/lib/useScrollsSideways.ts +26 -0
- package/src/monitoring/ErrorCatcherScript.tsx +15 -0
- package/src/monitoring/catcher.ts +118 -0
- package/src/monitoring/index.ts +25 -0
- package/src/monitoring/sdk.ts +112 -0
- package/src/monitoring/server.ts +244 -0
- package/src/monitoring/start.ts +118 -0
- package/src/primitives/Button.tsx +5 -1
- package/src/primitives/Eyebrow.tsx +6 -2
- package/src/primitives/ProseBlocks.tsx +6 -1
- package/src/primitives/SectionHeading.tsx +3 -1
- package/src/primitives/StarRow.tsx +23 -8
- package/src/routing/index.ts +1 -0
- package/src/routing/miss.ts +32 -0
- package/src/scripts/check-sentry.ts +77 -0
- package/src/sections/BlogIndex.tsx +17 -3
- package/src/sections/BlogPost.tsx +10 -1
- package/src/sections/CTASection.tsx +2 -2
- package/src/sections/CalloutPanel.tsx +34 -0
- package/src/sections/ComparisonTable.tsx +23 -2
- package/src/sections/ContactForm.tsx +61 -17
- package/src/sections/FAQBrowser.tsx +11 -2
- package/src/sections/FeatureGrid.tsx +6 -2
- package/src/sections/FullBleedVideo.tsx +167 -0
- package/src/sections/Gallery.tsx +6 -4
- package/src/sections/Hero.tsx +70 -39
- package/src/sections/JumpRail.tsx +7 -0
- package/src/sections/LegalPage.tsx +10 -2
- package/src/sections/LinkColumns.tsx +80 -0
- package/src/sections/LocationSection.tsx +28 -5
- package/src/sections/Locations.tsx +18 -5
- package/src/sections/LogoMarquee.tsx +43 -11
- package/src/sections/MapEmbed.tsx +13 -9
- package/src/sections/PageHero.tsx +16 -2
- package/src/sections/ProcessSteps.tsx +27 -4
- package/src/sections/ProfileCards.tsx +12 -2
- package/src/sections/ProofStrip.tsx +44 -0
- package/src/sections/RevealSlider.tsx +28 -7
- package/src/sections/ReviewCarousel.tsx +17 -4
- package/src/sections/ReviewWall.tsx +2 -2
- package/src/sections/SplitSection.tsx +2 -1
- package/src/sections/index.ts +15 -6
- package/src/sections/siteConfig.ts +101 -8
- package/src/styles/app.css +33 -2
- package/src/styles/artifact.css +20 -8
- package/src/styles/base.css +68 -13
- package/src/styles/chrome.css +1134 -56
- package/src/styles/components.css +104 -65
- package/src/styles/defaults.css +140 -0
- package/src/styles/gate.css +21 -10
- package/src/styles/primitives.css +108 -39
- package/src/styles/sections.css +500 -437
- package/src/styles/star-rating.css +1 -4
- package/src/tokens/palettes.ts +24 -4
- package/src/types.ts +220 -3
- package/src/vite/index.ts +4 -0
- package/src/vite/marketing-config.ts +81 -1
- package/src/app/CardErrorBoundary.tsx +0 -39
- package/src/sections/CTABanner.tsx +0 -93
- package/src/sections/DeviceShowcase.tsx +0 -39
- package/src/sections/MediaBand.tsx +0 -20
- package/src/sections/MenuList.tsx +0 -44
- package/src/sections/PressQuotes.tsx +0 -51
- package/src/sections/SocialStrip.tsx +0 -83
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
|
|
2
2
|
import { type ReactNode, useId, useMemo, useState } from "react";
|
|
3
|
+
import { useScrollsSideways } from "../lib/useScrollsSideways";
|
|
3
4
|
import { Hint } from "./Hint";
|
|
4
5
|
|
|
5
6
|
export type SortDirection = "asc" | "desc";
|
|
@@ -54,6 +55,12 @@ export interface DataTableProps {
|
|
|
54
55
|
sortLabel?: string;
|
|
55
56
|
/** Every other row on a tinted ground, so a wide table reads across. On by default. */
|
|
56
57
|
striped?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* What a screen reader calls the table's box while the table is wider
|
|
60
|
+
* than the page and scrolls inside it; defaults to "Table". Name what the
|
|
61
|
+
* table holds ("Searches by month").
|
|
62
|
+
*/
|
|
63
|
+
ariaLabel?: string;
|
|
57
64
|
className?: string;
|
|
58
65
|
}
|
|
59
66
|
|
|
@@ -94,9 +101,11 @@ export function DataTable({
|
|
|
94
101
|
defaultSort,
|
|
95
102
|
sortLabel = "Sort by",
|
|
96
103
|
striped = true,
|
|
104
|
+
ariaLabel = "Table",
|
|
97
105
|
className,
|
|
98
106
|
}: DataTableProps) {
|
|
99
107
|
const [sort, setSort] = useState(defaultSort ?? null);
|
|
108
|
+
const scrolls = useScrollsSideways();
|
|
100
109
|
const selectId = useId();
|
|
101
110
|
const anySortable = columns.some((column) => column.sortable);
|
|
102
111
|
|
|
@@ -155,96 +164,106 @@ export function DataTable({
|
|
|
155
164
|
</select>
|
|
156
165
|
</div>
|
|
157
166
|
)}
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
: undefined,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
data-active={active || undefined}
|
|
197
|
-
>
|
|
198
|
-
{column.label}
|
|
199
|
-
<Icon size={12} aria-hidden="true" />
|
|
200
|
-
</button>
|
|
201
|
-
) : (
|
|
202
|
-
column.label
|
|
203
|
-
)}
|
|
204
|
-
{!before && hint}
|
|
205
|
-
</th>
|
|
206
|
-
);
|
|
207
|
-
})}
|
|
208
|
-
</tr>
|
|
209
|
-
</thead>
|
|
210
|
-
<tbody>
|
|
211
|
-
{sorted.map(({ row, index }) => (
|
|
212
|
-
<tr key={index} data-tone={row.tone}>
|
|
213
|
-
{/* One cell per column at least, so a cell left out draws as empty. */}
|
|
214
|
-
{Array.from({ length: Math.max(columns.length, row.cells.length) }, (_, c) => {
|
|
215
|
-
const cell = row.cells[c];
|
|
216
|
-
const body = isEmpty(cell, c) ? (
|
|
217
|
-
<>
|
|
218
|
-
<span className="data-table-empty" aria-hidden="true" />
|
|
219
|
-
<span className="data-table-empty-label">
|
|
220
|
-
{columns[c]?.emptyLabel ?? "None"}
|
|
221
|
-
</span>
|
|
222
|
-
</>
|
|
223
|
-
) : isValueCell(cell) ? (
|
|
224
|
-
cell.display
|
|
225
|
-
) : (
|
|
226
|
-
cell
|
|
227
|
-
);
|
|
228
|
-
const shape = {
|
|
229
|
-
"data-align": columns[c]?.align ?? "left",
|
|
230
|
-
"data-fit": columns[c]?.fit || undefined,
|
|
167
|
+
<div
|
|
168
|
+
ref={scrolls.ref}
|
|
169
|
+
className="data-table-scroll"
|
|
170
|
+
{...(scrolls.active ? { tabIndex: 0, role: "region", "aria-label": ariaLabel } : {})}
|
|
171
|
+
>
|
|
172
|
+
<table>
|
|
173
|
+
<thead>
|
|
174
|
+
<tr>
|
|
175
|
+
{columns.map((column, index) => {
|
|
176
|
+
const active = sort?.column === index;
|
|
177
|
+
const Icon = !active
|
|
178
|
+
? ArrowUpDown
|
|
179
|
+
: sort?.direction === "asc"
|
|
180
|
+
? ArrowUp
|
|
181
|
+
: ArrowDown;
|
|
182
|
+
// The explainer's icon sits after the label, or before it when the
|
|
183
|
+
// column is right aligned, so the icon stays on the inside edge.
|
|
184
|
+
const before = column.align === "right";
|
|
185
|
+
const hint = column.hint ? (
|
|
186
|
+
<Hint
|
|
187
|
+
label={column.hintLabel ?? `About ${column.label}`}
|
|
188
|
+
side={before ? "before" : "after"}
|
|
189
|
+
>
|
|
190
|
+
{column.hint}
|
|
191
|
+
</Hint>
|
|
192
|
+
) : null;
|
|
193
|
+
const head = {
|
|
194
|
+
"data-align": column.align ?? "left",
|
|
195
|
+
"data-fit": column.fit || undefined,
|
|
196
|
+
// The hint button sits in the heading; the heading is still named by its label.
|
|
197
|
+
"aria-label": column.hint && column.label ? column.label : undefined,
|
|
198
|
+
"aria-sort": column.sortable
|
|
199
|
+
? active
|
|
200
|
+
? sort?.direction === "asc"
|
|
201
|
+
? ("ascending" as const)
|
|
202
|
+
: ("descending" as const)
|
|
203
|
+
: ("none" as const)
|
|
204
|
+
: undefined,
|
|
231
205
|
};
|
|
232
|
-
return
|
|
233
|
-
// biome-ignore lint/suspicious/noArrayIndexKey:
|
|
234
|
-
<th scope="
|
|
235
|
-
{
|
|
206
|
+
return (
|
|
207
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: columns sit in order, and two may share a blank label
|
|
208
|
+
<th scope="col" key={index} {...head}>
|
|
209
|
+
{before && hint}
|
|
210
|
+
{column.sortable ? (
|
|
211
|
+
<button
|
|
212
|
+
type="button"
|
|
213
|
+
onClick={() => sortBy(index)}
|
|
214
|
+
data-active={active || undefined}
|
|
215
|
+
>
|
|
216
|
+
{column.label}
|
|
217
|
+
<Icon size={12} aria-hidden="true" />
|
|
218
|
+
</button>
|
|
219
|
+
) : (
|
|
220
|
+
column.label
|
|
221
|
+
)}
|
|
222
|
+
{!before && hint}
|
|
236
223
|
</th>
|
|
237
|
-
) : (
|
|
238
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: cells sit in column order
|
|
239
|
-
<td key={c} {...shape} data-label={columns[c]?.label}>
|
|
240
|
-
{body}
|
|
241
|
-
</td>
|
|
242
224
|
);
|
|
243
225
|
})}
|
|
244
226
|
</tr>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
227
|
+
</thead>
|
|
228
|
+
<tbody>
|
|
229
|
+
{sorted.map(({ row, index }) => (
|
|
230
|
+
<tr key={index} data-tone={row.tone}>
|
|
231
|
+
{/* One cell per column at least, so a cell left out draws as empty. */}
|
|
232
|
+
{Array.from({ length: Math.max(columns.length, row.cells.length) }, (_, c) => {
|
|
233
|
+
const cell = row.cells[c];
|
|
234
|
+
const body = isEmpty(cell, c) ? (
|
|
235
|
+
<>
|
|
236
|
+
<span className="data-table-empty" aria-hidden="true" />
|
|
237
|
+
<span className="data-table-empty-label">
|
|
238
|
+
{columns[c]?.emptyLabel ?? "None"}
|
|
239
|
+
</span>
|
|
240
|
+
</>
|
|
241
|
+
) : isValueCell(cell) ? (
|
|
242
|
+
cell.display
|
|
243
|
+
) : (
|
|
244
|
+
cell
|
|
245
|
+
);
|
|
246
|
+
const shape = {
|
|
247
|
+
"data-align": columns[c]?.align ?? "left",
|
|
248
|
+
"data-fit": columns[c]?.fit || undefined,
|
|
249
|
+
};
|
|
250
|
+
return c === 0 ? (
|
|
251
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: cells sit in column order
|
|
252
|
+
<th scope="row" key={c} {...shape}>
|
|
253
|
+
{body}
|
|
254
|
+
</th>
|
|
255
|
+
) : (
|
|
256
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: cells sit in column order
|
|
257
|
+
<td key={c} {...shape} data-label={columns[c]?.label}>
|
|
258
|
+
{body}
|
|
259
|
+
</td>
|
|
260
|
+
);
|
|
261
|
+
})}
|
|
262
|
+
</tr>
|
|
263
|
+
))}
|
|
264
|
+
</tbody>
|
|
265
|
+
</table>
|
|
266
|
+
</div>
|
|
248
267
|
</div>
|
|
249
268
|
);
|
|
250
269
|
}
|
|
@@ -121,7 +121,9 @@ function ControlledDisclosure({
|
|
|
121
121
|
className="disclosure-toggle"
|
|
122
122
|
onClick={onToggle}
|
|
123
123
|
aria-expanded={open}
|
|
124
|
-
|
|
124
|
+
// The body is unmounted while closed, so the relation is
|
|
125
|
+
// drawn only while there is a panel to follow it to.
|
|
126
|
+
aria-controls={open ? id : undefined}
|
|
125
127
|
>
|
|
126
128
|
{label}
|
|
127
129
|
</button>
|
package/src/components/Hint.tsx
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { Info } from "lucide-react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
useCallback,
|
|
5
|
-
useEffect,
|
|
6
|
-
useId,
|
|
7
|
-
useLayoutEffect,
|
|
8
|
-
useRef,
|
|
9
|
-
useState,
|
|
10
|
-
} from "react";
|
|
2
|
+
import { type ReactNode, useCallback, useId, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useDismiss } from "../hooks/useDismiss";
|
|
11
4
|
|
|
12
5
|
export interface HintProps {
|
|
13
6
|
/** What the button is called, for a screen reader, e.g. "About First paint". */
|
|
@@ -44,21 +37,7 @@ export function Hint({ label, side = "after", className, children }: HintProps)
|
|
|
44
37
|
setKeyboard(false);
|
|
45
38
|
}, []);
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
if (!open) return;
|
|
49
|
-
const away = (event: PointerEvent) => {
|
|
50
|
-
if (!root.current?.contains(event.target as Node)) close();
|
|
51
|
-
};
|
|
52
|
-
const key = (event: KeyboardEvent) => {
|
|
53
|
-
if (event.key === "Escape") close();
|
|
54
|
-
};
|
|
55
|
-
document.addEventListener("pointerdown", away);
|
|
56
|
-
document.addEventListener("keydown", key);
|
|
57
|
-
return () => {
|
|
58
|
-
document.removeEventListener("pointerdown", away);
|
|
59
|
-
document.removeEventListener("keydown", key);
|
|
60
|
-
};
|
|
61
|
-
}, [open, close]);
|
|
40
|
+
useDismiss(open, root, close);
|
|
62
41
|
|
|
63
42
|
// Opens from the icon's left edge, then slides left just far enough to
|
|
64
43
|
// stay on screen, and never past the screen's left edge.
|
|
@@ -54,8 +54,9 @@ export function NotFound({
|
|
|
54
54
|
<div className="wrap center">
|
|
55
55
|
<span className="eyebrow center">{linksLabel}</span>
|
|
56
56
|
<nav aria-label={linksLabel} className="cta-row center">
|
|
57
|
-
{links.map((link) => (
|
|
58
|
-
|
|
57
|
+
{links.map((link, at) => (
|
|
58
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: two links may share a page, so the place keeps the key unique; links never reorder
|
|
59
|
+
<a key={at} className="btn btn-ghost" href={link.href}>
|
|
59
60
|
{link.label}
|
|
60
61
|
</a>
|
|
61
62
|
))}
|
|
@@ -74,7 +75,10 @@ export function NotFound({
|
|
|
74
75
|
{...newTabProps(primaryCTA.href, primaryCTA.external)}
|
|
75
76
|
>
|
|
76
77
|
{primaryCTA.label}
|
|
77
|
-
|
|
78
|
+
{/* Decoration: the link is named by its label alone, as Button's is. */}
|
|
79
|
+
<span className="arrow" aria-hidden="true">
|
|
80
|
+
{"→"}
|
|
81
|
+
</span>
|
|
78
82
|
</a>
|
|
79
83
|
<a className="btn btn-ghost btn-lg" href={secondary.href}>
|
|
80
84
|
{secondary.label}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Star } from "lucide-react";
|
|
2
|
-
import { type CSSProperties, type KeyboardEvent, useState } from "react";
|
|
2
|
+
import { type CSSProperties, type KeyboardEvent, type MouseEvent, useState } from "react";
|
|
3
3
|
|
|
4
4
|
const STEP = 0.5;
|
|
5
5
|
|
|
@@ -29,15 +29,18 @@ export function describeStarRating(value: number | null): string {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* A row of stars that shows a rating in half star steps and, given `onChange`,
|
|
32
|
-
* takes one. Each star is two hit
|
|
32
|
+
* takes one. Each star is two hit areas, its left half and its right, so a
|
|
33
33
|
* pointer lands on 3.5 or 4 without a second control. Picking the rating
|
|
34
34
|
* already set clears it, which is the only way back to unrated and needs no
|
|
35
35
|
* button of its own.
|
|
36
36
|
*
|
|
37
|
-
*
|
|
38
|
-
* move half a star, Home clears, End is the top of
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* An editable row is one slider, to a pointer, a keyboard, and a screen
|
|
38
|
+
* reader alike: the arrows move half a star, Home clears, End is the top of
|
|
39
|
+
* the scale, and the slider itself takes the pointer's press and hover. The
|
|
40
|
+
* halves are plain areas marked with the rating they stand for
|
|
41
|
+
* (`data-rating`), never controls of their own, since a slider's children
|
|
42
|
+
* are presentational and a control inside one is lost to a screen reader.
|
|
43
|
+
* Without `onChange` it is a picture with the rating as its name.
|
|
41
44
|
*
|
|
42
45
|
* The two colors are the `--star-fill` and `--star-outline` custom properties.
|
|
43
46
|
* `fillColor` and `outlineColor` set them on this row; a site may also set
|
|
@@ -54,6 +57,10 @@ export function StarRating({
|
|
|
54
57
|
className,
|
|
55
58
|
}: StarRatingProps) {
|
|
56
59
|
const [hover, setHover] = useState<number | null>(null);
|
|
60
|
+
// The half just picked, held out of the preview until the pointer moves
|
|
61
|
+
// to another half or leaves: the pointer is still on it, and its next
|
|
62
|
+
// move would put back up the very preview the pick took down.
|
|
63
|
+
const [picked, setPicked] = useState<number | null>(null);
|
|
57
64
|
const shown = hover ?? value ?? 0;
|
|
58
65
|
|
|
59
66
|
const style = {
|
|
@@ -73,20 +80,11 @@ export function StarRating({
|
|
|
73
80
|
</span>
|
|
74
81
|
{onChange &&
|
|
75
82
|
[star - STEP, star].map((rating, half) => (
|
|
76
|
-
<
|
|
83
|
+
<span
|
|
77
84
|
key={rating}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
aria-label={describeStarRating(rating)}
|
|
85
|
+
aria-hidden="true"
|
|
86
|
+
data-rating={rating}
|
|
81
87
|
className={`star-rating-hit ${half === 0 ? "is-left" : "is-right"}`}
|
|
82
|
-
onMouseEnter={() => setHover(rating)}
|
|
83
|
-
onClick={() => {
|
|
84
|
-
// Drop the preview with the pick: the pointer is still on this
|
|
85
|
-
// half, and a preview left up would hide a clear behind the
|
|
86
|
-
// very stars it just emptied.
|
|
87
|
-
setHover(null);
|
|
88
|
-
onChange(rating === value ? null : rating);
|
|
89
|
-
}}
|
|
90
88
|
/>
|
|
91
89
|
))}
|
|
92
90
|
</span>
|
|
@@ -110,6 +108,24 @@ export function StarRating({
|
|
|
110
108
|
if (next !== value) onChange(next);
|
|
111
109
|
};
|
|
112
110
|
|
|
111
|
+
/** The rating of the half star under the pointer, or null between stars. */
|
|
112
|
+
const ratingAt = (event: MouseEvent) => {
|
|
113
|
+
const hit = (event.target as Element).closest?.("[data-rating]");
|
|
114
|
+
const rating = Number(hit?.getAttribute("data-rating"));
|
|
115
|
+
return hit && Number.isFinite(rating) ? rating : null;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const onClick = (event: MouseEvent) => {
|
|
119
|
+
const rating = ratingAt(event);
|
|
120
|
+
if (rating === null) return;
|
|
121
|
+
// Drop the preview with the pick: the pointer is still on this half,
|
|
122
|
+
// and a preview left up would hide a clear behind the very stars it
|
|
123
|
+
// just emptied.
|
|
124
|
+
setHover(null);
|
|
125
|
+
setPicked(rating);
|
|
126
|
+
onChange(rating === value ? null : rating);
|
|
127
|
+
};
|
|
128
|
+
|
|
113
129
|
const onKeyDown = (event: KeyboardEvent) => {
|
|
114
130
|
const current = value ?? 0;
|
|
115
131
|
switch (event.key) {
|
|
@@ -145,7 +161,17 @@ export function StarRating({
|
|
|
145
161
|
className={`${classes} is-editable`}
|
|
146
162
|
style={style}
|
|
147
163
|
onKeyDown={onKeyDown}
|
|
148
|
-
|
|
164
|
+
onClick={onClick}
|
|
165
|
+
onMouseMove={(event) => {
|
|
166
|
+
const rating = ratingAt(event);
|
|
167
|
+
if (rating === null || rating === picked) return;
|
|
168
|
+
setPicked(null);
|
|
169
|
+
setHover(rating);
|
|
170
|
+
}}
|
|
171
|
+
onMouseLeave={() => {
|
|
172
|
+
setHover(null);
|
|
173
|
+
setPicked(null);
|
|
174
|
+
}}
|
|
149
175
|
>
|
|
150
176
|
{stars}
|
|
151
177
|
</span>
|
|
@@ -34,40 +34,50 @@ export interface ThresholdScaleProps {
|
|
|
34
34
|
export function ThresholdScale({ max, zones, ticks, readings, className }: ThresholdScaleProps) {
|
|
35
35
|
let from = 0;
|
|
36
36
|
const sized = zones.map((zone) => {
|
|
37
|
+
const start = from;
|
|
37
38
|
const to = zone.upTo ?? max;
|
|
38
39
|
const width = ((to - from) / max) * 100;
|
|
39
40
|
from = to;
|
|
40
|
-
return { ...zone, width };
|
|
41
|
+
return { ...zone, start, to, width };
|
|
41
42
|
});
|
|
43
|
+
// The zone a reading falls in, which the track's name speaks with the
|
|
44
|
+
// figure: the scale's verdict is otherwise only the pin's place and color.
|
|
45
|
+
// A reading on a line belongs to the zone the line closes; one past the
|
|
46
|
+
// far end, to the last zone.
|
|
47
|
+
const zoneOf = (value: number) =>
|
|
48
|
+
sized.find((zone) => value <= zone.to) ?? sized[sized.length - 1];
|
|
42
49
|
return (
|
|
43
50
|
<div className={["threshold-scale", className].filter(Boolean).join(" ")}>
|
|
44
|
-
{readings.map((reading) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
className="threshold-scale-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
{readings.map((reading) => {
|
|
52
|
+
const zone = zoneOf(reading.value);
|
|
53
|
+
return (
|
|
54
|
+
<div className="threshold-scale-row" key={reading.label}>
|
|
55
|
+
<span className="threshold-scale-label">{reading.label}</span>
|
|
56
|
+
<span
|
|
57
|
+
className="threshold-scale-track"
|
|
58
|
+
role="img"
|
|
59
|
+
aria-label={`${reading.label}: ${reading.display}${zone ? `, ${zone.label}` : ""}`}
|
|
60
|
+
>
|
|
61
|
+
{sized.map((zone) => (
|
|
62
|
+
<span
|
|
63
|
+
className="threshold-scale-zone"
|
|
64
|
+
key={zone.label}
|
|
65
|
+
data-tone={zone.tone}
|
|
66
|
+
style={{ width: `${zone.width}%` }}
|
|
67
|
+
/>
|
|
68
|
+
))}
|
|
53
69
|
<span
|
|
54
|
-
className="threshold-scale-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
style={{ width: `${zone.width}%` }}
|
|
70
|
+
className="threshold-scale-pin"
|
|
71
|
+
data-tone={reading.tone}
|
|
72
|
+
style={{ left: `${Math.min(reading.value / max, 1) * 100}%` }}
|
|
58
73
|
/>
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
<b className="threshold-scale-value" data-tone={reading.tone}>
|
|
67
|
-
{reading.display}
|
|
68
|
-
</b>
|
|
69
|
-
</div>
|
|
70
|
-
))}
|
|
74
|
+
</span>
|
|
75
|
+
<b className="threshold-scale-value" data-tone={reading.tone}>
|
|
76
|
+
{reading.display}
|
|
77
|
+
</b>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
})}
|
|
71
81
|
<div className="threshold-scale-row is-axis" aria-hidden="true">
|
|
72
82
|
<span className="threshold-scale-label" />
|
|
73
83
|
<span className="threshold-scale-axis">
|
package/src/email/atoms.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { eyebrowStyle, tableReset, useEmailTheme } from "./theme";
|
|
2
|
+
import { accentInk, eyebrowStyle, tableReset, useEmailTheme, wrapLong } from "./theme";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* The atoms of the runner email, ported one to one from the atoms section of
|
|
@@ -154,7 +154,7 @@ export function BigFold({ summary, count, children }: BigFoldProps) {
|
|
|
154
154
|
|
|
155
155
|
export type TitleLineProps = { name: string; right: string };
|
|
156
156
|
|
|
157
|
-
/** A name on the left and the one value that matters on the right, in the accent. */
|
|
157
|
+
/** A name on the left and the one value that matters on the right, in the accent's ink. */
|
|
158
158
|
export function TitleLine({ name, right }: TitleLineProps) {
|
|
159
159
|
const { palette, fonts } = useEmailTheme();
|
|
160
160
|
return (
|
|
@@ -177,7 +177,7 @@ export function TitleLine({ name, right }: TitleLineProps) {
|
|
|
177
177
|
style={{
|
|
178
178
|
fontFamily: fonts.mono,
|
|
179
179
|
fontSize: "12px",
|
|
180
|
-
color: palette
|
|
180
|
+
color: accentInk(palette),
|
|
181
181
|
whiteSpace: "nowrap",
|
|
182
182
|
paddingLeft: "12px",
|
|
183
183
|
}}
|
|
@@ -227,6 +227,7 @@ export function Item({
|
|
|
227
227
|
style={{
|
|
228
228
|
padding: `22px 24px ${last ? "22px" : "20px"}`,
|
|
229
229
|
fontFamily: fonts.sans,
|
|
230
|
+
...wrapLong,
|
|
230
231
|
...(last ? {} : { borderBottom: `1px solid ${palette.line}` }),
|
|
231
232
|
}}
|
|
232
233
|
>
|
|
@@ -273,7 +274,7 @@ export function Item({
|
|
|
273
274
|
|
|
274
275
|
export type NoteProps = { eyebrowText: string; text: string; accented: boolean; last: boolean };
|
|
275
276
|
|
|
276
|
-
/** A short note inside a card under a small eyebrow; accented puts the eyebrow in
|
|
277
|
+
/** A short note inside a card under a small eyebrow; accented puts the eyebrow in the accent's ink. */
|
|
277
278
|
export function Note({ eyebrowText, text, accented, last }: NoteProps) {
|
|
278
279
|
const { palette, fonts } = useEmailTheme();
|
|
279
280
|
return (
|
|
@@ -282,12 +283,15 @@ export function Note({ eyebrowText, text, accented, last }: NoteProps) {
|
|
|
282
283
|
style={{
|
|
283
284
|
padding: `18px 24px ${last ? "20px" : "4px"}`,
|
|
284
285
|
fontFamily: fonts.sans,
|
|
286
|
+
...wrapLong,
|
|
285
287
|
fontSize: "14px",
|
|
286
288
|
lineHeight: "1.55",
|
|
287
289
|
color: accented ? palette.ink : palette.dim,
|
|
288
290
|
}}
|
|
289
291
|
>
|
|
290
|
-
<span
|
|
292
|
+
<span
|
|
293
|
+
style={{ ...eyebrowStyle(fonts), color: accented ? accentInk(palette) : palette.faint }}
|
|
294
|
+
>
|
|
291
295
|
{eyebrowText}
|
|
292
296
|
</span>
|
|
293
297
|
<br />
|
|
@@ -391,7 +395,9 @@ export function ListRow({ children }: ListRowProps) {
|
|
|
391
395
|
const { palette } = useEmailTheme();
|
|
392
396
|
return (
|
|
393
397
|
<tr>
|
|
394
|
-
<td style={{ padding: "6px 0", borderTop: `1px solid ${palette.hair}
|
|
398
|
+
<td style={{ padding: "6px 0", borderTop: `1px solid ${palette.hair}`, ...wrapLong }}>
|
|
399
|
+
{children}
|
|
400
|
+
</td>
|
|
395
401
|
</tr>
|
|
396
402
|
);
|
|
397
403
|
}
|
|
@@ -419,6 +425,7 @@ export function Row({ last, children }: RowProps) {
|
|
|
419
425
|
style={{
|
|
420
426
|
padding: `18px 24px ${last ? "22px" : "18px"}`,
|
|
421
427
|
fontFamily: fonts.sans,
|
|
428
|
+
...wrapLong,
|
|
422
429
|
...(last ? {} : { borderBottom: `1px solid ${palette.line}` }),
|
|
423
430
|
}}
|
|
424
431
|
>
|
|
@@ -447,54 +454,3 @@ export function FoldRow({ last, children }: FoldRowProps) {
|
|
|
447
454
|
</tr>
|
|
448
455
|
);
|
|
449
456
|
}
|
|
450
|
-
|
|
451
|
-
export type MonoTableProps = { headers: string[]; rows: string[][] };
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* A compact monospace table for data the reader copies rather than reads.
|
|
455
|
-
*/
|
|
456
|
-
export function MonoTable({ headers, rows }: MonoTableProps) {
|
|
457
|
-
const { palette, fonts } = useEmailTheme();
|
|
458
|
-
return (
|
|
459
|
-
<table
|
|
460
|
-
{...tableReset}
|
|
461
|
-
width="100%"
|
|
462
|
-
style={{
|
|
463
|
-
marginTop: "12px",
|
|
464
|
-
fontFamily: fonts.mono,
|
|
465
|
-
fontSize: "11px",
|
|
466
|
-
lineHeight: "1.5",
|
|
467
|
-
color: palette.dim,
|
|
468
|
-
}}
|
|
469
|
-
>
|
|
470
|
-
<tbody>
|
|
471
|
-
<tr>
|
|
472
|
-
{headers.map((label, i) => (
|
|
473
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: a header's position is its identity
|
|
474
|
-
<td key={i} style={{ padding: "4px 6px", color: palette.faint }}>
|
|
475
|
-
{label}
|
|
476
|
-
</td>
|
|
477
|
-
))}
|
|
478
|
-
</tr>
|
|
479
|
-
{rows.map((cells, r) => (
|
|
480
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: a row's position is its identity
|
|
481
|
-
<tr key={r}>
|
|
482
|
-
{cells.map((cell, c) => (
|
|
483
|
-
<td
|
|
484
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: a cell's position is its identity
|
|
485
|
-
key={c}
|
|
486
|
-
style={{
|
|
487
|
-
padding: "4px 6px",
|
|
488
|
-
borderTop: `1px solid ${palette.hair}`,
|
|
489
|
-
verticalAlign: "top",
|
|
490
|
-
}}
|
|
491
|
-
>
|
|
492
|
-
{cell}
|
|
493
|
-
</td>
|
|
494
|
-
))}
|
|
495
|
-
</tr>
|
|
496
|
-
))}
|
|
497
|
-
</tbody>
|
|
498
|
-
</table>
|
|
499
|
-
);
|
|
500
|
-
}
|
package/src/email/frame.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, type ReactNode } from "react";
|
|
2
2
|
import { Card } from "./atoms";
|
|
3
3
|
import { asciiDowncase } from "./text";
|
|
4
|
-
import { eyebrowStyle, fadeStop, tableReset, useEmailTheme } from "./theme";
|
|
4
|
+
import { accentInk, eyebrowStyle, fadeStop, tableReset, useEmailTheme, wrapLong } from "./theme";
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* The frame, ported one to one from the frame section of homebase
|
|
@@ -199,9 +199,6 @@ function filled(value: string | undefined): value is string {
|
|
|
199
199
|
return value !== undefined && value.trim() !== "";
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
/** One long token (a path, a URL) wraps instead of widening the column. */
|
|
203
|
-
const wrapLong = { overflowWrap: "anywhere", wordBreak: "break-word" } as const;
|
|
204
|
-
|
|
205
202
|
type FailureFact = { label: string; value: string; kind: "step" | "reason" | "fix" };
|
|
206
203
|
|
|
207
204
|
/**
|
|
@@ -276,6 +273,7 @@ export function FailurePage({
|
|
|
276
273
|
fontFamily: fonts.mono,
|
|
277
274
|
fontSize: "12px",
|
|
278
275
|
whiteSpace: "pre-wrap",
|
|
276
|
+
...wrapLong,
|
|
279
277
|
color: palette.dim,
|
|
280
278
|
borderTop: `1px solid ${palette.line}`,
|
|
281
279
|
paddingTop: "14px",
|
|
@@ -295,7 +293,7 @@ export function FailurePage({
|
|
|
295
293
|
* The structured failure page: the same eyebrow and headline, then one row per
|
|
296
294
|
* fact that has a value, each a faint eyebrow over its value on a hairline,
|
|
297
295
|
* and the log's tail last under its own eyebrow. The fix's label wears the
|
|
298
|
-
* accent, as an accented `Note` does, and its value is set in mono because it
|
|
296
|
+
* accent's ink, as an accented `Note` does, and its value is set in mono because it
|
|
299
297
|
* so often holds a command.
|
|
300
298
|
*/
|
|
301
299
|
function StructuredFailurePage({
|
|
@@ -369,7 +367,7 @@ function StructuredFailurePage({
|
|
|
369
367
|
<div
|
|
370
368
|
style={{
|
|
371
369
|
...eyebrowStyle(fonts),
|
|
372
|
-
color: fact.kind === "fix" ? palette
|
|
370
|
+
color: fact.kind === "fix" ? accentInk(palette) : palette.faint,
|
|
373
371
|
}}
|
|
374
372
|
>
|
|
375
373
|
{fact.label}
|