@catalystsoftware/ui 1.0.2 → 1.0.5
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/data/tailwind.config.js +261 -3821
- package/dist/components/catalyst-ui/buttons/burger.tsx +207 -0
- package/dist/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
- package/dist/components/catalyst-ui/core/feedback/alert.tsx +491 -0
- package/dist/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
- package/dist/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
- package/dist/components/catalyst-ui/core/navigation/menu.tsx +164 -0
- package/dist/components/catalyst-ui/forms/toggle-class.tsx +176 -0
- package/dist/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
- package/dist/components/catalyst-ui/hooks/use-counter.tsx +13 -0
- package/dist/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
- package/dist/components/catalyst-ui/hooks/use-focus.tsx +17 -0
- package/dist/components/catalyst-ui/hooks/use-interval.tsx +23 -0
- package/dist/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
- package/dist/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
- package/dist/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
- package/dist/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
- package/dist/components/catalyst-ui/hooks/use-timer.tsx +209 -0
- package/dist/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
- package/dist/components/catalyst-ui/media/image.tsx +13 -0
- package/dist/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
- package/dist/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
- package/dist/components/catalyst-ui/primitives/accordion.tsx +250 -0
- package/dist/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
- package/dist/components/catalyst-ui/primitives/avatar.tsx +296 -0
- package/dist/components/catalyst-ui/primitives/badge.tsx +57 -0
- package/dist/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
- package/dist/components/catalyst-ui/primitives/button.tsx +265 -0
- package/dist/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
- package/dist/components/catalyst-ui/primitives/calendar.tsx +295 -0
- package/dist/components/catalyst-ui/primitives/card.tsx +618 -0
- package/dist/components/catalyst-ui/primitives/carousel.tsx +238 -0
- package/dist/components/catalyst-ui/primitives/chart.tsx +347 -0
- package/dist/components/catalyst-ui/primitives/checkbox.tsx +225 -0
- package/dist/components/catalyst-ui/primitives/collapsible.tsx +212 -0
- package/dist/components/catalyst-ui/primitives/command.tsx +393 -0
- package/dist/components/catalyst-ui/primitives/context-menu.tsx +236 -0
- package/dist/components/catalyst-ui/primitives/dialog.tsx +471 -0
- package/dist/components/catalyst-ui/primitives/drawer.tsx +761 -0
- package/dist/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
- package/dist/components/catalyst-ui/primitives/empty.tsx +104 -0
- package/dist/components/catalyst-ui/primitives/field.tsx +244 -0
- package/dist/components/catalyst-ui/primitives/hover-card.tsx +124 -0
- package/dist/components/catalyst-ui/primitives/input-otp.tsx +76 -0
- package/dist/components/catalyst-ui/primitives/input.tsx +64 -0
- package/dist/components/catalyst-ui/primitives/item.tsx +196 -0
- package/dist/components/catalyst-ui/primitives/kbd.tsx +75 -0
- package/dist/components/catalyst-ui/primitives/label.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
- package/dist/components/catalyst-ui/primitives/pagination.tsx +198 -0
- package/dist/components/catalyst-ui/primitives/popover.tsx +232 -0
- package/dist/components/catalyst-ui/primitives/progress.tsx +34 -0
- package/dist/components/catalyst-ui/primitives/radio-group.tsx +43 -0
- package/dist/components/catalyst-ui/primitives/resizable.tsx +56 -0
- package/dist/components/catalyst-ui/primitives/select.tsx +155 -0
- package/dist/components/catalyst-ui/primitives/separator.tsx +74 -0
- package/dist/components/catalyst-ui/primitives/sheet.tsx +126 -0
- package/dist/components/catalyst-ui/primitives/skeleton.tsx +15 -0
- package/dist/components/catalyst-ui/primitives/slider.tsx +27 -0
- package/dist/components/catalyst-ui/primitives/switch.tsx +187 -0
- package/dist/components/catalyst-ui/primitives/tabs.tsx +335 -0
- package/dist/components/catalyst-ui/primitives/textarea.tsx +24 -0
- package/dist/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
- package/dist/components/catalyst-ui/primitives/toggle.tsx +42 -0
- package/dist/components/catalyst-ui/primitives/tooltip.tsx +116 -0
- package/dist/components/catalyst-ui/utils/basic-auth.tsx +40 -0
- package/dist/components/catalyst-ui/utils/context-storage.tsx +19 -0
- package/dist/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
- package/dist/components/catalyst-ui/utils/deferred-content.tsx +595 -0
- package/dist/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
- package/dist/components/catalyst-ui/utils/incId.tsx +75 -0
- package/dist/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
- package/dist/components/catalyst-ui/utils/request-id.tsx +14 -0
- package/dist/components/catalyst-ui/utils/secure-headers.tsx +37 -0
- package/dist/components/catalyst-ui/utils/server-timing.tsx +23 -0
- package/dist/components/catalyst-ui/utils/utils.ts +43 -0
- package/dist/components/catalyst-ui/utils/with-cookie.tsx +43 -0
- package/dist/components/catalyst-ui/x/accordian-x.tsx +428 -0
- package/dist/components/catalyst-ui/x/alert-x.tsx +413 -0
- package/dist/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
- package/dist/components/catalyst-ui/x/avatar-x.tsx +515 -0
- package/dist/components/catalyst-ui/x/badge-x.tsx +670 -0
- package/dist/components/catalyst-ui/x/button-X.tsx +2857 -0
- package/dist/components/catalyst-ui/x/button-group-x.tsx +847 -0
- package/dist/components/catalyst-ui/x/calendar-x.tsx +1910 -0
- package/dist/components/catalyst-ui/x/card-x.tsx +2597 -0
- package/dist/components/catalyst-ui/x/checkbox-x.tsx +656 -0
- package/dist/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
- package/dist/components/catalyst-ui/x/combobox-x.tsx +911 -0
- package/dist/components/catalyst-ui/x/data-table-x.tsx +1753 -0
- package/dist/components/catalyst-ui/x/date-picker-x.tsx +648 -0
- package/dist/components/catalyst-ui/x/dialog-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
- package/dist/components/catalyst-ui/x/hover-card-x.tsx +375 -0
- package/dist/components/catalyst-ui/x/icon-x.tsx +840 -0
- package/dist/components/catalyst-ui/x/input-mask-x.tsx +981 -0
- package/dist/components/catalyst-ui/x/input-otp-x.tsx +659 -0
- package/dist/components/catalyst-ui/x/loader-x.tsx +1757 -0
- package/dist/components/catalyst-ui/x/pagination-x.tsx +622 -0
- package/dist/components/catalyst-ui/x/popover-x.tsx +744 -0
- package/dist/components/catalyst-ui/x/radio-group-x.tsx +499 -0
- package/dist/components/catalyst-ui/x/select-x.tsx +1127 -0
- package/dist/components/catalyst-ui/x/sheet-x.tsx +668 -0
- package/dist/components/catalyst-ui/x/switch-x.tsx +681 -0
- package/dist/components/catalyst-ui/x/table-x.tsx +574 -0
- package/dist/components/catalyst-ui/x/tabs-x.tsx +839 -0
- package/dist/components/catalyst-ui/x/textarea-x.tsx +1263 -0
- package/dist/components/catalyst-ui/x/tooltip-x.tsx +396 -0
- package/dist/components/catalyst-ui/x/tracker-x.tsx +560 -0
- package/dist/data/bg-data.tsx +901 -0
- package/dist/data/buttons-data.tsx +2327 -0
- package/dist/data/charts-data.tsx +102 -0
- package/dist/data/chat-data.tsx +83 -0
- package/dist/data/code-data.tsx +1040 -0
- package/dist/data/comboboxes-data.tsx +1843 -0
- package/dist/data/command-data.tsx +1381 -0
- package/dist/data/core-data.tsx +15953 -0
- package/dist/data/crm-data.tsx +47 -0
- package/dist/data/data.tsx +159 -0
- package/dist/data/date-and-time-data.tsx +554 -0
- package/dist/data/dependencies.tsx +7 -0
- package/dist/data/ecommerce-data.tsx +1387 -0
- package/dist/data/forms-data.tsx +7890 -0
- package/dist/data/hooks-data.tsx +5487 -0
- package/dist/data/index.ts +34 -0
- package/dist/data/inputs-data.tsx +557 -0
- package/dist/data/interactive-data.tsx +5394 -0
- package/dist/data/lofi-data.tsx +18295 -0
- package/dist/data/marketing-data.tsx +2546 -0
- package/dist/data/media-data.tsx +1510 -0
- package/dist/data/motion-data.tsx +5801 -0
- package/dist/data/overlay-data.tsx +4136 -0
- package/dist/data/pdf-data.tsx +124 -0
- package/dist/data/pos-data.tsx +213 -0
- package/dist/data/postcss.config.js +6 -0
- package/dist/data/primitive-data.tsx +5170 -0
- package/dist/data/prompt-data.tsx +1226 -0
- package/dist/data/requiredLibs.ts +4 -0
- package/dist/data/sandbox-data.tsx +1 -0
- package/dist/data/sidebars-data.tsx +5421 -0
- package/dist/data/stacks-data.tsx +32 -0
- package/dist/data/table-data.tsx +706 -0
- package/dist/data/tailwind.config.js +270 -0
- package/dist/data/tailwind.config.ngin.js +3830 -0
- package/dist/data/tailwind.css +431 -0
- package/dist/data/tools-data.tsx +6910 -0
- package/dist/data/typography-data.tsx +2050 -0
- package/dist/data/utils-data.tsx +6500 -0
- package/dist/data/x-data.tsx +1171 -0
- package/dist/data.tsx +159 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -362
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { cn } from '~/components/catalyst-ui';
|
|
3
|
+
import { Button } from '~/components/catalyst-ui'
|
|
4
|
+
// @dev app/components/catalyst-ui/data/buttons-data.tsx:1281
|
|
5
|
+
interface BurgerMenuProps {
|
|
6
|
+
opened?: boolean;
|
|
7
|
+
onToggle?: (opened: boolean) => void;
|
|
8
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
9
|
+
color?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
'aria-label'?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Burger({ opened = false, size = 'md', color = 'currentColor',}: BurgerMenuProps) {
|
|
16
|
+
const isOpened = opened
|
|
17
|
+
|
|
18
|
+
const sizeClasses = {
|
|
19
|
+
sm: 'w-4 h-4',
|
|
20
|
+
md: 'w-6 h-6',
|
|
21
|
+
lg: 'w-8 h-8',
|
|
22
|
+
xl: 'w-10 h-10'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const lineHeight = {
|
|
26
|
+
sm: '2px',
|
|
27
|
+
md: '2px',
|
|
28
|
+
lg: '3px',
|
|
29
|
+
xl: '3px'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div className={cn("relative", sizeClasses[size])}>
|
|
34
|
+
<span
|
|
35
|
+
className={cn("absolute left-0 block transition-all duration-300 ease-in-out rounded-full", "bg-current")}
|
|
36
|
+
style={{
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: lineHeight[size],
|
|
39
|
+
color: color,
|
|
40
|
+
top: isOpened ? '50%' : '20%',
|
|
41
|
+
transform: isOpened ? 'translateY(-50%) rotate(45deg)' : 'translateY(-50%) rotate(0deg)'
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
<span
|
|
45
|
+
className={cn(
|
|
46
|
+
"absolute left-0 block transition-all duration-300 ease-in-out rounded-full",
|
|
47
|
+
"bg-current"
|
|
48
|
+
)}
|
|
49
|
+
style={{
|
|
50
|
+
width: '100%',
|
|
51
|
+
height: lineHeight[size],
|
|
52
|
+
color: color,
|
|
53
|
+
top: '50%',
|
|
54
|
+
opacity: isOpened ? 0 : 1,
|
|
55
|
+
transform: 'translateY(-50%)'
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
<span
|
|
59
|
+
className={cn(
|
|
60
|
+
"absolute left-0 block transition-all duration-300 ease-in-out rounded-full",
|
|
61
|
+
"bg-current"
|
|
62
|
+
)}
|
|
63
|
+
style={{
|
|
64
|
+
width: '100%',
|
|
65
|
+
height: lineHeight[size],
|
|
66
|
+
color: color,
|
|
67
|
+
bottom: isOpened ? '50%' : '20%',
|
|
68
|
+
transform: isOpened ? 'translateY(50%) rotate(-45deg)' : 'translateY(50%) rotate(0deg)'
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function BurgerButton({
|
|
76
|
+
opened,
|
|
77
|
+
onToggle,
|
|
78
|
+
size,
|
|
79
|
+
color,
|
|
80
|
+
className = '',
|
|
81
|
+
'aria-label': ariaLabel = 'Toggle navigation',
|
|
82
|
+
disabled = false
|
|
83
|
+
}: BurgerMenuProps) {
|
|
84
|
+
const [internalOpened, setInternalOpened] = useState(false);
|
|
85
|
+
|
|
86
|
+
const isOpened = controlledOpened !== undefined ? controlledOpened : internalOpened;
|
|
87
|
+
|
|
88
|
+
const handleToggle = () => {
|
|
89
|
+
if (disabled) return;
|
|
90
|
+
|
|
91
|
+
const newOpened = !isOpened;
|
|
92
|
+
if (controlledOpened === undefined) {
|
|
93
|
+
setInternalOpened(newOpened);
|
|
94
|
+
}
|
|
95
|
+
onToggle?.(newOpened);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const sizeClasses = {
|
|
99
|
+
sm: 'w-4 h-4',
|
|
100
|
+
md: 'w-6 h-6',
|
|
101
|
+
lg: 'w-8 h-8',
|
|
102
|
+
xl: 'w-10 h-10'
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Button
|
|
108
|
+
variant="ghost"
|
|
109
|
+
size="icon"
|
|
110
|
+
onClick={handleToggle}
|
|
111
|
+
disabled={disabled}
|
|
112
|
+
aria-label={ariaLabel}
|
|
113
|
+
className={cn(
|
|
114
|
+
"relative p-2 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring",
|
|
115
|
+
sizeClasses[size],
|
|
116
|
+
className
|
|
117
|
+
)}
|
|
118
|
+
>
|
|
119
|
+
<Burger
|
|
120
|
+
opened={opened}
|
|
121
|
+
size={size}
|
|
122
|
+
color={color}
|
|
123
|
+
/>
|
|
124
|
+
</Button>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface NavigationItem {
|
|
129
|
+
id: string;
|
|
130
|
+
label: string;
|
|
131
|
+
href?: string;
|
|
132
|
+
onClick?: () => void;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface BurgerNavigationProps {
|
|
136
|
+
menuItems: NavigationItem[];
|
|
137
|
+
isOpen: boolean;
|
|
138
|
+
onToggle: (open: boolean) => void;
|
|
139
|
+
className?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function BurgerNavigation({
|
|
143
|
+
menuItems,
|
|
144
|
+
isOpen,
|
|
145
|
+
onToggle,
|
|
146
|
+
className = ''
|
|
147
|
+
}: BurgerNavigationProps) {
|
|
148
|
+
const handleItemClick = (item: NavigationItem) => {
|
|
149
|
+
if (item.onClick) {
|
|
150
|
+
item.onClick();
|
|
151
|
+
} else if (item.href) {
|
|
152
|
+
window.location.href = item.href;
|
|
153
|
+
}
|
|
154
|
+
onToggle(false);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<div className={cn("relative", className)}>
|
|
159
|
+
<Burger
|
|
160
|
+
opened={isOpen}
|
|
161
|
+
onToggle={onToggle}
|
|
162
|
+
size="lg"
|
|
163
|
+
className="z-50"
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
<div
|
|
167
|
+
className={cn(
|
|
168
|
+
"fixed inset-0 bg-background/80 backdrop-blur-sm transition-all duration-300 z-40",
|
|
169
|
+
isOpen ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"
|
|
170
|
+
)}
|
|
171
|
+
onClick={() => onToggle(false)}
|
|
172
|
+
/>
|
|
173
|
+
|
|
174
|
+
<nav
|
|
175
|
+
className={cn(
|
|
176
|
+
"fixed top-0 right-0 h-full w-80 bg-card border-l border-border shadow-lg transition-transform duration-300 ease-in-out z-50",
|
|
177
|
+
isOpen ? "translate-x-0" : "translate-x-full"
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
<div className="flex items-center justify-between p-6 border-b border-border">
|
|
181
|
+
<h2 className="text-lg font-semibold text-foreground">Menu</h2>
|
|
182
|
+
<Burger
|
|
183
|
+
opened={isOpen}
|
|
184
|
+
onToggle={onToggle}
|
|
185
|
+
size="md"
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div className="p-6">
|
|
190
|
+
<ul className="space-y-2">
|
|
191
|
+
{menuItems.map((item) => (
|
|
192
|
+
<li key={item.id}>
|
|
193
|
+
<button
|
|
194
|
+
onClick={() => handleItemClick(item)}
|
|
195
|
+
className="w-full text-left p-3 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors duration-150 text-foreground font-medium"
|
|
196
|
+
>
|
|
197
|
+
{item.label}
|
|
198
|
+
</button>
|
|
199
|
+
</li>
|
|
200
|
+
))}
|
|
201
|
+
</ul>
|
|
202
|
+
</div>
|
|
203
|
+
</nav>
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
import { cn } from "~/components/catalyst-ui";
|
|
7
|
+
|
|
8
|
+
// Types
|
|
9
|
+
type TimelineContextValue = {
|
|
10
|
+
activeStep: number;
|
|
11
|
+
setActiveStep: (step: number) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// Context
|
|
15
|
+
const TimelineContext = React.createContext<TimelineContextValue | undefined>(
|
|
16
|
+
undefined,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const useTimeline = () => {
|
|
20
|
+
const context = React.useContext(TimelineContext);
|
|
21
|
+
if (!context) {
|
|
22
|
+
throw new Error("useTimeline must be used within a Timeline");
|
|
23
|
+
}
|
|
24
|
+
return context;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Components
|
|
28
|
+
interface TimelineProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
29
|
+
defaultValue?: number;
|
|
30
|
+
value?: number;
|
|
31
|
+
onValueChange?: (value: number) => void;
|
|
32
|
+
orientation?: "horizontal" | "vertical";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Timeline({
|
|
36
|
+
defaultValue = 1,
|
|
37
|
+
value,
|
|
38
|
+
onValueChange,
|
|
39
|
+
orientation = "vertical",
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}: TimelineProps) {
|
|
43
|
+
const [activeStep, setInternalStep] = React.useState(defaultValue);
|
|
44
|
+
|
|
45
|
+
const setActiveStep = React.useCallback(
|
|
46
|
+
(step: number) => {
|
|
47
|
+
if (value === undefined) {
|
|
48
|
+
setInternalStep(step);
|
|
49
|
+
}
|
|
50
|
+
onValueChange?.(step);
|
|
51
|
+
},
|
|
52
|
+
[value, onValueChange],
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const currentStep = value ?? activeStep;
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<TimelineContext.Provider
|
|
59
|
+
value={{ activeStep: currentStep, setActiveStep }}
|
|
60
|
+
>
|
|
61
|
+
<div
|
|
62
|
+
className={cn(
|
|
63
|
+
"group/timeline flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col",
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
data-orientation={orientation}
|
|
67
|
+
data-slot="timeline"
|
|
68
|
+
{...props}
|
|
69
|
+
/>
|
|
70
|
+
</TimelineContext.Provider>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// TimelineContent
|
|
75
|
+
function TimelineContent({
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
79
|
+
return (
|
|
80
|
+
<div
|
|
81
|
+
className={cn("text-muted-foreground text-sm", className)}
|
|
82
|
+
data-slot="timeline-content"
|
|
83
|
+
{...props}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// TimelineDate
|
|
89
|
+
interface TimelineDateProps extends React.HTMLAttributes<HTMLTimeElement> {
|
|
90
|
+
asChild?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function TimelineDate({
|
|
94
|
+
asChild = false,
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: TimelineDateProps) {
|
|
98
|
+
const Comp = asChild ? Slot.Root : "time";
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Comp
|
|
102
|
+
className={cn(
|
|
103
|
+
"mb-1 block font-medium text-muted-foreground text-xs group-data-[orientation=vertical]/timeline:max-sm:h-4",
|
|
104
|
+
className,
|
|
105
|
+
)}
|
|
106
|
+
data-slot="timeline-date"
|
|
107
|
+
{...props}
|
|
108
|
+
/>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// TimelineHeader
|
|
113
|
+
function TimelineHeader({
|
|
114
|
+
className,
|
|
115
|
+
...props
|
|
116
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
117
|
+
return (
|
|
118
|
+
<div className={cn(className)} data-slot="timeline-header" {...props} />
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// TimelineIndicator
|
|
123
|
+
interface TimelineIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
124
|
+
asChild?: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function TimelineIndicator({
|
|
128
|
+
asChild = false,
|
|
129
|
+
className,
|
|
130
|
+
children,
|
|
131
|
+
...props
|
|
132
|
+
}: TimelineIndicatorProps) {
|
|
133
|
+
return (
|
|
134
|
+
<div
|
|
135
|
+
aria-hidden="true"
|
|
136
|
+
className={cn(
|
|
137
|
+
"group-data-[orientation=horizontal]/timeline:-top-6 group-data-[orientation=horizontal]/timeline:-translate-y-1/2 group-data-[orientation=vertical]/timeline:-left-6 group-data-[orientation=vertical]/timeline:-translate-x-1/2 absolute size-4 rounded-full border-2 border-primary/20 group-data-[orientation=vertical]/timeline:top-0 group-data-[orientation=horizontal]/timeline:left-0 group-data-completed/timeline-item:border-primary",
|
|
138
|
+
className,
|
|
139
|
+
)}
|
|
140
|
+
data-slot="timeline-indicator"
|
|
141
|
+
{...props}
|
|
142
|
+
>
|
|
143
|
+
{children}
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// TimelineItem
|
|
149
|
+
interface TimelineItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
150
|
+
step: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function TimelineItem({ step, className, ...props }: TimelineItemProps) {
|
|
154
|
+
const { activeStep } = useTimeline();
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div
|
|
158
|
+
className={cn(
|
|
159
|
+
"group/timeline-item relative flex flex-1 flex-col gap-0.5 group-data-[orientation=vertical]/timeline:ms-8 group-data-[orientation=horizontal]/timeline:mt-8 group-data-[orientation=horizontal]/timeline:not-last:pe-8 group-data-[orientation=vertical]/timeline:not-last:pb-12 has-[+[data-completed]]:[&_[data-slot=timeline-separator]]:bg-primary",
|
|
160
|
+
className,
|
|
161
|
+
)}
|
|
162
|
+
data-completed={step <= activeStep || undefined}
|
|
163
|
+
data-slot="timeline-item"
|
|
164
|
+
{...props}
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// TimelineSeparator
|
|
170
|
+
function TimelineSeparator({
|
|
171
|
+
className,
|
|
172
|
+
...props
|
|
173
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
174
|
+
return (
|
|
175
|
+
<div
|
|
176
|
+
aria-hidden="true"
|
|
177
|
+
className={cn(
|
|
178
|
+
"group-data-[orientation=horizontal]/timeline:-top-6 group-data-[orientation=horizontal]/timeline:-translate-y-1/2 group-data-[orientation=vertical]/timeline:-left-6 group-data-[orientation=vertical]/timeline:-translate-x-1/2 absolute self-start bg-primary/10 group-last/timeline-item:hidden group-data-[orientation=horizontal]/timeline:h-0.5 group-data-[orientation=vertical]/timeline:h-[calc(100%-1rem-0.25rem)] group-data-[orientation=horizontal]/timeline:w-[calc(100%-1rem-0.25rem)] group-data-[orientation=vertical]/timeline:w-0.5 group-data-[orientation=horizontal]/timeline:translate-x-4.5 group-data-[orientation=vertical]/timeline:translate-y-4.5",
|
|
179
|
+
className,
|
|
180
|
+
)}
|
|
181
|
+
data-slot="timeline-separator"
|
|
182
|
+
{...props}
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// TimelineTitle
|
|
188
|
+
function TimelineTitle({
|
|
189
|
+
className,
|
|
190
|
+
...props
|
|
191
|
+
}: React.HTMLAttributes<HTMLHeadingElement>) {
|
|
192
|
+
return (
|
|
193
|
+
<h3
|
|
194
|
+
className={cn("font-medium text-sm", className)}
|
|
195
|
+
data-slot="timeline-title"
|
|
196
|
+
{...props}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export {
|
|
202
|
+
Timeline,
|
|
203
|
+
TimelineContent,
|
|
204
|
+
TimelineDate,
|
|
205
|
+
TimelineHeader,
|
|
206
|
+
TimelineIndicator,
|
|
207
|
+
TimelineItem,
|
|
208
|
+
TimelineSeparator,
|
|
209
|
+
TimelineTitle,
|
|
210
|
+
};
|