@coston/ui 0.1.0 → 0.2.1
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/README.md +75 -10
- package/dist/{button-CJvoztqg.js → button-BJdMtkHX.js} +3 -3
- package/dist/button-BJdMtkHX.js.map +1 -0
- package/dist/components/accordion.d.ts.map +1 -1
- package/dist/components/accordion.js +4 -4
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/alert-dialog.d.ts +3 -3
- package/dist/components/alert-dialog.js +5 -5
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.d.ts +2 -2
- package/dist/components/alert.js +3 -3
- package/dist/components/alert.js.map +1 -1
- package/dist/components/avatar.d.ts.map +1 -1
- package/dist/components/avatar.js +2 -2
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.d.ts +5 -5
- package/dist/components/badge.d.ts.map +1 -1
- package/dist/components/badge.js +4 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.d.ts +3 -3
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/button.js +2 -2
- package/dist/components/calendar.d.ts +2 -2
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +1 -1
- package/dist/components/card.d.ts +4 -1
- package/dist/components/card.d.ts.map +1 -1
- package/dist/components/card.js +5 -5
- package/dist/components/card.js.map +1 -1
- package/dist/components/carousel.js +2 -2
- package/dist/components/chart.d.ts +1 -1
- package/dist/components/chart.d.ts.map +1 -1
- package/dist/components/chart.js +1 -1
- package/dist/components/checkbox.js +3 -3
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/command.d.ts +75 -10
- package/dist/components/command.d.ts.map +1 -1
- package/dist/components/command.js +3 -3
- package/dist/components/command.js.map +1 -1
- package/dist/components/context-menu.d.ts +2 -2
- package/dist/components/context-menu.d.ts.map +1 -1
- package/dist/components/context-menu.js +3 -3
- package/dist/components/context-menu.js.map +1 -1
- package/dist/components/dialog.d.ts +3 -3
- package/dist/components/dialog.js +2 -2
- package/dist/components/drawer.d.ts +13 -11
- package/dist/components/drawer.d.ts.map +1 -1
- package/dist/components/drawer.js +2 -2
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +3 -3
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/hover-card.js +2 -2
- package/dist/components/hover-card.js.map +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/label.d.ts +2 -2
- package/dist/components/label.js +1 -1
- package/dist/components/menubar.js +4 -4
- package/dist/components/menubar.js.map +1 -1
- package/dist/components/navigation-menu.d.ts +2 -2
- package/dist/components/navigation-menu.js +2 -2
- package/dist/components/navigation-menu.js.map +1 -1
- package/dist/components/pagination.d.ts +6 -6
- package/dist/components/pagination.d.ts.map +1 -1
- package/dist/components/pagination.js +2 -2
- package/dist/components/popover.js +2 -2
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.js +2 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/radio-group.js +1 -1
- package/dist/components/resizable.d.ts +5 -5
- package/dist/components/resizable.d.ts.map +1 -1
- package/dist/components/resizable.js +4 -4
- package/dist/components/resizable.js.map +1 -1
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/select.js +2 -2
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.js +2 -2
- package/dist/components/sheet.d.ts +6 -6
- package/dist/components/sheet.d.ts.map +1 -1
- package/dist/components/sheet.js +8 -8
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.js +5 -5
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.d.ts +2 -2
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +3 -3
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/sonner.d.ts.map +1 -1
- package/dist/components/switch.js +3 -3
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts.map +1 -1
- package/dist/components/table.js +2 -2
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.js +1 -1
- package/dist/components/toggle-group.d.ts +3 -3
- package/dist/components/toggle-group.js +2 -2
- package/dist/components/toggle.d.ts +3 -3
- package/dist/components/toggle.js +2 -2
- package/dist/components/tooltip.js +2 -2
- package/dist/{dialog-B_8jhMOs.js → dialog-COSqOqbH.js} +6 -6
- package/dist/dialog-COSqOqbH.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/{separator-9lzFsfCC.js → separator-C3mBJ8ik.js} +2 -2
- package/dist/{separator-9lzFsfCC.js.map → separator-C3mBJ8ik.js.map} +1 -1
- package/dist/{toggle-BpKiTVe4.js → toggle-CD9xIRlr.js} +3 -3
- package/dist/toggle-CD9xIRlr.js.map +1 -0
- package/dist/{tooltip-CXS6wR7g.js → tooltip-PxI7r4yP.js} +3 -3
- package/dist/tooltip-PxI7r4yP.js.map +1 -0
- package/dist/{utils-C0f9Ma6r.js → utils-CyPJ3VV3.js} +3 -2
- package/dist/utils-CyPJ3VV3.js.map +1 -0
- package/llms.txt +989 -0
- package/package.json +52 -14
- package/source.css +40 -0
- package/dist/button-CJvoztqg.js.map +0 -1
- package/dist/dialog-B_8jhMOs.js.map +0 -1
- package/dist/toggle-BpKiTVe4.js.map +0 -1
- package/dist/tooltip-CXS6wR7g.js.map +0 -1
- package/dist/utils-C0f9Ma6r.js.map +0 -1
- package/src/components/accordion.tsx +0 -51
- package/src/components/alert-dialog.tsx +0 -115
- package/src/components/alert.tsx +0 -49
- package/src/components/aspect-ratio.tsx +0 -5
- package/src/components/avatar.tsx +0 -44
- package/src/components/badge.tsx +0 -32
- package/src/components/breadcrumb.tsx +0 -101
- package/src/components/button.tsx +0 -48
- package/src/components/calendar.tsx +0 -76
- package/src/components/card.tsx +0 -60
- package/src/components/carousel.tsx +0 -240
- package/src/components/chart.tsx +0 -232
- package/src/components/checkbox.tsx +0 -25
- package/src/components/collapsible.tsx +0 -11
- package/src/components/command.tsx +0 -136
- package/src/components/context-menu.tsx +0 -187
- package/src/components/dialog.tsx +0 -105
- package/src/components/drawer.tsx +0 -98
- package/src/components/dropdown-menu.tsx +0 -185
- package/src/components/hover-card.tsx +0 -29
- package/src/components/input.tsx +0 -24
- package/src/components/label.tsx +0 -19
- package/src/components/menubar.tsx +0 -219
- package/src/components/navigation-menu.tsx +0 -120
- package/src/components/pagination.tsx +0 -98
- package/src/components/popover.tsx +0 -27
- package/src/components/progress.tsx +0 -23
- package/src/components/radio-group.tsx +0 -35
- package/src/components/resizable.tsx +0 -38
- package/src/components/scroll-area.tsx +0 -43
- package/src/components/select.tsx +0 -147
- package/src/components/separator.tsx +0 -23
- package/src/components/sheet.tsx +0 -122
- package/src/components/sidebar.tsx +0 -507
- package/src/components/skeleton.tsx +0 -7
- package/src/components/slider.tsx +0 -23
- package/src/components/sonner.tsx +0 -26
- package/src/components/switch.tsx +0 -26
- package/src/components/table.tsx +0 -95
- package/src/components/tabs.tsx +0 -53
- package/src/components/textarea.tsx +0 -20
- package/src/components/toggle-group.tsx +0 -54
- package/src/components/toggle.tsx +0 -40
- package/src/components/tooltip.tsx +0 -27
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/lib/utils.ts +0 -6
|
@@ -1,507 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import { PanelLeft } from 'lucide-react';
|
|
4
|
-
import { cn } from '../lib/utils';
|
|
5
|
-
import { Button } from './button';
|
|
6
|
-
import { Separator } from './separator';
|
|
7
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip';
|
|
8
|
-
import { useIsMobile } from '../hooks/use-mobile';
|
|
9
|
-
|
|
10
|
-
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
11
|
-
const SIDEBAR_WIDTH = '16rem';
|
|
12
|
-
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
13
|
-
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
14
|
-
|
|
15
|
-
type SidebarContext = {
|
|
16
|
-
state: 'expanded' | 'collapsed';
|
|
17
|
-
open: boolean;
|
|
18
|
-
setOpen: (open: boolean) => void;
|
|
19
|
-
openMobile: boolean;
|
|
20
|
-
setOpenMobile: (open: boolean) => void;
|
|
21
|
-
isMobile: boolean;
|
|
22
|
-
toggleSidebar: () => void;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const SidebarContext = React.createContext<SidebarContext | null>(null);
|
|
26
|
-
|
|
27
|
-
function useSidebar() {
|
|
28
|
-
const context = React.useContext(SidebarContext);
|
|
29
|
-
if (!context) {
|
|
30
|
-
throw new Error('useSidebar must be used within a SidebarProvider.');
|
|
31
|
-
}
|
|
32
|
-
return context;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const SidebarProvider = React.forwardRef<
|
|
36
|
-
HTMLDivElement,
|
|
37
|
-
React.ComponentProps<'div'> & {
|
|
38
|
-
defaultOpen?: boolean;
|
|
39
|
-
open?: boolean;
|
|
40
|
-
onOpenChange?: (open: boolean) => void;
|
|
41
|
-
}
|
|
42
|
-
>(
|
|
43
|
-
(
|
|
44
|
-
{
|
|
45
|
-
defaultOpen = true,
|
|
46
|
-
open: openProp,
|
|
47
|
-
onOpenChange: setOpenProp,
|
|
48
|
-
className,
|
|
49
|
-
style,
|
|
50
|
-
children,
|
|
51
|
-
...props
|
|
52
|
-
},
|
|
53
|
-
ref
|
|
54
|
-
) => {
|
|
55
|
-
const isMobile = useIsMobile();
|
|
56
|
-
const [openMobile, setOpenMobile] = React.useState(false);
|
|
57
|
-
|
|
58
|
-
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
59
|
-
const open = openProp ?? _open;
|
|
60
|
-
const setOpen = React.useCallback(
|
|
61
|
-
(value: boolean | ((value: boolean) => boolean)) => {
|
|
62
|
-
const openState = typeof value === 'function' ? value(open) : value;
|
|
63
|
-
if (setOpenProp) {
|
|
64
|
-
setOpenProp(openState);
|
|
65
|
-
} else {
|
|
66
|
-
_setOpen(openState);
|
|
67
|
-
}
|
|
68
|
-
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${60 * 60 * 24 * 7}`;
|
|
69
|
-
},
|
|
70
|
-
[setOpenProp, open]
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const toggleSidebar = React.useCallback(() => {
|
|
74
|
-
return isMobile ? setOpenMobile(open => !open) : setOpen(open => !open);
|
|
75
|
-
}, [isMobile, setOpen, setOpenMobile]);
|
|
76
|
-
|
|
77
|
-
React.useEffect(() => {
|
|
78
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
79
|
-
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
toggleSidebar();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
85
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
86
|
-
}, [toggleSidebar]);
|
|
87
|
-
|
|
88
|
-
const state = open ? 'expanded' : 'collapsed';
|
|
89
|
-
|
|
90
|
-
const contextValue = React.useMemo<SidebarContext>(
|
|
91
|
-
() => ({ state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar }),
|
|
92
|
-
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<SidebarContext.Provider value={contextValue}>
|
|
97
|
-
<TooltipProvider delayDuration={0}>
|
|
98
|
-
<div
|
|
99
|
-
ref={ref}
|
|
100
|
-
style={
|
|
101
|
-
{
|
|
102
|
-
'--sidebar-width': SIDEBAR_WIDTH,
|
|
103
|
-
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
104
|
-
...style,
|
|
105
|
-
} as React.CSSProperties
|
|
106
|
-
}
|
|
107
|
-
className={cn(
|
|
108
|
-
'group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar',
|
|
109
|
-
className
|
|
110
|
-
)}
|
|
111
|
-
data-collapsible={state === 'collapsed' ? 'icon' : ''}
|
|
112
|
-
{...props}
|
|
113
|
-
>
|
|
114
|
-
{children}
|
|
115
|
-
</div>
|
|
116
|
-
</TooltipProvider>
|
|
117
|
-
</SidebarContext.Provider>
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
);
|
|
121
|
-
SidebarProvider.displayName = 'SidebarProvider';
|
|
122
|
-
|
|
123
|
-
const Sidebar = React.forwardRef<
|
|
124
|
-
HTMLDivElement,
|
|
125
|
-
React.ComponentProps<'div'> & {
|
|
126
|
-
side?: 'left' | 'right';
|
|
127
|
-
variant?: 'sidebar' | 'floating' | 'inset';
|
|
128
|
-
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
129
|
-
}
|
|
130
|
-
>(
|
|
131
|
-
(
|
|
132
|
-
{
|
|
133
|
-
side = 'left',
|
|
134
|
-
variant = 'sidebar',
|
|
135
|
-
collapsible = 'offcanvas',
|
|
136
|
-
className,
|
|
137
|
-
children,
|
|
138
|
-
...props
|
|
139
|
-
},
|
|
140
|
-
ref
|
|
141
|
-
) => {
|
|
142
|
-
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
143
|
-
|
|
144
|
-
if (collapsible === 'none') {
|
|
145
|
-
return (
|
|
146
|
-
<div
|
|
147
|
-
className={cn('flex h-full flex-col bg-sidebar text-sidebar-foreground', className)}
|
|
148
|
-
style={{ width: 'var(--sidebar-width)' }}
|
|
149
|
-
ref={ref}
|
|
150
|
-
{...props}
|
|
151
|
-
>
|
|
152
|
-
{children}
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (isMobile) {
|
|
158
|
-
return (
|
|
159
|
-
<>
|
|
160
|
-
{openMobile && (
|
|
161
|
-
<div className="fixed inset-0 z-50 bg-black/50" onClick={() => setOpenMobile(false)} />
|
|
162
|
-
)}
|
|
163
|
-
<div
|
|
164
|
-
ref={ref}
|
|
165
|
-
data-variant={variant}
|
|
166
|
-
style={{ width: 'var(--sidebar-width)' }}
|
|
167
|
-
className={cn(
|
|
168
|
-
'fixed inset-y-0 z-50 flex h-svh flex-col bg-sidebar text-sidebar-foreground transition-transform duration-200',
|
|
169
|
-
side === 'left' ? 'left-0' : 'right-0',
|
|
170
|
-
openMobile
|
|
171
|
-
? 'translate-x-0'
|
|
172
|
-
: side === 'left'
|
|
173
|
-
? '-translate-x-full'
|
|
174
|
-
: 'translate-x-full',
|
|
175
|
-
className
|
|
176
|
-
)}
|
|
177
|
-
{...props}
|
|
178
|
-
>
|
|
179
|
-
{children}
|
|
180
|
-
</div>
|
|
181
|
-
</>
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<div
|
|
187
|
-
ref={ref}
|
|
188
|
-
className="group peer hidden md:block text-sidebar-foreground"
|
|
189
|
-
data-state={state}
|
|
190
|
-
data-collapsible={state === 'collapsed' ? collapsible : ''}
|
|
191
|
-
data-variant={variant}
|
|
192
|
-
data-side={side}
|
|
193
|
-
>
|
|
194
|
-
{/* Gap on side to keep layout */}
|
|
195
|
-
<div
|
|
196
|
-
style={{ width: 'var(--sidebar-width)' }}
|
|
197
|
-
className={cn(
|
|
198
|
-
'relative h-svh bg-transparent transition-[width] duration-200 ease-linear',
|
|
199
|
-
'group-data-[collapsible=offcanvas]:!w-0',
|
|
200
|
-
'group-data-[side=right]:rotate-180'
|
|
201
|
-
)}
|
|
202
|
-
/>
|
|
203
|
-
<div
|
|
204
|
-
style={{ width: 'var(--sidebar-width)' }}
|
|
205
|
-
className={cn(
|
|
206
|
-
'fixed inset-y-0 z-10 hidden h-svh transition-[left,right,width] duration-200 ease-linear md:flex',
|
|
207
|
-
'group-data-[collapsible=offcanvas]:!w-0',
|
|
208
|
-
side === 'left'
|
|
209
|
-
? 'left-0 group-data-[collapsible=offcanvas]:-left-[var(--sidebar-width)]'
|
|
210
|
-
: 'right-0 group-data-[collapsible=offcanvas]:-right-[var(--sidebar-width)]',
|
|
211
|
-
variant === 'floating' || variant === 'inset'
|
|
212
|
-
? 'p-2'
|
|
213
|
-
: 'group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
214
|
-
className
|
|
215
|
-
)}
|
|
216
|
-
{...props}
|
|
217
|
-
>
|
|
218
|
-
<div
|
|
219
|
-
data-sidebar="sidebar"
|
|
220
|
-
className="flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
|
|
221
|
-
>
|
|
222
|
-
{children}
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
);
|
|
229
|
-
Sidebar.displayName = 'Sidebar';
|
|
230
|
-
|
|
231
|
-
const SidebarTrigger = React.forwardRef<
|
|
232
|
-
React.ComponentRef<typeof Button>,
|
|
233
|
-
React.ComponentProps<typeof Button>
|
|
234
|
-
>(({ className, onClick, ...props }, ref) => {
|
|
235
|
-
const { toggleSidebar } = useSidebar();
|
|
236
|
-
|
|
237
|
-
return (
|
|
238
|
-
<Button
|
|
239
|
-
ref={ref}
|
|
240
|
-
data-sidebar="trigger"
|
|
241
|
-
variant="ghost"
|
|
242
|
-
size="icon"
|
|
243
|
-
className={cn('h-6 w-6 text-muted-foreground', className)}
|
|
244
|
-
onClick={event => {
|
|
245
|
-
onClick?.(event);
|
|
246
|
-
toggleSidebar();
|
|
247
|
-
}}
|
|
248
|
-
{...props}
|
|
249
|
-
>
|
|
250
|
-
<PanelLeft className="h-4 w-4" />
|
|
251
|
-
<span className="sr-only">Toggle Sidebar</span>
|
|
252
|
-
</Button>
|
|
253
|
-
);
|
|
254
|
-
});
|
|
255
|
-
SidebarTrigger.displayName = 'SidebarTrigger';
|
|
256
|
-
|
|
257
|
-
const SidebarInset = React.forwardRef<HTMLDivElement, React.ComponentProps<'main'>>(
|
|
258
|
-
({ className, ...props }, ref) => {
|
|
259
|
-
return (
|
|
260
|
-
<main
|
|
261
|
-
ref={ref}
|
|
262
|
-
className={cn(
|
|
263
|
-
'relative flex min-h-svh flex-1 flex-col bg-background',
|
|
264
|
-
'peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:border-sidebar-border',
|
|
265
|
-
className
|
|
266
|
-
)}
|
|
267
|
-
{...props}
|
|
268
|
-
/>
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
SidebarInset.displayName = 'SidebarInset';
|
|
273
|
-
|
|
274
|
-
const SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
275
|
-
({ className, ...props }, ref) => (
|
|
276
|
-
<div
|
|
277
|
-
ref={ref}
|
|
278
|
-
data-sidebar="header"
|
|
279
|
-
className={cn('flex flex-col gap-2 p-2', className)}
|
|
280
|
-
{...props}
|
|
281
|
-
/>
|
|
282
|
-
)
|
|
283
|
-
);
|
|
284
|
-
SidebarHeader.displayName = 'SidebarHeader';
|
|
285
|
-
|
|
286
|
-
const SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
287
|
-
({ className, ...props }, ref) => (
|
|
288
|
-
<div
|
|
289
|
-
ref={ref}
|
|
290
|
-
data-sidebar="footer"
|
|
291
|
-
className={cn('flex flex-col gap-2 p-2', className)}
|
|
292
|
-
{...props}
|
|
293
|
-
/>
|
|
294
|
-
)
|
|
295
|
-
);
|
|
296
|
-
SidebarFooter.displayName = 'SidebarFooter';
|
|
297
|
-
|
|
298
|
-
const SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
299
|
-
({ className, ...props }, ref) => (
|
|
300
|
-
<div
|
|
301
|
-
ref={ref}
|
|
302
|
-
data-sidebar="content"
|
|
303
|
-
className={cn(
|
|
304
|
-
'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
|
|
305
|
-
className
|
|
306
|
-
)}
|
|
307
|
-
{...props}
|
|
308
|
-
/>
|
|
309
|
-
)
|
|
310
|
-
);
|
|
311
|
-
SidebarContent.displayName = 'SidebarContent';
|
|
312
|
-
|
|
313
|
-
const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
314
|
-
({ className, ...props }, ref) => (
|
|
315
|
-
<div
|
|
316
|
-
ref={ref}
|
|
317
|
-
data-sidebar="group"
|
|
318
|
-
className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
|
|
319
|
-
{...props}
|
|
320
|
-
/>
|
|
321
|
-
)
|
|
322
|
-
);
|
|
323
|
-
SidebarGroup.displayName = 'SidebarGroup';
|
|
324
|
-
|
|
325
|
-
const SidebarGroupLabel = React.forwardRef<
|
|
326
|
-
HTMLDivElement,
|
|
327
|
-
React.ComponentProps<'div'> & { asChild?: boolean }
|
|
328
|
-
>(({ className, asChild = false, ...props }, ref) => {
|
|
329
|
-
const Comp = asChild ? Slot : 'div';
|
|
330
|
-
return (
|
|
331
|
-
<Comp
|
|
332
|
-
ref={ref}
|
|
333
|
-
data-sidebar="group-label"
|
|
334
|
-
className={cn(
|
|
335
|
-
'flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
336
|
-
'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
|
|
337
|
-
className
|
|
338
|
-
)}
|
|
339
|
-
{...props}
|
|
340
|
-
/>
|
|
341
|
-
);
|
|
342
|
-
});
|
|
343
|
-
SidebarGroupLabel.displayName = 'SidebarGroupLabel';
|
|
344
|
-
|
|
345
|
-
const SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(
|
|
346
|
-
({ className, ...props }, ref) => (
|
|
347
|
-
<div
|
|
348
|
-
ref={ref}
|
|
349
|
-
data-sidebar="group-content"
|
|
350
|
-
className={cn('w-full text-sm', className)}
|
|
351
|
-
{...props}
|
|
352
|
-
/>
|
|
353
|
-
)
|
|
354
|
-
);
|
|
355
|
-
SidebarGroupContent.displayName = 'SidebarGroupContent';
|
|
356
|
-
|
|
357
|
-
const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'>>(
|
|
358
|
-
({ className, ...props }, ref) => (
|
|
359
|
-
<ul
|
|
360
|
-
ref={ref}
|
|
361
|
-
data-sidebar="menu"
|
|
362
|
-
className={cn('flex w-full min-w-0 flex-col gap-1', className)}
|
|
363
|
-
{...props}
|
|
364
|
-
/>
|
|
365
|
-
)
|
|
366
|
-
);
|
|
367
|
-
SidebarMenu.displayName = 'SidebarMenu';
|
|
368
|
-
|
|
369
|
-
const SidebarMenuItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li'>>(
|
|
370
|
-
({ className, ...props }, ref) => (
|
|
371
|
-
<li
|
|
372
|
-
ref={ref}
|
|
373
|
-
data-sidebar="menu-item"
|
|
374
|
-
className={cn('group/menu-item relative', className)}
|
|
375
|
-
{...props}
|
|
376
|
-
/>
|
|
377
|
-
)
|
|
378
|
-
);
|
|
379
|
-
SidebarMenuItem.displayName = 'SidebarMenuItem';
|
|
380
|
-
|
|
381
|
-
const sidebarMenuButtonVariants = {
|
|
382
|
-
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
383
|
-
outline:
|
|
384
|
-
'bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
|
|
385
|
-
};
|
|
386
|
-
|
|
387
|
-
const SidebarMenuButton = React.forwardRef<
|
|
388
|
-
HTMLButtonElement,
|
|
389
|
-
React.ComponentProps<'button'> & {
|
|
390
|
-
asChild?: boolean;
|
|
391
|
-
isActive?: boolean;
|
|
392
|
-
variant?: 'default' | 'outline';
|
|
393
|
-
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
394
|
-
size?: 'default' | 'sm' | 'lg';
|
|
395
|
-
}
|
|
396
|
-
>(
|
|
397
|
-
(
|
|
398
|
-
{
|
|
399
|
-
asChild = false,
|
|
400
|
-
isActive = false,
|
|
401
|
-
variant = 'default',
|
|
402
|
-
size = 'default',
|
|
403
|
-
tooltip,
|
|
404
|
-
className,
|
|
405
|
-
...props
|
|
406
|
-
},
|
|
407
|
-
ref
|
|
408
|
-
) => {
|
|
409
|
-
const Comp = asChild ? Slot : 'button';
|
|
410
|
-
const { isMobile, state } = useSidebar();
|
|
411
|
-
|
|
412
|
-
const button = (
|
|
413
|
-
<Comp
|
|
414
|
-
ref={ref}
|
|
415
|
-
data-sidebar="menu-button"
|
|
416
|
-
data-size={size}
|
|
417
|
-
data-active={isActive}
|
|
418
|
-
data-slot="sidebar-menu-button"
|
|
419
|
-
className={cn(
|
|
420
|
-
'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-primary data-[active=true]:font-medium data-[active=true]:text-sidebar-primary-foreground data-[active=true]:hover:bg-sidebar-primary/90 data-[active=true]:hover:text-sidebar-primary-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
|
|
421
|
-
size === 'sm' && 'text-xs',
|
|
422
|
-
size === 'lg' &&
|
|
423
|
-
'group-data-[collapsible=icon]:!p-0 data-[size=lg]:h-12 data-[size=lg]:text-sm',
|
|
424
|
-
sidebarMenuButtonVariants[variant],
|
|
425
|
-
className
|
|
426
|
-
)}
|
|
427
|
-
{...props}
|
|
428
|
-
/>
|
|
429
|
-
);
|
|
430
|
-
|
|
431
|
-
if (!tooltip) return button;
|
|
432
|
-
|
|
433
|
-
const tooltipProps = typeof tooltip === 'string' ? { children: tooltip } : tooltip;
|
|
434
|
-
|
|
435
|
-
return (
|
|
436
|
-
<Tooltip>
|
|
437
|
-
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
438
|
-
<TooltipContent
|
|
439
|
-
side="right"
|
|
440
|
-
align="center"
|
|
441
|
-
hidden={state !== 'collapsed' || isMobile}
|
|
442
|
-
{...tooltipProps}
|
|
443
|
-
/>
|
|
444
|
-
</Tooltip>
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
);
|
|
448
|
-
SidebarMenuButton.displayName = 'SidebarMenuButton';
|
|
449
|
-
|
|
450
|
-
const SidebarMenuAction = React.forwardRef<
|
|
451
|
-
HTMLButtonElement,
|
|
452
|
-
React.ComponentProps<'button'> & {
|
|
453
|
-
asChild?: boolean;
|
|
454
|
-
showOnHover?: boolean;
|
|
455
|
-
}
|
|
456
|
-
>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
457
|
-
const Comp = asChild ? Slot : 'button';
|
|
458
|
-
|
|
459
|
-
return (
|
|
460
|
-
<Comp
|
|
461
|
-
ref={ref}
|
|
462
|
-
data-sidebar="menu-action"
|
|
463
|
-
className={cn(
|
|
464
|
-
'absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0',
|
|
465
|
-
'after:absolute after:-inset-2 after:md:hidden',
|
|
466
|
-
'group-data-[collapsible=icon]:hidden',
|
|
467
|
-
showOnHover &&
|
|
468
|
-
'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0',
|
|
469
|
-
className
|
|
470
|
-
)}
|
|
471
|
-
{...props}
|
|
472
|
-
/>
|
|
473
|
-
);
|
|
474
|
-
});
|
|
475
|
-
SidebarMenuAction.displayName = 'SidebarMenuAction';
|
|
476
|
-
|
|
477
|
-
const SidebarSeparator = React.forwardRef<
|
|
478
|
-
React.ComponentRef<typeof Separator>,
|
|
479
|
-
React.ComponentProps<typeof Separator>
|
|
480
|
-
>(({ className, ...props }, ref) => (
|
|
481
|
-
<Separator
|
|
482
|
-
ref={ref}
|
|
483
|
-
data-sidebar="separator"
|
|
484
|
-
className={cn('mx-2 w-auto bg-sidebar-border', className)}
|
|
485
|
-
{...props}
|
|
486
|
-
/>
|
|
487
|
-
));
|
|
488
|
-
SidebarSeparator.displayName = 'SidebarSeparator';
|
|
489
|
-
|
|
490
|
-
export {
|
|
491
|
-
Sidebar,
|
|
492
|
-
SidebarContent,
|
|
493
|
-
SidebarFooter,
|
|
494
|
-
SidebarGroup,
|
|
495
|
-
SidebarGroupContent,
|
|
496
|
-
SidebarGroupLabel,
|
|
497
|
-
SidebarHeader,
|
|
498
|
-
SidebarInset,
|
|
499
|
-
SidebarMenu,
|
|
500
|
-
SidebarMenuAction,
|
|
501
|
-
SidebarMenuButton,
|
|
502
|
-
SidebarMenuItem,
|
|
503
|
-
SidebarProvider,
|
|
504
|
-
SidebarSeparator,
|
|
505
|
-
SidebarTrigger,
|
|
506
|
-
useSidebar,
|
|
507
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
3
|
-
|
|
4
|
-
import { cn } from '../lib/utils';
|
|
5
|
-
|
|
6
|
-
const Slider = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof SliderPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
|
|
9
|
-
>(({ className, ...props }, ref) => (
|
|
10
|
-
<SliderPrimitive.Root
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn('relative flex w-full touch-none select-none items-center', className)}
|
|
13
|
-
{...props}
|
|
14
|
-
>
|
|
15
|
-
<SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
|
|
16
|
-
<SliderPrimitive.Range className="absolute h-full bg-primary" />
|
|
17
|
-
</SliderPrimitive.Track>
|
|
18
|
-
<SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
|
|
19
|
-
</SliderPrimitive.Root>
|
|
20
|
-
));
|
|
21
|
-
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
22
|
-
|
|
23
|
-
export { Slider };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Toaster as Sonner } from 'sonner';
|
|
2
|
-
|
|
3
|
-
type ToasterProps = React.ComponentProps<typeof Sonner>;
|
|
4
|
-
|
|
5
|
-
const Toaster = ({ ...props }: ToasterProps) => {
|
|
6
|
-
const isDark = document.documentElement.classList.contains('dark');
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<Sonner
|
|
10
|
-
theme={isDark ? 'dark' : 'light'}
|
|
11
|
-
className="toaster group"
|
|
12
|
-
toastOptions={{
|
|
13
|
-
classNames: {
|
|
14
|
-
toast:
|
|
15
|
-
'group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg',
|
|
16
|
-
description: 'group-[.toast]:text-muted-foreground',
|
|
17
|
-
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-foreground',
|
|
18
|
-
cancelButton: 'group-[.toast]:bg-muted group-[.toast]:text-muted-foreground',
|
|
19
|
-
},
|
|
20
|
-
}}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export { Toaster };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
3
|
-
import { cn } from '../lib/utils';
|
|
4
|
-
|
|
5
|
-
const Switch = React.forwardRef<
|
|
6
|
-
React.ComponentRef<typeof SwitchPrimitives.Root>,
|
|
7
|
-
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
8
|
-
>(({ className, ...props }, ref) => (
|
|
9
|
-
<SwitchPrimitives.Root
|
|
10
|
-
className={cn(
|
|
11
|
-
'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
|
|
12
|
-
className
|
|
13
|
-
)}
|
|
14
|
-
{...props}
|
|
15
|
-
ref={ref}
|
|
16
|
-
>
|
|
17
|
-
<SwitchPrimitives.Thumb
|
|
18
|
-
className={cn(
|
|
19
|
-
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0'
|
|
20
|
-
)}
|
|
21
|
-
/>
|
|
22
|
-
</SwitchPrimitives.Root>
|
|
23
|
-
));
|
|
24
|
-
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
25
|
-
|
|
26
|
-
export { Switch };
|
package/src/components/table.tsx
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cn } from '../lib/utils';
|
|
3
|
-
|
|
4
|
-
const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
|
|
5
|
-
({ className, ...props }, ref) => (
|
|
6
|
-
<div className="relative w-full overflow-auto">
|
|
7
|
-
<table ref={ref} className={cn('w-full caption-bottom text-sm', className)} {...props} />
|
|
8
|
-
</div>
|
|
9
|
-
)
|
|
10
|
-
);
|
|
11
|
-
Table.displayName = 'Table';
|
|
12
|
-
|
|
13
|
-
const TableHeader = React.forwardRef<
|
|
14
|
-
HTMLTableSectionElement,
|
|
15
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
16
|
-
>(({ className, ...props }, ref) => (
|
|
17
|
-
<thead
|
|
18
|
-
ref={ref}
|
|
19
|
-
className={cn('[&_tr]:border-b [&_tr]:border-border/50', className)}
|
|
20
|
-
{...props}
|
|
21
|
-
/>
|
|
22
|
-
));
|
|
23
|
-
TableHeader.displayName = 'TableHeader';
|
|
24
|
-
|
|
25
|
-
const TableBody = React.forwardRef<
|
|
26
|
-
HTMLTableSectionElement,
|
|
27
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
28
|
-
>(({ className, ...props }, ref) => (
|
|
29
|
-
<tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />
|
|
30
|
-
));
|
|
31
|
-
TableBody.displayName = 'TableBody';
|
|
32
|
-
|
|
33
|
-
const TableFooter = React.forwardRef<
|
|
34
|
-
HTMLTableSectionElement,
|
|
35
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
36
|
-
>(({ className, ...props }, ref) => (
|
|
37
|
-
<tfoot
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}
|
|
40
|
-
{...props}
|
|
41
|
-
/>
|
|
42
|
-
));
|
|
43
|
-
TableFooter.displayName = 'TableFooter';
|
|
44
|
-
|
|
45
|
-
const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
|
|
46
|
-
({ className, ...props }, ref) => (
|
|
47
|
-
<tr
|
|
48
|
-
ref={ref}
|
|
49
|
-
className={cn(
|
|
50
|
-
'border-b border-border/50 transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',
|
|
51
|
-
className
|
|
52
|
-
)}
|
|
53
|
-
{...props}
|
|
54
|
-
/>
|
|
55
|
-
)
|
|
56
|
-
);
|
|
57
|
-
TableRow.displayName = 'TableRow';
|
|
58
|
-
|
|
59
|
-
const TableHead = React.forwardRef<
|
|
60
|
-
HTMLTableCellElement,
|
|
61
|
-
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
62
|
-
>(({ className, ...props }, ref) => (
|
|
63
|
-
<th
|
|
64
|
-
ref={ref}
|
|
65
|
-
className={cn(
|
|
66
|
-
'h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0',
|
|
67
|
-
className
|
|
68
|
-
)}
|
|
69
|
-
{...props}
|
|
70
|
-
/>
|
|
71
|
-
));
|
|
72
|
-
TableHead.displayName = 'TableHead';
|
|
73
|
-
|
|
74
|
-
const TableCell = React.forwardRef<
|
|
75
|
-
HTMLTableCellElement,
|
|
76
|
-
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
77
|
-
>(({ className, ...props }, ref) => (
|
|
78
|
-
<td
|
|
79
|
-
ref={ref}
|
|
80
|
-
data-slot="table-cell"
|
|
81
|
-
className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)}
|
|
82
|
-
{...props}
|
|
83
|
-
/>
|
|
84
|
-
));
|
|
85
|
-
TableCell.displayName = 'TableCell';
|
|
86
|
-
|
|
87
|
-
const TableCaption = React.forwardRef<
|
|
88
|
-
HTMLTableCaptionElement,
|
|
89
|
-
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
90
|
-
>(({ className, ...props }, ref) => (
|
|
91
|
-
<caption ref={ref} className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />
|
|
92
|
-
));
|
|
93
|
-
TableCaption.displayName = 'TableCaption';
|
|
94
|
-
|
|
95
|
-
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
|