@42-central/ui-react 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -354,7 +354,14 @@ var TimelineItem = ({
|
|
|
354
354
|
state,
|
|
355
355
|
radius
|
|
356
356
|
}),
|
|
357
|
-
"size-(--tl-bullet-size) grid place-items-center
|
|
357
|
+
"size-(--tl-bullet-size) grid place-items-center",
|
|
358
|
+
// A surface clips what it holds to its shape. A subtle bullet has none: its
|
|
359
|
+
// custom bullet shows whole, with whatever it draws around itself (a badge's
|
|
360
|
+
// glow), and centred on the line even when wider than the bullet (a pill):
|
|
361
|
+
// its one column is held to the bullet's width (it would grow to the content's
|
|
362
|
+
// and overflow to the end), and `unsafe` centres the content within it instead
|
|
363
|
+
// of falling back to start alignment on overflow.
|
|
364
|
+
variant === "subtle" ? "overflow-visible grid-cols-[100%] [place-items:unsafe_center]" : "overflow-hidden",
|
|
358
365
|
// Zero specificity (`:where`), as in ActionIcon: a size class on
|
|
359
366
|
// the icon itself wins over the bullet's default fill.
|
|
360
367
|
"[:where(&)_svg]:size-full [:where(&)_svg]:p-0.5",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/timeline/timeline.tsx"],"names":["lineVariant","stateLabel"],"mappings":";;;;;;;;;;AAyBA,IAAM,WAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,UAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,QAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAyCA,IAAM,gBAAA,GAAmB,GAAA;AAAA,EACvB;AAAA,IACE,qFAAA;AAAA;AAAA;AAAA,IAGA,gFAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,qCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA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AA;AAOF,IAAM,kBAAkB,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAG,MAAK,qBACpD,GAAA;AAAA,EAAC,GAAA,CAAI,GAAA;AAAA,EAAJ;AAAA,IACC,WAAA,EAAU,SAAA;AAAA,IACV,SAAA,EAAW,EAAA,CAAG,aAAA,EAAe,SAAS,CAAA;AAAA,IACrC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAeF,IAAM,gBAAgB,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAG,MAAK,qBAClD,GAAA;AAAA,EAAC,GAAA,CAAI,IAAA;AAAA,EAAJ;AAAA,IACC,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,kBAAA,CAAmB,SAAS,SAAS,CAAA;AAAA,IACvE,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAGK,IAAM,QAAA,GAAW,MAAA,CAAO,MAAA,CAAO,YAAA,EAAc;AAAA,EAClD,IAAA,EAAM,YAAA;AAAA,EACN,KAAA,EAAO,aAAA;AAAA,EACP,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO;AACT,CAAC","file":"index.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { CSSProperties, ReactElement, ReactNode } from \"react\"\nimport { Children, cloneElement, isValidElement } from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport {\n buildGradientVars,\n GRADIENT_DIR_CLASS,\n type GradientDir,\n type GradientProps,\n} from \"../../lib/gradient\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Bullet diameter per `Size`, in the same steps Tailwind's `size-3.5..7`\n * utilities resolve to. Shared by the root's default (set as a CSS custom\n * property, see `timelineVariants`) and `Timeline.Item`'s own `size` override\n * (set as an inline style — see `TimelineItem`), so both ends of the default/\n * override split read from one source of truth.\n */\nconst BULLET_SIZE: Record<Size, string> = {\n xs: \"0.875rem\",\n sm: \"1rem\",\n md: \"1.25rem\",\n lg: \"1.5rem\",\n xl: \"1.75rem\",\n}\n\n/**\n * Three shared column tracks: an optional leading `label` (e.g. a date), the\n * fixed `axis` (bullet + connecting line), and the main `content`. Each\n * `Timeline.Item` re-declares these same tracks via `grid-cols-subgrid`, so\n * columns stay aligned across items even though any given item may only\n * populate one or two of the three.\n *\n * `label` and `axis` deliberately use `max-content` (not `auto`) as their max\n * sizing function: a track that no item populates collapses to exactly 0\n * instead of reserving dead space (the classic complaint with MUI's\n * `TimelineOppositeContent`, which reserves equal flex-basis whether or not\n * anything renders into it) — `max-content` sizes purely from the track's\n * actual content and never grows further. `auto` looks like the obvious\n * choice here but isn't: the grid track-sizing algorithm's \"maximize tracks\"\n * step expands *any* track whose max function is literally `auto` to absorb\n * leftover free space in the grid, even ones with zero content in every row —\n * that's the one column-sizing keyword this collapsing behavior can't use.\n * `content` gets the explicit `1fr` instead, so it's the one track that\n * intentionally absorbs whatever width `label`/`axis` don't need.\n *\n * `size` only ever touches dimensions (bullet size, line thickness, gaps,\n * spacing, text scale) via descendant selectors on stable `data-part` hooks —\n * never shape or color — so parts stay dumb and the whole tree stays a pure\n * Server Component, the same split `Table` uses for its `size` variant.\n *\n * The bullet's dimension is the one exception routed through a CSS custom\n * property (`--tl-bullet-size`, consumed by the bullet's own `size-(--tl-bullet-size)`\n * class, and by the line's `mt-(--tl-bullet-size)` — see `TimelineItem`)\n * rather than a plain `size-*` utility: a `Timeline.Item` can then override\n * just its own bullet (and keep the line in sync with it) via an inline\n * style on that same property, which always wins over the cascaded\n * class-based default regardless of selector specificity — a plain utility\n * class on the item couldn't reliably beat this descendant selector's own\n * specificity. It's declared on the root (not scoped to `[data-part=bullet]`)\n * so it cascades to the line too, not just the bullet that reads it first.\n * Each value below is a static literal (not built from `BULLET_SIZE` via\n * interpolation) because Tailwind's scanner needs the literal arbitrary-value\n * text in the source — an interpolated class name is invisible to it.\n */\nconst timelineVariants = cva(\n [\n \"m-0 grid list-none ps-0 grid-cols-[minmax(0,max-content)_max-content_minmax(0,1fr)]\",\n // The `default` bullet's own inverted fill (see `timelineBulletVariants`),\n // as a connector endpoint.\n \"[--tl-inverted:var(--color-brand-950)] dark:[--tl-inverted:var(--color-white)]\",\n // The palette an uncolored bullet draws in (the root's neutral, unless a\n // `data-color` ancestor says otherwise), captured here once. An uncolored\n // line end reads these instead of a bare `--c-*`: its inner span sits\n // inside the outer span's `data-color`, where a bare slot would resolve to\n // the *previous* item's palette, not the ambient one its bullet uses.\n \"[--tl-ambient-solid:var(--c-solid)]\",\n // Dash pattern for `lineVariant=\"dashed\"`, applied as a mask over the\n // line's gradient fill — `border-style: dashed` can't carry a gradient\n // (`border-image` paints over the dashes solid). Dash and gap scale with\n // the line's own thickness.\n \"[--tl-dashes:repeating-linear-gradient(to_bottom,#000_0_calc(var(--tl-line-width)*3),transparent_0_calc(var(--tl-line-width)*6))]\",\n ],\n {\n variants: {\n size: {\n xs: [\n \"gap-x-2 text-xs [--tl-bullet-size:0.875rem]\",\n \"[--tl-line-width:1px]\",\n \"**:data-[part=content]:pb-3\",\n ],\n sm: [\n \"gap-x-2.5 text-sm [--tl-bullet-size:1rem]\",\n \"[--tl-line-width:1px]\",\n \"**:data-[part=content]:pb-4\",\n ],\n md: [\n \"gap-x-3 text-sm [--tl-bullet-size:1.25rem]\",\n \"[--tl-line-width:2px]\",\n \"**:data-[part=content]:pb-5\",\n ],\n lg: [\n \"gap-x-3.5 text-base [--tl-bullet-size:1.5rem]\",\n \"[--tl-line-width:2px]\",\n \"**:data-[part=content]:pb-6\",\n ],\n xl: [\n \"gap-x-4 text-base [--tl-bullet-size:1.75rem]\",\n \"[--tl-line-width:4px]\",\n \"**:data-[part=content]:pb-7\",\n ],\n },\n // Sets the default via the same CSS-custom-property indirection as\n // `--tl-bullet-size` (the line reads it as `[mask-image:var(--tl-line-mask)]`,\n // see `TimelineItem`) — a `Timeline.Item` overrides just its own\n // segment with an inline style on that property (`LINE_MASK`), which\n // beats this inherited default. Kept in sync with `LINE_MASK` by hand:\n // Tailwind's scanner needs these literals.\n lineVariant: {\n solid: \"[--tl-line-mask:none]\",\n dashed: \"[--tl-line-mask:var(--tl-dashes)]\",\n },\n },\n defaultVariants: { size: \"md\", lineVariant: \"solid\" },\n },\n)\n\n/** Shape × color for the bullet — a small circle in the item's own\n * `data-color`. Mirrors Badge's (variant × color) axis (plus the same\n * `gradient` treatment) so a status dot reads consistently with the rest of\n * the kit. Dimensions are deliberately absent here (see `timelineVariants`)\n * so the same classes work at every `size`.\n *\n * `default` — the component's own default — mirrors Button's inverted\n * black/white treatment (dark surface in light mode, light surface in dark\n * mode), not a plain gray dot, so an untouched `<Timeline.Item>` reads as a\n * neutral, high-contrast marker rather than a colored status.\n *\n * `filled` and `default` ring their own fill with an *inset* box-shadow\n * ring-then-gap (`ring-inset` + `ring-offset`, page-background colored), not\n * plain outset `ring`/`ring-offset` — those grow the dot past\n * `--tl-bullet-size` and make it the one variant whose total footprint\n * doesn't match its same-`size` siblings. Inset shadows stay fully inside\n * the box no matter the color, so every variant — flat border or ringed\n * fill — renders at exactly the same diameter.\n *\n * That ring is for the *plain dot* reading, though — once a `bullet` icon\n * sits on top of it, a ring around a small icon reads as a stray outline\n * rather than a marker, so `TimelineItem` passes `ringed: !bullet` and the\n * `compoundVariants` below drop the ring/gap for a flat, fully filled disc\n * whenever there's icon content to frame. */\n/** The ringed `filled` and `gradient` bullets' band → gap → fill cut-out:\n * the bullet's border is the outer band and an inset ring-offset is the gap,\n * painted the page background (`brand-50` / `brand-950`) so it reads as a\n * hole through to the page.\n *\n * Both variants share it — and `default` draws its gap the same way — so\n * they all snap alike: under CSS `zoom` (or browser zoom) Chromium floors\n * border widths to whole device pixels but not box-shadow spreads, so a gap\n * drawn as a `::before` border instead came out thinner than its siblings'.\n *\n * The ring is transparent on purpose: its band sits over the bullet's own\n * fill, so the fill already paints it — the ring utility is only there to\n * draw the offset gap. Painting `--c-solid` again would double a translucent\n * fill (the pending `--c-solid-disabled` wash) and make the band read\n * brighter than the center. */\nconst RING_CUTOUT =\n \"ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-transparent ring-inset\"\n\nconst timelineBulletVariants = cva([\"shrink-0\"], {\n variants: {\n variant: {\n // `filled` paints the palette's solid, so its icon takes the palette's\n // own on-solid colour, like any text in it (navy on the bright dark-mode\n // solids: white there fell under 3:1 on yellow, green, pink).\n // `outline`/`dashed` have no fill: their icon sits on the page, so\n // `dark:[&_svg]:text-white` keeps it readable on the dark ground.\n // `default`/`gradient` invert to a *light* dark-mode surface and keep\n // their own text colour.\n filled: \"bg-(--c-solid) text-(--c-on-solid)\",\n // A tile, as Badge's `light`: the palette's soft surface (opaque, so the\n // line stops under it), a soft ring of its solid, the icon in its text\n // colour. Quieter than `filled` for a feed of many events.\n light: \"bg-(--c-soft) border border-(--c-solid)/40 text-(--c-text)\",\n // No surface and no ring: the custom `bullet` is drawn as it is (a\n // geodesic badge, an avatar). `color` still tints the line and the\n // icon, so the item keeps its place in the line's colours.\n subtle: \"text-(--c-text)\",\n outline: \"border-(--c-solid) border dark:[&_svg]:text-white\",\n dashed: \"border-dashed border-(--c-solid) border dark:[&_svg]:text-white\",\n default: \"bg-brand-950 text-white dark:bg-white dark:text-brand-950 border\",\n // from-*/to-* are the CSS defaults for --tw-gradient-from/to — see Badge.\n // The transparent border is the outer band of `RING_CUTOUT` (see the\n // compounds below), drawn the same way as `filled`'s: `bg-origin-border`\n // lays the gradient out under it instead of tiling it at the edge.\n gradient:\n \"bg-linear-to-r from-purple-300 to-pink-400 text-black border border-transparent bg-origin-border\",\n },\n /** Internal only — never exposed on `TimelineItemProps` (see `Omit` on\n * its type). Derived from whether the item has a custom `bullet`. */\n ringed: { true: \"\", false: \"\" },\n /** Internal only, like `ringed`. The item's progress state, resolved by\n * `TimelineRoot` from `active` (see `stateAt`). `pending` points this\n * bullet's palette slots at their `-disabled` counterparts (shared by\n * every palette, see `colors.css`), so each variant dims by its own rules\n * — an `outline` ring, a `filled` fill and ring all switch together.\n * `default` and `gradient` read fixed tokens instead of slots, so they get\n * their own compounds below. */\n state: {\n none: \"\",\n complete: \"\",\n active: \"\",\n pending: [\n \"[--c-solid:var(--c-solid-disabled)] [--c-on-solid:var(--c-on-solid-disabled)]\",\n // `light` and `subtle` read the soft surface and the text colour too.\n \"[--c-soft:var(--c-soft-disabled)] [--c-text:var(--c-text-disabled)]\",\n ],\n },\n /** The bullet's corners, the scale ActionIcon uses: `full` is the dot, a\n * smaller radius a rounded tile. */\n radius: {\n xs: \"rounded-xs\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n xl: \"rounded-xl\",\n full: \"rounded-full\",\n },\n },\n compoundVariants: [\n { variant: \"filled\", ringed: true, class: [\"border\", RING_CUTOUT] },\n { variant: \"gradient\", ringed: true, class: RING_CUTOUT },\n {\n variant: \"default\",\n ringed: true,\n class:\n \"ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-brand-950 dark:ring-white ring-inset\",\n },\n // An upcoming `default` step: just the outer ring, no center, in the\n // disabled color — `TimelineItem` also turns `ringed` off for it, which\n // drops the inset gap/center shadows. Listed after the base so `cn`'s\n // twMerge lets these colors win over both the base and `dark:` ones.\n {\n variant: \"default\",\n state: \"pending\",\n class: [\n \"bg-transparent dark:bg-transparent\",\n \"border-(--c-solid-disabled) dark:border-(--c-solid-disabled)\",\n \"text-(--c-text-disabled) dark:text-(--c-text-disabled)\",\n ],\n },\n // An upcoming gradient step: its fixed stops can't follow the slot\n // remap, so it flattens to the disabled fill. `TimelineItem` skips the\n // direction class and the custom stops for it.\n {\n variant: \"gradient\",\n state: \"pending\",\n class: \"bg-none bg-(--c-solid-disabled) text-(--c-on-solid-disabled)\",\n },\n ],\n defaultVariants: { variant: \"default\", ringed: true, state: \"none\", radius: \"full\" },\n})\n\n/** Inline override values for `--tl-line-mask` — see `timelineVariants`' `lineVariant`. */\nconst LINE_MASK: Record<TimelineLineVariant, string> = {\n solid: \"none\",\n dashed: \"var(--tl-dashes)\",\n}\n\n/** Gradient stops a `variant=\"gradient\"` item falls back to — the same\n * purple-300 → pink-400 Badge/Card use, spelled out as values (not left to\n * the bullet's `from-*`/`to-*` classes) so the line, which has no such class,\n * reads the same stops. */\nconst GRADIENT_DEFAULTS = {\n fromDefault: \"var(--color-purple-300)\",\n toDefault: \"var(--color-pink-400)\",\n}\n\n/**\n * One end of a connector: the color it shows there, plus the `data-color`\n * palette that color has to be resolved under (`--c-*` slots differ between\n * light and dark themes, so a palette color can't be written down as a plain\n * value — it only means something on an element carrying that palette).\n *\n * A connector enters an item in its *entry* color and leaves it in its *exit*\n * color. They're the same for every flat variant; a `gradient` item enters at\n * its `from` stop and leaves at its `to`, so the line reads as running through\n * the bullet's own fade.\n *\n * The remaining variants (`filled`, `outline`, `dashed`) all draw in\n * `--c-solid`. A colored end reads it under its own `data-color`. Without a\n * `color`, the bullet draws in the ambient palette, so its end reads the\n * root's `--tl-ambient-solid` copy instead — the inner span sits inside the\n * outer span's `data-color`, where a bare `--c-solid` would resolve to the\n * previous item's palette.\n *\n * A `default` item ends in its bullet's own fill (`--tl-inverted`),\n * palette-independent like the bullet, so `color` is ignored. Every pending\n * item ends in `--c-solid-disabled`, the color all pending bullets share: the\n * remapped `--c-solid`, a pending `default`'s ring, a flattened gradient.\n */\nfunction lineEnd(\n { color, variant: v, gradient, state }: TimelineNeighbour,\n end: \"entry\" | \"exit\",\n): LineEnd {\n // `??`, not a destructuring default: cva variant props also accept `null`.\n const variant = v ?? \"default\"\n if (state === \"pending\") return { value: \"var(--c-solid-disabled)\" }\n if (variant === \"gradient\") {\n return {\n value:\n end === \"entry\"\n ? (gradient?.from ?? GRADIENT_DEFAULTS.fromDefault)\n : (gradient?.to ?? GRADIENT_DEFAULTS.toDefault),\n }\n }\n if (variant === \"default\") return { value: \"var(--tl-inverted)\" }\n return color\n ? { dataColor: color, value: \"var(--c-solid)\" }\n : { value: \"var(--tl-ambient-solid)\" }\n}\n\ntype LineEnd = { dataColor?: Color; value: string }\n\n/** An item's place relative to the active step — `none` when no step is\n * active anywhere. Exposed as `data-state` on the item. */\ntype TimelineItemState = \"none\" | \"complete\" | \"active\" | \"pending\"\n\n/**\n * Each child's progress state. The active step is the first `Timeline.Item`\n * passing `active` — that overrides the root's `active` index — otherwise\n * the root's index, counted over `Timeline.Item`s only (other children are\n * skipped, and get `none`). Steps before it are `complete`, after it\n * `pending`; an index past the end leaves every step `complete`, a negative\n * one every step `pending`. With neither set, every item is `none`.\n */\nfunction stateAt(items: ReactNode[], active: number | undefined): TimelineItemState[] {\n const marked = items.filter(isTimelineItem).findIndex((item) => item.props.active === true)\n const current = marked !== -1 ? marked : active\n // Each child's position among the `Timeline.Item`s only.\n const steps = items.map((_, i) => items.slice(0, i).filter(isTimelineItem).length)\n return items.map((node, i): TimelineItemState => {\n const step = steps[i] ?? 0\n if (!isTimelineItem(node) || current === undefined) return \"none\"\n if (step < current) return \"complete\"\n return step === current ? \"active\" : \"pending\"\n })\n}\n\n/** `Timeline`'s density scale — the kit's canonical `Size` (xs–xl). */\nexport type TimelineSize = Size\nexport type TimelineLineVariant = NonNullable<VariantProps<typeof timelineVariants>[\"lineVariant\"]>\nexport type TimelineBulletRadius = NonNullable<\n VariantProps<typeof timelineBulletVariants>[\"radius\"]\n>\nexport type TimelineBulletVariant = NonNullable<\n VariantProps<typeof timelineBulletVariants>[\"variant\"]\n>\n\nexport type { GradientDir, GradientProps }\n\n/** Visually hidden state text for progress steps. The active step needs none:\n * it carries `aria-current=\"step\"`, which assistive tech reads as \"current step\". */\nexport type TimelineTranslations = {\n /** Read on a step before the active one. */\n complete: string\n /** Read on a step after the active one. */\n pending: string\n}\n\nconst DEFAULT_TRANSLATIONS: TimelineTranslations = {\n complete: \"Completed\",\n pending: \"Upcoming\",\n}\n\nexport type TimelineProps = HTMLArkProps<\"ol\"> &\n VariantProps<typeof timelineVariants> &\n WithTestId & {\n /**\n * Index of the current step among the `Timeline.Item` children (other\n * children aren't counted). Steps before it render as complete, steps\n * after it as pending — dimmed, and a `default` dot reduced to its outer\n * ring. A `Timeline.Item` passing its own `active` overrides this. Leave\n * both unset for a plain event list with no progress.\n */\n active?: number\n /** State text read on complete and pending steps (the dimmed colours alone\n * carry no meaning to assistive tech). English defaults; set only the keys\n * you translate. */\n translations?: Partial<TimelineTranslations>\n }\n\n/**\n * Timeline — a vertical, chronological list of events (activity feed, audit\n * log, changelog). Pure React Server Component: no state, no `\"use client\"`.\n *\n * Composed from `Timeline.Item` (one per event, owns the bullet + connecting\n * line), with two optional children per item: `Timeline.Label` (a leading\n * date/timestamp) and `Timeline.Content` (the body, holding an optional\n * `Timeline.Title`). Every item shares the same three column tracks, so\n * bullets stay aligned down a single axis regardless of which items use a\n * label — and the label column disappears entirely if no item uses it.\n *\n * <Timeline>\n * <Timeline.Item color=\"green\">\n * <Timeline.Label>Mar 1, 2026</Timeline.Label>\n * <Timeline.Content>\n * <Timeline.Title>Order placed</Timeline.Title>\n * </Timeline.Content>\n * </Timeline.Item>\n * <Timeline.Item variant=\"outline\">\n * <Timeline.Content>\n * <Timeline.Title>Delivered</Timeline.Title>\n * </Timeline.Content>\n * </Timeline.Item>\n * </Timeline>\n *\n * There is no `variant`×`color` axis on the root — those live per `Timeline.Item`,\n * since each event typically carries its own status. `size` and `lineVariant`\n * set the shared defaults for every item's bullet size and connecting line.\n *\n * Direct children should be `Timeline.Item` elements (as in the example\n * above, or a flat `.map()` over an array of them) — `TimelineRoot` reads\n * each item's `color`/`variant`/`gradient`/`lineVariant` off its immediate\n * siblings and hands them to it as `prevItem`/`nextItem`, so every connector\n * can blend from one item's color into the next one's (see `lineEnd`,\n * `TimelineItem`). A child that isn't a recognized `Timeline.Item` breaks\n * that chain at that point and never crashes: the connector leading into it\n * stays flat in its own item's color, as if it were the last one.\n */\n/** The hidden text an item's progress state reads as: `complete` and `pending`\n * only; `active` speaks through `aria-current`, and `none` isn't progress. */\nconst stateLabel = (\n state: TimelineItemState | undefined,\n t: TimelineTranslations,\n): string | undefined =>\n state === \"complete\" ? t.complete : state === \"pending\" ? t.pending : undefined\n\nfunction isTimelineItem(node: ReactNode): node is ReactElement<TimelineItemInternalProps> {\n return isValidElement(node) && node.type === TimelineItem\n}\n\nconst TimelineRoot = ({\n className,\n size,\n lineVariant,\n active,\n translations,\n children,\n testId,\n ...rest\n}: TimelineProps) => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const items = Children.toArray(children)\n // `asChild` morphs the root into a single element the caller passed as its\n // one child (see Ark's `withAsChild`) — it requires that child to still be\n // a bare, single valid element, not array-wrapped, so skip the transform\n // entirely rather than hand it something `Children.toArray` reshaped.\n // `Timeline.Item`s nested a level deeper inside that child are outside what\n // this prop-threading reaches anyway, same as the constraint documented\n // above.\n const states = stateAt(items, active)\n const neighbour = (i: number): TimelineNeighbour | undefined => {\n const node = items[i]\n if (!isTimelineItem(node)) return undefined\n const { color, variant, gradient, lineVariant } = node.props\n return { color, variant, gradient, lineVariant, state: states[i] }\n }\n const withNeighbours = rest.asChild\n ? children\n : items.map((child, i) =>\n isTimelineItem(child)\n ? cloneElement(child, {\n prevItem: neighbour(i - 1),\n nextItem: neighbour(i + 1),\n state: states[i],\n stateLabel: stateLabel(states[i], t),\n } satisfies Partial<TimelineItemInternalProps>)\n : child,\n )\n return (\n <ark.ol\n className={cn(timelineVariants({ size, lineVariant }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withNeighbours}\n </ark.ol>\n )\n}\n\nexport type TimelineItemProps = Omit<HTMLArkProps<\"li\">, \"color\"> &\n Omit<VariantProps<typeof timelineBulletVariants>, \"ringed\" | \"state\" | \"radius\"> &\n WithTestId & {\n /** The bullet's corners: `full` (the default) is a dot, a smaller radius a\n * rounded tile — `light` with `md` reads as an icon tile. */\n radius?: TimelineBulletRadius\n /** Accent palette for the bullet. Re-exported as `Color` from `@42/ui-react`. */\n color?: Color\n /** Overrides the default dot with any node — an icon, `<Avatar>`, or a\n * `<Spinner>` for an in-progress item. */\n bullet?: ReactNode\n /** Overrides just this item's bullet diameter; defaults to `Timeline`'s\n * own `size`. Doesn't affect line thickness or spacing — only the dot. */\n size?: Size\n /** Overrides `Timeline`'s connecting-line style for just the segment\n * below this item. */\n lineVariant?: TimelineLineVariant\n /**\n * Gradient config. Only applied when `variant=\"gradient\"`.\n * Mirrors Badge's gradient prop — unset fields fall back to the CVA\n * defaults (purple-300 → pink-400, to-r).\n */\n gradient?: GradientProps\n /**\n * Nudges the bullet+line column down (a CSS length, e.g. `\"11px\"`) to\n * line the bullet up with something inside a custom `Timeline.Content` —\n * a card's title, say — that Timeline has no visibility into on its own.\n * Applied as a shared CSS custom property, not a plain padding class on\n * the bullet alone, because the connecting line is a separate sibling\n * element that also needs to shift down by the same amount to keep\n * meeting the bullet's (now lower) edge — see `TimelineItem`.\n */\n axisOffset?: string\n /**\n * Marks this item as the current step, overriding `Timeline`'s `active`\n * index — handy when mapping over data that already knows which entry is\n * current. If several items pass it, the first one wins; `false` is the\n * same as leaving it unset.\n */\n active?: boolean\n }\n\n/** See `TimelineRoot`'s `prevItem`/`nextItem` threading. */\ntype TimelineNeighbour = Pick<\n TimelineItemProps,\n \"color\" | \"variant\" | \"gradient\" | \"lineVariant\"\n> & { state?: TimelineItemState }\n\n/**\n * `prevItem`/`nextItem`/`state` are internal-only — injected by `TimelineRoot`, never\n * meant to be passed directly by a consumer — so they're kept off the\n * exported/documented `TimelineItemProps` (the same internal/public split\n * `ringed` already uses on `timelineBulletVariants`, just at the plain-prop\n * level here instead of the cva-variant level).\n */\ntype TimelineItemInternalProps = TimelineItemProps & {\n prevItem?: TimelineNeighbour\n nextItem?: TimelineNeighbour\n state?: TimelineItemState\n /** `state` in words, from the root's `translations` (see `stateLabel`). */\n stateLabel?: string\n}\n\n/**\n * One event: a bullet + connecting line (generated automatically — no manual\n * separator/connector wiring), and up to two children, `Timeline.Label` and\n * `Timeline.Content`, which place themselves into the shared column tracks.\n * The line to the next item is suppressed automatically on the last item.\n */\nconst TimelineItem = ({\n className,\n color,\n variant,\n radius,\n bullet,\n size,\n lineVariant,\n gradient,\n axisOffset,\n style,\n children,\n prevItem,\n nextItem,\n state = \"none\",\n stateLabel,\n // Read by `TimelineRoot` (see `stateAt`); kept off the `<li>`.\n active: _active,\n testId,\n asChild,\n ...rest\n}: TimelineItemInternalProps) => {\n const isGradient = variant === \"gradient\"\n const pending = state === \"pending\"\n // Only for the bullet's own style — the line reads its endpoints through\n // `lineEnd` instead. A pending gradient flattens, so it gets none.\n const gradientVars =\n isGradient && !pending ? buildGradientVars(gradient, GRADIENT_DEFAULTS) : undefined\n // `entry` also colors the axisOffset stub: it sits right where the previous\n // connector arrives, which is in this item's own entry color.\n const entry = lineEnd({ color, variant, gradient, state }, \"entry\")\n const exit = lineEnd({ color, variant, gradient, state }, \"exit\")\n // No recognized next item (the last item, or a stray non-item child next):\n // the connector has nothing to blend into, so it stays flat in its own exit.\n const target = nextItem ? lineEnd(nextItem, \"entry\") : exit\n const ownMask = lineVariant && { \"--tl-line-mask\": LINE_MASK[lineVariant] }\n const leadingMask = prevItem?.lineVariant && {\n \"--tl-line-mask\": LINE_MASK[prevItem.lineVariant],\n }\n\n return (\n <ark.li\n asChild={asChild}\n style={\n {\n ...(size ? { \"--tl-bullet-size\": BULLET_SIZE[size] } : undefined),\n ...(axisOffset ? { \"--tl-axis-offset\": axisOffset } : undefined),\n ...style,\n } as CSSProperties\n }\n className={cn(\n \"col-span-3 grid grid-cols-subgrid\",\n \"[&:first-child_[data-part=line][data-edge=start]]:hidden\",\n \"[&:last-child_[data-part=line][data-edge=end]]:hidden\",\n className,\n )}\n {...props({\n \"data-testid\": testId,\n \"data-state\": state !== \"none\" && state,\n \"aria-current\": state === \"active\" && \"step\",\n })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {/* Two line segments share `data-part=\"line\"` (so the first/last-item\n suppression selectors above match both) but differ in `data-edge`\n for layout and visibility. Both are a `--tl-line-width`-wide\n background bar rather than a border, so a gradient fill and the\n `--tl-line-mask` dash pattern can be combined.\n\n `data-edge=\"start\"` (leading) fills the gap `axisOffset` opens\n *above* this item's own (shifted-down) bullet — a plain height of\n `--tl-axis-offset` (0, i.e. invisible, when `axisOffset` isn't\n set), `self-start` so it sits flush at the row's own top edge.\n Hidden on the first item: nothing renders above the very first\n bullet to connect to. It's flat in this item's own entry color:\n the previous item's trailing segment has already blended into\n exactly that color by the time it reaches this row's top edge, so\n the two meet with no seam. Only its dash pattern comes from the\n previous item (`prevItem.lineVariant`), since it continues that\n item's segment.\n\n `data-edge=\"end\"` (trailing) is the connector to the next item: a\n grid item in the same cell as the bullet (col/row-start-2/1,\n default align-self:stretch fills the row's real height), whose\n margin-top pushes its own box down by exactly the bullet's\n diameter plus `--tl-axis-offset` — so it stops right at the\n bullet's edge instead of running behind it, and the hollow\n variants can stay genuinely transparent. Hidden on the last item.\n\n It blends from this item's exit color to the next item's entry\n color. Those are usually two *different* palettes, and a `--c-*`\n slot only resolves against the `data-color` of the element it's\n read on, so it takes two elements: the outer span carries this\n item's palette and declares `--tl-from`, the inner one carries the\n next item's and declares `--tl-to`. A custom property inherits its\n *computed* value — the `var(--c-solid)` in `--tl-from` is already\n substituted with this item's color by the time the inner span reads\n it — so the inner span sees both colors at once. The outer span stays\n the direct grid item (stretching through a nested element is\n unreliable); the inner one just fills it with `absolute inset-0`.\n\n `--tl-bullet-size`/`--tl-axis-offset` are declared on the `<li>`\n (see `timelineVariants` / this component's own `style`), not\n scoped to the bullet, so these siblings can read the same values\n as the axis div below — siblings can only stay in sync through a\n shared var. */}\n <span\n data-part=\"line\"\n data-edge=\"start\"\n data-color={entry.dataColor}\n style={{ \"--tl-from\": entry.value, ...leadingMask } as CSSProperties}\n className={cn(\n \"col-start-2 row-start-1 self-start justify-self-center w-(--tl-line-width)\",\n \"h-(--tl-axis-offset,0px) bg-(--tl-from) [mask-image:var(--tl-line-mask)]\",\n )}\n />\n <span\n data-part=\"line\"\n data-edge=\"end\"\n data-color={exit.dataColor}\n style={{ \"--tl-from\": exit.value, ...ownMask } as CSSProperties}\n className={cn(\n \"relative col-start-2 row-start-1 justify-self-center w-(--tl-line-width)\",\n \"mt-[calc(var(--tl-bullet-size)+var(--tl-axis-offset,0px))]\",\n \"[mask-image:var(--tl-line-mask)]\",\n )}\n >\n <span\n data-color={target.dataColor}\n style={{ \"--tl-to\": target.value } as CSSProperties}\n className=\"absolute inset-0 [background-image:linear-gradient(to_bottom_in_oklab,var(--tl-from),var(--tl-to))]\"\n />\n </span>\n <div\n data-part=\"axis\"\n // `relative` contains the sr-only state text below.\n className=\"relative col-start-2 row-start-1 flex justify-center self-start pt-(--tl-axis-offset)\"\n >\n {/* Complete vs pending is only a colour change on the bullet and line,\n so the state is also spelled out, ahead of the item's content. */}\n {stateLabel && <span className=\"sr-only\">{stateLabel}</span>}\n <span\n data-part=\"bullet\"\n // A pending bullet drops its palette: `[data-color]` and the\n // `pending` slot remap would both set `--c-*` on this one element,\n // leaving the winner to stylesheet order. The disabled slots it\n // remaps to are shared by every palette anyway.\n data-color={!isGradient && !pending ? color : undefined}\n style={gradientVars as CSSProperties}\n className={cn(\n timelineBulletVariants({\n variant,\n // A pending `default` step is a bare outer ring: no inset gap\n // and center to draw.\n ringed: !bullet && !(pending && (variant ?? \"default\") === \"default\"),\n state,\n radius,\n }),\n \"size-(--tl-bullet-size) grid place-items-center overflow-hidden\",\n // Zero specificity (`:where`), as in ActionIcon: a size class on\n // the icon itself wins over the bullet's default fill.\n \"[:where(&)_svg]:size-full [:where(&)_svg]:p-0.5\",\n isGradient && !pending && gradient?.dir && GRADIENT_DIR_CLASS[gradient.dir],\n )}\n >\n {bullet}\n </span>\n </div>\n {own}\n </>\n ))}\n </ark.li>\n )\n}\n\nexport type TimelineLabelProps = Omit<HTMLArkProps<\"span\">, \"color\"> &\n WithTestId & {\n /** Tints the label (and any icon inside it) to match the item's accent —\n * pass the same value given to the `Timeline.Item`'s `color`. Omit it to\n * keep the neutral muted default. */\n color?: Color\n }\n\n/**\n * The leading zone (typically a date/timestamp), aligned to the bullet. Lays\n * out its children in a row (`inline-flex items-center gap-1.5`) so an icon\n * before the text — e.g. `<Timeline.Label><CalendarIcon />Mar 1, 2026</Timeline.Label>` —\n * sits inline without extra markup; stack a date over a time by nesting a\n * `flex flex-col` wrapper around the text yourself.\n */\nconst TimelineLabel = ({ className, color, testId, ...rest }: TimelineLabelProps) => (\n <ark.span\n data-part=\"label\"\n data-color={color}\n className={cn(\n \"col-start-1 inline-flex items-center gap-1.5 self-start pt-px [:where(&)_svg]:size-3.5 [:where(&)_svg]:shrink-0\",\n color ? \"text-(--c-text)\" : TEXT_COLOR_CLASSES.muted,\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type TimelineContentProps = HTMLArkProps<\"div\"> & WithTestId\n\n/** The main body zone for an item — holds an optional `Timeline.Title` and\n * any free-form description content. */\nconst TimelineContent = ({ className, testId, ...rest }: TimelineContentProps) => (\n <ark.div\n data-part=\"content\"\n className={cn(\"col-start-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type TimelineTitleProps = HTMLArkProps<\"span\"> & WithTestId\n\n/** A bold lead-in line for `Timeline.Content`. Deliberately a `<span>`, styled\n * `block` to sit on its own line, not a heading (a timeline can hold many\n * items, and one `<h3>` per item would spam heading landmarks — unlike\n * `Table.Title`, which labels the table once) and not a `<p>` either. A\n * `<div>` doesn't fix that second problem: `<p>`'s content model is phrasing\n * content only, so a `<div>` inside one is exactly as invalid as a nested\n * `<p>` — the tag has to be phrasing content itself for a consumer to safely\n * wrap `Timeline.Title` in their own paragraph (e.g. `<Text>`) without\n * triggering React's \"cannot be a descendant of `<p>`\" DOM-nesting warning;\n * `block` gets the same visual line without changing that category. */\nconst TimelineTitle = ({ className, testId, ...rest }: TimelineTitleProps) => (\n <ark.span\n className={cn(\"block font-medium\", TEXT_COLOR_CLASSES.primary, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Timeline = Object.assign(TimelineRoot, {\n Item: TimelineItem,\n Label: TimelineLabel,\n Content: TimelineContent,\n Title: TimelineTitle,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/timeline/timeline.tsx"],"names":["lineVariant","stateLabel"],"mappings":";;;;;;;;;;AAyBA,IAAM,WAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,UAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,QAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAyCA,IAAM,gBAAA,GAAmB,GAAA;AAAA,EACvB;AAAA,IACE,qFAAA;AAAA;AAAA;AAAA,IAGA,gFAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,qCAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI;AAAA,UACF,6CAAA;AAAA,UACA,uBAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,EAAA,EAAI;AAAA,UACF,2CAAA;AAAA,UACA,uBAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,EAAA,EAAI;AAAA,UACF,4CAAA;AAAA,UACA,uBAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,EAAA,EAAI;AAAA,UACF,+CAAA;AAAA,UACA,uBAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,EAAA,EAAI;AAAA,UACF,8CAAA;AAAA,U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AAM,gBAAgB,CAAC,EAAE,WAAW,MAAA,EAAQ,GAAG,MAAK,qBAClD,GAAA;AAAA,EAAC,GAAA,CAAI,IAAA;AAAA,EAAJ;AAAA,IACC,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,kBAAA,CAAmB,SAAS,SAAS,CAAA;AAAA,IACvE,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;AAGK,IAAM,QAAA,GAAW,MAAA,CAAO,MAAA,CAAO,YAAA,EAAc;AAAA,EAClD,IAAA,EAAM,YAAA;AAAA,EACN,KAAA,EAAO,aAAA;AAAA,EACP,OAAA,EAAS,eAAA;AAAA,EACT,KAAA,EAAO;AACT,CAAC","file":"index.js","sourcesContent":["import { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { CSSProperties, ReactElement, ReactNode } from \"react\"\nimport { Children, cloneElement, isValidElement } from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport {\n buildGradientVars,\n GRADIENT_DIR_CLASS,\n type GradientDir,\n type GradientProps,\n} from \"../../lib/gradient\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Bullet diameter per `Size`, in the same steps Tailwind's `size-3.5..7`\n * utilities resolve to. Shared by the root's default (set as a CSS custom\n * property, see `timelineVariants`) and `Timeline.Item`'s own `size` override\n * (set as an inline style — see `TimelineItem`), so both ends of the default/\n * override split read from one source of truth.\n */\nconst BULLET_SIZE: Record<Size, string> = {\n xs: \"0.875rem\",\n sm: \"1rem\",\n md: \"1.25rem\",\n lg: \"1.5rem\",\n xl: \"1.75rem\",\n}\n\n/**\n * Three shared column tracks: an optional leading `label` (e.g. a date), the\n * fixed `axis` (bullet + connecting line), and the main `content`. Each\n * `Timeline.Item` re-declares these same tracks via `grid-cols-subgrid`, so\n * columns stay aligned across items even though any given item may only\n * populate one or two of the three.\n *\n * `label` and `axis` deliberately use `max-content` (not `auto`) as their max\n * sizing function: a track that no item populates collapses to exactly 0\n * instead of reserving dead space (the classic complaint with MUI's\n * `TimelineOppositeContent`, which reserves equal flex-basis whether or not\n * anything renders into it) — `max-content` sizes purely from the track's\n * actual content and never grows further. `auto` looks like the obvious\n * choice here but isn't: the grid track-sizing algorithm's \"maximize tracks\"\n * step expands *any* track whose max function is literally `auto` to absorb\n * leftover free space in the grid, even ones with zero content in every row —\n * that's the one column-sizing keyword this collapsing behavior can't use.\n * `content` gets the explicit `1fr` instead, so it's the one track that\n * intentionally absorbs whatever width `label`/`axis` don't need.\n *\n * `size` only ever touches dimensions (bullet size, line thickness, gaps,\n * spacing, text scale) via descendant selectors on stable `data-part` hooks —\n * never shape or color — so parts stay dumb and the whole tree stays a pure\n * Server Component, the same split `Table` uses for its `size` variant.\n *\n * The bullet's dimension is the one exception routed through a CSS custom\n * property (`--tl-bullet-size`, consumed by the bullet's own `size-(--tl-bullet-size)`\n * class, and by the line's `mt-(--tl-bullet-size)` — see `TimelineItem`)\n * rather than a plain `size-*` utility: a `Timeline.Item` can then override\n * just its own bullet (and keep the line in sync with it) via an inline\n * style on that same property, which always wins over the cascaded\n * class-based default regardless of selector specificity — a plain utility\n * class on the item couldn't reliably beat this descendant selector's own\n * specificity. It's declared on the root (not scoped to `[data-part=bullet]`)\n * so it cascades to the line too, not just the bullet that reads it first.\n * Each value below is a static literal (not built from `BULLET_SIZE` via\n * interpolation) because Tailwind's scanner needs the literal arbitrary-value\n * text in the source — an interpolated class name is invisible to it.\n */\nconst timelineVariants = cva(\n [\n \"m-0 grid list-none ps-0 grid-cols-[minmax(0,max-content)_max-content_minmax(0,1fr)]\",\n // The `default` bullet's own inverted fill (see `timelineBulletVariants`),\n // as a connector endpoint.\n \"[--tl-inverted:var(--color-brand-950)] dark:[--tl-inverted:var(--color-white)]\",\n // The palette an uncolored bullet draws in (the root's neutral, unless a\n // `data-color` ancestor says otherwise), captured here once. An uncolored\n // line end reads these instead of a bare `--c-*`: its inner span sits\n // inside the outer span's `data-color`, where a bare slot would resolve to\n // the *previous* item's palette, not the ambient one its bullet uses.\n \"[--tl-ambient-solid:var(--c-solid)]\",\n // Dash pattern for `lineVariant=\"dashed\"`, applied as a mask over the\n // line's gradient fill — `border-style: dashed` can't carry a gradient\n // (`border-image` paints over the dashes solid). Dash and gap scale with\n // the line's own thickness.\n \"[--tl-dashes:repeating-linear-gradient(to_bottom,#000_0_calc(var(--tl-line-width)*3),transparent_0_calc(var(--tl-line-width)*6))]\",\n ],\n {\n variants: {\n size: {\n xs: [\n \"gap-x-2 text-xs [--tl-bullet-size:0.875rem]\",\n \"[--tl-line-width:1px]\",\n \"**:data-[part=content]:pb-3\",\n ],\n sm: [\n \"gap-x-2.5 text-sm [--tl-bullet-size:1rem]\",\n \"[--tl-line-width:1px]\",\n \"**:data-[part=content]:pb-4\",\n ],\n md: [\n \"gap-x-3 text-sm [--tl-bullet-size:1.25rem]\",\n \"[--tl-line-width:2px]\",\n \"**:data-[part=content]:pb-5\",\n ],\n lg: [\n \"gap-x-3.5 text-base [--tl-bullet-size:1.5rem]\",\n \"[--tl-line-width:2px]\",\n \"**:data-[part=content]:pb-6\",\n ],\n xl: [\n \"gap-x-4 text-base [--tl-bullet-size:1.75rem]\",\n \"[--tl-line-width:4px]\",\n \"**:data-[part=content]:pb-7\",\n ],\n },\n // Sets the default via the same CSS-custom-property indirection as\n // `--tl-bullet-size` (the line reads it as `[mask-image:var(--tl-line-mask)]`,\n // see `TimelineItem`) — a `Timeline.Item` overrides just its own\n // segment with an inline style on that property (`LINE_MASK`), which\n // beats this inherited default. Kept in sync with `LINE_MASK` by hand:\n // Tailwind's scanner needs these literals.\n lineVariant: {\n solid: \"[--tl-line-mask:none]\",\n dashed: \"[--tl-line-mask:var(--tl-dashes)]\",\n },\n },\n defaultVariants: { size: \"md\", lineVariant: \"solid\" },\n },\n)\n\n/** Shape × color for the bullet — a small circle in the item's own\n * `data-color`. Mirrors Badge's (variant × color) axis (plus the same\n * `gradient` treatment) so a status dot reads consistently with the rest of\n * the kit. Dimensions are deliberately absent here (see `timelineVariants`)\n * so the same classes work at every `size`.\n *\n * `default` — the component's own default — mirrors Button's inverted\n * black/white treatment (dark surface in light mode, light surface in dark\n * mode), not a plain gray dot, so an untouched `<Timeline.Item>` reads as a\n * neutral, high-contrast marker rather than a colored status.\n *\n * `filled` and `default` ring their own fill with an *inset* box-shadow\n * ring-then-gap (`ring-inset` + `ring-offset`, page-background colored), not\n * plain outset `ring`/`ring-offset` — those grow the dot past\n * `--tl-bullet-size` and make it the one variant whose total footprint\n * doesn't match its same-`size` siblings. Inset shadows stay fully inside\n * the box no matter the color, so every variant — flat border or ringed\n * fill — renders at exactly the same diameter.\n *\n * That ring is for the *plain dot* reading, though — once a `bullet` icon\n * sits on top of it, a ring around a small icon reads as a stray outline\n * rather than a marker, so `TimelineItem` passes `ringed: !bullet` and the\n * `compoundVariants` below drop the ring/gap for a flat, fully filled disc\n * whenever there's icon content to frame. */\n/** The ringed `filled` and `gradient` bullets' band → gap → fill cut-out:\n * the bullet's border is the outer band and an inset ring-offset is the gap,\n * painted the page background (`brand-50` / `brand-950`) so it reads as a\n * hole through to the page.\n *\n * Both variants share it — and `default` draws its gap the same way — so\n * they all snap alike: under CSS `zoom` (or browser zoom) Chromium floors\n * border widths to whole device pixels but not box-shadow spreads, so a gap\n * drawn as a `::before` border instead came out thinner than its siblings'.\n *\n * The ring is transparent on purpose: its band sits over the bullet's own\n * fill, so the fill already paints it — the ring utility is only there to\n * draw the offset gap. Painting `--c-solid` again would double a translucent\n * fill (the pending `--c-solid-disabled` wash) and make the band read\n * brighter than the center. */\nconst RING_CUTOUT =\n \"ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-transparent ring-inset\"\n\nconst timelineBulletVariants = cva([\"shrink-0\"], {\n variants: {\n variant: {\n // `filled` paints the palette's solid, so its icon takes the palette's\n // own on-solid colour, like any text in it (navy on the bright dark-mode\n // solids: white there fell under 3:1 on yellow, green, pink).\n // `outline`/`dashed` have no fill: their icon sits on the page, so\n // `dark:[&_svg]:text-white` keeps it readable on the dark ground.\n // `default`/`gradient` invert to a *light* dark-mode surface and keep\n // their own text colour.\n filled: \"bg-(--c-solid) text-(--c-on-solid)\",\n // A tile, as Badge's `light`: the palette's soft surface (opaque, so the\n // line stops under it), a soft ring of its solid, the icon in its text\n // colour. Quieter than `filled` for a feed of many events.\n light: \"bg-(--c-soft) border border-(--c-solid)/40 text-(--c-text)\",\n // No surface and no ring: the custom `bullet` is drawn as it is (a\n // geodesic badge, an avatar). `color` still tints the line and the\n // icon, so the item keeps its place in the line's colours.\n subtle: \"text-(--c-text)\",\n outline: \"border-(--c-solid) border dark:[&_svg]:text-white\",\n dashed: \"border-dashed border-(--c-solid) border dark:[&_svg]:text-white\",\n default: \"bg-brand-950 text-white dark:bg-white dark:text-brand-950 border\",\n // from-*/to-* are the CSS defaults for --tw-gradient-from/to — see Badge.\n // The transparent border is the outer band of `RING_CUTOUT` (see the\n // compounds below), drawn the same way as `filled`'s: `bg-origin-border`\n // lays the gradient out under it instead of tiling it at the edge.\n gradient:\n \"bg-linear-to-r from-purple-300 to-pink-400 text-black border border-transparent bg-origin-border\",\n },\n /** Internal only — never exposed on `TimelineItemProps` (see `Omit` on\n * its type). Derived from whether the item has a custom `bullet`. */\n ringed: { true: \"\", false: \"\" },\n /** Internal only, like `ringed`. The item's progress state, resolved by\n * `TimelineRoot` from `active` (see `stateAt`). `pending` points this\n * bullet's palette slots at their `-disabled` counterparts (shared by\n * every palette, see `colors.css`), so each variant dims by its own rules\n * — an `outline` ring, a `filled` fill and ring all switch together.\n * `default` and `gradient` read fixed tokens instead of slots, so they get\n * their own compounds below. */\n state: {\n none: \"\",\n complete: \"\",\n active: \"\",\n pending: [\n \"[--c-solid:var(--c-solid-disabled)] [--c-on-solid:var(--c-on-solid-disabled)]\",\n // `light` and `subtle` read the soft surface and the text colour too.\n \"[--c-soft:var(--c-soft-disabled)] [--c-text:var(--c-text-disabled)]\",\n ],\n },\n /** The bullet's corners, the scale ActionIcon uses: `full` is the dot, a\n * smaller radius a rounded tile. */\n radius: {\n xs: \"rounded-xs\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n xl: \"rounded-xl\",\n full: \"rounded-full\",\n },\n },\n compoundVariants: [\n { variant: \"filled\", ringed: true, class: [\"border\", RING_CUTOUT] },\n { variant: \"gradient\", ringed: true, class: RING_CUTOUT },\n {\n variant: \"default\",\n ringed: true,\n class:\n \"ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-brand-950 dark:ring-white ring-inset\",\n },\n // An upcoming `default` step: just the outer ring, no center, in the\n // disabled color — `TimelineItem` also turns `ringed` off for it, which\n // drops the inset gap/center shadows. Listed after the base so `cn`'s\n // twMerge lets these colors win over both the base and `dark:` ones.\n {\n variant: \"default\",\n state: \"pending\",\n class: [\n \"bg-transparent dark:bg-transparent\",\n \"border-(--c-solid-disabled) dark:border-(--c-solid-disabled)\",\n \"text-(--c-text-disabled) dark:text-(--c-text-disabled)\",\n ],\n },\n // An upcoming gradient step: its fixed stops can't follow the slot\n // remap, so it flattens to the disabled fill. `TimelineItem` skips the\n // direction class and the custom stops for it.\n {\n variant: \"gradient\",\n state: \"pending\",\n class: \"bg-none bg-(--c-solid-disabled) text-(--c-on-solid-disabled)\",\n },\n ],\n defaultVariants: { variant: \"default\", ringed: true, state: \"none\", radius: \"full\" },\n})\n\n/** Inline override values for `--tl-line-mask` — see `timelineVariants`' `lineVariant`. */\nconst LINE_MASK: Record<TimelineLineVariant, string> = {\n solid: \"none\",\n dashed: \"var(--tl-dashes)\",\n}\n\n/** Gradient stops a `variant=\"gradient\"` item falls back to — the same\n * purple-300 → pink-400 Badge/Card use, spelled out as values (not left to\n * the bullet's `from-*`/`to-*` classes) so the line, which has no such class,\n * reads the same stops. */\nconst GRADIENT_DEFAULTS = {\n fromDefault: \"var(--color-purple-300)\",\n toDefault: \"var(--color-pink-400)\",\n}\n\n/**\n * One end of a connector: the color it shows there, plus the `data-color`\n * palette that color has to be resolved under (`--c-*` slots differ between\n * light and dark themes, so a palette color can't be written down as a plain\n * value — it only means something on an element carrying that palette).\n *\n * A connector enters an item in its *entry* color and leaves it in its *exit*\n * color. They're the same for every flat variant; a `gradient` item enters at\n * its `from` stop and leaves at its `to`, so the line reads as running through\n * the bullet's own fade.\n *\n * The remaining variants (`filled`, `outline`, `dashed`) all draw in\n * `--c-solid`. A colored end reads it under its own `data-color`. Without a\n * `color`, the bullet draws in the ambient palette, so its end reads the\n * root's `--tl-ambient-solid` copy instead — the inner span sits inside the\n * outer span's `data-color`, where a bare `--c-solid` would resolve to the\n * previous item's palette.\n *\n * A `default` item ends in its bullet's own fill (`--tl-inverted`),\n * palette-independent like the bullet, so `color` is ignored. Every pending\n * item ends in `--c-solid-disabled`, the color all pending bullets share: the\n * remapped `--c-solid`, a pending `default`'s ring, a flattened gradient.\n */\nfunction lineEnd(\n { color, variant: v, gradient, state }: TimelineNeighbour,\n end: \"entry\" | \"exit\",\n): LineEnd {\n // `??`, not a destructuring default: cva variant props also accept `null`.\n const variant = v ?? \"default\"\n if (state === \"pending\") return { value: \"var(--c-solid-disabled)\" }\n if (variant === \"gradient\") {\n return {\n value:\n end === \"entry\"\n ? (gradient?.from ?? GRADIENT_DEFAULTS.fromDefault)\n : (gradient?.to ?? GRADIENT_DEFAULTS.toDefault),\n }\n }\n if (variant === \"default\") return { value: \"var(--tl-inverted)\" }\n return color\n ? { dataColor: color, value: \"var(--c-solid)\" }\n : { value: \"var(--tl-ambient-solid)\" }\n}\n\ntype LineEnd = { dataColor?: Color; value: string }\n\n/** An item's place relative to the active step — `none` when no step is\n * active anywhere. Exposed as `data-state` on the item. */\ntype TimelineItemState = \"none\" | \"complete\" | \"active\" | \"pending\"\n\n/**\n * Each child's progress state. The active step is the first `Timeline.Item`\n * passing `active` — that overrides the root's `active` index — otherwise\n * the root's index, counted over `Timeline.Item`s only (other children are\n * skipped, and get `none`). Steps before it are `complete`, after it\n * `pending`; an index past the end leaves every step `complete`, a negative\n * one every step `pending`. With neither set, every item is `none`.\n */\nfunction stateAt(items: ReactNode[], active: number | undefined): TimelineItemState[] {\n const marked = items.filter(isTimelineItem).findIndex((item) => item.props.active === true)\n const current = marked !== -1 ? marked : active\n // Each child's position among the `Timeline.Item`s only.\n const steps = items.map((_, i) => items.slice(0, i).filter(isTimelineItem).length)\n return items.map((node, i): TimelineItemState => {\n const step = steps[i] ?? 0\n if (!isTimelineItem(node) || current === undefined) return \"none\"\n if (step < current) return \"complete\"\n return step === current ? \"active\" : \"pending\"\n })\n}\n\n/** `Timeline`'s density scale — the kit's canonical `Size` (xs–xl). */\nexport type TimelineSize = Size\nexport type TimelineLineVariant = NonNullable<VariantProps<typeof timelineVariants>[\"lineVariant\"]>\nexport type TimelineBulletRadius = NonNullable<\n VariantProps<typeof timelineBulletVariants>[\"radius\"]\n>\nexport type TimelineBulletVariant = NonNullable<\n VariantProps<typeof timelineBulletVariants>[\"variant\"]\n>\n\nexport type { GradientDir, GradientProps }\n\n/** Visually hidden state text for progress steps. The active step needs none:\n * it carries `aria-current=\"step\"`, which assistive tech reads as \"current step\". */\nexport type TimelineTranslations = {\n /** Read on a step before the active one. */\n complete: string\n /** Read on a step after the active one. */\n pending: string\n}\n\nconst DEFAULT_TRANSLATIONS: TimelineTranslations = {\n complete: \"Completed\",\n pending: \"Upcoming\",\n}\n\nexport type TimelineProps = HTMLArkProps<\"ol\"> &\n VariantProps<typeof timelineVariants> &\n WithTestId & {\n /**\n * Index of the current step among the `Timeline.Item` children (other\n * children aren't counted). Steps before it render as complete, steps\n * after it as pending — dimmed, and a `default` dot reduced to its outer\n * ring. A `Timeline.Item` passing its own `active` overrides this. Leave\n * both unset for a plain event list with no progress.\n */\n active?: number\n /** State text read on complete and pending steps (the dimmed colours alone\n * carry no meaning to assistive tech). English defaults; set only the keys\n * you translate. */\n translations?: Partial<TimelineTranslations>\n }\n\n/**\n * Timeline — a vertical, chronological list of events (activity feed, audit\n * log, changelog). Pure React Server Component: no state, no `\"use client\"`.\n *\n * Composed from `Timeline.Item` (one per event, owns the bullet + connecting\n * line), with two optional children per item: `Timeline.Label` (a leading\n * date/timestamp) and `Timeline.Content` (the body, holding an optional\n * `Timeline.Title`). Every item shares the same three column tracks, so\n * bullets stay aligned down a single axis regardless of which items use a\n * label — and the label column disappears entirely if no item uses it.\n *\n * <Timeline>\n * <Timeline.Item color=\"green\">\n * <Timeline.Label>Mar 1, 2026</Timeline.Label>\n * <Timeline.Content>\n * <Timeline.Title>Order placed</Timeline.Title>\n * </Timeline.Content>\n * </Timeline.Item>\n * <Timeline.Item variant=\"outline\">\n * <Timeline.Content>\n * <Timeline.Title>Delivered</Timeline.Title>\n * </Timeline.Content>\n * </Timeline.Item>\n * </Timeline>\n *\n * There is no `variant`×`color` axis on the root — those live per `Timeline.Item`,\n * since each event typically carries its own status. `size` and `lineVariant`\n * set the shared defaults for every item's bullet size and connecting line.\n *\n * Direct children should be `Timeline.Item` elements (as in the example\n * above, or a flat `.map()` over an array of them) — `TimelineRoot` reads\n * each item's `color`/`variant`/`gradient`/`lineVariant` off its immediate\n * siblings and hands them to it as `prevItem`/`nextItem`, so every connector\n * can blend from one item's color into the next one's (see `lineEnd`,\n * `TimelineItem`). A child that isn't a recognized `Timeline.Item` breaks\n * that chain at that point and never crashes: the connector leading into it\n * stays flat in its own item's color, as if it were the last one.\n */\n/** The hidden text an item's progress state reads as: `complete` and `pending`\n * only; `active` speaks through `aria-current`, and `none` isn't progress. */\nconst stateLabel = (\n state: TimelineItemState | undefined,\n t: TimelineTranslations,\n): string | undefined =>\n state === \"complete\" ? t.complete : state === \"pending\" ? t.pending : undefined\n\nfunction isTimelineItem(node: ReactNode): node is ReactElement<TimelineItemInternalProps> {\n return isValidElement(node) && node.type === TimelineItem\n}\n\nconst TimelineRoot = ({\n className,\n size,\n lineVariant,\n active,\n translations,\n children,\n testId,\n ...rest\n}: TimelineProps) => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const items = Children.toArray(children)\n // `asChild` morphs the root into a single element the caller passed as its\n // one child (see Ark's `withAsChild`) — it requires that child to still be\n // a bare, single valid element, not array-wrapped, so skip the transform\n // entirely rather than hand it something `Children.toArray` reshaped.\n // `Timeline.Item`s nested a level deeper inside that child are outside what\n // this prop-threading reaches anyway, same as the constraint documented\n // above.\n const states = stateAt(items, active)\n const neighbour = (i: number): TimelineNeighbour | undefined => {\n const node = items[i]\n if (!isTimelineItem(node)) return undefined\n const { color, variant, gradient, lineVariant } = node.props\n return { color, variant, gradient, lineVariant, state: states[i] }\n }\n const withNeighbours = rest.asChild\n ? children\n : items.map((child, i) =>\n isTimelineItem(child)\n ? cloneElement(child, {\n prevItem: neighbour(i - 1),\n nextItem: neighbour(i + 1),\n state: states[i],\n stateLabel: stateLabel(states[i], t),\n } satisfies Partial<TimelineItemInternalProps>)\n : child,\n )\n return (\n <ark.ol\n className={cn(timelineVariants({ size, lineVariant }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withNeighbours}\n </ark.ol>\n )\n}\n\nexport type TimelineItemProps = Omit<HTMLArkProps<\"li\">, \"color\"> &\n Omit<VariantProps<typeof timelineBulletVariants>, \"ringed\" | \"state\" | \"radius\"> &\n WithTestId & {\n /** The bullet's corners: `full` (the default) is a dot, a smaller radius a\n * rounded tile — `light` with `md` reads as an icon tile. */\n radius?: TimelineBulletRadius\n /** Accent palette for the bullet. Re-exported as `Color` from `@42/ui-react`. */\n color?: Color\n /** Overrides the default dot with any node — an icon, `<Avatar>`, or a\n * `<Spinner>` for an in-progress item. */\n bullet?: ReactNode\n /** Overrides just this item's bullet diameter; defaults to `Timeline`'s\n * own `size`. Doesn't affect line thickness or spacing — only the dot. */\n size?: Size\n /** Overrides `Timeline`'s connecting-line style for just the segment\n * below this item. */\n lineVariant?: TimelineLineVariant\n /**\n * Gradient config. Only applied when `variant=\"gradient\"`.\n * Mirrors Badge's gradient prop — unset fields fall back to the CVA\n * defaults (purple-300 → pink-400, to-r).\n */\n gradient?: GradientProps\n /**\n * Nudges the bullet+line column down (a CSS length, e.g. `\"11px\"`) to\n * line the bullet up with something inside a custom `Timeline.Content` —\n * a card's title, say — that Timeline has no visibility into on its own.\n * Applied as a shared CSS custom property, not a plain padding class on\n * the bullet alone, because the connecting line is a separate sibling\n * element that also needs to shift down by the same amount to keep\n * meeting the bullet's (now lower) edge — see `TimelineItem`.\n */\n axisOffset?: string\n /**\n * Marks this item as the current step, overriding `Timeline`'s `active`\n * index — handy when mapping over data that already knows which entry is\n * current. If several items pass it, the first one wins; `false` is the\n * same as leaving it unset.\n */\n active?: boolean\n }\n\n/** See `TimelineRoot`'s `prevItem`/`nextItem` threading. */\ntype TimelineNeighbour = Pick<\n TimelineItemProps,\n \"color\" | \"variant\" | \"gradient\" | \"lineVariant\"\n> & { state?: TimelineItemState }\n\n/**\n * `prevItem`/`nextItem`/`state` are internal-only — injected by `TimelineRoot`, never\n * meant to be passed directly by a consumer — so they're kept off the\n * exported/documented `TimelineItemProps` (the same internal/public split\n * `ringed` already uses on `timelineBulletVariants`, just at the plain-prop\n * level here instead of the cva-variant level).\n */\ntype TimelineItemInternalProps = TimelineItemProps & {\n prevItem?: TimelineNeighbour\n nextItem?: TimelineNeighbour\n state?: TimelineItemState\n /** `state` in words, from the root's `translations` (see `stateLabel`). */\n stateLabel?: string\n}\n\n/**\n * One event: a bullet + connecting line (generated automatically — no manual\n * separator/connector wiring), and up to two children, `Timeline.Label` and\n * `Timeline.Content`, which place themselves into the shared column tracks.\n * The line to the next item is suppressed automatically on the last item.\n */\nconst TimelineItem = ({\n className,\n color,\n variant,\n radius,\n bullet,\n size,\n lineVariant,\n gradient,\n axisOffset,\n style,\n children,\n prevItem,\n nextItem,\n state = \"none\",\n stateLabel,\n // Read by `TimelineRoot` (see `stateAt`); kept off the `<li>`.\n active: _active,\n testId,\n asChild,\n ...rest\n}: TimelineItemInternalProps) => {\n const isGradient = variant === \"gradient\"\n const pending = state === \"pending\"\n // Only for the bullet's own style — the line reads its endpoints through\n // `lineEnd` instead. A pending gradient flattens, so it gets none.\n const gradientVars =\n isGradient && !pending ? buildGradientVars(gradient, GRADIENT_DEFAULTS) : undefined\n // `entry` also colors the axisOffset stub: it sits right where the previous\n // connector arrives, which is in this item's own entry color.\n const entry = lineEnd({ color, variant, gradient, state }, \"entry\")\n const exit = lineEnd({ color, variant, gradient, state }, \"exit\")\n // No recognized next item (the last item, or a stray non-item child next):\n // the connector has nothing to blend into, so it stays flat in its own exit.\n const target = nextItem ? lineEnd(nextItem, \"entry\") : exit\n const ownMask = lineVariant && { \"--tl-line-mask\": LINE_MASK[lineVariant] }\n const leadingMask = prevItem?.lineVariant && {\n \"--tl-line-mask\": LINE_MASK[prevItem.lineVariant],\n }\n\n return (\n <ark.li\n asChild={asChild}\n style={\n {\n ...(size ? { \"--tl-bullet-size\": BULLET_SIZE[size] } : undefined),\n ...(axisOffset ? { \"--tl-axis-offset\": axisOffset } : undefined),\n ...style,\n } as CSSProperties\n }\n className={cn(\n \"col-span-3 grid grid-cols-subgrid\",\n \"[&:first-child_[data-part=line][data-edge=start]]:hidden\",\n \"[&:last-child_[data-part=line][data-edge=end]]:hidden\",\n className,\n )}\n {...props({\n \"data-testid\": testId,\n \"data-state\": state !== \"none\" && state,\n \"aria-current\": state === \"active\" && \"step\",\n })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {/* Two line segments share `data-part=\"line\"` (so the first/last-item\n suppression selectors above match both) but differ in `data-edge`\n for layout and visibility. Both are a `--tl-line-width`-wide\n background bar rather than a border, so a gradient fill and the\n `--tl-line-mask` dash pattern can be combined.\n\n `data-edge=\"start\"` (leading) fills the gap `axisOffset` opens\n *above* this item's own (shifted-down) bullet — a plain height of\n `--tl-axis-offset` (0, i.e. invisible, when `axisOffset` isn't\n set), `self-start` so it sits flush at the row's own top edge.\n Hidden on the first item: nothing renders above the very first\n bullet to connect to. It's flat in this item's own entry color:\n the previous item's trailing segment has already blended into\n exactly that color by the time it reaches this row's top edge, so\n the two meet with no seam. Only its dash pattern comes from the\n previous item (`prevItem.lineVariant`), since it continues that\n item's segment.\n\n `data-edge=\"end\"` (trailing) is the connector to the next item: a\n grid item in the same cell as the bullet (col/row-start-2/1,\n default align-self:stretch fills the row's real height), whose\n margin-top pushes its own box down by exactly the bullet's\n diameter plus `--tl-axis-offset` — so it stops right at the\n bullet's edge instead of running behind it, and the hollow\n variants can stay genuinely transparent. Hidden on the last item.\n\n It blends from this item's exit color to the next item's entry\n color. Those are usually two *different* palettes, and a `--c-*`\n slot only resolves against the `data-color` of the element it's\n read on, so it takes two elements: the outer span carries this\n item's palette and declares `--tl-from`, the inner one carries the\n next item's and declares `--tl-to`. A custom property inherits its\n *computed* value — the `var(--c-solid)` in `--tl-from` is already\n substituted with this item's color by the time the inner span reads\n it — so the inner span sees both colors at once. The outer span stays\n the direct grid item (stretching through a nested element is\n unreliable); the inner one just fills it with `absolute inset-0`.\n\n `--tl-bullet-size`/`--tl-axis-offset` are declared on the `<li>`\n (see `timelineVariants` / this component's own `style`), not\n scoped to the bullet, so these siblings can read the same values\n as the axis div below — siblings can only stay in sync through a\n shared var. */}\n <span\n data-part=\"line\"\n data-edge=\"start\"\n data-color={entry.dataColor}\n style={{ \"--tl-from\": entry.value, ...leadingMask } as CSSProperties}\n className={cn(\n \"col-start-2 row-start-1 self-start justify-self-center w-(--tl-line-width)\",\n \"h-(--tl-axis-offset,0px) bg-(--tl-from) [mask-image:var(--tl-line-mask)]\",\n )}\n />\n <span\n data-part=\"line\"\n data-edge=\"end\"\n data-color={exit.dataColor}\n style={{ \"--tl-from\": exit.value, ...ownMask } as CSSProperties}\n className={cn(\n \"relative col-start-2 row-start-1 justify-self-center w-(--tl-line-width)\",\n \"mt-[calc(var(--tl-bullet-size)+var(--tl-axis-offset,0px))]\",\n \"[mask-image:var(--tl-line-mask)]\",\n )}\n >\n <span\n data-color={target.dataColor}\n style={{ \"--tl-to\": target.value } as CSSProperties}\n className=\"absolute inset-0 [background-image:linear-gradient(to_bottom_in_oklab,var(--tl-from),var(--tl-to))]\"\n />\n </span>\n <div\n data-part=\"axis\"\n // `relative` contains the sr-only state text below.\n className=\"relative col-start-2 row-start-1 flex justify-center self-start pt-(--tl-axis-offset)\"\n >\n {/* Complete vs pending is only a colour change on the bullet and line,\n so the state is also spelled out, ahead of the item's content. */}\n {stateLabel && <span className=\"sr-only\">{stateLabel}</span>}\n <span\n data-part=\"bullet\"\n // A pending bullet drops its palette: `[data-color]` and the\n // `pending` slot remap would both set `--c-*` on this one element,\n // leaving the winner to stylesheet order. The disabled slots it\n // remaps to are shared by every palette anyway.\n data-color={!isGradient && !pending ? color : undefined}\n style={gradientVars as CSSProperties}\n className={cn(\n timelineBulletVariants({\n variant,\n // A pending `default` step is a bare outer ring: no inset gap\n // and center to draw.\n ringed: !bullet && !(pending && (variant ?? \"default\") === \"default\"),\n state,\n radius,\n }),\n \"size-(--tl-bullet-size) grid place-items-center\",\n // A surface clips what it holds to its shape. A subtle bullet has none: its\n // custom bullet shows whole, with whatever it draws around itself (a badge's\n // glow), and centred on the line even when wider than the bullet (a pill):\n // its one column is held to the bullet's width (it would grow to the content's\n // and overflow to the end), and `unsafe` centres the content within it instead\n // of falling back to start alignment on overflow.\n variant === \"subtle\"\n ? \"overflow-visible grid-cols-[100%] [place-items:unsafe_center]\"\n : \"overflow-hidden\",\n // Zero specificity (`:where`), as in ActionIcon: a size class on\n // the icon itself wins over the bullet's default fill.\n \"[:where(&)_svg]:size-full [:where(&)_svg]:p-0.5\",\n isGradient && !pending && gradient?.dir && GRADIENT_DIR_CLASS[gradient.dir],\n )}\n >\n {bullet}\n </span>\n </div>\n {own}\n </>\n ))}\n </ark.li>\n )\n}\n\nexport type TimelineLabelProps = Omit<HTMLArkProps<\"span\">, \"color\"> &\n WithTestId & {\n /** Tints the label (and any icon inside it) to match the item's accent —\n * pass the same value given to the `Timeline.Item`'s `color`. Omit it to\n * keep the neutral muted default. */\n color?: Color\n }\n\n/**\n * The leading zone (typically a date/timestamp), aligned to the bullet. Lays\n * out its children in a row (`inline-flex items-center gap-1.5`) so an icon\n * before the text — e.g. `<Timeline.Label><CalendarIcon />Mar 1, 2026</Timeline.Label>` —\n * sits inline without extra markup; stack a date over a time by nesting a\n * `flex flex-col` wrapper around the text yourself.\n */\nconst TimelineLabel = ({ className, color, testId, ...rest }: TimelineLabelProps) => (\n <ark.span\n data-part=\"label\"\n data-color={color}\n className={cn(\n \"col-start-1 inline-flex items-center gap-1.5 self-start pt-px [:where(&)_svg]:size-3.5 [:where(&)_svg]:shrink-0\",\n color ? \"text-(--c-text)\" : TEXT_COLOR_CLASSES.muted,\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type TimelineContentProps = HTMLArkProps<\"div\"> & WithTestId\n\n/** The main body zone for an item — holds an optional `Timeline.Title` and\n * any free-form description content. */\nconst TimelineContent = ({ className, testId, ...rest }: TimelineContentProps) => (\n <ark.div\n data-part=\"content\"\n className={cn(\"col-start-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type TimelineTitleProps = HTMLArkProps<\"span\"> & WithTestId\n\n/** A bold lead-in line for `Timeline.Content`. Deliberately a `<span>`, styled\n * `block` to sit on its own line, not a heading (a timeline can hold many\n * items, and one `<h3>` per item would spam heading landmarks — unlike\n * `Table.Title`, which labels the table once) and not a `<p>` either. A\n * `<div>` doesn't fix that second problem: `<p>`'s content model is phrasing\n * content only, so a `<div>` inside one is exactly as invalid as a nested\n * `<p>` — the tag has to be phrasing content itself for a consumer to safely\n * wrap `Timeline.Title` in their own paragraph (e.g. `<Text>`) without\n * triggering React's \"cannot be a descendant of `<p>`\" DOM-nesting warning;\n * `block` gets the same visual line without changing that category. */\nconst TimelineTitle = ({ className, testId, ...rest }: TimelineTitleProps) => (\n <ark.span\n className={cn(\"block font-medium\", TEXT_COLOR_CLASSES.primary, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Timeline = Object.assign(TimelineRoot, {\n Item: TimelineItem,\n Label: TimelineLabel,\n Content: TimelineContent,\n Title: TimelineTitle,\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/components/timeline/timeline.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAA;AAInE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAkBnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,QAAA,MAAM,gBAAgB;;;8EA4DrB,CAAA;AA4CD,QAAA,MAAM,sBAAsB;;;;;8EA4F1B,CAAA;AA+DF;2DAC2D;AAC3D,KAAK,iBAAiB,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAA;AAuBnE,uEAAuE;AACvE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAA;AAC/B,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC,aAAa,CAAC,CAAC,CAAA;AACnG,MAAM,MAAM,oBAAo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MAAM,kBAAkB,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,UAAU,CAAA;AAElE;;;;;;;;;uEASuE;AACvE,QAAA,MAAM,aAAa,mCAAoC,kBAAkB,gCAMxE,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;CAKnB,CAAA"}
|
package/package.json
CHANGED
|
@@ -645,6 +645,28 @@ describe("Timeline", () => {
|
|
|
645
645
|
expect(subtle.getAttribute("data-color")).toBe("purple")
|
|
646
646
|
})
|
|
647
647
|
|
|
648
|
+
it("lets a subtle bullet show its content whole, and clips the others", () => {
|
|
649
|
+
const { container } = render(
|
|
650
|
+
<Timeline>
|
|
651
|
+
<Timeline.Item variant="subtle" bullet={<span>M3</span>}>
|
|
652
|
+
<Timeline.Content>x</Timeline.Content>
|
|
653
|
+
</Timeline.Item>
|
|
654
|
+
<Timeline.Item variant="light" bullet={<span>✓</span>}>
|
|
655
|
+
<Timeline.Content>x</Timeline.Content>
|
|
656
|
+
</Timeline.Item>
|
|
657
|
+
</Timeline>,
|
|
658
|
+
)
|
|
659
|
+
const [subtle, light] = [
|
|
660
|
+
...container.querySelectorAll<HTMLElement>('[data-part="bullet"]'),
|
|
661
|
+
] as [HTMLElement, HTMLElement]
|
|
662
|
+
expect(subtle.className).toContain("overflow-visible")
|
|
663
|
+
expect(subtle.className).not.toContain("overflow-hidden")
|
|
664
|
+
// Centred even when wider than the bullet, not pushed to the end.
|
|
665
|
+
expect(subtle.className).toContain("[place-items:unsafe_center]")
|
|
666
|
+
expect(subtle.className).toContain("grid-cols-[100%]")
|
|
667
|
+
expect(light.className).toContain("overflow-hidden")
|
|
668
|
+
})
|
|
669
|
+
|
|
648
670
|
it("dims a pending light bullet through its soft and text slots", () => {
|
|
649
671
|
const { container } = render(
|
|
650
672
|
<Timeline active={0}>
|
|
@@ -725,7 +725,16 @@ const TimelineItem = ({
|
|
|
725
725
|
state,
|
|
726
726
|
radius,
|
|
727
727
|
}),
|
|
728
|
-
"size-(--tl-bullet-size) grid place-items-center
|
|
728
|
+
"size-(--tl-bullet-size) grid place-items-center",
|
|
729
|
+
// A surface clips what it holds to its shape. A subtle bullet has none: its
|
|
730
|
+
// custom bullet shows whole, with whatever it draws around itself (a badge's
|
|
731
|
+
// glow), and centred on the line even when wider than the bullet (a pill):
|
|
732
|
+
// its one column is held to the bullet's width (it would grow to the content's
|
|
733
|
+
// and overflow to the end), and `unsafe` centres the content within it instead
|
|
734
|
+
// of falling back to start alignment on overflow.
|
|
735
|
+
variant === "subtle"
|
|
736
|
+
? "overflow-visible grid-cols-[100%] [place-items:unsafe_center]"
|
|
737
|
+
: "overflow-hidden",
|
|
729
738
|
// Zero specificity (`:where`), as in ActionIcon: a size class on
|
|
730
739
|
// the icon itself wins over the bullet's default fill.
|
|
731
740
|
"[:where(&)_svg]:size-full [:where(&)_svg]:p-0.5",
|