:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(quill): add composable Metric tile to quill-components (#65774)
Adam Leithdc2001d46c4f
diff --git a/packages/quill/packages/charts/AGENTS.md b/packages/quill/packages/charts/AGENTS.mdindex 0dc77c36d2d6..310e834a93ca 100644--- a/packages/quill/packages/charts/AGENTS.md+++ b/packages/quill/packages/charts/AGENTS.md@@ -75,6 +75,7 @@ Charts fill their container and need a parent with real dimensions — a `0`-hei- `Legend` (and `ChartLegend` for layout) is the lower-level presentational primitive: pass `items`, `onItemClick`, `hiddenKeys` — filtering series is the caller's state. Use it directly when the built-in `config.legend` can't express what you need (custom item order/labels). `useChartLegend(series, theme, config, items?)` is the shared hook the charts use — returns `visibleSeries` (hidden applied as `visibility.excluded`) plus `legendProps` to spread onto `<ChartLegend>`; `applyHiddenSeries` is the underlying helper. `LegendItem.secondaryLabel` shows muted trailing text (e.g. a slope chart's per-series change). Long labels clip to a max width with an ellipsis and expose the full text via a native `title` tooltip on hover. The legend slot in `ChartLegendLayout` is bounded and scrolls (a top/bottom legend caps at ~40% of the chart height so the plot keeps the majority; a left/right legend stretches to full chart height and caps at ~45% width), so a many-series legend scrolls instead of squeezing or stretching the chart. A left/right legend uses `align-self: stretch` (resolves against the container's used height, so it works even when no ancestor sets an explicit `height`). The top/bottom `max-height: 40%` cap is a percentage, so it only resolves when the chart container has an **explicit** `height` — a flex-derived used size (e.g. `flex: 1` with only `min-height`/`max-height`) does **not** count and the cap silently no-ops; pin a real `height` on the container.- `SlopeChart` config: `showSeriesLabels` (name beside each point; steepest line wins label collisions), `showStartLabels`/`showEndLabels` (defaults overridable per series via `meta.showStartLabel`/`showEndLabel`), `legend` (`{ show, position }`, rows carry the formatted change, ordered biggest-to-smallest by end value to match the lines' right-edge order), `valueFormatter`/`deltaFormatter`. The value axis is hidden by default — the start/end labels are the readout. The default tooltip orders its rows biggest-to-smallest by the hovered point's value (so many-breakdown tooltips match the lines' vertical order) and formats values with `valueFormatter` so they match the on-chart labels' units; pass your own `tooltip` to override. (`DefaultTooltip` itself takes an optional `valueFormatter` for the same reason — without it values fall back to `toLocaleString`.) Per-series `meta.incompleteEnd` dashes only the second half of that connector (the last point is the current incomplete period); the renderer splits the final segment at its midpoint via `stroke.partial.fromFraction`, so a two-point line needs no phantom interior point.- `MetricCard` is a left-aligned tile. Pass `title={null}` to drop the title row — the header band collapses when there is no title and no change pill, and the subtitle row is omitted when there is no subtitle (and no `labels`), so a value-only card renders just the number. `changeSize="md"` renders a larger change pill (default `sm`); `changeInline` puts the pill beside the headline instead of in the header; `sparklineFill` makes the sparkline fill the card's remaining height instead of a fixed `sparklineHeight`; `sparklineDashedFromIndex` dashes the sparkline from that index onward (e.g. an in-progress trailing period). `subtitle` always wins (shown at rest and on hover); `restingSubtitle` (e.g. `'Avg'`) shows only at rest and yields to the hovered point's label on hover — pair it with a `value` that summarizes the series (average/total) so the headline reads as a summary until hovered. `hoverChangeFromPreviousPoint` keeps the supplied resting `change` pill at rest but, while hovering, swaps it for the hovered point's change vs the previous point (hidden at the first point). `changeTooltip` shows a styled hover tooltip (floating-ui, using the host's tooltip surface tokens with chart-surface fallbacks) on the change pill (e.g. to spell out what the resting comparison is).+- The composable form of `MetricCard` lives one layer up as `Metric` in `@posthog/quill-components` (it needs `Card`/`Badge` from primitives, which charts can't depend on). It's built on `Sparkline` plus the headless metric helpers this package exports — `resolveDelta` / `computeFallbackChangePercent` (delta math), `useAnimatedNumber` (count-up headline), `useHoverIntent` (hover dwell) — and the `MetricChange` / `ResolvedDelta` types. Reach for `Metric` when you need a custom layout; use the monolithic `MetricCard` here for the default self-contained tile.- `TimeSeriesComboChart` wraps `ComboChart` the way `TimeSeriesLineChart`/`TimeSeriesBarChart` wrap their base charts: `config.xAxis`/`config.yAxis` (date tick formatter, y-format, scale, grid), `config.goalLines` (off-scale targets stretch the value axis via `ComboChart`'s `valueDomain`), `config.legend` (click-to-toggle), and `config.valueLabels`. Per-series `type` (`'bar' | 'line' | 'area'`) drives rendering; `barLayout` (`'stacked' | 'grouped'`) and right-axis series (`yAxisId: 'right'`) carry over from `ComboChart`. `ComboChart` itself now also honors `valueDomain` (primary axis only) and `showAxisLines`.- y-axis `format`: `numeric | short | percentage | percentage_scaled | currency | duration | duration-ms`, plus `prefix`/`suffix`.- y-axis baseline: defaults to clamping a non-negative axis down to 0 (matching the classic insight axis). To float the axis to its data range instead — zooming in on the variation — set `yAxis.startAtZero: false` on `TimeSeriesLineChart`, or `config.floatBaseline: true` on the lower-level `LineChart`. Ignored on a log scale (no zero baseline) and applied to the primary axis only. Bar charts always draw from a zero baseline, so the flag is a no-op there.diff --git a/packages/quill/packages/charts/src/components/MetricCard/MetricCard.tsx b/packages/quill/packages/charts/src/components/MetricCard/MetricCard.tsxindex 6f1e2667f048..939a79f335fb 100644--- a/packages/quill/packages/charts/src/components/MetricCard/MetricCard.tsx+++ b/packages/quill/packages/charts/src/components/MetricCard/MetricCard.tsx@@ -1,33 +1,23 @@-import {- arrow,- autoUpdate,- flip,- FloatingArrow,- FloatingPortal,- offset,- shift,- useFloating,- useHover,- useInteractions,- useRole,-} from '@floating-ui/react'-import React, { useMemo, useRef, useState } from 'react'+import React, { useMemo, useState } from 'react'import { Sparkline } from '../../charts/Sparkline/Sparkline'import { ChartErrorBoundary } from '../../core/ChartErrorBoundary'import type { ChartTheme } from '../../core/types'-import { TOOLTIP_FALLBACK_BG, TOOLTIP_FALLBACK_COLOR } from '../../overlays/TooltipSurface'-import { percentage } from '../../utils/format'+import {+ type ChangeColor,+ ChangePill,+ computeFallbackChangePercent,+ DEFAULT_FORMAT_CHANGE,+ DEFAULT_FORMAT_VALUE,+ DEFAULT_NEGATIVE_COLOR,+ DEFAULT_POSITIVE_COLOR,+} from './internals'import { type MetricChange, resolveDelta } from './resolveDelta'import { useAnimatedNumber } from './useAnimatedNumber'import { useHoverIntent } from './useHoverIntent'export type { MetricChange }--export interface ChangeColor {- background: string- foreground: string-}+export type { ChangeColor }export interface MetricCardProps {title: React.ReactNode@@ -83,15 +73,6 @@ export interface MetricCardProps {onError?: (error: Error, info: React.ErrorInfo) => void}-const DEFAULT_POSITIVE_COLOR: ChangeColor = { background: 'rgb(56 134 0 / 10%)', foreground: '#388600' }-const DEFAULT_NEGATIVE_COLOR: ChangeColor = { background: 'rgb(219 55 7 / 10%)', foreground: '#db3707' }--const DEFAULT_FORMAT_VALUE = (v: number): string => v.toLocaleString()-const DEFAULT_FORMAT_CHANGE = (p: number): string => {- const formatted = percentage(p / 100, 1, true)- return p > 0 ? `+${formatted}` : formatted-}-export function MetricCard(props: MetricCardProps): React.ReactElement | null {const { onError, ...rest } = propsreturn (@@ -241,145 +222,3 @@ function MetricCardInner({</div>)}--// Percent change from the point before `index` to the point at `index`. Returns null when there is-// no usable previous point (first index, missing/non-finite values, or a zero baseline).-function changeFromPreviousPoint(data: number[], index: number): number | null {- const prev = data[index - 1]- const curr = data[index]- if (index < 1 || prev === 0 || !Number.isFinite(prev) || !Number.isFinite(curr)) {- return null- }- return ((curr - prev) / Math.abs(prev)) * 100-}--// The hover-driven change percent: the hovered point vs the previous point when-// `hoverChangeFromPreviousPoint` is active, otherwise the live value vs the series baseline.-function computeFallbackChangePercent(- sparklineData: number[] | null,- usePrevPointHover: boolean,- intentIndex: number,- liveValue: number,- baselineValue: number | undefined-): number | null {- if (sparklineData == null) {- return null- }- if (usePrevPointHover) {- return changeFromPreviousPoint(sparklineData, intentIndex)- }- if (baselineValue == null) {- return null- }- return ((liveValue - baselineValue) / Math.abs(baselineValue)) * 100-}--interface ChangePillProps {- positive: boolean- label: React.ReactNode- colors: ChangeColor- size?: 'sm' | 'md'- tooltip?: string-}--function ChangePill({ positive, label, colors, size = 'sm', tooltip }: ChangePillProps): React.ReactElement {- const sizeClasses = size === 'md' ? 'gap-1.5 px-2.5 py-1 text-sm' : 'gap-1 px-2 py-0.5 text-xs'- const pill = (- <div- className={`inline-flex items-center rounded-full font-medium transition-colors ${sizeClasses}`}- style={{ background: colors.background, color: colors.foreground }}- data-attr="metric-card-change-pill"- >- <Chevron up={positive} size={size === 'md' ? 12 : 10} />- <span className="tabular-nums">{label}</span>- </div>- )- if (!tooltip) {- return pill- }- return <ChangePillTooltip content={tooltip}>{pill}</ChangePillTooltip>-}--// A hover tooltip for the change pill. Built on floating-ui directly so the charts package stays-// dependency-light (no app Tooltip import), but styled with the app's tooltip surface tokens so it-// reads as a normal PostHog tooltip and stays legible over the tile's own --card background. Falls-// back to the chart tooltip constants in non-app hosts that don't define those vars.-const TOOLTIP_BG = `var(--color-bg-surface-tooltip, ${TOOLTIP_FALLBACK_BG})`-const TOOLTIP_COLOR = `var(--color-text-primary-inverse, ${TOOLTIP_FALLBACK_COLOR})`--function ChangePillTooltip({- content,- children,-}: {- content: React.ReactNode- children: React.ReactNode-}): React.ReactElement {- const [open, setOpen] = useState(false)- const arrowRef = useRef<SVGSVGElement>(null)- const { refs, floatingStyles, context } = useFloating({- open,- onOpenChange: setOpen,- placement: 'top',- strategy: 'fixed',- whileElementsMounted: autoUpdate,- middleware: [offset(8), flip(), shift({ padding: 8 }), arrow({ element: arrowRef })],- })- const hover = useHover(context, { move: false })- const role = useRole(context, { role: 'tooltip' })- const { getReferenceProps, getFloatingProps } = useInteractions([hover, role])-- return (- <>- <span ref={refs.setReference} {...getReferenceProps()} className="inline-flex">- {children}- </span>- {open && (- <FloatingPortal>- <div- ref={refs.setFloating}- {...getFloatingProps()}- className="pointer-events-none max-w-80 rounded-md px-3 py-1.5 text-xs font-normal leading-snug"- // Dynamic only: floating-ui position + app tooltip tokens. Static styling stays in Tailwind.- // eslint-disable-next-line react/forbid-dom-props- style={{- ...floatingStyles,- zIndex: 'var(--z-tooltip, 9999)',- background: TOOLTIP_BG,- color: TOOLTIP_COLOR,- boxShadow: 'var(--modal-shadow-elevation, 0 2px 8px rgb(0 0 0 / 18%))',- }}- >- {content}- {/* `currentColor` + the bg-colored `color` paints the arrow the same surface color- (a CSS var can't go in the SVG `fill` attribute directly). */}- <FloatingArrow- ref={arrowRef}- context={context}- fill="currentColor"- // eslint-disable-next-line react/forbid-dom-props- style={{ color: TOOLTIP_BG }}- />- </div>- </FloatingPortal>- )}- </>- )-}--function Chevron({ up, size = 10 }: { up: boolean; size?: number }): React.ReactElement {- return (- <svg- width={size}- height={size}- viewBox="0 0 10 10"- fill="none"- stroke="currentColor"- strokeWidth="1.5"- strokeLinecap="round"- strokeLinejoin="round"- className={up ? '' : 'rotate-180'}- >- <path d="M2 6.5 L5 3.5 L8 6.5" />- </svg>- )-}diff --git a/packages/quill/packages/charts/src/components/MetricCard/internals.tsx b/packages/quill/packages/charts/src/components/MetricCard/internals.tsxnew file mode 100644index 000000000000..dfa2114204e4--- /dev/null+++ b/packages/quill/packages/charts/src/components/MetricCard/internals.tsx@@ -0,0 +1,173 @@+import {+ arrow,+ autoUpdate,+ flip,+ FloatingArrow,+ FloatingPortal,+ offset,+ shift,+ useFloating,+ useHover,+ useInteractions,+ useRole,+} from '@floating-ui/react'+import React, { useRef, useState } from 'react'++import { TOOLTIP_FALLBACK_BG, TOOLTIP_FALLBACK_COLOR } from '../../overlays/TooltipSurface'+import { percentage } from '../../utils/format'++export interface ChangeColor {+ background: string+ foreground: string+}++export const DEFAULT_POSITIVE_COLOR: ChangeColor = { background: 'rgb(56 134 0 / 10%)', foreground: '#388600' }+export const DEFAULT_NEGATIVE_COLOR: ChangeColor = { background: 'rgb(219 55 7 / 10%)', foreground: '#db3707' }++export const DEFAULT_FORMAT_VALUE = (v: number): string => v.toLocaleString()+export const DEFAULT_FORMAT_CHANGE = (p: number): string => {+ const formatted = percentage(p / 100, 1, true)+ return p > 0 ? `+${formatted}` : formatted+}++// Percent change from the point before `index` to the point at `index`. Returns null when there is+// no usable previous point (first index, missing/non-finite values, or a zero baseline).+export function changeFromPreviousPoint(data: number[], index: number): number | null {+ const prev = data[index - 1]+ const curr = data[index]+ if (index < 1 || prev === 0 || !Number.isFinite(prev) || !Number.isFinite(curr)) {+ return null+ }+ return ((curr - prev) / Math.abs(prev)) * 100+}++// The hover-driven change percent: the hovered point vs the previous point when+// `hoverChangeFromPreviousPoint` is active, otherwise the live value vs the series baseline.+export function computeFallbackChangePercent(+ sparklineData: number[] | null,+ usePrevPointHover: boolean,+ intentIndex: number,+ liveValue: number,+ baselineValue: number | undefined+): number | null {+ if (sparklineData == null) {+ return null+ }+ if (usePrevPointHover) {+ return changeFromPreviousPoint(sparklineData, intentIndex)+ }+ if (baselineValue == null) {+ return null+ }+ return ((liveValue - baselineValue) / Math.abs(baselineValue)) * 100+}++export interface ChangePillProps {+ positive: boolean+ label: React.ReactNode+ colors: ChangeColor+ size?: 'sm' | 'md'+ tooltip?: string+}++export function ChangePill({ positive, label, colors, size = 'sm', tooltip }: ChangePillProps): React.ReactElement {+ const sizeClasses = size === 'md' ? 'gap-1.5 px-2.5 py-1 text-sm' : 'gap-1 px-2 py-0.5 text-xs'+ const pill = (+ <div+ className={`inline-flex items-center rounded-full font-medium transition-colors ${sizeClasses}`}+ style={{ background: colors.background, color: colors.foreground }}+ data-attr="metric-card-change-pill"+ >+ <Chevron up={positive} size={size === 'md' ? 12 : 10} />+ <span className="tabular-nums">{label}</span>+ </div>+ )+ if (!tooltip) {+ return pill+ }+ return <ChangePillTooltip content={tooltip}>{pill}</ChangePillTooltip>+}++// A hover tooltip for the change pill. Built on floating-ui directly so the charts package stays+// dependency-light (no app Tooltip import), but styled with the app's tooltip surface tokens so it+// reads as a normal PostHog tooltip and stays legible over the tile's own --card background. Falls+// back to the chart tooltip constants in non-app hosts that don't define those vars.+const TOOLTIP_BG = `var(--color-bg-surface-tooltip, ${TOOLTIP_FALLBACK_BG})`+const TOOLTIP_COLOR = `var(--color-text-primary-inverse, ${TOOLTIP_FALLBACK_COLOR})`++function ChangePillTooltip({+ content,+ children,+}: {+ content: React.ReactNode+ children: React.ReactNode+}): React.ReactElement {+ const [open, setOpen] = useState(false)+ const arrowRef = useRef<SVGSVGElement>(null)+ const { refs, floatingStyles, context } = useFloating({+ open,+ onOpenChange: setOpen,+ placement: 'top',+ strategy: 'fixed',+ whileElementsMounted: autoUpdate,+ middleware: [offset(8), flip(), shift({ padding: 8 }), arrow({ element: arrowRef })],+ })+ const hover = useHover(context, { move: false })+ const role = useRole(context, { role: 'tooltip' })+ const { getReferenceProps, getFloatingProps } = useInteractions([hover, role])++ return (+ <>+ <span ref={refs.setReference} {...getReferenceProps()} className="inline-flex">+ {children}+ </span>+ {open && (+ <FloatingPortal>+ <div+ ref={refs.setFloating}+ {...getFloatingProps()}+ className="pointer-events-none max-w-80 rounded-md px-3 py-1.5 text-xs font-normal leading-snug"+ // Dynamic only: floating-ui position + app tooltip tokens. Static styling stays in Tailwind.+ // eslint-disable-next-line react/forbid-dom-props+ style={{+ ...floatingStyles,+ zIndex: 'var(--z-tooltip, 9999)',+ background: TOOLTIP_BG,+ color: TOOLTIP_COLOR,+ boxShadow: 'var(--modal-shadow-elevation, 0 2px 8px rgb(0 0 0 / 18%))',+ }}+ >+ {content}+ {/* `currentColor` + the bg-colored `color` paints the arrow the same surface color+ (a CSS var can't go in the SVG `fill` attribute directly). */}+ <FloatingArrow+ ref={arrowRef}+ context={context}+ fill="currentColor"+ // eslint-disable-next-line react/forbid-dom-props+ style={{ color: TOOLTIP_BG }}+ />+ </div>+ </FloatingPortal>+ )}+ </>+ )+}++function Chevron({ up, size = 10 }: { up: boolean; size?: number }): React.ReactElement {+ return (+ <svg+ width={size}+ height={size}+ viewBox="0 0 10 10"+ fill="none"+ stroke="currentColor"+ strokeWidth="1.5"+ strokeLinecap="round"+ strokeLinejoin="round"+ className={up ? '' : 'rotate-180'}+ >+ <path d="M2 6.5 L5 3.5 L8 6.5" />+ </svg>+ )+}diff --git a/packages/quill/packages/charts/src/index.ts b/packages/quill/packages/charts/src/index.tsindex 237d68a45a83..a33c6900f2ce 100644--- a/packages/quill/packages/charts/src/index.ts+++ b/packages/quill/packages/charts/src/index.ts@@ -25,6 +25,13 @@ export { Sparkline } from './charts/Sparkline/Sparkline'export type { SparklineProps } from './charts/Sparkline/Sparkline'export { MetricCard } from './components/MetricCard/MetricCard'export type { MetricCardProps, ChangeColor, MetricChange } from './components/MetricCard/MetricCard'+// Headless metric helpers — the "metric engine" shared by `MetricCard` and reused by higher layers+// (quill-components' composable `Metric`) to build metric tiles on top of `Sparkline`.+export { resolveDelta } from './components/MetricCard/resolveDelta'+export type { ResolvedDelta } from './components/MetricCard/resolveDelta'+export { computeFallbackChangePercent } from './components/MetricCard/internals'+export { useAnimatedNumber } from './components/MetricCard/useAnimatedNumber'+export { useHoverIntent } from './components/MetricCard/useHoverIntent'// Base chart (for building new chart types)export { Chart } from './core/Chart'diff --git a/packages/quill/packages/components/AGENTS.md b/packages/quill/packages/components/AGENTS.mdindex ef83487ad3ec..154e6f09d7ed 100644--- a/packages/quill/packages/components/AGENTS.md+++ b/packages/quill/packages/components/AGENTS.md@@ -8,6 +8,7 @@ Quick-reference for AI agents using `@posthog/quill-components` — composed com- `DateTimePicker` — calendar range picker with quick-range presets (`quickRanges`, `CUSTOM_RANGE`)- `DatePicker` — single-date picker (one calendar, optional time, no quick ranges)- `useCalendar` — headless calendar grid hook (`Day`, `Month` enums)+- `Metric` — composable stat tile (`Card` + `Badge` pill + `Sparkline`); marries primitives with `@posthog/quill-charts`. Import from the `@posthog/quill-components/metric` subpath (not the main barrel)## DataTable@@ -95,6 +96,45 @@ Rules:Headless month-grid state for building custom calendar UIs: returns `calendar` (months > weeks > days), view navigation (`viewNextMonth`, `viewToday`, ...), and selection helpers (`select`, `selectRange`, `isSelected`, `toggle`). Selected dates are normalized to midnight. Reach for this only when DateTimePicker doesn't fit.+## Metric++A composable stat tile: a headline number, a `Badge` change pill, and an optional `Sparkline`. `Metric` is **content, not a surface** — wrap it in `<Card flush>` for the border. It's the one component here that depends on `@posthog/quill-charts` (for `Sparkline` + the headless metric math), which pulls d3 — so it lives behind its own `@posthog/quill-components/metric` entry point, **not** the main barrel (and not the `@posthog/quill` umbrella). That keeps charts/d3 out of the always-eager app-shell graph: only code that imports the metric subpath pays for it. The `MetricCard` in `@posthog/quill-charts` is the older, self-contained (prop-driven, primitives-free) tile; use `Metric` when you want to compose the layout or lean on quill's `Card`/`Badge`.++```tsx+import {+ Metric,+ MetricHeader,+ MetricTitle,+ MetricDelta,+ MetricValue,+ MetricSubtitle,+ MetricSparkline,+} from '@posthog/quill-components/metric'+import { Card } from '@posthog/quill-primitives'+import { useChartTheme } from '@posthog/quill-charts'++const theme = useChartTheme()+;<Card flush className="h-40">+ <Metric data={series} labels={labels} theme={theme} color="#22d3ee" sparklineFill>+ <MetricHeader>+ <MetricTitle>Total revenue</MetricTitle>+ <MetricDelta /> {/* Badge: success/destructive by goodDirection; hidden when there's no delta */}+ </MetricHeader>+ <MetricValue className="mt-2" /> {/* hover-following headline; pass a text-* class to resize */}+ <MetricSubtitle className="mt-1" />+ <MetricSparkline /> {/* bleeds to the card's left/right; `<Card flush>` lets it reach the bottom */}+ </Metric>+</Card>+```++Rules:++- Wrap `Metric` in `<Card flush>` — `Metric` is just the layout/content (it owns its inline padding like `CardContent`, so the sparkline can bleed out with `-mx-4`); the card owns the border, block padding, and bottom edge. `flush` drops the card's bottom padding so `MetricSparkline` reaches the bottom; a number-only tile can use a plain `<Card>`.+- Give the card a height (`className="h-40"`, or `h-full` in a sized box) when using `sparklineFill` or when you want a fixed-height sparkline pinned to the bottom; otherwise it sizes to content (`Metric` is `h-full` so it fills whatever card it's in).+- The root owns the data/hover behavior and feeds the parts via context — a part used outside `<Metric>` throws. Pass `value` for a number-only tile; pass `data`+`labels`+`theme` for a sparkline.+- `MetricDelta` renders a `Badge`; `goodDirection` (default `up`) decides success vs destructive. `changeTooltip` needs a `TooltipProvider` at the app root.+- Reproduces `MetricCard`'s behavior (`restingSubtitle`, `hoverChangeFromPreviousPoint`, `changeTooltip`) but drops its color/size props in favor of `Badge` variants.+## MaintenanceWhen adding or changing a component here, update this guide in the same PR and add a story next to the component.diff --git a/packages/quill/packages/components/package.json b/packages/quill/packages/components/package.jsonindex cd10148e10ec..9389eb3c2a45 100644--- a/packages/quill/packages/components/package.json+++ b/packages/quill/packages/components/package.json@@ -24,12 +24,19 @@"require": "./dist/index.cjs","default": "./dist/index.js"},+ "./metric": {+ "types": "./dist/metric.d.ts",+ "import": "./dist/metric.js",+ "require": "./dist/metric.cjs",+ "default": "./dist/metric.js"+ },"./package.json": "./package.json"},"scripts": {"build": "vite build"},"dependencies": {+ "@posthog/quill-charts": "workspace:^","@posthog/quill-primitives": "workspace:^","@posthog/quill-tokens": "workspace:^","date-fns": "^4.0.0",diff --git a/packages/quill/packages/components/src/index.ts b/packages/quill/packages/components/src/index.tsindex 4d03c3d8fad6..200f11f7de99 100644--- a/packages/quill/packages/components/src/index.ts+++ b/packages/quill/packages/components/src/index.ts@@ -13,3 +13,6 @@ export { DateTimePicker, type DateTimePickerProps, type DateTimeValue, type Dateexport { DatePicker, type DatePickerProps } from './date-picker'export { quickRanges, CUSTOM_RANGE, type DateTimeRange, type DateTimeRangeName } from './date-time-ranges'export { useCalendar, Day, Month, type UseCalendarOptions, type UseCalendarReturn } from './use-calendar'+// `Metric` is intentionally NOT re-exported here: it pulls `@posthog/quill-charts` (d3), and this+// barrel is inlined into the always-eager `@posthog/quill` bundle. Import it from its own entry —+// `@posthog/quill-components/metric` — so charts only loads where a metric tile is actually used.diff --git a/packages/quill/packages/components/src/metric.stories.tsx b/packages/quill/packages/components/src/metric.stories.tsxnew file mode 100644index 000000000000..97db082fad19--- /dev/null+++ b/packages/quill/packages/components/src/metric.stories.tsx@@ -0,0 +1,311 @@+import type { Meta, StoryObj } from '@storybook/react'+import * as React from 'react'++import { useChartTheme } from '@posthog/quill-charts'+import { Card, TooltipProvider } from '@posthog/quill-primitives'++import { Metric, MetricDelta, MetricHeader, MetricSparkline, MetricSubtitle, MetricTitle, MetricValue } from './metric'++const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']+const REVENUE = [4200, 5100, 4700, 5400, 6000, 5800, 6400, 6900, 7200, 7700, 8100, 8800]+const FALLING = [9800, 9200, 8600, 8400, 7700, 7300, 6900, 6500, 6000, 5400, 4800, 4200]++const meta: Meta = {+ title: 'Components/Metric',+ parameters: { layout: 'centered' },+ decorators: [+ (Story) => (+ <TooltipProvider>+ <Story />+ </TooltipProvider>+ ),+ ],+}+export default meta++type Story = StoryObj<{}>++// `Metric` is content, not a surface — wrap it in `<Card flush>` for the border. `flush` drops the+// card's bottom padding so a `MetricSparkline` reaches the bottom edge.+export const Default: Story = {+ render: () => {+ const theme = useChartTheme()+ return (+ <Card flush className="h-[320px] w-[360px]">+ <Metric+ data={REVENUE}+ labels={MONTHS}+ theme={theme}+ color="#22d3ee"+ sparklineFill+ formatValue={(v) => `US$${Math.round(v).toLocaleString()}`}+ >+ <MetricHeader>+ <MetricTitle>Total revenue</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ <MetricSubtitle className="mt-1" />+ <MetricSparkline />+ </Metric>+ </Card>+ )+ },+}++// Default (no `sparklineFill`): the fixed-height sparkline drops to the bottom of the card on its own+// via the part's built-in `mt-auto`.+export const Falling: Story = {+ render: () => {+ const theme = useChartTheme()+ return (+ <Card flush className="h-[320px] w-[360px]">+ <Metric+ data={FALLING}+ labels={MONTHS}+ theme={theme}+ color="#fb7185"+ formatValue={(v) => Math.round(v).toLocaleString()}+ >+ <MetricHeader>+ <MetricTitle>Active users</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ <MetricSubtitle className="mt-1" />+ <MetricSparkline />+ </Metric>+ </Card>+ )+ },+}++// Composition: drop the change pill beside the headline, omit the subtitle.+export const InlineChangeNoSubtitle: Story = {+ render: () => {+ const theme = useChartTheme()+ return (+ <Card flush className="h-[320px] w-[360px]">+ <Metric+ data={REVENUE}+ labels={MONTHS}+ theme={theme}+ color="#22d3ee"+ sparklineFill+ formatValue={(v) => `US$${Math.round(v).toLocaleString()}`}+ >+ <MetricTitle>Total revenue</MetricTitle>+ <div className="mt-2 flex items-center justify-between gap-2">+ <MetricValue />+ <MetricDelta />+ </div>+ <MetricSparkline />+ </Metric>+ </Card>+ )+ },+}++export const NumberOnly: Story = {+ render: () => (+ <Card className="w-[360px]">+ <Metric value={1_284_320} change={{ value: 8.4 }} formatValue={(v) => `US$${v.toLocaleString()}`}>+ <MetricHeader>+ <MetricTitle>Lifetime revenue</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ </Metric>+ </Card>+ ),+}++// No title row — just the headline over a bottom-anchored sparkline.+export const NoTitle: Story = {+ render: () => {+ const theme = useChartTheme()+ return (+ <Card flush className="h-[240px] w-[360px]">+ <Metric+ data={REVENUE}+ labels={MONTHS}+ theme={theme}+ color="#22d3ee"+ formatValue={(v) => `US$${Math.round(v).toLocaleString()}`}+ >+ <MetricValue />+ <MetricSparkline />+ </Metric>+ </Card>+ )+ },+}++// A summary `value` (the average) with `restingSubtitle="Avg"`: at rest the headline reads as the+// average; hovering a point swaps in that point's value and month label.+export const RestingSummary: Story = {+ render: () => {+ const theme = useChartTheme()+ const avg = Math.round(REVENUE.reduce((a, b) => a + b, 0) / REVENUE.length)+ return (+ <Card flush className="h-[320px] w-[360px]">+ <Metric+ value={avg}+ restingSubtitle="Avg"+ data={REVENUE}+ labels={MONTHS}+ theme={theme}+ color="#22d3ee"+ sparklineFill+ formatValue={(v) => `US$${Math.round(v).toLocaleString()}`}+ >+ <MetricHeader>+ <MetricTitle>Total revenue</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ <MetricSubtitle className="mt-1" />+ <MetricSparkline />+ </Metric>+ </Card>+ )+ },+}++// `changeTooltip` spells out the comparison on hover (needs a `TooltipProvider` at the app root —+// supplied here by the story decorator).+export const WithTooltip: Story = {+ render: () => (+ <Card className="w-[360px]">+ <Metric+ value={1_284_320}+ change={{ value: 8.4 }}+ changeTooltip="vs. the previous 30 days"+ formatValue={(v) => `US$${v.toLocaleString()}`}+ >+ <MetricHeader>+ <MetricTitle>Lifetime revenue</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ </Metric>+ </Card>+ ),+}++// `hoverChangeFromPreviousPoint`: the resting pill shows the supplied `change`; while hovering, it+// swaps to the hovered point's change vs the previous point (hidden at the first point).+export const HoverChangeFromPrevious: Story = {+ render: () => {+ const theme = useChartTheme()+ return (+ <Card flush className="h-[320px] w-[360px]">+ <Metric+ data={FALLING}+ labels={MONTHS}+ theme={theme}+ color="#fb7185"+ change={{ value: -57.1 }}+ hoverChangeFromPreviousPoint+ sparklineFill+ formatValue={(v) => Math.round(v).toLocaleString()}+ >+ <MetricHeader>+ <MetricTitle>Active users</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ <MetricSubtitle className="mt-1" />+ <MetricSparkline />+ </Metric>+ </Card>+ )+ },+}++// A dashboard stat grid — each tile a `<Card flush>` wrapping a `Metric` with its own bottom-anchored+// sparkline. The pill falls back to each series' own trend; `goodDirection="down"` flips churn's color.+export const Grid: Story = {+ render: () => {+ const theme = useChartTheme()+ const SIGNUPS = [180, 210, 240, 230, 260, 300, 320, 360, 400, 420, 460, 510]+ const tiles = [+ {+ title: 'Revenue',+ data: REVENUE,+ color: '#22d3ee',+ good: 'up' as const,+ format: (v: number) => `US$${Math.round(v).toLocaleString()}`,+ },+ {+ title: 'Signups',+ data: SIGNUPS,+ color: '#a78bfa',+ good: 'up' as const,+ format: (v: number) => Math.round(v).toLocaleString(),+ },+ {+ title: 'Churn',+ data: FALLING,+ color: '#fb7185',+ good: 'down' as const,+ format: (v: number) => Math.round(v).toLocaleString(),+ },+ ]+ return (+ <div className="grid w-[720px] grid-cols-3 gap-4">+ {tiles.map((t) => (+ <Card key={t.title} flush className="h-40">+ <Metric+ data={t.data}+ labels={MONTHS}+ theme={theme}+ color={t.color}+ goodDirection={t.good}+ sparklineFill+ formatValue={t.format}+ >+ <MetricHeader>+ <MetricTitle>{t.title}</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2 text-2xl" />+ <MetricSparkline />+ </Metric>+ </Card>+ ))}+ </div>+ )+ },+}++// The same grid without sparklines — compact number-only tiles in shorter cards.+export const GridNoSparkline: Story = {+ render: () => {+ const tiles = [+ { title: 'Revenue', value: 1_284_320, change: 8.4, format: (v: number) => `US$${v.toLocaleString()}` },+ { title: 'Signups', value: 4218, change: 2.1, format: (v: number) => v.toLocaleString() },+ { title: 'Churn', value: 312, change: -4.7, format: (v: number) => v.toLocaleString() },+ ]+ return (+ <div className="grid w-[720px] grid-cols-3 gap-4">+ {tiles.map((t) => (+ <Card key={t.title}>+ <Metric+ value={t.value}+ change={{ value: t.change }}+ goodDirection={t.title === 'Churn' ? 'down' : 'up'}+ formatValue={t.format}+ >+ <MetricHeader>+ <MetricTitle>{t.title}</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2 text-2xl" />+ </Metric>+ </Card>+ ))}+ </div>+ )+ },+}diff --git a/packages/quill/packages/components/src/metric.tsx b/packages/quill/packages/components/src/metric.tsxnew file mode 100644index 000000000000..4128eaa6d675--- /dev/null+++ b/packages/quill/packages/components/src/metric.tsx@@ -0,0 +1,370 @@+import { ChevronDown, ChevronUp } from 'lucide-react'+import * as React from 'react'++import {+ ChartErrorBoundary,+ computeFallbackChangePercent,+ type MetricChange,+ percentage,+ type ResolvedDelta,+ resolveDelta,+ Sparkline,+ useAnimatedNumber,+ useHoverIntent,+} from '@posthog/quill-charts'+import type { ChartTheme } from '@posthog/quill-charts'+import { Badge, cn, Tooltip, TooltipContent, TooltipTrigger } from '@posthog/quill-primitives'++export type { MetricChange }++// What the root computes once and every part reads. Parts stay dumb: they render a slice of this.+interface MetricContextValue {+ /** Formatted headline — already follows the hovered sparkline point. */+ headlineDisplay: string+ /** Resolved caption (subtitle override → resting subtitle at rest → hovered label). */+ subtitle: React.ReactNode+ /** The change pill's resolved state, or null when there is nothing to show. */+ change: {+ delta: ResolvedDelta+ /** value ≥ 0 — drives the chevron direction. */+ positive: boolean+ /** Change is in the desired direction — drives the Badge color (success vs destructive). */+ good: boolean+ tooltip?: string+ } | null+ /** Sparkline wiring, or null when no series was supplied. */+ sparkline: {+ data: number[]+ labels?: string[]+ theme: ChartTheme+ color?: string+ height: number+ fill: boolean+ fillOpacity: number+ dashedFromIndex?: number+ setHoverIndex: (index: number) => void+ } | null+}++const MetricContext = React.createContext<MetricContextValue | null>(null)++function useMetric(part: string): MetricContextValue {+ const ctx = React.useContext(MetricContext)+ if (ctx == null) {+ throw new Error(`${part} must be rendered inside <Metric>`)+ }+ return ctx+}++const DEFAULT_FORMAT_VALUE = (v: number): string => v.toLocaleString()+const DEFAULT_FORMAT_CHANGE = (p: number): string => {+ // Matches the monolithic MetricCard: `percentage` carries the sign for negatives, we prepend `+`.+ const formatted = percentage(p / 100, 1, true)+ return p > 0 ? `+${formatted}` : formatted+}++export interface MetricProps {+ /** Resting headline number. Defaults to `data[data.length - 1]` when `data` is present;+ * required when `data` is empty or omitted. */+ value?: number+ /** Series values. When present, a `MetricSparkline` renders and hovering a point swaps the headline. */+ data?: number[]+ /** Labels paired with `data`. Used for the default subtitle on hover. */+ labels?: string[]+ /** Required when `data` is present. */+ theme?: ChartTheme+ /** Sparkline line + fill color. Falls back to `theme.colors[0]`. */+ color?: string+ sparklineHeight?: number+ /** Fill the card's remaining height with the sparkline instead of a fixed `sparklineHeight`. */+ sparklineFill?: boolean+ sparklineFillOpacity?: number+ /** Dash the sparkline from this index onward (e.g. an in-progress trailing period). */+ sparklineDashedFromIndex?: number+ formatValue?: (value: number) => string+ formatChange?: (percent: number) => string+ showChange?: boolean+ /** Fixed comparison pill. Supplied → no hover-driven fallback. Pass `null` to suppress. */+ change?: MetricChange | null+ /** Which direction is "good" — drives the pill color. Defaults to `up`. */+ goodDirection?: 'up' | 'down'+ /** Tooltip shown on hover over the change pill (requires a `TooltipProvider` at the app root). */+ changeTooltip?: string+ /** Caption shown at rest and on hover. Always wins over `restingSubtitle` and hovered labels. */+ subtitle?: React.ReactNode+ /** Caption shown only while at rest (e.g. `'Avg'`); on hover it yields to the hovered point's label. */+ restingSubtitle?: React.ReactNode+ /** While hovering a sparkline point, swap the resting `change` pill for the hovered point's change+ * vs the previous point. The resting `change` still shows when not hovering. */+ hoverChangeFromPreviousPoint?: boolean+ animationMs?: number+ /** Dwell (ms) a pointer must settle on the sparkline before the headline follows it. `0` disables. */+ hoverIntentMs?: number+ className?: string+ dataAttr?: string+ onError?: (error: Error, info: React.ErrorInfo) => void+ children: React.ReactNode+}++/**+ * Composable metric tile — a headline number, a `Badge` change pill, and an optional `Sparkline`.+ * `Metric` is content, not a surface: wrap it in `<Card flush>` for the border. The root owns the data+ * and hover behavior and hands every derived display value to its parts via context; you choose the+ * layout by composing the parts. It owns its inline padding (`px-4`) so `MetricSparkline` can bleed out.+ *+ * ```tsx+ * <Card flush>+ * <Metric data={data} labels={labels} theme={theme} color="#fb7185">+ * <MetricHeader>+ * <MetricTitle>Active users</MetricTitle>+ * <MetricDelta />+ * </MetricHeader>+ * <MetricValue />+ * <MetricSubtitle />+ * <MetricSparkline />+ * </Metric>+ * </Card>+ * ```+ */+export function Metric(props: MetricProps): React.ReactElement | null {+ const { onError, ...rest } = props+ return (+ <ChartErrorBoundary onError={onError}>+ <MetricInner {...rest} />+ </ChartErrorBoundary>+ )+}++function MetricInner({+ value,+ data,+ labels,+ theme,+ color,+ sparklineHeight = 120,+ sparklineFill = false,+ sparklineFillOpacity = 0.35,+ sparklineDashedFromIndex,+ formatValue = DEFAULT_FORMAT_VALUE,+ formatChange = DEFAULT_FORMAT_CHANGE,+ showChange = true,+ change,+ goodDirection = 'up',+ changeTooltip,+ subtitle,+ restingSubtitle,+ hoverChangeFromPreviousPoint = false,+ animationMs = 350,+ hoverIntentMs = 140,+ className,+ dataAttr,+ children,+}: Omit<MetricProps, 'onError'>): React.ReactElement | null {+ const sparklineData = data != null && data.length > 0 && theme != null ? data : null+ const lastIndex = sparklineData ? sparklineData.length - 1 : -1++ const [hoverIndex, setHoverIndex] = React.useState(-1)+ const intentIndex = useHoverIntent(hoverIndex, hoverIntentMs)+ const activeIndex = intentIndex >= 0 ? intentIndex : lastIndex++ const restingValue = value ?? (sparklineData ? sparklineData[lastIndex] : undefined)+ const animationTarget = sparklineData && intentIndex >= 0 ? (sparklineData[intentIndex] ?? 0) : (restingValue ?? 0)+ const animatedValue = useAnimatedNumber(animationTarget, animationMs)++ const baselineValue = React.useMemo(+ () => sparklineData?.find((v) => v !== 0 && Number.isFinite(v)),+ [sparklineData]+ )++ const ctx = React.useMemo<MetricContextValue | null>(() => {+ if (restingValue == null) {+ return null+ }++ const liveValue = sparklineData ? (sparklineData[activeIndex] ?? 0) : restingValue+ const usePrevPointHover = hoverChangeFromPreviousPoint && intentIndex >= 0 && sparklineData != null+ const fallbackChangePercent = computeFallbackChangePercent(+ sparklineData,+ usePrevPointHover,+ intentIndex,+ liveValue,+ baselineValue+ )++ // A supplied `change` shows at rest; while hovering with `hoverChangeFromPreviousPoint` it yields+ // to the point-vs-previous delta — except an explicit `null` (suppress) stays suppressed on hover.+ const delta = resolveDelta({+ showChange,+ change: usePrevPointHover && change !== null ? undefined : change,+ fallbackChangePercent,+ formatChange,+ })+ const positive = delta != null && delta.value >= 0+ const good = goodDirection === 'up' ? positive : !positive++ return {+ headlineDisplay: sparklineData ? formatValue(animatedValue) : formatValue(restingValue),+ subtitle:+ subtitle ?? (intentIndex < 0 && restingSubtitle != null ? restingSubtitle : labels?.[activeIndex]),+ change:+ delta != null+ ? {+ delta,+ positive,+ good,+ // The tooltip describes the resting comparison, so hide it on the per-point delta.+ tooltip: usePrevPointHover ? undefined : changeTooltip,+ }+ : null,+ sparkline: sparklineData+ ? {+ data: sparklineData,+ labels,+ theme: theme!,+ color,+ height: sparklineHeight,+ fill: sparklineFill,+ fillOpacity: sparklineFillOpacity,+ dashedFromIndex: sparklineDashedFromIndex,+ setHoverIndex,+ }+ : null,+ }+ }, [+ restingValue,+ sparklineData,+ activeIndex,+ intentIndex,+ hoverChangeFromPreviousPoint,+ baselineValue,+ showChange,+ change,+ formatChange,+ changeTooltip,+ goodDirection,+ formatValue,+ animatedValue,+ subtitle,+ restingSubtitle,+ labels,+ theme,+ color,+ sparklineHeight,+ sparklineFill,+ sparklineFillOpacity,+ sparklineDashedFromIndex,+ ])++ if (ctx == null) {+ return null+ }++ // Metric is content, not a surface — wrap it in `<Card flush>` for the border. It owns its inline+ // padding (`px-4`, like `CardContent`) so the text insets and a `MetricSparkline` can bleed back out+ // with `-mx-4`; block padding + the bottom edge come from the wrapping card.+ return (+ <MetricContext.Provider value={ctx}>+ <div data-attr={dataAttr} className={cn('flex h-full flex-col px-4', className)}>+ {children}+ </div>+ </MetricContext.Provider>+ )+}++/** Header row: title on the left, change pill (or anything) on the right. */+export function MetricHeader({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {+ return <div className={cn('flex items-start justify-between gap-2', className)} {...props} />+}++export function MetricTitle({ className, ...props }: React.ComponentProps<'div'>): React.ReactElement {+ return <div className={cn('text-sm font-medium', className)} {...props} />+}++/** Headline number. Follows the hovered sparkline point; pass `children` to render your own, or a+ * `text-*` class to resize it (cn lets your size win over the default `text-4xl`). */+export function MetricValue({ className, children, ...props }: React.ComponentProps<'div'>): React.ReactElement {+ const { headlineDisplay } = useMetric('MetricValue')+ return (+ <div className={cn('min-w-0 truncate text-4xl font-bold tracking-tight tabular-nums', className)} {...props}>+ {children ?? headlineDisplay}+ </div>+ )+}++/** Change pill — a `Badge` (success/destructive by `goodDirection`) with a directional chevron.+ * Renders nothing when there is no resolved delta. */+export function MetricDelta({ className }: { className?: string }): React.ReactElement | null {+ const { change } = useMetric('MetricDelta')+ if (change == null) {+ return null+ }+ const Chevron = change.positive ? ChevronUp : ChevronDown+ const badge = (+ <Badge+ variant={change.good ? 'success' : 'destructive'}+ className={cn('gap-0.5 rounded-full tabular-nums', className)}+ data-attr="metric-change-pill"+ >+ <Chevron className="size-3" />+ {change.delta.label}+ </Badge>+ )+ if (change.tooltip == null) {+ return badge+ }+ return (+ <Tooltip>+ <TooltipTrigger render={badge} />+ <TooltipContent>{change.tooltip}</TooltipContent>+ </Tooltip>+ )+}++/** Caption under the headline. Renders nothing when empty; pass `children` to override. */+export function MetricSubtitle({+ className,+ children,+ ...props+}: React.ComponentProps<'div'>): React.ReactElement | null {+ const { subtitle } = useMetric('MetricSubtitle')+ const content = children ?? subtitle+ if (content == null || content === '') {+ return null+ }+ return (+ <div className={cn('text-sm opacity-60', className)} data-attr="metric-subtitle" {...props}>+ {content}+ </div>+ )+}++/** Sparkline, bled out to the card edges. Renders nothing when no series was supplied to the root. */+export function MetricSparkline({+ className = '-mx-4 -mb-4 mt-4 relative top-[6px] flex-1',+}: {+ className?: string+}): React.ReactElement | null {+ const { sparkline } = useMetric('MetricSparkline')+ if (sparkline == null) {+ return null+ }+ // A fixed-height sparkline drops to the bottom of a taller card via `mt-auto`; a filling sparkline+ // grows into the free space itself, so it must not also claim that space with a margin. `-mx-4`/`-mb-4`+ // cancel the card's content padding so the chart reaches the left/right/bottom edges.+ const pinBottom = sparkline.fill ? '' : 'mt-auto'+ return (+ <Sparkline+ data={sparkline.data}+ labels={sparkline.labels}+ theme={sparkline.theme}+ color={sparkline.color}+ height={sparkline.height}+ fill={sparkline.fill}+ fillOpacity={sparkline.fillOpacity}+ dashedFromIndex={sparkline.dashedFromIndex}+ onHoverIndexChange={sparkline.setHoverIndex}+ className={cn(pinBottom, className)}+ dataAttr="metric-sparkline"+ />+ )+}diff --git a/packages/quill/packages/components/vite.config.ts b/packages/quill/packages/components/vite.config.tsindex 3997fa612939..b6e67d99f5d3 100644--- a/packages/quill/packages/components/vite.config.ts+++ b/packages/quill/packages/components/vite.config.ts@@ -8,12 +8,24 @@ export default defineConfig({plugins: [react(), tailwindcss(), dts({ tsconfigPath: resolve(__dirname, 'tsconfig.build.json') })],build: {lib: {- entry: resolve(__dirname, 'src/index.ts'),+ // `metric` is a separate entry (not part of the main barrel) so its `@posthog/quill-charts`+ // dependency only loads for consumers that import `@posthog/quill-components/metric`.+ entry: {+ index: resolve(__dirname, 'src/index.ts'),+ metric: resolve(__dirname, 'src/metric.tsx'),+ },formats: ['es', 'cjs'],- fileName: (format) => `index.${format === 'es' ? 'js' : 'cjs'}`,+ fileName: (format, entryName) => `${entryName}.${format === 'es' ? 'js' : 'cjs'}`,},rollupOptions: {- external: ['react', 'react-dom', 'react/jsx-runtime', '@posthog/quill-tokens', '@posthog/quill-primitives'],+ external: [+ 'react',+ 'react-dom',+ 'react/jsx-runtime',+ '@posthog/quill-tokens',+ '@posthog/quill-primitives',+ '@posthog/quill-charts',+ ],},cssCodeSplit: false,},diff --git a/packages/quill/packages/primitives/AGENTS.md b/packages/quill/packages/primitives/AGENTS.mdindex 57022631ae8c..5b36af57cb9e 100644--- a/packages/quill/packages/primitives/AGENTS.md+++ b/packages/quill/packages/primitives/AGENTS.md@@ -249,6 +249,8 @@ Stack cards with merged borders:</Card>```+For a stat tile (headline number + change pill + sparkline), don't hand-build one in a `Card` — wrap `Metric` (from `@posthog/quill-components/metric`) in `<Card flush>`. See its section in `../components/AGENTS.md`.+### Field (forms)Always use Field for form controls, not raw Label + Input:diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex f01c557148c2..596c5cdf343e 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -460,7 +460,7 @@ importers:version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])'@storybook/react-webpack5':specifier: ^8.6.14- version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])+ version: 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])'@storybook/test-runner':specifier: ^0.19.1version: 0.19.1([email protected]([email protected]))@@ -514,7 +514,7 @@ importers:version: 2.0.0([email protected])webpack:specifier: ^5.94.0- version: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])webpack-cli:specifier: ^5.1.4version: 5.1.4([email protected])@@ -1985,22 +1985,25 @@ importers:version: 18.3.7(@types/[email protected])'@vitejs/plugin-react':specifier: ^5.1.1- version: 5.2.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 5.2.0([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))jest:specifier: ^29.7.0- version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ version: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))typescript:specifier: 6.0.3version: 6.0.3vite:specifier: ^6.3.5- version: 6.4.2(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ version: 6.4.2(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])vite-plugin-dts:specifier: ^4.5.4- version: 4.5.4(@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 4.5.4(@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))packages/quill/packages/components:dependencies:+ '@posthog/quill-charts':+ specifier: workspace:^+ version: link:../charts'@posthog/quill-primitives':specifier: workspace:^version: link:../primitives@@ -3353,7 +3356,7 @@ importers:version: 2.1.1jest:specifier: '*'- version: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ version: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))kea:specifier: 'catalog:'version: 4.0.0-pre.5([email protected])@@ -4194,7 +4197,7 @@ importers:version: 1.2.1jest:specifier: '*'- version: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ version: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))kea:specifier: 'catalog:'version: 4.0.0-pre.5([email protected])@@ -27208,6 +27211,41 @@ snapshots:- ts-node- utf-8-validate+ '@jest/[email protected]':+ dependencies:+ '@jest/console': 29.7.0+ '@jest/reporters': 29.7.0+ '@jest/test-result': 29.7.0+ '@jest/transform': 29.7.0+ '@jest/types': 29.6.3+ '@types/node': 22.18.8+ ansi-escapes: 4.3.2+ chalk: 4.1.2+ ci-info: 3.8.0+ exit: 0.1.2+ graceful-fs: 4.2.11+ jest-changed-files: 29.7.0+ jest-config: 29.7.0(@types/[email protected])+ jest-haste-map: 29.7.0+ jest-message-util: 29.7.0+ jest-regex-util: 29.6.3+ jest-resolve: 29.7.0+ jest-resolve-dependencies: 29.7.0+ jest-runner: 29.7.0+ jest-runtime: 29.7.0+ jest-snapshot: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ jest-watcher: 29.7.0+ micromatch: 4.0.8+ pretty-format: 29.7.0+ slash: 3.0.0+ strip-ansi: 6.0.1+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color+ - ts-node+'@jest/[email protected]([email protected](@swc/[email protected])(@types/[email protected])([email protected]))':dependencies:'@jest/console': 29.7.0@@ -27349,6 +27387,42 @@ snapshots:- supports-color- ts-node+ '@jest/[email protected]([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))':+ dependencies:+ '@jest/console': 30.0.5+ '@jest/pattern': 30.0.1+ '@jest/reporters': 30.0.5+ '@jest/test-result': 30.0.5+ '@jest/transform': 30.0.5+ '@jest/types': 30.0.5+ '@types/node': 22.18.8+ ansi-escapes: 4.3.2+ chalk: 4.1.2+ ci-info: 4.3.0+ exit-x: 0.2.2+ graceful-fs: 4.2.11+ jest-changed-files: 30.0.5+ jest-config: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest-haste-map: 30.0.5+ jest-message-util: 30.0.5+ jest-regex-util: 30.0.1+ jest-resolve: 30.0.5+ jest-resolve-dependencies: 30.0.5+ jest-runner: 30.0.5+ jest-runtime: 30.0.5+ jest-snapshot: 30.0.5+ jest-util: 30.0.5+ jest-validate: 30.0.5+ jest-watcher: 30.0.5+ micromatch: 4.0.8+ pretty-format: 30.0.5+ slash: 3.0.0+ transitivePeerDependencies:+ - babel-plugin-macros+ - esbuild-register+ - supports-color+ - ts-node+'@jest/[email protected]':dependencies:'@jest/types': 29.6.3@@ -28024,6 +28098,14 @@ snapshots:transitivePeerDependencies:- '@types/react'+ '@microsoft/[email protected](@types/[email protected])':+ dependencies:+ '@microsoft/tsdoc': 0.16.0+ '@microsoft/tsdoc-config': 0.18.1+ '@rushstack/node-core-library': 5.21.0(@types/[email protected])+ transitivePeerDependencies:+ - '@types/node'+'@microsoft/[email protected](@types/[email protected])':dependencies:'@microsoft/tsdoc': 0.16.0@@ -28032,6 +28114,25 @@ snapshots:transitivePeerDependencies:- '@types/node'+ '@microsoft/[email protected](@types/[email protected])':+ dependencies:+ '@microsoft/api-extractor-model': 7.33.5(@types/[email protected])+ '@microsoft/tsdoc': 0.16.0+ '@microsoft/tsdoc-config': 0.18.1+ '@rushstack/node-core-library': 5.21.0(@types/[email protected])+ '@rushstack/rig-package': 0.7.2+ '@rushstack/terminal': 0.22.4(@types/[email protected])+ '@rushstack/ts-command-line': 5.3.4(@types/[email protected])+ diff: 8.0.4+ lodash: 4.18.1+ minimatch: 10.2.3+ resolve: 1.22.8+ semver: 7.5.4+ source-map: 0.6.1+ typescript: 6.0.3+ transitivePeerDependencies:+ - '@types/node'+'@microsoft/[email protected](@types/[email protected])':dependencies:'@microsoft/api-extractor-model': 7.33.5(@types/[email protected])@@ -30713,6 +30814,19 @@ snapshots:'@rollup/[email protected]':optional: true+ '@rushstack/[email protected](@types/[email protected])':+ dependencies:+ ajv: 8.18.0+ ajv-draft-04: 1.0.0([email protected])+ ajv-formats: 3.0.1([email protected])+ fs-extra: 11.3.5+ import-lazy: 4.0.0+ jju: 1.4.0+ resolve: 1.22.8+ semver: 7.5.4+ optionalDependencies:+ '@types/node': 22.18.8+'@rushstack/[email protected](@types/[email protected])':dependencies:ajv: 8.18.0@@ -30726,6 +30840,10 @@ snapshots:optionalDependencies:'@types/node': 25.8.0+ '@rushstack/[email protected](@types/[email protected])':+ optionalDependencies:+ '@types/node': 22.18.8+'@rushstack/[email protected](@types/[email protected])':optionalDependencies:'@types/node': 25.8.0@@ -30735,6 +30853,14 @@ snapshots:resolve: 1.22.8strip-json-comments: 3.1.1+ '@rushstack/[email protected](@types/[email protected])':+ dependencies:+ '@rushstack/node-core-library': 5.21.0(@types/[email protected])+ '@rushstack/problem-matcher': 0.2.1(@types/[email protected])+ supports-color: 8.1.1+ optionalDependencies:+ '@types/node': 22.18.8+'@rushstack/[email protected](@types/[email protected])':dependencies:'@rushstack/node-core-library': 5.21.0(@types/[email protected])@@ -30743,6 +30869,15 @@ snapshots:optionalDependencies:'@types/node': 25.8.0+ '@rushstack/[email protected](@types/[email protected])':+ dependencies:+ '@rushstack/terminal': 0.22.4(@types/[email protected])+ '@types/argparse': 1.0.38+ argparse: 1.0.10+ string-argv: 0.3.2+ transitivePeerDependencies:+ - '@types/node'+'@rushstack/[email protected](@types/[email protected])':dependencies:'@rushstack/terminal': 0.22.4(@types/[email protected])@@ -31517,7 +31652,7 @@ snapshots:ts-dedent: 2.2.0vite: 5.4.21(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])- '@storybook/[email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])':+ '@storybook/[email protected]([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':dependencies:'@storybook/core-webpack': 8.6.18([email protected]([email protected]))'@types/semver': 7.7.1@@ -31535,12 +31670,12 @@ snapshots:semver: 7.8.0storybook: 8.6.18([email protected])style-loader: 3.3.3([email protected])- terser-webpack-plugin: 5.6.0(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ terser-webpack-plugin: 5.6.0([email protected]([email protected]))([email protected])([email protected])ts-dedent: 2.2.0url: 0.11.1util: 0.12.5util-deprecate: 1.0.2- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])webpack-dev-middleware: 6.1.3([email protected])webpack-hot-middleware: 2.25.4webpack-virtual-modules: 0.6.2@@ -31634,7 +31769,7 @@ snapshots:dependencies:storybook: 8.6.18([email protected])- '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':+ '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':dependencies:'@storybook/core-webpack': 8.6.18([email protected]([email protected]))'@storybook/react': 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])@@ -31649,7 +31784,7 @@ snapshots:semver: 7.8.0storybook: 8.6.18([email protected])tsconfig-paths: 4.2.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])optionalDependencies:typescript: 6.0.3transitivePeerDependencies:@@ -31683,7 +31818,7 @@ snapshots:react-docgen-typescript: 2.2.2([email protected])tslib: 2.8.1typescript: 6.0.3- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])transitivePeerDependencies:- supports-color@@ -31721,10 +31856,10 @@ snapshots:- supports-color- typescript- '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':+ '@storybook/[email protected](@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])':dependencies:- '@storybook/builder-webpack5': 8.6.18(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])- '@storybook/preset-react-webpack': 8.6.18(@storybook/[email protected]([email protected]([email protected])))(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])+ '@storybook/builder-webpack5': 8.6.18([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])+ '@storybook/preset-react-webpack': 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])([email protected])'@storybook/react': 8.6.18(@storybook/[email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected])([email protected]([email protected]))([email protected])react: 18.3.1react-dom: 18.3.1([email protected])@@ -31818,7 +31953,7 @@ snapshots:'@swc/core': 1.15.18'@swc/jest': 0.2.37(@swc/[email protected])expect-playwright: 0.8.0- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-circus: 29.7.0jest-environment-node: 29.7.0jest-junit: 16.0.0@@ -33824,6 +33959,18 @@ snapshots:transitivePeerDependencies:- supports-color+ '@vitejs/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':+ dependencies:+ '@babel/core': 7.29.0+ '@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/[email protected])+ '@babel/plugin-transform-react-jsx-source': 7.27.1(@babel/[email protected])+ '@rolldown/pluginutils': 1.0.0-rc.3+ '@types/babel__core': 7.20.5+ react-refresh: 0.18.0+ vite: 6.4.2(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ transitivePeerDependencies:+ - supports-color+'@vitejs/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@babel/core': 7.29.0@@ -34130,17 +34277,17 @@ snapshots:dependencies:- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])webpack-cli: 5.1.4([email protected])dependencies:- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])webpack-cli: 5.1.4([email protected])dependencies:- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])webpack-cli: 5.1.4([email protected])'@xmldom/[email protected]': {}@@ -34662,7 +34809,7 @@ snapshots:loader-utils: 2.0.4make-dir: 3.1.0schema-utils: 2.7.1- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -35568,6 +35715,21 @@ snapshots:safe-buffer: 5.2.1sha.js: 2.4.12+ dependencies:+ '@jest/types': 29.6.3+ chalk: 4.1.2+ exit: 0.1.2+ graceful-fs: 4.2.11+ jest-config: 29.7.0+ jest-util: 29.7.0+ prompts: 2.4.2+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/types': 29.6.3@@ -35701,7 +35863,7 @@ snapshots:postcss-value-parser: 4.2.0schema-utils: 2.7.1semver: 6.3.1- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -35713,7 +35875,7 @@ snapshots:postcss-modules-values: 4.0.0([email protected])postcss-value-parser: 4.2.0semver: 7.8.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -37294,7 +37456,7 @@ snapshots:dependencies:loader-utils: 2.0.4schema-utils: 3.3.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])@@ -37413,7 +37575,7 @@ snapshots:semver: 7.8.0tapable: 2.3.3typescript: 6.0.3- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -38075,7 +38237,7 @@ snapshots:dependencies:html-webpack-plugin: 5.5.3([email protected])- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -38084,7 +38246,7 @@ snapshots:lodash: 4.18.1pretty-error: 4.0.0tapable: 2.2.1- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -38807,6 +38969,25 @@ snapshots:- ts-node- utf-8-validate+ dependencies:+ '@jest/core': 29.7.0+ '@jest/test-result': 29.7.0+ '@jest/types': 29.6.3+ chalk: 4.1.2+ create-jest: 29.7.0+ exit: 0.1.2+ import-local: 3.2.0+ jest-config: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ yargs: 17.7.2+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))@@ -38883,6 +39064,25 @@ snapshots:- supports-color- ts-node+ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@jest/core': 30.0.5([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ '@jest/test-result': 30.0.5+ '@jest/types': 30.0.5+ chalk: 4.1.2+ exit-x: 0.2.2+ import-local: 3.2.0+ jest-config: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest-util: 30.0.5+ jest-validate: 30.0.5+ yargs: 17.7.2+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - esbuild-register+ - supports-color+ - ts-node+[email protected]([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@babel/core': 7.29.0@@ -38917,6 +39117,64 @@ snapshots:- supports-color- utf-8-validate+ dependencies:+ '@babel/core': 7.29.0+ '@jest/test-sequencer': 29.7.0+ '@jest/types': 29.6.3+ babel-jest: 29.7.0(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 3.8.0+ deepmerge: 4.3.1+ glob: 7.2.3+ graceful-fs: 4.2.11+ jest-circus: 29.7.0+ jest-environment-node: 29.7.0+ jest-get-type: 29.6.3+ jest-regex-util: 29.6.3+ jest-resolve: 29.7.0+ jest-runner: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 29.7.0+ slash: 3.0.0+ strip-json-comments: 3.1.1+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color++ [email protected](@types/[email protected]):+ dependencies:+ '@babel/core': 7.29.0+ '@jest/test-sequencer': 29.7.0+ '@jest/types': 29.6.3+ babel-jest: 29.7.0(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 3.8.0+ deepmerge: 4.3.1+ glob: 7.2.3+ graceful-fs: 4.2.11+ jest-circus: 29.7.0+ jest-environment-node: 29.7.0+ jest-get-type: 29.6.3+ jest-regex-util: 29.6.3+ jest-resolve: 29.7.0+ jest-runner: 29.7.0+ jest-util: 29.7.0+ jest-validate: 29.7.0+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 29.7.0+ slash: 3.0.0+ strip-json-comments: 3.1.1+ optionalDependencies:+ '@types/node': 22.18.8+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@babel/core': 7.29.0@@ -39075,6 +39333,74 @@ snapshots:- babel-plugin-macros- supports-color+ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@babel/core': 7.29.0+ '@jest/get-type': 30.0.1+ '@jest/pattern': 30.0.1+ '@jest/test-sequencer': 30.0.5+ '@jest/types': 30.0.5+ babel-jest: 30.0.5(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 4.3.0+ deepmerge: 4.3.1+ glob: 10.5.0+ graceful-fs: 4.2.11+ jest-circus: 30.0.5+ jest-docblock: 30.0.1+ jest-environment-node: 30.0.5+ jest-regex-util: 30.0.1+ jest-resolve: 30.0.5+ jest-runner: 30.0.5+ jest-util: 30.0.5+ jest-validate: 30.0.5+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 30.0.5+ slash: 3.0.0+ strip-json-comments: 3.1.1+ optionalDependencies:+ '@types/node': 22.18.8+ esbuild-register: 3.6.0([email protected])+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color++ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@babel/core': 7.29.0+ '@jest/get-type': 30.0.1+ '@jest/pattern': 30.0.1+ '@jest/test-sequencer': 30.0.5+ '@jest/types': 30.0.5+ babel-jest: 30.0.5(@babel/[email protected])+ chalk: 4.1.2+ ci-info: 4.3.0+ deepmerge: 4.3.1+ glob: 10.5.0+ graceful-fs: 4.2.11+ jest-circus: 30.0.5+ jest-docblock: 30.0.1+ jest-environment-node: 30.0.5+ jest-regex-util: 30.0.1+ jest-resolve: 30.0.5+ jest-runner: 30.0.5+ jest-util: 30.0.5+ jest-validate: 30.0.5+ micromatch: 4.0.8+ parse-json: 5.2.0+ pretty-format: 30.0.5+ slash: 3.0.0+ strip-json-comments: 3.1.1+ optionalDependencies:+ '@types/node': 25.8.0+ esbuild-register: 3.6.0([email protected])+ transitivePeerDependencies:+ - babel-plugin-macros+ - supports-color+dependencies:chalk: 4.1.2@@ -39449,7 +39775,7 @@ snapshots:dependencies:expect-playwright: 0.8.0- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-circus: 29.7.0jest-environment-node: 29.7.0jest-process-manager: 0.4.0@@ -39884,7 +40210,7 @@ snapshots:dependencies:ansi-escapes: 6.0.0chalk: 5.6.2- jest: 29.7.0(@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ jest: 29.7.0jest-regex-util: 29.6.3jest-watcher: 29.7.0slash: 5.1.0@@ -39956,6 +40282,18 @@ snapshots:- ts-node- utf-8-validate+ dependencies:+ '@jest/core': 29.7.0+ '@jest/types': 29.6.3+ import-local: 3.2.0+ jest-cli: 29.7.0+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - supports-color+ - ts-node+[email protected](@types/[email protected])([email protected](@swc/[email protected])(@types/[email protected])([email protected])):dependencies:'@jest/core': 29.7.0([email protected](@swc/[email protected])(@types/[email protected])([email protected]))@@ -40005,6 +40343,19 @@ snapshots:- supports-color- ts-node+ [email protected](@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected])):+ dependencies:+ '@jest/core': 30.0.5([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ '@jest/types': 30.0.5+ import-local: 3.2.0+ jest-cli: 30.0.5(@types/[email protected])([email protected]([email protected]))([email protected](@swc/[email protected])(@types/[email protected])([email protected]))+ transitivePeerDependencies:+ - '@types/node'+ - babel-plugin-macros+ - esbuild-register+ - supports-color+ - ts-node+@@ -40311,7 +40662,7 @@ snapshots:less: 4.2.2loader-utils: 2.0.4schema-utils: 3.3.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -42567,7 +42918,7 @@ snapshots:postcss: 8.5.15schema-utils: 3.3.0semver: 7.7.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -43336,7 +43687,7 @@ snapshots:dependencies:loader-utils: 2.0.4schema-utils: 3.3.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -44372,7 +44723,7 @@ snapshots:neo-async: 2.6.2schema-utils: 3.3.0semver: 7.7.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])optionalDependencies:sass: 1.56.0@@ -45036,11 +45387,11 @@ snapshots:dependencies:loader-utils: 2.0.4schema-utils: 3.3.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])@@ -45407,30 +45758,28 @@ snapshots:ansi-escapes: 4.3.2supports-hyperlinks: 2.3.0- [email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]):+ [email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])):dependencies:'@jridgewell/trace-mapping': 0.3.29jest-worker: 27.5.1schema-utils: 4.3.3terser: 5.46.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])optionalDependencies:'@swc/core': 1.15.18cssnano: 7.0.6([email protected])- esbuild: 0.25.12+ esbuild: 0.28.0postcss: 8.5.15- [email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])):dependencies:'@jridgewell/trace-mapping': 0.3.29jest-worker: 27.5.1schema-utils: 4.3.3terser: 5.46.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])optionalDependencies:- '@swc/core': 1.15.18cssnano: 7.0.6([email protected])- esbuild: 0.28.0postcss: 8.5.15@@ -46273,6 +46622,25 @@ snapshots:- tsx- yaml+ [email protected](@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):+ dependencies:+ '@microsoft/api-extractor': 7.58.1(@types/[email protected])+ '@rollup/pluginutils': 5.3.0([email protected])+ '@volar/typescript': 2.4.28+ '@vue/language-core': 2.2.0([email protected])+ compare-versions: 6.1.1+ debug: 4.4.3+ kolorist: 1.8.0+ local-pkg: 1.1.2+ magic-string: 0.30.21+ typescript: 6.0.3+ optionalDependencies:+ vite: 6.4.2(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ transitivePeerDependencies:+ - '@types/node'+ - rollup+ - supports-color+[email protected](@types/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:'@microsoft/api-extractor': 7.58.1(@types/[email protected])@@ -46348,6 +46716,26 @@ snapshots:sass-embedded: 1.70.0terser: 5.46.0+ [email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]):+ dependencies:+ esbuild: 0.25.12+ fdir: 6.5.0([email protected])+ picomatch: 4.0.4+ postcss: 8.5.15+ rollup: 4.60.4+ tinyglobby: 0.2.16+ optionalDependencies:+ '@types/node': 22.18.8+ fsevents: 2.3.3+ jiti: 2.6.1+ less: 4.2.2+ lightningcss: 1.32.0+ sass: 1.56.0+ sass-embedded: 1.70.0+ terser: 5.46.0+ tsx: 4.20.5+ yaml: 2.9.0+[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:esbuild: 0.25.12@@ -46650,7 +47038,7 @@ snapshots:import-local: 3.1.0interpret: 3.1.1rechoir: 0.8.0- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])webpack-merge: 5.8.0@@ -46661,7 +47049,7 @@ snapshots:range-parser: 1.2.1schema-utils: 4.3.3optionalDependencies:- webpack: 5.105.4(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])dependencies:@@ -46680,7 +47068,7 @@ snapshots:- [email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected]):+ [email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected]):dependencies:'@types/eslint-scope': 3.7.7'@types/estree': 1.0.8@@ -46704,11 +47092,9 @@ snapshots:neo-async: 2.6.2schema-utils: 4.3.3tapable: 2.3.0- terser-webpack-plugin: 5.6.0(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])+ terser-webpack-plugin: 5.6.0(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected]))watchpack: 2.5.1webpack-sources: 3.3.4- optionalDependencies:- webpack-cli: 5.1.4([email protected])transitivePeerDependencies:- '@minify-html/node'- '@swc/core'@@ -46723,7 +47109,7 @@ snapshots:- postcss- uglify-js- [email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected]):dependencies:'@types/eslint-scope': 3.7.7'@types/estree': 1.0.8@@ -46747,9 +47133,11 @@ snapshots:neo-async: 2.6.2schema-utils: 4.3.3tapable: 2.3.0- terser-webpack-plugin: 5.6.0(@swc/[email protected])([email protected]([email protected]))([email protected])([email protected])([email protected](@swc/[email protected])([email protected]([email protected]))([email protected])([email protected]))+ terser-webpack-plugin: 5.6.0([email protected]([email protected]))([email protected])([email protected])watchpack: 2.5.1webpack-sources: 3.3.4+ optionalDependencies:+ webpack-cli: 5.1.4([email protected])transitivePeerDependencies:- '@minify-html/node'- '@swc/core'