@joewinke/jatui 0.57.0 → 0.58.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/CLAUDE.md CHANGED
@@ -83,7 +83,7 @@ Then import:
83
83
  | `StatGroup` | Lays out StatCards: `cards` (responsive auto-fit grid) or `joined` (one bordered panel with hairline dividers) — the replacement for raw DaisyUI `stats` markup. | `columns?`, `minWidth?` ('12rem'), `variant?`, `ariaLabel?`, `children` |
84
84
  | `ChartCard` | "Headline + period switch + chart" shell that draws NO chart (bring layerchart / d3 / SVG). The `chart` snippet gets `{ period, hover, hovered }`; call `hover({value, label, delta?})` as the pointer moves and the headline tweens to that point and the caption shows its label; `hover(null)` (or pointer leave) restores the total. Periods use SegmentedControl. | `label`, `value`, `format?`, `delta?`, `invertDelta?`, `caption?`, `periods?`, `period` (bindable), `onPeriodChange?`, `chartHeight?`, `loading?`, `chart` (snippet), `actions?`/`footer?` (snippets) |
85
85
  | `BarList` | Ranked horizontal bars ("top pages / top callers"): label + value as text, a decorative token-tinted bar sized against the max, optional `href` or `onSelect` per row, `hint`, per-row `tone`, `limit` + "Show N more". Pure HTML/CSS, no chart lib. | `items: BarListItem[]`, `sort?` (`desc`), `limit?`, `format?`, `formatValue?(item, total)`, `labelHeader?`/`valueHeader?`, `tone?`, `size?`, `onSelect?`, `label?` (snippet) |
86
- | `ActivityHeatmap` | GitHub-style activity-per-day calendar (calls/day, tasks closed/day): 7 weekday rows × week columns, default range = last 12 months, `weekStart`, 4-step `color-mix` ramp from one theme `tone` (no hex), one floating tooltip, legend + summary ("1,204 calls in the last year"). `role="grid"` with ONE tab stop: arrows move by day (↑↓) / week (←→), PgUp/PgDn 4 weeks, Home/End row ends, mod+Home/End range ends, Enter/Space select. Pure layout helpers exported (`buildHeatmap`, `moveHeatFocus`). | `data` (`{date, count}[]` or `getDate`/`getCount`), `start?`/`end?`, `weekStart?`, `unit?` ('call' or ['call','calls']), `formatLabel?`, `tone?`, `levels?`, `levelOf?`, `compact?`, `showLegend?`/`showWeekdays?`/`showMonths?`, `summary?`, `selected` (bindable), `onSelectDay?(date, count)`, `locale?` |
86
+ | `ActivityHeatmap` | GitHub-style activity-per-day calendar (calls/day, tasks closed/day): 7 weekday rows × week columns, default range = last 12 months, `weekStart`, 4-step `color-mix` ramp from one theme `tone` (no hex), one floating tooltip, legend + summary ("1,204 calls in the last year"). `role="grid"` with ONE tab stop: arrows move by day (↑↓) / week (←→), PgUp/PgDn 4 weeks, Home/End row ends, mod+Home/End range ends, Enter/Space select. `fill` (default `true`) sizes the cells to the container — pure CSS (`container-type: inline-size` + cqi), clamped 8–20px (`--hm-cell-min`/`--hm-cell-max`), scrolling only below the floor and the legend parked under the grid's right edge; `fill={false}` is the legacy fixed 12px grid (and the one to pass in a shrink-to-fit host, where an inline-size container collapses). Pure layout helpers exported (`buildHeatmap`, `moveHeatFocus`). | `data` (`{date, count}[]` or `getDate`/`getCount`), `start?`/`end?`, `weekStart?`, `unit?` ('call' or ['call','calls']), `formatLabel?`, `tone?`, `levels?`, `levelOf?`, `compact?`, `fill?` (true), `showLegend?`/`showWeekdays?`/`showMonths?`, `summary?`, `selected` (bindable), `onSelectDay?(date, count)`, `locale?` |
87
87
  | `StatusBadge` | Status indicator with dot | `status: StatusValue`, `label` |
88
88
  | `Card` | Content card container | `title`, `children` (snippet) |
89
89
  | `Modal` | Dialog overlay. `zIndex` accepts `number` OR any CSS `z-index` string, including `"var(--z-lightbox)"`. **On open, focus goes to the first fillable field** (WAI-ARIA APG): a `[data-autofocus]`/`autofocus` element, else the first enabled **rendered** text-entry control (readOnly/disabled textareas excluded, unrendered candidates skipped), else the dialog itself — `initialFocus` overrides the order (`'dialog'` restores the old container focus); the focus landing is verified, else the container is focused. When the dialog is the fallback focus, **Escape is owned by the dialog element itself** (not the window handler), so `trapKeys`' stopPropagation can't swallow Esc; a Modal opened inside a host Drawer closes before the drawer. The component ships its own open-state `.modal-box` opacity rule, so it renders under DaisyUI 5 with no host global override. | `open` (bindable), `title`, `children` (snippet), `zIndex?: string \| number`, `trapKeys?`, `closeOnEscape?`, `initialFocus?` |
@@ -6,6 +6,13 @@
6
6
  (color-mix from one theme colour into base-100, no hex), a single tooltip,
7
7
  a legend and a summary line. One tab stop: arrows move by day/week inside
8
8
  the grid (role="grid"), Enter/Space selects.
9
+
10
+ Fill mode (jatui-pldt4, default): the component is an inline-size container
11
+ and --hm-cell is derived from the container width in pure CSS (cqi + calc,
12
+ no ResizeObserver, no first-paint jump), so a wide card is spanned end to
13
+ end and the footer — summary left, legend right — stays as wide as the
14
+ grid instead of floating at the card edges. fill={false} keeps the exact
15
+ legacy fixed-cell markup and scroll behaviour.
9
16
  -->
10
17
  <script lang="ts" generics="T = { date: string | Date; count: number }">
11
18
  import { untrack } from 'svelte';
@@ -34,6 +41,21 @@
34
41
  levelOf?: (count: number, max: number, levels: number) => number;
35
42
  /** Smaller cells and labels. */
36
43
  compact?: boolean;
44
+ /**
45
+ * Size cells to the host's width (default `true`): `--hm-cell` becomes
46
+ * `(containerWidth - focus padding - weekday gutter) / weeks - gap`,
47
+ * clamped to `--hm-cell-min` (8px) … `--hm-cell-max` (20px) — both
48
+ * overridable in CSS. Below the floor the grid overflows and scrolls
49
+ * horizontally inside the component; above the ceiling the grid keeps its
50
+ * maximum size at the inline start and the footer (summary + legend) is
51
+ * sized to the grid's width, so the legend sits under the grid's right
52
+ * edge rather than the card's. Needs a host that gives the component a
53
+ * definite width (a card body): in a shrink-to-fit host the inline-size
54
+ * container collapses — pass `fill={false}` there. `false` keeps the
55
+ * fixed `--hm-cell` grid (the exact legacy markup) with the same
56
+ * horizontal scroll whenever the weeks don't fit.
57
+ */
58
+ fill?: boolean;
37
59
  showLegend?: boolean;
38
60
  showWeekdays?: boolean;
39
61
  showMonths?: boolean;
@@ -60,6 +82,7 @@
60
82
  levels = 4,
61
83
  levelOf,
62
84
  compact = false,
85
+ fill = true,
63
86
  showLegend = true,
64
87
  showWeekdays = true,
65
88
  showMonths = true,
@@ -165,6 +188,7 @@
165
188
  <div
166
189
  class="jatui-heatmap tone-{tone} {className}"
167
190
  class:is-compact={compact}
191
+ class:is-fill={fill}
168
192
  bind:this={wrapEl}
169
193
  style:--weeks={layout.weeks}
170
194
  >
@@ -255,6 +279,13 @@
255
279
  .jatui-heatmap {
256
280
  --hm-cell: 0.75rem;
257
281
  --hm-gap: 3px;
282
+ /* Root font size and the focus-ring padding as vars so the fill math can
283
+ * reference them without em (em inside an inherited custom property
284
+ * resolves against each USING element's font size — the weekday labels
285
+ * are 0.9em and would disagree with the cells). rem is absolute, so
286
+ * every element resolves the same px. */
287
+ --hm-fs: 0.75rem;
288
+ --hm-pad: 2px;
258
289
  --hm-tone: var(--color-primary);
259
290
  --hm-empty: color-mix(in oklch, var(--color-base-content) 8%, var(--color-base-100));
260
291
  position: relative;
@@ -263,13 +294,56 @@
263
294
  gap: var(--jatui-space-base, 8px);
264
295
  min-width: 0;
265
296
  max-width: 100%;
266
- font-size: 0.75rem;
297
+ font-size: var(--hm-fs);
267
298
  color: color-mix(in oklch, var(--color-base-content) 60%, transparent);
268
299
  }
269
300
  .jatui-heatmap.is-compact {
270
301
  --hm-cell: 0.625rem;
302
+ --hm-fs: 0.6875rem;
271
303
  --hm-gap: 2px;
272
- font-size: 0.6875rem;
304
+ font-size: var(--hm-fs);
305
+ }
306
+
307
+ /* Fill mode (jatui-pldt4): the component is the size container; cells size
308
+ * to the width the host gives it — (container - focus padding - weekday
309
+ * gutter) / weeks - gap — clamped to a readable band (--hm-cell-min …
310
+ * --hm-cell-max). Below the floor the grid overflows and .hm-scroll scrolls
311
+ * (the floor is the only thing that triggers scrolling); above the ceiling
312
+ * the grid keeps its maximum size at the inline start and the footer is
313
+ * sized to the grid's width, so the legend lands under the grid's right
314
+ * edge, never the card's. Month labels and the weekday column keep reading
315
+ * the same --hm-cell, so everything stays on one grid. */
316
+ .jatui-heatmap.is-fill {
317
+ container-type: inline-size;
318
+ }
319
+ .jatui-heatmap.is-fill:has(.hm-weekdays) {
320
+ --hm-label-w: calc(2.25 * var(--hm-fs) + var(--hm-gap));
321
+ }
322
+ .jatui-heatmap.is-fill .hm-months {
323
+ /* A month starting in the final week column hangs its label past the
324
+ * grid's right edge; legacy let the body grow to fit it, but the fill
325
+ * grid is pinned to the container — clip the decorative label at the
326
+ * grid's edge instead of handing the scroller a phantom scrollbar. */
327
+ overflow: hidden;
328
+ }
329
+ .jatui-heatmap.is-fill :is(.hm-scroll, .hm-foot) {
330
+ --hm-cell: clamp(
331
+ var(--hm-cell-min, 8px),
332
+ calc(
333
+ (100cqi - 2 * var(--hm-pad) - var(--hm-label-w, 0px)) / var(--weeks) -
334
+ var(--hm-gap)
335
+ ),
336
+ var(--hm-cell-max, 20px)
337
+ );
338
+ }
339
+ .jatui-heatmap.is-fill .hm-foot {
340
+ width: min(
341
+ calc(
342
+ var(--hm-pad) + var(--hm-label-w, 0px) +
343
+ var(--weeks) * (var(--hm-cell) + var(--hm-gap)) - var(--hm-gap)
344
+ ),
345
+ 100%
346
+ );
273
347
  }
274
348
  .tone-secondary { --hm-tone: var(--color-secondary); }
275
349
  .tone-accent { --hm-tone: var(--color-accent); }
@@ -282,7 +356,7 @@
282
356
  overflow-x: auto;
283
357
  overscroll-behavior-x: contain;
284
358
  /* room for the focus ring */
285
- padding: 2px;
359
+ padding: var(--hm-pad);
286
360
  }
287
361
  .hm-body {
288
362
  display: inline-flex;
@@ -24,6 +24,21 @@ declare function $$render<T = {
24
24
  levelOf?: (count: number, max: number, levels: number) => number;
25
25
  /** Smaller cells and labels. */
26
26
  compact?: boolean;
27
+ /**
28
+ * Size cells to the host's width (default `true`): `--hm-cell` becomes
29
+ * `(containerWidth - focus padding - weekday gutter) / weeks - gap`,
30
+ * clamped to `--hm-cell-min` (8px) … `--hm-cell-max` (20px) — both
31
+ * overridable in CSS. Below the floor the grid overflows and scrolls
32
+ * horizontally inside the component; above the ceiling the grid keeps its
33
+ * maximum size at the inline start and the footer (summary + legend) is
34
+ * sized to the grid's width, so the legend sits under the grid's right
35
+ * edge rather than the card's. Needs a host that gives the component a
36
+ * definite width (a card body): in a shrink-to-fit host the inline-size
37
+ * container collapses — pass `fill={false}` there. `false` keeps the
38
+ * fixed `--hm-cell` grid (the exact legacy markup) with the same
39
+ * horizontal scroll whenever the weeks don't fit.
40
+ */
41
+ fill?: boolean;
27
42
  showLegend?: boolean;
28
43
  showWeekdays?: boolean;
29
44
  showMonths?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joewinke/jatui",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "private": false,
5
5
  "description": "Shared Svelte 5 component library for JAT projects",
6
6
  "type": "module",