@seekalfred/primitives 0.7.3 → 0.8.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 (149) hide show
  1. package/README.md +315 -4
  2. package/dist/alert/alert.d.ts +2 -2
  3. package/dist/alert/alert.js +1 -1
  4. package/dist/alert/alert.js.map +1 -1
  5. package/dist/alert-dialog/alert-dialog.d.ts +14 -0
  6. package/dist/alert-dialog/alert-dialog.js +52 -27
  7. package/dist/alert-dialog/alert-dialog.js.map +1 -1
  8. package/dist/announcement-bar/announcement-bar.d.ts +15 -4
  9. package/dist/announcement-bar/announcement-bar.js +31 -6
  10. package/dist/announcement-bar/announcement-bar.js.map +1 -1
  11. package/dist/avatar/avatar.d.ts +7 -0
  12. package/dist/avatar/avatar.js +33 -12
  13. package/dist/avatar/avatar.js.map +1 -1
  14. package/dist/badge/badge.d.ts +16 -1
  15. package/dist/badge/badge.js +12 -5
  16. package/dist/badge/badge.js.map +1 -1
  17. package/dist/bar-chart/bar-chart-series.d.ts +75 -0
  18. package/dist/bar-chart/bar-chart-series.js +401 -0
  19. package/dist/bar-chart/bar-chart-series.js.map +1 -0
  20. package/dist/bar-chart/bar-chart.d.ts +25 -1
  21. package/dist/bar-chart/bar-chart.js +26 -1
  22. package/dist/bar-chart/bar-chart.js.map +1 -1
  23. package/dist/bar-chart/index.d.ts +2 -1
  24. package/dist/button/button.d.ts +24 -2
  25. package/dist/button/button.js +62 -13
  26. package/dist/button/button.js.map +1 -1
  27. package/dist/card/card.js +1 -1
  28. package/dist/card/card.js.map +1 -1
  29. package/dist/checkbox/checkbox.d.ts +25 -1
  30. package/dist/checkbox/checkbox.js +103 -28
  31. package/dist/checkbox/checkbox.js.map +1 -1
  32. package/dist/checkbox/index.d.ts +2 -2
  33. package/dist/checkbox/index.js +2 -2
  34. package/dist/chip-group/chip-group.d.ts +11 -0
  35. package/dist/chip-group/chip-group.js +50 -34
  36. package/dist/chip-group/chip-group.js.map +1 -1
  37. package/dist/chip-group/index.d.ts +2 -2
  38. package/dist/code-block/code-block.d.ts +45 -0
  39. package/dist/code-block/code-block.js +74 -0
  40. package/dist/code-block/code-block.js.map +1 -0
  41. package/dist/code-block/index.d.ts +2 -0
  42. package/dist/code-block/index.js +2 -0
  43. package/dist/command-palette/command-palette.d.ts +128 -0
  44. package/dist/command-palette/command-palette.js +371 -0
  45. package/dist/command-palette/command-palette.js.map +1 -0
  46. package/dist/command-palette/index.d.ts +2 -0
  47. package/dist/command-palette/index.js +2 -0
  48. package/dist/copy-button/copy-button.d.ts +19 -3
  49. package/dist/copy-button/copy-button.js +7 -4
  50. package/dist/copy-button/copy-button.js.map +1 -1
  51. package/dist/dialog/dialog.js +1 -1
  52. package/dist/dialog/dialog.js.map +1 -1
  53. package/dist/empty-state/empty-state.d.ts +17 -0
  54. package/dist/empty-state/empty-state.js +9 -7
  55. package/dist/empty-state/empty-state.js.map +1 -1
  56. package/dist/file-drop-zone/file-drop-zone.d.ts +29 -3
  57. package/dist/file-drop-zone/file-drop-zone.js +26 -8
  58. package/dist/file-drop-zone/file-drop-zone.js.map +1 -1
  59. package/dist/gauge/gauge.d.ts +18 -1
  60. package/dist/gauge/gauge.js +35 -21
  61. package/dist/gauge/gauge.js.map +1 -1
  62. package/dist/gauge/index.d.ts +2 -2
  63. package/dist/index.d.ts +14 -9
  64. package/dist/index.js +14 -10
  65. package/dist/info-tooltip/index.d.ts +2 -0
  66. package/dist/info-tooltip/index.js +2 -0
  67. package/dist/info-tooltip/info-tooltip.d.ts +35 -0
  68. package/dist/info-tooltip/info-tooltip.js +49 -0
  69. package/dist/info-tooltip/info-tooltip.js.map +1 -0
  70. package/dist/input/input.d.ts +7 -0
  71. package/dist/input/input.js +4 -2
  72. package/dist/input/input.js.map +1 -1
  73. package/dist/lib/field-shell.js +2 -6
  74. package/dist/lib/field-shell.js.map +1 -1
  75. package/dist/lib/required-marker.js +20 -0
  76. package/dist/lib/required-marker.js.map +1 -0
  77. package/dist/lib/selection-control.js +32 -1
  78. package/dist/lib/selection-control.js.map +1 -1
  79. package/dist/line-chart/index.d.ts +2 -2
  80. package/dist/line-chart/line-chart.d.ts +106 -3
  81. package/dist/line-chart/line-chart.js +185 -46
  82. package/dist/line-chart/line-chart.js.map +1 -1
  83. package/dist/mention-input/mention-input.js +1 -1
  84. package/dist/money-input/index.d.ts +2 -2
  85. package/dist/money-input/money-input.d.ts +14 -0
  86. package/dist/money-input/money-input.js +17 -7
  87. package/dist/money-input/money-input.js.map +1 -1
  88. package/dist/morph-select/morph-select.d.ts +8 -1
  89. package/dist/morph-select/morph-select.js +8 -5
  90. package/dist/morph-select/morph-select.js.map +1 -1
  91. package/dist/multi-select/multi-select.d.ts +31 -0
  92. package/dist/multi-select/multi-select.js +123 -6
  93. package/dist/multi-select/multi-select.js.map +1 -1
  94. package/dist/number-field/number-field.js +1 -1
  95. package/dist/password-field/password-field.js +1 -1
  96. package/dist/password-strength/password-strength.js +1 -1
  97. package/dist/phone-input/phone-input.js +1 -1
  98. package/dist/popover/popover.js +1 -1
  99. package/dist/popover/popover.js.map +1 -1
  100. package/dist/progress/index.d.ts +2 -2
  101. package/dist/progress/index.js +2 -2
  102. package/dist/progress/progress.d.ts +53 -2
  103. package/dist/progress/progress.js +146 -36
  104. package/dist/progress/progress.js.map +1 -1
  105. package/dist/radio-group/radio-group.d.ts +12 -3
  106. package/dist/radio-group/radio-group.js +62 -52
  107. package/dist/radio-group/radio-group.js.map +1 -1
  108. package/dist/rich-text-editor/rich-text-editor.js +1 -1
  109. package/dist/scroll-area/scroll-area.d.ts +1 -1
  110. package/dist/scrub-input/scrub-input.d.ts +11 -1
  111. package/dist/scrub-input/scrub-input.js +22 -10
  112. package/dist/scrub-input/scrub-input.js.map +1 -1
  113. package/dist/search-field/search-field.js +1 -1
  114. package/dist/select/select.d.ts +10 -1
  115. package/dist/select/select.js +4 -3
  116. package/dist/select/select.js.map +1 -1
  117. package/dist/separator/separator.d.ts +1 -1
  118. package/dist/shortcut-recorder/shortcut-recorder.js +1 -1
  119. package/dist/sparkline/sparkline.d.ts +27 -2
  120. package/dist/sparkline/sparkline.js +115 -18
  121. package/dist/sparkline/sparkline.js.map +1 -1
  122. package/dist/stat-card/index.d.ts +2 -2
  123. package/dist/stat-card/index.js +2 -2
  124. package/dist/stat-card/stat-card.d.ts +32 -1
  125. package/dist/stat-card/stat-card.js +52 -9
  126. package/dist/stat-card/stat-card.js.map +1 -1
  127. package/dist/styles.css +1 -1
  128. package/dist/table/index.d.ts +2 -2
  129. package/dist/table/index.js +2 -2
  130. package/dist/table/table.d.ts +211 -3
  131. package/dist/table/table.js +473 -93
  132. package/dist/table/table.js.map +1 -1
  133. package/dist/tabs/tabs.d.ts +4 -2
  134. package/dist/tabs/tabs.js +7 -5
  135. package/dist/tabs/tabs.js.map +1 -1
  136. package/dist/tag-input/tag-input.js +1 -1
  137. package/dist/text-shimmer/text-shimmer.d.ts +18 -2
  138. package/dist/text-shimmer/text-shimmer.js +5 -2
  139. package/dist/text-shimmer/text-shimmer.js.map +1 -1
  140. package/dist/textarea/textarea.d.ts +7 -0
  141. package/dist/textarea/textarea.js +4 -2
  142. package/dist/textarea/textarea.js.map +1 -1
  143. package/dist/toast/toast.d.ts +2 -2
  144. package/dist/toggle-button/index.d.ts +2 -0
  145. package/dist/toggle-button/index.js +2 -0
  146. package/dist/toggle-button/toggle-button.d.ts +93 -0
  147. package/dist/toggle-button/toggle-button.js +199 -0
  148. package/dist/toggle-button/toggle-button.js.map +1 -0
  149. package/package.json +19 -3
@@ -1 +1 @@
1
- {"version":3,"file":"line-chart.js","names":[],"sources":["../../src/line-chart/line-chart.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type PointerEvent,\n} from \"react\";\n\nimport { cn } from \"../lib/cn.js\";\nimport { mergeRefs } from \"../lib/merge-refs.js\";\nimport { prefersReducedMotion, useIsomorphicLayoutEffect } from \"../lib/motion.js\";\nimport { SMOOTH, SNAPPY, tween } from \"../lib/spring-tween.js\";\n\n/**\n * LineChart: one or more measures over time, when the shape of the trend\n * matters more than any single value.\n *\n * The lines draw left to right the first time the chart is seen. New data\n * morphs every line from the shape on screen, and the value axis slides to its\n * new range while gridlines fade in and out. Hiding a series flattens it into\n * the baseline as it fades and the rest rescale. Hover, drag or the arrow keys\n * scrub: a crosshair glides between points with a dot on each line and a\n * tooltip that follows on its own spring and flips before it leaves the plot.\n * `loading` keeps the current lines on screen, dimmed and breathing.\n *\n * Plain SVG and CSS; one small spring tween drives the shapes, the scale and\n * the crosshair. A visually hidden table carries every value for assistive\n * technology, and the plot itself is a slider.\n */\nexport interface LineChartSeries {\n /** Stable identity. A series keeps its line across data changes, so switching ranges morphs it. */\n key: string;\n /** Name in the legend, the tooltip and the data table. */\n label: string;\n /** Any CSS colour. Defaults to chart-1 for the first series, then quieter neutral steps. */\n color?: string;\n /** A dashed stroke, for a previous period or a target. */\n dashed?: boolean;\n /** A faint fill under the line. Defaults to true for the first series. */\n area?: boolean;\n}\n\nexport interface LineChartDatum {\n /** Stable identity, such as an ISO date. */\n key: string;\n /** Full label for the tooltip and screen readers, such as \"Tue, Sep 15\". */\n label: string;\n /** Short label on the x axis. Leave it out to keep the axis quiet at that point. */\n axisLabel?: string;\n /**\n * One value per series key. A missing value (`undefined` or `null`) counts as\n * zero, unless the chart's `missing` is `\"gap\"`.\n */\n values: Record<string, number | null | undefined>;\n}\n\n/**\n * A reference line: a horizontal line at a value (a target, a threshold), or a\n * vertical line at one datum (today, a launch). Drawn dashed and quiet, behind\n * the series, with its label at the line's end.\n */\nexport type LineChartReference = {\n /** Stable identity. */\n key: string;\n /** Short text beside the line, such as \"Target\" or \"Today\". Also read to screen readers. */\n label: string;\n} & (\n | {\n /**\n * A value on the value axis: a horizontal line. The scale grows to keep it\n * in view, even when every value is missing. A value that is not finite\n * draws nothing. Read with `formatValue` (given the chart's first series)\n * and `unit`, like the series.\n */\n value: number;\n at?: never;\n }\n | {\n /** The `key` of a datum: a vertical line at that point. A key not in `data` draws nothing. */\n at: string;\n value?: never;\n }\n);\n\nexport interface LineChartProps {\n data: LineChartDatum[];\n series: LineChartSeries[];\n /** What is measured, such as \"Signups\". Names the chart for assistive technology. */\n label: string;\n /** Unit after each value in the tooltip, such as \"ms\". */\n unit?: string;\n /** Plot height in pixels. The width follows the container. @default 220 */\n height?: number;\n /** Formats values in the tooltip and data table. */\n formatValue?: (value: number, series: LineChartSeries) => string;\n /** Formats the value axis. Defaults to a compact number, such as 1.2K. */\n formatTick?: (value: number) => string;\n /** Controlled hidden series keys. */\n hiddenSeries?: string[];\n defaultHiddenSeries?: string[];\n onHiddenSeriesChange?: (hidden: string[]) => void;\n /** Called as the crosshair moves, and with null when it leaves. */\n onActiveChange?: (index: number | null, datum: LineChartDatum | null) => void;\n /** Keeps the current lines on screen, dimmed, while the next range loads. */\n loading?: boolean;\n /** Shown when there are no points. @default \"No data for this range\" */\n emptyLabel?: string;\n /** Series toggles above the plot. Shown by default when there is more than one series. */\n legend?: boolean;\n /** Header of the first column in the data table read by screen readers. @default \"Date\" */\n categoryLabel?: string;\n /** Smooth monotone curves that never swing past the data, or straight segments. @default \"smooth\" */\n curve?: \"smooth\" | \"linear\";\n /**\n * How a missing value (`undefined`, `null` or not a finite number) is drawn.\n * `\"zero\"` counts it as zero, as before. `\"gap\"` breaks the line (and its\n * area) there, leaves it out of the scale, hides the crosshair dot on it and\n * reads it as `missingLabel` in the tooltip and the data table. A point with\n * missing neighbours on both sides is drawn as a dot.\n * @default \"zero\"\n */\n missing?: \"zero\" | \"gap\";\n /** Read in place of a missing value when `missing` is `\"gap\"`. @default \"No data\" */\n missingLabel?: string;\n /** Reference lines: targets at a value, or markers such as \"today\" at a datum. */\n references?: LineChartReference[];\n /** Extra classes for the root. Merged last. */\n className?: string;\n}\n\ntype Point = [x: number, value: number];\n/** Open intervals of x (0 to 1) where a line is not drawn: the gaps around missing values. */\ntype Breaks = [from: number, to: number][];\ntype Track = { shape: Point[]; breaks: Breaks; presence: number; stop: (() => void) | null };\n\n/** Room above the top gridline, and the gap between the crosshair and its tooltip. */\nconst TOP = 12;\nconst GAP = 14;\n/** The first draw: 480ms x 1.75, slow at both ends. */\nexport const LINE_CHART_DRAW_MS = 840;\nconst PALETTE = [\n \"var(--color-chart-1)\",\n \"color-mix(in oklab, var(--color-foreground) 46%, var(--color-surface))\",\n \"color-mix(in oklab, var(--color-foreground) 26%, var(--color-surface))\",\n];\nconst GROUPED = new Intl.NumberFormat(\"en-US\", { maximumFractionDigits: 1 });\nconst COMPACT = new Intl.NumberFormat(\"en-US\", { notation: \"compact\", maximumFractionDigits: 1 });\nconst GRID = Array.from({ length: 241 }, (_, index) => index / 240);\nconst clamp = (value: number, low: number, high: number) => Math.min(high, Math.max(low, value));\nconst colorOf = (line: LineChartSeries, index: number) =>\n line.color ?? PALETTE[Math.min(index, PALETTE.length - 1)]!;\nconst clean = (value: number) => Number(value.toPrecision(12));\n\n/** Clean gridlines: the smallest step of 1, 2, 2.5 or 5 that covers the data in four rows or fewer, from zero unless the data dips below it. */\nfunction niceScale(low: number, high: number) {\n const lo = Math.min(0, low);\n const hi = Math.max(high, lo + 1);\n const magnitude = 10 ** Math.floor(Math.log10((hi - lo) / 4));\n for (const factor of [1, 2, 2.5, 5, 10]) {\n const step = factor * magnitude;\n const bottom = Math.floor(lo / step) * step;\n const top = Math.ceil(hi / step) * step;\n if ((top - bottom) / step <= 4 + 1e-9) {\n const ticks: number[] = [];\n for (let value = bottom; value <= top + step / 2; value += step) ticks.push(clean(value));\n return { min: clean(bottom), max: clean(top), ticks };\n }\n }\n return { min: lo, max: hi, ticks: [lo, hi] };\n}\n\n/** The line through every value, sampled densely on x from 0 to 1 in data units. Monotone tangents keep a smooth curve from swinging past the data. */\nfunction curveFor(values: number[], smooth: boolean): Point[] {\n if (values.length === 0) return [];\n if (values.length === 1) return [[0, values[0]!], [1, values[0]!]];\n const last = values.length - 1;\n const step = 1 / last;\n if (!smooth) return values.map((value, index) => [index * step, value]);\n const slopes = values.slice(1).map((value, index) => (value - values[index]!) / step);\n const tangents = values.map((_, index) =>\n index === 0 || index === last\n ? 0\n : (Math.sign(slopes[index - 1]!) + Math.sign(slopes[index]!)) *\n Math.min(\n Math.abs(slopes[index - 1]!),\n Math.abs(slopes[index]!),\n Math.abs(slopes[index - 1]! + slopes[index]!) / 4,\n ) || 0,\n );\n if (last > 1) {\n tangents[0] = (3 * slopes[0]! - tangents[1]!) / 2;\n tangents[last] = (3 * slopes[last - 1]! - tangents[last - 1]!) / 2;\n } else {\n tangents[0] = slopes[0]!;\n tangents[1] = slopes[0]!;\n }\n const samples = Math.max(1, Math.min(16, Math.round(192 / last)));\n const points: Point[] = [];\n for (let index = 0; index < last; index++) {\n const low = Math.min(values[index]!, values[index + 1]!);\n const high = Math.max(values[index]!, values[index + 1]!);\n for (let sample = 0; sample < samples; sample++) {\n const t = sample / samples;\n const t2 = t * t;\n const t3 = t2 * t;\n const value =\n (2 * t3 - 3 * t2 + 1) * values[index]! +\n (t3 - 2 * t2 + t) * step * tangents[index]! +\n (3 * t2 - 2 * t3) * values[index + 1]! +\n (t3 - t2) * step * tangents[index + 1]!;\n points.push([(index + t) * step, clamp(value, low, high)]);\n }\n }\n points.push([1, values[last]!]);\n return points;\n}\n\n/** Fills each missing value straight between its present neighbours (or with the nearest one at the ends), so a gapped line still has a shape to morph. */\nfunction fillGaps(values: (number | null)[]): number[] {\n const present = values.flatMap((value, index) => (value === null ? [] : [index]));\n if (!present.length) return values.map(() => 0);\n return values.map((value, index) => {\n if (value !== null) return value;\n const after = present.find((at) => at > index);\n const before = [...present].reverse().find((at) => at < index);\n if (before === undefined) return values[after!]!;\n if (after === undefined) return values[before]!;\n return values[before]! + ((values[after]! - values[before]!) * (index - before)) / (after - before);\n });\n}\n\n/** Where a line with missing values is not drawn: before its first value, after its last, and between two values with missing ones between them. */\nfunction breaksFor(values: (number | null)[]): Breaks {\n const present = values.flatMap((value, index) => (value === null ? [] : [index]));\n if (!present.length) return values.length ? [[-Infinity, Infinity]] : [];\n const last = values.length - 1;\n if (last === 0) return [];\n const breaks: Breaks = [];\n if (present[0]! > 0) breaks.push([-Infinity, present[0]! / last]);\n for (let at = 1; at < present.length; at++) {\n if (present[at]! - present[at - 1]! > 1) breaks.push([present[at - 1]! / last, present[at]! / last]);\n }\n if (present[present.length - 1]! < last) breaks.push([present[present.length - 1]! / last, Infinity]);\n return breaks;\n}\n\nconst EDGE = 1e-9;\n/** Radius of a lone point's dot, inside its 2px stroke. */\nconst DOT = 1.5;\nconst inBreak = (breaks: Breaks, x: number) => breaks.some(([from, to]) => x > from + EDGE && x < to - EDGE);\n\n/** The drawn runs of a line, split at its gaps. A run of one point is a dot: a small closed circle the stroke fills out to about 5px. */\nfunction pathsFor(shape: Point[], breaks: Breaks, toX: (x: number) => number, toY: (value: number) => number, bottom: number) {\n const runs: string[][] = [];\n let run: string[] | null = null;\n for (const [x, value] of shape) {\n if (breaks.length && inBreak(breaks, x)) {\n run = null;\n continue;\n }\n if (!run) runs.push((run = []));\n run.push(`${toX(x).toFixed(1)},${toY(value).toFixed(1)}`);\n }\n const line = runs\n .map((points) => {\n if (points.length > 1) return `M${points.join(\"L\")}`;\n const [x, y] = points[0]!.split(\",\").map(Number);\n return `M${(x! - DOT).toFixed(1)},${y!.toFixed(1)}a${DOT},${DOT} 0 1,0 ${DOT * 2},0a${DOT},${DOT} 0 1,0 ${-DOT * 2},0`;\n })\n .join(\"\");\n const area = runs\n .map((points) => {\n const first = points[0]!.split(\",\")[0];\n const lastX = points[points.length - 1]!.split(\",\")[0];\n return `M${points.join(\"L\")}L${lastX},${bottom}L${first},${bottom}Z`;\n })\n .join(\"\");\n return { line, area };\n}\n\nconst isFiniteValue = (reference: LineChartReference): reference is LineChartReference & { value: number } =>\n typeof reference.value === \"number\" && Number.isFinite(reference.value);\n\n/** Value of a sampled line at x, straight between samples. */\nfunction valueAt(shape: Point[], x: number) {\n if (!shape.length) return 0;\n let low = 0;\n let high = shape.length - 1;\n if (x <= shape[low]![0]) return shape[low]![1];\n if (x >= shape[high]![0]) return shape[high]![1];\n while (high - low > 1) {\n const middle = (low + high) >> 1;\n if (shape[middle]![0] < x) low = middle;\n else high = middle;\n }\n const [x0, y0] = shape[low]!;\n const [x1, y1] = shape[high]!;\n return x1 === x0 ? y1 : y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);\n}\n\n/** Axis labels that fit: at most one per 76 pixels, counted back from the latest so the newest always shows. */\nfunction axisPicks(data: LineChartDatum[], width: number) {\n const labeled = data.flatMap((item, index) => (item.axisLabel ? [index] : []));\n if (!width || !labeled.length) return [];\n const room = Math.max(2, Math.floor(width / 76));\n const stride = Math.ceil(labeled.length / room);\n return labeled\n .reverse()\n .filter((_, rank) => rank % stride === 0)\n .reverse();\n}\n\nexport const LineChart = forwardRef<HTMLElement, LineChartProps>(function LineChart(\n {\n data,\n series,\n label,\n unit = \"\",\n height = 220,\n formatValue,\n formatTick = (value) => COMPACT.format(value),\n hiddenSeries,\n defaultHiddenSeries,\n onHiddenSeriesChange,\n onActiveChange,\n loading = false,\n emptyLabel = \"No data for this range\",\n legend,\n categoryLabel = \"Date\",\n curve = \"smooth\",\n missing = \"zero\",\n missingLabel = \"No data\",\n references,\n className,\n },\n ref,\n) {\n const figure = useRef<HTMLElement | null>(null);\n const refs = useMemo(() => mergeRefs(ref, figure), [ref]);\n const plot = useRef<HTMLDivElement>(null);\n const svg = useRef<SVGSVGElement>(null);\n const tip = useRef<HTMLDivElement>(null);\n const gutter = useRef<HTMLDivElement>(null);\n const uid = `line${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n const last = data.length - 1;\n const empty = data.length === 0;\n\n const [ownHidden, setOwnHidden] = useState<string[]>(defaultHiddenSeries ?? []);\n const hidden = hiddenSeries ?? ownHidden;\n const toggle = (key: string) => {\n const next = hidden.includes(key) ? hidden.filter((item) => item !== key) : [...hidden, key];\n if (hiddenSeries === undefined) setOwnHidden(next);\n onHiddenSeriesChange?.(next);\n };\n const visible = series.filter((line) => !hidden.includes(line.key));\n const showLegend = legend ?? series.length > 1;\n\n // A missing value is zero, as it always was, unless gaps are asked for.\n const gaps = missing === \"gap\";\n const read = (item: LineChartDatum, key: string): number | null => {\n const value = item.values[key];\n if (!gaps) return value ?? 0;\n return typeof value === \"number\" && Number.isFinite(value) ? value : null;\n };\n\n // Each series becomes a dense curve in data units; the scale fits only the series on show.\n const signature = `${curve}|${missing}|${series.map((line) => line.key).join(\",\")}|${data\n .map((item) => `${item.key}:${series.map((line) => read(item, line.key)).join(\",\")}`)\n .join(\";\")}`;\n const targets = useMemo(\n () =>\n new Map(\n series.map((line) => {\n const values = data.map((item) => read(item, line.key));\n return [\n line.key,\n { shape: curveFor(fillGaps(values), curve === \"smooth\"), breaks: breaksFor(values) },\n ];\n }),\n ),\n // The signature captures everything the curves read.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [signature],\n );\n let low = Infinity;\n let high = -Infinity;\n for (const line of visible) {\n for (const item of data) {\n const value = read(item, line.key);\n if (value === null) continue;\n low = Math.min(low, value);\n high = Math.max(high, value);\n }\n }\n // A target keeps itself in view, even with every value missing, so it never sits on the fallback scale.\n for (const reference of references ?? []) {\n if (!isFiniteValue(reference)) continue;\n low = Math.min(low, reference.value);\n high = Math.max(high, reference.value);\n }\n const range = Number.isFinite(low) ? niceScale(low, high) : null;\n const [steady, setSteady] = useState(() => range ?? niceScale(0, 100));\n if (range && (range.min !== steady.min || range.max !== steady.max)) setSteady(range);\n\n // Scrubbing: a new range lets go of the crosshair.\n const [active, setActive] = useState<number | null>(null);\n const [seen, setSeen] = useState(signature);\n if (seen !== signature) {\n setSeen(signature);\n setActive(null);\n }\n const index = active === null || empty ? null : Math.min(active, last);\n const scrubbing = index !== null;\n\n const width = useRef(0);\n const [plotWidth, setPlotWidth] = useState(0);\n const [drawn, setDrawn] = useState(false);\n const tracks = useRef(new Map<string, Track>());\n const scale = useRef({ min: steady.min, max: steady.max });\n const cursor = useRef(1);\n // `undefined`: nothing to draw (an unknown datum, or a value that is not finite).\n const referenceAt = (reference: LineChartReference) => {\n if (typeof reference.value === \"number\") return isFiniteValue(reference) ? null : undefined;\n const at = data.findIndex((item) => item.key === reference.at);\n return at < 0 ? undefined : last > 0 ? at / last : 0.5;\n };\n const drawnReferences = (references ?? []).filter((reference) => referenceAt(reference) !== undefined);\n const live = useRef({ series, hidden });\n useIsomorphicLayoutEffect(() => {\n live.current = { series, hidden };\n });\n\n /** One writer for every drawn attribute: morphs, toggles, the scale, the crosshair and the size all repaint through here. */\n const paint = useCallback(() => {\n const w = width.current;\n const root = svg.current;\n if (!w || !root) return;\n const lo = scale.current.min;\n const span = scale.current.max - lo || 1;\n const toY = (value: number) => TOP + (1 - (value - lo) / span) * (height - TOP);\n const at = cursor.current;\n const dotYs: number[] = [];\n for (const line of live.current.series) {\n const track = tracks.current.get(line.key);\n if (!track) continue;\n const p = track.presence;\n const y = (value: number) => toY(lo + (value - lo) * p);\n const group = root.querySelector<SVGGElement>(`[data-series=\"${CSS.escape(line.key)}\"]`);\n if (track.breaks.length) {\n const paths = pathsFor(track.shape, track.breaks, (x) => x * w, y, height);\n group?.querySelector(\"[data-part=line]\")?.setAttribute(\"d\", paths.line);\n group?.querySelector(\"[data-part=area]\")?.setAttribute(\"d\", paths.area);\n } else {\n const path = track.shape.length\n ? `M${track.shape.map(([x, value]) => `${(x * w).toFixed(1)},${y(value).toFixed(1)}`).join(\"L\")}`\n : \"\";\n group?.querySelector(\"[data-part=line]\")?.setAttribute(\"d\", path);\n group?.querySelector(\"[data-part=area]\")?.setAttribute(\"d\", path ? `${path}L${w},${height}L0,${height}Z` : \"\");\n }\n if (group) group.style.opacity = String(p);\n const dot = root.querySelector<SVGCircleElement>(`[data-dot=\"${CSS.escape(line.key)}\"]`);\n if (dot && track.shape.length) {\n const gap = inBreak(track.breaks, at);\n const cy = y(valueAt(track.shape, at));\n dot.setAttribute(\"cx\", (at * w).toFixed(1));\n dot.setAttribute(\"cy\", cy.toFixed(1));\n // No value here: no dot, and the tooltip does not centre on one.\n if (gap) dot.setAttribute(\"data-gap\", \"\");\n else dot.removeAttribute(\"data-gap\");\n if (p > 0.5 && !gap) dotYs.push(cy);\n }\n }\n // Gridlines and tick labels ride the scale.\n for (const node of root.querySelectorAll<SVGLineElement>(\"[data-grid]\")) {\n const yy = String(Math.round(toY(Number(node.dataset.grid))) + 0.5);\n node.setAttribute(\"y1\", yy);\n node.setAttribute(\"y2\", yy);\n }\n for (const node of gutter.current?.querySelectorAll<HTMLElement>(\"[data-tick]\") ?? []) {\n node.style.translate = `0 ${Math.round(toY(Number(node.dataset.tick)))}px`;\n }\n // Reference lines: a value rides the scale like a gridline; a datum sits at its x.\n for (const node of root.querySelectorAll<SVGLineElement>(\"[data-reference-value]\")) {\n const yy = String(Math.round(toY(Number(node.dataset.referenceValue))) + 0.5);\n node.setAttribute(\"y1\", yy);\n node.setAttribute(\"y2\", yy);\n }\n for (const node of root.querySelectorAll<SVGLineElement>(\"[data-reference-at]\")) {\n const xx = String(Math.round(Number(node.dataset.referenceAt) * w) + 0.5);\n node.setAttribute(\"x1\", xx);\n node.setAttribute(\"x2\", xx);\n }\n for (const node of plot.current?.querySelectorAll<HTMLElement>(\"[data-reference-label]\") ?? []) {\n const { referenceValue, referenceAt } = node.dataset;\n node.style.translate =\n referenceValue !== undefined\n ? `0 ${Math.round(toY(Number(referenceValue)))}px`\n : `${Math.round(Number(referenceAt) * w)}px 0`;\n }\n const cx = Math.round(at * w) + 0.5;\n const cross = root.querySelector(\"[data-part=crosshair]\");\n cross?.setAttribute(\"x1\", String(cx));\n cross?.setAttribute(\"x2\", String(cx));\n // The tooltip sits beside the crosshair, flips sides before it would leave the plot, and centres on the points it describes.\n const bubble = tip.current;\n if (bubble) {\n const tw = bubble.offsetWidth;\n const th = bubble.offsetHeight;\n let x = cx + GAP;\n if (x + tw > w) x = cx - GAP - tw;\n const middle = dotYs.length ? dotYs.reduce((sum, value) => sum + value, 0) / dotYs.length : height / 2;\n bubble.style.translate = `${clamp(x, 0, Math.max(0, w - tw))}px ${clamp(middle - th / 2, 0, Math.max(0, height - th))}px`;\n }\n }, [height]);\n\n // The plot draws in its own pixels: measure the width and follow resizes.\n useIsomorphicLayoutEffect(() => {\n const node = plot.current;\n if (!node) return;\n const read = () => {\n width.current = node.clientWidth;\n setPlotWidth(node.clientWidth);\n paint();\n };\n read();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(read);\n observer.observe(node);\n return () => observer.disconnect();\n }, [paint]);\n useIsomorphicLayoutEffect(paint);\n\n // New data morphs every line from the shape on screen, sampled on shared x positions so a range that gains or loses points still flows.\n useEffect(() => {\n const moves: { track: Track; xs: number[]; from: number[]; to: number[]; target: Point[] }[] = [];\n for (const [key, { shape: target, breaks }] of targets) {\n const track = tracks.current.get(key);\n if (!track) {\n tracks.current.set(key, {\n shape: target,\n breaks,\n presence: live.current.hidden.includes(key) ? 0 : 1,\n stop: null,\n });\n continue;\n }\n // The gaps move to the new data at once; the line morphs between them.\n track.breaks = breaks;\n if (!track.shape.length || !target.length) {\n track.shape = target;\n continue;\n }\n const xs = [...new Set([...GRID, ...target.map(([x]) => x)])].sort((a, b) => a - b);\n moves.push({ track, xs, from: xs.map((x) => valueAt(track.shape, x)), to: xs.map((x) => valueAt(target, x)), target });\n }\n if (!moves.length) {\n paint();\n return;\n }\n return tween(\n SMOOTH,\n (p) => {\n for (const move of moves) {\n move.track.shape = move.xs.map((x, at): Point => [x, move.from[at]! + (move.to[at]! - move.from[at]!) * p]);\n }\n paint();\n },\n () => {\n for (const move of moves) move.track.shape = move.target;\n paint();\n },\n );\n }, [paint, targets]);\n\n // A hidden series flattens into the baseline as it fades; the ones that stay rescale around it.\n const hiddenKey = hidden.join(\"|\");\n useEffect(() => {\n for (const [key, track] of tracks.current) {\n const to = hidden.includes(key) ? 0 : 1;\n if (track.presence === to) continue;\n track.stop?.();\n const from = track.presence;\n track.stop = tween(SMOOTH, (p) => {\n track.presence = from + (to - from) * p;\n paint();\n });\n }\n paint();\n // hiddenKey stands for `hidden`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [hiddenKey, paint]);\n\n // The value axis slides to its new range on the smooth spring.\n useEffect(() => {\n const from = { ...scale.current };\n if (from.min === steady.min && from.max === steady.max) return;\n return tween(SMOOTH, (p) => {\n scale.current = { min: from.min + (steady.min - from.min) * p, max: from.max + (steady.max - from.max) * p };\n paint();\n });\n }, [paint, steady]);\n\n // The lines draw left to right the first time the chart is seen with data.\n useEffect(() => {\n if (empty || drawn) return;\n const node = figure.current;\n if (!node || prefersReducedMotion() || typeof IntersectionObserver === \"undefined\") {\n setDrawn(true);\n return;\n }\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (!entry?.isIntersecting) return;\n observer.disconnect();\n setDrawn(true);\n },\n { threshold: 0.3 },\n );\n observer.observe(node);\n return () => observer.disconnect();\n }, [drawn, empty]);\n\n // The crosshair appears on the first scrubbed point and glides between the ones after it.\n const wasScrubbing = useRef(false);\n useEffect(() => {\n if (index === null) {\n wasScrubbing.current = false;\n return;\n }\n const to = last > 0 ? index / last : 0.5;\n const from = cursor.current;\n if (!wasScrubbing.current) {\n wasScrubbing.current = true;\n cursor.current = to;\n paint();\n return;\n }\n return tween(SNAPPY, (p) => {\n cursor.current = from + (to - from) * p;\n paint();\n });\n }, [index, last, paint]);\n\n const onActive = useRef(onActiveChange);\n useIsomorphicLayoutEffect(() => {\n onActive.current = onActiveChange;\n });\n useEffect(() => {\n onActive.current?.(index, index === null ? null : (data[index] ?? null));\n // Report only when the scrubbed point changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [index]);\n\n const pointAt = (clientX: number) => {\n const rect = plot.current?.getBoundingClientRect();\n if (!rect?.width || last < 1) return Math.max(0, last);\n return clamp(Math.round(((clientX - rect.left) / rect.width) * last), 0, last);\n };\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Escape\" && scrubbing) {\n event.preventDefault();\n setActive(null);\n return;\n }\n const from = index ?? last + 1;\n const page = Math.max(1, Math.round(data.length / 6));\n const next = (\n {\n ArrowLeft: from - 1,\n ArrowDown: from - 1,\n ArrowRight: index === null ? last : from + 1,\n ArrowUp: index === null ? last : from + 1,\n PageDown: from - page,\n PageUp: from + page,\n Home: 0,\n End: last,\n } as Record<string, number>\n )[event.key];\n if (next === undefined || empty) return;\n event.preventDefault();\n setActive(clamp(next, 0, last));\n };\n const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if (empty) return;\n if (event.pointerType !== \"mouse\") event.currentTarget.setPointerCapture?.(event.pointerId);\n setActive(pointAt(event.clientX));\n };\n const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n if (!empty && (event.pointerType === \"mouse\" || event.buttons)) setActive(pointAt(event.clientX));\n };\n\n const formatNumber = (value: number, line: LineChartSeries) =>\n `${formatValue ? formatValue(value, line) : GROUPED.format(value)}${unit ? ` ${unit}` : \"\"}`;\n const format = (value: number | null, line: LineChartSeries) =>\n value === null ? missingLabel : formatNumber(value, line);\n // A reference belongs to no series; `formatValue` gets the first one, so a chart of one unit reads the same.\n const formatReference = (value: number) =>\n series[0] ? formatNumber(value, series[0]) : `${GROUPED.format(value)}${unit ? ` ${unit}` : \"\"}`;\n const reading = index === null ? null : data[index];\n const shown = reading ?? data[last];\n const valueText = reading\n ? `${reading.label}: ${visible.map((line) => `${line.label} ${format(read(reading, line.key), line)}`).join(\", \")}`\n : empty\n ? emptyLabel\n : `${visible.length} of ${series.length} series shown`;\n const summary = empty\n ? `${label}. ${emptyLabel}.`\n : `${label}, ${data[0]!.label} to ${data[last]!.label}. ${visible\n .map((line) => `${line.label}, latest ${format(read(data[last]!, line.key), line)}`)\n .join(\". \")}.${drawnReferences\n .map((reference) =>\n typeof reference.value === \"number\"\n ? ` ${reference.label}: ${formatReference(reference.value)}.`\n : ` ${reference.label}: ${data.find((item) => item.key === reference.at)!.label}.`,\n )\n .join(\"\")}`;\n const picks = axisPicks(data, plotWidth);\n const allHidden = !empty && visible.length === 0;\n\n return (\n <figure\n ref={refs}\n data-slot=\"line-chart\"\n aria-label={label}\n aria-busy={loading || undefined}\n className={cn(\"m-0 grid min-w-0 gap-4 box-border font-sans text-foreground\", className)}\n >\n {showLegend ? (\n <div role=\"group\" aria-label={`${label} series`} className=\"-mx-2 flex min-w-0 flex-wrap gap-x-1 gap-y-0.5\">\n {series.map((line, at) => (\n <button\n key={line.key}\n type=\"button\"\n data-slot=\"line-chart-toggle\"\n aria-pressed={!hidden.includes(line.key)}\n onClick={() => toggle(line.key)}\n style={{ \"--series\": colorOf(line, at) } as CSSProperties}\n className=\"chart-legend-toggle\"\n >\n <span aria-hidden=\"true\" data-dashed={line.dashed || undefined} className=\"chart-swatch\" />\n <span className=\"chart-toggle-label\">{line.label}</span>\n </button>\n ))}\n </div>\n ) : null}\n <div\n data-slot=\"line-chart-chart\"\n data-scrubbing={scrubbing || undefined}\n data-loading={loading || undefined}\n data-drawn={drawn || undefined}\n className=\"line-chart-frame\"\n >\n <div\n ref={plot}\n data-slot=\"line-chart-plot\"\n role=\"slider\"\n tabIndex={empty ? -1 : 0}\n aria-label={`${label}, explore by ${categoryLabel.toLowerCase()}`}\n aria-orientation=\"horizontal\"\n aria-valuemin={1}\n aria-valuemax={Math.max(1, data.length)}\n aria-valuenow={(index ?? last) + 1}\n aria-valuetext={valueText}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={(event) => {\n if (event.pointerType !== \"mouse\") setActive(null);\n }}\n onPointerCancel={() => setActive(null)}\n onPointerLeave={(event) => {\n if (event.pointerType === \"mouse\") setActive(null);\n }}\n onKeyDown={onKeyDown}\n onBlur={() => setActive(null)}\n onFocus={(event) => {\n if (event.currentTarget.matches(\":focus-visible\") && !empty) setActive((current) => current ?? last);\n }}\n className=\"line-chart-plot\"\n style={{ height }}\n >\n <svg ref={svg} width=\"100%\" height={height} aria-hidden=\"true\" focusable=\"false\" className=\"block overflow-visible\">\n <defs>\n <clipPath id={`${uid}-draw`} clipPathUnits=\"userSpaceOnUse\">\n <rect className=\"line-chart-reveal\" x={-8} y={-16} height={height + 32} style={{ width: drawn ? plotWidth + 16 : 0 }} />\n </clipPath>\n </defs>\n {steady.ticks.slice(1).map((value) => (\n <line key={value} data-grid={value} className=\"line-chart-grid\" x1={0} x2=\"100%\" />\n ))}\n <line className=\"line-chart-baseline\" x1={0} x2=\"100%\" y1={height - 0.5} y2={height - 0.5} />\n {drawnReferences.map((reference) =>\n typeof reference.value === \"number\" ? (\n <line\n key={reference.key}\n data-reference={reference.key}\n data-reference-value={reference.value}\n className=\"line-chart-reference\"\n x1={0}\n x2=\"100%\"\n />\n ) : (\n <line\n key={reference.key}\n data-reference={reference.key}\n data-reference-at={referenceAt(reference)!}\n className=\"line-chart-reference\"\n y1={TOP - 4}\n y2={height}\n />\n ),\n )}\n <line data-part=\"crosshair\" className=\"line-chart-crosshair\" y1={TOP - 4} y2={height} />\n <g className=\"line-chart-series\" clipPath={`url(#${uid}-draw)`}>\n {series.map((line, at) => (\n <g key={line.key} data-series={line.key} style={{ \"--series\": colorOf(line, at) } as CSSProperties}>\n {(line.area ?? at === 0) ? <path data-part=\"area\" className=\"line-chart-area\" /> : null}\n <path data-part=\"line\" data-dashed={line.dashed || undefined} className=\"line-chart-line\" />\n </g>\n ))}\n </g>\n {series.map((line, at) => (\n <circle\n key={line.key}\n data-dot={line.key}\n data-hidden={hidden.includes(line.key) || undefined}\n r={4}\n className=\"line-chart-dot\"\n style={{ \"--series\": colorOf(line, at) } as CSSProperties}\n />\n ))}\n </svg>\n {drawnReferences.map((reference) => (\n <span\n key={reference.key}\n aria-hidden=\"true\"\n data-slot=\"line-chart-reference-label\"\n data-reference-label={reference.key}\n data-reference-value={typeof reference.value === \"number\" ? reference.value : undefined}\n data-reference-at={typeof reference.value === \"number\" ? undefined : referenceAt(reference)!}\n data-axis={typeof reference.value === \"number\" ? \"value\" : \"category\"}\n className=\"line-chart-reference-label\"\n >\n {reference.label}\n </span>\n ))}\n <div ref={tip} aria-hidden=\"true\" data-slot=\"line-chart-tooltip\" className=\"line-chart-tooltip\">\n <p className=\"m-0 mb-0.5 whitespace-nowrap text-xs tabular-nums text-text-secondary\">{shown?.label ?? \"\"}</p>\n {visible.map((line) => (\n <p\n key={line.key}\n className=\"m-0 flex min-w-0 items-center gap-2 text-sm\"\n style={{ \"--series\": colorOf(line, series.indexOf(line)) } as CSSProperties}\n >\n <span data-dashed={line.dashed || undefined} className=\"chart-tip-swatch\" />\n <span className=\"min-w-0 flex-1 truncate text-text-secondary\">{line.label}</span>\n <span className=\"ms-2 flex-none whitespace-nowrap font-medium tabular-nums text-foreground\">\n {shown ? format(read(shown, line.key), line) : format(0, line)}\n </span>\n </p>\n ))}\n </div>\n {(empty || allHidden) && !loading ? (\n <p className=\"absolute inset-0 m-0 grid place-items-center text-sm text-muted-foreground pointer-events-none motion-safe:animate-fade-in\">\n {empty ? emptyLabel : \"Choose a series to show\"}\n </p>\n ) : null}\n {loading && empty ? <span aria-hidden=\"true\" className=\"chart-skeleton\" /> : null}\n </div>\n <div ref={gutter} aria-hidden=\"true\" className=\"relative min-w-0 [grid-area:1/2]\">\n {steady.ticks.map((value) => (\n <span key={value} data-tick={value} className=\"line-chart-tick motion-safe:animate-fade-in\">\n <span className=\"block -translate-y-1/2 text-xs leading-none tabular-nums text-muted-foreground\">\n {formatTick(value)}\n </span>\n </span>\n ))}\n </div>\n <div aria-hidden=\"true\" className=\"relative min-w-0 [grid-area:2/1]\">\n {picks.map((at) => {\n const share = last > 0 ? at / last : 0.5;\n return (\n <span\n key={`${data[at]!.key}:${data[at]!.axisLabel}`}\n className=\"absolute top-2 whitespace-nowrap text-xs leading-none tabular-nums text-muted-foreground motion-safe:animate-fade-in\"\n style={{ left: `${share * 100}%`, translate: `${-share * 100}% 0` }}\n >\n {data[at]!.axisLabel}\n </span>\n );\n })}\n </div>\n </div>\n <p className=\"sr-only\">{summary}</p>\n {empty ? null : (\n <div className=\"sr-only\">\n <table>\n <caption>{label}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{categoryLabel}</th>\n {series.map((line) => (\n <th key={line.key} scope=\"col\">\n {line.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.map((item) => (\n <tr key={item.key}>\n <th scope=\"row\">{item.label}</th>\n {series.map((line) => (\n <td key={line.key}>{format(read(item, line.key), line)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n <p className=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n {loading ? \"Loading\" : \"\"}\n </p>\n </figure>\n );\n});\n"],"mappings":";;;;;;;;;AA+IA,MAAM,MAAM;AACZ,MAAM,MAAM;;AAEZ,MAAa,qBAAqB;AAClC,MAAM,UAAU;CACd;CACA;CACA;AACF;AACA,MAAM,UAAU,IAAI,KAAK,aAAa,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAC3E,MAAM,UAAU,IAAI,KAAK,aAAa,SAAS;CAAE,UAAU;CAAW,uBAAuB;AAAE,CAAC;AAChG,MAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,IAAI,IAAI,GAAG,UAAU,QAAQ,GAAG;AAClE,MAAM,SAAS,OAAe,KAAa,SAAiB,KAAK,IAAI,MAAM,KAAK,IAAI,KAAK,KAAK,CAAC;AAC/F,MAAM,WAAW,MAAuB,UACtC,KAAK,SAAS,QAAQ,KAAK,IAAI,OAAO,QAAQ,SAAS,CAAC;AAC1D,MAAM,SAAS,UAAkB,OAAO,MAAM,YAAY,EAAE,CAAC;;AAG7D,SAAS,UAAU,KAAa,MAAc;CAC5C,MAAM,KAAK,KAAK,IAAI,GAAG,GAAG;CAC1B,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,CAAC;CAChC,MAAM,YAAY,MAAM,KAAK,MAAM,KAAK,OAAO,KAAK,MAAM,CAAC,CAAC;CAC5D,KAAK,MAAM,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AQ,OACP,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,qBAAC,SAAD,EAAA,UAAA;KACE,oBAAC,WAAD,EAAA,UAAU,MAAe,CAAA;KACzB,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD,EAAA,UAAA,CACE,oBAAC,MAAD;MAAI,OAAM;MAAO,UAAA;KAAkB,CAAA,GAClC,OAAO,KAAK,SACX,oBAAC,MAAD;MAAmB,OAAM;MACtB,UAAA,KAAK;KACJ,GAFK,KAAK,GAEV,CACL,CACC,EAAA,CAAA,EACC,CAAA;KACP,oBAAC,SAAD,EAAA,UACG,KAAK,KAAK,SACT,qBAAC,MAAD,EAAA,UAAA,CACE,oBAAC,MAAD;MAAI,OAAM;MAAO,UAAA,KAAK;KAAU,CAAA,GAC/B,OAAO,KAAK,SACX,oBAAC,MAAD,EAAA,UAAoB,OAAO,KAAK,MAAM,KAAK,GAAG,GAAG,IAAI,EAAM,GAAlD,KAAK,GAA6C,CAC5D,CACC,EAAA,GALK,KAAK,GAKV,CACL,EACI,CAAA;IACF,EAAA,CAAA;GACJ,CAAA;GAEP,oBAAC,KAAD;IAAG,WAAU;IAAU,aAAU;IAAS,eAAY;IACnD,UAAA,UAAU,YAAY;GACtB,CAAA;EACG;;AAEZ,CAAC"}
1
+ {"version":3,"file":"line-chart.js","names":[],"sources":["../../src/line-chart/line-chart.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type PointerEvent,\n type ReactNode,\n} from \"react\";\n\nimport { cn } from \"../lib/cn.js\";\nimport { mergeRefs } from \"../lib/merge-refs.js\";\nimport { prefersReducedMotion, useIsomorphicLayoutEffect } from \"../lib/motion.js\";\nimport { SMOOTH, SNAPPY, tween } from \"../lib/spring-tween.js\";\n\n/**\n * LineChart: one or more measures over time, when the shape of the trend\n * matters more than any single value.\n *\n * The lines draw left to right the first time the chart is seen. New data\n * morphs every line from the shape on screen, and the value axis slides to its\n * new range while gridlines fade in and out. Hiding a series flattens it into\n * the baseline as it fades and the rest rescale. Hover, drag or the arrow keys\n * scrub: a crosshair glides between points with a dot on each line and a\n * tooltip that follows on its own spring and flips before it leaves the plot.\n * `loading` keeps the current lines on screen, dimmed and breathing.\n *\n * Plain SVG and CSS; one small spring tween drives the shapes, the scale and\n * the crosshair. A visually hidden table carries every value for assistive\n * technology, and the plot itself is a slider.\n */\nexport interface LineChartSeries {\n /** Stable identity. A series keeps its line across data changes, so switching ranges morphs it. */\n key: string;\n /** Name in the legend, the tooltip and the data table. */\n label: string;\n /** Any CSS colour. Defaults to chart-1 for the first series, then quieter neutral steps. */\n color?: string;\n /** A dashed stroke, for a previous period or a target. */\n dashed?: boolean;\n /** A faint fill under the line. Defaults to true for the first series. */\n area?: boolean;\n /**\n * Prints each value above its point, read with `formatValue` (without `unit`).\n * A missing value (with `missing` `\"gap\"` or `\"connect\"`) has no label. For a\n * few points: labels on a dense line collide.\n * @default false\n */\n pointLabels?: boolean;\n /**\n * A label above the series' last point with a value. `true` prints that value\n * (read with `formatValue`, without `unit`); a string prints the text, such as\n * \"Heading for 1,800\", and is read in the chart's summary.\n */\n endLabel?: boolean | string;\n}\n\nexport interface LineChartDatum {\n /** Stable identity, such as an ISO date. */\n key: string;\n /** Full label for the tooltip and screen readers, such as \"Tue, Sep 15\". */\n label: string;\n /** Short label on the x axis. Leave it out to keep the axis quiet at that point. */\n axisLabel?: string;\n /**\n * One value per series key. A missing value (`undefined` or `null`) counts as\n * zero, unless the chart's `missing` is `\"gap\"`.\n */\n values: Record<string, number | null | undefined>;\n}\n\n/** The colour role of a reference line or an event marker. `\"neutral\"` is the quiet default. */\nexport type LineChartTone = \"neutral\" | \"accent\" | \"success\" | \"warning\" | \"danger\";\n\n/**\n * A reference line: a horizontal line at a value (a target, a threshold), or a\n * vertical line at one datum (today, a launch). Drawn dashed and quiet, behind\n * the series, with its label at the line's end.\n */\nexport type LineChartReference = {\n /** Stable identity. */\n key: string;\n /** Short text beside the line, such as \"Target\" or \"Today\". Also read to screen readers. */\n label: string;\n /**\n * Colours the line and its label, for a line whose colour carries meaning,\n * such as a \"Goal\" in warning. Still dashed, still behind the series.\n * @default \"neutral\"\n */\n tone?: LineChartTone;\n} & (\n | {\n /**\n * A value on the value axis: a horizontal line. The scale grows to keep it\n * in view, even when every value is missing. A value that is not finite\n * draws nothing. Read with `formatValue` (given the chart's first series)\n * and `unit`, like the series.\n */\n value: number;\n at?: never;\n }\n | {\n /** The `key` of a datum: a vertical line at that point. A key not in `data` draws nothing. */\n at: string;\n value?: never;\n }\n);\n\n/**\n * An event on the category axis, such as \"prompts changed\": a short stem up\n * from the baseline at one datum, with a short visible label above it.\n */\nexport interface LineChartMarker {\n /** Stable identity. */\n key: string;\n /** The `key` of a datum. A key not in `data` draws nothing. */\n at: string;\n /** Short visible text, such as \"Changed\" or \"v2\". */\n label: string;\n /** What happened, read to screen readers in place of `label`, such as \"Prompt set changed\". */\n description?: string;\n /** @default \"neutral\" */\n tone?: LineChartTone;\n}\n\n/**\n * A shaded band across the plot between two values, such as \"Page 1\" for\n * ranks 1 to 10. Drawn behind the gridlines and the series, clipped to the\n * value axis; it never grows the scale.\n */\nexport interface LineChartBand {\n /** Stable identity. */\n key: string;\n /** One edge of the band, on the value axis. Either order. */\n from: number;\n /** The other edge. */\n to: number;\n /** Short text inside the band at its top inline-start corner, such as \"Page 1\". Hidden when the band is too thin to hold it. */\n label: string;\n /** What the band means, read in the chart's summary in place of `label` and its range, such as \"Page 1: ranks 1 to 10\". */\n description?: string;\n /** @default \"neutral\" */\n tone?: LineChartTone;\n}\n\n/** What `renderTooltip` is given for the point under the crosshair. */\nexport interface LineChartTooltipContext {\n datum: LineChartDatum;\n index: number;\n /** The series on show, in order. */\n series: LineChartSeries[];\n /** Each shown series' value at this point; `null` when it is missing (with `missing` `\"gap\"` or `\"connect\"`). */\n values: Record<string, number | null>;\n /** Reads a value the way the default tooltip does: `formatValue`, `unit`, and `missingLabel` for `null`. */\n format: (value: number | null, series: LineChartSeries) => string;\n /** The default tooltip content (the date and one row per series), to keep and add to. */\n readout: ReactNode;\n}\n\nexport interface LineChartProps {\n data: LineChartDatum[];\n series: LineChartSeries[];\n /** What is measured, such as \"Signups\". Names the chart for assistive technology. */\n label: string;\n /** Unit after each value in the tooltip, such as \"ms\". */\n unit?: string;\n /** Plot height in pixels. The width follows the container. @default 220 */\n height?: number;\n /** Formats values in the tooltip and data table. */\n formatValue?: (value: number, series: LineChartSeries) => string;\n /** Formats the value axis. Defaults to a compact number, such as 1.2K. */\n formatTick?: (value: number) => string;\n /** Controlled hidden series keys. */\n hiddenSeries?: string[];\n defaultHiddenSeries?: string[];\n onHiddenSeriesChange?: (hidden: string[]) => void;\n /** Called as the crosshair moves, and with null when it leaves. */\n onActiveChange?: (index: number | null, datum: LineChartDatum | null) => void;\n /** Keeps the current lines on screen, dimmed, while the next range loads. */\n loading?: boolean;\n /** Shown when there are no points. @default \"No data for this range\" */\n emptyLabel?: string;\n /** Series toggles above the plot. Shown by default when there is more than one series. */\n legend?: boolean;\n /** Header of the first column in the data table read by screen readers. @default \"Date\" */\n categoryLabel?: string;\n /** Smooth monotone curves that never swing past the data, or straight segments. @default \"smooth\" */\n curve?: \"smooth\" | \"linear\";\n /**\n * How a missing value (`undefined`, `null` or not a finite number) is drawn.\n * `\"zero\"` counts it as zero, as before. `\"gap\"` breaks the line (and its\n * area) there, leaves it out of the scale, hides the crosshair dot on it and\n * reads it as `missingLabel` in the tooltip and the data table. A point with\n * missing neighbours on both sides is drawn as a dot, and so is the only point\n * of a chart with one datum (at the centre, in every mode). `\"connect\"` is the same,\n * except the line runs on across missing values between two present ones,\n * through the straight line between them (a projection known at a few\n * points); before the first value and after the last, nothing is drawn.\n * @default \"zero\"\n */\n missing?: \"zero\" | \"gap\" | \"connect\";\n /** Read in place of a missing value when `missing` is `\"gap\"` or `\"connect\"`. @default \"No data\" */\n missingLabel?: string;\n /** Reference lines: targets at a value, or markers such as \"today\" at a datum. */\n references?: LineChartReference[];\n /** Events on the category axis, each with a short visible label. Read in the summary and when scrubbed to. */\n markers?: LineChartMarker[];\n /**\n * Flips the value axis: the lowest value at the top, the highest on the\n * baseline. For ranks, where 1 is best. Pair it with `valueDomain`, such as\n * `{ min: 1 }`, so the axis starts at rank 1 rather than 0.\n * @default false\n */\n reversed?: boolean;\n /**\n * Pins either end of the value axis, such as `{ min: 1, max: 100 }` for ranks\n * #1 to #100. An end left out fits the data as before (from zero at the low\n * end). The pinned values are always ticks. A value past a pinned end is drawn\n * past the edge, so pin a range that covers the data.\n */\n valueDomain?: { min?: number; max?: number };\n /** Shaded bands between two values, such as rank pages. Read in the summary. */\n bands?: LineChartBand[];\n /**\n * Replaces the tooltip's content for the point under the crosshair. It is\n * given the point and the default `readout`, to keep and add to (gained and\n * lost counts under a total). Return `null` (or `undefined`, `false`, `0` or `\"\"`) to show no tooltip at that point.\n * The tooltip is visual only: the slider's value text, the summary and the\n * data table still read every value.\n */\n renderTooltip?: (context: LineChartTooltipContext) => ReactNode;\n /** Extra classes for the root. Merged last. */\n className?: string;\n}\n\ntype Point = [x: number, value: number];\n/** Open intervals of x (0 to 1) where a line is not drawn: the gaps around missing values. */\ntype Breaks = [from: number, to: number][];\n/** x (0 to 1) of each missing value, where the crosshair shows no dot even when the line runs across. */\ntype Holes = number[];\ntype Track = { shape: Point[]; breaks: Breaks; holes: Holes; presence: number; stop: (() => void) | null };\n\n/** Room above the top gridline, and the gap between the crosshair and its tooltip. */\nconst TOP = 12;\nconst GAP = 14;\n/** Between a point and its label. */\nconst LABEL_GAP = 6;\n/** The first draw: 480ms x 1.75, slow at both ends. */\nexport const LINE_CHART_DRAW_MS = 840;\nconst PALETTE = [\n \"var(--color-chart-1)\",\n \"color-mix(in oklab, var(--color-foreground) 46%, var(--color-surface))\",\n \"color-mix(in oklab, var(--color-foreground) 26%, var(--color-surface))\",\n];\nconst GROUPED = new Intl.NumberFormat(\"en-US\", { maximumFractionDigits: 1 });\nconst COMPACT = new Intl.NumberFormat(\"en-US\", { notation: \"compact\", maximumFractionDigits: 1 });\nconst GRID = Array.from({ length: 241 }, (_, index) => index / 240);\nconst clamp = (value: number, low: number, high: number) => Math.min(high, Math.max(low, value));\nconst colorOf = (line: LineChartSeries, index: number) =>\n line.color ?? PALETTE[Math.min(index, PALETTE.length - 1)]!;\nconst clean = (value: number) => Number(value.toPrecision(12));\n\n/** Clean gridlines: the smallest step of 1, 2, 2.5 or 5 that covers the data in four rows or fewer, from zero unless the data dips below it (or `fromZero` is off). */\nfunction niceScale(low: number, high: number, fromZero = true) {\n const lo = fromZero ? Math.min(0, low) : low;\n const hi = Math.max(high, lo + 1);\n const magnitude = 10 ** Math.floor(Math.log10((hi - lo) / 4));\n for (const factor of [1, 2, 2.5, 5, 10]) {\n const step = factor * magnitude;\n const bottom = Math.floor(lo / step) * step;\n const top = Math.ceil(hi / step) * step;\n if ((top - bottom) / step <= 4 + 1e-9) {\n const ticks: number[] = [];\n for (let value = bottom; value <= top + step / 2; value += step) ticks.push(clean(value));\n return { min: clean(bottom), max: clean(top), ticks };\n }\n }\n return { min: lo, max: hi, ticks: [lo, hi] };\n}\n\ntype Scale = ReturnType<typeof niceScale>;\n\n/** The nice scale with either end pinned: a pinned end is a tick, and the nice ticks within half a step of it give way. */\nfunction pinScale(scale: Scale, min?: number, max?: number): Scale {\n if (min === undefined && max === undefined) return scale;\n const lo = min ?? scale.min;\n const hi = max ?? scale.max;\n if (!(hi > lo)) return scale;\n const step = scale.ticks.length > 1 ? scale.ticks[1]! - scale.ticks[0]! : hi - lo;\n return { min: lo, max: hi, ticks: [lo, ...scale.ticks.filter((tick) => tick > lo + step / 2 && tick < hi - step / 2), hi] };\n}\n\n/** The line through every value, sampled densely on x from 0 to 1 in data units. Monotone tangents keep a smooth curve from swinging past the data. */\nfunction curveFor(values: number[], smooth: boolean): Point[] {\n if (values.length === 0) return [];\n // A lone value has no run to stretch: one sample at the centre, drawn as a dot by `breaksFor`.\n if (values.length === 1) return [[0.5, values[0]!]];\n const last = values.length - 1;\n const step = 1 / last;\n if (!smooth) return values.map((value, index) => [index * step, value]);\n const slopes = values.slice(1).map((value, index) => (value - values[index]!) / step);\n const tangents = values.map((_, index) =>\n index === 0 || index === last\n ? 0\n : (Math.sign(slopes[index - 1]!) + Math.sign(slopes[index]!)) *\n Math.min(\n Math.abs(slopes[index - 1]!),\n Math.abs(slopes[index]!),\n Math.abs(slopes[index - 1]! + slopes[index]!) / 4,\n ) || 0,\n );\n if (last > 1) {\n tangents[0] = (3 * slopes[0]! - tangents[1]!) / 2;\n tangents[last] = (3 * slopes[last - 1]! - tangents[last - 1]!) / 2;\n } else {\n tangents[0] = slopes[0]!;\n tangents[1] = slopes[0]!;\n }\n const samples = Math.max(1, Math.min(16, Math.round(192 / last)));\n const points: Point[] = [];\n for (let index = 0; index < last; index++) {\n const low = Math.min(values[index]!, values[index + 1]!);\n const high = Math.max(values[index]!, values[index + 1]!);\n for (let sample = 0; sample < samples; sample++) {\n const t = sample / samples;\n const t2 = t * t;\n const t3 = t2 * t;\n const value =\n (2 * t3 - 3 * t2 + 1) * values[index]! +\n (t3 - 2 * t2 + t) * step * tangents[index]! +\n (3 * t2 - 2 * t3) * values[index + 1]! +\n (t3 - t2) * step * tangents[index + 1]!;\n points.push([(index + t) * step, clamp(value, low, high)]);\n }\n }\n points.push([1, values[last]!]);\n return points;\n}\n\n/** Fills each missing value straight between its present neighbours (or with the nearest one at the ends), so a gapped line still has a shape to morph. */\nfunction fillGaps(values: (number | null)[]): number[] {\n const present = values.flatMap((value, index) => (value === null ? [] : [index]));\n if (!present.length) return values.map(() => 0);\n return values.map((value, index) => {\n if (value !== null) return value;\n const after = present.find((at) => at > index);\n const before = [...present].reverse().find((at) => at < index);\n if (before === undefined) return values[after!]!;\n if (after === undefined) return values[before]!;\n return values[before]! + ((values[after]! - values[before]!) * (index - before)) / (after - before);\n });\n}\n\n/** Where a line with missing values is not drawn: before its first value, after its last, and (unless it connects across them) between two values with missing ones between them. */\nfunction breaksFor(values: (number | null)[], across = false): Breaks {\n const present = values.flatMap((value, index) => (value === null ? [] : [index]));\n if (!present.length) return values.length ? [[-Infinity, Infinity]] : [];\n const last = values.length - 1;\n // A lone value is a dot, like any isolated present value: the line is cut on both sides of the centre, where `curveFor` puts it.\n if (last === 0) return [[-Infinity, 0.5], [0.5, Infinity]];\n const breaks: Breaks = [];\n if (present[0]! > 0) breaks.push([-Infinity, present[0]! / last]);\n for (let at = 1; at < present.length; at++) {\n if (!across && present[at]! - present[at - 1]! > 1) breaks.push([present[at - 1]! / last, present[at]! / last]);\n }\n if (present[present.length - 1]! < last) breaks.push([present[present.length - 1]! / last, Infinity]);\n return breaks;\n}\n\nfunction holesFor(values: (number | null)[]): Holes {\n const last = values.length - 1;\n return values.flatMap((value, index) => (value === null && last > 0 ? [index / last] : []));\n}\n\nconst EDGE = 1e-9;\n/** Radius of a lone point's dot, inside its 2px stroke. */\nconst DOT = 1.5;\nconst inBreak = (breaks: Breaks, x: number) => breaks.some(([from, to]) => x > from + EDGE && x < to - EDGE);\n\n/** The drawn runs of a line, split at its gaps. A run of one point is a dot: a small closed circle the stroke fills out to about 5px. */\nfunction pathsFor(shape: Point[], breaks: Breaks, toX: (x: number) => number, toY: (value: number) => number, bottom: number) {\n const runs: string[][] = [];\n let run: string[] | null = null;\n for (const [x, value] of shape) {\n if (breaks.length && inBreak(breaks, x)) {\n run = null;\n continue;\n }\n if (!run) runs.push((run = []));\n run.push(`${toX(x).toFixed(1)},${toY(value).toFixed(1)}`);\n }\n const line = runs\n .map((points) => {\n if (points.length > 1) return `M${points.join(\"L\")}`;\n const [x, y] = points[0]!.split(\",\").map(Number);\n return `M${(x! - DOT).toFixed(1)},${y!.toFixed(1)}a${DOT},${DOT} 0 1,0 ${DOT * 2},0a${DOT},${DOT} 0 1,0 ${-DOT * 2},0`;\n })\n .join(\"\");\n const area = runs\n .map((points) => {\n const first = points[0]!.split(\",\")[0];\n const lastX = points[points.length - 1]!.split(\",\")[0];\n return `M${points.join(\"L\")}L${lastX},${bottom}L${first},${bottom}Z`;\n })\n .join(\"\");\n return { line, area };\n}\n\nconst isFiniteValue = (reference: LineChartReference): reference is LineChartReference & { value: number } =>\n typeof reference.value === \"number\" && Number.isFinite(reference.value);\n\n/** Value of a sampled line at x, straight between samples. */\nfunction valueAt(shape: Point[], x: number) {\n if (!shape.length) return 0;\n let low = 0;\n let high = shape.length - 1;\n if (x <= shape[low]![0]) return shape[low]![1];\n if (x >= shape[high]![0]) return shape[high]![1];\n while (high - low > 1) {\n const middle = (low + high) >> 1;\n if (shape[middle]![0] < x) low = middle;\n else high = middle;\n }\n const [x0, y0] = shape[low]!;\n const [x1, y1] = shape[high]!;\n return x1 === x0 ? y1 : y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);\n}\n\n/** Axis labels that fit: at most one per 76 pixels, counted back from the latest so the newest always shows. */\nfunction axisPicks(data: LineChartDatum[], width: number) {\n const labeled = data.flatMap((item, index) => (item.axisLabel ? [index] : []));\n if (!width || !labeled.length) return [];\n const room = Math.max(2, Math.floor(width / 76));\n const stride = Math.ceil(labeled.length / room);\n return labeled\n .reverse()\n .filter((_, rank) => rank % stride === 0)\n .reverse();\n}\n\nexport const LineChart = forwardRef<HTMLElement, LineChartProps>(function LineChart(\n {\n data,\n series,\n label,\n unit = \"\",\n height = 220,\n formatValue,\n formatTick = (value) => COMPACT.format(value),\n hiddenSeries,\n defaultHiddenSeries,\n onHiddenSeriesChange,\n onActiveChange,\n loading = false,\n emptyLabel = \"No data for this range\",\n legend,\n categoryLabel = \"Date\",\n curve = \"smooth\",\n missing = \"zero\",\n missingLabel = \"No data\",\n references,\n markers,\n reversed = false,\n valueDomain,\n bands,\n renderTooltip,\n className,\n },\n ref,\n) {\n const figure = useRef<HTMLElement | null>(null);\n const refs = useMemo(() => mergeRefs(ref, figure), [ref]);\n const plot = useRef<HTMLDivElement>(null);\n const svg = useRef<SVGSVGElement>(null);\n const tip = useRef<HTMLDivElement>(null);\n const gutter = useRef<HTMLDivElement>(null);\n const uid = `line${useId().replace(/[^a-zA-Z0-9_-]/g, \"\")}`;\n const last = data.length - 1;\n const empty = data.length === 0;\n\n const [ownHidden, setOwnHidden] = useState<string[]>(defaultHiddenSeries ?? []);\n const hidden = hiddenSeries ?? ownHidden;\n const toggle = (key: string) => {\n const next = hidden.includes(key) ? hidden.filter((item) => item !== key) : [...hidden, key];\n if (hiddenSeries === undefined) setOwnHidden(next);\n onHiddenSeriesChange?.(next);\n };\n const visible = series.filter((line) => !hidden.includes(line.key));\n const showLegend = legend ?? series.length > 1;\n\n // A missing value is zero, as it always was, unless gaps (or a connected line) are asked for.\n const gaps = missing !== \"zero\";\n const read = (item: LineChartDatum, key: string): number | null => {\n const value = item.values[key];\n if (!gaps) return value ?? 0;\n return typeof value === \"number\" && Number.isFinite(value) ? value : null;\n };\n\n // Each series becomes a dense curve in data units; the scale fits only the series on show.\n const signature = `${curve}|${missing}|${series.map((line) => line.key).join(\",\")}|${data\n .map((item) => `${item.key}:${series.map((line) => read(item, line.key)).join(\",\")}`)\n .join(\";\")}`;\n const targets = useMemo(\n () =>\n new Map(\n series.map((line) => {\n const values = data.map((item) => read(item, line.key));\n return [\n line.key,\n {\n shape: curveFor(fillGaps(values), curve === \"smooth\"),\n breaks: breaksFor(values, missing === \"connect\"),\n holes: holesFor(values),\n },\n ];\n }),\n ),\n // The signature captures everything the curves read.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [signature],\n );\n let low = Infinity;\n let high = -Infinity;\n for (const line of visible) {\n for (const item of data) {\n const value = read(item, line.key);\n if (value === null) continue;\n low = Math.min(low, value);\n high = Math.max(high, value);\n }\n }\n // A target keeps itself in view, even with every value missing, so it never sits on the fallback scale.\n for (const reference of references ?? []) {\n if (!isFiniteValue(reference)) continue;\n low = Math.min(low, reference.value);\n high = Math.max(high, reference.value);\n }\n // A pinned end stands in for the data at that end, so a pinned low end does not reach down to zero.\n const pinMin = Number.isFinite(valueDomain?.min) ? valueDomain!.min : undefined;\n const pinMax = Number.isFinite(valueDomain?.max) ? valueDomain!.max : undefined;\n const fit = (from: number, to: number) => pinScale(niceScale(pinMin ?? from, pinMax ?? to, pinMin === undefined), pinMin, pinMax);\n const range = Number.isFinite(low) ? fit(low, high) : pinMin !== undefined && pinMax !== undefined ? fit(pinMin, pinMax) : null;\n const [steady, setSteady] = useState(() => range ?? fit(0, 100));\n if (range && (range.min !== steady.min || range.max !== steady.max || range.ticks.join() !== steady.ticks.join())) setSteady(range);\n\n // Scrubbing: a new range lets go of the crosshair.\n const [active, setActive] = useState<number | null>(null);\n const [seen, setSeen] = useState(signature);\n if (seen !== signature) {\n setSeen(signature);\n setActive(null);\n }\n const index = active === null || empty ? null : Math.min(active, last);\n const scrubbing = index !== null;\n\n const width = useRef(0);\n const [plotWidth, setPlotWidth] = useState(0);\n const [drawn, setDrawn] = useState(false);\n const tracks = useRef(new Map<string, Track>());\n const scale = useRef({ min: steady.min, max: steady.max });\n const cursor = useRef(1);\n // `undefined`: nothing to draw (an unknown datum, or a value that is not finite).\n const referenceAt = (reference: LineChartReference) => {\n if (typeof reference.value === \"number\") return isFiniteValue(reference) ? null : undefined;\n const at = data.findIndex((item) => item.key === reference.at);\n return at < 0 ? undefined : last > 0 ? at / last : 0.5;\n };\n const drawnReferences = (references ?? []).filter((reference) => referenceAt(reference) !== undefined);\n const markerIndex = (marker: LineChartMarker) => data.findIndex((item) => item.key === marker.at);\n const drawnMarkers = (markers ?? []).filter((marker) => markerIndex(marker) >= 0);\n const drawnBands = (bands ?? []).filter((band) => Number.isFinite(band.from) && Number.isFinite(band.to));\n const live = useRef({ series, hidden });\n useIsomorphicLayoutEffect(() => {\n live.current = { series, hidden };\n });\n\n /** One writer for every drawn attribute: morphs, toggles, the scale, the crosshair and the size all repaint through here. */\n const paint = useCallback(() => {\n const w = width.current;\n const root = svg.current;\n if (!w || !root) return;\n const lo = scale.current.min;\n const span = scale.current.max - lo || 1;\n const toY = (value: number) => TOP + (reversed ? (value - lo) / span : 1 - (value - lo) / span) * (height - TOP);\n // A hidden series flattens into the value on the baseline: the lowest, or the highest on a reversed axis.\n const base = reversed ? scale.current.max : lo;\n const at = cursor.current;\n const dotYs: number[] = [];\n for (const line of live.current.series) {\n const track = tracks.current.get(line.key);\n if (!track) continue;\n const p = track.presence;\n const y = (value: number) => toY(base + (value - base) * p);\n const group = root.querySelector<SVGGElement>(`[data-series=\"${CSS.escape(line.key)}\"]`);\n if (track.breaks.length) {\n const paths = pathsFor(track.shape, track.breaks, (x) => x * w, y, height);\n group?.querySelector(\"[data-part=line]\")?.setAttribute(\"d\", paths.line);\n group?.querySelector(\"[data-part=area]\")?.setAttribute(\"d\", paths.area);\n } else {\n const path = track.shape.length\n ? `M${track.shape.map(([x, value]) => `${(x * w).toFixed(1)},${y(value).toFixed(1)}`).join(\"L\")}`\n : \"\";\n group?.querySelector(\"[data-part=line]\")?.setAttribute(\"d\", path);\n group?.querySelector(\"[data-part=area]\")?.setAttribute(\"d\", path ? `${path}L${w},${height}L0,${height}Z` : \"\");\n }\n if (group) group.style.opacity = String(p);\n const dot = root.querySelector<SVGCircleElement>(`[data-dot=\"${CSS.escape(line.key)}\"]`);\n if (dot && track.shape.length) {\n const gap = inBreak(track.breaks, at) || track.holes.some((x) => Math.abs(x - at) < 1e-6);\n const cy = y(valueAt(track.shape, at));\n dot.setAttribute(\"cx\", (at * w).toFixed(1));\n dot.setAttribute(\"cy\", cy.toFixed(1));\n // No value here: no dot, and the tooltip does not centre on one.\n if (gap) dot.setAttribute(\"data-gap\", \"\");\n else dot.removeAttribute(\"data-gap\");\n if (p > 0.5 && !gap) dotYs.push(cy);\n }\n }\n // Gridlines and tick labels ride the scale.\n for (const node of root.querySelectorAll<SVGLineElement>(\"[data-grid]\")) {\n const yy = String(Math.round(toY(Number(node.dataset.grid))) + 0.5);\n node.setAttribute(\"y1\", yy);\n node.setAttribute(\"y2\", yy);\n }\n for (const node of gutter.current?.querySelectorAll<HTMLElement>(\"[data-tick]\") ?? []) {\n node.style.translate = `0 ${Math.round(toY(Number(node.dataset.tick)))}px`;\n }\n // Bands ride the scale too, clipped to the axis; a label shows only when the band can hold it.\n for (const node of root.querySelectorAll<SVGRectElement>(\"[data-band]\")) {\n const ys = [toY(Number(node.dataset.from)), toY(Number(node.dataset.to))];\n const top = clamp(Math.min(...ys), TOP, height);\n const bottom = clamp(Math.max(...ys), TOP, height);\n node.setAttribute(\"y\", String(Math.round(top)));\n node.setAttribute(\"height\", String(Math.max(0, Math.round(bottom) - Math.round(top))));\n const text = plot.current?.querySelector<HTMLElement>(`[data-band-label=\"${CSS.escape(node.dataset.band!)}\"]`);\n if (text) {\n text.style.translate = `0 ${Math.round(top)}px`;\n text.style.visibility = bottom - top >= text.offsetHeight ? \"\" : \"hidden\";\n }\n }\n // Reference lines: a value rides the scale like a gridline; a datum sits at its x.\n for (const node of root.querySelectorAll<SVGLineElement>(\"[data-reference-value]\")) {\n const yy = String(Math.round(toY(Number(node.dataset.referenceValue))) + 0.5);\n node.setAttribute(\"y1\", yy);\n node.setAttribute(\"y2\", yy);\n }\n for (const node of root.querySelectorAll<SVGLineElement>(\"[data-reference-at]\")) {\n const xx = String(Math.round(Number(node.dataset.referenceAt) * w) + 0.5);\n node.setAttribute(\"x1\", xx);\n node.setAttribute(\"x2\", xx);\n }\n for (const node of plot.current?.querySelectorAll<HTMLElement>(\"[data-reference-label]\") ?? []) {\n const { referenceValue, referenceAt } = node.dataset;\n node.style.translate =\n referenceValue !== undefined\n ? `0 ${Math.round(toY(Number(referenceValue)))}px`\n : `${Math.round(Number(referenceAt) * w)}px 0`;\n }\n // Point and end labels ride their line: centred above the point (below it at the top), kept inside the plot.\n for (const node of plot.current?.querySelectorAll<HTMLElement>(\"[data-point-label]\") ?? []) {\n const track = tracks.current.get(node.dataset.pointLabel!);\n if (!track?.shape.length) continue;\n const x = Number(node.dataset.x);\n const cy = toY(base + (valueAt(track.shape, x) - base) * track.presence);\n const lw = node.offsetWidth;\n const lh = node.offsetHeight;\n const top = cy - lh - LABEL_GAP < 0 ? cy + LABEL_GAP : cy - lh - LABEL_GAP;\n node.style.translate = `${Math.round(clamp(x * w - lw / 2, 0, Math.max(0, w - lw)))}px ${Math.round(clamp(top, 0, Math.max(0, height - lh)))}px`;\n node.style.opacity = String(track.presence);\n }\n const cx = Math.round(at * w) + 0.5;\n const cross = root.querySelector(\"[data-part=crosshair]\");\n cross?.setAttribute(\"x1\", String(cx));\n cross?.setAttribute(\"x2\", String(cx));\n // The tooltip sits beside the crosshair, flips sides before it would leave the plot, and centres on the points it describes.\n const bubble = tip.current;\n if (bubble) {\n const tw = bubble.offsetWidth;\n const th = bubble.offsetHeight;\n let x = cx + GAP;\n if (x + tw > w) x = cx - GAP - tw;\n const middle = dotYs.length ? dotYs.reduce((sum, value) => sum + value, 0) / dotYs.length : height / 2;\n bubble.style.translate = `${clamp(x, 0, Math.max(0, w - tw))}px ${clamp(middle - th / 2, 0, Math.max(0, height - th))}px`;\n }\n }, [height, reversed]);\n\n // The plot draws in its own pixels: measure the width and follow resizes.\n useIsomorphicLayoutEffect(() => {\n const node = plot.current;\n if (!node) return;\n const read = () => {\n width.current = node.clientWidth;\n setPlotWidth(node.clientWidth);\n paint();\n };\n read();\n if (typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(read);\n observer.observe(node);\n return () => observer.disconnect();\n }, [paint]);\n useIsomorphicLayoutEffect(paint);\n\n // New data morphs every line from the shape on screen, sampled on shared x positions so a range that gains or loses points still flows.\n useEffect(() => {\n const moves: { track: Track; xs: number[]; from: number[]; to: number[]; target: Point[] }[] = [];\n for (const [key, { shape: target, breaks, holes }] of targets) {\n const track = tracks.current.get(key);\n if (!track) {\n tracks.current.set(key, {\n shape: target,\n breaks,\n holes,\n presence: live.current.hidden.includes(key) ? 0 : 1,\n stop: null,\n });\n continue;\n }\n // The gaps move to the new data at once; the line morphs between them.\n track.breaks = breaks;\n track.holes = holes;\n if (!track.shape.length || !target.length) {\n track.shape = target;\n continue;\n }\n const xs = [...new Set([...GRID, ...target.map(([x]) => x)])].sort((a, b) => a - b);\n moves.push({ track, xs, from: xs.map((x) => valueAt(track.shape, x)), to: xs.map((x) => valueAt(target, x)), target });\n }\n if (!moves.length) {\n paint();\n return;\n }\n return tween(\n SMOOTH,\n (p) => {\n for (const move of moves) {\n move.track.shape = move.xs.map((x, at): Point => [x, move.from[at]! + (move.to[at]! - move.from[at]!) * p]);\n }\n paint();\n },\n () => {\n for (const move of moves) move.track.shape = move.target;\n paint();\n },\n );\n }, [paint, targets]);\n\n // A hidden series flattens into the baseline as it fades; the ones that stay rescale around it.\n const hiddenKey = hidden.join(\"|\");\n useEffect(() => {\n for (const [key, track] of tracks.current) {\n const to = hidden.includes(key) ? 0 : 1;\n if (track.presence === to) continue;\n track.stop?.();\n const from = track.presence;\n track.stop = tween(SMOOTH, (p) => {\n track.presence = from + (to - from) * p;\n paint();\n });\n }\n paint();\n // hiddenKey stands for `hidden`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [hiddenKey, paint]);\n\n // The value axis slides to its new range on the smooth spring.\n useEffect(() => {\n const from = { ...scale.current };\n if (from.min === steady.min && from.max === steady.max) return;\n return tween(SMOOTH, (p) => {\n scale.current = { min: from.min + (steady.min - from.min) * p, max: from.max + (steady.max - from.max) * p };\n paint();\n });\n }, [paint, steady]);\n\n // The lines draw left to right the first time the chart is seen with data.\n useEffect(() => {\n if (empty || drawn) return;\n const node = figure.current;\n if (!node || prefersReducedMotion() || typeof IntersectionObserver === \"undefined\") {\n setDrawn(true);\n return;\n }\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (!entry?.isIntersecting) return;\n observer.disconnect();\n setDrawn(true);\n },\n { threshold: 0.3 },\n );\n observer.observe(node);\n return () => observer.disconnect();\n }, [drawn, empty]);\n\n // The crosshair appears on the first scrubbed point and glides between the ones after it.\n const wasScrubbing = useRef(false);\n useEffect(() => {\n if (index === null) {\n wasScrubbing.current = false;\n return;\n }\n const to = last > 0 ? index / last : 0.5;\n const from = cursor.current;\n if (!wasScrubbing.current) {\n wasScrubbing.current = true;\n cursor.current = to;\n paint();\n return;\n }\n return tween(SNAPPY, (p) => {\n cursor.current = from + (to - from) * p;\n paint();\n });\n }, [index, last, paint]);\n\n const onActive = useRef(onActiveChange);\n useIsomorphicLayoutEffect(() => {\n onActive.current = onActiveChange;\n });\n useEffect(() => {\n onActive.current?.(index, index === null ? null : (data[index] ?? null));\n // Report only when the scrubbed point changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [index]);\n\n const pointAt = (clientX: number) => {\n const rect = plot.current?.getBoundingClientRect();\n if (!rect?.width || last < 1) return Math.max(0, last);\n return clamp(Math.round(((clientX - rect.left) / rect.width) * last), 0, last);\n };\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"Escape\" && scrubbing) {\n event.preventDefault();\n setActive(null);\n return;\n }\n const from = index ?? last + 1;\n const page = Math.max(1, Math.round(data.length / 6));\n const next = (\n {\n ArrowLeft: from - 1,\n ArrowDown: from - 1,\n ArrowRight: index === null ? last : from + 1,\n ArrowUp: index === null ? last : from + 1,\n PageDown: from - page,\n PageUp: from + page,\n Home: 0,\n End: last,\n } as Record<string, number>\n )[event.key];\n if (next === undefined || empty) return;\n event.preventDefault();\n setActive(clamp(next, 0, last));\n };\n const onPointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if (empty) return;\n if (event.pointerType !== \"mouse\") event.currentTarget.setPointerCapture?.(event.pointerId);\n setActive(pointAt(event.clientX));\n };\n const onPointerMove = (event: PointerEvent<HTMLDivElement>) => {\n if (!empty && (event.pointerType === \"mouse\" || event.buttons)) setActive(pointAt(event.clientX));\n };\n\n const formatShort = (value: number, line: LineChartSeries) =>\n formatValue ? formatValue(value, line) : GROUPED.format(value);\n const formatNumber = (value: number, line: LineChartSeries) => `${formatShort(value, line)}${unit ? ` ${unit}` : \"\"}`;\n const format = (value: number | null, line: LineChartSeries) =>\n value === null ? missingLabel : formatNumber(value, line);\n // A reference belongs to no series; `formatValue` gets the first one, so a chart of one unit reads the same.\n const formatReference = (value: number) =>\n series[0] ? formatNumber(value, series[0]) : `${GROUPED.format(value)}${unit ? ` ${unit}` : \"\"}`;\n const reading = index === null ? null : data[index];\n const shown = reading ?? data[last];\n const markedHere = index === null ? [] : drawnMarkers.filter((marker) => markerIndex(marker) === index);\n const valueText = reading\n ? `${reading.label}: ${visible.map((line) => `${line.label} ${format(read(reading, line.key), line)}`).join(\", \")}${markedHere\n .map((marker) => `. ${marker.description ?? marker.label}`)\n .join(\"\")}`\n : empty\n ? emptyLabel\n : `${visible.length} of ${series.length} series shown`;\n const summary = empty\n ? `${label}. ${emptyLabel}.`\n : `${label}, ${data[0]!.label} to ${data[last]!.label}. ${visible\n .map(\n (line) =>\n `${line.label}, latest ${format(read(data[last]!, line.key), line)}${\n typeof line.endLabel === \"string\" ? `, ${line.endLabel}` : \"\"\n }`,\n )\n .join(\". \")}.${drawnReferences\n .map((reference) =>\n typeof reference.value === \"number\"\n ? ` ${reference.label}: ${formatReference(reference.value)}.`\n : ` ${reference.label}: ${data.find((item) => item.key === reference.at)!.label}.`,\n )\n .join(\"\")}${drawnMarkers\n .map((marker) => ` ${marker.description ?? marker.label}: ${data[markerIndex(marker)]!.label}.`)\n .join(\"\")}${drawnBands\n .map(\n (band) =>\n ` ${band.description ?? `${band.label}: ${formatReference(Math.min(band.from, band.to))} to ${formatReference(Math.max(band.from, band.to))}`}.`,\n )\n .join(\"\")}`;\n // One label per present point, and the end label on the last of them. A hidden series' labels fade with its line.\n const pointLabels = empty\n ? []\n : series.flatMap((line) => {\n if (!line.pointLabels && !line.endLabel) return [];\n const present = data.flatMap((item, at) => {\n const value = read(item, line.key);\n return value === null ? [] : [{ at, value }];\n });\n const end = line.endLabel ? present.at(-1) : undefined;\n return [\n ...(line.pointLabels ? present.filter((point) => point !== end) : []).map((point) => ({\n line,\n ...point,\n end: false,\n text: formatShort(point.value, line),\n })),\n ...(end\n ? [{ line, ...end, end: true, text: typeof line.endLabel === \"string\" ? line.endLabel : formatShort(end.value, line) }]\n : []),\n ];\n });\n const readout = (\n <>\n <p className=\"m-0 mb-0.5 whitespace-nowrap text-xs tabular-nums text-text-secondary\">{shown?.label ?? \"\"}</p>\n {visible.map((line) => (\n <p\n key={line.key}\n className=\"m-0 flex min-w-0 items-center gap-2 text-sm\"\n style={{ \"--series\": colorOf(line, series.indexOf(line)) } as CSSProperties}\n >\n <span data-dashed={line.dashed || undefined} className=\"chart-tip-swatch\" />\n <span className=\"min-w-0 flex-1 truncate text-text-secondary\">{line.label}</span>\n <span className=\"ms-2 flex-none whitespace-nowrap font-medium tabular-nums text-foreground\">\n {shown ? format(read(shown, line.key), line) : format(0, line)}\n </span>\n </p>\n ))}\n </>\n );\n // A custom tooltip is given the point it describes (the last one until scrubbed, so it is sized before it shows) and the default readout.\n const tipContent: ReactNode =\n renderTooltip && shown\n ? renderTooltip({\n datum: shown,\n index: index ?? last,\n series: visible,\n values: Object.fromEntries(visible.map((line) => [line.key, read(shown, line.key)])),\n format,\n readout,\n })\n : readout;\n const picks = axisPicks(data, plotWidth);\n const allHidden = !empty && visible.length === 0;\n\n return (\n <figure\n ref={refs}\n data-slot=\"line-chart\"\n aria-label={label}\n aria-busy={loading || undefined}\n className={cn(\"m-0 grid min-w-0 gap-4 box-border font-sans text-foreground\", className)}\n >\n {showLegend ? (\n <div role=\"group\" aria-label={`${label} series`} className=\"-mx-2 flex min-w-0 flex-wrap gap-x-1 gap-y-0.5\">\n {series.map((line, at) => (\n <button\n key={line.key}\n type=\"button\"\n data-slot=\"line-chart-toggle\"\n aria-pressed={!hidden.includes(line.key)}\n onClick={() => toggle(line.key)}\n style={{ \"--series\": colorOf(line, at) } as CSSProperties}\n className=\"chart-legend-toggle\"\n >\n <span aria-hidden=\"true\" data-dashed={line.dashed || undefined} className=\"chart-swatch\" />\n <span className=\"chart-toggle-label\">{line.label}</span>\n </button>\n ))}\n </div>\n ) : null}\n <div\n data-slot=\"line-chart-chart\"\n data-scrubbing={scrubbing || undefined}\n data-loading={loading || undefined}\n data-drawn={drawn || undefined}\n className=\"line-chart-frame\"\n >\n <div\n ref={plot}\n data-slot=\"line-chart-plot\"\n role=\"slider\"\n tabIndex={empty ? -1 : 0}\n aria-label={`${label}, explore by ${categoryLabel.toLowerCase()}`}\n aria-orientation=\"horizontal\"\n aria-valuemin={1}\n aria-valuemax={Math.max(1, data.length)}\n aria-valuenow={(index ?? last) + 1}\n aria-valuetext={valueText}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={(event) => {\n if (event.pointerType !== \"mouse\") setActive(null);\n }}\n onPointerCancel={() => setActive(null)}\n onPointerLeave={(event) => {\n if (event.pointerType === \"mouse\") setActive(null);\n }}\n onKeyDown={onKeyDown}\n onBlur={() => setActive(null)}\n onFocus={(event) => {\n if (event.currentTarget.matches(\":focus-visible\") && !empty) setActive((current) => current ?? last);\n }}\n className=\"line-chart-plot\"\n style={{ height }}\n >\n <svg ref={svg} width=\"100%\" height={height} aria-hidden=\"true\" focusable=\"false\" className=\"block overflow-visible\">\n <defs>\n <clipPath id={`${uid}-draw`} clipPathUnits=\"userSpaceOnUse\">\n <rect className=\"line-chart-reveal\" x={-8} y={-16} height={height + 32} style={{ width: drawn ? plotWidth + 16 : 0 }} />\n </clipPath>\n </defs>\n {drawnBands.map((band) => (\n <rect\n key={band.key}\n data-band={band.key}\n data-from={band.from}\n data-to={band.to}\n data-tone={band.tone}\n className=\"line-chart-band\"\n x={0}\n width=\"100%\"\n />\n ))}\n {(reversed ? steady.ticks.slice(0, -1) : steady.ticks.slice(1)).map((value) => (\n <line key={value} data-grid={value} className=\"line-chart-grid\" x1={0} x2=\"100%\" />\n ))}\n <line className=\"line-chart-baseline\" x1={0} x2=\"100%\" y1={height - 0.5} y2={height - 0.5} />\n {drawnReferences.map((reference) =>\n typeof reference.value === \"number\" ? (\n <line\n key={reference.key}\n data-reference={reference.key}\n data-reference-value={reference.value}\n data-tone={reference.tone}\n className=\"line-chart-reference\"\n x1={0}\n x2=\"100%\"\n />\n ) : (\n <line\n key={reference.key}\n data-reference={reference.key}\n data-reference-at={referenceAt(reference)!}\n data-tone={reference.tone}\n className=\"line-chart-reference\"\n y1={TOP - 4}\n y2={height}\n />\n ),\n )}\n <line data-part=\"crosshair\" className=\"line-chart-crosshair\" y1={TOP - 4} y2={height} />\n <g className=\"line-chart-series\" clipPath={`url(#${uid}-draw)`}>\n {series.map((line, at) => (\n <g key={line.key} data-series={line.key} style={{ \"--series\": colorOf(line, at) } as CSSProperties}>\n {(line.area ?? at === 0) ? <path data-part=\"area\" className=\"line-chart-area\" /> : null}\n <path data-part=\"line\" data-dashed={line.dashed || undefined} className=\"line-chart-line\" />\n </g>\n ))}\n </g>\n {series.map((line, at) => (\n <circle\n key={line.key}\n data-dot={line.key}\n data-hidden={hidden.includes(line.key) || undefined}\n r={4}\n className=\"line-chart-dot\"\n style={{ \"--series\": colorOf(line, at) } as CSSProperties}\n />\n ))}\n </svg>\n {drawnBands.map((band) => (\n <span\n key={band.key}\n aria-hidden=\"true\"\n data-slot=\"line-chart-band-label\"\n data-band-label={band.key}\n data-tone={band.tone}\n className=\"line-chart-band-label\"\n >\n {band.label}\n </span>\n ))}\n {drawnReferences.map((reference) => (\n <span\n key={reference.key}\n aria-hidden=\"true\"\n data-slot=\"line-chart-reference-label\"\n data-reference-label={reference.key}\n data-reference-value={typeof reference.value === \"number\" ? reference.value : undefined}\n data-reference-at={typeof reference.value === \"number\" ? undefined : referenceAt(reference)!}\n data-axis={typeof reference.value === \"number\" ? \"value\" : \"category\"}\n data-tone={reference.tone}\n className=\"line-chart-reference-label\"\n >\n {reference.label}\n </span>\n ))}\n {drawnMarkers.map((marker) => {\n const share = last > 0 ? markerIndex(marker) / last : 0.5;\n return (\n <span\n key={marker.key}\n aria-hidden=\"true\"\n data-slot=\"line-chart-marker\"\n data-marker={marker.key}\n data-tone={marker.tone}\n className=\"line-chart-marker\"\n style={{ left: `${share * 100}%` }}\n >\n <span className=\"line-chart-marker-label\" style={{ translate: `${-share * 100}% 0` }}>\n {marker.label}\n </span>\n </span>\n );\n })}\n {pointLabels.map(({ line, at, end, text }) => (\n <span\n key={`${line.key}:${data[at]!.key}`}\n aria-hidden=\"true\"\n data-slot={end ? \"line-chart-end-label\" : \"line-chart-point-label\"}\n data-point-label={line.key}\n data-x={last > 0 ? at / last : 0.5}\n className=\"line-chart-point-label\"\n data-end={end || undefined}\n style={{ \"--series\": colorOf(line, series.indexOf(line)) } as CSSProperties}\n >\n {end ? <span data-dashed={line.dashed || undefined} className=\"chart-tip-swatch\" /> : null}\n {text}\n </span>\n ))}\n <div\n ref={tip}\n aria-hidden=\"true\"\n data-slot=\"line-chart-tooltip\"\n data-empty={!tipContent || undefined}\n className=\"line-chart-tooltip\"\n >\n {tipContent}\n </div>\n {(empty || allHidden) && !loading ? (\n <p className=\"absolute inset-0 m-0 grid place-items-center text-sm text-muted-foreground pointer-events-none motion-safe:animate-fade-in\">\n {empty ? emptyLabel : \"Choose a series to show\"}\n </p>\n ) : null}\n {loading && empty ? <span aria-hidden=\"true\" className=\"chart-skeleton\" /> : null}\n </div>\n <div ref={gutter} aria-hidden=\"true\" className=\"relative min-w-0 [grid-area:1/2]\">\n {steady.ticks.map((value) => (\n <span key={value} data-tick={value} className=\"line-chart-tick motion-safe:animate-fade-in\">\n <span className=\"block -translate-y-1/2 text-xs leading-none tabular-nums text-muted-foreground\">\n {formatTick(value)}\n </span>\n </span>\n ))}\n </div>\n <div aria-hidden=\"true\" className=\"relative min-w-0 [grid-area:2/1]\">\n {picks.map((at) => {\n const share = last > 0 ? at / last : 0.5;\n return (\n <span\n key={`${data[at]!.key}:${data[at]!.axisLabel}`}\n className=\"absolute top-2 whitespace-nowrap text-xs leading-none tabular-nums text-muted-foreground motion-safe:animate-fade-in\"\n style={{ left: `${share * 100}%`, translate: `${-share * 100}% 0` }}\n >\n {data[at]!.axisLabel}\n </span>\n );\n })}\n </div>\n </div>\n <p className=\"sr-only\">{summary}</p>\n {empty ? null : (\n <div className=\"sr-only\">\n <table>\n <caption>{label}</caption>\n <thead>\n <tr>\n <th scope=\"col\">{categoryLabel}</th>\n {series.map((line) => (\n <th key={line.key} scope=\"col\">\n {line.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {data.map((item) => (\n <tr key={item.key}>\n <th scope=\"row\">{item.label}</th>\n {series.map((line) => (\n <td key={line.key}>{format(read(item, line.key), line)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n <p className=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n {loading ? \"Loading\" : \"\"}\n </p>\n </figure>\n );\n});\n"],"mappings":";;;;;;;;;AAyPA,MAAM,MAAM;AACZ,MAAM,MAAM;;AAEZ,MAAM,YAAY;;AAElB,MAAa,qBAAqB;AAClC,MAAM,UAAU;CACd;CACA;CACA;AACF;AACA,MAAM,UAAU,IAAI,KAAK,aAAa,SAAS,EAAE,uBAAuB,EAAE,CAAC;AAC3E,MAAM,UAAU,IAAI,KAAK,aAAa,SAAS;CAAE,UAAU;CAAW,uBAAuB;AAAE,CAAC;AAChG,MAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,IAAI,IAAI,GAAG,UAAU,QAAQ,GAAG;AAClE,MAAM,SAAS,OAAe,KAAa,SAAiB,KAAK,IAAI,MAAM,KAAK,IAAI,KAAK,KAAK,CAAC;AAC/F,MAAM,WAAW,MAAuB,UACtC,KAAK,SAAS,QAAQ,KAAK,IAAI,OAAO,QAAQ,SAAS,CAAC;AAC1D,MAAM,SAAS,UAAkB,OAAO,MAAM,YAAY,EAAE,CAAC;;AAG7D,SAAS,UAAU,KAAa,MAAc,WAAW,MAAM;CAC7D,MAAM,KAAK,WAAW,KAAK,IAAI,GAAG,GAAG,IAAI;CACzC,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,CAAC;CAChC,MAAM,YAAY,MAAM,KAA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,EAAA,UAAA,CACE,oBAAC,MAAD;MAAI,OAAM;MAAO,UAAA,KAAK;KAAU,CAAA,GAC/B,OAAO,KAAK,SACX,oBAAC,MAAD,EAAA,UAAoB,OAAO,KAAK,MAAM,KAAK,GAAG,GAAG,IAAI,EAAM,GAAlD,KAAK,GAA6C,CAC5D,CACC,EAAA,GALK,KAAK,GAKV,CACL,EACI,CAAA;IACF,EAAA,CAAA;GACJ,CAAA;GAEP,oBAAC,KAAD;IAAG,WAAU;IAAU,aAAU;IAAS,eAAY;IACnD,UAAA,UAAU,YAAY;GACtB,CAAA;EACG;;AAEZ,CAAC"}
@@ -2,8 +2,8 @@
2
2
  import { cn, cnAll } from "../lib/cn.js";
3
3
  import { prefersReducedMotion, useExitBackstop, useIsomorphicLayoutEffect } from "../lib/motion.js";
4
4
  import { Avatar } from "../avatar/avatar.js";
5
- import { fieldSurfaceVariants } from "../lib/field-surface.js";
6
5
  import { FieldShell, useFieldWiring } from "../lib/field-shell.js";
6
+ import { fieldSurfaceVariants } from "../lib/field-surface.js";
7
7
  import { forwardRef, useCallback, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  //#region src/mention-input/mention-input.tsx
@@ -1,2 +1,2 @@
1
- import { MoneyInput, MoneyInputDetails, MoneyInputProps } from "./money-input.js";
2
- export { MoneyInput, type MoneyInputDetails, type MoneyInputProps };
1
+ import { MoneyInput, MoneyInputDetails, MoneyInputProps, MoneyInputSize } from "./money-input.js";
2
+ export { MoneyInput, type MoneyInputDetails, type MoneyInputProps, type MoneyInputSize };
@@ -8,6 +8,8 @@ export interface MoneyInputDetails {
8
8
  /** The amount as a full currency string, such as "$12.50". */
9
9
  formatted: string;
10
10
  }
11
+ /** The field sizes: the large `"hero"` amount, or one of Input's `sm`, `md` and `lg` rungs. */
12
+ export type MoneyInputSize = "hero" | "sm" | "md" | "lg";
11
13
  /**
12
14
  * MoneyInput: a currency amount. The value is in minor units, so $12.50 is 1250
13
15
  * and 500 yen is 500. Digits group as they are typed without moving the caret,
@@ -28,6 +30,18 @@ export interface MoneyInputDetails {
28
30
  * it is (or while the amount is out of range, whose wording it then replaces).
29
31
  */
30
32
  export interface MoneyInputProps {
33
+ /**
34
+ * How big the field is. `"hero"` is the large amount field: a 76px panel
35
+ * with the amount at the type scale's h2 size. `"sm"`, `"md"` and `"lg"`
36
+ * are Input's own rungs: the same height and inline padding (the
37
+ * `--density-control-*` tokens), the same text size, the same radius and
38
+ * the same border, so the amount sits level with an Input, a Select or a
39
+ * Button of that size in a form row. The currency menu shrinks to fit inside
40
+ * the box; the quick-add row and the messages are unchanged.
41
+ *
42
+ * @default "hero"
43
+ */
44
+ size?: MoneyInputSize;
31
45
  /** What the amount is, and the field's accessible name. */
32
46
  label: string;
33
47
  /** Render the label for screen readers only. */
@@ -3,9 +3,9 @@ import { cn, cnAll } from "../lib/cn.js";
3
3
  import { useIsomorphicLayoutEffect, useMorphWidth } from "../lib/motion.js";
4
4
  import { Button as Button$1 } from "../button/button.js";
5
5
  import { SwapText } from "../lib/swap-text.js";
6
- import { fieldSurfaceVariants } from "../lib/field-surface.js";
7
6
  import { FieldMessage, RollingNumber } from "../lib/field-message.js";
8
7
  import { FieldShell, useFieldWiring } from "../lib/field-shell.js";
8
+ import { fieldBoxSize, fieldSurfaceVariants, fieldTextSize } from "../lib/field-surface.js";
9
9
  import { SelectItem, selectPopoverVariants } from "../select/select.js";
10
10
  import { forwardRef, useCallback, useId, useImperativeHandle, useMemo, useReducer, useRef, useState } from "react";
11
11
  import { Button, Group, Input, ListBox, Popover, Select, SelectValue } from "react-aria-components";
@@ -146,8 +146,18 @@ function Amount({ draft, digits, symbols, direction, still }) {
146
146
  ] }) : null] });
147
147
  }
148
148
  const triggerClass = "inline-flex h-9 flex-none cursor-pointer items-center gap-1 rounded-pill border-0 bg-transparent ps-3 pe-2 font-sans text-sm font-medium tabular-nums text-foreground outline-none motion-safe:transition-[background-color] motion-safe:duration-(--duration-quick) motion-safe:ease-settle data-[hovered]:bg-muted data-[pressed]:bg-muted data-[disabled]:cursor-not-allowed data-[focus-visible]:outline-solid data-[focus-visible]:outline-(length:--focus-ring-width) data-[focus-visible]:outline-offset-(--focus-ring-offset) data-[focus-visible]:outline-(--color-ring)";
149
- const shellClass = cnAll(fieldSurfaceVariants(), "flex h-19 items-center gap-2 rounded-panel ps-4.5 pe-2", "has-[input:focus]:not-data-[invalid]:border-foreground", "forced-colors:has-[input:focus]:outline-solid forced-colors:has-[input:focus]:outline-(length:--focus-ring-width) forced-colors:has-[input:focus]:outline-offset-(--focus-ring-offset)");
150
- const MoneyInput = forwardRef(function MoneyInput({ label, labelHidden = false, value, defaultValue = null, onValueChange, currency: currencyProp, defaultCurrency = "USD", onCurrencyChange, currencies = [
149
+ const shellFocus = ["has-[input:focus]:not-data-[invalid]:border-foreground", "forced-colors:has-[input:focus]:outline-solid forced-colors:has-[input:focus]:outline-(length:--focus-ring-width) forced-colors:has-[input:focus]:outline-offset-(--focus-ring-offset)"];
150
+ const shellClass = cnAll(fieldSurfaceVariants(), "flex h-19 items-center gap-2 rounded-panel ps-4.5 pe-2", ...shellFocus);
151
+ const fieldShellClass = (size, hasMenu) => cnAll(fieldSurfaceVariants(), "flex items-center gap-2", fieldBoxSize[size], ...shellFocus, hasMenu && "pe-1");
152
+ const fieldTriggerClass = cnAll(triggerClass, "h-auto self-stretch my-1 ps-2.5 pe-1.5");
153
+ const amountBase = "inline-flex flex-none origin-left items-baseline whitespace-nowrap";
154
+ const amountRest = "tabular-nums text-foreground data-[ready]:motion-safe:transition-[scale] data-[ready]:motion-safe:duration-(--duration-smooth) data-[ready]:motion-safe:ease-smooth data-[strain]:motion-safe:animate-field-strain";
155
+ const amountClass = (size) => [
156
+ amountBase,
157
+ size === "hero" ? "font-display text-h2 font-medium" : fieldTextSize[size],
158
+ amountRest
159
+ ].join(" ");
160
+ const MoneyInput = forwardRef(function MoneyInput({ size = "hero", label, labelHidden = false, value, defaultValue = null, onValueChange, currency: currencyProp, defaultCurrency = "USD", onCurrencyChange, currencies = [
151
161
  "USD",
152
162
  "EUR",
153
163
  "GBP",
@@ -426,7 +436,7 @@ const MoneyInput = forwardRef(function MoneyInput({ label, labelHidden = false,
426
436
  isDisabled: disabled,
427
437
  isInvalid: invalid || Boolean(message),
428
438
  "data-slot": "money-input-shell",
429
- className: shellClass,
439
+ className: size === "hero" ? shellClass : fieldShellClass(size, canSwitch),
430
440
  children: [/* @__PURE__ */ jsx("div", {
431
441
  ref: wrapRef,
432
442
  className: "relative flex h-full min-w-0 flex-1 cursor-text items-center overflow-hidden",
@@ -442,7 +452,7 @@ const MoneyInput = forwardRef(function MoneyInput({ label, labelHidden = false,
442
452
  children: /* @__PURE__ */ jsxs("div", {
443
453
  ref: groupRef,
444
454
  "data-slot": "money-input-amount",
445
- className: "inline-flex flex-none origin-left items-baseline whitespace-nowrap font-display text-h2 font-medium tabular-nums text-foreground data-[ready]:motion-safe:transition-[scale] data-[ready]:motion-safe:duration-(--duration-smooth) data-[ready]:motion-safe:ease-smooth data-[strain]:motion-safe:animate-field-strain",
455
+ className: amountClass(size),
446
456
  children: [
447
457
  info.position === "prefix" ? /* @__PURE__ */ jsx(SymbolSlot, {
448
458
  symbol: info.symbol,
@@ -507,7 +517,7 @@ const MoneyInput = forwardRef(function MoneyInput({ label, labelHidden = false,
507
517
  "data-slot": "money-input-currency",
508
518
  className: "flex-none",
509
519
  children: [/* @__PURE__ */ jsxs(Button, {
510
- className: cnAll(triggerClass, "group/trigger"),
520
+ className: cnAll(size === "hero" ? triggerClass : fieldTriggerClass, "group/trigger"),
511
521
  children: [/* @__PURE__ */ jsx(SelectValue, { children: () => code }), /* @__PURE__ */ jsx("svg", {
512
522
  "aria-hidden": "true",
513
523
  viewBox: "0 0 16 16",
@@ -550,7 +560,7 @@ const MoneyInput = forwardRef(function MoneyInput({ label, labelHidden = false,
550
560
  })]
551
561
  }) : /* @__PURE__ */ jsx("span", {
552
562
  "data-slot": "money-input-currency",
553
- className: "flex-none px-2.5 text-sm font-medium text-text-secondary",
563
+ className: cnAll("flex-none px-2.5 text-sm font-medium text-text-secondary", size !== "hero" && "pe-0"),
554
564
  children: code
555
565
  })]
556
566
  }),