@underpin/ui 0.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +44 -1
- package/components/autocomplete.d.ts +25 -0
- package/components/autocomplete.js +71 -0
- package/components/autocomplete.js.map +1 -0
- package/components/avatar.d.ts +5 -0
- package/components/avatar.js +26 -0
- package/components/avatar.js.map +1 -0
- package/components/badge.d.ts +36 -0
- package/components/badge.js +140 -0
- package/components/badge.js.map +1 -0
- package/components/bar-list.d.ts +133 -0
- package/components/bar-list.js +204 -0
- package/components/bar-list.js.map +1 -0
- package/components/breakdown-card.d.ts +30 -0
- package/components/breakdown-card.js +43 -0
- package/components/breakdown-card.js.map +1 -0
- package/components/button-group.d.ts +17 -0
- package/components/button-group.js +27 -0
- package/components/button-group.js.map +1 -0
- package/components/button.d.ts +39 -0
- package/components/button.js +128 -0
- package/components/button.js.map +1 -0
- package/components/calendar.d.ts +27 -0
- package/components/calendar.js +95 -0
- package/components/calendar.js.map +1 -0
- package/components/callout.d.ts +26 -0
- package/components/callout.js +71 -0
- package/components/callout.js.map +1 -0
- package/components/card.d.ts +55 -0
- package/components/card.js +96 -0
- package/components/card.js.map +1 -0
- package/components/chart.d.ts +32 -0
- package/components/chart.js +43 -0
- package/components/chart.js.map +1 -0
- package/components/checkbox.d.ts +15 -0
- package/components/checkbox.js +42 -0
- package/components/checkbox.js.map +1 -0
- package/components/code-block.d.ts +21 -0
- package/components/code-block.js +35 -0
- package/components/code-block.js.map +1 -0
- package/components/collapse.d.ts +14 -0
- package/components/collapse.js +25 -0
- package/components/collapse.js.map +1 -0
- package/components/combobox.d.ts +71 -0
- package/components/combobox.js +155 -0
- package/components/combobox.js.map +1 -0
- package/components/copy-button.d.ts +29 -0
- package/components/copy-button.js +100 -0
- package/components/copy-button.js.map +1 -0
- package/components/copy-input.d.ts +15 -0
- package/components/copy-input.js +51 -0
- package/components/copy-input.js.map +1 -0
- package/components/date-picker-trigger.d.ts +12 -0
- package/components/date-picker-trigger.js +30 -0
- package/components/date-picker-trigger.js.map +1 -0
- package/components/date-picker.d.ts +36 -0
- package/components/date-picker.js +70 -0
- package/components/date-picker.js.map +1 -0
- package/components/detail-row.d.ts +51 -0
- package/components/detail-row.js +77 -0
- package/components/detail-row.js.map +1 -0
- package/components/dialog.d.ts +121 -0
- package/components/dialog.js +327 -0
- package/components/dialog.js.map +1 -0
- package/components/disabled-reason.d.ts +31 -0
- package/components/disabled-reason.js +67 -0
- package/components/disabled-reason.js.map +1 -0
- package/components/empty-state.d.ts +41 -0
- package/components/empty-state.js +84 -0
- package/components/empty-state.js.map +1 -0
- package/components/entity-avatar.d.ts +54 -0
- package/components/entity-avatar.js +68 -0
- package/components/entity-avatar.js.map +1 -0
- package/components/form-section.d.ts +22 -0
- package/components/form-section.js +38 -0
- package/components/form-section.js.map +1 -0
- package/components/form.d.ts +199 -0
- package/components/form.js +456 -0
- package/components/form.js.map +1 -0
- package/components/formatted-number.d.ts +21 -0
- package/components/formatted-number.js +13 -0
- package/components/formatted-number.js.map +1 -0
- package/components/heading.d.ts +23 -0
- package/components/heading.js +44 -0
- package/components/heading.js.map +1 -0
- package/components/icon-swap.d.ts +15 -0
- package/components/icon-swap.js +29 -0
- package/components/icon-swap.js.map +1 -0
- package/components/inline-action.d.ts +21 -0
- package/components/inline-action.js +36 -0
- package/components/inline-action.js.map +1 -0
- package/components/input.d.ts +51 -0
- package/components/input.js +52 -0
- package/components/input.js.map +1 -0
- package/components/kbd.d.ts +17 -0
- package/components/kbd.js +34 -0
- package/components/kbd.js.map +1 -0
- package/components/label.d.ts +10 -0
- package/components/label.js +20 -0
- package/components/label.js.map +1 -0
- package/components/menu.d.ts +77 -0
- package/components/menu.js +189 -0
- package/components/menu.js.map +1 -0
- package/components/nav-button.d.ts +34 -0
- package/components/nav-button.js +71 -0
- package/components/nav-button.js.map +1 -0
- package/components/nav.d.ts +39 -0
- package/components/nav.js +68 -0
- package/components/nav.js.map +1 -0
- package/components/number-input.d.ts +16 -0
- package/components/number-input.js +25 -0
- package/components/number-input.js.map +1 -0
- package/components/page.d.ts +14 -0
- package/components/page.js +23 -0
- package/components/page.js.map +1 -0
- package/components/pagination.d.ts +15 -0
- package/components/pagination.js +63 -0
- package/components/pagination.js.map +1 -0
- package/components/ping.d.ts +38 -0
- package/components/ping.js +50 -0
- package/components/ping.js.map +1 -0
- package/components/popover.d.ts +5 -0
- package/components/popover.js +25 -0
- package/components/popover.js.map +1 -0
- package/components/radio-group.d.ts +35 -0
- package/components/radio-group.js +81 -0
- package/components/radio-group.js.map +1 -0
- package/components/relative-time.d.ts +25 -0
- package/components/relative-time.js +51 -0
- package/components/relative-time.js.map +1 -0
- package/components/saved-mark.d.ts +15 -0
- package/components/saved-mark.js +45 -0
- package/components/saved-mark.js.map +1 -0
- package/components/search-input.d.ts +13 -0
- package/components/search-input.js +44 -0
- package/components/search-input.js.map +1 -0
- package/components/section-header.d.ts +83 -0
- package/components/section-header.js +170 -0
- package/components/section-header.js.map +1 -0
- package/components/segmented-control.d.ts +24 -0
- package/components/segmented-control.js +70 -0
- package/components/segmented-control.js.map +1 -0
- package/components/select.d.ts +28 -0
- package/components/select.js +129 -0
- package/components/select.js.map +1 -0
- package/components/shortcut-keys.d.ts +14 -0
- package/components/shortcut-keys.js +32 -0
- package/components/shortcut-keys.js.map +1 -0
- package/components/shortcuts-dialog.d.ts +10 -0
- package/components/shortcuts-dialog.js +92 -0
- package/components/shortcuts-dialog.js.map +1 -0
- package/components/skeleton.d.ts +8 -0
- package/components/skeleton.js +23 -0
- package/components/skeleton.js.map +1 -0
- package/components/sparkline.d.ts +25 -0
- package/components/sparkline.js +70 -0
- package/components/sparkline.js.map +1 -0
- package/components/stack.d.ts +21 -0
- package/components/stack.js +45 -0
- package/components/stack.js.map +1 -0
- package/components/stat-strip.d.ts +43 -0
- package/components/stat-strip.js +151 -0
- package/components/stat-strip.js.map +1 -0
- package/components/steps.d.ts +19 -0
- package/components/steps.js +25 -0
- package/components/steps.js.map +1 -0
- package/components/switch.d.ts +16 -0
- package/components/switch.js +29 -0
- package/components/switch.js.map +1 -0
- package/components/tabs.d.ts +18 -0
- package/components/tabs.js +65 -0
- package/components/tabs.js.map +1 -0
- package/components/text-link.d.ts +16 -0
- package/components/text-link.js +32 -0
- package/components/text-link.js.map +1 -0
- package/components/textarea.d.ts +10 -0
- package/components/textarea.js +23 -0
- package/components/textarea.js.map +1 -0
- package/components/theme.d.ts +28 -0
- package/components/theme.js +158 -0
- package/components/theme.js.map +1 -0
- package/components/time-series-chart.d.ts +122 -0
- package/components/time-series-chart.js +722 -0
- package/components/time-series-chart.js.map +1 -0
- package/components/toaster.d.ts +3 -0
- package/components/toaster.js +44 -0
- package/components/toaster.js.map +1 -0
- package/components/tooltip.d.ts +64 -0
- package/components/tooltip.js +126 -0
- package/components/tooltip.js.map +1 -0
- package/components/view-picker.d.ts +20 -0
- package/components/view-picker.js +24 -0
- package/components/view-picker.js.map +1 -0
- package/fonts/inter-OFL.txt +93 -0
- package/fonts/inter-cyrillic-ext.woff2 +0 -0
- package/fonts/inter-cyrillic.woff2 +0 -0
- package/fonts/inter-greek-ext.woff2 +0 -0
- package/fonts/inter-greek.woff2 +0 -0
- package/fonts/inter-latin-ext.woff2 +0 -0
- package/fonts/inter-latin.woff2 +0 -0
- package/fonts/inter-vietnamese.woff2 +0 -0
- package/fonts.css +83 -0
- package/lib/animation.d.ts +14 -0
- package/lib/animation.js +20 -0
- package/lib/animation.js.map +1 -0
- package/lib/aria.d.ts +5 -0
- package/lib/aria.js +12 -0
- package/lib/aria.js.map +1 -0
- package/lib/chart-curve.d.ts +13 -0
- package/lib/chart-curve.js +79 -0
- package/lib/chart-curve.js.map +1 -0
- package/lib/classes.d.ts +134 -0
- package/lib/classes.js +152 -0
- package/lib/classes.js.map +1 -0
- package/lib/color.d.ts +25 -0
- package/lib/color.js +149 -0
- package/lib/color.js.map +1 -0
- package/lib/day.d.ts +9 -0
- package/lib/day.js +20 -0
- package/lib/day.js.map +1 -0
- package/lib/design-tokens.d.ts +56 -0
- package/lib/design-tokens.js +196 -0
- package/lib/design-tokens.js.map +1 -0
- package/lib/icon.d.ts +17 -0
- package/lib/icon.js +34 -0
- package/lib/icon.js.map +1 -0
- package/lib/icons.d.ts +23 -0
- package/lib/icons.js +28 -0
- package/lib/icons.js.map +1 -0
- package/lib/interactive.d.ts +21 -0
- package/lib/interactive.js +31 -0
- package/lib/interactive.js.map +1 -0
- package/lib/media.d.ts +58 -0
- package/lib/media.js +116 -0
- package/lib/media.js.map +1 -0
- package/lib/segmented.d.ts +57 -0
- package/lib/segmented.js +83 -0
- package/lib/segmented.js.map +1 -0
- package/lib/shortcuts.d.ts +94 -0
- package/lib/shortcuts.js +271 -0
- package/lib/shortcuts.js.map +1 -0
- package/lib/slot.d.ts +9 -0
- package/lib/slot.js +18 -0
- package/lib/slot.js.map +1 -0
- package/lib/time-series.d.ts +100 -0
- package/lib/time-series.js +144 -0
- package/lib/time-series.js.map +1 -0
- package/lib/tone.d.ts +6 -0
- package/lib/tone.js +0 -0
- package/lib/variants.d.ts +12 -0
- package/lib/variants.js +14 -0
- package/lib/variants.js.map +1 -0
- package/package.json +110 -3
- package/styles.css +619 -0
- package/tokens.d.ts +104 -0
- package/tokens.js +108 -0
- package/tokens.js.map +1 -0
- package/publish.log +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time-series-chart.js","names":[],"sources":["../../src/components/time-series-chart.tsx"],"sourcesContent":["\"use client\"\n\nimport {\n areaY,\n barY,\n type ChartGuideLineStyle,\n createMark,\n defineChart,\n group,\n lineY,\n} from \"@tanstack/charts\"\nimport { d3Curve } from \"@tanstack/charts/d3/shape\"\nimport { focusGuideX } from \"@tanstack/charts/focus/guide\"\nimport { motion } from \"@tanstack/charts/motion\"\nimport { RendererChart } from \"@tanstack/charts/react/tooltip\"\nimport { scaleBand } from \"@tanstack/charts/scales/band\"\nimport { scaleLinear } from \"@tanstack/charts/scales/linear\"\nimport { tooltip } from \"@tanstack/charts/tooltip\"\nimport { portal } from \"@tanstack/charts/tooltip/portal\"\nimport { curveLinear, curveMonotoneX } from \"d3-shape\"\nimport {\n type ComponentProps,\n type CSSProperties,\n type PointerEvent,\n useDeferredValue,\n useId,\n useRef,\n useState,\n} from \"react\"\nimport { CHART_TRANSITION } from \"../lib/animation\"\nimport { splitCurve } from \"../lib/chart-curve\"\nimport { tooltipLabelClasses, tooltipRuleClasses } from \"../lib/classes\"\nimport { useElementWidth } from \"../lib/media\"\nimport {\n bucketNotes,\n AREA_FADE,\n countPartialStart,\n countRunning,\n domainTicks,\n niceTicks,\n pickTicks,\n SERIES_COLORS,\n seriesTotal,\n type TimeSeriesNote,\n type TimeSeriesPoint,\n type TimeSeriesSeries,\n} from \"../lib/time-series\"\nimport { cn } from \"../lib/variants\"\nimport { type ChartTooltipItem, ChartTooltipContent } from \"./chart\"\n\nexport type { TimeSeriesNote, TimeSeriesPoint, TimeSeriesSeries } from \"../lib/time-series\"\n\nconst DEFAULT_COLOR = \"var(--color-chart-1)\"\nconst BAR_COLOR = \"var(--color-chart-2)\"\n// Neither the line's hue nor the bars': a note is a third thing on the chart.\nconst NOTE_COLOR = \"var(--color-chart-3)\"\n/** How far a value label sits above its grid line, so the line runs under it, not through. */\nconst LABEL_RISE = 8\n/**\n * The space between a plot edge that carries value labels and the data nearest it. The grid\n * lines run the full width; the line or the outermost bar stops this far short of the labels.\n */\nconst PLOT_INSET = 40\nconst PLOT_HEIGHT = 256\n/** The `text-2xs` size in px, as the chart renderer takes it. */\nconst TICK_FONT_SIZE = 11\nconst GRID: ChartGuideLineStyle = {\n stroke: \"var(--color-edge)\",\n strokeOpacity: 1,\n strokeDasharray: \"2 3\",\n}\nconst BAR_RADIUS = [2, 2, 0, 0] as const\nconst BAR_MAX_WIDTH = 18\n/** The share of the space between buckets that the renderer gives a bucket's bars. */\nconst BAR_SHARE = 0.8\n/** The band a lone bucket's bars get, with no neighbour to measure the space against. */\nconst LONE_BANDWIDTH = 48\n/** The gaps around a compared pair's two bars, as a share of the pair's band. */\nconst PAIR_PADDING = 0.08\n/** Half the diagonal of the 9px square a note marker is, stood on its corner. */\nconst NOTE_RADIUS = 6.4\n/** A chart moves when its numbers change. Its first draw is not a change, so it lands at once. */\nconst RENDERER = motion({ initial: false, transition: CHART_TRANSITION })\n\n/**\n * Room for one date label. Ticks are thinned to what the plot can hold at this pitch, so a\n * week shows every day on a wide card and a 180-day range still reads on a narrow one.\n */\nconst TICK_PITCH = 80\n/** A tick label's width per character, as a share of its font size: the average advance. */\nconst TICK_CHARACTER_WIDTH = 0.6\n\n/** Notes listed in one tooltip before the rest are summed up. */\nconst TOOLTIP_NOTES = 2\n\nconst DAY_MS = 86_400_000\n\n/**\n * How far a bucket's bars reach either side of its time, given the band the renderer sizes\n * them from: half a bar, or half a compared pair of them. Follows the renderer's own sizing,\n * so the outermost bar can be placed to the pixel.\n */\nfunction measureBarReach(bandwidth: number, paired: boolean) {\n if (!paired) return Math.min(bandwidth, BAR_MAX_WIDTH) / 2\n const step = bandwidth / (2 + PAIR_PADDING)\n return (step + Math.min((1 - PAIR_PADDING) * step, BAR_MAX_WIDTH)) / 2\n}\n\ninterface EyebrowProps {\n parts: (string | false | undefined)[]\n}\n\n/** The small line over a note's text: whichever of author and day apply, or nothing at all. */\nfunction Eyebrow({ parts }: EyebrowProps) {\n const shown = parts.filter(Boolean)\n if (!shown.length) return null\n return <div className={cn(tooltipLabelClasses, \"truncate text-2xs\")}>{shown.join(\" · \")}</div>\n}\n\ninterface NotesFooterProps {\n notes?: TimeSeriesNote[]\n /** The bucket's instant and exclusive end. */\n bucket?: number\n end?: number\n hint?: string\n color: string\n formatDate: (date: Date) => string\n}\n\n/**\n * The hovered bucket's notes under its figures, each with the marker's colour down its left\n * edge and a small line naming the author and the day. The day is left off only where the\n * tooltip's own heading already says it: a bucket no wider than a day, holding a note on that\n * very instant. Then what a click does, where the chart takes one; with neither notes nor a\n * click to explain it renders nothing at all.\n */\nfunction NotesFooter({ notes, bucket, end, hint, color, formatDate }: NotesFooterProps) {\n const shown = notes?.slice(0, TOOLTIP_NOTES) ?? []\n const rest = (notes?.length ?? 0) - shown.length\n const dayBucket = bucket !== undefined && end !== undefined && end - bucket <= DAY_MS\n\n if (!shown.length) {\n return hint ? <div className={tooltipLabelClasses}>{hint}</div> : null\n }\n\n return (\n <div className=\"grid gap-1.5\">\n {shown.map((note, index) => (\n <div\n key={index}\n className=\"min-w-0 border-l-2 border-(--color-note) pl-2\"\n style={{ \"--color-note\": color } as CSSProperties}\n >\n <Eyebrow\n parts={[\n note.author,\n !(dayBucket && note.date.getTime() === bucket) && formatDate(note.date),\n ]}\n />\n {/* One line, whatever its length: a note runs to a paragraph, and a tooltip that\n grew to hold one would cover the chart it reports on. */}\n <div className=\"truncate font-medium\">{note.text}</div>\n </div>\n ))}\n\n {rest > 0 && (\n <div className={tooltipLabelClasses}>\n and {rest} more {rest === 1 ? \"note\" : \"notes\"}\n </div>\n )}\n\n {hint && (\n // 8px either side of the rule, like the one the tooltip draws over this footer:\n // the grid's 6px gap plus 2px, then the same padding below.\n <div className={cn(tooltipLabelClasses, \"mt-0.5 border-t pt-2\", tooltipRuleClasses)}>\n {hint}\n </div>\n )}\n </div>\n )\n}\n\ninterface SeriesLegendProps {\n series: (TimeSeriesSeries & { color: string })[]\n /** Absent for a metric with no meaningful sum. */\n totals?: Map<string, number>\n formatValue: (value: number) => string\n}\n\n/**\n * One entry per line of a multi-series plot: the line's swatch, its name and its total over\n * the range. Left-aligned above the plot, so the names are read before the lines they label.\n */\nfunction SeriesLegend({ series, totals, formatValue }: SeriesLegendProps) {\n return (\n <div className=\"mb-3 flex flex-wrap gap-x-4 gap-y-1 text-xs\">\n {series.map(entry => (\n <div key={entry.key} className=\"flex items-center gap-1.5\">\n {/* A dash, not a dot: it reads as the line it stands for. */}\n <span\n aria-hidden\n className=\"h-0.5 w-2.5 shrink-0 rounded-[1px] bg-(--color-swatch)\"\n style={{ \"--color-swatch\": entry.color } as CSSProperties}\n />\n <span className=\"text-ink-secondary\">{entry.label}</span>\n {totals && (\n <span className=\"font-medium tabular-nums\">\n {formatValue(totals.get(entry.key) ?? 0)}\n </span>\n )}\n </div>\n ))}\n </div>\n )\n}\n\n/** The dot a line shows at the hovered bucket, ringed in the card's colour. */\nfunction focusMarker(color: string) {\n return { radius: 4, fill: color, stroke: \"var(--color-surface)\", strokeWidth: 2 }\n}\n\n/** Whether a bucket has an outline segment to stack on its bar. */\nfunction isOutlined(point: TimeSeriesPoint) {\n return (point.outline ?? 0) > 0\n}\n\n/** A bucket as the chart draws it: the point, where its bucket starts and ends, and its notes. */\ninterface PlotPoint extends TimeSeriesPoint {\n time: number\n end: number\n notes: TimeSeriesNote[]\n}\n\n/**\n * A diamond in the note colour on the baseline of each bucket holding a note, the shape\n * Plausible settled on: a dot the size of the line would read as a data point, and one small\n * enough not to would read as nothing. Decorative, so hovering it reports its bucket as usual.\n */\nfunction noteMarkers(times: number[], baseline: number, scaleId: string, color: string) {\n return createMark<PlotPoint>(() => ({\n id: \"notes\",\n channels: {\n x: { scale: \"x\", values: times },\n y: { scale: scaleId, values: [baseline] },\n },\n render({ scales }) {\n const xScale = scales.x\n const yScale = scales[scaleId]\n if (!xScale || !yScale) return { nodes: [] }\n const cy = yScale.map(baseline)\n\n return {\n nodes: times.map(time => {\n const cx = xScale.map(time)\n return {\n kind: \"area\" as const,\n key: `note-${time}`,\n points: [\n [cx, cy - NOTE_RADIUS],\n [cx + NOTE_RADIUS, cy],\n [cx, cy + NOTE_RADIUS],\n [cx - NOTE_RADIUS, cy],\n ],\n style: { fill: color, stroke: \"var(--color-surface)\", strokeWidth: 1.5 },\n }\n }),\n }\n },\n }))\n}\n\nexport interface TimeSeriesChartProps extends Omit<ComponentProps<\"div\">, \"children\"> {\n data: TimeSeriesPoint[]\n /**\n * The series name, shown in the tooltip. Under `series` it is the chart's accessible name\n * instead; each line carries its own label.\n */\n label: string\n /**\n * Series colour; one of the `--color-chart-*` tokens.\n */\n color?: string\n /**\n * Multi-series mode: one line per entry, read from `point.values[key]`, all on the value\n * axis. Draws no gradient and no `previous` line; lists every line in the tooltip, largest\n * first, and a legend of totals above the plot. Meant for up to three lines.\n */\n series?: TimeSeriesSeries[]\n /**\n * Whether the legend sums each line over the range. Off for a metric that does not add up\n * across buckets (a rate, an average duration), where the legend names the lines alone.\n */\n seriesTotals?: boolean\n /**\n * Value-axis tick, usually compact (\"5.9K\"). The chart builds no formatter of its own: the\n * app supplies every reading, so the axis follows the same locale and time zone as the\n * figures around it.\n */\n formatTick: (value: number) => string\n /**\n * Tooltip value, usually grouped (\"5,912\").\n */\n formatValue: (value: number) => string\n /**\n * Date-axis tick, usually short (\"Sep 6\").\n */\n formatDate: (date: Date) => string\n /**\n * A note's day in the tooltip; `formatDate` by default. Set it where `formatDate` follows\n * the bucket size and drops the day on a monthly axis.\n */\n formatNoteDate?: (date: Date) => string\n /**\n * Tooltip heading, usually long (\"September 6, 2026\").\n */\n formatTooltipDate: (date: Date) => string\n /**\n * A fixed scale (a rate pinned to `[0, 100]`) instead of a rounded top over the data.\n */\n domain?: [number, number]\n /**\n * Line shape: a smooth curve through the points by default, or straight segments between\n * them (`\"linear\"`) so each bucket reads as a corner.\n */\n curve?: \"smooth\" | \"linear\"\n /**\n * The line through `value` (default), or the `bar` series alone (`\"bar\"`) at full scale on\n * the left axis: a sum per bucket, such as money, rather than a level. As the chart, a\n * compared period (`previous`, in the bar's unit) is a hatched bar beside each one. The bar\n * element is the same either way, so switching morphs the bars instead of redrawing them.\n */\n shape?: \"line\" | \"bar\"\n /**\n * The bar series' name (tooltip and legend); shown when any point carries a `bar`.\n */\n barLabel?: string\n /** The outline series' name (tooltip); shown when any point carries an `outline`. */\n outlineLabel?: string\n /**\n * Bar colour; one of the `--color-chart-*` tokens.\n */\n barColor?: string\n /**\n * Bar-axis tick, on the left; `formatTick` by default.\n */\n formatBarTick?: (value: number) => string\n /**\n * Bar tooltip value; `formatValue` by default.\n */\n formatBarValue?: (value: number) => string\n /**\n * Notes pinned to dates; drawn as markers on the baseline of the bucket that holds them and\n * listed in that bucket's tooltip.\n */\n notes?: TimeSeriesNote[]\n /**\n * Marker and tooltip colour for notes; one of the `--color-chart-*` tokens.\n */\n noteColor?: string\n /**\n * The exclusive end of the bucket starting at `date`. Only the trailing bucket needs it,\n * since every other bucket ends where the next begins, and only because a month bucket's\n * width can't be read off the series; without it the last bucket is as wide as the one\n * before.\n */\n bucketEnd?: (date: Date) => Date\n /**\n * Called with the clicked bucket's date and exclusive end. The cursor turns into a pointer\n * when set.\n */\n onPointClick?: (date: Date, end: Date) => void\n /**\n * What a click on the plot does, said at the foot of the tooltip; shown only with\n * `onPointClick`.\n */\n pointClickHint?: string\n /**\n * Draw no value labels, on either side, and let the data run to the plot's edges. The grid\n * stays. For a plot too narrow to give the labels their room.\n */\n hideValueAxis?: boolean\n}\n\n/**\n * A value tick with no label. The axis itself stays, because the grid lines follow its ticks.\n */\nfunction formatNoTick() {\n return \"\"\n}\n\n/**\n * The single time series: a smooth gradient area with a right-hand value axis on round grid\n * lines and evenly spaced date ticks along the bottom. A compared period draws as a dashed\n * line in the same hue. Notes pinned to dates mark their bucket on the baseline and list\n * themselves in its tooltip. With `series` set it is several plain lines on that same axis,\n * under a legend of totals.\n */\nexport function TimeSeriesChart({\n data,\n label,\n color = DEFAULT_COLOR,\n series,\n seriesTotals = true,\n formatTick,\n formatValue,\n formatDate,\n formatNoteDate = formatDate,\n formatTooltipDate,\n domain,\n curve = \"smooth\",\n shape = \"line\",\n barLabel = \"\",\n outlineLabel = \"\",\n barColor = BAR_COLOR,\n formatBarTick = formatTick,\n formatBarValue = formatValue,\n notes = [],\n noteColor = NOTE_COLOR,\n bucketEnd,\n onPointClick,\n pointClickHint,\n hideValueAxis = false,\n className,\n ...props\n}: TimeSeriesChartProps) {\n const asBars = shape === \"bar\"\n // The compared period's tooltip swatch: a dashed outline in the series' own hue, since a\n // swatch can show neither a hatched bar nor a dashed line.\n const previousColor = `color-mix(in oklab, ${barColor} 45%, transparent)`\n const hatchId = `hatch-${useId()}`\n // Every line with its colour settled, so the plot, the tooltip and the legend agree on it.\n const lines = (series ?? []).map((entry, index) => ({\n ...entry,\n color: entry.color ?? SERIES_COLORS[index % SERIES_COLORS.length] ?? DEFAULT_COLOR,\n }))\n const multi = lines.length > 0\n const compared = !multi && data.some(point => point.previous !== undefined)\n const hasOutline = data.some(isOutlined)\n // An outline rides the bars' scale, so a range that holds refunds and no sales still needs it.\n const hasBars = asBars || hasOutline || data.some(point => (point.bar ?? 0) > 0)\n // The plot mounts one render after the rest of the chart, in a render React can interrupt,\n // so the page's first render does not also build the chart's scene. Its box keeps its\n // height meanwhile, so nothing around it moves.\n const plotted = useDeferredValue(true, false)\n // The plot's width decides how many date labels fit; measured, since the chart fills\n // whatever card it sits in. The value labels sit inside the plot, so it spans the card.\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const plotWidth = useElementWidth(element, { deferred: false }) ?? 0\n // A compared bar chart pairs the earlier bucket's bar with this one inside each bucket.\n const pairs = asBars && compared\n // The data stops short of an edge that carries value labels: the right always, the left\n // only when the bars' own axis sits there. The end buckets sit further in by as far as\n // their bars reach, so the outermost bar, not its middle, lines up with the inset. The\n // bars are sized from the space between buckets, which the reach itself takes from, so it\n // is measured twice.\n const insetLeft = hasBars && !asBars && !hideValueAxis ? PLOT_INSET : 0\n const insetRight = hideValueAxis ? 0 : PLOT_INSET\n const times = data.map(point => point.date.getTime())\n const first = times[0] ?? 0\n const last = times[times.length - 1] ?? first\n // The renderer sizes bars from the closest two buckets, so a short month narrows them all.\n const closest = Math.min(...times.slice(1).map((time, index) => time - (times[index] ?? 0)))\n function reachAt(width: number) {\n if (!hasBars) return 0\n const bandwidth = last > first ? (BAR_SHARE * width * closest) / (last - first) : LONE_BANDWIDTH\n return measureBarReach(bandwidth, pairs)\n }\n const edgeSpan = plotWidth - insetLeft - insetRight\n const reach = reachAt(edgeSpan - reachAt(edgeSpan) * 2)\n const startOffset = insetLeft + reach\n const endOffset = insetRight + reach\n const bucketSpan = plotWidth - startOffset - endOffset\n // Labels are thinned to a pitch that fits the widest they are likely to run, read off the\n // first one: a minute's \"30 min ago\" needs more room than a day's \"Sep 6\". The end labels\n // sit under the end buckets, so the span between those holds them all.\n const firstDate = data[0]?.date\n const labelWidth = firstDate\n ? formatDate(firstDate).length * TICK_FONT_SIZE * TICK_CHARACTER_WIDTH\n : 0\n const tickPitch = Math.max(TICK_PITCH, labelWidth * 1.5)\n const tickCount = Math.max(2, Math.floor(bucketSpan / tickPitch) + 1)\n const previousLabel = `${label} (previous)`\n // A tap leaves the chart focused on the bucket it hit, and nothing on a touch screen ever\n // moves off it again, so lifting the finger dismisses the tooltip. After the tap's click\n // has run, which would otherwise focus the bucket again.\n const dismissTooltip = useRef<() => void>(undefined)\n const touched = useRef(false)\n function dismissAfterTouch() {\n if (touched.current) setTimeout(() => dismissTooltip.current?.(), 0)\n }\n function onLift(event: PointerEvent<HTMLDivElement>) {\n touched.current = event.pointerType !== \"mouse\"\n dismissAfterTouch()\n }\n\n const lastDate = data[data.length - 1]?.date\n const endOfLast = bucketEnd && lastDate ? bucketEnd(lastDate).getTime() : undefined\n // The tooltip reads a bucket's notes straight off the hovered point's row.\n const bucketed = bucketNotes(times, notes, endOfLast)\n const points: PlotPoint[] = data.map((point, index) => {\n const time = times[index] ?? 0\n // The bucket's end: the next bucket, or for the last one what `bucketEnd` says (else as\n // wide as the one before).\n const end = times[index + 1] ?? endOfLast ?? time + (time - (times[index - 1] ?? time))\n return { ...point, time, end, notes: bucketed.get(time) ?? [] }\n })\n const xTicks = pickTicks(times, Math.min(tickCount, points.length))\n const labels = new Map(xTicks.map(tick => [tick, formatDate(new Date(tick))]))\n // Grid, axis labels and the area's baseline: round lines over the data, or an explicit\n // domain split into equal intervals. Hidden behind the bars, so nothing to fit then. Every\n // line of a multi-series chart shares the one axis, so the scale spans them all.\n const values = asBars\n ? [0]\n : multi\n ? data.flatMap(point => lines.map(line => point.values?.[line.key] ?? 0))\n : data.flatMap(point => [\n point.value,\n ...(point.previous === undefined ? [] : [point.previous]),\n ])\n const max = Math.max(...values, 0)\n const totals = seriesTotals\n ? new Map(lines.map(line => [line.key, seriesTotal(data, line.key)]))\n : undefined\n const yTicks = domain\n ? domainTicks(domain)\n : niceTicks(max, { integer: values.every(Number.isInteger), format: formatTick })\n const [low, top] = domain ?? [0, yTicks[yTicks.length - 1] ?? 1]\n // The bar series rides its own left axis, over the same fixed intervals so both sets of labels\n // sit on the same grid lines. As an overlay its top is scaled to twice the tallest bar so the\n // bars fill about half the plot and read as a backdrop under the line, rather than towering\n // over it; as the main series it is the chart's scale.\n const bars = data.flatMap(point => [\n (point.bar ?? 0) + (point.outline ?? 0),\n ...(asBars && point.previous !== undefined ? [point.previous] : []),\n ])\n const barMax = Math.max(...bars, 0)\n const barTicks = niceTicks(asBars ? barMax : barMax * 2, {\n integer: bars.every(Number.isInteger),\n format: formatBarTick,\n })\n const barTop = barTicks[barTicks.length - 1] ?? 1\n\n /**\n * The hovered bucket's rows: the chart's own series first, its compared period under it, the\n * outline last, whatever the draw order. Several lines read largest first, so the tooltip's\n * order is the order the lines stack in at that point. A bucket that took no money and lost\n * none has no bar or outline row to report; a bar chart's own series stays whatever its value.\n */\n function tooltipItems(point: PlotPoint): ChartTooltipItem[] {\n const bar = point.bar ?? 0\n const outline = point.outline ?? 0\n const barRow: ChartTooltipItem[] =\n hasBars && (asBars || bar > 0)\n ? [\n {\n key: \"bar\",\n label: asBars ? label : barLabel,\n value: formatBarValue(bar),\n color: barColor,\n },\n ]\n : []\n\n if (multi) {\n const rows = lines\n .map(line => ({ line, value: point.values?.[line.key] ?? 0 }))\n .sort((a, b) => b.value - a.value)\n .map(({ line, value }) => ({\n key: line.key,\n label: line.label,\n value: formatValue(value),\n color: line.color,\n }))\n return [...rows, ...barRow]\n }\n\n const valueRow: ChartTooltipItem[] = asBars\n ? []\n : [{ key: \"value\", label, value: formatValue(point.value), color }]\n const previousRow: ChartTooltipItem[] =\n compared && point.previous !== undefined\n ? [\n {\n key: \"previous\",\n label: previousLabel,\n value: (asBars ? formatBarValue : formatValue)(point.previous),\n color: asBars ? previousColor : color,\n indicator: \"outline\",\n },\n ]\n : []\n const outlineRow: ChartTooltipItem[] =\n hasOutline && outline > 0\n ? [\n {\n key: \"outline\",\n label: outlineLabel,\n value: formatBarValue(outline),\n color: barColor,\n indicator: \"outline\",\n },\n ]\n : []\n\n return asBars\n ? [...barRow, ...previousRow, ...outlineRow]\n : [...valueRow, ...previousRow, ...barRow, ...outlineRow]\n }\n\n const curveFactory = curve === \"smooth\" ? curveMonotoneX : curveLinear\n const lineCurve = d3Curve(curveFactory)\n // The partial buckets at either end: the line reaches them dashed, on the same curve as the\n // solid part, and their bars are dashed outlines.\n const running = countRunning(data)\n const leading = countPartialStart(data)\n const split = running + leading > 0 ? splitCurve(curveFactory, running, leading) : undefined\n // The offsets are in pixels, so they are turned into time over the buckets' span.\n const span = Math.max(last - first, 1)\n const msPerPixel = bucketSpan > 0 ? span / bucketSpan : 0\n const timeDomain = [first - startOffset * msPerPixel, first + span + endOffset * msPerPixel]\n const pairLayout = group({\n scale: scaleBand<string>().domain([\"previous\", \"bar\"]).padding(PAIR_PADDING),\n })\n\n // Built on every render: the callers hand the chart fresh rows and formatters each time, so a\n // memo would never hold. A new definition rebuilds the scene, and keyed geometry that did not\n // change does not move.\n const definition = defineChart({\n marks: [\n // The area keeps the whole series' curve, so both parts of a split line run along its edge.\n ...(!asBars && !multi\n ? [\n areaY(points, {\n id: \"area\",\n x: \"time\",\n y1: low,\n y2: \"value\",\n fill: \"url(#fill)\",\n fillOpacity: 1,\n curve: lineCurve,\n }),\n ]\n : []),\n // The bars sit under the lines, so the line leads where the two cross.\n ...(pairs\n ? [\n barY(points, {\n id: \"previous\",\n x: \"time\",\n y1: 0,\n y2: point => point.previous ?? 0,\n z: () => \"previous\",\n yScale: \"bar\",\n fill: `url(#${hatchId})`,\n radius: [...BAR_RADIUS],\n maxThickness: BAR_MAX_WIDTH,\n layout: pairLayout,\n }),\n ]\n : []),\n // The outline spans the whole stack from zero, under the bar: the renderer grows a bar from\n // its `y1`, so one starting at the bar's top would float above a bar still in motion.\n ...(hasOutline\n ? [\n barY(points, {\n id: \"outline\",\n x: \"time\",\n y1: 0,\n y2: point => (point.bar ?? 0) + (point.outline ?? 0),\n z: () => \"bar\",\n yScale: \"bar\",\n fill: barColor,\n fillOpacity: 0.15,\n // The mark keeps every bucket, since it sizes its bars by their spacing, so a bucket\n // with nothing to outline hides its stroke.\n stroke: point => (isOutlined(point) ? barColor : \"transparent\"),\n strokeOpacity: 0.7,\n strokeDasharray: \"3 2\",\n strokeWidth: 1,\n // Inset by half the stroke, so the dashes sit inside the bar's width. A bar at its\n // cap is not inset, so the cap shrinks by the whole stroke.\n inset: 0.5,\n radius: [...BAR_RADIUS],\n maxThickness: BAR_MAX_WIDTH - 1,\n ...(pairs && { layout: pairLayout }),\n }),\n ]\n : []),\n ...(hasBars\n ? [\n // The card's colour under every bar, which is translucent, so a bar comes out one\n // colour whatever runs behind it: the area, a grid line, an outline's dashed sides.\n barY(points, {\n id: \"bar-mask\",\n x: \"time\",\n y1: 0,\n y2: point => (point.partial ? 0 : (point.bar ?? 0)),\n z: () => \"bar\",\n yScale: \"bar\",\n fill: \"var(--color-surface)\",\n radius: point => (isOutlined(point) ? 0 : [...BAR_RADIUS]),\n maxThickness: BAR_MAX_WIDTH,\n ...(pairs && { layout: pairLayout }),\n }),\n barY(points, {\n id: \"bar\",\n x: \"time\",\n y1: 0,\n y2: point => (point.partial ? 0 : (point.bar ?? 0)),\n z: () => \"bar\",\n yScale: \"bar\",\n fill: barColor,\n fillOpacity: 0.7,\n // Rounded on top, except where the outline stacks on it and rounds instead.\n radius: point => (isOutlined(point) ? 0 : [...BAR_RADIUS]),\n maxThickness: BAR_MAX_WIDTH,\n ...(pairs && { layout: pairLayout }),\n }),\n // A partial bucket's bar is a dashed outline, drawn as a refund's is, since its figure\n // covers only part of the bucket.\n ...(running + leading > 0\n ? [\n barY(points, {\n id: \"bar-running\",\n x: \"time\",\n y1: 0,\n y2: point => (point.partial ? (point.bar ?? 0) : 0),\n z: () => \"bar\",\n yScale: \"bar\",\n fill: barColor,\n fillOpacity: 0.15,\n // A running bucket with nothing in it yet draws nothing: a dashed stub on\n // the baseline would read as a figure.\n stroke: point =>\n point.partial && (point.bar ?? 0) > 0 ? barColor : \"transparent\",\n strokeOpacity: 0.7,\n strokeDasharray: \"3 2\",\n strokeWidth: 1,\n inset: 0.5,\n radius: [...BAR_RADIUS],\n maxThickness: BAR_MAX_WIDTH - 1,\n ...(pairs && { layout: pairLayout }),\n }),\n ]\n : []),\n ]\n : []),\n ...(compared && !asBars\n ? [\n lineY(points, {\n id: \"previous-line\",\n x: \"time\",\n y: point => point.previous,\n stroke: color,\n strokeWidth: 1.5,\n strokeDasharray: \"4 3\",\n // The same hue behind the solid line, light enough to stay behind it and strong\n // enough to read as a line of its own: 70% keeps it above 3:1 on the card.\n strokeOpacity: 0.7,\n curve: lineCurve,\n }),\n ]\n : []),\n ...(!asBars && !multi\n ? [\n lineY(points, {\n id: \"value\",\n x: \"time\",\n y: \"value\",\n stroke: color,\n strokeWidth: 2,\n curve: split?.complete ?? lineCurve,\n }),\n ...(split\n ? [\n lineY(points, {\n id: \"value-running\",\n x: \"time\",\n y: \"value\",\n stroke: color,\n strokeWidth: 2,\n strokeDasharray: \"4 4\",\n curve: split.running,\n }),\n ]\n : []),\n ]\n : []),\n ...lines.flatMap(line => [\n lineY(points, {\n id: `series-${line.key}`,\n x: \"time\",\n y: point => point.values?.[line.key] ?? 0,\n stroke: line.color,\n strokeWidth: 2,\n curve: split?.complete ?? lineCurve,\n }),\n ...(split\n ? [\n lineY(points, {\n id: `series-${line.key}-running`,\n x: \"time\",\n y: point => point.values?.[line.key] ?? 0,\n stroke: line.color,\n strokeWidth: 2,\n strokeDasharray: \"4 4\",\n curve: split.running,\n }),\n ]\n : []),\n ]),\n // The hover rule, drawn in mark order: over the lines and bars, under the dots. A\n // `crosshair` paints in a layer above every mark, dots included. The rule and dots jump to\n // the bucket with the tooltip rather than tweening after it.\n focusGuideX(points, {\n id: \"rule\",\n x: \"time\",\n y: () => low,\n match: \"x\",\n // Solid: a focus guide's rule is dashed by default.\n xRule: { stroke: \"var(--chart-rule)\", strokeOpacity: 1, strokeDasharray: \"none\" },\n motion: false,\n marker: false,\n }),\n // A dot on every line at the hovered bucket.\n ...(!asBars && !multi\n ? [\n focusGuideX(points, {\n id: \"value-marker\",\n x: \"time\",\n y: \"value\",\n match: \"x\",\n xRule: false,\n motion: false,\n marker: focusMarker(color),\n }),\n ]\n : []),\n ...(compared && !asBars\n ? [\n focusGuideX(points, {\n id: \"previous-marker\",\n x: \"time\",\n y: point => point.previous,\n match: \"x\",\n xRule: false,\n motion: false,\n marker: focusMarker(color),\n }),\n ]\n : []),\n ...lines.map(line =>\n focusGuideX(points, {\n id: `series-${line.key}-marker`,\n x: \"time\",\n y: point => point.values?.[line.key] ?? 0,\n match: \"x\",\n xRule: false,\n motion: false,\n marker: focusMarker(line.color),\n }),\n ),\n // Last, so the markers sit over the area they mark the baseline of. On the axis that\n // is shown: the bars' scale when they are the chart.\n noteMarkers([...bucketed.keys()], asBars ? 0 : low, asBars ? \"bar\" : \"y\", noteColor),\n ],\n scales: {\n // A continuous time axis, for bars too: the renderer sizes them from the space between\n // buckets, and a compared pair splits that space between its two bars.\n x: {\n scale: scaleLinear().domain(timeDomain),\n axis: {\n // Labels change place with the range or the shape; they snap there rather than\n // sliding across the plot.\n motion: false,\n line: false,\n ticks: {\n values: xTicks,\n size: 0,\n padding: 12,\n format: (time: number) => labels.get(time) ?? \"\",\n },\n tickLabels: {\n fontSize: TICK_FONT_SIZE,\n opacity: 1,\n thin: false,\n // With no inset on a side the date there would hang past the plot, so it lines up\n // with where the data starts or stops.\n anchor: ({ value }) => {\n if (value === first && !insetLeft) return \"start\"\n return value === last && !insetRight ? \"end\" : \"middle\"\n },\n dx: ({ value }) => {\n if (value === first && !insetLeft) return -reach\n return value === last && !insetRight ? reach : 0\n },\n },\n },\n },\n // The line's axis; hidden behind the bars, which carry their own on this side.\n y: {\n scale: scaleLinear().domain([low, top > low ? top : low + 1]),\n side: \"right\",\n grid: asBars ? false : GRID,\n axis: asBars\n ? false\n : {\n motion: false,\n line: false,\n ticks: {\n values: yTicks,\n size: 0,\n padding: 0,\n format: hideValueAxis ? formatNoTick : formatTick,\n },\n tickLabels: {\n fontSize: TICK_FONT_SIZE,\n opacity: 1,\n anchor: \"end\",\n dy: -LABEL_RISE,\n thin: false,\n },\n },\n },\n ...(hasBars && {\n bar: {\n channel: \"y\" as const,\n scale: scaleLinear().domain([0, barTop]),\n // Beside a line the bar's own scale sits opposite it; as the chart itself it takes\n // the side every other chart's values are read on.\n side: asBars ? (\"right\" as const) : (\"left\" as const),\n grid: asBars ? GRID : false,\n axis: {\n motion: false,\n line: false,\n ticks: {\n values: barTicks,\n size: 0,\n padding: 0,\n format: hideValueAxis ? formatNoTick : formatBarTick,\n },\n tickLabels: {\n fontSize: TICK_FONT_SIZE,\n opacity: 1,\n anchor: asBars ? (\"end\" as const) : (\"start\" as const),\n dy: -LABEL_RISE,\n thin: false,\n },\n },\n },\n }),\n },\n gradients: [\n {\n id: \"fill\",\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 1,\n stops: AREA_FADE.map(stop => ({ ...stop, color })),\n },\n ],\n theme: {\n foreground: \"var(--color-ink)\",\n muted: \"var(--color-ink-muted)\",\n grid: \"var(--color-edge)\",\n background: \"transparent\",\n },\n // The value labels sit inside the plot, so neither side reserves room for them: an\n // authored side replaces the renderer's measured margin. The top leaves room for the\n // highest label, which rises above the top grid line.\n margin: { top: 8 + LABEL_RISE, right: 0, left: 0 },\n focus: \"group-x\",\n maxFocusDistance: Number.POSITIVE_INFINITY,\n focusRing: false,\n tooltip: {\n use: tooltip,\n // Pinned to the plot's top, a tooltip with notes grows past the card's bottom edge, and\n // the card clips its content. The top layer lets it overhang the card instead.\n portal,\n // A click runs the caller's action, so it never pins the tooltip.\n sticky: false,\n motion: false,\n anchor: { x: \"value\", y: \"plot-top\" },\n placement: [\"bottom-right\", \"bottom-left\"],\n offset: 12,\n },\n })\n\n return (\n <div\n ref={setElement}\n className={cn(\n // The hover rule, a quarter of the ink, darkens under a press on a chart that acts on one.\n \"flex flex-col [--chart-rule:color-mix(in_oklab,var(--color-ink)_25%,transparent)]\",\n onPointClick && \"cursor-pointer active:[--chart-rule:var(--color-ink-secondary)]\",\n className,\n )}\n {...props}\n onPointerUp={onLift}\n onPointerCancel={onLift}\n >\n {multi && <SeriesLegend series={lines} totals={totals} formatValue={formatValue} />}\n {/* The compared period's bars: diagonal hatching in the bars' colour, which reads as \"the\n earlier one\" beside a solid bar without a legend. A chart declares gradients but not\n patterns, so the pattern lives in its own empty SVG and the bars reach it by id. */}\n <svg aria-hidden className=\"absolute size-0\">\n <defs>\n <pattern\n id={hatchId}\n width=\"5\"\n height=\"5\"\n patternUnits=\"userSpaceOnUse\"\n patternTransform=\"rotate(45)\"\n >\n <rect width=\"5\" height=\"5\" fill={barColor} fillOpacity={0.12} />\n <line\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"5\"\n stroke={barColor}\n strokeWidth=\"1.5\"\n strokeOpacity={0.55}\n />\n </pattern>\n </defs>\n </svg>\n {/* The plot runs to the SVG's edges, so the hovered dot on the first point and the\n note markers on the baseline would be clipped by the SVG box; let them overflow\n into the card's padding instead. The tooltip's own chrome is the panel inside it. */}\n {plotted ? (\n <RendererChart\n definition={definition}\n renderer={RENDERER}\n ariaLabel={label}\n height={PLOT_HEIGHT}\n className={cn(\n // A sideways drag scrubs through the buckets; an upright one still scrolls the page.\n \"w-full touch-pan-y text-xs [&_svg]:overflow-visible\",\n // The plot takes focus on a click as well as a key press, and Chrome then draws the\n // focus ring around all of it. Focus already shows as the guide and the tooltip on\n // the focused bucket, which a key press moves to straight away.\n \"[&_svg]:outline-none\",\n // Value labels set on even digits, so a column of figures lines up.\n \"[&_[data-ts-key^=bar-tick-label]]:tabular-nums [&_[data-ts-key^=y-tick-label]]:tabular-nums\",\n // Value labels sit over the plot; a card-coloured outline keeps them legible where\n // the line or a bar passes under them.\n \"[&_[data-ts-key^=bar-tick-label]]:stroke-surface [&_[data-ts-key^=bar-tick-label]]:stroke-3 [&_[data-ts-key^=bar-tick-label]]:[paint-order:stroke] [&_[data-ts-key^=y-tick-label]]:stroke-surface [&_[data-ts-key^=y-tick-label]]:stroke-3 [&_[data-ts-key^=y-tick-label]]:[paint-order:stroke]\",\n \"[--ts-chart-tooltip-background:transparent] [--ts-chart-tooltip-border:none] [--ts-chart-tooltip-max-width:none] [--ts-chart-tooltip-padding:0] [--ts-chart-tooltip-shadow:none]\",\n )}\n onSelect={point => {\n dismissAfterTouch()\n if (!point || !onPointClick) return\n onPointClick(point.datum.date, new Date(point.datum.end))\n }}\n renderTooltipBody={({ points: focused, dismiss }) => {\n dismissTooltip.current = dismiss\n const point = focused[0]?.datum\n if (!point) return null\n return (\n <ChartTooltipContent\n title={formatTooltipDate(point.date)}\n items={tooltipItems(point)}\n details={point.details}\n // Bounded rather than fixed: the floor keeps a bucket with no notes from\n // shrinking to its figures, the cap makes a note truncate rather than widen the\n // tooltip over the chart it reports on. Between the two it moves at most 32px\n // from one bucket to the next.\n className=\"min-w-48 max-w-56\"\n footer={\n <NotesFooter\n notes={point.notes}\n bucket={point.time}\n end={point.end}\n hint={onPointClick ? pointClickHint : undefined}\n color={noteColor}\n formatDate={formatNoteDate}\n />\n }\n />\n )\n }}\n />\n ) : (\n <div className=\"w-full\" style={{ height: PLOT_HEIGHT }} />\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoDA,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAElB,MAAM,aAAa;;;;;AAOnB,MAAM,aAAa;AACnB,MAAM,cAAc;;AAEpB,MAAM,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|
+
import { CancelCircleIcon, CheckCircleIcon, HelpIcon, LoadingIcon } from "../lib/icons.js";
|
|
3
|
+
import { cn } from "../lib/variants.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Toaster as Toaster$1 } from "sonner";
|
|
6
|
+
// src/components/toaster.tsx
|
|
7
|
+
function Toaster({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Toaster$1, {
|
|
9
|
+
className: "pointer-events-auto font-sans antialiased",
|
|
10
|
+
offset: 16,
|
|
11
|
+
gap: 8,
|
|
12
|
+
duration: 6e3,
|
|
13
|
+
closeButton: true,
|
|
14
|
+
mobileOffset: {
|
|
15
|
+
bottom: "calc(16px + env(safe-area-inset-bottom))",
|
|
16
|
+
left: 16,
|
|
17
|
+
right: 16
|
|
18
|
+
},
|
|
19
|
+
toastOptions: {
|
|
20
|
+
unstyled: true,
|
|
21
|
+
classNames: {
|
|
22
|
+
toast: cn("flex w-full items-start gap-2.5 px-3.5 py-3 font-medium", "text-control", popupSurfaceClasses, "[&[data-expanded=false][data-front=false]>*]:opacity-0", className),
|
|
23
|
+
success: "[&>[data-icon]]:text-success-ink",
|
|
24
|
+
error: "[&>[data-icon]]:text-danger-ink",
|
|
25
|
+
info: "[&>[data-icon]]:text-ink-muted",
|
|
26
|
+
loading: "[&>[data-icon]]:text-ink-muted",
|
|
27
|
+
content: "min-w-0 grow",
|
|
28
|
+
description: "mt-0.5 font-normal text-copy text-ink-muted",
|
|
29
|
+
icon: "relative mt-px size-4 shrink-0",
|
|
30
|
+
closeButton: "order-last -m-1 -mt-0.75 size-6 shrink-0 cursor-pointer rounded-sm p-1 text-ink-muted transition-colors hover:text-ink [&>svg]:size-full"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
icons: {
|
|
34
|
+
info: /* @__PURE__ */ jsx(HelpIcon, { className: "size-4" }),
|
|
35
|
+
success: /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-4" }),
|
|
36
|
+
error: /* @__PURE__ */ jsx(CancelCircleIcon, { className: "size-4" }),
|
|
37
|
+
loading: /* @__PURE__ */ jsx(LoadingIcon, { className: "size-4 animate-spin" })
|
|
38
|
+
},
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { Toaster };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=toaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toaster.js","names":["Sonner"],"sources":["../../src/components/toaster.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\"\nimport { Toaster as Sonner } from \"sonner\"\nimport { popupSurfaceClasses } from \"../lib/classes\"\nimport { CancelCircleIcon, CheckCircleIcon, HelpIcon, LoadingIcon } from \"../lib/icons\"\nimport { cn } from \"../lib/variants\"\n\nexport function Toaster({ className, ...props }: ComponentProps<typeof Sonner>) {\n return (\n <Sonner\n className=\"pointer-events-auto font-sans antialiased\"\n offset={16}\n gap={8}\n /*\n * Sonner's own default is 4s, which is under the time it takes to read a two-line\n * message, and a toast that leaves on its own is the only copy of what it said. The\n * close button is what a reader who is done with it uses instead of waiting. A message\n * that must not expire at all passes `duration: Infinity` when it is raised.\n */\n duration={6000}\n closeButton\n mobileOffset={{ bottom: \"calc(16px + env(safe-area-inset-bottom))\", left: 16, right: 16 }}\n toastOptions={{\n unstyled: true,\n classNames: {\n /*\n * A toast is drawn on the same card as every menu and picker, so it reads as part of\n * the app rather than a coloured banner over it. The type lives in the icon alone:\n * sonner joins `toast` with exactly one type key per toast as a plain string, so a\n * per-type class here is never merged away. A toast behind the front one collapses\n * to the front toast's height, so its content is hidden or it would show through.\n */\n toast: cn(\n \"flex w-full items-start gap-2.5 px-3.5 py-3 font-medium\",\n \"text-control\",\n popupSurfaceClasses,\n \"[&[data-expanded=false][data-front=false]>*]:opacity-0\",\n className,\n ),\n success: \"[&>[data-icon]]:text-success-ink\",\n error: \"[&>[data-icon]]:text-danger-ink\",\n info: \"[&>[data-icon]]:text-ink-muted\",\n loading: \"[&>[data-icon]]:text-ink-muted\",\n content: \"min-w-0 grow\",\n description: \"mt-0.5 font-normal text-copy text-ink-muted\",\n icon: \"relative mt-px size-4 shrink-0\",\n // Sonner renders the close button first and parks it in the corner with styles the\n // unstyled toast never loads, so it is ordered to the end of the row here instead. Its\n // 16px glyph sits in a 24px target, pulled back by the margins so the row keeps its size.\n closeButton:\n \"order-last -m-1 -mt-0.75 size-6 shrink-0 cursor-pointer rounded-sm p-1 text-ink-muted transition-colors hover:text-ink [&>svg]:size-full\",\n },\n }}\n icons={{\n info: <HelpIcon className=\"size-4\" />,\n success: <CheckCircleIcon className=\"size-4\" />,\n error: <CancelCircleIcon className=\"size-4\" />,\n loading: <LoadingIcon className=\"size-4 animate-spin\" />,\n }}\n {...props}\n />\n )\n}\n"],"mappings":";;;;;;AAMA,SAAgB,QAAQ,EAAE,WAAW,GAAG,SAAwC;CAC9E,OACE,oBAACA,WAAD;EACE,WAAU;EACV,QAAQ;EACR,KAAK;EAOL,UAAU;EACV,aAAA;EACA,cAAc;GAAE,QAAQ;GAA4C,MAAM;GAAI,OAAO;EAAG;EACxF,cAAc;GACZ,UAAU;GACV,YAAY;IAQV,OAAO,GACL,2DACA,gBACA,qBACA,0DACA,SACF;IACA,SAAS;IACT,OAAO;IACP,MAAM;IACN,SAAS;IACT,SAAS;IACT,aAAa;IACb,MAAM;IAIN,aACE;GACJ;EACF;EACA,OAAO;GACL,MAAM,oBAAC,UAAD,EAAU,WAAU,SAAU,CAAA;GACpC,SAAS,oBAAC,iBAAD,EAAiB,WAAU,SAAU,CAAA;GAC9C,OAAO,oBAAC,kBAAD,EAAkB,WAAU,SAAU,CAAA;GAC7C,SAAS,oBAAC,aAAD,EAAa,WAAU,sBAAuB,CAAA;EACzD;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ComponentProps, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
3
|
+
export interface TooltipFigure {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
value: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A heading over a small table of labelled figures: what a tooltip holds when it reports on
|
|
9
|
+
* something rather than explaining a control. One component so every such tooltip in the app
|
|
10
|
+
* is composed the same way, whichever surface raised it: a breakdown row, a point on a chart.
|
|
11
|
+
* The figures right-align as a block against the labels, so the numbers read down a column.
|
|
12
|
+
*/
|
|
13
|
+
export declare function TooltipFigures({ title, figures }: {
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
figures: TooltipFigure[];
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
declare const TooltipRoot: <Payload>(props: Tooltip$1.Root.Props<Payload>) => React.JSX.Element;
|
|
18
|
+
declare const TooltipTrigger: Tooltip$1.Trigger;
|
|
19
|
+
/**
|
|
20
|
+
* `default` is one line beside its anchor. Its ceiling sits far above a label's length, so a
|
|
21
|
+
* sentence of explanation stays on one line too, and text that does run past it wraps
|
|
22
|
+
* left-aligned: a centred ragged block reads as a mistake. `rich` is a small panel: roomier,
|
|
23
|
+
* for a stack of labelled figures rather than a sentence. The panel has a floor as well as a
|
|
24
|
+
* ceiling on its width, so a short report ("Russia", four figures) gets the same room as a
|
|
25
|
+
* long one and the two never read as different tooltips.
|
|
26
|
+
*/
|
|
27
|
+
type TooltipVariant = "default" | "rich";
|
|
28
|
+
/**
|
|
29
|
+
* A tooltip's panel on its own, for a surface something other than the tooltip primitive
|
|
30
|
+
* positions: a chart's hover card, a map's. It looks exactly like `TooltipContent`, which
|
|
31
|
+
* it shares its classes with, so a report reads the same wherever it pops up.
|
|
32
|
+
*/
|
|
33
|
+
declare function TooltipPanel({ variant, className, ...props }: ComponentProps<"div"> & {
|
|
34
|
+
variant?: TooltipVariant;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
36
|
+
/**
|
|
37
|
+
* The offset is measured to the panel's edge, and the arrow hangs 6px beyond it. Eight leaves a
|
|
38
|
+
* 2px gap between the arrow's tip and the anchor, so the tip never touches what it points at.
|
|
39
|
+
*/
|
|
40
|
+
declare function TooltipContent({ className, sideOffset, side, align, variant, children, ...props }: Tooltip$1.Popup.Props & Pick<Tooltip$1.Positioner.Props, "sideOffset" | "side" | "align"> & {
|
|
41
|
+
variant?: TooltipVariant;
|
|
42
|
+
}): import("react").JSX.Element;
|
|
43
|
+
/**
|
|
44
|
+
* The shared delay for every tooltip, and the single popup they all share. One popup means the
|
|
45
|
+
* pointer moving from one trigger to the next slides the panel over rather than closing it and
|
|
46
|
+
* opening another in place, which is why each `Tooltip` renders a trigger and nothing else.
|
|
47
|
+
*/
|
|
48
|
+
declare function TooltipProvider({ children, ...props }: Tooltip$1.Provider.Props): import("react").JSX.Element;
|
|
49
|
+
interface TooltipProps extends Pick<Tooltip$1.Positioner.Props, "side" | "align"> {
|
|
50
|
+
/** Names the trigger for `showTooltip`. The element keeps an id of its own, if it has one. */
|
|
51
|
+
id?: string;
|
|
52
|
+
children: ReactElement;
|
|
53
|
+
tooltip: ReactNode;
|
|
54
|
+
variant?: TooltipVariant;
|
|
55
|
+
/** Classes for the panel, e.g. a width a variant's own ceiling is too low for. */
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
declare function Tooltip({ id, children, tooltip, side, align, variant, className }: TooltipProps): import("react").JSX.Element;
|
|
59
|
+
/**
|
|
60
|
+
* Opens the tooltip of the trigger with this `id`. A tooltip opens on hover and keyboard focus
|
|
61
|
+
* alone, so a tap on a touch screen needs this to show one.
|
|
62
|
+
*/
|
|
63
|
+
declare function showTooltip(triggerId: string): void;
|
|
64
|
+
export { Tooltip, TooltipContent, TooltipPanel, TooltipProvider, TooltipRoot, TooltipTrigger, showTooltip };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { tooltipAnimationClasses, tooltipSurfaceClasses } from "../lib/classes.js";
|
|
3
|
+
import { cn } from "../lib/variants.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as Fragment$1 } from "react";
|
|
6
|
+
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
7
|
+
// src/components/tooltip.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A heading over a small table of labelled figures: what a tooltip holds when it reports on
|
|
10
|
+
* something rather than explaining a control. One component so every such tooltip in the app
|
|
11
|
+
* is composed the same way, whichever surface raised it: a breakdown row, a point on a chart.
|
|
12
|
+
* The figures right-align as a block against the labels, so the numbers read down a column.
|
|
13
|
+
*/
|
|
14
|
+
function TooltipFigures({ title, figures }) {
|
|
15
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [title && /* @__PURE__ */ jsx("div", {
|
|
16
|
+
className: "font-medium break-words",
|
|
17
|
+
children: title
|
|
18
|
+
}), figures.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
19
|
+
className: "mt-1.5 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1",
|
|
20
|
+
children: figures.map((figure, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "text-ink-muted",
|
|
22
|
+
children: figure.label
|
|
23
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
24
|
+
className: "text-right font-medium tabular-nums whitespace-nowrap",
|
|
25
|
+
children: figure.value
|
|
26
|
+
})] }, index))
|
|
27
|
+
})] });
|
|
28
|
+
}
|
|
29
|
+
const TooltipRoot = Tooltip$1.Root;
|
|
30
|
+
const TooltipTrigger = Tooltip$1.Trigger;
|
|
31
|
+
const tooltipVariantClasses = {
|
|
32
|
+
default: "max-w-[min(32rem,calc(100vw-2rem))] inline-flex items-center gap-2 px-3 py-1.5 text-start",
|
|
33
|
+
rich: "pointer-events-none block min-w-44 max-w-72 px-3 py-2 text-start"
|
|
34
|
+
};
|
|
35
|
+
/** The tooltip surface with a variant's shape: what every tooltip panel in the app is made of. */
|
|
36
|
+
function tooltipPanelClasses(variant) {
|
|
37
|
+
return cn(tooltipSurfaceClasses, tooltipVariantClasses[variant]);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A tooltip's panel on its own, for a surface something other than the tooltip primitive
|
|
41
|
+
* positions: a chart's hover card, a map's. It looks exactly like `TooltipContent`, which
|
|
42
|
+
* it shares its classes with, so a report reads the same wherever it pops up.
|
|
43
|
+
*/
|
|
44
|
+
function TooltipPanel({ variant = "default", className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: cn(tooltipPanelClasses(variant), className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The pointer from the popup to its anchor: a 12×6 window on a square of the popup's own fill
|
|
52
|
+
* stood on its corner, so what shows is a wide shallow triangle rather than the steep notch a
|
|
53
|
+
* whole corner cuts. The window clips the half that would fall inside the panel, which is what
|
|
54
|
+
* leaves the hairline running down both slopes and open across the base where the two meet.
|
|
55
|
+
* Base UI places the window along the anchor and says which side the popup is on.
|
|
56
|
+
*/
|
|
57
|
+
function TooltipArrow() {
|
|
58
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Arrow, {
|
|
59
|
+
className: cn("tooltip-arrow relative block h-[6px] w-3 overflow-clip", "data-[side=bottom]:-top-[6px]", "data-[side=top]:-bottom-[6px] data-[side=top]:rotate-180", "data-[side=left]:-right-[9px] data-[side=left]:rotate-90", "data-[side=right]:-left-[9px] data-[side=right]:-rotate-90"),
|
|
60
|
+
children: /* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-1/2 size-[calc(0.375rem*1.4142)] -translate-x-1/2 translate-y-1/2 rotate-45 rounded-tl-[3px] border border-edge-float bg-overlay" })
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The offset is measured to the panel's edge, and the arrow hangs 6px beyond it. Eight leaves a
|
|
65
|
+
* 2px gap between the arrow's tip and the anchor, so the tip never touches what it points at.
|
|
66
|
+
*/
|
|
67
|
+
function TooltipContent({ className, sideOffset = 8, side, align, variant = "default", children, ...props }) {
|
|
68
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
69
|
+
sideOffset,
|
|
70
|
+
side,
|
|
71
|
+
align,
|
|
72
|
+
className: "tooltip-positioner isolate z-50",
|
|
73
|
+
children: /* @__PURE__ */ jsxs(Tooltip$1.Popup, {
|
|
74
|
+
className: cn("relative z-50", tooltipPanelClasses(variant), tooltipAnimationClasses, className),
|
|
75
|
+
...props,
|
|
76
|
+
children: [/* @__PURE__ */ jsx(TooltipArrow, {}), children]
|
|
77
|
+
})
|
|
78
|
+
}) });
|
|
79
|
+
}
|
|
80
|
+
const tooltipHandle = Tooltip$1.createHandle();
|
|
81
|
+
/**
|
|
82
|
+
* The shared delay for every tooltip, and the single popup they all share. One popup means the
|
|
83
|
+
* pointer moving from one trigger to the next slides the panel over rather than closing it and
|
|
84
|
+
* opening another in place, which is why each `Tooltip` renders a trigger and nothing else.
|
|
85
|
+
*/
|
|
86
|
+
function TooltipProvider({ children, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsxs(Tooltip$1.Provider, {
|
|
88
|
+
...props,
|
|
89
|
+
children: [children, /* @__PURE__ */ jsx(TooltipRoot, {
|
|
90
|
+
handle: tooltipHandle,
|
|
91
|
+
disableHoverablePopup: true,
|
|
92
|
+
children: ({ payload }) => /* @__PURE__ */ jsx(TooltipContent, {
|
|
93
|
+
side: payload?.side,
|
|
94
|
+
align: payload?.align,
|
|
95
|
+
variant: payload?.variant ?? "default",
|
|
96
|
+
className: payload?.className,
|
|
97
|
+
children: payload?.content
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function Tooltip({ id, children, tooltip, side, align, variant = "default", className }) {
|
|
103
|
+
if (!tooltip) return children;
|
|
104
|
+
return /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
105
|
+
id,
|
|
106
|
+
handle: tooltipHandle,
|
|
107
|
+
payload: {
|
|
108
|
+
content: tooltip,
|
|
109
|
+
variant,
|
|
110
|
+
side,
|
|
111
|
+
align,
|
|
112
|
+
className
|
|
113
|
+
},
|
|
114
|
+
render: children
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Opens the tooltip of the trigger with this `id`. A tooltip opens on hover and keyboard focus
|
|
119
|
+
* alone, so a tap on a touch screen needs this to show one.
|
|
120
|
+
*/
|
|
121
|
+
function showTooltip(triggerId) {
|
|
122
|
+
tooltipHandle.open(triggerId);
|
|
123
|
+
}
|
|
124
|
+
export { Tooltip, TooltipContent, TooltipFigures, TooltipPanel, TooltipProvider, TooltipRoot, TooltipTrigger, showTooltip };
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltip.js","names":["Fragment","TooltipPrimitive"],"sources":["../../src/components/tooltip.tsx"],"sourcesContent":["\"use client\"\n\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\"\nimport { type ComponentProps, Fragment, type ReactElement, type ReactNode } from \"react\"\nimport { tooltipAnimationClasses, tooltipLabelClasses, tooltipSurfaceClasses } from \"../lib/classes\"\nimport { cn } from \"../lib/variants\"\n\nexport interface TooltipFigure {\n label: ReactNode\n value: ReactNode\n}\n\n/**\n * A heading over a small table of labelled figures: what a tooltip holds when it reports on\n * something rather than explaining a control. One component so every such tooltip in the app\n * is composed the same way, whichever surface raised it: a breakdown row, a point on a chart.\n * The figures right-align as a block against the labels, so the numbers read down a column.\n */\nexport function TooltipFigures({\n title,\n figures,\n}: {\n title?: ReactNode\n figures: TooltipFigure[]\n}) {\n return (\n <>\n {title && <div className=\"font-medium break-words\">{title}</div>}\n {figures.length > 0 && (\n <div className=\"mt-1.5 grid grid-cols-[auto_1fr] gap-x-6 gap-y-1\">\n {figures.map((figure, index) => (\n <Fragment key={index}>\n <span className={tooltipLabelClasses}>{figure.label}</span>\n {/* The figures carry the weight and the labels are muted, so the eye runs down\n the numbers and reads a label only where it stops. A figure never wraps: the\n label beside it gives way instead. */}\n <span className=\"text-right font-medium tabular-nums whitespace-nowrap\">\n {figure.value}\n </span>\n </Fragment>\n ))}\n </div>\n )}\n </>\n )\n}\n\nconst TooltipRoot = TooltipPrimitive.Root\nconst TooltipTrigger = TooltipPrimitive.Trigger\n\n/**\n * `default` is one line beside its anchor. Its ceiling sits far above a label's length, so a\n * sentence of explanation stays on one line too, and text that does run past it wraps\n * left-aligned: a centred ragged block reads as a mistake. `rich` is a small panel: roomier,\n * for a stack of labelled figures rather than a sentence. The panel has a floor as well as a\n * ceiling on its width, so a short report (\"Russia\", four figures) gets the same room as a\n * long one and the two never read as different tooltips.\n */\ntype TooltipVariant = \"default\" | \"rich\"\n\nconst tooltipVariantClasses: Record<TooltipVariant, string> = {\n default:\n \"max-w-[min(32rem,calc(100vw-2rem))] inline-flex items-center gap-2 px-3 py-1.5 text-start\",\n rich: \"pointer-events-none block min-w-44 max-w-72 px-3 py-2 text-start\",\n}\n\n/** The tooltip surface with a variant's shape: what every tooltip panel in the app is made of. */\nfunction tooltipPanelClasses(variant: TooltipVariant) {\n return cn(tooltipSurfaceClasses, tooltipVariantClasses[variant])\n}\n\n/**\n * A tooltip's panel on its own, for a surface something other than the tooltip primitive\n * positions: a chart's hover card, a map's. It looks exactly like `TooltipContent`, which\n * it shares its classes with, so a report reads the same wherever it pops up.\n */\nfunction TooltipPanel({\n variant = \"default\",\n className,\n ...props\n}: ComponentProps<\"div\"> & { variant?: TooltipVariant }) {\n return <div className={cn(tooltipPanelClasses(variant), className)} {...props} />\n}\n\n/**\n * The pointer from the popup to its anchor: a 12×6 window on a square of the popup's own fill\n * stood on its corner, so what shows is a wide shallow triangle rather than the steep notch a\n * whole corner cuts. The window clips the half that would fall inside the panel, which is what\n * leaves the hairline running down both slopes and open across the base where the two meet.\n * Base UI places the window along the anchor and says which side the popup is on.\n */\nfunction TooltipArrow() {\n return (\n <TooltipPrimitive.Arrow\n className={cn(\n \"tooltip-arrow relative block h-[6px] w-3 overflow-clip\",\n // The offsets are measured from inside the panel's border, so pulling the window its own\n // depth lands it over that border: the fill opens the line across the mouth and the\n // slopes start where the line stops, not a pixel inside or outside it.\n \"data-[side=bottom]:-top-[6px]\",\n \"data-[side=top]:-bottom-[6px] data-[side=top]:rotate-180\",\n \"data-[side=left]:-right-[9px] data-[side=left]:rotate-90\",\n \"data-[side=right]:-left-[9px] data-[side=right]:-rotate-90\",\n )}\n >\n {/* The corner that ends up as the tip is rounded, so the point reads as drawn rather\n than as a shard of the panel. */}\n <div className=\"absolute bottom-0 left-1/2 size-[calc(0.375rem*1.4142)] -translate-x-1/2 translate-y-1/2 rotate-45 rounded-tl-[3px] border border-edge-float bg-overlay\" />\n </TooltipPrimitive.Arrow>\n )\n}\n\n/**\n * The offset is measured to the panel's edge, and the arrow hangs 6px beyond it. Eight leaves a\n * 2px gap between the arrow's tip and the anchor, so the tip never touches what it points at.\n */\nfunction TooltipContent({\n className,\n sideOffset = 8,\n side,\n align,\n variant = \"default\",\n children,\n ...props\n}: TooltipPrimitive.Popup.Props &\n Pick<TooltipPrimitive.Positioner.Props, \"sideOffset\" | \"side\" | \"align\"> & {\n variant?: TooltipVariant\n }) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Positioner\n sideOffset={sideOffset}\n side={side}\n align={align}\n className=\"tooltip-positioner isolate z-50\"\n >\n <TooltipPrimitive.Popup\n className={cn(\n \"relative z-50\",\n tooltipPanelClasses(variant),\n tooltipAnimationClasses,\n className,\n )}\n {...props}\n >\n <TooltipArrow />\n {children}\n </TooltipPrimitive.Popup>\n </TooltipPrimitive.Positioner>\n </TooltipPrimitive.Portal>\n )\n}\n\n/**\n * What a trigger hands the shared popup: its content and the shape to draw it in. Base UI keeps\n * the payload of whichever trigger is active, so the panel re-reads all of it on every move and\n * a plain tooltip can hand over to a rich one without closing.\n */\ninterface TooltipPayload {\n content: ReactNode\n variant: TooltipVariant\n side: TooltipPrimitive.Positioner.Props[\"side\"]\n align: TooltipPrimitive.Positioner.Props[\"align\"]\n /** Classes for the panel, e.g. a width a variant's own ceiling is too low for. */\n className?: string\n}\n\nconst tooltipHandle = TooltipPrimitive.createHandle<TooltipPayload>()\n\n/**\n * The shared delay for every tooltip, and the single popup they all share. One popup means the\n * pointer moving from one trigger to the next slides the panel over rather than closing it and\n * opening another in place, which is why each `Tooltip` renders a trigger and nothing else.\n */\nfunction TooltipProvider({ children, ...props }: TooltipPrimitive.Provider.Props) {\n return (\n <TooltipPrimitive.Provider {...props}>\n {children}\n\n {/* A tooltip explains or reports; nothing in it is clicked, so it closes the moment the\n pointer leaves the trigger rather than lingering while the pointer crosses the popup. */}\n <TooltipRoot handle={tooltipHandle} disableHoverablePopup>\n {({ payload }) => (\n <TooltipContent\n side={payload?.side}\n align={payload?.align}\n variant={payload?.variant ?? \"default\"}\n className={payload?.className}\n >\n {payload?.content}\n </TooltipContent>\n )}\n </TooltipRoot>\n </TooltipPrimitive.Provider>\n )\n}\n\ninterface TooltipProps extends Pick<TooltipPrimitive.Positioner.Props, \"side\" | \"align\"> {\n /** Names the trigger for `showTooltip`. The element keeps an id of its own, if it has one. */\n id?: string\n children: ReactElement\n tooltip: ReactNode\n variant?: TooltipVariant\n /** Classes for the panel, e.g. a width a variant's own ceiling is too low for. */\n className?: string\n}\n\nfunction Tooltip({\n id,\n children,\n tooltip,\n side,\n align,\n variant = \"default\",\n className,\n}: TooltipProps) {\n if (!tooltip) return children\n\n return (\n <TooltipTrigger\n id={id}\n handle={tooltipHandle}\n payload={{ content: tooltip, variant, side, align, className }}\n render={children}\n />\n )\n}\n\n/**\n * Opens the tooltip of the trigger with this `id`. A tooltip opens on hover and keyboard focus\n * alone, so a tap on a touch screen needs this to show one.\n */\nfunction showTooltip(triggerId: string) {\n tooltipHandle.open(triggerId)\n}\n\nexport {\n showTooltip,\n Tooltip,\n TooltipRoot,\n TooltipTrigger,\n TooltipContent,\n TooltipPanel,\n TooltipProvider,\n}\n"],"mappings":";;;;;;;;;;;;;AAkBA,SAAgB,eAAe,EAC7B,OACA,WAIC;CACD,OACE,qBAAA,UAAA,EAAA,UAAA,CACG,SAAS,oBAAC,OAAD;EAAK,WAAU;EAA2B,UAAA;CAAW,CAAA,GAC9D,QAAQ,SAAS,KAChB,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,QAAQ,KAAK,QAAQ,UACpB,qBAACA,YAAD,EAAA,UAAA,CACE,oBAAC,QAAD;GAAM,WAAA;GAAiC,UAAA,OAAO;EAAY,CAAA,GAI1D,oBAAC,QAAD;GAAM,WAAU;GACb,UAAA,OAAO;EACJ,CAAA,CACE,EAAA,GARK,KAQL,CACX;CACE,CAAA,CAEP,EAAA,CAAA;AAEN;AAEA,MAAM,cAAcC,UAAiB;AACrC,MAAM,iBAAiBA,UAAiB;AAYxC,MAAM,wBAAwD;CAC5D,SACE;CACF,MAAM;AACR;;AAGA,SAAS,oBAAoB,SAAyB;CACpD,OAAO,GAAG,uBAAuB,sBAAsB,QAAQ;AACjE;;;;;;AAOA,SAAS,aAAa,EACpB,UAAU,WACV,WACA,GAAG,SACoD;CACvD,OAAO,oBAAC,OAAD;EAAK,WAAW,GAAG,oBAAoB,OAAO,GAAG,SAAS;EAAG,GAAI;CAAQ,CAAA;AAClF;;;;;;;;AASA,SAAS,eAAe;CACtB,OACE,oBAACA,UAAiB,OAAlB;EACE,WAAW,GACT,0DAIA,iCACA,4DACA,4DACA,4DACF;EAIA,UAAA,oBAAC,OAAD,EAAK,WAAU,0JAA2J,CAAA;CACpJ,CAAA;AAE5B;;;;;AAMA,SAAS,eAAe,EACtB,WACA,aAAa,GACb,MACA,OACA,UAAU,WACV,UACA,GAAG,SAIA;CACH,OACE,oBAACA,UAAiB,QAAlB,EAAA,UACE,oBAACA,UAAiB,YAAlB;EACc;EACN;EACC;EACP,WAAU;EAEV,UAAA,qBAACA,UAAiB,OAAlB;GACE,WAAW,GACT,iBACA,oBAAoB,OAAO,GAC3B,yBACA,SACF;GACA,GAAI;GAPN,UAAA,CASE,oBAAC,cAAD,CAAe,CAAA,GACd,QACqB;;CACG,CAAA,EACN,CAAA;AAE7B;AAgBA,MAAM,gBAAgBA,UAAiB,aAA6B;;;;;;AAOpE,SAAS,gBAAgB,EAAE,UAAU,GAAG,SAA0C;CAChF,OACE,qBAACA,UAAiB,UAAlB;EAA2B,GAAI;EAA/B,UAAA,CACG,UAID,oBAAC,aAAD;GAAa,QAAQ;GAAe,uBAAA;GAChC,WAAA,EAAE,cACF,oBAAC,gBAAD;IACE,MAAM,SAAS;IACf,OAAO,SAAS;IAChB,SAAS,SAAS,WAAW;IAC7B,WAAW,SAAS;IAEnB,UAAA,SAAS;GACI,CAAA;EAEP,CAAA,CACY;;AAE/B;AAYA,SAAS,QAAQ,EACf,IACA,UACA,SACA,MACA,OACA,UAAU,WACV,aACe;CACf,IAAI,CAAC,SAAS,OAAO;CAErB,OACE,oBAAC,gBAAD;EACM;EACJ,QAAQ;EACR,SAAS;GAAE,SAAS;GAAS;GAAS;GAAM;GAAO;EAAU;EAC7D,QAAQ;CACT,CAAA;AAEL;;;;;AAMA,SAAS,YAAY,WAAmB;CACtC,cAAc,KAAK,SAAS;AAC9B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SegmentedControlProps } from "./segmented-control.js";
|
|
2
|
+
export interface ViewPickerProps<T extends string> extends Omit<SegmentedControlProps<T>, "value" | "defaultValue" | "onValueChange" | "onChange"> {
|
|
3
|
+
value: T;
|
|
4
|
+
/**
|
|
5
|
+
* The view that maps to no `?view=` param, so the URL stays clean on the default view.
|
|
6
|
+
*/
|
|
7
|
+
defaultValue: T;
|
|
8
|
+
options: {
|
|
9
|
+
value: T;
|
|
10
|
+
label: string;
|
|
11
|
+
}[];
|
|
12
|
+
onChange: (view: T | undefined) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* View switcher bound to a route's `view` search param: `segmented` (default) for a header,
|
|
16
|
+
* `plain` inside a card. Emits `undefined` for the default view so the route can drop it from
|
|
17
|
+
* the URL instead of writing `?view=<default>`. It is a radio group, so each arrow key writes
|
|
18
|
+
* the next view to the URL as it moves.
|
|
19
|
+
*/
|
|
20
|
+
export declare function ViewPicker<T extends string>({ value, defaultValue, options, onChange, ...props }: ViewPickerProps<T>): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SegmentedControl, SegmentedControlItem } from "./segmented-control.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/view-picker.tsx
|
|
5
|
+
/**
|
|
6
|
+
* View switcher bound to a route's `view` search param: `segmented` (default) for a header,
|
|
7
|
+
* `plain` inside a card. Emits `undefined` for the default view so the route can drop it from
|
|
8
|
+
* the URL instead of writing `?view=<default>`. It is a radio group, so each arrow key writes
|
|
9
|
+
* the next view to the URL as it moves.
|
|
10
|
+
*/
|
|
11
|
+
function ViewPicker({ value, defaultValue, options, onChange, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(SegmentedControl, {
|
|
13
|
+
value,
|
|
14
|
+
onValueChange: (next) => onChange(next === defaultValue ? void 0 : next),
|
|
15
|
+
...props,
|
|
16
|
+
children: options.map((option) => /* @__PURE__ */ jsx(SegmentedControlItem, {
|
|
17
|
+
value: option.value,
|
|
18
|
+
children: option.label
|
|
19
|
+
}, option.value))
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export { ViewPicker };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=view-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-picker.js","names":[],"sources":["../../src/components/view-picker.tsx"],"sourcesContent":["\"use client\"\n\nimport {\n SegmentedControl,\n SegmentedControlItem,\n type SegmentedControlProps,\n} from \"./segmented-control\"\n\nexport interface ViewPickerProps<T extends string> extends Omit<\n SegmentedControlProps<T>,\n \"value\" | \"defaultValue\" | \"onValueChange\" | \"onChange\"\n> {\n value: T\n /**\n * The view that maps to no `?view=` param, so the URL stays clean on the default view.\n */\n defaultValue: T\n options: { value: T; label: string }[]\n onChange: (view: T | undefined) => void\n}\n\n/**\n * View switcher bound to a route's `view` search param: `segmented` (default) for a header,\n * `plain` inside a card. Emits `undefined` for the default view so the route can drop it from\n * the URL instead of writing `?view=<default>`. It is a radio group, so each arrow key writes\n * the next view to the URL as it moves.\n */\nexport function ViewPicker<T extends string>({\n value,\n defaultValue,\n options,\n onChange,\n ...props\n}: ViewPickerProps<T>) {\n return (\n <SegmentedControl\n value={value}\n onValueChange={(next: T) => onChange(next === defaultValue ? undefined : next)}\n {...props}\n >\n {options.map(option => (\n <SegmentedControlItem key={option.value} value={option.value}>\n {option.label}\n </SegmentedControlItem>\n ))}\n </SegmentedControl>\n )\n}\n"],"mappings":";;;;;;;;;;AA2BA,SAAgB,WAA6B,EAC3C,OACA,cACA,SACA,UACA,GAAG,SACkB;CACrB,OACE,oBAAC,kBAAD;EACS;EACP,gBAAgB,SAAY,SAAS,SAAS,eAAe,KAAA,IAAY,IAAI;EAC7E,GAAI;EAEH,UAAA,QAAQ,KAAI,WACX,oBAAC,sBAAD;GAAyC,OAAO,OAAO;GACpD,UAAA,OAAO;EACY,GAFK,OAAO,KAEZ,CACvB;CACe,CAAA;AAEtB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|