@n1kname/components 0.66.0 → 0.66.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n1kname/components",
3
- "version": "0.66.0",
3
+ "version": "0.66.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -39,7 +39,7 @@
39
39
  "@n1kname/charts": "0.15.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@n1kname/tokens": "^0.11.0",
42
+ "@n1kname/tokens": "^0.11.1",
43
43
  "astro": "^7.4.4"
44
44
  },
45
45
  "publishConfig": {
@@ -137,6 +137,7 @@ const layerSizes = (width: number) =>
137
137
  `(max-width: 760px) ${Math.round(width * 0.85)}vw, ${Math.round(width * (layout === 'wide' ? 7 : 6))}px`;
138
138
  const figures = layout === 'wide' ? metrics.slice(0, 4) : [];
139
139
  const meta = metaProp ?? overline;
140
+ // Each dot is held to the item before it (a no-break space), so a wrapped line never starts on one.
140
141
  // The link is named title first, then the line, the meta and the note, so a screen reader
141
142
  // hears the case before its dates. Ids from the href, so the build stays the same each run.
142
143
  const uid = `case-tile-${href.replace(/[^a-z0-9]+/gi, '-').replace(/^-|-$/g, '') || 'home'}`;
@@ -153,7 +154,7 @@ const labelledby = [`${uid}-title`, text && `${uid}-text`, meta && `${uid}-meta`
153
154
  <div class="frame">
154
155
  <div class="copy">
155
156
  <Heading class="title" id={`${uid}-title`}>{title}</Heading>
156
- {meta && <p class="meta" id={`${uid}-meta`}>{meta}</p>}
157
+ {meta && <p class="meta" id={`${uid}-meta`}>{meta.split(' · ').join('\u00a0· ')}</p>}
157
158
  {text && <p class="text" id={`${uid}-text`}>{text}</p>}
158
159
  {note && <p class="note" id={`${uid}-note`}>{note}</p>}
159
160
  {
@@ -48,7 +48,12 @@ const Tag = as;
48
48
  </script>
49
49
 
50
50
  <style>
51
+ /* A column, so the panel can fill a figure that a grid stretches (two charts side by side)
52
+ * without counting the caption: height: 100% took the caption's height into the panel and left
53
+ * that much empty under the legend. */
51
54
  .chart-figure {
55
+ display: flex;
56
+ flex-direction: column;
52
57
  margin-block: var(--sp-6) var(--sp-7);
53
58
  }
54
59
  .chart-figure.panel {
@@ -57,7 +62,7 @@ const Tag = as;
57
62
 
58
63
  .frame {
59
64
  container-type: inline-size;
60
- height: 100%;
65
+ flex: 1 1 auto;
61
66
  padding: var(--sp-5);
62
67
  background: var(--c-surface);
63
68
  border: 1px solid var(--c-border);
package/src/Facts.astro CHANGED
@@ -199,6 +199,20 @@ const hl = highlight && variant === 'tiles';
199
199
  color: var(--c-text-secondary);
200
200
  }
201
201
 
202
+ /* A label that would get less than 7rem beside its icon (a narrow tile, two across on a phone)
203
+ drops under it and takes the tile's whole width: beside the icon it had about 70px and broke
204
+ a word to a line. Done with wrapping, not a container query: a container on the tile would
205
+ switch off its subgrid, and the figures would no longer share a baseline. */
206
+ .tiles :global(dt) {
207
+ flex-wrap: wrap;
208
+ row-gap: var(--sp-2);
209
+ }
210
+
211
+ .tiles :global(.fact-label) {
212
+ flex: 1 1 7rem;
213
+ min-width: 0;
214
+ }
215
+
202
216
  .tiles :global(.fact-icon) {
203
217
  width: 28px;
204
218
  height: 28px;
package/src/facts.js CHANGED
@@ -26,7 +26,7 @@ const deltaOf = (d) => (d == null || d === '' ? null : typeof d === 'string' ? {
26
26
  const hasLine = (f) => f.context != null || f.contextId != null || deltaOf(f.delta) != null;
27
27
  const sizeOf = (variant) => (variant === 'tiles' ? 16 : 14);
28
28
 
29
- const dtHTML = (f, size) => `${f.icon ? `<span class="fact-icon">${icon(f.icon, size)}</span>` : ''}${esc(f.label)}`;
29
+ const dtHTML = (f, size) => `${f.icon ? `<span class="fact-icon">${icon(f.icon, size)}</span>` : ''}<span class="fact-label">${esc(f.label)}</span>`;
30
30
  const lineHTML = (f) => {
31
31
  const d = deltaOf(f.delta);
32
32
  return `${d ? `<strong class="fact-delta" data-tone="${d.tone}">${esc(d.text)}</strong> ` : ''}${esc(f.context)}`;