@object-ui/plugin-timeline 0.3.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 +21 -0
- package/README.md +80 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +785 -0
- package/dist/index.umd.cjs +7 -0
- package/dist/src/index.d.ts +34 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/renderer.d.ts +9 -0
- package/dist/src/renderer.d.ts.map +1 -0
- package/package.json +51 -0
- package/src/index.tsx +277 -0
- package/src/renderer.tsx +474 -0
- package/tsconfig.json +18 -0
- package/vite.config.ts +48 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
import * as v from "react";
|
|
2
|
+
import we from "react";
|
|
3
|
+
import { renderChildren as Q, cn as b } from "@object-ui/components";
|
|
4
|
+
import { ComponentRegistry as Re } from "@object-ui/core";
|
|
5
|
+
var S = { exports: {} }, j = {};
|
|
6
|
+
var X;
|
|
7
|
+
function ye() {
|
|
8
|
+
if (X) return j;
|
|
9
|
+
X = 1;
|
|
10
|
+
var t = /* @__PURE__ */ Symbol.for("react.transitional.element"), n = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
11
|
+
function r(f, l, o) {
|
|
12
|
+
var g = null;
|
|
13
|
+
if (o !== void 0 && (g = "" + o), l.key !== void 0 && (g = "" + l.key), "key" in l) {
|
|
14
|
+
o = {};
|
|
15
|
+
for (var s in l)
|
|
16
|
+
s !== "key" && (o[s] = l[s]);
|
|
17
|
+
} else o = l;
|
|
18
|
+
return l = o.ref, {
|
|
19
|
+
$$typeof: t,
|
|
20
|
+
type: f,
|
|
21
|
+
key: g,
|
|
22
|
+
ref: l !== void 0 ? l : null,
|
|
23
|
+
props: o
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return j.Fragment = n, j.jsx = r, j.jsxs = r, j;
|
|
27
|
+
}
|
|
28
|
+
var D = {};
|
|
29
|
+
var Z;
|
|
30
|
+
function je() {
|
|
31
|
+
return Z || (Z = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
32
|
+
function t(e) {
|
|
33
|
+
if (e == null) return null;
|
|
34
|
+
if (typeof e == "function")
|
|
35
|
+
return e.$$typeof === he ? null : e.displayName || e.name || null;
|
|
36
|
+
if (typeof e == "string") return e;
|
|
37
|
+
switch (e) {
|
|
38
|
+
case d:
|
|
39
|
+
return "Fragment";
|
|
40
|
+
case de:
|
|
41
|
+
return "Profiler";
|
|
42
|
+
case E:
|
|
43
|
+
return "StrictMode";
|
|
44
|
+
case pe:
|
|
45
|
+
return "Suspense";
|
|
46
|
+
case ve:
|
|
47
|
+
return "SuspenseList";
|
|
48
|
+
case xe:
|
|
49
|
+
return "Activity";
|
|
50
|
+
}
|
|
51
|
+
if (typeof e == "object")
|
|
52
|
+
switch (typeof e.tag == "number" && console.error(
|
|
53
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
54
|
+
), e.$$typeof) {
|
|
55
|
+
case h:
|
|
56
|
+
return "Portal";
|
|
57
|
+
case ue:
|
|
58
|
+
return e.displayName || "Context";
|
|
59
|
+
case me:
|
|
60
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
61
|
+
case fe:
|
|
62
|
+
var i = e.render;
|
|
63
|
+
return e = e.displayName, e || (e = i.displayName || i.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
64
|
+
case be:
|
|
65
|
+
return i = e.displayName || null, i !== null ? i : t(e.type) || "Memo";
|
|
66
|
+
case P:
|
|
67
|
+
i = e._payload, e = e._init;
|
|
68
|
+
try {
|
|
69
|
+
return t(e(i));
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
function n(e) {
|
|
76
|
+
return "" + e;
|
|
77
|
+
}
|
|
78
|
+
function r(e) {
|
|
79
|
+
try {
|
|
80
|
+
n(e);
|
|
81
|
+
var i = !1;
|
|
82
|
+
} catch {
|
|
83
|
+
i = !0;
|
|
84
|
+
}
|
|
85
|
+
if (i) {
|
|
86
|
+
i = console;
|
|
87
|
+
var c = i.error, m = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
88
|
+
return c.call(
|
|
89
|
+
i,
|
|
90
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
91
|
+
m
|
|
92
|
+
), n(e);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function f(e) {
|
|
96
|
+
if (e === d) return "<>";
|
|
97
|
+
if (typeof e == "object" && e !== null && e.$$typeof === P)
|
|
98
|
+
return "<...>";
|
|
99
|
+
try {
|
|
100
|
+
var i = t(e);
|
|
101
|
+
return i ? "<" + i + ">" : "<...>";
|
|
102
|
+
} catch {
|
|
103
|
+
return "<...>";
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function l() {
|
|
107
|
+
var e = A.A;
|
|
108
|
+
return e === null ? null : e.getOwner();
|
|
109
|
+
}
|
|
110
|
+
function o() {
|
|
111
|
+
return Error("react-stack-top-frame");
|
|
112
|
+
}
|
|
113
|
+
function g(e) {
|
|
114
|
+
if (V.call(e, "key")) {
|
|
115
|
+
var i = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
116
|
+
if (i && i.isReactWarning) return !1;
|
|
117
|
+
}
|
|
118
|
+
return e.key !== void 0;
|
|
119
|
+
}
|
|
120
|
+
function s(e, i) {
|
|
121
|
+
function c() {
|
|
122
|
+
W || (W = !0, console.error(
|
|
123
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
124
|
+
i
|
|
125
|
+
));
|
|
126
|
+
}
|
|
127
|
+
c.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
128
|
+
get: c,
|
|
129
|
+
configurable: !0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function T() {
|
|
133
|
+
var e = t(this.type);
|
|
134
|
+
return q[e] || (q[e] = !0, console.error(
|
|
135
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
136
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
137
|
+
}
|
|
138
|
+
function R(e, i, c, m, N, I) {
|
|
139
|
+
var u = c.ref;
|
|
140
|
+
return e = {
|
|
141
|
+
$$typeof: x,
|
|
142
|
+
type: e,
|
|
143
|
+
key: i,
|
|
144
|
+
props: c,
|
|
145
|
+
_owner: m
|
|
146
|
+
}, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
|
|
147
|
+
enumerable: !1,
|
|
148
|
+
get: T
|
|
149
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
150
|
+
configurable: !1,
|
|
151
|
+
enumerable: !1,
|
|
152
|
+
writable: !0,
|
|
153
|
+
value: 0
|
|
154
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
155
|
+
configurable: !1,
|
|
156
|
+
enumerable: !1,
|
|
157
|
+
writable: !0,
|
|
158
|
+
value: null
|
|
159
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
160
|
+
configurable: !1,
|
|
161
|
+
enumerable: !1,
|
|
162
|
+
writable: !0,
|
|
163
|
+
value: N
|
|
164
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
165
|
+
configurable: !1,
|
|
166
|
+
enumerable: !1,
|
|
167
|
+
writable: !0,
|
|
168
|
+
value: I
|
|
169
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
170
|
+
}
|
|
171
|
+
function w(e, i, c, m, N, I) {
|
|
172
|
+
var u = i.children;
|
|
173
|
+
if (u !== void 0)
|
|
174
|
+
if (m)
|
|
175
|
+
if (ge(u)) {
|
|
176
|
+
for (m = 0; m < u.length; m++)
|
|
177
|
+
O(u[m]);
|
|
178
|
+
Object.freeze && Object.freeze(u);
|
|
179
|
+
} else
|
|
180
|
+
console.error(
|
|
181
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
182
|
+
);
|
|
183
|
+
else O(u);
|
|
184
|
+
if (V.call(i, "key")) {
|
|
185
|
+
u = t(e);
|
|
186
|
+
var y = Object.keys(i).filter(function(Te) {
|
|
187
|
+
return Te !== "key";
|
|
188
|
+
});
|
|
189
|
+
m = 0 < y.length ? "{key: someKey, " + y.join(": ..., ") + ": ...}" : "{key: someKey}", J[u + m] || (y = 0 < y.length ? "{" + y.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
190
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
191
|
+
let props = %s;
|
|
192
|
+
<%s {...props} />
|
|
193
|
+
React keys must be passed directly to JSX without using spread:
|
|
194
|
+
let props = %s;
|
|
195
|
+
<%s key={someKey} {...props} />`,
|
|
196
|
+
m,
|
|
197
|
+
u,
|
|
198
|
+
y,
|
|
199
|
+
u
|
|
200
|
+
), J[u + m] = !0);
|
|
201
|
+
}
|
|
202
|
+
if (u = null, c !== void 0 && (r(c), u = "" + c), g(i) && (r(i.key), u = "" + i.key), "key" in i) {
|
|
203
|
+
c = {};
|
|
204
|
+
for (var M in i)
|
|
205
|
+
M !== "key" && (c[M] = i[M]);
|
|
206
|
+
} else c = i;
|
|
207
|
+
return u && s(
|
|
208
|
+
c,
|
|
209
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
210
|
+
), R(
|
|
211
|
+
e,
|
|
212
|
+
u,
|
|
213
|
+
c,
|
|
214
|
+
l(),
|
|
215
|
+
N,
|
|
216
|
+
I
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
function O(e) {
|
|
220
|
+
_(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === P && (e._payload.status === "fulfilled" ? _(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
221
|
+
}
|
|
222
|
+
function _(e) {
|
|
223
|
+
return typeof e == "object" && e !== null && e.$$typeof === x;
|
|
224
|
+
}
|
|
225
|
+
var p = we, x = /* @__PURE__ */ Symbol.for("react.transitional.element"), h = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), E = /* @__PURE__ */ Symbol.for("react.strict_mode"), de = /* @__PURE__ */ Symbol.for("react.profiler"), me = /* @__PURE__ */ Symbol.for("react.consumer"), ue = /* @__PURE__ */ Symbol.for("react.context"), fe = /* @__PURE__ */ Symbol.for("react.forward_ref"), pe = /* @__PURE__ */ Symbol.for("react.suspense"), ve = /* @__PURE__ */ Symbol.for("react.suspense_list"), be = /* @__PURE__ */ Symbol.for("react.memo"), P = /* @__PURE__ */ Symbol.for("react.lazy"), xe = /* @__PURE__ */ Symbol.for("react.activity"), he = /* @__PURE__ */ Symbol.for("react.client.reference"), A = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, ge = Array.isArray, C = console.createTask ? console.createTask : function() {
|
|
226
|
+
return null;
|
|
227
|
+
};
|
|
228
|
+
p = {
|
|
229
|
+
react_stack_bottom_frame: function(e) {
|
|
230
|
+
return e();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
var W, q = {}, H = p.react_stack_bottom_frame.bind(
|
|
234
|
+
p,
|
|
235
|
+
o
|
|
236
|
+
)(), B = C(f(o)), J = {};
|
|
237
|
+
D.Fragment = d, D.jsx = function(e, i, c) {
|
|
238
|
+
var m = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
239
|
+
return w(
|
|
240
|
+
e,
|
|
241
|
+
i,
|
|
242
|
+
c,
|
|
243
|
+
!1,
|
|
244
|
+
m ? Error("react-stack-top-frame") : H,
|
|
245
|
+
m ? C(f(e)) : B
|
|
246
|
+
);
|
|
247
|
+
}, D.jsxs = function(e, i, c) {
|
|
248
|
+
var m = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
249
|
+
return w(
|
|
250
|
+
e,
|
|
251
|
+
i,
|
|
252
|
+
c,
|
|
253
|
+
!0,
|
|
254
|
+
m ? Error("react-stack-top-frame") : H,
|
|
255
|
+
m ? C(f(e)) : B
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
})()), D;
|
|
259
|
+
}
|
|
260
|
+
var K;
|
|
261
|
+
function De() {
|
|
262
|
+
return K || (K = 1, process.env.NODE_ENV === "production" ? S.exports = ye() : S.exports = je()), S.exports;
|
|
263
|
+
}
|
|
264
|
+
var a = De();
|
|
265
|
+
const _e = 10080 * 60 * 1e3;
|
|
266
|
+
function Ee(t) {
|
|
267
|
+
const n = t.flatMap(
|
|
268
|
+
(l) => (l.items || []).flatMap((o) => [o.startDate, o.endDate])
|
|
269
|
+
), r = Math.min(...n.map((l) => new Date(l).getTime())), f = Math.max(...n.map((l) => new Date(l).getTime()));
|
|
270
|
+
return {
|
|
271
|
+
minDate: new Date(r).toISOString().split("T")[0],
|
|
272
|
+
maxDate: new Date(f).toISOString().split("T")[0]
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
function Ne(t, n, r, f) {
|
|
276
|
+
const l = new Date(t).getTime(), o = new Date(n).getTime(), g = new Date(r).getTime(), T = new Date(f).getTime() - g, R = l - g, w = o - l;
|
|
277
|
+
return {
|
|
278
|
+
start: R / T * 100,
|
|
279
|
+
width: w / T * 100
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function k(t, n) {
|
|
283
|
+
const r = new Date(t);
|
|
284
|
+
return n === "short" ? r.toLocaleDateString() : n === "long" ? r.toLocaleDateString("en-US", {
|
|
285
|
+
year: "numeric",
|
|
286
|
+
month: "long",
|
|
287
|
+
day: "numeric"
|
|
288
|
+
}) : r.toISOString().split("T")[0];
|
|
289
|
+
}
|
|
290
|
+
Re.register(
|
|
291
|
+
"timeline",
|
|
292
|
+
({ schema: t, className: n, ...r }) => {
|
|
293
|
+
const {
|
|
294
|
+
variant: f = "vertical",
|
|
295
|
+
items: l = [],
|
|
296
|
+
dateFormat: o = "short",
|
|
297
|
+
onItemClick: g
|
|
298
|
+
} = t;
|
|
299
|
+
if (f === "vertical")
|
|
300
|
+
return /* @__PURE__ */ a.jsx(ee, { className: n, ...r, children: l.map((s, T) => /* @__PURE__ */ a.jsxs(te, { className: s.className, children: [
|
|
301
|
+
/* @__PURE__ */ a.jsx(F, { variant: s.variant || "default", children: s.icon && /* @__PURE__ */ a.jsx("span", { className: "text-xs", children: s.icon }) }),
|
|
302
|
+
/* @__PURE__ */ a.jsxs(re, { children: [
|
|
303
|
+
s.time && /* @__PURE__ */ a.jsx(Y, { dateTime: s.time, children: k(s.time, o) }),
|
|
304
|
+
s.title && /* @__PURE__ */ a.jsx(G, { children: s.title }),
|
|
305
|
+
s.description && /* @__PURE__ */ a.jsx(L, { children: s.description }),
|
|
306
|
+
s.content && Q(s.content)
|
|
307
|
+
] })
|
|
308
|
+
] }, T)) });
|
|
309
|
+
if (f === "horizontal")
|
|
310
|
+
return /* @__PURE__ */ a.jsx(ae, { className: n, ...r, children: l.map((s, T) => /* @__PURE__ */ a.jsxs(ne, { className: s.className, children: [
|
|
311
|
+
/* @__PURE__ */ a.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
312
|
+
/* @__PURE__ */ a.jsx(F, { variant: s.variant || "default", children: s.icon && /* @__PURE__ */ a.jsx("span", { className: "text-xs", children: s.icon }) }),
|
|
313
|
+
/* @__PURE__ */ a.jsxs("div", { className: "mt-4 text-center", children: [
|
|
314
|
+
s.time && /* @__PURE__ */ a.jsx(Y, { dateTime: s.time, children: k(s.time, o) }),
|
|
315
|
+
s.title && /* @__PURE__ */ a.jsx(G, { children: s.title }),
|
|
316
|
+
s.description && /* @__PURE__ */ a.jsx(L, { className: "text-center", children: s.description }),
|
|
317
|
+
s.content && Q(s.content)
|
|
318
|
+
] })
|
|
319
|
+
] }),
|
|
320
|
+
T < l.length - 1 && /* @__PURE__ */ a.jsx("div", { className: "absolute left-full w-16 border-t-2 border-gray-200 top-3" })
|
|
321
|
+
] }, T)) });
|
|
322
|
+
if (f === "gantt") {
|
|
323
|
+
const s = Ee(l), T = t.minDate || s.minDate, R = t.maxDate || s.maxDate, w = t.timeScale || "month", _ = (() => {
|
|
324
|
+
const p = [], x = new Date(T), h = new Date(R);
|
|
325
|
+
if (w === "month") {
|
|
326
|
+
const d = new Date(x);
|
|
327
|
+
for (; d <= h; )
|
|
328
|
+
p.push(
|
|
329
|
+
d.toLocaleDateString("en-US", {
|
|
330
|
+
month: "short",
|
|
331
|
+
year: "numeric"
|
|
332
|
+
})
|
|
333
|
+
), d.setMonth(d.getMonth() + 1);
|
|
334
|
+
} else if (w === "week") {
|
|
335
|
+
const d = new Date(x);
|
|
336
|
+
for (; d <= h; )
|
|
337
|
+
p.push(
|
|
338
|
+
`Week ${Math.ceil(
|
|
339
|
+
(d.getTime() - x.getTime()) / _e
|
|
340
|
+
) + 1}`
|
|
341
|
+
), d.setDate(d.getDate() + 7);
|
|
342
|
+
} else if (w === "day") {
|
|
343
|
+
const d = new Date(x);
|
|
344
|
+
for (; d <= h; )
|
|
345
|
+
p.push(
|
|
346
|
+
d.toLocaleDateString("en-US", {
|
|
347
|
+
month: "short",
|
|
348
|
+
day: "numeric"
|
|
349
|
+
})
|
|
350
|
+
), d.setDate(d.getDate() + 1);
|
|
351
|
+
}
|
|
352
|
+
return p;
|
|
353
|
+
})();
|
|
354
|
+
return /* @__PURE__ */ a.jsxs(ie, { className: n, ...r, children: [
|
|
355
|
+
/* @__PURE__ */ a.jsxs(se, { children: [
|
|
356
|
+
/* @__PURE__ */ a.jsx($, { className: "flex items-center px-4 py-3", children: /* @__PURE__ */ a.jsx("span", { className: "font-semibold text-sm", children: t.rowLabel || "Items" }) }),
|
|
357
|
+
/* @__PURE__ */ a.jsx(z, { children: /* @__PURE__ */ a.jsx("div", { className: "flex h-full", children: _.map((p, x) => /* @__PURE__ */ a.jsx(
|
|
358
|
+
"div",
|
|
359
|
+
{
|
|
360
|
+
className: "flex-1 px-2 py-3 border-r text-xs font-medium text-center",
|
|
361
|
+
children: p
|
|
362
|
+
},
|
|
363
|
+
x
|
|
364
|
+
)) }) })
|
|
365
|
+
] }),
|
|
366
|
+
/* @__PURE__ */ a.jsx("div", { children: /* @__PURE__ */ a.jsxs("div", { className: "flex", children: [
|
|
367
|
+
/* @__PURE__ */ a.jsx($, { children: l.map((p, x) => /* @__PURE__ */ a.jsx(U, { children: /* @__PURE__ */ a.jsx(le, { title: p.label, children: p.label }) }, x)) }),
|
|
368
|
+
/* @__PURE__ */ a.jsx(z, { className: "relative", children: l.map((p, x) => /* @__PURE__ */ a.jsx(U, { className: "relative", children: (p.items || []).map((h, d) => {
|
|
369
|
+
const E = Ne(
|
|
370
|
+
h.startDate,
|
|
371
|
+
h.endDate,
|
|
372
|
+
T,
|
|
373
|
+
R
|
|
374
|
+
);
|
|
375
|
+
return /* @__PURE__ */ a.jsx(
|
|
376
|
+
oe,
|
|
377
|
+
{
|
|
378
|
+
start: E.start,
|
|
379
|
+
width: E.width,
|
|
380
|
+
variant: h.variant || "default",
|
|
381
|
+
onClick: () => g?.(h, p, x, d),
|
|
382
|
+
title: `${h.title || ""}
|
|
383
|
+
${k(h.startDate, o)} - ${k(h.endDate, o)}`,
|
|
384
|
+
children: /* @__PURE__ */ a.jsx(ce, { children: h.title })
|
|
385
|
+
},
|
|
386
|
+
d
|
|
387
|
+
);
|
|
388
|
+
}) }, x)) })
|
|
389
|
+
] }) })
|
|
390
|
+
] });
|
|
391
|
+
}
|
|
392
|
+
return null;
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
label: "Timeline",
|
|
396
|
+
category: "data-display",
|
|
397
|
+
inputs: [
|
|
398
|
+
{
|
|
399
|
+
name: "variant",
|
|
400
|
+
type: "enum",
|
|
401
|
+
enum: ["vertical", "horizontal", "gantt"],
|
|
402
|
+
label: "Timeline Variant",
|
|
403
|
+
defaultValue: "vertical"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
name: "items",
|
|
407
|
+
type: "array",
|
|
408
|
+
label: "Timeline Items",
|
|
409
|
+
description: "For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
name: "dateFormat",
|
|
413
|
+
type: "enum",
|
|
414
|
+
enum: ["short", "long", "iso"],
|
|
415
|
+
label: "Date Format",
|
|
416
|
+
defaultValue: "short"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
name: "timeScale",
|
|
420
|
+
type: "enum",
|
|
421
|
+
enum: ["day", "week", "month"],
|
|
422
|
+
label: "Time Scale (Gantt only)",
|
|
423
|
+
defaultValue: "month"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
name: "rowLabel",
|
|
427
|
+
type: "string",
|
|
428
|
+
label: "Row Label (Gantt only)",
|
|
429
|
+
defaultValue: "Items"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
name: "minDate",
|
|
433
|
+
type: "string",
|
|
434
|
+
label: "Min Date (Gantt only)",
|
|
435
|
+
description: "Override auto-calculated min date (YYYY-MM-DD)"
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: "maxDate",
|
|
439
|
+
type: "string",
|
|
440
|
+
label: "Max Date (Gantt only)",
|
|
441
|
+
description: "Override auto-calculated max date (YYYY-MM-DD)"
|
|
442
|
+
},
|
|
443
|
+
{ name: "className", type: "string", label: "CSS Class" }
|
|
444
|
+
],
|
|
445
|
+
defaultProps: {
|
|
446
|
+
variant: "vertical",
|
|
447
|
+
dateFormat: "short",
|
|
448
|
+
items: [
|
|
449
|
+
{
|
|
450
|
+
time: "2024-01-15",
|
|
451
|
+
title: "Project Started",
|
|
452
|
+
description: "Kickoff meeting and initial planning",
|
|
453
|
+
variant: "success",
|
|
454
|
+
icon: "🚀"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
time: "2024-02-01",
|
|
458
|
+
title: "First Milestone",
|
|
459
|
+
description: "Completed initial design phase",
|
|
460
|
+
variant: "info",
|
|
461
|
+
icon: "🎨"
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
time: "2024-03-15",
|
|
465
|
+
title: "Beta Release",
|
|
466
|
+
description: "Released beta version to testers",
|
|
467
|
+
variant: "warning",
|
|
468
|
+
icon: "⚡"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
time: "2024-04-01",
|
|
472
|
+
title: "Launch",
|
|
473
|
+
description: "Official product launch",
|
|
474
|
+
variant: "success",
|
|
475
|
+
icon: "🎉"
|
|
476
|
+
}
|
|
477
|
+
]
|
|
478
|
+
},
|
|
479
|
+
examples: {
|
|
480
|
+
vertical: {
|
|
481
|
+
variant: "vertical",
|
|
482
|
+
dateFormat: "long",
|
|
483
|
+
items: [
|
|
484
|
+
{
|
|
485
|
+
time: "2024-01-15",
|
|
486
|
+
title: "Project Started",
|
|
487
|
+
description: "Kickoff meeting and initial planning",
|
|
488
|
+
variant: "success"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
time: "2024-02-01",
|
|
492
|
+
title: "First Milestone",
|
|
493
|
+
description: "Completed initial design phase",
|
|
494
|
+
variant: "info"
|
|
495
|
+
}
|
|
496
|
+
]
|
|
497
|
+
},
|
|
498
|
+
horizontal: {
|
|
499
|
+
variant: "horizontal",
|
|
500
|
+
dateFormat: "short",
|
|
501
|
+
items: [
|
|
502
|
+
{
|
|
503
|
+
time: "2024-01-01",
|
|
504
|
+
title: "Q1",
|
|
505
|
+
description: "First quarter",
|
|
506
|
+
variant: "default"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
time: "2024-04-01",
|
|
510
|
+
title: "Q2",
|
|
511
|
+
description: "Second quarter",
|
|
512
|
+
variant: "info"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
time: "2024-07-01",
|
|
516
|
+
title: "Q3",
|
|
517
|
+
description: "Third quarter",
|
|
518
|
+
variant: "warning"
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
time: "2024-10-01",
|
|
522
|
+
title: "Q4",
|
|
523
|
+
description: "Fourth quarter",
|
|
524
|
+
variant: "success"
|
|
525
|
+
}
|
|
526
|
+
]
|
|
527
|
+
},
|
|
528
|
+
gantt: {
|
|
529
|
+
variant: "gantt",
|
|
530
|
+
dateFormat: "short",
|
|
531
|
+
timeScale: "month",
|
|
532
|
+
rowLabel: "Projects",
|
|
533
|
+
items: [
|
|
534
|
+
{
|
|
535
|
+
label: "Backend Development",
|
|
536
|
+
items: [
|
|
537
|
+
{
|
|
538
|
+
title: "API Design",
|
|
539
|
+
startDate: "2024-01-01",
|
|
540
|
+
endDate: "2024-01-31",
|
|
541
|
+
variant: "success"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
title: "Implementation",
|
|
545
|
+
startDate: "2024-02-01",
|
|
546
|
+
endDate: "2024-03-31",
|
|
547
|
+
variant: "info"
|
|
548
|
+
}
|
|
549
|
+
]
|
|
550
|
+
},
|
|
551
|
+
{
|
|
552
|
+
label: "Frontend Development",
|
|
553
|
+
items: [
|
|
554
|
+
{
|
|
555
|
+
title: "UI Design",
|
|
556
|
+
startDate: "2024-01-15",
|
|
557
|
+
endDate: "2024-02-15",
|
|
558
|
+
variant: "warning"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
title: "Component Dev",
|
|
562
|
+
startDate: "2024-02-15",
|
|
563
|
+
endDate: "2024-04-15",
|
|
564
|
+
variant: "default"
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
label: "Testing",
|
|
570
|
+
items: [
|
|
571
|
+
{
|
|
572
|
+
title: "QA Phase",
|
|
573
|
+
startDate: "2024-03-01",
|
|
574
|
+
endDate: "2024-04-30",
|
|
575
|
+
variant: "danger"
|
|
576
|
+
}
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
);
|
|
584
|
+
const ee = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
585
|
+
"ol",
|
|
586
|
+
{
|
|
587
|
+
ref: r,
|
|
588
|
+
className: b("relative border-l border-gray-200", t),
|
|
589
|
+
...n
|
|
590
|
+
}
|
|
591
|
+
));
|
|
592
|
+
ee.displayName = "Timeline";
|
|
593
|
+
const te = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
594
|
+
"li",
|
|
595
|
+
{
|
|
596
|
+
ref: r,
|
|
597
|
+
className: b("mb-10 ml-6", t),
|
|
598
|
+
...n
|
|
599
|
+
}
|
|
600
|
+
));
|
|
601
|
+
te.displayName = "TimelineItem";
|
|
602
|
+
const F = v.forwardRef(({ className: t, variant: n = "default", ...r }, f) => {
|
|
603
|
+
const l = {
|
|
604
|
+
default: "bg-gray-200 border-gray-300",
|
|
605
|
+
success: "bg-green-200 border-green-500",
|
|
606
|
+
warning: "bg-yellow-200 border-yellow-500",
|
|
607
|
+
danger: "bg-red-200 border-red-500",
|
|
608
|
+
info: "bg-blue-200 border-blue-500"
|
|
609
|
+
};
|
|
610
|
+
return /* @__PURE__ */ a.jsx(
|
|
611
|
+
"div",
|
|
612
|
+
{
|
|
613
|
+
ref: f,
|
|
614
|
+
className: b(
|
|
615
|
+
"absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center",
|
|
616
|
+
l[n],
|
|
617
|
+
t
|
|
618
|
+
),
|
|
619
|
+
...r
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
});
|
|
623
|
+
F.displayName = "TimelineMarker";
|
|
624
|
+
const re = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
625
|
+
"div",
|
|
626
|
+
{
|
|
627
|
+
ref: r,
|
|
628
|
+
className: t,
|
|
629
|
+
...n
|
|
630
|
+
}
|
|
631
|
+
));
|
|
632
|
+
re.displayName = "TimelineContent";
|
|
633
|
+
const G = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
634
|
+
"h3",
|
|
635
|
+
{
|
|
636
|
+
ref: r,
|
|
637
|
+
className: b("font-semibold text-lg mb-1", t),
|
|
638
|
+
...n
|
|
639
|
+
}
|
|
640
|
+
));
|
|
641
|
+
G.displayName = "TimelineTitle";
|
|
642
|
+
const Y = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
643
|
+
"time",
|
|
644
|
+
{
|
|
645
|
+
ref: r,
|
|
646
|
+
className: b("text-sm font-normal text-gray-500 mb-2 block", t),
|
|
647
|
+
...n
|
|
648
|
+
}
|
|
649
|
+
));
|
|
650
|
+
Y.displayName = "TimelineTime";
|
|
651
|
+
const L = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
652
|
+
"p",
|
|
653
|
+
{
|
|
654
|
+
ref: r,
|
|
655
|
+
className: b("text-base text-gray-700", t),
|
|
656
|
+
...n
|
|
657
|
+
}
|
|
658
|
+
));
|
|
659
|
+
L.displayName = "TimelineDescription";
|
|
660
|
+
const ae = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
661
|
+
"div",
|
|
662
|
+
{
|
|
663
|
+
ref: r,
|
|
664
|
+
className: b("relative flex overflow-x-auto py-8", t),
|
|
665
|
+
...n
|
|
666
|
+
}
|
|
667
|
+
));
|
|
668
|
+
ae.displayName = "TimelineHorizontal";
|
|
669
|
+
const ne = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
670
|
+
"div",
|
|
671
|
+
{
|
|
672
|
+
ref: r,
|
|
673
|
+
className: b("flex-shrink-0 w-64 relative", t),
|
|
674
|
+
...n
|
|
675
|
+
}
|
|
676
|
+
));
|
|
677
|
+
ne.displayName = "TimelineHorizontalItem";
|
|
678
|
+
const ie = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
679
|
+
"div",
|
|
680
|
+
{
|
|
681
|
+
ref: r,
|
|
682
|
+
className: b("relative w-full border rounded-lg overflow-hidden", t),
|
|
683
|
+
...n
|
|
684
|
+
}
|
|
685
|
+
));
|
|
686
|
+
ie.displayName = "TimelineGantt";
|
|
687
|
+
const se = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
688
|
+
"div",
|
|
689
|
+
{
|
|
690
|
+
ref: r,
|
|
691
|
+
className: b("flex border-b bg-gray-50", t),
|
|
692
|
+
...n
|
|
693
|
+
}
|
|
694
|
+
));
|
|
695
|
+
se.displayName = "TimelineGanttHeader";
|
|
696
|
+
const $ = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
697
|
+
"div",
|
|
698
|
+
{
|
|
699
|
+
ref: r,
|
|
700
|
+
className: b("w-48 border-r bg-white", t),
|
|
701
|
+
...n
|
|
702
|
+
}
|
|
703
|
+
));
|
|
704
|
+
$.displayName = "TimelineGanttRowLabels";
|
|
705
|
+
const z = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
706
|
+
"div",
|
|
707
|
+
{
|
|
708
|
+
ref: r,
|
|
709
|
+
className: b("flex-1 overflow-x-auto", t),
|
|
710
|
+
...n
|
|
711
|
+
}
|
|
712
|
+
));
|
|
713
|
+
z.displayName = "TimelineGanttGrid";
|
|
714
|
+
const U = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
715
|
+
"div",
|
|
716
|
+
{
|
|
717
|
+
ref: r,
|
|
718
|
+
className: b("flex items-center border-b min-h-12", t),
|
|
719
|
+
...n
|
|
720
|
+
}
|
|
721
|
+
));
|
|
722
|
+
U.displayName = "TimelineGanttRow";
|
|
723
|
+
const le = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
724
|
+
"div",
|
|
725
|
+
{
|
|
726
|
+
ref: r,
|
|
727
|
+
className: b("px-4 py-2 font-medium text-sm truncate", t),
|
|
728
|
+
...n
|
|
729
|
+
}
|
|
730
|
+
));
|
|
731
|
+
le.displayName = "TimelineGanttLabel";
|
|
732
|
+
const oe = v.forwardRef(({ className: t, start: n = 0, width: r = 100, variant: f = "default", ...l }, o) => {
|
|
733
|
+
const g = {
|
|
734
|
+
default: "bg-blue-500 hover:bg-blue-600",
|
|
735
|
+
success: "bg-green-500 hover:bg-green-600",
|
|
736
|
+
warning: "bg-yellow-500 hover:bg-yellow-600",
|
|
737
|
+
danger: "bg-red-500 hover:bg-red-600",
|
|
738
|
+
info: "bg-purple-500 hover:bg-purple-600"
|
|
739
|
+
};
|
|
740
|
+
return /* @__PURE__ */ a.jsx(
|
|
741
|
+
"div",
|
|
742
|
+
{
|
|
743
|
+
ref: o,
|
|
744
|
+
className: b(
|
|
745
|
+
"absolute h-8 rounded-md transition-colors cursor-pointer",
|
|
746
|
+
g[f],
|
|
747
|
+
t
|
|
748
|
+
),
|
|
749
|
+
style: {
|
|
750
|
+
left: `${n}%`,
|
|
751
|
+
width: `${r}%`
|
|
752
|
+
},
|
|
753
|
+
...l
|
|
754
|
+
}
|
|
755
|
+
);
|
|
756
|
+
});
|
|
757
|
+
oe.displayName = "TimelineGanttBar";
|
|
758
|
+
const ce = v.forwardRef(({ className: t, ...n }, r) => /* @__PURE__ */ a.jsx(
|
|
759
|
+
"div",
|
|
760
|
+
{
|
|
761
|
+
ref: r,
|
|
762
|
+
className: b("px-2 py-1 text-white text-xs font-medium truncate", t),
|
|
763
|
+
...n
|
|
764
|
+
}
|
|
765
|
+
));
|
|
766
|
+
ce.displayName = "TimelineGanttBarContent";
|
|
767
|
+
export {
|
|
768
|
+
ee as Timeline,
|
|
769
|
+
re as TimelineContent,
|
|
770
|
+
L as TimelineDescription,
|
|
771
|
+
ie as TimelineGantt,
|
|
772
|
+
oe as TimelineGanttBar,
|
|
773
|
+
ce as TimelineGanttBarContent,
|
|
774
|
+
z as TimelineGanttGrid,
|
|
775
|
+
se as TimelineGanttHeader,
|
|
776
|
+
le as TimelineGanttLabel,
|
|
777
|
+
U as TimelineGanttRow,
|
|
778
|
+
$ as TimelineGanttRowLabels,
|
|
779
|
+
ae as TimelineHorizontal,
|
|
780
|
+
ne as TimelineHorizontalItem,
|
|
781
|
+
te as TimelineItem,
|
|
782
|
+
F as TimelineMarker,
|
|
783
|
+
Y as TimelineTime,
|
|
784
|
+
G as TimelineTitle
|
|
785
|
+
};
|