@42-central/ui-react 0.19.0 → 0.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/colors.css +15 -10
- package/dist/components/timeline/index.js +7 -13
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts +0 -24
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/theme.css +23 -0
- package/package.json +1 -1
- package/src/colors.css +15 -10
- package/src/components/timeline/timeline.test.tsx +27 -1
- package/src/components/timeline/timeline.tsx +25 -14
- package/src/theme.css +23 -0
package/dist/colors.css
CHANGED
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
*
|
|
32
32
|
* Disabled slots (--c-*-disabled):
|
|
33
33
|
* A disabled control reads as inactive, so these are deliberately
|
|
34
|
-
* palette-independent — neutral
|
|
34
|
+
* palette-independent — translucent neutral washes (black in light, white
|
|
35
|
+
* in dark) that mute the accent. Translucent, not opaque gray steps, so
|
|
36
|
+
* they take the tint of whatever surface they sit on. They are
|
|
35
37
|
* declared once on `:root` / `[data-theme="dark"]`; every `[data-color]`
|
|
36
38
|
* inherits the same muted appearance, so they are *not* repeated per color.
|
|
37
39
|
* Consumers wanting a palette-specific disabled look can still override
|
|
@@ -55,11 +57,12 @@
|
|
|
55
57
|
--c-soft-hover: color-mix(in oklab, var(--color-black) 35%, transparent);
|
|
56
58
|
--c-text: var(--color-gray-light-700);
|
|
57
59
|
|
|
58
|
-
/* Neutral disabled slots — shared across every palette (see header).
|
|
59
|
-
|
|
60
|
-
--c-
|
|
61
|
-
--c-
|
|
62
|
-
--c-
|
|
60
|
+
/* Neutral disabled slots — shared across every palette (see header).
|
|
61
|
+
Translucent black washes, so they pick up whatever surface they sit on. */
|
|
62
|
+
--c-solid-disabled: color-mix(in oklab, var(--color-black) 16%, transparent);
|
|
63
|
+
--c-on-solid-disabled: color-mix(in oklab, var(--color-black) 55%, transparent);
|
|
64
|
+
--c-soft-disabled: color-mix(in oklab, var(--color-black) 4%, transparent);
|
|
65
|
+
--c-text-disabled: color-mix(in oklab, var(--color-black) 38%, transparent);
|
|
63
66
|
}
|
|
64
67
|
[data-theme="dark"] {
|
|
65
68
|
--c-solid: var(--color-white);
|
|
@@ -69,10 +72,12 @@
|
|
|
69
72
|
--c-soft-hover: color-mix(in oklab, var(--color-white) 35%, transparent);
|
|
70
73
|
--c-text: var(--color-gray-dark-300);
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
--c-
|
|
75
|
-
--c-
|
|
75
|
+
/* Translucent white washes: on the blue-tinted brand-950 surface they
|
|
76
|
+
take its tint instead of reading as a flat foreign gray. */
|
|
77
|
+
--c-solid-disabled: color-mix(in oklab, var(--color-white) 20%, transparent);
|
|
78
|
+
--c-on-solid-disabled: color-mix(in oklab, var(--color-white) 50%, transparent);
|
|
79
|
+
--c-soft-disabled: color-mix(in oklab, var(--color-white) 8%, transparent);
|
|
80
|
+
--c-text-disabled: color-mix(in oklab, var(--color-white) 35%, transparent);
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
[data-color="brand"] {
|
|
@@ -75,6 +75,7 @@ var timelineVariants = cva(
|
|
|
75
75
|
defaultVariants: { size: "md", lineVariant: "solid" }
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
|
+
var RING_CUTOUT = "ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-transparent ring-inset";
|
|
78
79
|
var timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
79
80
|
variants: {
|
|
80
81
|
variant: {
|
|
@@ -87,14 +88,10 @@ var timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
|
87
88
|
dashed: "border-dashed border-(--c-solid) border dark:[&_svg]:text-white",
|
|
88
89
|
default: "dark:bg-gray-light-50 dark:text-gray-light-900 bg-gray-dark-900 text-gray-dark-25 border",
|
|
89
90
|
// from-*/to-* are the CSS defaults for --tw-gradient-from/to — see Badge.
|
|
90
|
-
// The
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
gradient:
|
|
94
|
-
"bg-linear-to-r from-purple-300 to-pink-400 text-black",
|
|
95
|
-
"relative",
|
|
96
|
-
"before:absolute before:inset-px before:border-2 before:border-brand-50 dark:before:border-brand-950 before:rounded-full"
|
|
97
|
-
]
|
|
91
|
+
// The transparent border is the outer band of `RING_CUTOUT` (see the
|
|
92
|
+
// compounds below), drawn the same way as `filled`'s: `bg-origin-border`
|
|
93
|
+
// lays the gradient out under it instead of tiling it at the edge.
|
|
94
|
+
gradient: "bg-linear-to-r from-purple-300 to-pink-400 text-black border border-transparent bg-origin-border"
|
|
98
95
|
},
|
|
99
96
|
/** Internal only — never exposed on `TimelineItemProps` (see `Omit` on
|
|
100
97
|
* its type). Derived from whether the item has a custom `bullet`. */
|
|
@@ -114,11 +111,8 @@ var timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
|
114
111
|
}
|
|
115
112
|
},
|
|
116
113
|
compoundVariants: [
|
|
117
|
-
{
|
|
118
|
-
|
|
119
|
-
ringed: true,
|
|
120
|
-
class: "border ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-(--c-solid) ring-inset"
|
|
121
|
-
},
|
|
114
|
+
{ variant: "filled", ringed: true, class: ["border", RING_CUTOUT] },
|
|
115
|
+
{ variant: "gradient", ringed: true, class: RING_CUTOUT },
|
|
122
116
|
{
|
|
123
117
|
variant: "default",
|
|
124
118
|
ringed: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/timeline/timeline.tsx"],"names":["lineVariant"],"mappings":";;;;;;;;;AAwBA,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,GA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zD,GAAA;AAAA,EAAC,GAAA,CAAI,IAAA;AAAA,EAAJ;AAAA,IACC,WAAA,EAAU,OAAA;AAAA,IACV,YAAA,EAAY,KAAA;AAAA,IACZ,SAAA,EAAW,EAAA;AAAA,MACT,iGAAA;AAAA,MACA,QAAQ,iBAAA,GAAoB,6CAAA;AAAA,MAC5B;AAAA,KACF;AAAA,IACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IAClC,GAAG;AAAA;AACN,CAAA;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,8DAAA,EAAgE,SAAS,CAAA;AAAA,IACtF,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\"\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-gray-dark-900)] dark:[--tl-inverted:var(--color-gray-light-50)]\",\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. */\nconst timelineBulletVariants = cva([\"rounded-full shrink-0\"], {\n variants: {\n variant: {\n // `dark:[&_svg]:text-white` overrides the slot-var/theme text color for\n // just the icon, on the three variants whose dark-mode surface is a\n // saturated or dark fill — `default`/`gradient` invert to a *light*\n // dark-mode surface instead, so forcing white there would hide the icon.\n filled: \"bg-(--c-solid) text-(--c-on-solid) dark:[&_svg]:text-white\",\n outline: \"border-(--c-solid) border dark:[&_svg]:text-white\",\n dashed: \"border-dashed border-(--c-solid) border dark:[&_svg]:text-white\",\n default:\n \"dark:bg-gray-light-50 dark:text-gray-light-900 bg-gray-dark-900 text-gray-dark-25 border\",\n // from-*/to-* are the CSS defaults for --tw-gradient-from/to — see Badge.\n // The inner cut-out ring (and the ring offsets in the compounds below)\n // paint the page background, `brand-50` / `brand-950`, so the gap reads\n // as a hole through to the page rather than a gray outline.\n gradient: [\n \"bg-linear-to-r from-purple-300 to-pink-400 text-black\",\n \"relative\",\n \"before:absolute before:inset-px before:border-2 before:border-brand-50 dark:before:border-brand-950 before:rounded-full\",\n ],\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: \"[--c-solid:var(--c-solid-disabled)] [--c-on-solid:var(--c-on-solid-disabled)]\",\n },\n },\n compoundVariants: [\n {\n variant: \"filled\",\n ringed: true,\n class:\n \"border ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-(--c-solid) ring-inset\",\n },\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-gray-light-950 dark:ring-gray-light-50 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\" },\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 TimelineBulletVariant = NonNullable<\n VariantProps<typeof timelineBulletVariants>[\"variant\"]\n>\n\nexport type { GradientDir, GradientProps }\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 }\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 */\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 children,\n testId,\n ...rest\n}: TimelineProps) => {\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 } 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\"> &\n WithTestId & {\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}\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 bullet,\n size,\n lineVariant,\n gradient,\n axisOffset,\n style,\n children,\n prevItem,\n nextItem,\n state = \"none\",\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 className=\"col-start-2 row-start-1 flex justify-center self-start pt-(--tl-axis-offset)\"\n >\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 }),\n \"size-(--tl-bullet-size) grid place-items-center overflow-hidden\",\n \"[&_svg]:size-full [&_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 [&_svg]:size-3.5 [&_svg]:shrink-0\",\n color ? \"text-(--c-text)\" : \"text-gray-light-500 dark:text-gray-dark-400\",\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-gray-light-900 dark:text-gray-dark-25\", 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"],"mappings":";;;;;;;;;AAwBA,IAAM,WAAA,GAA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,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\"\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-gray-dark-900)] dark:[--tl-inverted:var(--color-gray-light-50)]\",\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([\"rounded-full shrink-0\"], {\n variants: {\n variant: {\n // `dark:[&_svg]:text-white` overrides the slot-var/theme text color for\n // just the icon, on the three variants whose dark-mode surface is a\n // saturated or dark fill — `default`/`gradient` invert to a *light*\n // dark-mode surface instead, so forcing white there would hide the icon.\n filled: \"bg-(--c-solid) text-(--c-on-solid) dark:[&_svg]:text-white\",\n outline: \"border-(--c-solid) border dark:[&_svg]:text-white\",\n dashed: \"border-dashed border-(--c-solid) border dark:[&_svg]:text-white\",\n default:\n \"dark:bg-gray-light-50 dark:text-gray-light-900 bg-gray-dark-900 text-gray-dark-25 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: \"[--c-solid:var(--c-solid-disabled)] [--c-on-solid:var(--c-on-solid-disabled)]\",\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-gray-light-950 dark:ring-gray-light-50 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\" },\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 TimelineBulletVariant = NonNullable<\n VariantProps<typeof timelineBulletVariants>[\"variant\"]\n>\n\nexport type { GradientDir, GradientProps }\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 }\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 */\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 children,\n testId,\n ...rest\n}: TimelineProps) => {\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 } 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\"> &\n WithTestId & {\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}\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 bullet,\n size,\n lineVariant,\n gradient,\n axisOffset,\n style,\n children,\n prevItem,\n nextItem,\n state = \"none\",\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 className=\"col-start-2 row-start-1 flex justify-center self-start pt-(--tl-axis-offset)\"\n >\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 }),\n \"size-(--tl-bullet-size) grid place-items-center overflow-hidden\",\n \"[&_svg]:size-full [&_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 [&_svg]:size-3.5 [&_svg]:shrink-0\",\n color ? \"text-(--c-text)\" : \"text-gray-light-500 dark:text-gray-dark-400\",\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-gray-light-900 dark:text-gray-dark-25\", 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"]}
|
|
@@ -48,30 +48,6 @@ declare const timelineVariants: (props?: ({
|
|
|
48
48
|
size?: "lg" | "md" | "sm" | "xl" | "xs" | null | undefined;
|
|
49
49
|
lineVariant?: "dashed" | "solid" | null | undefined;
|
|
50
50
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
51
|
-
/** Shape × color for the bullet — a small circle in the item's own
|
|
52
|
-
* `data-color`. Mirrors Badge's (variant × color) axis (plus the same
|
|
53
|
-
* `gradient` treatment) so a status dot reads consistently with the rest of
|
|
54
|
-
* the kit. Dimensions are deliberately absent here (see `timelineVariants`)
|
|
55
|
-
* so the same classes work at every `size`.
|
|
56
|
-
*
|
|
57
|
-
* `default` — the component's own default — mirrors Button's inverted
|
|
58
|
-
* black/white treatment (dark surface in light mode, light surface in dark
|
|
59
|
-
* mode), not a plain gray dot, so an untouched `<Timeline.Item>` reads as a
|
|
60
|
-
* neutral, high-contrast marker rather than a colored status.
|
|
61
|
-
*
|
|
62
|
-
* `filled` and `default` ring their own fill with an *inset* box-shadow
|
|
63
|
-
* ring-then-gap (`ring-inset` + `ring-offset`, page-background colored), not
|
|
64
|
-
* plain outset `ring`/`ring-offset` — those grow the dot past
|
|
65
|
-
* `--tl-bullet-size` and make it the one variant whose total footprint
|
|
66
|
-
* doesn't match its same-`size` siblings. Inset shadows stay fully inside
|
|
67
|
-
* the box no matter the color, so every variant — flat border or ringed
|
|
68
|
-
* fill — renders at exactly the same diameter.
|
|
69
|
-
*
|
|
70
|
-
* That ring is for the *plain dot* reading, though — once a `bullet` icon
|
|
71
|
-
* sits on top of it, a ring around a small icon reads as a stray outline
|
|
72
|
-
* rather than a marker, so `TimelineItem` passes `ringed: !bullet` and the
|
|
73
|
-
* `compoundVariants` below drop the ring/gap for a flat, fully filled disc
|
|
74
|
-
* whenever there's icon content to frame. */
|
|
75
51
|
declare const timelineBulletVariants: (props?: ({
|
|
76
52
|
variant?: "dashed" | "default" | "filled" | "gradient" | "outline" | null | undefined;
|
|
77
53
|
ringed?: boolean | null | undefined;
|
|
@@ -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;AAiBnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,QAAA,MAAM,gBAAgB;;;8EA4DrB,CAAA;
|
|
1
|
+
{"version":3,"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AAA,MAAM,aAAa,0CAA2C,kBAAkB,gCAY/E,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,UAAU,CAAA;AAEnE;wCACwC;AACxC,QAAA,MAAM,eAAe,mCAAoC,oBAAoB,gCAO5E,CAAA;AAED,MAAM,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/dist/theme.css
CHANGED
|
@@ -392,6 +392,29 @@ body {
|
|
|
392
392
|
color: var(--color-gray-dark-50);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
+
/* Default border color: the kit's hairline. Tailwind v4 dropped v3's default
|
|
396
|
+
border color, so a bare `border` (a Timeline bullet's edge, Schedule's
|
|
397
|
+
time-column divider) paints in `currentColor`: near-black on a white dot,
|
|
398
|
+
a hard white line on dark surfaces. The docs never showed it because
|
|
399
|
+
Fumadocs adds the same kind of rule; any app without Fumadocs did. Layered
|
|
400
|
+
in `base`, under every utility, so a component that sets its own border
|
|
401
|
+
color keeps it. */
|
|
402
|
+
:root {
|
|
403
|
+
--default-border-color: color-mix(in srgb, var(--color-brand-900) 20%, transparent);
|
|
404
|
+
}
|
|
405
|
+
[data-theme="dark"] {
|
|
406
|
+
--default-border-color: color-mix(in srgb, white 15%, transparent);
|
|
407
|
+
}
|
|
408
|
+
@layer base {
|
|
409
|
+
*,
|
|
410
|
+
::after,
|
|
411
|
+
::before,
|
|
412
|
+
::backdrop,
|
|
413
|
+
::file-selector-button {
|
|
414
|
+
border-color: var(--default-border-color, currentColor);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
395
418
|
@keyframes fade-in {
|
|
396
419
|
from {
|
|
397
420
|
opacity: 0;
|
package/package.json
CHANGED
package/src/colors.css
CHANGED
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
*
|
|
32
32
|
* Disabled slots (--c-*-disabled):
|
|
33
33
|
* A disabled control reads as inactive, so these are deliberately
|
|
34
|
-
* palette-independent — neutral
|
|
34
|
+
* palette-independent — translucent neutral washes (black in light, white
|
|
35
|
+
* in dark) that mute the accent. Translucent, not opaque gray steps, so
|
|
36
|
+
* they take the tint of whatever surface they sit on. They are
|
|
35
37
|
* declared once on `:root` / `[data-theme="dark"]`; every `[data-color]`
|
|
36
38
|
* inherits the same muted appearance, so they are *not* repeated per color.
|
|
37
39
|
* Consumers wanting a palette-specific disabled look can still override
|
|
@@ -55,11 +57,12 @@
|
|
|
55
57
|
--c-soft-hover: color-mix(in oklab, var(--color-black) 35%, transparent);
|
|
56
58
|
--c-text: var(--color-gray-light-700);
|
|
57
59
|
|
|
58
|
-
/* Neutral disabled slots — shared across every palette (see header).
|
|
59
|
-
|
|
60
|
-
--c-
|
|
61
|
-
--c-
|
|
62
|
-
--c-
|
|
60
|
+
/* Neutral disabled slots — shared across every palette (see header).
|
|
61
|
+
Translucent black washes, so they pick up whatever surface they sit on. */
|
|
62
|
+
--c-solid-disabled: color-mix(in oklab, var(--color-black) 16%, transparent);
|
|
63
|
+
--c-on-solid-disabled: color-mix(in oklab, var(--color-black) 55%, transparent);
|
|
64
|
+
--c-soft-disabled: color-mix(in oklab, var(--color-black) 4%, transparent);
|
|
65
|
+
--c-text-disabled: color-mix(in oklab, var(--color-black) 38%, transparent);
|
|
63
66
|
}
|
|
64
67
|
[data-theme="dark"] {
|
|
65
68
|
--c-solid: var(--color-white);
|
|
@@ -69,10 +72,12 @@
|
|
|
69
72
|
--c-soft-hover: color-mix(in oklab, var(--color-white) 35%, transparent);
|
|
70
73
|
--c-text: var(--color-gray-dark-300);
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
--c-
|
|
75
|
-
--c-
|
|
75
|
+
/* Translucent white washes: on the blue-tinted brand-950 surface they
|
|
76
|
+
take its tint instead of reading as a flat foreign gray. */
|
|
77
|
+
--c-solid-disabled: color-mix(in oklab, var(--color-white) 20%, transparent);
|
|
78
|
+
--c-on-solid-disabled: color-mix(in oklab, var(--color-white) 50%, transparent);
|
|
79
|
+
--c-soft-disabled: color-mix(in oklab, var(--color-white) 8%, transparent);
|
|
80
|
+
--c-text-disabled: color-mix(in oklab, var(--color-white) 35%, transparent);
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
[data-color="brand"] {
|
|
@@ -537,7 +537,10 @@ describe("Timeline", () => {
|
|
|
537
537
|
// ring/ring-offset pair — that's what keeps every variant at the same
|
|
538
538
|
// total footprint.
|
|
539
539
|
expect(bullet.className).toContain("ring-inset")
|
|
540
|
-
|
|
540
|
+
// The ring band shows the fill through a transparent ring, so a
|
|
541
|
+
// translucent fill (pending's disabled wash) isn't painted twice.
|
|
542
|
+
expect(bullet.className).toContain("ring-transparent")
|
|
543
|
+
expect(bullet.className).not.toContain("ring-(--c-solid)")
|
|
541
544
|
})
|
|
542
545
|
|
|
543
546
|
it("forces bullet icons to white in dark mode on the colored variants, not default/gradient", () => {
|
|
@@ -605,6 +608,29 @@ describe("Timeline", () => {
|
|
|
605
608
|
expect(bullet.style.getPropertyValue("--tw-gradient-to")).toBe("#222")
|
|
606
609
|
})
|
|
607
610
|
|
|
611
|
+
it("cuts a gradient dot's gap with the same inset ring as filled, not a ::before border", () => {
|
|
612
|
+
const { container } = render(
|
|
613
|
+
<Timeline>
|
|
614
|
+
<Timeline.Item variant="gradient">
|
|
615
|
+
<Timeline.Content>x</Timeline.Content>
|
|
616
|
+
</Timeline.Item>
|
|
617
|
+
<Timeline.Item variant="gradient" bullet={<svg aria-hidden="true" />}>
|
|
618
|
+
<Timeline.Content>y</Timeline.Content>
|
|
619
|
+
</Timeline.Item>
|
|
620
|
+
</Timeline>,
|
|
621
|
+
)
|
|
622
|
+
const bullets = container.querySelectorAll('[data-part="bullet"]')
|
|
623
|
+
const dot = bullets[0] as HTMLElement
|
|
624
|
+
const icon = bullets[1] as HTMLElement
|
|
625
|
+
// A border drawn gap snaps differently from a box-shadow one under zoom.
|
|
626
|
+
expect(dot.className).not.toMatch(/before:/)
|
|
627
|
+
expect(dot.className).toContain("ring-inset")
|
|
628
|
+
expect(dot.className).toContain("ring-offset-2")
|
|
629
|
+
// Like filled, an icon bullet is a flat disc with no cut-out.
|
|
630
|
+
expect(icon.className).not.toContain("ring-inset")
|
|
631
|
+
expect(icon.className).not.toContain("ring-offset-2")
|
|
632
|
+
})
|
|
633
|
+
|
|
608
634
|
it("tints Timeline.Label's text and icons via its own color prop", () => {
|
|
609
635
|
const { container } = render(
|
|
610
636
|
<Timeline>
|
|
@@ -155,6 +155,24 @@ const timelineVariants = cva(
|
|
|
155
155
|
* rather than a marker, so `TimelineItem` passes `ringed: !bullet` and the
|
|
156
156
|
* `compoundVariants` below drop the ring/gap for a flat, fully filled disc
|
|
157
157
|
* whenever there's icon content to frame. */
|
|
158
|
+
/** The ringed `filled` and `gradient` bullets' band → gap → fill cut-out:
|
|
159
|
+
* the bullet's border is the outer band and an inset ring-offset is the gap,
|
|
160
|
+
* painted the page background (`brand-50` / `brand-950`) so it reads as a
|
|
161
|
+
* hole through to the page.
|
|
162
|
+
*
|
|
163
|
+
* Both variants share it — and `default` draws its gap the same way — so
|
|
164
|
+
* they all snap alike: under CSS `zoom` (or browser zoom) Chromium floors
|
|
165
|
+
* border widths to whole device pixels but not box-shadow spreads, so a gap
|
|
166
|
+
* drawn as a `::before` border instead came out thinner than its siblings'.
|
|
167
|
+
*
|
|
168
|
+
* The ring is transparent on purpose: its band sits over the bullet's own
|
|
169
|
+
* fill, so the fill already paints it — the ring utility is only there to
|
|
170
|
+
* draw the offset gap. Painting `--c-solid` again would double a translucent
|
|
171
|
+
* fill (the pending `--c-solid-disabled` wash) and make the band read
|
|
172
|
+
* brighter than the center. */
|
|
173
|
+
const RING_CUTOUT =
|
|
174
|
+
"ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-transparent ring-inset"
|
|
175
|
+
|
|
158
176
|
const timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
159
177
|
variants: {
|
|
160
178
|
variant: {
|
|
@@ -168,14 +186,11 @@ const timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
|
168
186
|
default:
|
|
169
187
|
"dark:bg-gray-light-50 dark:text-gray-light-900 bg-gray-dark-900 text-gray-dark-25 border",
|
|
170
188
|
// from-*/to-* are the CSS defaults for --tw-gradient-from/to — see Badge.
|
|
171
|
-
// The
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
gradient:
|
|
175
|
-
"bg-linear-to-r from-purple-300 to-pink-400 text-black",
|
|
176
|
-
"relative",
|
|
177
|
-
"before:absolute before:inset-px before:border-2 before:border-brand-50 dark:before:border-brand-950 before:rounded-full",
|
|
178
|
-
],
|
|
189
|
+
// The transparent border is the outer band of `RING_CUTOUT` (see the
|
|
190
|
+
// compounds below), drawn the same way as `filled`'s: `bg-origin-border`
|
|
191
|
+
// lays the gradient out under it instead of tiling it at the edge.
|
|
192
|
+
gradient:
|
|
193
|
+
"bg-linear-to-r from-purple-300 to-pink-400 text-black border border-transparent bg-origin-border",
|
|
179
194
|
},
|
|
180
195
|
/** Internal only — never exposed on `TimelineItemProps` (see `Omit` on
|
|
181
196
|
* its type). Derived from whether the item has a custom `bullet`. */
|
|
@@ -195,12 +210,8 @@ const timelineBulletVariants = cva(["rounded-full shrink-0"], {
|
|
|
195
210
|
},
|
|
196
211
|
},
|
|
197
212
|
compoundVariants: [
|
|
198
|
-
{
|
|
199
|
-
|
|
200
|
-
ringed: true,
|
|
201
|
-
class:
|
|
202
|
-
"border ring-2 ring-offset-2 ring-offset-brand-50 dark:ring-offset-brand-950 ring-(--c-solid) ring-inset",
|
|
203
|
-
},
|
|
213
|
+
{ variant: "filled", ringed: true, class: ["border", RING_CUTOUT] },
|
|
214
|
+
{ variant: "gradient", ringed: true, class: RING_CUTOUT },
|
|
204
215
|
{
|
|
205
216
|
variant: "default",
|
|
206
217
|
ringed: true,
|
package/src/theme.css
CHANGED
|
@@ -392,6 +392,29 @@ body {
|
|
|
392
392
|
color: var(--color-gray-dark-50);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
+
/* Default border color: the kit's hairline. Tailwind v4 dropped v3's default
|
|
396
|
+
border color, so a bare `border` (a Timeline bullet's edge, Schedule's
|
|
397
|
+
time-column divider) paints in `currentColor`: near-black on a white dot,
|
|
398
|
+
a hard white line on dark surfaces. The docs never showed it because
|
|
399
|
+
Fumadocs adds the same kind of rule; any app without Fumadocs did. Layered
|
|
400
|
+
in `base`, under every utility, so a component that sets its own border
|
|
401
|
+
color keeps it. */
|
|
402
|
+
:root {
|
|
403
|
+
--default-border-color: color-mix(in srgb, var(--color-brand-900) 20%, transparent);
|
|
404
|
+
}
|
|
405
|
+
[data-theme="dark"] {
|
|
406
|
+
--default-border-color: color-mix(in srgb, white 15%, transparent);
|
|
407
|
+
}
|
|
408
|
+
@layer base {
|
|
409
|
+
*,
|
|
410
|
+
::after,
|
|
411
|
+
::before,
|
|
412
|
+
::backdrop,
|
|
413
|
+
::file-selector-button {
|
|
414
|
+
border-color: var(--default-border-color, currentColor);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
395
418
|
@keyframes fade-in {
|
|
396
419
|
from {
|
|
397
420
|
opacity: 0;
|