@codefast/ui 0.0.66 → 0.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +70 -102
- package/dist/chunk-DH3YP4ZC.cjs +0 -2
- package/dist/chunk-DH3YP4ZC.cjs.map +0 -1
- package/dist/chunk-DTSAQICV.js +0 -2
- package/dist/chunk-DTSAQICV.js.map +0 -1
- package/dist/chunk-NH6X3FON.js +0 -2
- package/dist/chunk-NH6X3FON.js.map +0 -1
- package/dist/chunk-P563ILDJ.cjs +0 -2
- package/dist/chunk-P563ILDJ.cjs.map +0 -1
- package/dist/chunk-VVA2EE5V.js +0 -2
- package/dist/chunk-VVA2EE5V.js.map +0 -1
- package/dist/chunk-VZ6P3BCB.cjs +0 -2
- package/dist/chunk-VZ6P3BCB.cjs.map +0 -1
- package/dist/hooks/use-media-query.cjs +0 -2
- package/dist/hooks/use-media-query.cjs.map +0 -1
- package/dist/hooks/use-media-query.d.cts +0 -3
- package/dist/hooks/use-media-query.d.ts +0 -3
- package/dist/hooks/use-media-query.js +0 -2
- package/dist/hooks/use-media-query.js.map +0 -1
- package/dist/hooks/use-mutation-observer.cjs +0 -2
- package/dist/hooks/use-mutation-observer.cjs.map +0 -1
- package/dist/hooks/use-mutation-observer.d.cts +0 -5
- package/dist/hooks/use-mutation-observer.d.ts +0 -5
- package/dist/hooks/use-mutation-observer.js +0 -2
- package/dist/hooks/use-mutation-observer.js.map +0 -1
- package/dist/lib/colors.cjs +0 -2
- package/dist/lib/colors.cjs.map +0 -1
- package/dist/lib/colors.d.cts +0 -1759
- package/dist/lib/colors.d.ts +0 -1759
- package/dist/lib/colors.js +0 -2
- package/dist/lib/colors.js.map +0 -1
- package/dist/plugin/animate.plugin.cjs +0 -2
- package/dist/plugin/animate.plugin.cjs.map +0 -1
- package/dist/plugin/animate.plugin.js +0 -2
- package/dist/plugin/animate.plugin.js.map +0 -1
- package/dist/plugin/base.plugin.cjs +0 -2
- package/dist/plugin/base.plugin.cjs.map +0 -1
- package/dist/plugin/base.plugin.js +0 -2
- package/dist/plugin/base.plugin.js.map +0 -1
- package/dist/plugin/perspective.plugin.cjs +0 -2
- package/dist/plugin/perspective.plugin.cjs.map +0 -1
- package/dist/plugin/perspective.plugin.js +0 -2
- package/dist/plugin/perspective.plugin.js.map +0 -1
- package/dist/tailwind.config.cjs +0 -2
- package/dist/tailwind.config.cjs.map +0 -1
- package/dist/tailwind.config.js +0 -2
- package/dist/tailwind.config.js.map +0 -1
- package/plugin/animate.plugin.ts +0 -319
- package/plugin/base.plugin.ts +0 -21
- package/plugin/perspective.plugin.ts +0 -11
- package/src/hooks/use-media-query.ts +0 -22
- package/src/hooks/use-mutation-observer.ts +0 -26
- package/src/lib/colors.ts +0 -1757
- package/src/lib/utils.ts +0 -6
- package/src/react/accordion.tsx +0 -88
- package/src/react/alert-dialog.tsx +0 -185
- package/src/react/alert.tsx +0 -73
- package/src/react/aspect-ratio.tsx +0 -17
- package/src/react/avatar.tsx +0 -60
- package/src/react/badge.tsx +0 -39
- package/src/react/blockquote.tsx +0 -26
- package/src/react/box.tsx +0 -34
- package/src/react/breadcrumb.tsx +0 -154
- package/src/react/button.tsx +0 -94
- package/src/react/calendar.tsx +0 -79
- package/src/react/card.tsx +0 -109
- package/src/react/carousel.tsx +0 -299
- package/src/react/checkbox-cards.tsx +0 -61
- package/src/react/checkbox-group.primitive.tsx +0 -206
- package/src/react/checkbox-group.tsx +0 -55
- package/src/react/checkbox.tsx +0 -36
- package/src/react/code.tsx +0 -26
- package/src/react/collapsible.tsx +0 -54
- package/src/react/command.tsx +0 -209
- package/src/react/container.tsx +0 -29
- package/src/react/context-menu.tsx +0 -306
- package/src/react/data-table.tsx +0 -249
- package/src/react/dialog.tsx +0 -160
- package/src/react/drawer.tsx +0 -136
- package/src/react/dropdown-menu.tsx +0 -290
- package/src/react/em.tsx +0 -26
- package/src/react/form.tsx +0 -234
- package/src/react/heading.tsx +0 -29
- package/src/react/hover-card.tsx +0 -75
- package/src/react/input-otp.tsx +0 -120
- package/src/react/input.tsx +0 -145
- package/src/react/kbd.tsx +0 -36
- package/src/react/label.tsx +0 -31
- package/src/react/menubar.tsx +0 -322
- package/src/react/navigation-menu.tsx +0 -192
- package/src/react/pagination.tsx +0 -150
- package/src/react/popover.tsx +0 -84
- package/src/react/pre.tsx +0 -26
- package/src/react/progress.tsx +0 -35
- package/src/react/quote.tsx +0 -26
- package/src/react/radio-cards.tsx +0 -48
- package/src/react/radio-group.tsx +0 -50
- package/src/react/radio.tsx +0 -40
- package/src/react/resizable.tsx +0 -62
- package/src/react/scroll-area.tsx +0 -106
- package/src/react/section.tsx +0 -26
- package/src/react/select.tsx +0 -219
- package/src/react/separator.tsx +0 -32
- package/src/react/sheet.tsx +0 -178
- package/src/react/skeleton.tsx +0 -18
- package/src/react/slider.tsx +0 -41
- package/src/react/sonner.tsx +0 -40
- package/src/react/spinner.tsx +0 -68
- package/src/react/strong.tsx +0 -26
- package/src/react/switch.tsx +0 -33
- package/src/react/table.tsx +0 -148
- package/src/react/tabs.tsx +0 -87
- package/src/react/text-input.tsx +0 -36
- package/src/react/text.tsx +0 -34
- package/src/react/textarea.tsx +0 -30
- package/src/react/toggle-group.tsx +0 -84
- package/src/react/toggle.tsx +0 -49
- package/src/react/tooltip.tsx +0 -83
- package/src/styles/styles.css +0 -3
- package/tailwind.config.ts +0 -126
package/src/react/data-table.tsx
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
ArrowDownIcon,
|
|
6
|
-
ArrowUpIcon,
|
|
7
|
-
CaretSortIcon,
|
|
8
|
-
ChevronLeftIcon,
|
|
9
|
-
ChevronRightIcon,
|
|
10
|
-
DoubleArrowLeftIcon,
|
|
11
|
-
DoubleArrowRightIcon,
|
|
12
|
-
EyeNoneIcon,
|
|
13
|
-
MixerHorizontalIcon,
|
|
14
|
-
} from '@radix-ui/react-icons';
|
|
15
|
-
import type * as ReactTable from '@tanstack/react-table';
|
|
16
|
-
import { cn } from '../lib/utils';
|
|
17
|
-
import {
|
|
18
|
-
DropdownMenu,
|
|
19
|
-
DropdownMenuCheckboxItem,
|
|
20
|
-
DropdownMenuContent,
|
|
21
|
-
DropdownMenuItem,
|
|
22
|
-
DropdownMenuLabel,
|
|
23
|
-
DropdownMenuSeparator,
|
|
24
|
-
DropdownMenuTrigger,
|
|
25
|
-
} from './dropdown-menu';
|
|
26
|
-
import { Button } from './button';
|
|
27
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select';
|
|
28
|
-
|
|
29
|
-
/* -----------------------------------------------------------------------------
|
|
30
|
-
* Component: DataTableViewOptions
|
|
31
|
-
* -------------------------------------------------------------------------- */
|
|
32
|
-
|
|
33
|
-
interface DataTableViewOptionsProps<TData> {
|
|
34
|
-
table: ReactTable.Table<TData>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function DataTableViewOptions<TData>({ table }: DataTableViewOptionsProps<TData>): React.JSX.Element {
|
|
38
|
-
return (
|
|
39
|
-
<DropdownMenu>
|
|
40
|
-
<DropdownMenuTrigger asChild>
|
|
41
|
-
<Button className="ml-auto hidden h-8 lg:flex" size="sm" variant="outline">
|
|
42
|
-
<MixerHorizontalIcon className="mr-2 size-4" />
|
|
43
|
-
View
|
|
44
|
-
</Button>
|
|
45
|
-
</DropdownMenuTrigger>
|
|
46
|
-
<DropdownMenuContent align="end" className="w-36">
|
|
47
|
-
<DropdownMenuLabel>Toggle columns</DropdownMenuLabel>
|
|
48
|
-
<DropdownMenuSeparator />
|
|
49
|
-
{table
|
|
50
|
-
.getAllColumns()
|
|
51
|
-
.filter((column) => typeof column.accessorFn !== 'undefined' && column.getCanHide())
|
|
52
|
-
.map((column) => {
|
|
53
|
-
return (
|
|
54
|
-
<DropdownMenuCheckboxItem
|
|
55
|
-
key={column.id}
|
|
56
|
-
checked={column.getIsVisible()}
|
|
57
|
-
className="capitalize"
|
|
58
|
-
onCheckedChange={(value) => {
|
|
59
|
-
column.toggleVisibility(Boolean(value));
|
|
60
|
-
}}
|
|
61
|
-
>
|
|
62
|
-
{column.id}
|
|
63
|
-
</DropdownMenuCheckboxItem>
|
|
64
|
-
);
|
|
65
|
-
})}
|
|
66
|
-
</DropdownMenuContent>
|
|
67
|
-
</DropdownMenu>
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* -----------------------------------------------------------------------------
|
|
72
|
-
* Component: DataTablePagination
|
|
73
|
-
* -------------------------------------------------------------------------- */
|
|
74
|
-
|
|
75
|
-
interface DataTablePaginationProps<TData> extends React.HTMLAttributes<HTMLDivElement> {
|
|
76
|
-
table: ReactTable.Table<TData>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function DataTablePagination<TData>({
|
|
80
|
-
table,
|
|
81
|
-
className,
|
|
82
|
-
...props
|
|
83
|
-
}: DataTablePaginationProps<TData>): React.JSX.Element {
|
|
84
|
-
return (
|
|
85
|
-
<div className={cn('flex items-center justify-between px-2', className)} {...props}>
|
|
86
|
-
<div className="text-muted-foreground flex-1 text-sm">
|
|
87
|
-
{table.getFilteredSelectedRowModel().rows.length} of {table.getFilteredRowModel().rows.length} row(s) selected.
|
|
88
|
-
</div>
|
|
89
|
-
<div className="flex items-center space-x-6 lg:space-x-8">
|
|
90
|
-
<div className="flex items-center space-x-2">
|
|
91
|
-
<p className="text-sm font-medium">Rows per page</p>
|
|
92
|
-
<Select
|
|
93
|
-
value={String(table.getState().pagination.pageSize)}
|
|
94
|
-
onValueChange={(value) => {
|
|
95
|
-
table.setPageSize(Number(value));
|
|
96
|
-
}}
|
|
97
|
-
>
|
|
98
|
-
<SelectTrigger className="w-18 h-8">
|
|
99
|
-
<SelectValue placeholder={table.getState().pagination.pageSize} />
|
|
100
|
-
</SelectTrigger>
|
|
101
|
-
<SelectContent side="top">
|
|
102
|
-
{[10, 20, 30, 40, 50].map((pageSize) => (
|
|
103
|
-
<SelectItem key={pageSize} value={String(pageSize)}>
|
|
104
|
-
{pageSize}
|
|
105
|
-
</SelectItem>
|
|
106
|
-
))}
|
|
107
|
-
</SelectContent>
|
|
108
|
-
</Select>
|
|
109
|
-
</div>
|
|
110
|
-
<div className="flex w-28 items-center justify-center text-sm font-medium">
|
|
111
|
-
Page {table.getState().pagination.pageIndex + 1} of {table.getPageCount()}
|
|
112
|
-
</div>
|
|
113
|
-
<div className="flex items-center space-x-2">
|
|
114
|
-
<Button
|
|
115
|
-
className="hidden lg:flex"
|
|
116
|
-
disabled={!table.getCanPreviousPage()}
|
|
117
|
-
size="icon-xs"
|
|
118
|
-
variant="outline"
|
|
119
|
-
onClick={() => {
|
|
120
|
-
table.setPageIndex(0);
|
|
121
|
-
}}
|
|
122
|
-
>
|
|
123
|
-
<span className="sr-only">Go to first page</span>
|
|
124
|
-
<DoubleArrowLeftIcon className="size-4" />
|
|
125
|
-
</Button>
|
|
126
|
-
<Button
|
|
127
|
-
disabled={!table.getCanPreviousPage()}
|
|
128
|
-
size="icon-xs"
|
|
129
|
-
variant="outline"
|
|
130
|
-
onClick={() => {
|
|
131
|
-
table.previousPage();
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
<span className="sr-only">Go to previous page</span>
|
|
135
|
-
<ChevronLeftIcon className="size-4" />
|
|
136
|
-
</Button>
|
|
137
|
-
<Button
|
|
138
|
-
disabled={!table.getCanNextPage()}
|
|
139
|
-
size="icon-xs"
|
|
140
|
-
variant="outline"
|
|
141
|
-
onClick={() => {
|
|
142
|
-
table.nextPage();
|
|
143
|
-
}}
|
|
144
|
-
>
|
|
145
|
-
<span className="sr-only">Go to next page</span>
|
|
146
|
-
<ChevronRightIcon className="size-4" />
|
|
147
|
-
</Button>
|
|
148
|
-
<Button
|
|
149
|
-
className="hidden lg:flex"
|
|
150
|
-
disabled={!table.getCanNextPage()}
|
|
151
|
-
size="icon-xs"
|
|
152
|
-
variant="outline"
|
|
153
|
-
onClick={() => {
|
|
154
|
-
table.setPageIndex(table.getPageCount() - 1);
|
|
155
|
-
}}
|
|
156
|
-
>
|
|
157
|
-
<span className="sr-only">Go to last page</span>
|
|
158
|
-
<DoubleArrowRightIcon className="size-4" />
|
|
159
|
-
</Button>
|
|
160
|
-
</div>
|
|
161
|
-
</div>
|
|
162
|
-
</div>
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/* -----------------------------------------------------------------------------
|
|
167
|
-
* Component: DataTableColumnHeader
|
|
168
|
-
* -------------------------------------------------------------------------- */
|
|
169
|
-
|
|
170
|
-
interface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {
|
|
171
|
-
column: ReactTable.Column<TData, TValue>;
|
|
172
|
-
title: string;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function DataTableColumnHeader<TData, TValue>({
|
|
176
|
-
column,
|
|
177
|
-
title,
|
|
178
|
-
className,
|
|
179
|
-
}: DataTableColumnHeaderProps<TData, TValue>): React.JSX.Element {
|
|
180
|
-
if (!column.getCanSort()) {
|
|
181
|
-
return <div className={className}>{title}</div>;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return (
|
|
185
|
-
<div className={cn('flex items-center space-x-2', className)}>
|
|
186
|
-
<DropdownMenu>
|
|
187
|
-
<DropdownMenuTrigger asChild>
|
|
188
|
-
<Button className="data-[state=open]:bg-accent -ml-3" size="xs" variant="ghost">
|
|
189
|
-
<span>{title}</span>
|
|
190
|
-
<SortIcon sorted={column.getIsSorted()} />
|
|
191
|
-
</Button>
|
|
192
|
-
</DropdownMenuTrigger>
|
|
193
|
-
<DropdownMenuContent align="start">
|
|
194
|
-
<DropdownMenuItem
|
|
195
|
-
onClick={() => {
|
|
196
|
-
column.toggleSorting(false);
|
|
197
|
-
}}
|
|
198
|
-
>
|
|
199
|
-
<ArrowUpIcon className="text-muted-foreground/70 mr-2 size-3.5" />
|
|
200
|
-
Asc
|
|
201
|
-
</DropdownMenuItem>
|
|
202
|
-
<DropdownMenuItem
|
|
203
|
-
onClick={() => {
|
|
204
|
-
column.toggleSorting(true);
|
|
205
|
-
}}
|
|
206
|
-
>
|
|
207
|
-
<ArrowDownIcon className="text-muted-foreground/70 mr-2 size-3.5" />
|
|
208
|
-
Desc
|
|
209
|
-
</DropdownMenuItem>
|
|
210
|
-
<DropdownMenuSeparator />
|
|
211
|
-
<DropdownMenuItem
|
|
212
|
-
onClick={() => {
|
|
213
|
-
column.toggleVisibility(false);
|
|
214
|
-
}}
|
|
215
|
-
>
|
|
216
|
-
<EyeNoneIcon className="text-muted-foreground/70 mr-2 size-3.5" />
|
|
217
|
-
Hide
|
|
218
|
-
</DropdownMenuItem>
|
|
219
|
-
</DropdownMenuContent>
|
|
220
|
-
</DropdownMenu>
|
|
221
|
-
</div>
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function SortIcon({ sorted }: { sorted: false | ReactTable.SortDirection }): React.JSX.Element {
|
|
226
|
-
switch (sorted) {
|
|
227
|
-
case 'desc':
|
|
228
|
-
return <ArrowDownIcon className="ml-2 size-4" />;
|
|
229
|
-
|
|
230
|
-
case 'asc':
|
|
231
|
-
return <ArrowUpIcon className="ml-2 size-4" />;
|
|
232
|
-
|
|
233
|
-
default:
|
|
234
|
-
return <CaretSortIcon className="ml-2 size-4" />;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/* -----------------------------------------------------------------------------
|
|
239
|
-
* Exports
|
|
240
|
-
* -------------------------------------------------------------------------- */
|
|
241
|
-
|
|
242
|
-
export {
|
|
243
|
-
DataTableViewOptions,
|
|
244
|
-
DataTablePagination,
|
|
245
|
-
DataTableColumnHeader,
|
|
246
|
-
type DataTableViewOptionsProps,
|
|
247
|
-
type DataTablePaginationProps,
|
|
248
|
-
type DataTableColumnHeaderProps,
|
|
249
|
-
};
|
package/src/react/dialog.tsx
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
5
|
-
import { Cross2Icon } from '@radix-ui/react-icons';
|
|
6
|
-
import { cn } from '../lib/utils';
|
|
7
|
-
|
|
8
|
-
/* -----------------------------------------------------------------------------
|
|
9
|
-
* Component: Dialog
|
|
10
|
-
* -------------------------------------------------------------------------- */
|
|
11
|
-
|
|
12
|
-
type DialogProps = React.ComponentProps<typeof DialogPrimitive.Root>;
|
|
13
|
-
const Dialog = DialogPrimitive.Root;
|
|
14
|
-
|
|
15
|
-
/* -----------------------------------------------------------------------------
|
|
16
|
-
* Component: DialogTrigger
|
|
17
|
-
* -------------------------------------------------------------------------- */
|
|
18
|
-
|
|
19
|
-
type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;
|
|
20
|
-
const DialogTrigger = DialogPrimitive.Trigger;
|
|
21
|
-
|
|
22
|
-
/* -----------------------------------------------------------------------------
|
|
23
|
-
* Component: DialogClose
|
|
24
|
-
* -------------------------------------------------------------------------- */
|
|
25
|
-
|
|
26
|
-
type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;
|
|
27
|
-
const DialogClose = DialogPrimitive.Close;
|
|
28
|
-
|
|
29
|
-
/* -----------------------------------------------------------------------------
|
|
30
|
-
* Component: DialogContent
|
|
31
|
-
* -------------------------------------------------------------------------- */
|
|
32
|
-
|
|
33
|
-
type DialogContentElement = React.ElementRef<typeof DialogPrimitive.Content>;
|
|
34
|
-
type DialogContentProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>;
|
|
35
|
-
|
|
36
|
-
const DialogContent = React.forwardRef<DialogContentElement, DialogContentProps>(
|
|
37
|
-
({ children, className, ...props }, forwardedRef) => (
|
|
38
|
-
<DialogPrimitive.Portal>
|
|
39
|
-
<DialogPrimitive.Overlay className="data-[state=open]:animate-duration-200 data-[state=closed]:animate-duration-200 data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out fixed inset-0 z-50 grid place-items-center overflow-auto bg-black/80 p-4 sm:pb-12 sm:pt-8">
|
|
40
|
-
<DialogPrimitive.Content
|
|
41
|
-
ref={forwardedRef}
|
|
42
|
-
className={cn(
|
|
43
|
-
'bg-background data-[state=open]:animate-in data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95 data-[state=open]:animate-duration-200 data-[state=closed]:animate-duration-200 data-[state=open]:fade-in data-[state=closed]:animate-out data-[state=closed]:fade-out relative z-50 flex w-full max-w-lg flex-col rounded-lg border shadow-lg',
|
|
44
|
-
className,
|
|
45
|
-
)}
|
|
46
|
-
{...props}
|
|
47
|
-
>
|
|
48
|
-
{children}
|
|
49
|
-
<DialogPrimitive.Close className="data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm p-1 opacity-70 transition hover:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none">
|
|
50
|
-
<Cross2Icon className="size-4" />
|
|
51
|
-
<span className="sr-only">Close</span>
|
|
52
|
-
</DialogPrimitive.Close>
|
|
53
|
-
</DialogPrimitive.Content>
|
|
54
|
-
</DialogPrimitive.Overlay>
|
|
55
|
-
</DialogPrimitive.Portal>
|
|
56
|
-
),
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
60
|
-
|
|
61
|
-
/* -----------------------------------------------------------------------------
|
|
62
|
-
* Component: DialogHeader
|
|
63
|
-
* -------------------------------------------------------------------------- */
|
|
64
|
-
|
|
65
|
-
type DialogHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
66
|
-
|
|
67
|
-
function DialogHeader({ className, ...props }: DialogHeaderProps): React.JSX.Element {
|
|
68
|
-
return (
|
|
69
|
-
<header
|
|
70
|
-
className={cn('flex shrink-0 flex-col gap-1.5 px-6 pb-4 pt-6 text-center sm:text-left', className)}
|
|
71
|
-
{...props}
|
|
72
|
-
/>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/* -----------------------------------------------------------------------------
|
|
77
|
-
* Component: DialogBody
|
|
78
|
-
* -------------------------------------------------------------------------- */
|
|
79
|
-
|
|
80
|
-
type DialogBodyProps = React.HTMLAttributes<HTMLDivElement>;
|
|
81
|
-
|
|
82
|
-
function DialogBody({ className, ...props }: DialogBodyProps): React.JSX.Element {
|
|
83
|
-
return <main className={cn('overflow-auto px-6 py-2', className)} {...props} />;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/* -----------------------------------------------------------------------------
|
|
87
|
-
* Component: DialogFooter
|
|
88
|
-
* -------------------------------------------------------------------------- */
|
|
89
|
-
|
|
90
|
-
type DialogFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
91
|
-
|
|
92
|
-
function DialogFooter({ className, ...props }: DialogFooterProps): React.JSX.Element {
|
|
93
|
-
return (
|
|
94
|
-
<footer
|
|
95
|
-
className={cn('flex shrink-0 flex-col-reverse gap-2 px-6 pb-6 pt-4 sm:flex-row sm:justify-end', className)}
|
|
96
|
-
{...props}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/* -----------------------------------------------------------------------------
|
|
102
|
-
* Component: DialogTitle
|
|
103
|
-
* -------------------------------------------------------------------------- */
|
|
104
|
-
|
|
105
|
-
type DialogTitleElement = React.ElementRef<typeof DialogPrimitive.Title>;
|
|
106
|
-
type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;
|
|
107
|
-
|
|
108
|
-
const DialogTitle = React.forwardRef<DialogTitleElement, DialogTitleProps>(({ className, ...props }, forwardedRef) => (
|
|
109
|
-
<DialogPrimitive.Title
|
|
110
|
-
ref={forwardedRef}
|
|
111
|
-
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
));
|
|
115
|
-
|
|
116
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
117
|
-
|
|
118
|
-
/* -----------------------------------------------------------------------------
|
|
119
|
-
* Component: DialogDescription
|
|
120
|
-
* -------------------------------------------------------------------------- */
|
|
121
|
-
|
|
122
|
-
type DialogDescriptionElement = React.ElementRef<typeof DialogPrimitive.Description>;
|
|
123
|
-
type DialogDescriptionProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>;
|
|
124
|
-
|
|
125
|
-
const DialogDescription = React.forwardRef<DialogDescriptionElement, DialogDescriptionProps>(
|
|
126
|
-
({ className, ...props }, forwardedRef) => (
|
|
127
|
-
<DialogPrimitive.Description
|
|
128
|
-
ref={forwardedRef}
|
|
129
|
-
className={cn('text-muted-foreground text-sm', className)}
|
|
130
|
-
{...props}
|
|
131
|
-
/>
|
|
132
|
-
),
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
136
|
-
|
|
137
|
-
/* -----------------------------------------------------------------------------
|
|
138
|
-
* Exports
|
|
139
|
-
* -------------------------------------------------------------------------- */
|
|
140
|
-
|
|
141
|
-
export {
|
|
142
|
-
Dialog,
|
|
143
|
-
DialogTrigger,
|
|
144
|
-
DialogClose,
|
|
145
|
-
DialogContent,
|
|
146
|
-
DialogHeader,
|
|
147
|
-
DialogBody,
|
|
148
|
-
DialogFooter,
|
|
149
|
-
DialogTitle,
|
|
150
|
-
DialogDescription,
|
|
151
|
-
type DialogProps,
|
|
152
|
-
type DialogTriggerProps,
|
|
153
|
-
type DialogCloseProps,
|
|
154
|
-
type DialogContentProps,
|
|
155
|
-
type DialogHeaderProps,
|
|
156
|
-
type DialogBodyProps,
|
|
157
|
-
type DialogFooterProps,
|
|
158
|
-
type DialogTitleProps,
|
|
159
|
-
type DialogDescriptionProps,
|
|
160
|
-
};
|
package/src/react/drawer.tsx
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Drawer as DrawerPrimitive } from 'vaul';
|
|
5
|
-
import { cn } from '../lib/utils';
|
|
6
|
-
|
|
7
|
-
/* -----------------------------------------------------------------------------
|
|
8
|
-
* Component: Drawer
|
|
9
|
-
* -------------------------------------------------------------------------- */
|
|
10
|
-
|
|
11
|
-
type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root>;
|
|
12
|
-
|
|
13
|
-
function Drawer({ shouldScaleBackground = true, ...props }: DrawerProps): React.JSX.Element {
|
|
14
|
-
return <DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/* -----------------------------------------------------------------------------
|
|
18
|
-
* Component: DrawerTrigger
|
|
19
|
-
* -------------------------------------------------------------------------- */
|
|
20
|
-
|
|
21
|
-
type DrawerTriggerProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Trigger>;
|
|
22
|
-
const DrawerTrigger = DrawerPrimitive.Trigger;
|
|
23
|
-
|
|
24
|
-
/* -----------------------------------------------------------------------------
|
|
25
|
-
* Component: DrawerClose
|
|
26
|
-
* -------------------------------------------------------------------------- */
|
|
27
|
-
|
|
28
|
-
type DrawerCloseProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Close>;
|
|
29
|
-
const DrawerClose = DrawerPrimitive.Close;
|
|
30
|
-
|
|
31
|
-
/* -----------------------------------------------------------------------------
|
|
32
|
-
* Component: DrawerContent
|
|
33
|
-
* -------------------------------------------------------------------------- */
|
|
34
|
-
|
|
35
|
-
type DrawerContentElement = React.ElementRef<typeof DrawerPrimitive.Content>;
|
|
36
|
-
type DrawerContentProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>;
|
|
37
|
-
|
|
38
|
-
const DrawerContent = React.forwardRef<DrawerContentElement, DrawerContentProps>(
|
|
39
|
-
({ children, className, ...props }, forwardedRef) => (
|
|
40
|
-
<DrawerPrimitive.Portal>
|
|
41
|
-
<DrawerPrimitive.Overlay className="fixed inset-0 z-50 bg-black/80" />
|
|
42
|
-
<DrawerPrimitive.Content
|
|
43
|
-
ref={forwardedRef}
|
|
44
|
-
className={cn(
|
|
45
|
-
'bg-background fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-xl border',
|
|
46
|
-
className,
|
|
47
|
-
)}
|
|
48
|
-
{...props}
|
|
49
|
-
>
|
|
50
|
-
<div className="bg-muted mx-auto mt-4 h-2 w-24 rounded-full" />
|
|
51
|
-
{children}
|
|
52
|
-
</DrawerPrimitive.Content>
|
|
53
|
-
</DrawerPrimitive.Portal>
|
|
54
|
-
),
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
DrawerContent.displayName = 'DrawerContent';
|
|
58
|
-
|
|
59
|
-
/* -----------------------------------------------------------------------------
|
|
60
|
-
* Component: DrawerHeader
|
|
61
|
-
* -------------------------------------------------------------------------- */
|
|
62
|
-
|
|
63
|
-
type DrawerHeaderProps = React.HTMLAttributes<HTMLDivElement>;
|
|
64
|
-
|
|
65
|
-
function DrawerHeader({ className, ...props }: DrawerHeaderProps): React.JSX.Element {
|
|
66
|
-
return <div className={cn('grid gap-1.5 p-4 text-center sm:text-left', className)} {...props} />;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* -----------------------------------------------------------------------------
|
|
70
|
-
* Component: DrawerFooter
|
|
71
|
-
* -------------------------------------------------------------------------- */
|
|
72
|
-
|
|
73
|
-
type DrawerFooterProps = React.HTMLAttributes<HTMLDivElement>;
|
|
74
|
-
|
|
75
|
-
function DrawerFooter({ className, ...props }: DrawerFooterProps): React.JSX.Element {
|
|
76
|
-
return <div className={cn('mt-auto flex flex-col gap-2 p-4', className)} {...props} />;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/* -----------------------------------------------------------------------------
|
|
80
|
-
* Component: DrawerTitle
|
|
81
|
-
* -------------------------------------------------------------------------- */
|
|
82
|
-
|
|
83
|
-
type DrawerTitleElement = React.ElementRef<typeof DrawerPrimitive.Title>;
|
|
84
|
-
type DrawerTitleProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>;
|
|
85
|
-
|
|
86
|
-
const DrawerTitle = React.forwardRef<DrawerTitleElement, DrawerTitleProps>(({ className, ...props }, forwardedRef) => (
|
|
87
|
-
<DrawerPrimitive.Title
|
|
88
|
-
ref={forwardedRef}
|
|
89
|
-
className={cn('text-lg font-semibold leading-none tracking-tight', className)}
|
|
90
|
-
{...props}
|
|
91
|
-
/>
|
|
92
|
-
));
|
|
93
|
-
|
|
94
|
-
DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
|
|
95
|
-
|
|
96
|
-
/* -----------------------------------------------------------------------------
|
|
97
|
-
* Component: DrawerDescription
|
|
98
|
-
* -------------------------------------------------------------------------- */
|
|
99
|
-
|
|
100
|
-
type DrawerDescriptionElement = React.ElementRef<typeof DrawerPrimitive.Description>;
|
|
101
|
-
type DrawerDescriptionProps = React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>;
|
|
102
|
-
|
|
103
|
-
const DrawerDescription = React.forwardRef<DrawerDescriptionElement, DrawerDescriptionProps>(
|
|
104
|
-
({ className, ...props }, forwardedRef) => (
|
|
105
|
-
<DrawerPrimitive.Description
|
|
106
|
-
ref={forwardedRef}
|
|
107
|
-
className={cn('text-muted-foreground text-sm', className)}
|
|
108
|
-
{...props}
|
|
109
|
-
/>
|
|
110
|
-
),
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
|
|
114
|
-
|
|
115
|
-
/* -----------------------------------------------------------------------------
|
|
116
|
-
* Exports
|
|
117
|
-
* -------------------------------------------------------------------------- */
|
|
118
|
-
|
|
119
|
-
export {
|
|
120
|
-
Drawer,
|
|
121
|
-
DrawerTrigger,
|
|
122
|
-
DrawerClose,
|
|
123
|
-
DrawerContent,
|
|
124
|
-
DrawerHeader,
|
|
125
|
-
DrawerFooter,
|
|
126
|
-
DrawerTitle,
|
|
127
|
-
DrawerDescription,
|
|
128
|
-
type DrawerProps,
|
|
129
|
-
type DrawerTriggerProps,
|
|
130
|
-
type DrawerCloseProps,
|
|
131
|
-
type DrawerContentProps,
|
|
132
|
-
type DrawerHeaderProps,
|
|
133
|
-
type DrawerFooterProps,
|
|
134
|
-
type DrawerTitleProps,
|
|
135
|
-
type DrawerDescriptionProps,
|
|
136
|
-
};
|