@sqlrooms/ui 0.0.0 → 0.0.1-alpha.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/CHANGELOG.md +2 -0
- package/package.json +3 -5
- package/.turbo/turbo-build.log +0 -8
- package/.turbo/turbo-lint.log +0 -10
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/eslint.config.js +0 -4
- package/src/components/accordion.tsx +0 -55
- package/src/components/alert.tsx +0 -59
- package/src/components/badge.tsx +0 -34
- package/src/components/breadcrumb.tsx +0 -115
- package/src/components/button.tsx +0 -55
- package/src/components/card.tsx +0 -76
- package/src/components/checkbox.tsx +0 -28
- package/src/components/dialog.tsx +0 -120
- package/src/components/dropdown-menu.tsx +0 -199
- package/src/components/editable-text.tsx +0 -199
- package/src/components/error-boundary.tsx +0 -48
- package/src/components/error-pane.tsx +0 -81
- package/src/components/form.tsx +0 -176
- package/src/components/input.tsx +0 -22
- package/src/components/label.tsx +0 -24
- package/src/components/popover.tsx +0 -31
- package/src/components/progress-modal.tsx +0 -33
- package/src/components/progress.tsx +0 -26
- package/src/components/resizable.tsx +0 -43
- package/src/components/select.tsx +0 -157
- package/src/components/skeleton-pane.tsx +0 -45
- package/src/components/skeleton.tsx +0 -12
- package/src/components/spinner-pane.tsx +0 -44
- package/src/components/spinner.tsx +0 -16
- package/src/components/switch.tsx +0 -27
- package/src/components/table.tsx +0 -136
- package/src/components/tabs.tsx +0 -53
- package/src/components/textarea.tsx +0 -21
- package/src/components/toast.tsx +0 -127
- package/src/components/toaster.tsx +0 -33
- package/src/components/tooltip.tsx +0 -29
- package/src/hooks/use-toast.ts +0 -191
- package/src/hooks/useDisclosure.ts +0 -26
- package/src/index.ts +0 -35
- package/src/lib/utils.ts +0 -6
- package/src/tailwind-preset.css +0 -68
- package/src/tailwind-preset.ts +0 -55
- package/tsconfig.json +0 -12
package/src/components/input.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {cn} from '../lib/utils';
|
|
4
|
-
|
|
5
|
-
const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<'input'>>(
|
|
6
|
-
({className, type, ...props}, ref) => {
|
|
7
|
-
return (
|
|
8
|
-
<input
|
|
9
|
-
type={type}
|
|
10
|
-
className={cn(
|
|
11
|
-
'flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
|
|
12
|
-
className,
|
|
13
|
-
)}
|
|
14
|
-
ref={ref}
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
},
|
|
19
|
-
);
|
|
20
|
-
Input.displayName = 'Input';
|
|
21
|
-
|
|
22
|
-
export {Input};
|
package/src/components/label.tsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
-
import {cva, type VariantProps} from 'class-variance-authority';
|
|
4
|
-
|
|
5
|
-
import {cn} from '../lib/utils';
|
|
6
|
-
|
|
7
|
-
const labelVariants = cva(
|
|
8
|
-
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
const Label = React.forwardRef<
|
|
12
|
-
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
13
|
-
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
|
14
|
-
VariantProps<typeof labelVariants>
|
|
15
|
-
>(({className, ...props}, ref) => (
|
|
16
|
-
<LabelPrimitive.Root
|
|
17
|
-
ref={ref}
|
|
18
|
-
className={cn(labelVariants(), className)}
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
));
|
|
22
|
-
Label.displayName = LabelPrimitive.Root.displayName;
|
|
23
|
-
|
|
24
|
-
export {Label};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
3
|
-
|
|
4
|
-
import {cn} from '../lib/utils';
|
|
5
|
-
|
|
6
|
-
const Popover = PopoverPrimitive.Root;
|
|
7
|
-
|
|
8
|
-
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
9
|
-
|
|
10
|
-
const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
11
|
-
|
|
12
|
-
const PopoverContent = React.forwardRef<
|
|
13
|
-
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
14
|
-
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
|
15
|
-
>(({className, align = 'center', sideOffset = 4, ...props}, ref) => (
|
|
16
|
-
<PopoverPrimitive.Portal>
|
|
17
|
-
<PopoverPrimitive.Content
|
|
18
|
-
ref={ref}
|
|
19
|
-
align={align}
|
|
20
|
-
sideOffset={sideOffset}
|
|
21
|
-
className={cn(
|
|
22
|
-
'z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
23
|
-
className,
|
|
24
|
-
)}
|
|
25
|
-
{...props}
|
|
26
|
-
/>
|
|
27
|
-
</PopoverPrimitive.Portal>
|
|
28
|
-
));
|
|
29
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
30
|
-
|
|
31
|
-
export {Popover, PopoverTrigger, PopoverContent, PopoverAnchor};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {FC} from 'react';
|
|
2
|
-
import {Dialog, DialogContent, DialogHeader, DialogTitle} from './dialog';
|
|
3
|
-
import {Progress} from './progress';
|
|
4
|
-
|
|
5
|
-
type Props = {
|
|
6
|
-
isOpen: boolean;
|
|
7
|
-
title?: string;
|
|
8
|
-
loadingStage?: string;
|
|
9
|
-
progress?: number;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const ProgressModal: FC<Props> = (props) => {
|
|
13
|
-
const {isOpen, title, loadingStage, progress} = props;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<Dialog open={isOpen} onOpenChange={() => {}}>
|
|
17
|
-
<DialogContent className="sm:max-w-[425px]">
|
|
18
|
-
<DialogHeader>
|
|
19
|
-
<DialogTitle>{title ?? ''}</DialogTitle>
|
|
20
|
-
</DialogHeader>
|
|
21
|
-
<div className="flex flex-col gap-2">
|
|
22
|
-
<Progress value={progress} className="w-full" />
|
|
23
|
-
<div className="flex justify-between text-sm text-muted-foreground">
|
|
24
|
-
<span>{loadingStage ?? ''}</span>
|
|
25
|
-
{progress ? <span>{progress}%</span> : null}
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</DialogContent>
|
|
29
|
-
</Dialog>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export {ProgressModal};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
3
|
-
|
|
4
|
-
import {cn} from '../lib/utils';
|
|
5
|
-
|
|
6
|
-
const Progress = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof ProgressPrimitive.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
|
|
9
|
-
>(({className, value, ...props}, ref) => (
|
|
10
|
-
<ProgressPrimitive.Root
|
|
11
|
-
ref={ref}
|
|
12
|
-
className={cn(
|
|
13
|
-
'relative h-2 w-full overflow-hidden rounded-full bg-primary/20',
|
|
14
|
-
className,
|
|
15
|
-
)}
|
|
16
|
-
{...props}
|
|
17
|
-
>
|
|
18
|
-
<ProgressPrimitive.Indicator
|
|
19
|
-
className="h-full w-full flex-1 bg-primary transition-all"
|
|
20
|
-
style={{transform: `translateX(-${100 - (value || 0)}%)`}}
|
|
21
|
-
/>
|
|
22
|
-
</ProgressPrimitive.Root>
|
|
23
|
-
));
|
|
24
|
-
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
25
|
-
|
|
26
|
-
export {Progress};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {GripVertical} from 'lucide-react';
|
|
2
|
-
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
3
|
-
|
|
4
|
-
import {cn} from '../lib/utils';
|
|
5
|
-
|
|
6
|
-
const ResizablePanelGroup = ({
|
|
7
|
-
className,
|
|
8
|
-
...props
|
|
9
|
-
}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
|
|
10
|
-
<ResizablePrimitive.PanelGroup
|
|
11
|
-
className={cn(
|
|
12
|
-
'flex h-full w-full data-[panel-group-direction=vertical]:flex-col',
|
|
13
|
-
className,
|
|
14
|
-
)}
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
const ResizablePanel = ResizablePrimitive.Panel;
|
|
20
|
-
|
|
21
|
-
const ResizableHandle = ({
|
|
22
|
-
withHandle,
|
|
23
|
-
className,
|
|
24
|
-
...props
|
|
25
|
-
}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
|
|
26
|
-
withHandle?: boolean;
|
|
27
|
-
}) => (
|
|
28
|
-
<ResizablePrimitive.PanelResizeHandle
|
|
29
|
-
className={cn(
|
|
30
|
-
'relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90',
|
|
31
|
-
className,
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
>
|
|
35
|
-
{withHandle && (
|
|
36
|
-
<div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
|
|
37
|
-
<GripVertical className="h-2.5 w-2.5" />
|
|
38
|
-
</div>
|
|
39
|
-
)}
|
|
40
|
-
</ResizablePrimitive.PanelResizeHandle>
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
export {ResizablePanelGroup, ResizablePanel, ResizableHandle};
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
3
|
-
import {Check, ChevronDown, ChevronUp} from 'lucide-react';
|
|
4
|
-
|
|
5
|
-
import {cn} from '../lib/utils';
|
|
6
|
-
|
|
7
|
-
const Select = SelectPrimitive.Root;
|
|
8
|
-
|
|
9
|
-
const SelectGroup = SelectPrimitive.Group;
|
|
10
|
-
|
|
11
|
-
const SelectValue = SelectPrimitive.Value;
|
|
12
|
-
|
|
13
|
-
const SelectTrigger = React.forwardRef<
|
|
14
|
-
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
16
|
-
>(({className, children, ...props}, ref) => (
|
|
17
|
-
<SelectPrimitive.Trigger
|
|
18
|
-
ref={ref}
|
|
19
|
-
className={cn(
|
|
20
|
-
'flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
>
|
|
25
|
-
{children}
|
|
26
|
-
<SelectPrimitive.Icon asChild>
|
|
27
|
-
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
28
|
-
</SelectPrimitive.Icon>
|
|
29
|
-
</SelectPrimitive.Trigger>
|
|
30
|
-
));
|
|
31
|
-
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
32
|
-
|
|
33
|
-
const SelectScrollUpButton = React.forwardRef<
|
|
34
|
-
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
35
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
36
|
-
>(({className, ...props}, ref) => (
|
|
37
|
-
<SelectPrimitive.ScrollUpButton
|
|
38
|
-
ref={ref}
|
|
39
|
-
className={cn(
|
|
40
|
-
'flex cursor-default items-center justify-center py-1',
|
|
41
|
-
className,
|
|
42
|
-
)}
|
|
43
|
-
{...props}
|
|
44
|
-
>
|
|
45
|
-
<ChevronUp className="h-4 w-4" />
|
|
46
|
-
</SelectPrimitive.ScrollUpButton>
|
|
47
|
-
));
|
|
48
|
-
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
49
|
-
|
|
50
|
-
const SelectScrollDownButton = React.forwardRef<
|
|
51
|
-
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
52
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
53
|
-
>(({className, ...props}, ref) => (
|
|
54
|
-
<SelectPrimitive.ScrollDownButton
|
|
55
|
-
ref={ref}
|
|
56
|
-
className={cn(
|
|
57
|
-
'flex cursor-default items-center justify-center py-1',
|
|
58
|
-
className,
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
>
|
|
62
|
-
<ChevronDown className="h-4 w-4" />
|
|
63
|
-
</SelectPrimitive.ScrollDownButton>
|
|
64
|
-
));
|
|
65
|
-
SelectScrollDownButton.displayName =
|
|
66
|
-
SelectPrimitive.ScrollDownButton.displayName;
|
|
67
|
-
|
|
68
|
-
const SelectContent = React.forwardRef<
|
|
69
|
-
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
70
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
71
|
-
>(({className, children, position = 'popper', ...props}, ref) => (
|
|
72
|
-
<SelectPrimitive.Portal>
|
|
73
|
-
<SelectPrimitive.Content
|
|
74
|
-
ref={ref}
|
|
75
|
-
className={cn(
|
|
76
|
-
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
77
|
-
position === 'popper' &&
|
|
78
|
-
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
79
|
-
className,
|
|
80
|
-
)}
|
|
81
|
-
position={position}
|
|
82
|
-
{...props}
|
|
83
|
-
>
|
|
84
|
-
<SelectScrollUpButton />
|
|
85
|
-
<SelectPrimitive.Viewport
|
|
86
|
-
className={cn(
|
|
87
|
-
'p-1',
|
|
88
|
-
position === 'popper' &&
|
|
89
|
-
'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]',
|
|
90
|
-
)}
|
|
91
|
-
>
|
|
92
|
-
{children}
|
|
93
|
-
</SelectPrimitive.Viewport>
|
|
94
|
-
<SelectScrollDownButton />
|
|
95
|
-
</SelectPrimitive.Content>
|
|
96
|
-
</SelectPrimitive.Portal>
|
|
97
|
-
));
|
|
98
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
99
|
-
|
|
100
|
-
const SelectLabel = React.forwardRef<
|
|
101
|
-
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
102
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
103
|
-
>(({className, ...props}, ref) => (
|
|
104
|
-
<SelectPrimitive.Label
|
|
105
|
-
ref={ref}
|
|
106
|
-
className={cn('px-2 py-1.5 text-sm font-semibold', className)}
|
|
107
|
-
{...props}
|
|
108
|
-
/>
|
|
109
|
-
));
|
|
110
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
111
|
-
|
|
112
|
-
const SelectItem = React.forwardRef<
|
|
113
|
-
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
114
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
115
|
-
>(({className, children, ...props}, ref) => (
|
|
116
|
-
<SelectPrimitive.Item
|
|
117
|
-
ref={ref}
|
|
118
|
-
className={cn(
|
|
119
|
-
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
120
|
-
className,
|
|
121
|
-
)}
|
|
122
|
-
{...props}
|
|
123
|
-
>
|
|
124
|
-
<span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
125
|
-
<SelectPrimitive.ItemIndicator>
|
|
126
|
-
<Check className="h-4 w-4" />
|
|
127
|
-
</SelectPrimitive.ItemIndicator>
|
|
128
|
-
</span>
|
|
129
|
-
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
130
|
-
</SelectPrimitive.Item>
|
|
131
|
-
));
|
|
132
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
133
|
-
|
|
134
|
-
const SelectSeparator = React.forwardRef<
|
|
135
|
-
React.ElementRef<typeof SelectPrimitive.Separator>,
|
|
136
|
-
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
|
137
|
-
>(({className, ...props}, ref) => (
|
|
138
|
-
<SelectPrimitive.Separator
|
|
139
|
-
ref={ref}
|
|
140
|
-
className={cn('-mx-1 my-1 h-px bg-muted', className)}
|
|
141
|
-
{...props}
|
|
142
|
-
/>
|
|
143
|
-
));
|
|
144
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
145
|
-
|
|
146
|
-
export {
|
|
147
|
-
Select,
|
|
148
|
-
SelectGroup,
|
|
149
|
-
SelectValue,
|
|
150
|
-
SelectTrigger,
|
|
151
|
-
SelectContent,
|
|
152
|
-
SelectLabel,
|
|
153
|
-
SelectItem,
|
|
154
|
-
SelectSeparator,
|
|
155
|
-
SelectScrollUpButton,
|
|
156
|
-
SelectScrollDownButton,
|
|
157
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {cn} from '../lib/utils';
|
|
3
|
-
import {Skeleton} from './skeleton';
|
|
4
|
-
|
|
5
|
-
export type Props = {
|
|
6
|
-
n?: number;
|
|
7
|
-
staggeringDelay?: number;
|
|
8
|
-
rowHeight?: number | string;
|
|
9
|
-
className?: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const SkeletonPane: React.FC<Props> = ({
|
|
13
|
-
n = 3,
|
|
14
|
-
staggeringDelay = 200,
|
|
15
|
-
rowHeight = '20px',
|
|
16
|
-
className,
|
|
17
|
-
}) => {
|
|
18
|
-
const [count, setCount] = React.useState(0);
|
|
19
|
-
|
|
20
|
-
React.useEffect(() => {
|
|
21
|
-
if (count >= n) return;
|
|
22
|
-
|
|
23
|
-
const timer = setTimeout(() => {
|
|
24
|
-
setCount(count + 1);
|
|
25
|
-
}, staggeringDelay);
|
|
26
|
-
|
|
27
|
-
return () => clearTimeout(timer);
|
|
28
|
-
}, [count, n, staggeringDelay]);
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div className={cn('flex w-full flex-col justify-center', className)}>
|
|
32
|
-
<div className="flex flex-col gap-2">
|
|
33
|
-
{Array.from({length: n}).map((_, i) =>
|
|
34
|
-
i < count ? (
|
|
35
|
-
<Skeleton key={i} className="w-full" style={{height: rowHeight}} />
|
|
36
|
-
) : (
|
|
37
|
-
<div key={i} style={{height: rowHeight}} />
|
|
38
|
-
),
|
|
39
|
-
)}
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export {SkeletonPane};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {cn} from '../lib/utils';
|
|
2
|
-
|
|
3
|
-
function Skeleton({className, ...props}: React.HTMLAttributes<HTMLDivElement>) {
|
|
4
|
-
return (
|
|
5
|
-
<div
|
|
6
|
-
className={cn('animate-pulse rounded-md bg-primary/10', className)}
|
|
7
|
-
{...props}
|
|
8
|
-
/>
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {Skeleton};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {cn} from '../lib/utils';
|
|
3
|
-
import {Spinner} from './spinner';
|
|
4
|
-
|
|
5
|
-
export type SpinnerPaneProps = {
|
|
6
|
-
h?: number | string;
|
|
7
|
-
delayed?: boolean;
|
|
8
|
-
className?: string;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const DELAY = 500;
|
|
13
|
-
|
|
14
|
-
const SpinnerPane: React.FC<SpinnerPaneProps> = (props) => {
|
|
15
|
-
const {h, delayed, children, className, ...rest} = props;
|
|
16
|
-
const [isPlaying, setPlaying] = React.useState(!delayed);
|
|
17
|
-
|
|
18
|
-
React.useEffect(() => {
|
|
19
|
-
if (!isPlaying && delayed) {
|
|
20
|
-
const timer = setTimeout(() => setPlaying(true), DELAY);
|
|
21
|
-
return () => clearTimeout(timer);
|
|
22
|
-
}
|
|
23
|
-
}, [isPlaying, delayed]);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div
|
|
27
|
-
className={cn(
|
|
28
|
-
'mx-auto flex min-h-[inherit] items-center justify-center',
|
|
29
|
-
className,
|
|
30
|
-
)}
|
|
31
|
-
style={{minHeight: h}}
|
|
32
|
-
{...rest}
|
|
33
|
-
>
|
|
34
|
-
{isPlaying ? (
|
|
35
|
-
<div className="flex flex-col items-center gap-2">
|
|
36
|
-
{children}
|
|
37
|
-
<Spinner className="text-muted-foreground" />
|
|
38
|
-
</div>
|
|
39
|
-
) : null}
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export {SpinnerPane};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {FC} from 'react';
|
|
2
|
-
|
|
3
|
-
import {LoaderCircleIcon} from 'lucide-react';
|
|
4
|
-
import {cn} from '../lib/utils';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Loading spinner component
|
|
8
|
-
*/
|
|
9
|
-
export const Spinner: FC<{className?: string}> = ({className}) => {
|
|
10
|
-
return (
|
|
11
|
-
<LoaderCircleIcon
|
|
12
|
-
className={cn('animate-spin text-brand-primary', className)}
|
|
13
|
-
size={17}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
3
|
-
|
|
4
|
-
import {cn} from '../lib/utils';
|
|
5
|
-
|
|
6
|
-
const Switch = React.forwardRef<
|
|
7
|
-
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
8
|
-
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
9
|
-
>(({className, ...props}, ref) => (
|
|
10
|
-
<SwitchPrimitives.Root
|
|
11
|
-
className={cn(
|
|
12
|
-
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm 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',
|
|
13
|
-
className,
|
|
14
|
-
)}
|
|
15
|
-
{...props}
|
|
16
|
-
ref={ref}
|
|
17
|
-
>
|
|
18
|
-
<SwitchPrimitives.Thumb
|
|
19
|
-
className={cn(
|
|
20
|
-
'pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',
|
|
21
|
-
)}
|
|
22
|
-
/>
|
|
23
|
-
</SwitchPrimitives.Root>
|
|
24
|
-
));
|
|
25
|
-
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
26
|
-
|
|
27
|
-
export {Switch};
|
package/src/components/table.tsx
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {cn} from '../lib/utils';
|
|
4
|
-
|
|
5
|
-
interface TableProps extends React.HTMLAttributes<HTMLTableElement> {
|
|
6
|
-
/**
|
|
7
|
-
* The overflow-auto in shadcn's Table component is there to handle tables that might be wider
|
|
8
|
-
* than their container - it's a common pattern to ensure wide tables can be scrolled horizontally
|
|
9
|
-
* without breaking the layout. This prop allows you to disable this behavior, because it might
|
|
10
|
-
* cause issues with sticky headers.
|
|
11
|
-
*/
|
|
12
|
-
disableWrapper?: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const Table = React.forwardRef<HTMLTableElement, TableProps>(
|
|
16
|
-
({className, disableWrapper, ...props}, ref) =>
|
|
17
|
-
disableWrapper ? (
|
|
18
|
-
<table
|
|
19
|
-
ref={ref}
|
|
20
|
-
className={cn('w-full caption-bottom text-sm', className)}
|
|
21
|
-
{...props}
|
|
22
|
-
/>
|
|
23
|
-
) : (
|
|
24
|
-
<div className="relative w-full overflow-auto">
|
|
25
|
-
<table
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={cn('w-full caption-bottom text-sm', className)}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
</div>
|
|
31
|
-
),
|
|
32
|
-
);
|
|
33
|
-
Table.displayName = 'Table';
|
|
34
|
-
|
|
35
|
-
const TableHeader = React.forwardRef<
|
|
36
|
-
HTMLTableSectionElement,
|
|
37
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
38
|
-
>(({className, ...props}, ref) => (
|
|
39
|
-
<thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />
|
|
40
|
-
));
|
|
41
|
-
TableHeader.displayName = 'TableHeader';
|
|
42
|
-
|
|
43
|
-
const TableBody = React.forwardRef<
|
|
44
|
-
HTMLTableSectionElement,
|
|
45
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
46
|
-
>(({className, ...props}, ref) => (
|
|
47
|
-
<tbody
|
|
48
|
-
ref={ref}
|
|
49
|
-
className={cn('[&_tr:last-child]:border-0', className)}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
52
|
-
));
|
|
53
|
-
TableBody.displayName = 'TableBody';
|
|
54
|
-
|
|
55
|
-
const TableFooter = React.forwardRef<
|
|
56
|
-
HTMLTableSectionElement,
|
|
57
|
-
React.HTMLAttributes<HTMLTableSectionElement>
|
|
58
|
-
>(({className, ...props}, ref) => (
|
|
59
|
-
<tfoot
|
|
60
|
-
ref={ref}
|
|
61
|
-
className={cn(
|
|
62
|
-
'border-t bg-muted/50 font-medium [&>tr]:last:border-b-0',
|
|
63
|
-
className,
|
|
64
|
-
)}
|
|
65
|
-
{...props}
|
|
66
|
-
/>
|
|
67
|
-
));
|
|
68
|
-
TableFooter.displayName = 'TableFooter';
|
|
69
|
-
|
|
70
|
-
const TableRow = React.forwardRef<
|
|
71
|
-
HTMLTableRowElement,
|
|
72
|
-
React.HTMLAttributes<HTMLTableRowElement>
|
|
73
|
-
>(({className, ...props}, ref) => (
|
|
74
|
-
<tr
|
|
75
|
-
ref={ref}
|
|
76
|
-
className={cn(
|
|
77
|
-
'border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted',
|
|
78
|
-
className,
|
|
79
|
-
)}
|
|
80
|
-
{...props}
|
|
81
|
-
/>
|
|
82
|
-
));
|
|
83
|
-
TableRow.displayName = 'TableRow';
|
|
84
|
-
|
|
85
|
-
const TableHead = React.forwardRef<
|
|
86
|
-
HTMLTableCellElement,
|
|
87
|
-
React.ThHTMLAttributes<HTMLTableCellElement>
|
|
88
|
-
>(({className, ...props}, ref) => (
|
|
89
|
-
<th
|
|
90
|
-
ref={ref}
|
|
91
|
-
className={cn(
|
|
92
|
-
'h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
|
93
|
-
className,
|
|
94
|
-
)}
|
|
95
|
-
{...props}
|
|
96
|
-
/>
|
|
97
|
-
));
|
|
98
|
-
TableHead.displayName = 'TableHead';
|
|
99
|
-
|
|
100
|
-
const TableCell = React.forwardRef<
|
|
101
|
-
HTMLTableCellElement,
|
|
102
|
-
React.TdHTMLAttributes<HTMLTableCellElement>
|
|
103
|
-
>(({className, ...props}, ref) => (
|
|
104
|
-
<td
|
|
105
|
-
ref={ref}
|
|
106
|
-
className={cn(
|
|
107
|
-
'p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
|
|
108
|
-
className,
|
|
109
|
-
)}
|
|
110
|
-
{...props}
|
|
111
|
-
/>
|
|
112
|
-
));
|
|
113
|
-
TableCell.displayName = 'TableCell';
|
|
114
|
-
|
|
115
|
-
const TableCaption = React.forwardRef<
|
|
116
|
-
HTMLTableCaptionElement,
|
|
117
|
-
React.HTMLAttributes<HTMLTableCaptionElement>
|
|
118
|
-
>(({className, ...props}, ref) => (
|
|
119
|
-
<caption
|
|
120
|
-
ref={ref}
|
|
121
|
-
className={cn('mt-4 text-sm text-muted-foreground', className)}
|
|
122
|
-
{...props}
|
|
123
|
-
/>
|
|
124
|
-
));
|
|
125
|
-
TableCaption.displayName = 'TableCaption';
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
Table,
|
|
129
|
-
TableHeader,
|
|
130
|
-
TableBody,
|
|
131
|
-
TableFooter,
|
|
132
|
-
TableHead,
|
|
133
|
-
TableRow,
|
|
134
|
-
TableCell,
|
|
135
|
-
TableCaption,
|
|
136
|
-
};
|
package/src/components/tabs.tsx
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
|
-
|
|
4
|
-
import {cn} from '../lib/utils';
|
|
5
|
-
|
|
6
|
-
const Tabs = TabsPrimitive.Root;
|
|
7
|
-
|
|
8
|
-
const TabsList = React.forwardRef<
|
|
9
|
-
React.ElementRef<typeof TabsPrimitive.List>,
|
|
10
|
-
React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
|
|
11
|
-
>(({className, ...props}, ref) => (
|
|
12
|
-
<TabsPrimitive.List
|
|
13
|
-
ref={ref}
|
|
14
|
-
className={cn(
|
|
15
|
-
'inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground',
|
|
16
|
-
className,
|
|
17
|
-
)}
|
|
18
|
-
{...props}
|
|
19
|
-
/>
|
|
20
|
-
));
|
|
21
|
-
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
22
|
-
|
|
23
|
-
const TabsTrigger = React.forwardRef<
|
|
24
|
-
React.ElementRef<typeof TabsPrimitive.Trigger>,
|
|
25
|
-
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
|
|
26
|
-
>(({className, ...props}, ref) => (
|
|
27
|
-
<TabsPrimitive.Trigger
|
|
28
|
-
ref={ref}
|
|
29
|
-
className={cn(
|
|
30
|
-
'inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow',
|
|
31
|
-
className,
|
|
32
|
-
)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
));
|
|
36
|
-
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
37
|
-
|
|
38
|
-
const TabsContent = React.forwardRef<
|
|
39
|
-
React.ElementRef<typeof TabsPrimitive.Content>,
|
|
40
|
-
React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
|
|
41
|
-
>(({className, ...props}, ref) => (
|
|
42
|
-
<TabsPrimitive.Content
|
|
43
|
-
ref={ref}
|
|
44
|
-
className={cn(
|
|
45
|
-
'mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',
|
|
46
|
-
className,
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
));
|
|
51
|
-
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
52
|
-
|
|
53
|
-
export {Tabs, TabsList, TabsTrigger, TabsContent};
|