@overdoser/react-toolkit 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +6 -0
- package/CHANGELOG.md +84 -0
- package/components/Drawer/Drawer.js +88 -83
- package/components/Timeline/GanttTimeline.d.ts +144 -0
- package/components/Timeline/GanttTimeline.js +305 -0
- package/components/Timeline/GanttTimeline.module.scss.js +55 -0
- package/components/Timeline/HistoryTimeline.d.ts +184 -0
- package/components/Timeline/HistoryTimeline.js +445 -0
- package/components/Timeline/HistoryTimeline.module.scss.js +59 -0
- package/components/Timeline/Timeline.module.scss.js +111 -0
- package/components/Timeline/TimelineShared.d.ts +79 -0
- package/components/Timeline/TimelineShared.js +173 -0
- package/components/Timeline/TraceTimeline.d.ts +180 -0
- package/components/Timeline/TraceTimeline.js +511 -0
- package/components/Timeline/TraceTimeline.module.scss.js +105 -0
- package/components/Timeline/demoData.d.ts +42 -0
- package/components/Timeline/historyLayout.d.ts +82 -0
- package/components/Timeline/historyLayout.js +264 -0
- package/components/Timeline/index.d.ts +7 -0
- package/components/Timeline/timelineCore.d.ts +90 -0
- package/components/Timeline/timelineCore.js +135 -0
- package/components/Timeline/traceLayout.d.ts +72 -0
- package/components/Timeline/traceLayout.js +92 -0
- package/components/Timeline/useTimeline.d.ts +39 -0
- package/components/Timeline/useTimeline.js +81 -0
- package/components/inputs/Select/Select.js +158 -154
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.js +93 -87
- package/index.layered.css +1 -1
- package/llms.txt +113 -0
- package/manifest.json +323 -0
- package/package.json +1 -1
- package/recipes/live-timeline-feed.tsx +147 -0
package/AGENTS.md
CHANGED
|
@@ -101,6 +101,11 @@ For exhaustive component reference (every prop, every variant, every signature),
|
|
|
101
101
|
- Tiny inline trend (table cell, KPI tile) → `<Sparkline>`.
|
|
102
102
|
- Axis-based charts share a `config` object: `{ [dataKey]: { label, color } }`. `PieChart` uses `nameKey` + `valueKey` (+ optional `colorKey`) instead. Colors via `var(--crk-chart-1)` … `var(--crk-chart-5)`.
|
|
103
103
|
|
|
104
|
+
- **Need a timeline of events?** Three views, all fully controlled (you pass the pre-filtered event array; items without an `end` render live and keep growing until an update completes them), all with wheel-zoom / drag-pan / Fit, keyword highlighting (built-in toolbar search box by default — `showSearch={false}` to hide, `renderSearch` to inject your own element, or controlled `highlight` + `onHighlightChange` for an external box), tooltips, a click-to-open detail side panel, and an optional `showSummary` panel (dense numbered event list with a live viewport band and click-to-navigate smooth scrolling; `summaryPlacement` docks it left/right/top/bottom or floats it as a draggable palette). Customize via `--crk-timeline-*` tokens, `classes`, or render-prop slots (`renderChip`/`renderCard`/`renderBar`+`renderRowLabel`, `renderTooltip`, `renderDetails`) that inject custom components while the layout algorithms keep owning geometry:
|
|
105
|
+
- Request/response flow across services (one correlated "manifest"/saga/order) on a proportional UTC band → `<TraceTimeline events title services highlight />`.
|
|
106
|
+
- One subject's life story (order, incident, candidate, deploy) as cards alternating around an axis, horizontal or vertical, equal/log/proportional spacing → `<HistoryTimeline events subjectName defaultSpacing />`.
|
|
107
|
+
- Tasks stacked by start time with duration bars (Gantt) → `<GanttTimeline tasks title onTaskSelect />`.
|
|
108
|
+
|
|
104
109
|
- **Multi-step / wizard form?** Use one `useForm()` per step OR a single `<Form>` wrapping all steps with conditional rendering. The toolkit doesn't ship a stepper.
|
|
105
110
|
|
|
106
111
|
## Common shapes (copy-paste)
|
|
@@ -172,6 +177,7 @@ Full copy-paste-able files live alongside this doc. Each is one self-contained f
|
|
|
172
177
|
- [recipes/interactive-pie-chart.tsx](./recipes/interactive-pie-chart.tsx) — Metric/period filter for `PieChart`: all slices stay visible, the selector picks which metric drives the pie. Three exports: `InteractivePieChartTiles`, `InteractivePieChartNavigator`, `InteractivePieChartDropdown`.
|
|
173
178
|
- [recipes/trading-chart.tsx](./recipes/trading-chart.tsx) — Full-stack `TradingChart` with a resolution selector, in-memory datafeed adapter, and the SMA/EMA/Bollinger/RSI/Volume indicator stack. Swap `createMemoryDatafeed` for your own REST/WebSocket adapter; everything else carries over.
|
|
174
179
|
- [recipes/tag-input.tsx](./recipes/tag-input.tsx) — Tag-input pattern via `<Select multiple allowCreate>`: pick from existing tags or type a new one + Enter to create. `onCreate` persists the new tag back into the options list. Wired through `<FormField>` for react-hook-form integration.
|
|
180
|
+
- [recipes/live-timeline-feed.tsx](./recipes/live-timeline-feed.tsx) — Live event feeds into `TraceTimeline` / `HistoryTimeline` / `GanttTimeline`: consumer-side push/complete merge hooks (start appends with `end: null`, complete merges response fields + stamps `end`), optional WebSocket source, and consumer-side correlation filtering.
|
|
175
181
|
- [recipes/multi-select-in-modal.tsx](./recipes/multi-select-in-modal.tsx) — `<Select multiple>` inside `<Modal size="sm">`. Default `portal={true}` lets the menu escape the modal's `overflow: hidden` and sit above the modal via `--crk-z-floating`, so the modal does NOT need to be sized to contain the menu. Pair with `closeOnBackdrop={false}` so a backdrop click closes the open menu only, not the modal.
|
|
176
182
|
|
|
177
183
|
## Anti-patterns to refuse
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,90 @@ All notable changes to `@overdoser/react-toolkit` are documented here.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
|
5
5
|
project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.9.0]
|
|
8
|
+
|
|
9
|
+
Introduces the Timeline family: three timeline views built from the
|
|
10
|
+
timeline-views design handoff, sharing one theming/customization surface.
|
|
11
|
+
Components render whatever event arrays they are given — filtering,
|
|
12
|
+
correlation, and live-feed sourcing stay in consumer code.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- **`TraceTimeline`** — horizontal trace view for correlated
|
|
17
|
+
request/response (or custom) events, e.g. tracking one manifest across
|
|
18
|
+
services. Sub-row bar packing plus chip nudging keeps labels
|
|
19
|
+
overlap-free; events without an `end` render as live/growing; clicking
|
|
20
|
+
an event opens a details drawer (`renderDetails` to replace it).
|
|
21
|
+
- **`HistoryTimeline`** — subject history view with event circles and
|
|
22
|
+
description chips, horizontal or vertical, with `equal`/`proportional`/
|
|
23
|
+
`log` spacing. Connector segments are routed around circles and other
|
|
24
|
+
segments; chip heights are content-computed so chips never overlap.
|
|
25
|
+
- **`GanttTimeline`** — project-planning view with task bars, progress,
|
|
26
|
+
and row labels.
|
|
27
|
+
- Shared across the family: built-in hideable controls (zoom, orientation
|
|
28
|
+
and spacing where relevant) with controlled/uncontrolled props; a
|
|
29
|
+
built-in keyword-highlight search box (`showSearch`, `highlight` /
|
|
30
|
+
`defaultHighlight` / `onHighlightChange`, or inject your own element via
|
|
31
|
+
`renderSearch`); an optional summary panel (`showSummary`) listing every
|
|
32
|
+
event as a numbered dense row with a viewport band tracking what's
|
|
33
|
+
visible and ~1s smooth scroll-to-event on click, placeable
|
|
34
|
+
`left`/`right`/`top`/`bottom` or `floating` (draggable);
|
|
35
|
+
render-prop slots (`renderChip`/`renderCard`/`renderBar`/
|
|
36
|
+
`renderRowLabel`/`renderTooltip`/`renderDetails`); `classes` overrides;
|
|
37
|
+
and `--crk-timeline-*` theme tokens defaulting to the handoff palette.
|
|
38
|
+
- New recipe `recipes/live-timeline-feed.tsx` — push/complete merge hooks
|
|
39
|
+
for feeding live events into any of the three views (WebSocket example
|
|
40
|
+
included).
|
|
41
|
+
|
|
42
|
+
## [0.8.3]
|
|
43
|
+
|
|
44
|
+
One more callback-ref fix, found by auditing for the 0.8.1/0.8.2
|
|
45
|
+
pattern. No API changes.
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
|
|
49
|
+
- **`Select` (searchable) fires its synthetic `change` event with callback
|
|
50
|
+
refs.** Like Modal/Drawer before 0.8.2, it used a forwarded ref directly
|
|
51
|
+
as the hidden native select's ref, so passing a callback ref silently
|
|
52
|
+
skipped the synthetic `change` dispatch on selection — `onChange` (and
|
|
53
|
+
anything listening to the native event, e.g. form libraries) never fired,
|
|
54
|
+
while `onValueChange` kept working. The forwarded ref is now merged with
|
|
55
|
+
an internal one in both the searchable and `multiple` variants.
|
|
56
|
+
|
|
57
|
+
## [0.8.2]
|
|
58
|
+
|
|
59
|
+
Brings the 0.8.1 `Modal` fixes to `Drawer`. No API changes.
|
|
60
|
+
|
|
61
|
+
### Fixed
|
|
62
|
+
|
|
63
|
+
- **`Drawer` no longer closes when a text-selection drag ends on the
|
|
64
|
+
backdrop**, and its **focus trap works with callback refs** — the same
|
|
65
|
+
two fixes `Modal` received in 0.8.1 (see below for the details); Drawer
|
|
66
|
+
had identical backdrop-click and forwarded-ref handling.
|
|
67
|
+
|
|
68
|
+
## [0.8.1]
|
|
69
|
+
|
|
70
|
+
Modal fixes and tooling updates. No API changes.
|
|
71
|
+
|
|
72
|
+
### Fixed
|
|
73
|
+
|
|
74
|
+
- **`Modal` no longer closes when a text-selection drag ends on the
|
|
75
|
+
backdrop.** It closed on backdrop `click`, but a click's target is the
|
|
76
|
+
common ancestor of where the press started and ended — so selecting text
|
|
77
|
+
inside the dialog and releasing over the backdrop counted as a backdrop
|
|
78
|
+
click. It now closes on `mouseup` only when the press both started and
|
|
79
|
+
ended on the backdrop itself; this also means a press that starts on the
|
|
80
|
+
backdrop and is released inside the dialog no longer closes it.
|
|
81
|
+
- **`Modal` focus trap works with callback refs.** It used the forwarded
|
|
82
|
+
ref directly as the focus-trap ref when one was provided, so passing a
|
|
83
|
+
callback ref silently disabled the trap (and initial focus). The
|
|
84
|
+
forwarded ref is now merged with an internal one, matching the other
|
|
85
|
+
ref-forwarding components.
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
|
|
89
|
+
- Internal tooling updates (nx 22.7.7, vite). No consumer-facing changes.
|
|
90
|
+
|
|
7
91
|
## [0.8.0]
|
|
8
92
|
|
|
9
93
|
Bundle-size release: the package now tree-shakes properly. No API changes.
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { createPortal as
|
|
4
|
-
import
|
|
5
|
-
import { useFocusTrap as
|
|
6
|
-
import { useKeyboard as
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
const { classes:
|
|
10
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsx as d, jsxs as K } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as q, useRef as x, useId as G, useState as u, useEffect as w, useMemo as J, createContext as Q, useContext as h } from "react";
|
|
3
|
+
import { createPortal as V } from "react-dom";
|
|
4
|
+
import l from "clsx";
|
|
5
|
+
import { useFocusTrap as X } from "../../hooks/useFocusTrap.js";
|
|
6
|
+
import { useKeyboard as Y } from "../../hooks/useKeyboard.js";
|
|
7
|
+
import t from "./Drawer.module.scss.js";
|
|
8
|
+
const m = Q({ classes: {}, titleId: "" }), M = ({ children: e, className: a, style: s, onClose: o }) => {
|
|
9
|
+
const { classes: i, titleId: y } = h(m);
|
|
10
|
+
return /* @__PURE__ */ K(
|
|
11
11
|
"div",
|
|
12
12
|
{
|
|
13
|
-
id:
|
|
14
|
-
className:
|
|
15
|
-
style:
|
|
13
|
+
id: y,
|
|
14
|
+
className: l(t.header, o && t.headerWithClose, i.header, a),
|
|
15
|
+
style: s,
|
|
16
16
|
children: [
|
|
17
17
|
e,
|
|
18
|
-
|
|
18
|
+
o && /* @__PURE__ */ d(
|
|
19
19
|
"button",
|
|
20
20
|
{
|
|
21
21
|
type: "button",
|
|
22
|
-
className:
|
|
23
|
-
onClick:
|
|
22
|
+
className: l(t.closeButton, i.closeButton),
|
|
23
|
+
onClick: o,
|
|
24
24
|
"aria-label": "Close",
|
|
25
25
|
children: "×"
|
|
26
26
|
}
|
|
@@ -29,86 +29,91 @@ const u = J({ classes: {}, titleId: "" }), D = ({ children: e, className: o, sty
|
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
const R = ({ children: e, className:
|
|
34
|
-
const { classes:
|
|
35
|
-
return /* @__PURE__ */
|
|
32
|
+
M.displayName = "Drawer.Header";
|
|
33
|
+
const R = ({ children: e, className: a, style: s }) => {
|
|
34
|
+
const { classes: o } = h(m);
|
|
35
|
+
return /* @__PURE__ */ d("div", { className: l(t.body, o.body, a), style: s, children: e });
|
|
36
36
|
};
|
|
37
37
|
R.displayName = "Drawer.Body";
|
|
38
|
-
const
|
|
39
|
-
const { classes:
|
|
40
|
-
return /* @__PURE__ */
|
|
38
|
+
const _ = ({ children: e, className: a, style: s }) => {
|
|
39
|
+
const { classes: o } = h(m);
|
|
40
|
+
return /* @__PURE__ */ d("div", { className: l(t.footer, o.footer, a), style: s, children: e });
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
const
|
|
42
|
+
_.displayName = "Drawer.Footer";
|
|
43
|
+
const Z = 340, f = q(
|
|
44
44
|
({
|
|
45
45
|
open: e,
|
|
46
|
-
onClose:
|
|
47
|
-
side:
|
|
48
|
-
size:
|
|
49
|
-
variant:
|
|
50
|
-
closeOnBackdrop:
|
|
51
|
-
closeOnEscape:
|
|
52
|
-
classes:
|
|
53
|
-
className:
|
|
54
|
-
style:
|
|
55
|
-
children:
|
|
56
|
-
"aria-label":
|
|
57
|
-
"aria-labelledby":
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
46
|
+
onClose: a,
|
|
47
|
+
side: s = "right",
|
|
48
|
+
size: o = "md",
|
|
49
|
+
variant: i = "temporary",
|
|
50
|
+
closeOnBackdrop: y = !0,
|
|
51
|
+
closeOnEscape: N = !0,
|
|
52
|
+
classes: p,
|
|
53
|
+
className: $,
|
|
54
|
+
style: A,
|
|
55
|
+
children: C,
|
|
56
|
+
"aria-label": k,
|
|
57
|
+
"aria-labelledby": F
|
|
58
|
+
}, n) => {
|
|
59
|
+
const B = x(null), H = (r) => {
|
|
60
|
+
B.current = r, typeof n == "function" ? n(r) : n && (n.current = r);
|
|
61
|
+
}, O = G(), g = F ?? `${O}-title`, b = i === "temporary", [c, D] = u(e), [I, S] = u(!1), [T, j] = u(s), [E, P] = u(o);
|
|
62
|
+
w(() => {
|
|
63
|
+
e && (D(!0), S(!1), j(s), P(o));
|
|
64
|
+
}, [e, s, o]), w(() => {
|
|
65
|
+
if (e || !c) return;
|
|
66
|
+
S(!0);
|
|
67
|
+
const r = setTimeout(() => D(!1), Z);
|
|
68
|
+
return () => clearTimeout(r);
|
|
69
|
+
}, [e, c]), X(B, c && e && b);
|
|
70
|
+
const U = J(
|
|
71
|
+
() => ({ Escape: () => N && a() }),
|
|
72
|
+
[N, a]
|
|
71
73
|
);
|
|
72
|
-
|
|
73
|
-
if (!
|
|
74
|
-
const
|
|
74
|
+
Y(U, e), w(() => {
|
|
75
|
+
if (!c) return;
|
|
76
|
+
const r = document.body.style.overflow;
|
|
75
77
|
return document.body.style.overflow = "hidden", () => {
|
|
76
|
-
document.body.style.overflow =
|
|
78
|
+
document.body.style.overflow = r;
|
|
77
79
|
};
|
|
78
|
-
}, [
|
|
79
|
-
const
|
|
80
|
-
|
|
80
|
+
}, [c]);
|
|
81
|
+
const v = x(!1), W = (r) => {
|
|
82
|
+
v.current = r.target === r.currentTarget;
|
|
83
|
+
}, z = (r) => {
|
|
84
|
+
y && v.current && r.target === r.currentTarget && a(), v.current = !1;
|
|
81
85
|
};
|
|
82
|
-
return
|
|
83
|
-
/* @__PURE__ */
|
|
86
|
+
return c ? V(
|
|
87
|
+
/* @__PURE__ */ d(
|
|
84
88
|
"div",
|
|
85
89
|
{
|
|
86
|
-
className:
|
|
87
|
-
|
|
88
|
-
I &&
|
|
89
|
-
!b &&
|
|
90
|
-
|
|
90
|
+
className: l(
|
|
91
|
+
t.backdrop,
|
|
92
|
+
I && t.backdropClosing,
|
|
93
|
+
!b && t.backdropBare,
|
|
94
|
+
p?.backdrop
|
|
91
95
|
),
|
|
92
|
-
|
|
96
|
+
onMouseDown: W,
|
|
97
|
+
onMouseUp: z,
|
|
93
98
|
role: "presentation",
|
|
94
|
-
children: /* @__PURE__ */
|
|
99
|
+
children: /* @__PURE__ */ d(
|
|
95
100
|
"div",
|
|
96
101
|
{
|
|
97
|
-
ref:
|
|
98
|
-
className:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
ref: H,
|
|
103
|
+
className: l(
|
|
104
|
+
t.drawer,
|
|
105
|
+
t[`side_${T}`],
|
|
106
|
+
t[`size_${E}`],
|
|
107
|
+
t[`${I ? "slideOut" : "slideIn"}_${T}`],
|
|
108
|
+
p?.drawer,
|
|
109
|
+
$
|
|
105
110
|
),
|
|
106
|
-
style:
|
|
111
|
+
style: A,
|
|
107
112
|
role: "dialog",
|
|
108
113
|
"aria-modal": b ? "true" : void 0,
|
|
109
|
-
"aria-label":
|
|
110
|
-
"aria-labelledby":
|
|
111
|
-
children: /* @__PURE__ */
|
|
114
|
+
"aria-label": k,
|
|
115
|
+
"aria-labelledby": k ? void 0 : g,
|
|
116
|
+
children: /* @__PURE__ */ d(m.Provider, { value: { classes: p ?? {}, titleId: g }, children: C })
|
|
112
117
|
}
|
|
113
118
|
)
|
|
114
119
|
}
|
|
@@ -117,10 +122,10 @@ const X = 340, m = z(
|
|
|
117
122
|
) : null;
|
|
118
123
|
}
|
|
119
124
|
);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
125
|
+
f.displayName = "Drawer";
|
|
126
|
+
f.Header = M;
|
|
127
|
+
f.Body = R;
|
|
128
|
+
f.Footer = _;
|
|
124
129
|
export {
|
|
125
|
-
|
|
130
|
+
f as Drawer
|
|
126
131
|
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { TimelineSummaryPlacement } from './TimelineShared';
|
|
3
|
+
import { DraggablePosition } from '../Draggable';
|
|
4
|
+
/** One task row. A task with no `end` is running and keeps growing. */
|
|
5
|
+
export interface GanttTimelineTask {
|
|
6
|
+
/** Stable identifier (selection, completion). */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Task name shown in the sticky label column. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Longer description shown in the tooltip and detail panel. */
|
|
11
|
+
detail?: string;
|
|
12
|
+
/** Owner shown in the tooltip and detail panel. */
|
|
13
|
+
owner?: string;
|
|
14
|
+
/** Start time, epoch ms. */
|
|
15
|
+
start: number;
|
|
16
|
+
/** End time, epoch ms. `null`/`undefined` while the task is still running. */
|
|
17
|
+
end?: number | null;
|
|
18
|
+
/** Extra fields are allowed and participate in keyword matching. */
|
|
19
|
+
[extra: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface GanttTimelineClasses {
|
|
22
|
+
root: string;
|
|
23
|
+
toolbar: string;
|
|
24
|
+
card: string;
|
|
25
|
+
scroller: string;
|
|
26
|
+
axis: string;
|
|
27
|
+
row: string;
|
|
28
|
+
rowLabel: string;
|
|
29
|
+
bar: string;
|
|
30
|
+
summary: string;
|
|
31
|
+
search: string;
|
|
32
|
+
drawer: string;
|
|
33
|
+
tooltip: string;
|
|
34
|
+
footnote: string;
|
|
35
|
+
}
|
|
36
|
+
/** Context handed to the GanttTimeline render-prop slots. */
|
|
37
|
+
export interface GanttTimelineItemContext {
|
|
38
|
+
/** Row index after sorting by start time. */
|
|
39
|
+
index: number;
|
|
40
|
+
/** Resolved row color. */
|
|
41
|
+
color: string;
|
|
42
|
+
/** True while the task has no `end`. */
|
|
43
|
+
running: boolean;
|
|
44
|
+
/** Duration so far, ms. */
|
|
45
|
+
durationMs: number;
|
|
46
|
+
}
|
|
47
|
+
export interface GanttTimelineProps {
|
|
48
|
+
/**
|
|
49
|
+
* Tasks to render, one row each, sorted by start time. Provide the already
|
|
50
|
+
* filtered/pre-processed list — the component applies no filtering. Push
|
|
51
|
+
* updated arrays to animate a live feed; a task whose `end` is unset renders
|
|
52
|
+
* as running (dashed, pulsing) and grows until an update supplies its `end`.
|
|
53
|
+
*/
|
|
54
|
+
tasks: GanttTimelineTask[];
|
|
55
|
+
/** Title shown in the toolbar above the chart. */
|
|
56
|
+
title?: ReactNode;
|
|
57
|
+
/** Meta text next to the title. Defaults to `N tasks · span · K running`. */
|
|
58
|
+
meta?: ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* Controlled keyword highlight: case-insensitive AND over
|
|
61
|
+
* whitespace-separated tokens, matched against each task's JSON. Matching
|
|
62
|
+
* rows get highlighted bars and marked substrings; non-matching rows dim.
|
|
63
|
+
* When set, the built-in search box reflects it — pair with
|
|
64
|
+
* `onHighlightChange` (or use `defaultHighlight` for uncontrolled).
|
|
65
|
+
*/
|
|
66
|
+
highlight?: string;
|
|
67
|
+
/** Initial keyword for the built-in search box (uncontrolled). */
|
|
68
|
+
defaultHighlight?: string;
|
|
69
|
+
/** Fired when the keyword changes via the built-in box or `renderSearch`. */
|
|
70
|
+
onHighlightChange?: (value: string) => void;
|
|
71
|
+
/** Built-in "Highlight keyword…" box in the toolbar. @default true */
|
|
72
|
+
showSearch?: boolean;
|
|
73
|
+
/** Replace the built-in search box with a custom element in the toolbar. */
|
|
74
|
+
renderSearch?: (api: {
|
|
75
|
+
value: string;
|
|
76
|
+
setValue: (value: string) => void;
|
|
77
|
+
}) => ReactNode;
|
|
78
|
+
/** Tighter 42px rows instead of 54px. @default false */
|
|
79
|
+
compactRows?: boolean;
|
|
80
|
+
/** Vertical gridlines under each axis tick. @default true */
|
|
81
|
+
showGridlines?: boolean;
|
|
82
|
+
/** Toolbar row with the zoom −/%/+/Fit controls. @default true */
|
|
83
|
+
showControls?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Dense one-line-per-task summary panel beside the chart: all tasks
|
|
86
|
+
* numbered chronologically from `01`, a highlight band over the tasks
|
|
87
|
+
* currently visible in the viewport (auto-follows drag-panning), and
|
|
88
|
+
* click-to-navigate — the chart smooth-scrolls (~1s, decelerating) to
|
|
89
|
+
* center the picked task. The panel scrolls independently.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
showSummary?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Where the summary panel sits: docked `'left'`/`'right'` of the chart,
|
|
95
|
+
* full-width `'top'`/`'bottom'`, or `'floating'` — a draggable palette over
|
|
96
|
+
* the chart, grabbed by its header. @default 'left'
|
|
97
|
+
*/
|
|
98
|
+
summaryPlacement?: TimelineSummaryPlacement;
|
|
99
|
+
/** Floating summary: initial offset from the component's top-left corner. */
|
|
100
|
+
summaryDefaultPosition?: DraggablePosition;
|
|
101
|
+
/** Max height of the scrollable chart area. @default '74vh' */
|
|
102
|
+
maxHeight?: number | string;
|
|
103
|
+
/** Controlled id of the task open in the detail panel (`null` = closed). */
|
|
104
|
+
selectedTaskId?: string | null;
|
|
105
|
+
/** Initially open task (uncontrolled). */
|
|
106
|
+
defaultSelectedTaskId?: string | null;
|
|
107
|
+
/** Fired when a task is opened (task) or closed (`null`). */
|
|
108
|
+
onTaskSelect?: (task: GanttTimelineTask | null) => void;
|
|
109
|
+
/** Replace the sticky label-column content (default: name + date range). */
|
|
110
|
+
renderRowLabel?: (task: GanttTimelineTask, ctx: GanttTimelineItemContext) => ReactNode;
|
|
111
|
+
/** Replace the content inside the bar pill (default: pulse dot + duration text; also suppresses the outside duration text). Geometry stays component-owned. */
|
|
112
|
+
renderBar?: (task: GanttTimelineTask, ctx: GanttTimelineItemContext) => ReactNode;
|
|
113
|
+
/** Replace the tooltip content. Return `null` to suppress the tooltip for that task. */
|
|
114
|
+
renderTooltip?: (task: GanttTimelineTask, ctx: GanttTimelineItemContext) => ReactNode;
|
|
115
|
+
/** Replace the detail side panel content; the sticky panel shell is kept. */
|
|
116
|
+
renderDetails?: (task: GanttTimelineTask, api: {
|
|
117
|
+
close: () => void;
|
|
118
|
+
running: boolean;
|
|
119
|
+
}) => ReactNode;
|
|
120
|
+
/** Override class names on internal elements. */
|
|
121
|
+
classes?: Partial<GanttTimelineClasses>;
|
|
122
|
+
className?: string;
|
|
123
|
+
style?: CSSProperties;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Gantt-style task timeline: rows stacked by start time, horizontal bars
|
|
127
|
+
* proportional to duration, a sticky label column and time axis. Running
|
|
128
|
+
* tasks (no `end`) grow live with a pulsing dashed bar and a "now" line.
|
|
129
|
+
* Wheel-zoom (cursor-anchored), drag-to-pan, fit-to-width, keyword
|
|
130
|
+
* highlighting, hover tooltips, and a click-to-open detail side panel.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```tsx
|
|
134
|
+
* <GanttTimeline
|
|
135
|
+
* title="Platform Relaunch — Q3"
|
|
136
|
+
* tasks={[
|
|
137
|
+
* { id: 't1', name: 'Kickoff', owner: 'P. Marsh', start: t0, end: t0 + 2 * DAY },
|
|
138
|
+
* { id: 't2', name: 'Pilot rollout', owner: 'QA', start: t0 + 5 * DAY }, // running
|
|
139
|
+
* ]}
|
|
140
|
+
* highlight={keyword}
|
|
141
|
+
* />
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
export declare const GanttTimeline: import('react').ForwardRefExoticComponent<GanttTimelineProps & import('react').RefAttributes<HTMLDivElement>>;
|