@molecule/app-timeline-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +115 -0
- package/README.md +221 -0
- package/dist/Timeline.d.ts +20 -0
- package/dist/Timeline.d.ts.map +1 -0
- package/dist/Timeline.js +19 -0
- package/dist/TimelineDate.d.ts +14 -0
- package/dist/TimelineDate.d.ts.map +1 -0
- package/dist/TimelineDate.js +10 -0
- package/dist/TimelineEvent.d.ts +16 -0
- package/dist/TimelineEvent.d.ts.map +1 -0
- package/dist/TimelineEvent.js +11 -0
- package/dist/TimelineRail.d.ts +17 -0
- package/dist/TimelineRail.d.ts.map +1 -0
- package/dist/TimelineRail.js +11 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including the
|
|
45
|
+
original version of the Work and any modifications or additions
|
|
46
|
+
to that Work, that is intentionally submitted to the Licensor for
|
|
47
|
+
inclusion in the Work by the copyright owner or by an individual or
|
|
48
|
+
Legal Entity authorized to submit on behalf of the copyright owner.
|
|
49
|
+
|
|
50
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
52
|
+
subsequently incorporated within the Work.
|
|
53
|
+
|
|
54
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
55
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
56
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
57
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
58
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
59
|
+
Work and such Derivative Works in Source or Object form.
|
|
60
|
+
|
|
61
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
63
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
+
patent license to make, have made, use, offer to sell, sell, import,
|
|
65
|
+
and otherwise transfer the Work.
|
|
66
|
+
|
|
67
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
69
|
+
modifications, and in Source or Object form, provided that You
|
|
70
|
+
meet the following conditions:
|
|
71
|
+
|
|
72
|
+
(a) You must give any other recipients of the Work or
|
|
73
|
+
Derivative Works a copy of this License; and
|
|
74
|
+
|
|
75
|
+
(b) You must cause any modified files to carry prominent notices
|
|
76
|
+
stating that You changed the files; and
|
|
77
|
+
|
|
78
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
79
|
+
that You distribute, all copyright, patent, trademark, and
|
|
80
|
+
attribution notices from the Source form of the Work,
|
|
81
|
+
excluding those notices that do not pertain to any part of
|
|
82
|
+
the Derivative Works; and
|
|
83
|
+
|
|
84
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
|
+
distribution, then any Derivative Works that You distribute must
|
|
86
|
+
include a readable copy of the attribution notices contained
|
|
87
|
+
within such NOTICE file.
|
|
88
|
+
|
|
89
|
+
5. Submission of Contributions.
|
|
90
|
+
|
|
91
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
93
|
+
|
|
94
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
+
agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
|
|
96
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
|
|
97
|
+
|
|
98
|
+
8. Limitation of Liability. In no event and under no legal theory shall
|
|
99
|
+
any Contributor be liable to You for damages.
|
|
100
|
+
|
|
101
|
+
9. Accepting Warranty or Additional Liability.
|
|
102
|
+
|
|
103
|
+
Copyright 2026 Molecule Dev, Inc.
|
|
104
|
+
|
|
105
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
you may not use this file except in compliance with the License.
|
|
107
|
+
You may obtain a copy of the License at
|
|
108
|
+
|
|
109
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
|
|
111
|
+
Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
See the License for the specific language governing permissions and
|
|
115
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T00:41:25.308Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-timeline-react
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
React chronological timeline primitives.
|
|
16
|
+
|
|
17
|
+
Exports:
|
|
18
|
+
|
|
19
|
+
- `<Timeline>` — vertical list of events with optional date separators.
|
|
20
|
+
- `<TimelineEvent>` — one event row with rail (marker + connector) + content.
|
|
21
|
+
- `<TimelineRail>` — standalone rail (marker + connector) for custom rows.
|
|
22
|
+
- `<TimelineDate>` — date separator rendered between groups.
|
|
23
|
+
- `TimelineEventData` type for event records.
|
|
24
|
+
|
|
25
|
+
Use for activity chronologies, deal timelines, order tracking, audit logs.
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Timeline, TimelineDate } from '@molecule/app-timeline-react'
|
|
31
|
+
|
|
32
|
+
;<Timeline
|
|
33
|
+
events={[
|
|
34
|
+
{ id: '1', timestamp: '2 hours ago', title: 'Order placed' },
|
|
35
|
+
{ id: '2', timestamp: 'Yesterday', title: 'Payment confirmed', body: 'Visa ending 4242' },
|
|
36
|
+
{ id: '3', timestamp: 'Mar 12', title: 'Item shipped' },
|
|
37
|
+
]}
|
|
38
|
+
renderDateSeparator={(event, prev) =>
|
|
39
|
+
!prev ? <TimelineDate>{event.timestamp}</TimelineDate> : null
|
|
40
|
+
}
|
|
41
|
+
emptyState={<p>No activity yet.</p>}
|
|
42
|
+
/>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Type
|
|
46
|
+
|
|
47
|
+
`feature`
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install @molecule/app-timeline-react @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
|
|
53
|
+
npm install -D @types/react
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
### Interfaces
|
|
59
|
+
|
|
60
|
+
#### `TimelineDateProps`
|
|
61
|
+
|
|
62
|
+
Props for the {@link TimelineDate} component.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
interface TimelineDateProps {
|
|
66
|
+
/** Date label ("Today", "Yesterday", "March 12, 2025"). */
|
|
67
|
+
children: ReactNode
|
|
68
|
+
/** Extra classes. */
|
|
69
|
+
className?: string
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### `TimelineEventData`
|
|
74
|
+
|
|
75
|
+
Timeline event types.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
interface TimelineEventData {
|
|
79
|
+
id: string
|
|
80
|
+
/** Marker icon / dot — defaults to a small dot. */
|
|
81
|
+
marker?: ReactNode
|
|
82
|
+
/** Display timestamp (ISO, relative, etc.). */
|
|
83
|
+
timestamp: ReactNode
|
|
84
|
+
/** Headline of the event. */
|
|
85
|
+
title: ReactNode
|
|
86
|
+
/** Optional body content. */
|
|
87
|
+
body?: ReactNode
|
|
88
|
+
/**
|
|
89
|
+
* Optional accent color hint. Currently INERT — no component consumes it,
|
|
90
|
+
* so setting it changes nothing; pass a custom `marker` node to color a row.
|
|
91
|
+
*/
|
|
92
|
+
accent?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral'
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### `TimelineEventProps`
|
|
97
|
+
|
|
98
|
+
Props for the {@link TimelineEvent} component.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
interface TimelineEventProps {
|
|
102
|
+
event: TimelineEventData
|
|
103
|
+
/** Whether this is the last event in the list (suppresses the connector). */
|
|
104
|
+
isLast?: boolean
|
|
105
|
+
/** Extra classes. */
|
|
106
|
+
className?: string
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### `TimelineProps`
|
|
111
|
+
|
|
112
|
+
Props for the {@link Timeline} component.
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
interface TimelineProps {
|
|
116
|
+
events: TimelineEventData[]
|
|
117
|
+
/** Optional renderer for date separators between consecutive events. */
|
|
118
|
+
renderDateSeparator?: (event: TimelineEventData, prev?: TimelineEventData) => ReactNode
|
|
119
|
+
/** Rendered when there are no events. */
|
|
120
|
+
emptyState?: ReactNode
|
|
121
|
+
/** Extra classes on the outer wrapper. */
|
|
122
|
+
className?: string
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### `TimelineRailProps`
|
|
127
|
+
|
|
128
|
+
Props for the {@link TimelineRail} component.
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
interface TimelineRailProps {
|
|
132
|
+
/** Marker for this row — typically a dot or icon. */
|
|
133
|
+
marker?: ReactNode
|
|
134
|
+
/** Whether to render the vertical connector below the marker. */
|
|
135
|
+
connector?: boolean
|
|
136
|
+
/** Extra classes on the outer wrapper. */
|
|
137
|
+
className?: string
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Functions
|
|
142
|
+
|
|
143
|
+
#### `Timeline(props)`
|
|
144
|
+
|
|
145
|
+
Vertical chronological list of events. Each event renders with a
|
|
146
|
+
marker + connector on the left (`<TimelineEvent>`). Optional date
|
|
147
|
+
separators can be inserted by returning a node from `renderDateSeparator`.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
function Timeline({
|
|
151
|
+
events,
|
|
152
|
+
renderDateSeparator,
|
|
153
|
+
emptyState,
|
|
154
|
+
className,
|
|
155
|
+
}: TimelineProps): ReactElement<unknown, string | JSXElementConstructor<any>>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- `props` — Component props (see {@link TimelineProps}).
|
|
159
|
+
|
|
160
|
+
#### `TimelineDate(props)`
|
|
161
|
+
|
|
162
|
+
Date separator rendered between timeline groups.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
function TimelineDate({ children, className }: TimelineDateProps): JSX.Element
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- `props` — Component props (see {@link TimelineDateProps}).
|
|
169
|
+
|
|
170
|
+
#### `TimelineEvent(props)`
|
|
171
|
+
|
|
172
|
+
One row of a `<Timeline>`: [rail (marker + connector)] [timestamp / title / body].
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
function TimelineEvent({ event, isLast, className }: TimelineEventProps): JSX.Element
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
- `props` — Component props (see {@link TimelineEventProps}).
|
|
179
|
+
|
|
180
|
+
#### `TimelineRail(props)`
|
|
181
|
+
|
|
182
|
+
Left-hand rail of a timeline row — renders the marker and an optional
|
|
183
|
+
vertical connector extending downward.
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
function TimelineRail({ marker, connector = true, className }: TimelineRailProps): JSX.Element
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- `props` — Component props (see {@link TimelineRailProps}).
|
|
190
|
+
|
|
191
|
+
## Injection Notes
|
|
192
|
+
|
|
193
|
+
### Requirements
|
|
194
|
+
|
|
195
|
+
Peer dependencies:
|
|
196
|
+
|
|
197
|
+
- `@molecule/app-react` ^1.0.0
|
|
198
|
+
- `@molecule/app-ui` ^1.0.0
|
|
199
|
+
- `@molecule/app-ui-react` ^1.0.0
|
|
200
|
+
- `react` ^18.0.0 || ^19.0.0
|
|
201
|
+
|
|
202
|
+
### Runtime Dependencies
|
|
203
|
+
|
|
204
|
+
- `@molecule/app-react`
|
|
205
|
+
- `@molecule/app-ui`
|
|
206
|
+
- `@molecule/app-ui-react`
|
|
207
|
+
- `react`
|
|
208
|
+
|
|
209
|
+
This is NOT the React binding for `@molecule/app-timeline` (the headless
|
|
210
|
+
provider core wired via `setProvider`) — it is standalone presentational
|
|
211
|
+
markup with no provider. For domain-specific rows see the sibling
|
|
212
|
+
`@molecule/app-{activity,order,status,stage,day}-timeline-react` packages.
|
|
213
|
+
|
|
214
|
+
`TimelineEventData.accent` is currently INERT — no component reads it, so
|
|
215
|
+
setting it changes nothing; color a row by passing a custom `marker` node
|
|
216
|
+
instead. `timestamp` is a display node — format/translate it before
|
|
217
|
+
passing. The prop surface (documented on the exported `TimelineProps`,
|
|
218
|
+
`TimelineEventProps`, `TimelineRailProps` and `TimelineDateProps`
|
|
219
|
+
interfaces): Timeline(events, renderDateSeparator, emptyState, className),
|
|
220
|
+
TimelineEvent(event, isLast, className), TimelineRail(marker, connector,
|
|
221
|
+
className), TimelineDate(children, className).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { TimelineEventData } from './types.js';
|
|
3
|
+
/** Props for the {@link Timeline} component. */
|
|
4
|
+
export interface TimelineProps {
|
|
5
|
+
events: TimelineEventData[];
|
|
6
|
+
/** Optional renderer for date separators between consecutive events. */
|
|
7
|
+
renderDateSeparator?: (event: TimelineEventData, prev?: TimelineEventData) => ReactNode;
|
|
8
|
+
/** Rendered when there are no events. */
|
|
9
|
+
emptyState?: ReactNode;
|
|
10
|
+
/** Extra classes on the outer wrapper. */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Vertical chronological list of events. Each event renders with a
|
|
15
|
+
* marker + connector on the left (`<TimelineEvent>`). Optional date
|
|
16
|
+
* separators can be inserted by returning a node from `renderDateSeparator`.
|
|
17
|
+
* @param props - Component props (see {@link TimelineProps}).
|
|
18
|
+
*/
|
|
19
|
+
export declare function Timeline({ events, renderDateSeparator, emptyState, className, }: TimelineProps): ReactElement;
|
|
20
|
+
//# sourceMappingURL=Timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeline.d.ts","sourceRoot":"","sources":["../src/Timeline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,wEAAwE;IACxE,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,iBAAiB,KAAK,SAAS,CAAA;IACvF,yCAAyC;IACzC,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,mBAAmB,EACnB,UAAU,EACV,SAAS,GACV,EAAE,aAAa,GAAG,YAAY,CAiB9B"}
|
package/dist/Timeline.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
3
|
+
import { TimelineEvent } from './TimelineEvent.js';
|
|
4
|
+
/**
|
|
5
|
+
* Vertical chronological list of events. Each event renders with a
|
|
6
|
+
* marker + connector on the left (`<TimelineEvent>`). Optional date
|
|
7
|
+
* separators can be inserted by returning a node from `renderDateSeparator`.
|
|
8
|
+
* @param props - Component props (see {@link TimelineProps}).
|
|
9
|
+
*/
|
|
10
|
+
export function Timeline({ events, renderDateSeparator, emptyState, className, }) {
|
|
11
|
+
const cm = getClassMap();
|
|
12
|
+
if (events.length === 0 && emptyState)
|
|
13
|
+
return _jsx(_Fragment, { children: emptyState });
|
|
14
|
+
return (_jsx("div", { className: cm.cn(cm.stack(0), className), children: events.map((event, i) => {
|
|
15
|
+
const prev = i > 0 ? events[i - 1] : undefined;
|
|
16
|
+
const separator = renderDateSeparator?.(event, prev);
|
|
17
|
+
return (_jsxs("div", { children: [separator, _jsx(TimelineEvent, { event: event, isLast: i === events.length - 1 })] }, event.id));
|
|
18
|
+
}) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
/** Props for the {@link TimelineDate} component. */
|
|
3
|
+
export interface TimelineDateProps {
|
|
4
|
+
/** Date label ("Today", "Yesterday", "March 12, 2025"). */
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
/** Extra classes. */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Date separator rendered between timeline groups.
|
|
11
|
+
* @param props - Component props (see {@link TimelineDateProps}).
|
|
12
|
+
*/
|
|
13
|
+
export declare function TimelineDate({ children, className }: TimelineDateProps): JSX.Element;
|
|
14
|
+
//# sourceMappingURL=TimelineDate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineDate.d.ts","sourceRoot":"","sources":["../src/TimelineDate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,QAAQ,EAAE,SAAS,CAAA;IACnB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAepF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
3
|
+
/**
|
|
4
|
+
* Date separator rendered between timeline groups.
|
|
5
|
+
* @param props - Component props (see {@link TimelineDateProps}).
|
|
6
|
+
*/
|
|
7
|
+
export function TimelineDate({ children, className }) {
|
|
8
|
+
const cm = getClassMap();
|
|
9
|
+
return (_jsx("div", { className: cm.cn(cm.flex({ align: 'center', gap: 'sm' }), cm.sp('py', 2), cm.textSize('xs'), cm.fontWeight('semibold'), className), children: _jsx("span", { className: cm.flex1, children: children }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { TimelineEventData } from './types.js';
|
|
3
|
+
/** Props for the {@link TimelineEvent} component. */
|
|
4
|
+
export interface TimelineEventProps {
|
|
5
|
+
event: TimelineEventData;
|
|
6
|
+
/** Whether this is the last event in the list (suppresses the connector). */
|
|
7
|
+
isLast?: boolean;
|
|
8
|
+
/** Extra classes. */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One row of a `<Timeline>`: [rail (marker + connector)] [timestamp / title / body].
|
|
13
|
+
* @param props - Component props (see {@link TimelineEventProps}).
|
|
14
|
+
*/
|
|
15
|
+
export declare function TimelineEvent({ event, isLast, className }: TimelineEventProps): JSX.Element;
|
|
16
|
+
//# sourceMappingURL=TimelineEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineEvent.d.ts","sourceRoot":"","sources":["../src/TimelineEvent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAKhC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,iBAAiB,CAAA;IACxB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CAY3F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
3
|
+
import { TimelineRail } from './TimelineRail.js';
|
|
4
|
+
/**
|
|
5
|
+
* One row of a `<Timeline>`: [rail (marker + connector)] [timestamp / title / body].
|
|
6
|
+
* @param props - Component props (see {@link TimelineEventProps}).
|
|
7
|
+
*/
|
|
8
|
+
export function TimelineEvent({ event, isLast, className }) {
|
|
9
|
+
const cm = getClassMap();
|
|
10
|
+
return (_jsxs("div", { className: cm.cn(cm.flex({ align: 'stretch', gap: 'sm' }), className), children: [_jsx(TimelineRail, { marker: event.marker, connector: !isLast }), _jsxs("div", { className: cm.cn(cm.flex1, cm.stack(1), cm.sp('pb', 4)), children: [_jsx("div", { className: cm.cn(cm.textSize('xs'), cm.fontWeight('medium')), children: event.timestamp }), _jsx("div", { className: cm.cn(cm.textSize('sm'), cm.fontWeight('semibold')), children: event.title }), event.body && _jsx("div", { className: cm.textSize('sm'), children: event.body })] })] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSX, ReactNode } from 'react';
|
|
2
|
+
/** Props for the {@link TimelineRail} component. */
|
|
3
|
+
export interface TimelineRailProps {
|
|
4
|
+
/** Marker for this row — typically a dot or icon. */
|
|
5
|
+
marker?: ReactNode;
|
|
6
|
+
/** Whether to render the vertical connector below the marker. */
|
|
7
|
+
connector?: boolean;
|
|
8
|
+
/** Extra classes on the outer wrapper. */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Left-hand rail of a timeline row — renders the marker and an optional
|
|
13
|
+
* vertical connector extending downward.
|
|
14
|
+
* @param props - Component props (see {@link TimelineRailProps}).
|
|
15
|
+
*/
|
|
16
|
+
export declare function TimelineRail({ marker, connector, className, }: TimelineRailProps): JSX.Element;
|
|
17
|
+
//# sourceMappingURL=TimelineRail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineRail.d.ts","sourceRoot":"","sources":["../src/TimelineRail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAI3C,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,SAAgB,EAChB,SAAS,GACV,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAajC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
3
|
+
/**
|
|
4
|
+
* Left-hand rail of a timeline row — renders the marker and an optional
|
|
5
|
+
* vertical connector extending downward.
|
|
6
|
+
* @param props - Component props (see {@link TimelineRailProps}).
|
|
7
|
+
*/
|
|
8
|
+
export function TimelineRail({ marker, connector = true, className, }) {
|
|
9
|
+
const cm = getClassMap();
|
|
10
|
+
return (_jsxs("div", { className: cm.cn(cm.flex({ direction: 'col', align: 'center' }), cm.shrink0, className), children: [_jsx("div", { children: marker ?? _jsx("span", { "aria-hidden": true, children: "\u2022" }) }), connector && (_jsx("div", { className: cm.cn(cm.w(0), cm.h('full')), style: { borderLeft: '1px solid currentColor', opacity: 0.2, minHeight: 24 } }))] }));
|
|
11
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React chronological timeline primitives.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - `<Timeline>` — vertical list of events with optional date separators.
|
|
6
|
+
* - `<TimelineEvent>` — one event row with rail (marker + connector) + content.
|
|
7
|
+
* - `<TimelineRail>` — standalone rail (marker + connector) for custom rows.
|
|
8
|
+
* - `<TimelineDate>` — date separator rendered between groups.
|
|
9
|
+
* - `TimelineEventData` type for event records.
|
|
10
|
+
*
|
|
11
|
+
* Use for activity chronologies, deal timelines, order tracking, audit logs.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { Timeline, TimelineDate } from '@molecule/app-timeline-react'
|
|
16
|
+
*
|
|
17
|
+
* <Timeline
|
|
18
|
+
* events={[
|
|
19
|
+
* { id: '1', timestamp: '2 hours ago', title: 'Order placed' },
|
|
20
|
+
* { id: '2', timestamp: 'Yesterday', title: 'Payment confirmed', body: 'Visa ending 4242' },
|
|
21
|
+
* { id: '3', timestamp: 'Mar 12', title: 'Item shipped' },
|
|
22
|
+
* ]}
|
|
23
|
+
* renderDateSeparator={(event, prev) =>
|
|
24
|
+
* !prev ? <TimelineDate>{event.timestamp}</TimelineDate> : null
|
|
25
|
+
* }
|
|
26
|
+
* emptyState={<p>No activity yet.</p>}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* This is NOT the React binding for `@molecule/app-timeline` (the headless
|
|
32
|
+
* provider core wired via `setProvider`) — it is standalone presentational
|
|
33
|
+
* markup with no provider. For domain-specific rows see the sibling
|
|
34
|
+
* `@molecule/app-{activity,order,status,stage,day}-timeline-react` packages.
|
|
35
|
+
*
|
|
36
|
+
* `TimelineEventData.accent` is currently INERT — no component reads it, so
|
|
37
|
+
* setting it changes nothing; color a row by passing a custom `marker` node
|
|
38
|
+
* instead. `timestamp` is a display node — format/translate it before
|
|
39
|
+
* passing. The prop surface (documented on the exported `TimelineProps`,
|
|
40
|
+
* `TimelineEventProps`, `TimelineRailProps` and `TimelineDateProps`
|
|
41
|
+
* interfaces): Timeline(events, renderDateSeparator, emptyState, className),
|
|
42
|
+
* TimelineEvent(event, isLast, className), TimelineRail(marker, connector,
|
|
43
|
+
* className), TimelineDate(children, className).
|
|
44
|
+
*
|
|
45
|
+
* @module
|
|
46
|
+
*/
|
|
47
|
+
export * from './Timeline.js';
|
|
48
|
+
export * from './TimelineDate.js';
|
|
49
|
+
export * from './TimelineEvent.js';
|
|
50
|
+
export * from './TimelineRail.js';
|
|
51
|
+
export * from './types.js';
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React chronological timeline primitives.
|
|
3
|
+
*
|
|
4
|
+
* Exports:
|
|
5
|
+
* - `<Timeline>` — vertical list of events with optional date separators.
|
|
6
|
+
* - `<TimelineEvent>` — one event row with rail (marker + connector) + content.
|
|
7
|
+
* - `<TimelineRail>` — standalone rail (marker + connector) for custom rows.
|
|
8
|
+
* - `<TimelineDate>` — date separator rendered between groups.
|
|
9
|
+
* - `TimelineEventData` type for event records.
|
|
10
|
+
*
|
|
11
|
+
* Use for activity chronologies, deal timelines, order tracking, audit logs.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { Timeline, TimelineDate } from '@molecule/app-timeline-react'
|
|
16
|
+
*
|
|
17
|
+
* <Timeline
|
|
18
|
+
* events={[
|
|
19
|
+
* { id: '1', timestamp: '2 hours ago', title: 'Order placed' },
|
|
20
|
+
* { id: '2', timestamp: 'Yesterday', title: 'Payment confirmed', body: 'Visa ending 4242' },
|
|
21
|
+
* { id: '3', timestamp: 'Mar 12', title: 'Item shipped' },
|
|
22
|
+
* ]}
|
|
23
|
+
* renderDateSeparator={(event, prev) =>
|
|
24
|
+
* !prev ? <TimelineDate>{event.timestamp}</TimelineDate> : null
|
|
25
|
+
* }
|
|
26
|
+
* emptyState={<p>No activity yet.</p>}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* This is NOT the React binding for `@molecule/app-timeline` (the headless
|
|
32
|
+
* provider core wired via `setProvider`) — it is standalone presentational
|
|
33
|
+
* markup with no provider. For domain-specific rows see the sibling
|
|
34
|
+
* `@molecule/app-{activity,order,status,stage,day}-timeline-react` packages.
|
|
35
|
+
*
|
|
36
|
+
* `TimelineEventData.accent` is currently INERT — no component reads it, so
|
|
37
|
+
* setting it changes nothing; color a row by passing a custom `marker` node
|
|
38
|
+
* instead. `timestamp` is a display node — format/translate it before
|
|
39
|
+
* passing. The prop surface (documented on the exported `TimelineProps`,
|
|
40
|
+
* `TimelineEventProps`, `TimelineRailProps` and `TimelineDateProps`
|
|
41
|
+
* interfaces): Timeline(events, renderDateSeparator, emptyState, className),
|
|
42
|
+
* TimelineEvent(event, isLast, className), TimelineRail(marker, connector,
|
|
43
|
+
* className), TimelineDate(children, className).
|
|
44
|
+
*
|
|
45
|
+
* @module
|
|
46
|
+
*/
|
|
47
|
+
export * from './Timeline.js';
|
|
48
|
+
export * from './TimelineDate.js';
|
|
49
|
+
export * from './TimelineEvent.js';
|
|
50
|
+
export * from './TimelineRail.js';
|
|
51
|
+
export * from './types.js';
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Timeline event types.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
export interface TimelineEventData {
|
|
8
|
+
id: string;
|
|
9
|
+
/** Marker icon / dot — defaults to a small dot. */
|
|
10
|
+
marker?: ReactNode;
|
|
11
|
+
/** Display timestamp (ISO, relative, etc.). */
|
|
12
|
+
timestamp: ReactNode;
|
|
13
|
+
/** Headline of the event. */
|
|
14
|
+
title: ReactNode;
|
|
15
|
+
/** Optional body content. */
|
|
16
|
+
body?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Optional accent color hint. Currently INERT — no component consumes it,
|
|
19
|
+
* so setting it changes nothing; pass a custom `marker` node to color a row.
|
|
20
|
+
*/
|
|
21
|
+
accent?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral';
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,mDAAmD;IACnD,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,+CAA+C;IAC/C,SAAS,EAAE,SAAS,CAAA;IACpB,6BAA6B;IAC7B,KAAK,EAAE,SAAS,CAAA;IAChB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;CAC1E"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@molecule/app-timeline-react",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React chronological timeline with event rails and date markers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"molecule",
|
|
25
|
+
"timeline-ui",
|
|
26
|
+
"react"
|
|
27
|
+
],
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@molecule/app-react": "^1.0.0",
|
|
31
|
+
"@molecule/app-ui": "^1.0.0",
|
|
32
|
+
"@molecule/app-ui-react": "^1.0.0",
|
|
33
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@molecule/app-react": "1.0.0",
|
|
37
|
+
"@molecule/app-ui": "1.0.0",
|
|
38
|
+
"@molecule/app-ui-react": "1.0.0",
|
|
39
|
+
"@types/node": "26.1.2",
|
|
40
|
+
"@types/react": "19.2.17",
|
|
41
|
+
"@types/react-dom": "19.2.3",
|
|
42
|
+
"react": "19.2.8",
|
|
43
|
+
"react-dom": "19.2.8",
|
|
44
|
+
"typescript": "6.0.3",
|
|
45
|
+
"vitest": "4.1.10"
|
|
46
|
+
}
|
|
47
|
+
}
|