@atelic-action/ui 3.8.0 → 3.9.2

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 CHANGED
@@ -705,7 +705,7 @@ The blocks a page composes, each styled in `styles/components.css` inside the `a
705
705
  | `IconList` | A list whose bullets are icons | `icon` and `tone` on the list set every bullet; an item's own override them. The bullet is decoration, so a screen reader hears only the items. A dot when no icon is set; the text's color when no tone is |
706
706
  | `ReportCard` | A name, a grade, and one line on it per row, in labeled groups, each row's parts centered on it | A row with `href` is a link from edge to edge with a chevron at its end; a link inside `line` still goes where it points. `before` sets the earlier grade faded beside the grade; no `grade` draws a dash read as not graded. `legend` explains the letters beside the `title`, or under the card with `legendAt="foot"`; `labels` sets the screen reader's words. The grade is `GradeChip` |
707
707
  | `Rank` | A figure with its badge, for a table cell | `figure` is the rank, the place, or a dash for none; `tone` colors the badge and `meaning` names it for a screen reader; `href` links the figure, in a new tab with `newTab`. The figure's slot is a fixed width, so the badges line up down a column |
708
- | `DataTable` | A table whose first column names each row, sortable by any column marked `sortable` | A click on a heading sorts on a wide screen. On a phone each row stacks, every fact wearing its column's label, and a dropdown sorts. A cell is a node, or `{ display, sort }` when what it shows is not what it sorts by; a formatted number in a string (`"$12,047"`, `"0.24%"`) sorts as a number. It renders in `defaultSort` on the server. Every other row sits on a tinted ground; `striped={false}` turns that off. A column marked `fit` hugs its content, for a swatch or a mark beside a figure. A column with a `hint` draws a `Hint` beside its heading, before the label when the column is right aligned; on a phone the heading row is hidden, so the hint is too |
708
+ | `DataTable` | A table whose first column names each row, sortable by any column marked `sortable` | A click on a heading sorts on a wide screen. On a phone each row stacks, every fact wearing its column's label, and a dropdown sorts. A cell is a node, or `{ display, sort }` when what it shows is not what it sorts by; a formatted number in a string (`"$12,047"`, `"0.24%"`) sorts as a number. It renders in `defaultSort` on the server. Every other row sits on a tinted ground; `striped={false}` turns that off. A column marked `fit` hugs its content, for a swatch or a mark beside a figure. A column with a `hint` draws a `Hint` beside its heading, before the label when the column is right aligned; on a phone the heading row is hidden, so the hint is too. A cell given as `null` or `undefined`, or left out of a short row, is empty: it draws a short gray rule, the `.data-table-empty` class, which a screen reader hears as "None" or as the column's `emptyLabel`, and it sorts last whichever way the column runs. The first cell names the row, so it is never drawn as empty; give every row a name. A typed string is always content, a dash included, so type nothing for an empty cell. A document may wear `.data-table-empty` for its own neutral mark, so every empty cell reads the same |
709
709
  | `Hint` | An info icon that opens a short explainer beside a word | Opens on hover or focus, stays open on a click or a tap, closes on Escape or a tap elsewhere. The bubble opens from the icon's left edge and slides left when it would run off the screen. `side="before"` puts the icon before its word, for a right aligned heading. `label` is what a screen reader calls the button; the bubble is its description. Print hides it |
710
710
  | `StatRow` | A row of large figures, each over what it counts and its `period`. `variant="quiet"` is the glance row for a working page: a light figure in the text color over a small capitalized label, hairlines between; `unit` sets a figure's unit small beside it | `trend` draws an arrow before a figure that is itself a change. `deltas` list comparisons beneath: an arrow, how far, against what (`basis`), and the earlier figure (`was`), each in its own tone, since a spend falling and a cost falling read differently |
711
711
  | `Callout` | One finding: an icon in its tone beside the title, the explainer under it | `variant="box"` sets it apart on a tinted ground, for something missing or owed |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atelic-action/ui",
3
- "version": "3.8.0",
3
+ "version": "3.9.2",
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",
@@ -27,7 +27,11 @@ export interface SiteShellProps {
27
27
  basePath?: string;
28
28
  /** The header's links. Defaults to `site.nav`; the footer lists the same ones. */
29
29
  nav?: NavItem[];
30
- /** Home style pages with a full bleed hero get a transparent header. */
30
+ /**
31
+ * Home style pages with a full bleed hero get a transparent header, and
32
+ * their hero sits under it. Every other page starts below the fixed
33
+ * header: `<main>` clears it here, once, so no section has to.
34
+ */
31
35
  heroNav?: boolean;
32
36
  /**
33
37
  * A page that closes on its own ask turns the mobile booking bar off,
@@ -109,7 +113,9 @@ export function SiteShell({
109
113
  hideCTA={hideNavCTA}
110
114
  contact={{ phone: site.phone, email: site.email, address: site.address }}
111
115
  />
112
- <main id="main">{children}</main>
116
+ <main id="main" className={heroNav ? undefined : "clears-nav"}>
117
+ {children}
118
+ </main>
113
119
  {stickyCTA && <StickyCTABar primaryCTA={cta} phone={site.phone} />}
114
120
  {footer ? (
115
121
  <Footer
@@ -20,6 +20,8 @@ export interface DataTableColumn {
20
20
  hint?: ReactNode;
21
21
  /** What a screen reader calls the hint's button; defaults to "About" and the label. */
22
22
  hintLabel?: string;
23
+ /** What a screen reader hears for an empty cell in this column; defaults to "None". */
24
+ emptyLabel?: string;
23
25
  }
24
26
 
25
27
  /** A cell whose display is not what it sorts by, e.g. an icon over a number. */
@@ -28,6 +30,12 @@ export interface DataTableValueCell {
28
30
  sort: number | string;
29
31
  }
30
32
 
33
+ /**
34
+ * A cell is a node, or a value cell. `null` or `undefined`, or a cell left
35
+ * out, is an empty cell: it draws a short gray rule and sorts last either way.
36
+ * A string is always content, a typed dash included, since a dash can mean
37
+ * "unchanged".
38
+ */
31
39
  export type DataTableCell = ReactNode | DataTableValueCell;
32
40
 
33
41
  export interface DataTableRow {
@@ -53,6 +61,11 @@ function isValueCell(cell: DataTableCell): cell is DataTableValueCell {
53
61
  return typeof cell === "object" && cell !== null && "sort" in cell && "display" in cell;
54
62
  }
55
63
 
64
+ /** No value to show. The first cell names the row, so it is never empty. */
65
+ function isEmpty(cell: DataTableCell, column: number): boolean {
66
+ return column !== 0 && (cell === null || cell === undefined);
67
+ }
68
+
56
69
  function sortValue(cell: DataTableCell): number | string {
57
70
  if (isValueCell(cell)) return cell.sort;
58
71
  if (typeof cell === "number") return cell;
@@ -94,10 +107,13 @@ export function DataTable({
94
107
  if (!sort) return indexed;
95
108
  const direction = sort.direction === "asc" ? 1 : -1;
96
109
  return indexed.sort((a, b) => {
97
- const order = compare(
98
- sortValue(a.row.cells[sort.column]),
99
- sortValue(b.row.cells[sort.column]),
100
- );
110
+ const cellA = a.row.cells[sort.column];
111
+ const cellB = b.row.cells[sort.column];
112
+ // An empty cell sorts last whichever way the column runs.
113
+ const emptyA = isEmpty(cellA, sort.column);
114
+ const emptyB = isEmpty(cellB, sort.column);
115
+ if (emptyA || emptyB) return emptyA === emptyB ? a.index - b.index : emptyA ? 1 : -1;
116
+ const order = compare(sortValue(cellA), sortValue(cellB));
101
117
  return order === 0 ? a.index - b.index : order * direction;
102
118
  });
103
119
  }, [rows, sort]);
@@ -194,8 +210,21 @@ export function DataTable({
194
210
  <tbody>
195
211
  {sorted.map(({ row, index }) => (
196
212
  <tr key={index} data-tone={row.tone}>
197
- {row.cells.map((cell, c) => {
198
- const body = isValueCell(cell) ? cell.display : cell;
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
+ );
199
228
  const shape = {
200
229
  "data-align": columns[c]?.align ?? "left",
201
230
  "data-fit": columns[c]?.fit || undefined,
@@ -79,6 +79,10 @@ function Clip({
79
79
  // A pause that interrupts a pending play rejects it with an AbortError;
80
80
  // that is the reader scrolling past, not autoplay being refused.
81
81
  let observer: IntersectionObserver | undefined;
82
+ // React sets muted as a property and never renders the attribute, and an
83
+ // iPhone browser's autoplay check reads the attribute, so set both.
84
+ video.muted = true;
85
+ video.setAttribute("muted", "");
82
86
  const play = () =>
83
87
  video.play()?.catch((err: unknown) => {
84
88
  if ((err as { name?: string } | null)?.name === "AbortError") return;
@@ -144,17 +148,15 @@ function Figure({ block, withBase }: { block: ProseBlock; withBase: (path: strin
144
148
 
145
149
  if (!src) {
146
150
  return (
147
- <figure className="pb-figure">
148
- <div className="ph" style={tileStyle(block.width, block.height)}>
149
- {block.alt ?? "Figure"}
150
- </div>
151
+ <figure className="pb-figure" style={tileStyle(block.width, block.height)}>
152
+ <div className="ph">{block.alt ?? "Figure"}</div>
151
153
  {block.caption ? <figcaption className="pb-caption">{block.caption}</figcaption> : null}
152
154
  </figure>
153
155
  );
154
156
  }
155
157
 
156
158
  return (
157
- <figure className="pb-figure">
159
+ <figure className="pb-figure" style={tileStyle(block.width, block.height)}>
158
160
  {/* biome-ignore lint/a11y/useKeyWithClickEvents: the backdrop click is a pointer shortcut; the dialog closes on Escape natively and has a close button */}
159
161
  <dialog
160
162
  ref={dialogRef}
@@ -206,7 +208,6 @@ function Figure({ block, withBase }: { block: ProseBlock; withBase: (path: strin
206
208
  <button
207
209
  type="button"
208
210
  className="pb-tile"
209
- style={tileStyle(block.width, block.height)}
210
211
  aria-label={`Open larger: ${label}`}
211
212
  onClick={() => {
212
213
  setReduceMotion(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false);
@@ -66,6 +66,13 @@
66
66
  }
67
67
 
68
68
  /* ---- Header ---- */
69
+ /* The page starts below the fixed header, cleared once here rather than by
70
+ each opening section. A page with a full bleed hero (heroNav) leaves it
71
+ off, so the hero runs under the transparent header. */
72
+ .atelic-ui main.clears-nav {
73
+ padding-top: var(--nav-height, 72px);
74
+ }
75
+
69
76
  /* Fixed header: transparent over a hero, solid once scrolled, or dark. */
70
77
  .atelic-ui .nav {
71
78
  position: fixed;
@@ -16,9 +16,15 @@
16
16
  channels there) sets the `--ui-` names and leaves its own alone. */
17
17
  @layer atelic-ui {
18
18
  .atelic-ui .not-found-hero {
19
- padding-top: calc(var(--nav-height, 72px) + clamp(40px, 7vw, 86px));
19
+ padding-top: clamp(40px, 7vw, 86px);
20
20
  padding-bottom: clamp(28px, 5vw, 60px);
21
21
  }
22
+ /* SiteShell's main clears the fixed header for the page. A shell that does
23
+ not (ArtifactShell, whose documents clear it in their own sheet) leaves
24
+ the 404 to clear it here, or its heading sits under the header. */
25
+ .atelic-ui main:not(.clears-nav) .not-found-hero {
26
+ padding-top: calc(var(--nav-height, 72px) + clamp(40px, 7vw, 86px));
27
+ }
22
28
  .atelic-ui .not-found-hero h1 {
23
29
  margin: 16px 0 0;
24
30
  }
@@ -1042,6 +1048,27 @@
1042
1048
  text-transform: uppercase;
1043
1049
  color: var(--neutral-500);
1044
1050
  }
1051
+ /* An empty cell's dash: a short gray rule, never a typed character. A
1052
+ document may wear the class for its own neutral mark. Drawn as a
1053
+ border, since a print drops backgrounds by default. */
1054
+ .atelic-ui .data-table-empty {
1055
+ display: inline-block;
1056
+ width: 14px;
1057
+ height: 0;
1058
+ vertical-align: 0.3em;
1059
+ border-top: 1.5px solid var(--neutral-300);
1060
+ }
1061
+ .atelic-ui .data-table-empty-label {
1062
+ position: absolute;
1063
+ width: 1px;
1064
+ height: 1px;
1065
+ margin: -1px;
1066
+ padding: 0;
1067
+ overflow: hidden;
1068
+ clip: rect(0, 0, 0, 0);
1069
+ white-space: nowrap;
1070
+ border: 0;
1071
+ }
1045
1072
  @media print, (min-width: 721px) {
1046
1073
  .atelic-ui .data-table-sort {
1047
1074
  display: none;
@@ -245,24 +245,30 @@
245
245
  }
246
246
  }
247
247
 
248
+ /* The figure carries the tile's shape (its aspect ratio, inline) at the
249
+ row's height, so the flex row sizes it to the file. Set on the inner
250
+ button instead, WebKit (every iPhone browser) stretched the figure to the
251
+ row's width while the button stayed narrow, so the caption's shade ran
252
+ across empty space. */
248
253
  .atelic-ui .pb-figure {
249
254
  position: relative;
255
+ flex: 0 0 auto;
250
256
  margin: 0;
251
257
  height: var(--pb-tile-height);
252
258
  min-width: 0;
253
259
  max-width: 100%;
254
260
  }
255
261
 
256
- /* A placeholder keeps its own look and takes only the tile's shape. */
262
+ /* A placeholder keeps its own look and fills the figure. */
257
263
  .atelic-ui .pb-figure .ph {
264
+ width: 100%;
258
265
  height: 100%;
259
- max-width: 100%;
260
266
  }
261
267
 
262
268
  .atelic-ui .pb-tile {
263
269
  display: block;
270
+ width: 100%;
264
271
  height: 100%;
265
- max-width: 100%;
266
272
  padding: 0;
267
273
  border: 0;
268
274
  border-radius: 12px;
@@ -65,7 +65,12 @@
65
65
 
66
66
  /* ---- BlogPost (blog-post.css) ---- */
67
67
  /* A single article. The title is the content, so it sits in the flow rather
68
- than inside a hero band that would push the writing below the fold. */
68
+ than inside a hero band that would push the writing below the fold. The
69
+ shell clears the fixed header; the article sits as close under it as a
70
+ page hero's content does. */
71
+ .atelic-ui .blog-post {
72
+ padding-top: clamp(32px, 6vw, 64px);
73
+ }
69
74
 
70
75
  /* The article takes the site's own width, like every other page, so no
71
76
  page or site wears a column of its own size (Forni, 2026-10-26). The
@@ -678,7 +683,7 @@
678
683
 
679
684
  /* ---- PageHero (page-hero.css) ---- */
680
685
  .atelic-ui .page-hero {
681
- padding-top: calc(var(--nav-height) + clamp(40px, 7vw, 86px));
686
+ padding-top: clamp(40px, 7vw, 86px);
682
687
  padding-bottom: clamp(28px, 5vw, 60px);
683
688
  background: var(--surface-alt);
684
689
  }