eai-frontend-components 2.0.5 → 2.0.7

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.
Files changed (104) hide show
  1. package/dist/index.esm.js +2 -2
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js +2 -2
  4. package/dist/index.js.map +1 -1
  5. package/package.json +3 -3
  6. package/src/components/ui/accordion.tsx +0 -48
  7. package/src/components/ui/alert-dialog.tsx +0 -138
  8. package/src/components/ui/alert.tsx +0 -36
  9. package/src/components/ui/avatar.tsx +0 -48
  10. package/src/components/ui/badge.tsx +0 -35
  11. package/src/components/ui/breadcrumb.tsx +0 -115
  12. package/src/components/ui/button.tsx +0 -43
  13. package/src/components/ui/calendar.tsx +0 -142
  14. package/src/components/ui/card.tsx +0 -35
  15. package/src/components/ui/carousel.tsx +0 -257
  16. package/src/components/ui/chart.tsx +0 -363
  17. package/src/components/ui/checkbox.tsx +0 -26
  18. package/src/components/ui/collapsible.tsx +0 -9
  19. package/src/components/ui/command.tsx +0 -145
  20. package/src/components/ui/context-menu.tsx +0 -198
  21. package/src/components/ui/custom/date-picker.tsx +0 -97
  22. package/src/components/ui/custom/form/checkbox.tsx +0 -53
  23. package/src/components/ui/custom/form/color.tsx +0 -140
  24. package/src/components/ui/custom/form/combobox.tsx +0 -259
  25. package/src/components/ui/custom/form/cpf-cnpj.tsx +0 -85
  26. package/src/components/ui/custom/form/currency.tsx +0 -51
  27. package/src/components/ui/custom/form/date-range.tsx +0 -110
  28. package/src/components/ui/custom/form/date.tsx +0 -109
  29. package/src/components/ui/custom/form/decimal.tsx +0 -50
  30. package/src/components/ui/custom/form/file.tsx +0 -65
  31. package/src/components/ui/custom/form/form-help-text.tsx +0 -20
  32. package/src/components/ui/custom/form/form-label.tsx +0 -24
  33. package/src/components/ui/custom/form/form-message.tsx +0 -10
  34. package/src/components/ui/custom/form/ghost.tsx +0 -28
  35. package/src/components/ui/custom/form/input.tsx +0 -69
  36. package/src/components/ui/custom/form/mask.tsx +0 -78
  37. package/src/components/ui/custom/form/multi-select.tsx +0 -209
  38. package/src/components/ui/custom/form/password.tsx +0 -70
  39. package/src/components/ui/custom/form/percent.tsx +0 -52
  40. package/src/components/ui/custom/form/phone.tsx +0 -79
  41. package/src/components/ui/custom/form/radio-group.tsx +0 -94
  42. package/src/components/ui/custom/form/select.tsx +0 -62
  43. package/src/components/ui/custom/form/step-new-form.tsx +0 -49
  44. package/src/components/ui/custom/form/switch.tsx +0 -51
  45. package/src/components/ui/custom/form/text.tsx +0 -71
  46. package/src/components/ui/custom/form/textarea.tsx +0 -71
  47. package/src/components/ui/custom/form/utils.ts +0 -100
  48. package/src/components/ui/custom/header.tsx +0 -128
  49. package/src/components/ui/custom/label.tsx +0 -79
  50. package/src/components/ui/custom/not-found.tsx +0 -30
  51. package/src/components/ui/custom/sidebar/module-switcher.tsx +0 -58
  52. package/src/components/ui/custom/sidebar/nav-footer.tsx +0 -35
  53. package/src/components/ui/custom/sidebar/nav-main.tsx +0 -64
  54. package/src/components/ui/custom/sidebar/nav-submenu-collapsible.tsx +0 -60
  55. package/src/components/ui/custom/sidebar/nav-submenu-dropdown.tsx +0 -56
  56. package/src/components/ui/custom/sidebar/nav-user.tsx +0 -77
  57. package/src/components/ui/custom/sidebar/sidebar-button.tsx +0 -30
  58. package/src/components/ui/custom/sidebar/sidebar-item-two-lines.tsx +0 -25
  59. package/src/components/ui/custom/sidebar/sidebar-item.tsx +0 -19
  60. package/src/components/ui/custom/sidebar/types/sidebar.ts +0 -31
  61. package/src/components/ui/custom/table/data-table-export.tsx +0 -126
  62. package/src/components/ui/custom/table/data-table-footer.tsx +0 -148
  63. package/src/components/ui/custom/table/data-table-header.tsx +0 -58
  64. package/src/components/ui/custom/table/data-table-rows.tsx +0 -94
  65. package/src/components/ui/custom/table/data-table.tsx +0 -285
  66. package/src/components/ui/custom/table/types/data-table.ts +0 -31
  67. package/src/components/ui/custom/theme-provider.tsx +0 -121
  68. package/src/components/ui/dateRangePicker.tsx +0 -63
  69. package/src/components/ui/dialog.tsx +0 -84
  70. package/src/components/ui/drawer.tsx +0 -116
  71. package/src/components/ui/dropdown-menu.tsx +0 -173
  72. package/src/components/ui/form.tsx +0 -114
  73. package/src/components/ui/hover-card.tsx +0 -27
  74. package/src/components/ui/input.tsx +0 -265
  75. package/src/components/ui/label.tsx +0 -15
  76. package/src/components/ui/masks.ts +0 -35
  77. package/src/components/ui/pagination.tsx +0 -78
  78. package/src/components/ui/popover.tsx +0 -32
  79. package/src/components/ui/progress.tsx +0 -22
  80. package/src/components/ui/radio-group.tsx +0 -36
  81. package/src/components/ui/scroll-area.tsx +0 -46
  82. package/src/components/ui/select.tsx +0 -130
  83. package/src/components/ui/separator.tsx +0 -29
  84. package/src/components/ui/sheet.tsx +0 -90
  85. package/src/components/ui/sidebar.tsx +0 -598
  86. package/src/components/ui/skeleton.tsx +0 -15
  87. package/src/components/ui/slider.tsx +0 -18
  88. package/src/components/ui/switch.tsx +0 -26
  89. package/src/components/ui/table.tsx +0 -53
  90. package/src/components/ui/tabs.tsx +0 -47
  91. package/src/components/ui/textarea.tsx +0 -27
  92. package/src/components/ui/toast.tsx +0 -88
  93. package/src/components/ui/toaster.tsx +0 -49
  94. package/src/components/ui/tooltip.tsx +0 -31
  95. package/src/components/ui/use-calendar.tsx +0 -61
  96. package/src/components/ui/use-toast.ts +0 -186
  97. package/src/hooks/use-mobile.tsx +0 -19
  98. package/src/index.ts +0 -299
  99. package/src/lib/help/date-utils.ts +0 -41
  100. package/src/lib/help/format.ts +0 -171
  101. package/src/lib/help/theme.ts +0 -346
  102. package/src/lib/help/uuid.ts +0 -4
  103. package/src/lib/utils.ts +0 -6
  104. package/src/styles/globals.css +0 -59
@@ -1,598 +0,0 @@
1
- import { Slot } from '@radix-ui/react-slot';
2
- import { VariantProps, cva } from 'class-variance-authority';
3
- import { PanelLeft } from 'lucide-react';
4
- import * as React from 'react';
5
- import { useIsMobile } from '../../hooks/use-mobile';
6
- import { cn } from '../../lib/utils';
7
- import { Button } from './button';
8
- import { Input } from './input';
9
- import { Separator } from './separator';
10
- import { Sheet, SheetContent } from './sheet';
11
- import { Skeleton } from './skeleton';
12
- import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip';
13
-
14
- const SIDEBAR_COOKIE_NAME = 'sidebar:state';
15
- const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
16
- const SIDEBAR_WIDTH = '16rem';
17
- const SIDEBAR_WIDTH_MOBILE = '18rem';
18
- const SIDEBAR_WIDTH_ICON = '3rem';
19
- const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
20
-
21
- type SidebarContext = {
22
- state: 'expanded' | 'collapsed';
23
- open: boolean;
24
- setOpen: (open: boolean) => void;
25
- openMobile: boolean;
26
- setOpenMobile: (open: boolean) => void;
27
- isMobile: boolean;
28
- toggleSidebar: () => void;
29
- };
30
-
31
- const SidebarContext = React.createContext<SidebarContext | null>(null);
32
-
33
- function useSidebar() {
34
- const context = React.useContext(SidebarContext);
35
- if (!context) {
36
- throw new Error('useSidebar must be used within a SidebarProvider.');
37
- }
38
-
39
- return context;
40
- }
41
-
42
- const SidebarProvider = React.forwardRef<
43
- HTMLDivElement,
44
- React.ComponentProps<'div'> & {
45
- defaultOpen?: boolean;
46
- open?: boolean;
47
- onOpenChange?: (open: boolean) => void;
48
- }
49
- >(({ defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }, ref) => {
50
- const isMobile = useIsMobile();
51
- const [openMobile, setOpenMobile] = React.useState(false);
52
-
53
- // This is the internal state of the sidebar.
54
- // We use openProp and setOpenProp for control from outside the component.
55
- const [_open, _setOpen] = React.useState(defaultOpen);
56
- const open = openProp ?? _open;
57
- const setOpen = React.useCallback(
58
- (value: boolean | ((value: boolean) => boolean)) => {
59
- const openState = typeof value === 'function' ? value(open) : value;
60
- if (setOpenProp) {
61
- setOpenProp(openState);
62
- } else {
63
- _setOpen(openState);
64
- }
65
-
66
- // This sets the cookie to keep the sidebar state.
67
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
68
- },
69
- [setOpenProp, open],
70
- );
71
-
72
- // Helper to toggle the sidebar.
73
- const toggleSidebar = React.useCallback(() => {
74
- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
75
- }, [isMobile, setOpen, setOpenMobile]);
76
-
77
- // Adds a keyboard shortcut to toggle the sidebar.
78
- React.useEffect(() => {
79
- const handleKeyDown = (event: KeyboardEvent) => {
80
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
81
- event.preventDefault();
82
- toggleSidebar();
83
- }
84
- };
85
-
86
- window.addEventListener('keydown', handleKeyDown);
87
- return () => window.removeEventListener('keydown', handleKeyDown);
88
- }, [toggleSidebar]);
89
-
90
- // We add a state so that we can do data-state="expanded" or "collapsed".
91
- // This makes it easier to style the sidebar with Tailwind classes.
92
- const state = open ? 'expanded' : 'collapsed';
93
-
94
- const contextValue = React.useMemo<SidebarContext>(
95
- () => ({
96
- state,
97
- open,
98
- setOpen,
99
- isMobile,
100
- openMobile,
101
- setOpenMobile,
102
- toggleSidebar,
103
- }),
104
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
105
- );
106
-
107
- return (
108
- <SidebarContext.Provider value={contextValue}>
109
- <TooltipProvider delayDuration={0}>
110
- <div
111
- style={
112
- {
113
- '--sidebar-width': SIDEBAR_WIDTH,
114
- '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
115
- ...style,
116
- } as React.CSSProperties
117
- }
118
- className={cn('group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar', className)}
119
- ref={ref}
120
- {...props}
121
- >
122
- {children}
123
- </div>
124
- </TooltipProvider>
125
- </SidebarContext.Provider>
126
- );
127
- });
128
- SidebarProvider.displayName = 'SidebarProvider';
129
-
130
- const Sidebar = React.forwardRef<
131
- HTMLDivElement,
132
- React.ComponentProps<'div'> & {
133
- side?: 'left' | 'right';
134
- variant?: 'sidebar' | 'floating' | 'inset';
135
- collapsible?: 'offcanvas' | 'icon' | 'none';
136
- }
137
- >(({ side = 'left', variant = 'sidebar', collapsible = 'offcanvas', className, children, ...props }, ref) => {
138
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
139
-
140
- if (collapsible === 'none') {
141
- return (
142
- <div className={cn('flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground', className)} ref={ref} {...props}>
143
- {children}
144
- </div>
145
- );
146
- }
147
-
148
- if (isMobile) {
149
- return (
150
- <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
151
- <SheetContent
152
- data-sidebar='sidebar'
153
- data-mobile='true'
154
- className='w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden'
155
- style={
156
- {
157
- '--sidebar-width': SIDEBAR_WIDTH_MOBILE,
158
- } as React.CSSProperties
159
- }
160
- side={side}
161
- >
162
- <div className='flex h-screen w-full flex-col'>{children}</div>
163
- </SheetContent>
164
- </Sheet>
165
- );
166
- }
167
-
168
- return (
169
- <div
170
- ref={ref}
171
- className='group peer hidden md:block text-sidebar-foreground'
172
- data-state={state}
173
- data-collapsible={state === 'collapsed' ? collapsible : ''}
174
- data-variant={variant}
175
- data-side={side}
176
- >
177
- {/* This is what handles the sidebar gap on desktop */}
178
- <div
179
- className={cn(
180
- 'duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear',
181
- 'group-data-[collapsible=offcanvas]:w-0',
182
- 'group-data-[side=right]:rotate-180',
183
- variant === 'floating' || variant === 'inset'
184
- ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]'
185
- : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon]',
186
- )}
187
- />
188
- <div
189
- className={cn(
190
- 'duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex',
191
- side === 'left'
192
- ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
193
- : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
194
- // Adjust the padding for floating and inset variants.
195
- variant === 'floating' || variant === 'inset'
196
- ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]'
197
- : 'group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l',
198
- className,
199
- )}
200
- {...props}
201
- >
202
- <div
203
- data-sidebar='sidebar'
204
- 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'
205
- >
206
- {children}
207
- </div>
208
- </div>
209
- </div>
210
- );
211
- });
212
- Sidebar.displayName = 'Sidebar';
213
-
214
- const SidebarTrigger = React.forwardRef<React.ElementRef<typeof Button>, React.ComponentProps<typeof Button>>(
215
- ({ className, onClick, ...props }, ref) => {
216
- const { toggleSidebar } = useSidebar();
217
-
218
- return (
219
- <Button
220
- ref={ref}
221
- data-sidebar='trigger'
222
- variant='ghost'
223
- size='icon'
224
- type='button'
225
- className={cn('h-7 w-7', className)}
226
- onClick={(event) => {
227
- onClick?.(event);
228
- toggleSidebar();
229
- }}
230
- {...props}
231
- >
232
- <PanelLeft />
233
- <span className='sr-only'>Toggle Sidebar</span>
234
- </Button>
235
- );
236
- },
237
- );
238
- SidebarTrigger.displayName = 'SidebarTrigger';
239
-
240
- const SidebarRail = React.forwardRef<HTMLButtonElement, React.ComponentProps<'button'>>(({ className, ...props }, ref) => {
241
- const { toggleSidebar } = useSidebar();
242
-
243
- return (
244
- <button
245
- ref={ref}
246
- data-sidebar='rail'
247
- aria-label='Toggle Sidebar'
248
- tabIndex={-1}
249
- type='button'
250
- onClick={toggleSidebar}
251
- title='Toggle Sidebar'
252
- className={cn(
253
- 'absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex',
254
- '[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize',
255
- '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
256
- 'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar',
257
- '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
258
- '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
259
- className,
260
- )}
261
- {...props}
262
- />
263
- );
264
- });
265
- SidebarRail.displayName = 'SidebarRail';
266
-
267
- const SidebarInset = React.forwardRef<HTMLDivElement, React.ComponentProps<'main'>>(({ className, ...props }, ref) => {
268
- return (
269
- <main
270
- ref={ref}
271
- className={cn(
272
- 'relative flex min-h-svh flex-1 flex-col bg-background',
273
- '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',
274
- className,
275
- )}
276
- {...props}
277
- />
278
- );
279
- });
280
- SidebarInset.displayName = 'SidebarInset';
281
-
282
- const SidebarInput = React.forwardRef<React.ElementRef<typeof Input>, React.ComponentProps<typeof Input>>(({ className, ...props }, ref) => {
283
- return (
284
- <Input
285
- ref={ref}
286
- data-sidebar='input'
287
- className={cn('h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring', className)}
288
- {...props}
289
- />
290
- );
291
- });
292
- SidebarInput.displayName = 'SidebarInput';
293
-
294
- const SidebarHeader = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
295
- return <div ref={ref} data-sidebar='header' className={cn('flex flex-col gap-2 p-2', className)} {...props} />;
296
- });
297
- SidebarHeader.displayName = 'SidebarHeader';
298
-
299
- const SidebarFooter = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
300
- return <div ref={ref} data-sidebar='footer' className={cn('flex flex-col gap-2 p-2', className)} {...props} />;
301
- });
302
- SidebarFooter.displayName = 'SidebarFooter';
303
-
304
- const SidebarSeparator = React.forwardRef<React.ElementRef<typeof Separator>, React.ComponentProps<typeof Separator>>(
305
- ({ className, ...props }, ref) => {
306
- return <Separator ref={ref} data-sidebar='separator' className={cn('mx-2 w-auto bg-sidebar-border', className)} {...props} />;
307
- },
308
- );
309
- SidebarSeparator.displayName = 'SidebarSeparator';
310
-
311
- const SidebarContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
312
- return (
313
- <div
314
- ref={ref}
315
- data-sidebar='content'
316
- className={cn('flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden', className)}
317
- {...props}
318
- />
319
- );
320
- });
321
- SidebarContent.displayName = 'SidebarContent';
322
-
323
- const SidebarGroup = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => {
324
- return <div ref={ref} data-sidebar='group' className={cn('relative flex w-full min-w-0 flex-col p-2', className)} {...props} />;
325
- });
326
- SidebarGroup.displayName = 'SidebarGroup';
327
-
328
- const SidebarGroupLabel = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'> & { asChild?: boolean }>(
329
- ({ className, asChild = false, ...props }, ref) => {
330
- const Comp = asChild ? Slot : 'div';
331
-
332
- return (
333
- <Comp
334
- ref={ref}
335
- data-sidebar='group-label'
336
- className={cn(
337
- 'duration-200 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] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
338
- 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
339
- className,
340
- )}
341
- {...props}
342
- />
343
- );
344
- },
345
- );
346
- SidebarGroupLabel.displayName = 'SidebarGroupLabel';
347
-
348
- const SidebarGroupAction = React.forwardRef<HTMLButtonElement, React.ComponentProps<'button'> & { asChild?: boolean }>(
349
- ({ className, asChild = false, ...props }, ref) => {
350
- const Comp = asChild ? Slot : 'button';
351
-
352
- return (
353
- <Comp
354
- ref={ref}
355
- data-sidebar='group-action'
356
- className={cn(
357
- 'absolute right-3 top-3.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 [&>svg]:size-4 [&>svg]:shrink-0',
358
- // Increases the hit area of the button on mobile.
359
- 'after:absolute after:-inset-2 after:md:hidden',
360
- 'group-data-[collapsible=icon]:hidden',
361
- className,
362
- )}
363
- {...props}
364
- />
365
- );
366
- },
367
- );
368
- SidebarGroupAction.displayName = 'SidebarGroupAction';
369
-
370
- const SidebarGroupContent = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => (
371
- <div ref={ref} data-sidebar='group-content' className={cn('w-full text-sm', className)} {...props} />
372
- ));
373
- SidebarGroupContent.displayName = 'SidebarGroupContent';
374
-
375
- const SidebarMenu = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'>>(({ className, ...props }, ref) => (
376
- <ul ref={ref} data-sidebar='menu' className={cn('flex w-full min-w-0 flex-col gap-1', className)} {...props} />
377
- ));
378
- SidebarMenu.displayName = 'SidebarMenu';
379
-
380
- const SidebarMenuItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li'>>(({ className, ...props }, ref) => (
381
- <li ref={ref} data-sidebar='menu-item' className={cn('group/menu-item relative', className)} {...props} />
382
- ));
383
- SidebarMenuItem.displayName = 'SidebarMenuItem';
384
-
385
- const sidebarMenuButtonVariants = cva(
386
- '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 active:bg-sidebar-accent active:text-sidebar-accent-foreground 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-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-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',
387
- {
388
- variants: {
389
- variant: {
390
- default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
391
- outline:
392
- 'bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',
393
- },
394
- size: {
395
- default: 'h-8 text-sm',
396
- sm: 'h-7 text-xs',
397
- lg: 'h-12 text-sm group-data-[collapsible=icon]:!p-0',
398
- },
399
- },
400
- defaultVariants: {
401
- variant: 'default',
402
- size: 'default',
403
- },
404
- },
405
- );
406
-
407
- const SidebarMenuButton = React.forwardRef<
408
- HTMLButtonElement,
409
- React.ComponentProps<'button'> & {
410
- asChild?: boolean;
411
- isActive?: boolean;
412
- tooltip?: string | React.ComponentProps<typeof TooltipContent>;
413
- } & VariantProps<typeof sidebarMenuButtonVariants>
414
- >(({ asChild = false, isActive = false, variant = 'default', size = 'default', tooltip, className, ...props }, ref) => {
415
- const Comp = asChild ? Slot : 'button';
416
- const { isMobile, state } = useSidebar();
417
-
418
- const button = (
419
- <Comp
420
- ref={ref}
421
- data-sidebar='menu-button'
422
- data-size={size}
423
- data-active={isActive}
424
- className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
425
- {...props}
426
- />
427
- );
428
-
429
- if (!tooltip) {
430
- return button;
431
- }
432
-
433
- if (typeof tooltip === 'string') {
434
- tooltip = {
435
- children: tooltip,
436
- };
437
- }
438
-
439
- return (
440
- <Tooltip>
441
- <TooltipTrigger asChild>{button}</TooltipTrigger>
442
- <TooltipContent side='right' align='center' hidden={state !== 'collapsed' || isMobile} {...tooltip} />
443
- </Tooltip>
444
- );
445
- });
446
- SidebarMenuButton.displayName = 'SidebarMenuButton';
447
-
448
- const SidebarMenuAction = React.forwardRef<
449
- HTMLButtonElement,
450
- React.ComponentProps<'button'> & {
451
- asChild?: boolean;
452
- showOnHover?: boolean;
453
- }
454
- >(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
455
- const Comp = asChild ? Slot : 'button';
456
-
457
- return (
458
- <Comp
459
- ref={ref}
460
- data-sidebar='menu-action'
461
- className={cn(
462
- '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',
463
- // Increases the hit area of the button on mobile.
464
- 'after:absolute after:-inset-2 after:md:hidden',
465
- 'peer-data-[size=sm]/menu-button:top-1',
466
- 'peer-data-[size=default]/menu-button:top-1.5',
467
- 'peer-data-[size=lg]/menu-button:top-2.5',
468
- 'group-data-[collapsible=icon]:hidden',
469
- showOnHover &&
470
- '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',
471
- className,
472
- )}
473
- {...props}
474
- />
475
- );
476
- });
477
- SidebarMenuAction.displayName = 'SidebarMenuAction';
478
-
479
- const SidebarMenuBadge = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(({ className, ...props }, ref) => (
480
- <div
481
- ref={ref}
482
- data-sidebar='menu-badge'
483
- className={cn(
484
- 'absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none',
485
- 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
486
- 'peer-data-[size=sm]/menu-button:top-1',
487
- 'peer-data-[size=default]/menu-button:top-1.5',
488
- 'peer-data-[size=lg]/menu-button:top-2.5',
489
- 'group-data-[collapsible=icon]:hidden',
490
- className,
491
- )}
492
- {...props}
493
- />
494
- ));
495
- SidebarMenuBadge.displayName = 'SidebarMenuBadge';
496
-
497
- const SidebarMenuSkeleton = React.forwardRef<
498
- HTMLDivElement,
499
- React.ComponentProps<'div'> & {
500
- showIcon?: boolean;
501
- }
502
- >(({ className, showIcon = false, ...props }, ref) => {
503
- // Random width between 50 to 90%.
504
- const width = React.useMemo(() => {
505
- return `${Math.floor(Math.random() * 40) + 50}%`;
506
- }, []);
507
-
508
- return (
509
- <div ref={ref} data-sidebar='menu-skeleton' className={cn('rounded-md h-8 flex gap-2 px-2 items-center', className)} {...props}>
510
- {showIcon && <Skeleton className='size-4 rounded-md' data-sidebar='menu-skeleton-icon' />}
511
- <Skeleton
512
- className='h-4 flex-1 max-w-[--skeleton-width]'
513
- data-sidebar='menu-skeleton-text'
514
- style={
515
- {
516
- '--skeleton-width': width,
517
- } as React.CSSProperties
518
- }
519
- />
520
- </div>
521
- );
522
- });
523
- SidebarMenuSkeleton.displayName = 'SidebarMenuSkeleton';
524
-
525
- const SidebarMenuSub = React.forwardRef<HTMLUListElement, React.ComponentProps<'ul'>>(({ className, ...props }, ref) => (
526
- <ul
527
- ref={ref}
528
- data-sidebar='menu-sub'
529
- className={cn(
530
- 'mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5',
531
- 'group-data-[collapsible=icon]:hidden',
532
- className,
533
- )}
534
- {...props}
535
- />
536
- ));
537
- SidebarMenuSub.displayName = 'SidebarMenuSub';
538
-
539
- const SidebarMenuSubItem = React.forwardRef<HTMLLIElement, React.ComponentProps<'li'>>(({ ...props }, ref) => <li ref={ref} {...props} />);
540
- SidebarMenuSubItem.displayName = 'SidebarMenuSubItem';
541
-
542
- const SidebarMenuSubButton = React.forwardRef<
543
- HTMLAnchorElement,
544
- React.ComponentProps<'a'> & {
545
- asChild?: boolean;
546
- size?: 'sm' | 'md';
547
- isActive?: boolean;
548
- }
549
- >(({ asChild = false, size = 'md', isActive, className, ...props }, ref) => {
550
- const Comp = asChild ? Slot : 'a';
551
-
552
- return (
553
- <Comp
554
- ref={ref}
555
- data-sidebar='menu-sub-button'
556
- data-size={size}
557
- data-active={isActive}
558
- className={cn(
559
- 'flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',
560
- 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
561
- size === 'sm' && 'text-xs',
562
- size === 'md' && 'text-sm',
563
- 'group-data-[collapsible=icon]:hidden',
564
- className,
565
- )}
566
- {...props}
567
- />
568
- );
569
- });
570
- SidebarMenuSubButton.displayName = 'SidebarMenuSubButton';
571
-
572
- export {
573
- Sidebar,
574
- SidebarContent,
575
- SidebarFooter,
576
- SidebarGroup,
577
- SidebarGroupAction,
578
- SidebarGroupContent,
579
- SidebarGroupLabel,
580
- SidebarHeader,
581
- SidebarInput,
582
- SidebarInset,
583
- SidebarMenu,
584
- SidebarMenuAction,
585
- SidebarMenuBadge,
586
- SidebarMenuButton,
587
- SidebarMenuItem,
588
- SidebarMenuSkeleton,
589
- SidebarMenuSub,
590
- SidebarMenuSubButton,
591
- SidebarMenuSubItem,
592
- SidebarProvider,
593
- SidebarRail,
594
- SidebarSeparator,
595
- SidebarTrigger,
596
- useSidebar
597
- };
598
-
@@ -1,15 +0,0 @@
1
- import { cn } from "@/lib/utils"
2
-
3
- function Skeleton({
4
- className,
5
- ...props
6
- }: React.HTMLAttributes<HTMLDivElement>) {
7
- return (
8
- <div
9
- className={cn("animate-pulse rounded-md bg-muted", className)}
10
- {...props}
11
- />
12
- )
13
- }
14
-
15
- export { Skeleton }
@@ -1,18 +0,0 @@
1
- import * as SliderPrimitive from '@radix-ui/react-slider';
2
- import * as React from 'react';
3
- import { cn } from '../../lib/utils';
4
-
5
- const Slider = React.forwardRef<React.ElementRef<typeof SliderPrimitive.Root>, React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>>(
6
- ({ className, ...props }, ref) => (
7
- <SliderPrimitive.Root ref={ref} className={cn('relative flex w-full touch-none select-none items-center', className)} {...props}>
8
- <SliderPrimitive.Track className='relative h-2 w-full grow overflow-hidden rounded-full bg-background-secondary'>
9
- <SliderPrimitive.Range className='absolute h-full bg-background-primary' />
10
- </SliderPrimitive.Track>
11
- <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' />
12
- </SliderPrimitive.Root>
13
- ),
14
- );
15
- Slider.displayName = SliderPrimitive.Root.displayName;
16
-
17
- export { Slider };
18
-
@@ -1,26 +0,0 @@
1
- import * as SwitchPrimitives from '@radix-ui/react-switch';
2
- import * as React from 'react';
3
- import { cn } from '../../lib/utils';
4
-
5
- const Switch = React.forwardRef<React.ElementRef<typeof SwitchPrimitives.Root>, React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>>(
6
- ({ className, ...props }, ref) => (
7
- <SwitchPrimitives.Root
8
- className={cn(
9
- '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-background-primary data-[state=unchecked]:bg-accent',
10
- className,
11
- )}
12
- {...props}
13
- ref={ref}
14
- >
15
- <SwitchPrimitives.Thumb
16
- className={cn(
17
- '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',
18
- )}
19
- />
20
- </SwitchPrimitives.Root>
21
- ),
22
- );
23
- Switch.displayName = SwitchPrimitives.Root.displayName;
24
-
25
- export { Switch };
26
-