@szum-tech/design-system 3.8.1 → 3.10.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/dist/chunk-2WQJ36RD.cjs +78 -0
- package/dist/{chunk-O3DHBQA5.cjs → chunk-3GNVQFCK.cjs} +1 -1
- package/dist/{chunk-SYKUS2RV.js → chunk-3MH6P44N.js} +2 -2
- package/dist/{chunk-3BLXG7ET.js → chunk-3RK5PCIC.js} +1 -1
- package/dist/{chunk-2Q2BIWBE.js → chunk-5MV54MWS.js} +1 -1
- package/dist/{chunk-YWG7TML6.cjs → chunk-6X26XC6P.cjs} +1 -1
- package/dist/chunk-A7SBXO2Y.cjs +40 -0
- package/dist/{chunk-ACJ3ES2B.js → chunk-BTSHACKG.js} +1 -1
- package/dist/{chunk-3DUJHGXE.cjs → chunk-CFJ44JVK.cjs} +1 -1
- package/dist/chunk-D4QID7AI.cjs +607 -0
- package/dist/chunk-DGWBE2Y3.cjs +205 -0
- package/dist/{chunk-Q5ONG5HB.cjs → chunk-DTYX7CYN.cjs} +2 -2
- package/dist/{chunk-3Z3GVXXN.cjs → chunk-EG374TED.cjs} +57 -89
- package/dist/chunk-EUH466AL.cjs +179 -0
- package/dist/chunk-F7N6WQV6.cjs +53 -0
- package/dist/chunk-GYXQUTWZ.cjs +59 -0
- package/dist/chunk-IWF52DDE.js +55 -0
- package/dist/{chunk-SZ3LC2VO.js → chunk-JLKQ6WKK.js} +53 -85
- package/dist/chunk-K5AURCK5.js +183 -0
- package/dist/{chunk-XV3AQ6NS.js → chunk-KGGCA634.js} +1 -1
- package/dist/chunk-OCOCENE6.js +42 -0
- package/dist/chunk-R65CJGEQ.js +48 -0
- package/dist/chunk-TKZOB6C3.cjs +70 -0
- package/dist/{chunk-FKCWRNWB.js → chunk-U3QKV7I4.js} +1 -1
- package/dist/chunk-U7XZJQ4O.js +36 -0
- package/dist/{chunk-X55H6LRX.cjs → chunk-ULEEQ723.cjs} +1 -1
- package/dist/{chunk-BAWVLSRF.cjs → chunk-VK5EX3OG.cjs} +1 -1
- package/dist/{chunk-UW6GOD7J.js → chunk-VT5GDGZJ.js} +1 -1
- package/dist/chunk-WMGJCB7O.js +157 -0
- package/dist/chunk-YEFLGE3L.cjs +47 -0
- package/dist/chunk-YQ6J6VOI.js +48 -0
- package/dist/chunk-YSYZKK24.js +575 -0
- package/dist/chunk-YUMKV5TH.js +56 -0
- package/dist/{chunk-Z6CZAPVG.cjs → chunk-ZVF7J4EI.cjs} +1 -1
- package/dist/components/accordion/index.cjs +23 -0
- package/dist/components/accordion/index.d.cts +17 -0
- package/dist/components/accordion/index.d.ts +17 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/alert/index.cjs +4 -4
- package/dist/components/alert/index.js +1 -1
- package/dist/components/badge/index.cjs +4 -4
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/index.cjs +23 -16
- package/dist/components/button/index.js +22 -15
- package/dist/components/color-swatch/index.cjs +2 -2
- package/dist/components/color-swatch/index.js +1 -1
- package/dist/components/counting-number/index.cjs +11 -0
- package/dist/components/counting-number/index.d.cts +18 -0
- package/dist/components/counting-number/index.d.ts +18 -0
- package/dist/components/counting-number/index.js +2 -0
- package/dist/components/dialog/index.cjs +9 -9
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/field/index.cjs +11 -11
- package/dist/components/field/index.js +1 -1
- package/dist/components/header/index.cjs +2 -2
- package/dist/components/header/index.js +1 -1
- package/dist/components/index.cjs +251 -144
- package/dist/components/index.d.cts +12 -3
- package/dist/components/index.d.ts +12 -3
- package/dist/components/index.js +22 -15
- package/dist/components/item/index.cjs +11 -11
- package/dist/components/item/index.js +1 -1
- package/dist/components/marquee/index.cjs +11 -0
- package/dist/components/marquee/index.d.cts +48 -0
- package/dist/components/marquee/index.d.ts +48 -0
- package/dist/components/marquee/index.js +2 -0
- package/dist/components/status/index.cjs +19 -0
- package/dist/components/status/index.d.cts +25 -0
- package/dist/components/status/index.d.ts +25 -0
- package/dist/components/status/index.js +2 -0
- package/dist/components/stepper/index.cjs +41 -34
- package/dist/components/stepper/index.d.cts +5 -4
- package/dist/components/stepper/index.d.ts +5 -4
- package/dist/components/stepper/index.js +22 -15
- package/dist/components/tabs/index.cjs +23 -0
- package/dist/components/tabs/index.d.cts +17 -0
- package/dist/components/tabs/index.d.ts +17 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/timeline/index.cjs +44 -0
- package/dist/components/timeline/index.d.cts +62 -0
- package/dist/components/timeline/index.d.ts +62 -0
- package/dist/components/timeline/index.js +3 -0
- package/dist/components/toaster/index.cjs +24 -17
- package/dist/components/toaster/index.js +22 -15
- package/dist/components/tooltip/index.cjs +9 -4
- package/dist/components/tooltip/index.d.cts +8 -12
- package/dist/components/tooltip/index.d.ts +8 -12
- package/dist/components/tooltip/index.js +2 -1
- package/dist/components/typing-text/index.cjs +11 -0
- package/dist/components/typing-text/index.d.cts +40 -0
- package/dist/components/typing-text/index.d.ts +40 -0
- package/dist/components/typing-text/index.js +2 -0
- package/dist/components/word-rotate/index.cjs +11 -0
- package/dist/components/word-rotate/index.d.cts +29 -0
- package/dist/components/word-rotate/index.d.ts +29 -0
- package/dist/components/word-rotate/index.js +2 -0
- package/dist/direction-CUOPDLCj.d.cts +7 -0
- package/dist/direction-CUOPDLCj.d.ts +7 -0
- package/package.json +37 -49
- package/tailwind/animation.css +23 -1
- package/tailwind/global.css +5 -0
- package/tailwind/palette.css +2 -2
- package/dist/chunk-EW6TE3N5.cjs +0 -38
- package/dist/chunk-GR37JJQK.cjs +0 -43
- package/dist/chunk-H5O5L6XT.js +0 -14
- package/dist/chunk-HJJPEVIH.js +0 -40
- package/dist/contexts/index.cjs +0 -18
- package/dist/contexts/index.d.cts +0 -11
- package/dist/contexts/index.d.ts +0 -11
- package/dist/contexts/index.js +0 -1
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk7EYMOUWG_cjs = require('./chunk-7EYMOUWG.cjs');
|
|
4
|
+
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
5
|
+
var React2 = require('react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
8
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
29
|
+
|
|
30
|
+
var DirectionContext = React2__namespace.createContext(void 0);
|
|
31
|
+
function useDirection(localDir) {
|
|
32
|
+
const globalDir = React2__namespace.useContext(DirectionContext);
|
|
33
|
+
return localDir || globalDir || "ltr";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/components/timeline/timeline.constants.ts
|
|
37
|
+
var TIMELINE_ROOT_NAME = "Timeline";
|
|
38
|
+
var TIMELINE_ITEM_NAME = "TimelineItem";
|
|
39
|
+
var TIMELINE_CONTENT_NAME = "TimelineContent";
|
|
40
|
+
var TIMELINE_CONNECTOR_NAME = "TimelineConnector";
|
|
41
|
+
var TIMELINE_DOT_NAME = "TimelineDot";
|
|
42
|
+
|
|
43
|
+
// src/components/timeline/timeline.store.tsx
|
|
44
|
+
var TimelineStoreContext = React2__namespace.createContext(null);
|
|
45
|
+
function useTimelineStore(selector) {
|
|
46
|
+
const store = React2__namespace.useContext(TimelineStoreContext);
|
|
47
|
+
if (!store) {
|
|
48
|
+
throw new Error(`\`useTimelineStore\` must be used within \`${TIMELINE_ROOT_NAME}\``);
|
|
49
|
+
}
|
|
50
|
+
const getSnapshot = React2__namespace.useCallback(() => selector(store), [store, selector]);
|
|
51
|
+
return React2__namespace.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
52
|
+
}
|
|
53
|
+
function useTimelineStoreContext(consumerName) {
|
|
54
|
+
const context = React2__namespace.useContext(TimelineStoreContext);
|
|
55
|
+
if (!context) {
|
|
56
|
+
throw new Error(`\`${consumerName}\` must be used within \`${TIMELINE_ROOT_NAME}\``);
|
|
57
|
+
}
|
|
58
|
+
return context;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/components/timeline/timeline.utils.ts
|
|
62
|
+
function getItemStatus(itemIndex, activeIndex) {
|
|
63
|
+
if (activeIndex === void 0) return "pending";
|
|
64
|
+
if (itemIndex < activeIndex) return "completed";
|
|
65
|
+
if (itemIndex === activeIndex) return "active";
|
|
66
|
+
return "pending";
|
|
67
|
+
}
|
|
68
|
+
function getSortedEntries(entries) {
|
|
69
|
+
return entries.sort((a, b) => {
|
|
70
|
+
const elementA = a[1].current;
|
|
71
|
+
const elementB = b[1].current;
|
|
72
|
+
if (!elementA || !elementB) return 0;
|
|
73
|
+
const position = elementA.compareDocumentPosition(elementB);
|
|
74
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
|
|
75
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
|
|
76
|
+
return 0;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
var TimelineContext = React2__namespace.createContext(null);
|
|
80
|
+
function useTimelineContext(consumerName) {
|
|
81
|
+
const context = React2__namespace.useContext(TimelineContext);
|
|
82
|
+
if (!context) {
|
|
83
|
+
throw new Error(`\`${consumerName}\` must be used within \`${TIMELINE_ROOT_NAME}\``);
|
|
84
|
+
}
|
|
85
|
+
return context;
|
|
86
|
+
}
|
|
87
|
+
var timelineVariants = classVarianceAuthority.cva(
|
|
88
|
+
"relative flex [--timeline-connector-thickness:0.125rem] [--timeline-dot-size:0.875rem]",
|
|
89
|
+
{
|
|
90
|
+
variants: {
|
|
91
|
+
orientation: {
|
|
92
|
+
vertical: "flex-col",
|
|
93
|
+
horizontal: "flex-row items-start"
|
|
94
|
+
},
|
|
95
|
+
variant: {
|
|
96
|
+
default: "",
|
|
97
|
+
alternate: ""
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
compoundVariants: [
|
|
101
|
+
{
|
|
102
|
+
orientation: "vertical",
|
|
103
|
+
variant: "default",
|
|
104
|
+
class: "gap-6"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
orientation: "horizontal",
|
|
108
|
+
variant: "default",
|
|
109
|
+
class: "gap-8"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
orientation: "vertical",
|
|
113
|
+
variant: "alternate",
|
|
114
|
+
class: "relative w-full gap-3"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
orientation: "horizontal",
|
|
118
|
+
variant: "alternate",
|
|
119
|
+
class: "items-center gap-4"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
defaultVariants: {
|
|
123
|
+
orientation: "vertical",
|
|
124
|
+
variant: "default"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
var timelineItemVariants = classVarianceAuthority.cva("relative flex", {
|
|
129
|
+
variants: {
|
|
130
|
+
orientation: {
|
|
131
|
+
vertical: "",
|
|
132
|
+
horizontal: ""
|
|
133
|
+
},
|
|
134
|
+
variant: {
|
|
135
|
+
default: "",
|
|
136
|
+
alternate: ""
|
|
137
|
+
},
|
|
138
|
+
isAlternateRight: {
|
|
139
|
+
true: "",
|
|
140
|
+
false: ""
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
compoundVariants: [
|
|
144
|
+
{
|
|
145
|
+
orientation: "vertical",
|
|
146
|
+
variant: "default",
|
|
147
|
+
class: "gap-3 pb-8 last:pb-0"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
orientation: "horizontal",
|
|
151
|
+
variant: "default",
|
|
152
|
+
class: "flex-col gap-3"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
orientation: "vertical",
|
|
156
|
+
variant: "alternate",
|
|
157
|
+
isAlternateRight: false,
|
|
158
|
+
class: "w-1/2 gap-3 pr-6 pb-12 last:pb-0"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
orientation: "vertical",
|
|
162
|
+
variant: "alternate",
|
|
163
|
+
isAlternateRight: true,
|
|
164
|
+
class: "ml-auto w-1/2 flex-row-reverse gap-3 pb-12 pl-6 last:pb-0"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
orientation: "horizontal",
|
|
168
|
+
variant: "alternate",
|
|
169
|
+
class: "grid min-w-0 grid-rows-[1fr_auto_1fr] gap-3"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
defaultVariants: {
|
|
173
|
+
orientation: "vertical",
|
|
174
|
+
variant: "default",
|
|
175
|
+
isAlternateRight: false
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
var timelineContentVariants = classVarianceAuthority.cva("flex-1", {
|
|
179
|
+
variants: {
|
|
180
|
+
orientation: {
|
|
181
|
+
vertical: "",
|
|
182
|
+
horizontal: ""
|
|
183
|
+
},
|
|
184
|
+
variant: {
|
|
185
|
+
default: "",
|
|
186
|
+
alternate: ""
|
|
187
|
+
},
|
|
188
|
+
isAlternateRight: {
|
|
189
|
+
true: "",
|
|
190
|
+
false: ""
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
compoundVariants: [
|
|
194
|
+
{
|
|
195
|
+
variant: "alternate",
|
|
196
|
+
orientation: "vertical",
|
|
197
|
+
isAlternateRight: false,
|
|
198
|
+
class: "text-right"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
variant: "alternate",
|
|
202
|
+
orientation: "horizontal",
|
|
203
|
+
isAlternateRight: false,
|
|
204
|
+
class: "row-start-3 pt-2"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
variant: "alternate",
|
|
208
|
+
orientation: "horizontal",
|
|
209
|
+
isAlternateRight: true,
|
|
210
|
+
class: "row-start-1 pb-2"
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
defaultVariants: {
|
|
214
|
+
orientation: "vertical",
|
|
215
|
+
variant: "default",
|
|
216
|
+
isAlternateRight: false
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
var timelineDotVariants = classVarianceAuthority.cva(
|
|
220
|
+
"relative z-10 flex size-(--timeline-dot-size) shrink-0 items-center justify-center rounded-full border-2 bg-background",
|
|
221
|
+
{
|
|
222
|
+
variants: {
|
|
223
|
+
status: {
|
|
224
|
+
completed: "border-primary",
|
|
225
|
+
active: "border-primary",
|
|
226
|
+
pending: "border-border"
|
|
227
|
+
},
|
|
228
|
+
orientation: {
|
|
229
|
+
vertical: "",
|
|
230
|
+
horizontal: ""
|
|
231
|
+
},
|
|
232
|
+
variant: {
|
|
233
|
+
default: "",
|
|
234
|
+
alternate: ""
|
|
235
|
+
},
|
|
236
|
+
isAlternateRight: {
|
|
237
|
+
true: "",
|
|
238
|
+
false: ""
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
compoundVariants: [
|
|
242
|
+
{
|
|
243
|
+
variant: "alternate",
|
|
244
|
+
orientation: "vertical",
|
|
245
|
+
isAlternateRight: false,
|
|
246
|
+
class: "absolute -right-[calc(var(--timeline-dot-size)/2-var(--timeline-connector-thickness)/2)] bg-background"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
variant: "alternate",
|
|
250
|
+
orientation: "vertical",
|
|
251
|
+
isAlternateRight: true,
|
|
252
|
+
class: "absolute -left-[calc(var(--timeline-dot-size)/2-var(--timeline-connector-thickness)/2)] bg-background"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
variant: "alternate",
|
|
256
|
+
orientation: "horizontal",
|
|
257
|
+
class: "row-start-2 bg-background"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
variant: "alternate",
|
|
261
|
+
status: "completed",
|
|
262
|
+
class: "bg-background"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
variant: "alternate",
|
|
266
|
+
status: "active",
|
|
267
|
+
class: "bg-background"
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
defaultVariants: {
|
|
271
|
+
status: "pending",
|
|
272
|
+
orientation: "vertical",
|
|
273
|
+
variant: "default",
|
|
274
|
+
isAlternateRight: false
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
var timelineConnectorVariants = classVarianceAuthority.cva("absolute z-0", {
|
|
279
|
+
variants: {
|
|
280
|
+
isCompleted: {
|
|
281
|
+
true: "bg-primary",
|
|
282
|
+
false: "bg-border"
|
|
283
|
+
},
|
|
284
|
+
orientation: {
|
|
285
|
+
vertical: "",
|
|
286
|
+
horizontal: ""
|
|
287
|
+
},
|
|
288
|
+
variant: {
|
|
289
|
+
default: "",
|
|
290
|
+
alternate: ""
|
|
291
|
+
},
|
|
292
|
+
isAlternateRight: {
|
|
293
|
+
true: "",
|
|
294
|
+
false: ""
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
compoundVariants: [
|
|
298
|
+
{
|
|
299
|
+
orientation: "vertical",
|
|
300
|
+
variant: "default",
|
|
301
|
+
class: "start-[calc(var(--timeline-dot-size)/2-var(--timeline-connector-thickness)/2)] top-3 h-[calc(100%+0.5rem)] w-(--timeline-connector-thickness)"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
orientation: "horizontal",
|
|
305
|
+
variant: "default",
|
|
306
|
+
class: "start-3 top-[calc(var(--timeline-dot-size)/2-var(--timeline-connector-thickness)/2)] h-(--timeline-connector-thickness) w-[calc(100%+0.5rem)]"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
orientation: "vertical",
|
|
310
|
+
variant: "alternate",
|
|
311
|
+
isAlternateRight: false,
|
|
312
|
+
class: "top-2 -right-[calc(var(--timeline-connector-thickness)/2)] h-full w-(--timeline-connector-thickness)"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
orientation: "vertical",
|
|
316
|
+
variant: "alternate",
|
|
317
|
+
isAlternateRight: true,
|
|
318
|
+
class: "top-2 -left-[calc(var(--timeline-connector-thickness)/2)] h-full w-(--timeline-connector-thickness)"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
orientation: "horizontal",
|
|
322
|
+
variant: "alternate",
|
|
323
|
+
class: "top-[calc(var(--timeline-dot-size)/2-var(--timeline-connector-thickness)/2)] left-3 row-start-2 h-(--timeline-connector-thickness) w-[calc(100%+0.5rem)]"
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
defaultVariants: {
|
|
327
|
+
isCompleted: false,
|
|
328
|
+
orientation: "vertical",
|
|
329
|
+
variant: "default",
|
|
330
|
+
isAlternateRight: false
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
function Timeline({
|
|
334
|
+
orientation = "vertical",
|
|
335
|
+
variant = "default",
|
|
336
|
+
dir: dirProp,
|
|
337
|
+
activeIndex,
|
|
338
|
+
asChild = false,
|
|
339
|
+
className,
|
|
340
|
+
...props
|
|
341
|
+
}) {
|
|
342
|
+
const dir = useDirection(dirProp);
|
|
343
|
+
const listenersRef = chunk7EYMOUWG_cjs.useLazyRef(() => /* @__PURE__ */ new Set());
|
|
344
|
+
const stateRef = chunk7EYMOUWG_cjs.useLazyRef(() => ({
|
|
345
|
+
items: /* @__PURE__ */ new Map()
|
|
346
|
+
}));
|
|
347
|
+
const store = React2__namespace.useMemo(() => {
|
|
348
|
+
return {
|
|
349
|
+
subscribe: (cb) => {
|
|
350
|
+
listenersRef.current.add(cb);
|
|
351
|
+
return () => listenersRef.current.delete(cb);
|
|
352
|
+
},
|
|
353
|
+
getState: () => stateRef.current,
|
|
354
|
+
notify: () => {
|
|
355
|
+
for (const cb of listenersRef.current) {
|
|
356
|
+
cb();
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
onItemRegister: (id, ref) => {
|
|
360
|
+
stateRef.current.items.set(id, ref);
|
|
361
|
+
store.notify();
|
|
362
|
+
},
|
|
363
|
+
onItemUnregister: (id) => {
|
|
364
|
+
stateRef.current.items.delete(id);
|
|
365
|
+
store.notify();
|
|
366
|
+
},
|
|
367
|
+
getNextItemStatus: (id, activeIndex2) => {
|
|
368
|
+
const entries = Array.from(stateRef.current.items.entries());
|
|
369
|
+
const sortedEntries = getSortedEntries(entries);
|
|
370
|
+
const currentIndex = sortedEntries.findIndex(([key]) => key === id);
|
|
371
|
+
if (currentIndex === -1 || currentIndex === sortedEntries.length - 1) {
|
|
372
|
+
return void 0;
|
|
373
|
+
}
|
|
374
|
+
const nextItemIndex = currentIndex + 1;
|
|
375
|
+
return getItemStatus(nextItemIndex, activeIndex2);
|
|
376
|
+
},
|
|
377
|
+
getItemIndex: (id) => {
|
|
378
|
+
const entries = Array.from(stateRef.current.items.entries());
|
|
379
|
+
const sortedEntries = getSortedEntries(entries);
|
|
380
|
+
return sortedEntries.findIndex(([key]) => key === id);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}, [listenersRef, stateRef]);
|
|
384
|
+
const contextValue = React2__namespace.useMemo(
|
|
385
|
+
() => ({
|
|
386
|
+
dir,
|
|
387
|
+
orientation,
|
|
388
|
+
variant,
|
|
389
|
+
activeIndex
|
|
390
|
+
}),
|
|
391
|
+
[dir, orientation, variant, activeIndex]
|
|
392
|
+
);
|
|
393
|
+
const RootPrimitive = asChild ? reactSlot.Slot : "div";
|
|
394
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TimelineStoreContext.Provider, { value: store, children: /* @__PURE__ */ jsxRuntime.jsx(TimelineContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
395
|
+
RootPrimitive,
|
|
396
|
+
{
|
|
397
|
+
role: "list",
|
|
398
|
+
"aria-orientation": orientation,
|
|
399
|
+
"data-slot": "timeline",
|
|
400
|
+
"data-orientation": orientation,
|
|
401
|
+
"data-variant": variant,
|
|
402
|
+
dir,
|
|
403
|
+
...props,
|
|
404
|
+
className: chunkH2BWO3SI_cjs.cn(timelineVariants({ orientation, variant, className }))
|
|
405
|
+
}
|
|
406
|
+
) }) });
|
|
407
|
+
}
|
|
408
|
+
function setRef(ref, value) {
|
|
409
|
+
if (typeof ref === "function") {
|
|
410
|
+
return ref(value);
|
|
411
|
+
} else if (ref !== null && ref !== void 0) {
|
|
412
|
+
ref.current = value;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
function composeRefs(...refs) {
|
|
416
|
+
return (node) => {
|
|
417
|
+
let hasCleanup = false;
|
|
418
|
+
const cleanups = refs.map((ref) => {
|
|
419
|
+
const cleanup = setRef(ref, node);
|
|
420
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
421
|
+
hasCleanup = true;
|
|
422
|
+
}
|
|
423
|
+
return cleanup;
|
|
424
|
+
});
|
|
425
|
+
if (hasCleanup) {
|
|
426
|
+
return () => {
|
|
427
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
428
|
+
const cleanup = cleanups[i];
|
|
429
|
+
if (typeof cleanup == "function") {
|
|
430
|
+
cleanup();
|
|
431
|
+
} else {
|
|
432
|
+
setRef(refs[i], null);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function useComposedRefs(...refs) {
|
|
440
|
+
return React2__namespace.useCallback(composeRefs(...refs), refs);
|
|
441
|
+
}
|
|
442
|
+
var TimelineItemContext = React2__namespace.createContext(null);
|
|
443
|
+
function useTimelineItemContext(consumerName) {
|
|
444
|
+
const context = React2__namespace.useContext(TimelineItemContext);
|
|
445
|
+
if (!context) {
|
|
446
|
+
throw new Error(`\`${consumerName}\` must be used within \`${TIMELINE_ITEM_NAME}\``);
|
|
447
|
+
}
|
|
448
|
+
return context;
|
|
449
|
+
}
|
|
450
|
+
function TimelineItem({ asChild = false, className, id, ref, ...props }) {
|
|
451
|
+
const { dir, orientation, variant, activeIndex } = useTimelineContext(TIMELINE_ITEM_NAME);
|
|
452
|
+
const store = useTimelineStoreContext(TIMELINE_ITEM_NAME);
|
|
453
|
+
const instanceId = React2__namespace.useId();
|
|
454
|
+
const itemId = id ?? instanceId;
|
|
455
|
+
const itemRef = React2__namespace.useRef(null);
|
|
456
|
+
const composedRef = useComposedRefs(ref, itemRef);
|
|
457
|
+
const itemIndex = useTimelineStore((state) => state.getItemIndex(itemId));
|
|
458
|
+
const status = React2__namespace.useMemo(
|
|
459
|
+
function() {
|
|
460
|
+
return itemIndex < 0 ? "pending" : getItemStatus(itemIndex, activeIndex);
|
|
461
|
+
},
|
|
462
|
+
[activeIndex, itemIndex]
|
|
463
|
+
);
|
|
464
|
+
chunk7EYMOUWG_cjs.useIsomorphicLayoutEffect(() => {
|
|
465
|
+
store.onItemRegister(itemId, itemRef);
|
|
466
|
+
return () => {
|
|
467
|
+
store.onItemUnregister(itemId);
|
|
468
|
+
};
|
|
469
|
+
}, [id, store]);
|
|
470
|
+
const isAlternateRight = variant === "alternate" && itemIndex % 2 === 1;
|
|
471
|
+
const itemContextValue = React2__namespace.useMemo(
|
|
472
|
+
() => ({ id: itemId, status, isAlternateRight }),
|
|
473
|
+
[itemId, status, isAlternateRight]
|
|
474
|
+
);
|
|
475
|
+
const ItemPrimitive = asChild ? reactSlot.Slot : "div";
|
|
476
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TimelineItemContext.Provider, { value: itemContextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
477
|
+
ItemPrimitive,
|
|
478
|
+
{
|
|
479
|
+
role: "listitem",
|
|
480
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
481
|
+
"data-slot": "timeline-item",
|
|
482
|
+
"data-status": status,
|
|
483
|
+
"data-orientation": orientation,
|
|
484
|
+
"data-alternate-right": isAlternateRight ? "" : void 0,
|
|
485
|
+
id: itemId,
|
|
486
|
+
dir,
|
|
487
|
+
...props,
|
|
488
|
+
ref: composedRef,
|
|
489
|
+
className: chunkH2BWO3SI_cjs.cn(
|
|
490
|
+
timelineItemVariants({
|
|
491
|
+
orientation,
|
|
492
|
+
variant,
|
|
493
|
+
isAlternateRight,
|
|
494
|
+
className
|
|
495
|
+
})
|
|
496
|
+
)
|
|
497
|
+
}
|
|
498
|
+
) });
|
|
499
|
+
}
|
|
500
|
+
function TimelineContent({ asChild = false, className, ...props }) {
|
|
501
|
+
const { variant, orientation } = useTimelineContext(TIMELINE_CONTENT_NAME);
|
|
502
|
+
const { status, isAlternateRight } = useTimelineItemContext(TIMELINE_CONTENT_NAME);
|
|
503
|
+
const ContentPrimitive = asChild ? reactSlot.Slot : "div";
|
|
504
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
505
|
+
ContentPrimitive,
|
|
506
|
+
{
|
|
507
|
+
"data-slot": "timeline-content",
|
|
508
|
+
"data-status": status,
|
|
509
|
+
...props,
|
|
510
|
+
className: chunkH2BWO3SI_cjs.cn(
|
|
511
|
+
timelineContentVariants({
|
|
512
|
+
orientation,
|
|
513
|
+
variant,
|
|
514
|
+
isAlternateRight,
|
|
515
|
+
className
|
|
516
|
+
})
|
|
517
|
+
)
|
|
518
|
+
}
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
function TimelineDot({ asChild = false, className, ...props }) {
|
|
522
|
+
const { orientation, variant } = useTimelineContext(TIMELINE_DOT_NAME);
|
|
523
|
+
const { status, isAlternateRight } = useTimelineItemContext(TIMELINE_DOT_NAME);
|
|
524
|
+
const DotPrimitive = asChild ? reactSlot.Slot : "div";
|
|
525
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
526
|
+
DotPrimitive,
|
|
527
|
+
{
|
|
528
|
+
"data-slot": "timeline-dot",
|
|
529
|
+
"data-status": status,
|
|
530
|
+
"data-orientation": orientation,
|
|
531
|
+
...props,
|
|
532
|
+
className: chunkH2BWO3SI_cjs.cn(
|
|
533
|
+
timelineDotVariants({
|
|
534
|
+
status,
|
|
535
|
+
orientation,
|
|
536
|
+
variant,
|
|
537
|
+
isAlternateRight,
|
|
538
|
+
className
|
|
539
|
+
})
|
|
540
|
+
)
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function TimelineConnector({ asChild = false, forceMount, className, ...props }) {
|
|
545
|
+
const { orientation, variant, activeIndex } = useTimelineContext(TIMELINE_CONNECTOR_NAME);
|
|
546
|
+
const { id, status, isAlternateRight } = useTimelineItemContext(TIMELINE_CONNECTOR_NAME);
|
|
547
|
+
const nextItemStatus = useTimelineStore((state) => state.getNextItemStatus(id, activeIndex));
|
|
548
|
+
const isLastItem = nextItemStatus === void 0;
|
|
549
|
+
if (!forceMount && isLastItem) return null;
|
|
550
|
+
const isConnectorCompleted = nextItemStatus === "completed" || nextItemStatus === "active";
|
|
551
|
+
const ConnectorPrimitive = asChild ? reactSlot.Slot : "div";
|
|
552
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
553
|
+
ConnectorPrimitive,
|
|
554
|
+
{
|
|
555
|
+
"aria-hidden": "true",
|
|
556
|
+
"data-slot": "timeline-connector",
|
|
557
|
+
"data-completed": isConnectorCompleted ? "" : void 0,
|
|
558
|
+
"data-status": status,
|
|
559
|
+
"data-orientation": orientation,
|
|
560
|
+
...props,
|
|
561
|
+
className: chunkH2BWO3SI_cjs.cn(
|
|
562
|
+
timelineConnectorVariants({
|
|
563
|
+
isCompleted: isConnectorCompleted,
|
|
564
|
+
orientation,
|
|
565
|
+
variant,
|
|
566
|
+
isAlternateRight,
|
|
567
|
+
className
|
|
568
|
+
})
|
|
569
|
+
)
|
|
570
|
+
}
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
function TimelineHeader({ asChild, className, ...props }) {
|
|
574
|
+
const HeaderPrimitive = asChild ? reactSlot.Slot : "div";
|
|
575
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HeaderPrimitive, { "data-slot": "timeline-header", className: chunkH2BWO3SI_cjs.cn("flex flex-col gap-1", className), ...props });
|
|
576
|
+
}
|
|
577
|
+
function TimelineTitle({ asChild = false, className, ...props }) {
|
|
578
|
+
const TitlePrimitive = asChild ? reactSlot.Slot : "div";
|
|
579
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TitlePrimitive, { "data-slot": "timeline-title", className: chunkH2BWO3SI_cjs.cn("leading-none font-semibold", className), ...props });
|
|
580
|
+
}
|
|
581
|
+
function TimelineDescription({ asChild = false, className, ...props }) {
|
|
582
|
+
const DescriptionPrimitive = asChild ? reactSlot.Slot : "div";
|
|
583
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
584
|
+
DescriptionPrimitive,
|
|
585
|
+
{
|
|
586
|
+
"data-slot": "timeline-description",
|
|
587
|
+
...props,
|
|
588
|
+
className: chunkH2BWO3SI_cjs.cn("text-muted-foreground text-sm", className)
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
function TimelineTime({ asChild = false, className, ...props }) {
|
|
593
|
+
const TimePrimitive = asChild ? reactSlot.Slot : "time";
|
|
594
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TimePrimitive, { "data-slot": "timeline-time", className: chunkH2BWO3SI_cjs.cn("text-muted-foreground text-xs", className), ...props });
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
exports.Timeline = Timeline;
|
|
598
|
+
exports.TimelineConnector = TimelineConnector;
|
|
599
|
+
exports.TimelineContent = TimelineContent;
|
|
600
|
+
exports.TimelineDescription = TimelineDescription;
|
|
601
|
+
exports.TimelineDot = TimelineDot;
|
|
602
|
+
exports.TimelineHeader = TimelineHeader;
|
|
603
|
+
exports.TimelineItem = TimelineItem;
|
|
604
|
+
exports.TimelineTime = TimelineTime;
|
|
605
|
+
exports.TimelineTitle = TimelineTitle;
|
|
606
|
+
exports.useComposedRefs = useComposedRefs;
|
|
607
|
+
exports.useDirection = useDirection;
|