@plus234feed/ds 0.14.0 → 0.15.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/components.css +86 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plus234feed/ds",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Plus234Feed design system. Editorial tokens, type scale and components for a news intelligence platform: newspaper hierarchy, accessible colour in both themes, one component per job.",
5
5
  "keywords": [
6
6
  "design-system",
@@ -331,33 +331,86 @@
331
331
  `min(100%, ...)` is what keeps a single column on a phone: without it the
332
332
  minimum wins and the row overflows the screen. */
333
333
  .p234-tiles {
334
- display: grid;
334
+ display: flex;
335
+ flex-wrap: wrap;
335
336
  gap: var(--p234-space-6);
337
+ /* The row decides its columns from its own width, not the viewport's. The
338
+ version before this used a viewport media query with thresholds worked
339
+ out for the page measure, and the first page with a rail beside the
340
+ content got four tiles as three and one again. */
341
+ container-type: inline-size;
342
+ }
343
+ /* Flex rather than grid for one reason: when a count does not divide, the
344
+ tiles on the last row grow to fill it, so five never leaves a lone tile at
345
+ a third of the width. A grid leaves the hole. */
346
+ .p234-tiles > * { flex: 1 1 100%; min-width: 0; }
347
+
348
+ @container (min-width: 34rem) {
349
+ .p234-tiles > * { flex-basis: calc(50% - var(--p234-space-6)); }
350
+ .p234-tiles:has(> :nth-child(3):last-child) > * { flex-basis: calc(33.4% - var(--p234-space-6)); }
351
+ }
352
+ @container (min-width: 52rem) {
353
+ .p234-tiles:has(> :nth-child(4):last-child) > *,
354
+ .p234-tiles:has(> :nth-child(7):last-child) > *,
355
+ .p234-tiles:has(> :nth-child(8):last-child) > * { flex-basis: calc(25% - var(--p234-space-6)); }
356
+ .p234-tiles:has(> :nth-child(5):last-child) > *,
357
+ .p234-tiles:has(> :nth-child(6):last-child) > * { flex-basis: calc(33.4% - var(--p234-space-6)); }
358
+ }
359
+
360
+ /* --- section head ------------------------------------------------------
361
+ A heading with a note on the same line and a rule beneath: "Global
362
+ commodities" with "Spot, USD" at the right, "Monthly movers" with the date
363
+ range. The markets page did this six times, each with its own icon in
364
+ front of the heading saying what the heading said. */
365
+ .p234-sectionhead {
366
+ display: flex;
367
+ align-items: baseline;
368
+ justify-content: space-between;
369
+ gap: var(--p234-space-4);
370
+ flex-wrap: wrap;
371
+ padding-bottom: var(--p234-space-3);
372
+ border-bottom: var(--p234-border-thick) solid var(--p234-color-ink);
373
+ margin-bottom: var(--p234-space-5);
374
+ }
375
+ .p234-sectionhead__title {
376
+ font-family: var(--p234-type-headline-sm-family);
377
+ font-size: var(--p234-type-headline-sm-size);
378
+ line-height: var(--p234-type-headline-sm-leading);
379
+ letter-spacing: var(--p234-type-headline-sm-tracking);
380
+ font-weight: var(--p234-type-headline-sm-weight);
381
+ color: var(--p234-color-ink);
382
+ margin: 0;
383
+ }
384
+ .p234-sectionhead__note {
385
+ font-family: var(--p234-type-meta-family);
386
+ font-size: var(--p234-type-meta-size);
387
+ color: var(--p234-color-ink-muted);
336
388
  }
337
389
 
338
- /* One column on a phone, a row once there is space for one.
339
- *
340
- * The first version used `minmax(min(100%, 11rem), 1fr)` to get the single
341
- * column without a media query. A percentage inside minmax under auto-fit is
342
- * treated as indefinite while tracks are being sized, so the track falls back
343
- * to sizing from its contents, and a row of three tiles with labels as long
344
- * as "Parallel market, USD" came out as three rows. The same mistake cost
345
- * four pages their layout in .p234-split: the clever form loses to the
346
- * explicit one. */
347
- @media (min-width: 40rem) {
348
- .p234-tiles { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
349
-
350
- /* Quantity queries. At the page measure an 11rem minimum fits three
351
- across, so four tiles break as three and one, and seven as three, three
352
- and one. A wider minimum drops those to two and four across, which
353
- divide evenly. */
354
- .p234-tiles:has(> :nth-child(4):last-child) {
355
- grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
356
- }
357
- .p234-tiles:has(> :nth-child(7):last-child) {
358
- grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
359
- }
390
+ /* --- sparkline ---------------------------------------------------------
391
+ A line of recent prices beside a figure, small enough to sit in a row.
392
+ The page draws the path; this sets its size and stroke, and takes the
393
+ colour from the delta tokens so a rise and a fall look the same here as
394
+ they do in the number beside it. It is a shape, not a chart: no axes, no
395
+ labels, and it never carries a value the row does not also state. */
396
+ .p234-sparkline {
397
+ display: inline-block;
398
+ width: 5rem;
399
+ height: 1.75rem;
400
+ flex: none;
401
+ vertical-align: middle;
402
+ overflow: visible;
360
403
  }
404
+ .p234-sparkline path {
405
+ fill: none;
406
+ stroke: var(--p234-color-data-flat);
407
+ stroke-width: var(--p234-chart-line-width);
408
+ stroke-linecap: round;
409
+ stroke-linejoin: round;
410
+ vector-effect: non-scaling-stroke;
411
+ }
412
+ .p234-sparkline[data-direction="up"] path { stroke: var(--p234-color-data-up); }
413
+ .p234-sparkline[data-direction="down"] path { stroke: var(--p234-color-data-down); }
361
414
 
362
415
  /* --- meter -------------------------------------------------------------
363
416
  An inline bar for one value's share of a whole: a food group's share of a
@@ -1519,6 +1572,16 @@ textarea.p234-field__control {
1519
1572
  align-self: center;
1520
1573
  }
1521
1574
 
1575
+ /* Many short rows at once: 106 government bonds, each a code and a price.
1576
+ One column of those is a scroll of a thousand pixels; laid out in columns
1577
+ they fit a screen. A rem minimum, never a percentage, so the columns
1578
+ collapse to one on a phone without the track-sizing trap. */
1579
+ .p234-directory--grid {
1580
+ display: grid;
1581
+ grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
1582
+ column-gap: var(--p234-space-7);
1583
+ }
1584
+
1522
1585
  @container (max-width: 26rem) {
1523
1586
  .p234-directory__row {
1524
1587
  display: grid;