File tree Expand file tree Collapse file tree 9 files changed +1720
-868
lines changed Expand file tree Collapse file tree 9 files changed +1720
-868
lines changed Original file line number Diff line number Diff line change @@ -43,17 +43,19 @@ export function DnDList<T>({
4343 } box-border border`}
4444 >
4545 < DragDropContext onDragEnd = { onDragEnd } >
46- < Droppable droppableId = "droppable" >
47- { ( provided ) => (
48- < div
49- { ...provided . droppableProps }
50- ref = { provided . innerRef }
51- className = "flex flex-col w-full"
52- >
53- { children }
54- { provided . placeholder }
55- </ div >
56- ) }
46+ < Droppable droppableId = { `droppable-${ crypto . randomUUID ( ) } ` } >
47+ { ( provided ) => {
48+ return (
49+ < div
50+ { ...provided . droppableProps }
51+ ref = { provided . innerRef }
52+ className = "flex flex-col w-full"
53+ >
54+ { children }
55+ { provided . placeholder }
56+ </ div >
57+ )
58+ } }
5759 </ Droppable >
5860 </ DragDropContext >
5961 </ div >
Original file line number Diff line number Diff line change @@ -12,6 +12,20 @@ export type DragItemProps = {
1212 style ?: React . CSSProperties
1313}
1414
15+ function findClosestScrollContainer ( element : HTMLElement | null ) {
16+ if ( ! element ) {
17+ return null
18+ }
19+ let parent = element . parentElement
20+ while ( parent ) {
21+ if ( parent . scrollHeight > parent . clientHeight ) {
22+ return parent
23+ }
24+ parent = parent . parentElement
25+ }
26+ return null
27+ }
28+
1529export function DragItem ( {
1630 draggableId,
1731 index,
@@ -20,16 +34,22 @@ export function DragItem({
2034 style,
2135 thin = false ,
2236} : DragItemProps ) {
23- const draggableRef = React . useRef ( null )
37+ const draggableRef = React . useRef < HTMLDivElement > ( null )
2438 return (
2539 < Draggable draggableId = { draggableId } index = { index } >
2640 { ( { innerRef, draggableProps, dragHandleProps } ) => {
2741 // offset bug workaround: https://github.com/atlassian/react-beautiful-dnd/issues/1881
42+
43+ const draggableRect =
44+ draggableRef . current ?. getBoundingClientRect ( )
45+ const draggableTop = draggableRect ?. top ?? 0
46+ const draggableLeft = draggableRect ?. left ?? 0
47+
2848 const dragStyle = {
2949 ...style ,
3050 ...draggableProps . style ,
31- top : "auto" ,
32- left : "auto" ,
51+ top : ` ${ draggableTop } px` ,
52+ left : ` ${ draggableLeft } px` ,
3353 }
3454 //
3555 return (
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ const PageHeaderTitle = ({
7272 return (
7373 < div
7474 className = { twMerge ( "mb-2 flex items-center px-8" , className ) }
75- id = { id }
75+ id = { id ?? "page-header-title" }
7676 style = { style }
7777 data-testid = { testId }
7878 >
@@ -154,7 +154,7 @@ const PageBody = ({
154154 className ,
155155 ) }
156156 style = { style }
157- id = { id }
157+ id = { id ?? "page-body" }
158158 data-testid = { testId }
159159 >
160160 { children }
@@ -179,7 +179,7 @@ const PageBodyContent = ({
179179 "min-h-0 flex-1 overflow-y-auto px-6 py-3" ,
180180 className ,
181181 ) }
182- id = { id }
182+ id = { id ?? "page-body-content" }
183183 style = { style }
184184 data-testid = { testId }
185185 >
@@ -205,7 +205,7 @@ const PageBodyHeader = ({
205205 "bg-surface-raised shadow-overflow z-0 px-8 py-1" ,
206206 className ,
207207 ) }
208- id = { id }
208+ id = { id ?? "page-body-header" }
209209 style = { style }
210210 data-testid = { testId }
211211 >
@@ -231,7 +231,7 @@ const PageBodyFooter = ({
231231 "bg-surface-raised border-border shadow-strong z-0 flex justify-center border-t p-1.5" ,
232232 className ,
233233 ) }
234- id = { id }
234+ id = { id ?? "page-body-footer" }
235235 style = { style }
236236 data-testid = { testId }
237237 >
Original file line number Diff line number Diff line change 11export const portalContainerID = "uikts-portal" as const
22
33export function getPortal ( insidePortalContainerID : string ) {
4+ if ( ! portalContainerID ) {
5+ throw new Error ( "No portal container id provided" )
6+ }
47 let portalNode = document . getElementById ( portalContainerID )
58 if ( ! portalNode ) {
69 console . log ( "creating portal node with id:" , portalContainerID )
You can’t perform that action at this time.
0 commit comments