doo-boilerplate 0.2.7 → 0.2.9
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/package.json +1 -1
- package/templates/template-vite/src/components/data-table/data-table-drag-handle.tsx +10 -5
- package/templates/template-vite/src/components/data-table/data-table-sortable-header.tsx +11 -5
- package/templates/template-vite/src/components/data-table/data-table.tsx +1 -1
- package/templates/template-vite/src/components/layout/page-layout.tsx +2 -2
- package/templates/template-vite/src/routes/(auth)/sign-in.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
import type { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities'
|
|
2
|
+
import type { DraggableAttributes } from '@dnd-kit/core'
|
|
1
3
|
import { GripVertical } from 'lucide-react'
|
|
2
|
-
import { useSortable } from '@dnd-kit/sortable'
|
|
3
4
|
|
|
4
5
|
interface DragHandleProps {
|
|
5
|
-
|
|
6
|
+
attributes: DraggableAttributes
|
|
7
|
+
listeners: SyntheticListenerMap | undefined
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Drag handle icon for sortable column headers.
|
|
12
|
+
* Receives dnd-kit listeners/attributes from the parent useSortable call
|
|
13
|
+
* to avoid calling useSortable twice with the same id.
|
|
14
|
+
*/
|
|
15
|
+
export function ColumnDragHandle({ attributes, listeners }: DragHandleProps) {
|
|
11
16
|
return (
|
|
12
17
|
<button
|
|
13
18
|
{...attributes}
|
|
@@ -10,23 +10,29 @@ interface SortableHeaderProps<TData, TValue> {
|
|
|
10
10
|
header: Header<TData, TValue>
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Table header cell with DnD sortable support.
|
|
15
|
+
* useSortable is called once here; listeners are passed to ColumnDragHandle
|
|
16
|
+
* to avoid duplicate useSortable calls with the same id.
|
|
17
|
+
*/
|
|
14
18
|
export function SortableHeader<TData, TValue>({ header }: SortableHeaderProps<TData, TValue>) {
|
|
15
|
-
const { transform, transition, isDragging } = useSortable({
|
|
19
|
+
const { attributes, listeners, transform, transition, isDragging } = useSortable({
|
|
20
|
+
id: header.column.id,
|
|
21
|
+
})
|
|
16
22
|
|
|
17
23
|
const style: React.CSSProperties = {
|
|
18
24
|
transform: CSS.Translate.toString(transform),
|
|
19
25
|
transition,
|
|
20
26
|
opacity: isDragging ? 0.5 : 1,
|
|
21
|
-
zIndex: isDragging ? 1 : 0,
|
|
22
27
|
position: 'relative',
|
|
28
|
+
zIndex: isDragging ? 1 : 0,
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
return (
|
|
26
|
-
<TableHead
|
|
32
|
+
<TableHead colSpan={header.colSpan} style={style}>
|
|
27
33
|
{header.isPlaceholder ? null : (
|
|
28
34
|
<div className='flex items-center gap-1'>
|
|
29
|
-
|
|
35
|
+
<ColumnDragHandle attributes={attributes} listeners={listeners} />
|
|
30
36
|
{flexRender(header.column.columnDef.header, header.getContext())}
|
|
31
37
|
</div>
|
|
32
38
|
)}
|
|
@@ -58,7 +58,7 @@ export function DataTable<TData>({ table, columns, isLoading }: DataTableProps<T
|
|
|
58
58
|
modifiers={[restrictToHorizontalAxis]}
|
|
59
59
|
>
|
|
60
60
|
<div className='space-y-4'>
|
|
61
|
-
<div className='rounded-md border'>
|
|
61
|
+
<div className='rounded-md border overflow-hidden'>
|
|
62
62
|
<Table>
|
|
63
63
|
<TableHeader>
|
|
64
64
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
@@ -12,7 +12,7 @@ interface PageLayoutProps {
|
|
|
12
12
|
/** Standard page wrapper with title, optional description + actions slot */
|
|
13
13
|
export function PageLayout({ title, description, actions, children }: PageLayoutProps) {
|
|
14
14
|
return (
|
|
15
|
-
<div className='flex
|
|
15
|
+
<div className='flex flex-col'>
|
|
16
16
|
<div className='flex items-start justify-between px-6 pt-6'>
|
|
17
17
|
<div>
|
|
18
18
|
<h1 className='text-2xl font-bold tracking-tight'>{title}</h1>
|
|
@@ -25,7 +25,7 @@ export function PageLayout({ title, description, actions, children }: PageLayout
|
|
|
25
25
|
|
|
26
26
|
<Separator className='my-4' />
|
|
27
27
|
|
|
28
|
-
<div className='
|
|
28
|
+
<div className='px-6 pb-6'>{children}</div>
|
|
29
29
|
</div>
|
|
30
30
|
)
|
|
31
31
|
}
|
|
@@ -18,7 +18,7 @@ function SignInPage() {
|
|
|
18
18
|
return (
|
|
19
19
|
<div className='grid min-h-screen lg:grid-cols-2'>
|
|
20
20
|
{/* Left: branding panel (hidden on mobile) */}
|
|
21
|
-
<div className='hidden lg:flex flex-col items-start justify-between bg-
|
|
21
|
+
<div className='hidden lg:flex flex-col items-start justify-between bg-sidebar p-10'>
|
|
22
22
|
<div className='flex items-center gap-2 text-lg font-semibold'>
|
|
23
23
|
<div className='h-8 w-8 rounded-md bg-primary' />
|
|
24
24
|
{siteConfig.name}
|
|
@@ -30,7 +30,7 @@ function SignInPage() {
|
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
32
|
{/* Right: form panel */}
|
|
33
|
-
<div className='flex items-center justify-center p-8'>
|
|
33
|
+
<div className='flex items-center justify-center bg-background p-8'>
|
|
34
34
|
<div className='w-full max-w-sm'>
|
|
35
35
|
<SignInForm />
|
|
36
36
|
</div>
|