Skip to content

Commit 6242d9d

Browse files
committed
feat: update kanban
1 parent fb03e32 commit 6242d9d

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

docs/content/docs/components/sortable.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ import * as Sortable from "@/components/ui/sortable";
6464

6565
### With Handle
6666

67-
Use `ItemHandle` as a drag handle for sorting.
67+
Use `ItemHandle` as a drag handle for sortable items.
6868

6969
<ComponentTabs name="sortable-handle-demo" />
7070

docs/registry/default/example/kanban-demo.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default function KanbanDemo() {
121121
<GripVertical className="h-4 w-4" />
122122
</Button>
123123
</div>
124-
<div className="flex max-h-[600px] flex-col gap-2 overflow-y-auto p-0.5">
124+
<div className="flex flex-col gap-2 p-0.5">
125125
{tasks?.map((task) => (
126126
<TaskCard key={task.id} task={task} asHandle />
127127
))}

docs/registry/default/example/sortable-handle-demo.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default function SortableHandleDemo() {
5151
<SortableContent asChild>
5252
<TableBody>
5353
{tricks.map((trick) => (
54-
<SortableItem key={trick.id} value={trick.id} asChild asHandle>
54+
<SortableItem key={trick.id} value={trick.id} asChild>
5555
<TableRow>
5656
<TableCell className="w-[50px]">
5757
<SortableItemHandle asChild>

docs/registry/default/ui/kanban.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,6 @@ const KanbanItem = React.forwardRef<HTMLDivElement, KanbanItemProps>(
611611
};
612612
}, [transform, transition, style]);
613613

614-
const ItemSlot = asChild ? Slot : "div";
615-
616614
const itemContext = React.useMemo<KanbanItemContextValue>(
617615
() => ({
618616
id,
@@ -625,10 +623,13 @@ const KanbanItem = React.forwardRef<HTMLDivElement, KanbanItemProps>(
625623
[id, attributes, listeners, setActivatorNodeRef, isDragging, disabled],
626624
);
627625

626+
const ItemSlot = asChild ? Slot : "div";
627+
628628
return (
629629
<KanbanItemContext.Provider value={itemContext}>
630630
<ItemSlot
631631
data-dragging={isDragging ? "" : undefined}
632+
data-kanban-item=""
632633
{...itemProps}
633634
{...(asHandle ? attributes : {})}
634635
{...(asHandle ? listeners : {})}
@@ -739,7 +740,10 @@ function KanbanOverlay(props: KanbanOverlayProps) {
739740
<DragOverlay
740741
modifiers={context.modifiers}
741742
dropAnimation={dropAnimationProp ?? dropAnimation}
742-
className={cn(!context.flatCursor && "cursor-grabbing")}
743+
className={cn(
744+
"[&_[data-kanban-item]]:opacity-50 [&_[data-kanban-item]]:outline-none [&_[data-kanban-item]]:ring-1 [&_[data-kanban-item]]:ring-ring [&_[data-kanban-item]]:ring-offset-1",
745+
!context.flatCursor && "cursor-grabbing",
746+
)}
743747
{...overlayProps}
744748
>
745749
{context.activeId && children

docs/registry/default/ui/sortable.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,10 @@ function SortableOverlay(props: SortableOverlayProps) {
327327
<DragOverlay
328328
modifiers={context.modifiers}
329329
dropAnimation={dropAnimationProp ?? dropAnimation}
330-
className={cn(!context.flatCursor && "cursor-grabbing")}
330+
className={cn(
331+
"[&_[data-sortable-item]]:opacity-50 [&_[data-sortable-item]]:outline-none [&_[data-sortable-item]]:ring-1 [&_[data-sortable-item]]:ring-ring [&_[data-sortable-item]]:ring-offset-1",
332+
!context.flatCursor && "cursor-grabbing",
333+
)}
331334
{...overlayProps}
332335
>
333336
<SortableOverlayContext.Provider value={true}>
@@ -439,6 +442,7 @@ const SortableItem = React.forwardRef<HTMLDivElement, SortableItemProps>(
439442
<ItemSlot
440443
id={id}
441444
data-dragging={isDragging ? "" : undefined}
445+
data-sortable-item=""
442446
{...itemProps}
443447
{...(asHandle ? attributes : {})}
444448
{...(asHandle ? listeners : {})}

0 commit comments

Comments
 (0)