@atelic-action/ui 3.13.0 → 3.14.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 +2 -2
- package/package.json +1 -1
- package/src/components/StatRow.tsx +55 -5
- package/src/components/index.ts +1 -0
- package/src/sections/ComparisonTable.tsx +13 -1
- package/src/styles/components.css +60 -2
- package/src/styles/sections.css +15 -0
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
|
|
|
26
26
|
| `ReportCard` | `@atelic-action/ui/components` | A name, a grade, and a line per row, in labeled groups, each row a link to its section | [#report-card](https://ui.atelic.me/#report-card) |
|
|
27
27
|
| `reportCardLabels`, `ReportCardLabels` | `@atelic-action/ui/components` | The words a screen reader hears around a report card's letters by default, and their type | none |
|
|
28
28
|
| `Rank` | `@atelic-action/ui/components` | A figure with its badge in a tone, for a table cell: a rank, a place in an answer, or a dash | [#rank](https://ui.atelic.me/#rank) |
|
|
29
|
-
| `StatRow` | `@atelic-action/ui/components` | A row of large figures with periods, deltas, and trends | [#stat-row](https://ui.atelic.me/#stat-row) |
|
|
29
|
+
| `StatRow` | `@atelic-action/ui/components` | A row of large figures with periods, deltas, and trends; a share's denominator set small after the figure (`outOf`) and a change set small beside it with a triangle (`change`), 3.14.0 | [#stat-row](https://ui.atelic.me/#stat-row) |
|
|
30
30
|
| `Callout` | `@atelic-action/ui/components` | One finding: an icon in its tone, the title, the explainer | [#callout](https://ui.atelic.me/#callout) |
|
|
31
31
|
| `Disclosure` | `@atelic-action/ui/components` | A section that folds: controlled, an app's card; uncontrolled, a native details fold that prints open | [#disclosure](https://ui.atelic.me/#disclosure) |
|
|
32
32
|
| `Tabs`, `TabsItem` | `@atelic-action/ui/components` | Panels behind a row of tabs, every panel kept in the page: a hash opens the tab or the panel holding what it names, and it prints every panel under its label | [#tabs](https://ui.atelic.me/#tabs) |
|
|
@@ -67,7 +67,7 @@ Every export, grouped by the entry it is imported from. The gallery column links
|
|
|
67
67
|
| `BlogPost` | `@atelic-action/ui/sections` | One article: back link, title, byline and dateline, body | [#blog-post](https://ui.atelic.me/#blog-post) |
|
|
68
68
|
| `CTABanner` | `@atelic-action/ui/sections` | A mid page banner behind a directional wash, with the token gradient before any photography | [#c-t-a-banner](https://ui.atelic.me/#c-t-a-banner) |
|
|
69
69
|
| `CTASection` | `@atelic-action/ui/sections` | The standard closer: the site's own primary action and an optional ghost second | [#c-t-a-section](https://ui.atelic.me/#c-t-a-section) |
|
|
70
|
-
| `ComparisonTable` | `@atelic-action/ui/sections` | A graded before and after that scrolls sideways on a phone rather than reflowing | [#comparison-table](https://ui.atelic.me/#comparison-table) |
|
|
70
|
+
| `ComparisonTable` | `@atelic-action/ui/sections` | A graded before and after that scrolls sideways on a phone rather than reflowing; a row's label can link to what explains it (`stageHref`, 3.14.0) | [#comparison-table](https://ui.atelic.me/#comparison-table) |
|
|
71
71
|
| `ContactForm` | `@atelic-action/ui/sections` | Validated form with a honeypot that posts to `endpoint` (or hands off to mail); `onLead` replaces the default GA4 `generate_lead` event | [#contact-form](https://ui.atelic.me/#contact-form) |
|
|
72
72
|
| `ContactInfoCard` | `@atelic-action/ui/sections` | A dark card of direct contact rows: call, email, visit, portal | [#contact-info-card](https://ui.atelic.me/#contact-info-card) |
|
|
73
73
|
| `CredentialList` | `@atelic-action/ui/sections` | Credential cards with a mono code before each | [#credential-list](https://ui.atelic.me/#credential-list) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atelic-action/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.1",
|
|
4
4
|
"description": "Shared UI for the Atelic templates: site chrome, base styles, the component library, the access gate, and the app shell they install",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowDown, ArrowRight, ArrowUp } from "lucide-react";
|
|
1
|
+
import { ArrowDown, ArrowRight, ArrowUp, Triangle } from "lucide-react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { Tone } from "./tone";
|
|
4
4
|
|
|
@@ -19,11 +19,33 @@ export interface StatDelta {
|
|
|
19
19
|
tone?: Tone;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/** The change beside a figure: a small triangle and how far it moved, to the right of the figure. */
|
|
23
|
+
export interface StatChange {
|
|
24
|
+
direction: StatDirection;
|
|
25
|
+
/** How far it moved, e.g. "+26", "3.8 s". */
|
|
26
|
+
text: string;
|
|
27
|
+
/** Whether the move is good or bad news. Defaults to good for a rise and muted otherwise. */
|
|
28
|
+
tone?: Tone;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
export interface StatItem {
|
|
23
32
|
/** The big figure, e.g. "$199", "3,948", "23%"; may embed an inline glyph. */
|
|
24
33
|
value: ReactNode;
|
|
25
34
|
/** The figure's unit, set small after it on the same baseline, e.g. "mi". */
|
|
26
35
|
unit?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* The denominator of a figure that is a share, set small and muted after
|
|
38
|
+
* it: a `value` of "6" with an `outOf` of "7" reads as a big 6 and a small
|
|
39
|
+
* /7, so the number that matters is the one the eye lands on.
|
|
40
|
+
*/
|
|
41
|
+
outOf?: ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* The change, set small to the right of the figure with a triangle for its
|
|
44
|
+
* direction: "100 ▲ +26". The figure stays the current reading; the earlier
|
|
45
|
+
* one is not shown. For a comparison with its basis spelled out, use
|
|
46
|
+
* `deltas`.
|
|
47
|
+
*/
|
|
48
|
+
change?: StatChange;
|
|
27
49
|
/** An arrow before the figure, when the figure is itself a change. */
|
|
28
50
|
trend?: StatDirection;
|
|
29
51
|
/** What the figure counts. */
|
|
@@ -72,11 +94,39 @@ export function StatRow({ stats, variant = "loud", className }: StatRowProps) {
|
|
|
72
94
|
// biome-ignore lint/suspicious/noArrayIndexKey: stats are static content in a fixed order
|
|
73
95
|
<div className="stat" key={i} data-tone={stat.tone}>
|
|
74
96
|
<div className="num">
|
|
75
|
-
{
|
|
76
|
-
|
|
97
|
+
{/* The trend arrow, the figure, its denominator, and its unit are one
|
|
98
|
+
unbreakable group; only the change may drop to the next line on a
|
|
99
|
+
phone. */}
|
|
100
|
+
<span className="stat-figure">
|
|
101
|
+
{Trend && stat.trend && (
|
|
102
|
+
<Trend className="stat-trend" role="img" aria-label={spoken[stat.trend]} />
|
|
103
|
+
)}
|
|
104
|
+
{stat.value}
|
|
105
|
+
{stat.outOf != null && <span className="stat-out-of">/{stat.outOf}</span>}
|
|
106
|
+
{stat.unit != null && <span className="stat-unit">{stat.unit}</span>}
|
|
107
|
+
</span>
|
|
108
|
+
{stat.change && (
|
|
109
|
+
<span
|
|
110
|
+
className={[
|
|
111
|
+
"stat-change",
|
|
112
|
+
stat.change.direction === "down" && "is-down",
|
|
113
|
+
stat.change.direction === "flat" && "is-flat",
|
|
114
|
+
]
|
|
115
|
+
.filter(Boolean)
|
|
116
|
+
.join(" ")}
|
|
117
|
+
data-tone={
|
|
118
|
+
stat.change.tone ?? (stat.change.direction === "up" ? "good" : "muted")
|
|
119
|
+
}
|
|
120
|
+
>
|
|
121
|
+
<Triangle
|
|
122
|
+
size={10}
|
|
123
|
+
fill="currentColor"
|
|
124
|
+
role="img"
|
|
125
|
+
aria-label={spoken[stat.change.direction]}
|
|
126
|
+
/>
|
|
127
|
+
{stat.change.text}
|
|
128
|
+
</span>
|
|
77
129
|
)}
|
|
78
|
-
{stat.value}
|
|
79
|
-
{stat.unit != null && <span className="stat-unit">{stat.unit}</span>}
|
|
80
130
|
</div>
|
|
81
131
|
{stat.deltas?.map((delta) => {
|
|
82
132
|
const Icon = arrow[delta.direction];
|
package/src/components/index.ts
CHANGED
|
@@ -38,6 +38,7 @@ export {
|
|
|
38
38
|
export { StackedBar, type StackedBarProps, type StackedBarSegment } from "./StackedBar";
|
|
39
39
|
export { describeStarRating, StarRating, type StarRatingProps } from "./StarRating";
|
|
40
40
|
export {
|
|
41
|
+
type StatChange,
|
|
41
42
|
type StatDelta,
|
|
42
43
|
type StatDirection,
|
|
43
44
|
type StatItem,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import { useWithBase } from "../routing/BasePathProvider";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* A graded before and after: one row per graded item, each side carrying a grade and
|
|
@@ -29,6 +30,8 @@ export interface ComparisonRow {
|
|
|
29
30
|
id: string;
|
|
30
31
|
/** The row label, e.g. the thing being graded. */
|
|
31
32
|
stage: string;
|
|
33
|
+
/** Links the label, e.g. to the glossary entry that explains the thing graded. A root path takes the base path. */
|
|
34
|
+
stageHref?: string;
|
|
32
35
|
before: ComparisonState;
|
|
33
36
|
after: ComparisonState;
|
|
34
37
|
}
|
|
@@ -70,6 +73,7 @@ function Cell({ state, highlight }: { state: ComparisonState; highlight: boolean
|
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
export function ComparisonTable({ rows, columns, footnote, className }: ComparisonTableProps) {
|
|
76
|
+
const withBase = useWithBase();
|
|
73
77
|
const heads = {
|
|
74
78
|
stage: columns?.stage ?? "Area",
|
|
75
79
|
before: columns?.before ?? "Before",
|
|
@@ -95,7 +99,15 @@ export function ComparisonTable({ rows, columns, footnote, className }: Comparis
|
|
|
95
99
|
<tbody>
|
|
96
100
|
{rows.map((row) => (
|
|
97
101
|
<tr key={row.id}>
|
|
98
|
-
<th scope="row">
|
|
102
|
+
<th scope="row">
|
|
103
|
+
{row.stageHref ? (
|
|
104
|
+
<a className="cmp-stage-link" href={withBase(row.stageHref)}>
|
|
105
|
+
{row.stage}
|
|
106
|
+
</a>
|
|
107
|
+
) : (
|
|
108
|
+
row.stage
|
|
109
|
+
)}
|
|
110
|
+
</th>
|
|
99
111
|
<td>
|
|
100
112
|
<Cell state={row.before} highlight={false} />
|
|
101
113
|
</td>
|
|
@@ -95,6 +95,7 @@
|
|
|
95
95
|
}
|
|
96
96
|
.atelic-ui .stat .num {
|
|
97
97
|
display: flex;
|
|
98
|
+
flex-wrap: wrap;
|
|
98
99
|
align-items: center;
|
|
99
100
|
gap: 0.12em;
|
|
100
101
|
font-size: clamp(2.2rem, 5vw, 3rem);
|
|
@@ -104,6 +105,14 @@
|
|
|
104
105
|
line-height: 1;
|
|
105
106
|
font-variant-numeric: tabular-nums;
|
|
106
107
|
}
|
|
108
|
+
/* The figure with its denominator and unit never breaks; the change
|
|
109
|
+
beside it is the one piece that may wrap under it on a narrow phone. */
|
|
110
|
+
.atelic-ui .stat-figure {
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
gap: 0.12em;
|
|
114
|
+
white-space: nowrap;
|
|
115
|
+
}
|
|
107
116
|
.atelic-ui .stat-row.is-center .stat .num {
|
|
108
117
|
justify-content: center;
|
|
109
118
|
}
|
|
@@ -153,13 +162,48 @@
|
|
|
153
162
|
margin-top: 4px;
|
|
154
163
|
}
|
|
155
164
|
|
|
165
|
+
/* The unit sits on the figure's baseline, small and muted, the way the
|
|
166
|
+
denominator does, so "0.9 s" and "3/4" read as one shape. */
|
|
156
167
|
.atelic-ui .stat-unit {
|
|
168
|
+
align-self: flex-end;
|
|
157
169
|
margin-left: 0.2em;
|
|
158
|
-
|
|
159
|
-
font-
|
|
170
|
+
margin-bottom: 0.08em;
|
|
171
|
+
font-size: 0.42em;
|
|
172
|
+
font-weight: 600;
|
|
173
|
+
letter-spacing: 0;
|
|
174
|
+
color: var(--neutral-500);
|
|
175
|
+
}
|
|
176
|
+
/* A share's denominator: small and muted right after the figure, "6/7"
|
|
177
|
+
with the 6 big. */
|
|
178
|
+
.atelic-ui .stat-out-of {
|
|
179
|
+
align-self: flex-end;
|
|
180
|
+
margin-bottom: 0.08em;
|
|
181
|
+
font-size: 0.42em;
|
|
182
|
+
font-weight: 600;
|
|
160
183
|
letter-spacing: 0;
|
|
161
184
|
color: var(--neutral-500);
|
|
162
185
|
}
|
|
186
|
+
/* The change to the right of the figure: a filled triangle for the
|
|
187
|
+
direction (pointing down for a fall) and how far it moved, small, in
|
|
188
|
+
the tone the news deserves. */
|
|
189
|
+
.atelic-ui .stat-change {
|
|
190
|
+
display: inline-flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
gap: 0.25em;
|
|
193
|
+
align-self: flex-end;
|
|
194
|
+
margin-left: 0.4em;
|
|
195
|
+
margin-bottom: 0.14em;
|
|
196
|
+
font-size: 0.34em;
|
|
197
|
+
font-weight: 700;
|
|
198
|
+
letter-spacing: 0;
|
|
199
|
+
color: var(--tone, var(--neutral-500));
|
|
200
|
+
}
|
|
201
|
+
.atelic-ui .stat-change.is-down svg {
|
|
202
|
+
transform: rotate(180deg);
|
|
203
|
+
}
|
|
204
|
+
.atelic-ui .stat-change.is-flat svg {
|
|
205
|
+
transform: rotate(90deg);
|
|
206
|
+
}
|
|
163
207
|
|
|
164
208
|
/* ---- StatRow, quiet: a glance row for a working page. A light figure in
|
|
165
209
|
the text color over a small capitalized label, the stats divided by a
|
|
@@ -177,6 +221,10 @@
|
|
|
177
221
|
padding-left: 16px;
|
|
178
222
|
border-left: 1px solid var(--neutral-200);
|
|
179
223
|
}
|
|
224
|
+
.atelic-ui .stat-row.is-quiet .stat-figure {
|
|
225
|
+
align-items: baseline;
|
|
226
|
+
gap: 4px;
|
|
227
|
+
}
|
|
180
228
|
.atelic-ui .stat-row.is-quiet .stat .num {
|
|
181
229
|
align-items: baseline;
|
|
182
230
|
gap: 4px;
|
|
@@ -186,7 +234,17 @@
|
|
|
186
234
|
letter-spacing: -0.02em;
|
|
187
235
|
color: var(--tone, var(--ink));
|
|
188
236
|
}
|
|
237
|
+
/* On the quiet row the denominator and the change sit on the figure's
|
|
238
|
+
baseline at a legible size, since the figure itself is small. */
|
|
239
|
+
.atelic-ui .stat-row.is-quiet .stat-out-of,
|
|
240
|
+
.atelic-ui .stat-row.is-quiet .stat-change {
|
|
241
|
+
align-self: baseline;
|
|
242
|
+
margin-bottom: 0;
|
|
243
|
+
font-size: 0.55em;
|
|
244
|
+
}
|
|
189
245
|
.atelic-ui .stat-row.is-quiet .stat-unit {
|
|
246
|
+
align-self: baseline;
|
|
247
|
+
margin-bottom: 0;
|
|
190
248
|
margin-left: 0;
|
|
191
249
|
font: 500 12px / 1 var(--font-mono);
|
|
192
250
|
}
|
package/src/styles/sections.css
CHANGED
|
@@ -256,6 +256,21 @@
|
|
|
256
256
|
color: var(--ink);
|
|
257
257
|
font-weight: 500;
|
|
258
258
|
}
|
|
259
|
+
/* A linked row label reads as the label, with a quiet underline for the
|
|
260
|
+
link, so the column of names stays a column of names. */
|
|
261
|
+
.atelic-ui .cmp-stage-link {
|
|
262
|
+
color: inherit;
|
|
263
|
+
text-decoration: underline;
|
|
264
|
+
text-decoration-color: color-mix(in srgb, var(--ink) 25%, transparent);
|
|
265
|
+
text-underline-offset: 0.18em;
|
|
266
|
+
}
|
|
267
|
+
.atelic-ui .cmp-stage-link:hover {
|
|
268
|
+
text-decoration-color: var(--ui-primary, var(--primary));
|
|
269
|
+
}
|
|
270
|
+
.atelic-ui .cmp-stage-link:focus-visible {
|
|
271
|
+
outline: 2px solid var(--ui-primary, var(--primary));
|
|
272
|
+
outline-offset: 2px;
|
|
273
|
+
}
|
|
259
274
|
.atelic-ui .cmp-table tbody td {
|
|
260
275
|
color: var(--ink-soft);
|
|
261
276
|
}
|