MCPcopy Create free account
hub / github.com/adobe/react-spectrum / InsertionIndicator

Function InsertionIndicator

packages/@react-spectrum/s2/src/dnd-utils.tsx:50–86  ·  view source on GitHub ↗
({target}: {target: ItemDropTarget})

Source from the content-addressed store, hash-verified

48});
49
50export function InsertionIndicator({target}: {target: ItemDropTarget}) {
51 let {dropState} = useContext(DragAndDropContext) ?? {};
52 let level = 0;
53 if (target.type === 'item' && dropState?.collection) {
54 level = dropState.collection.getItem(target.key)?.level ?? 0;
55 }
56 return (
57 <DropIndicator className="" target={target}>
58 {({isDropTarget}) => (
59 <div
60 className={insertionIndicatorWrapper({isDropTarget, isRoot: level === 0})}
61 style={level > 0 ? ({'--drop-level': level} as React.CSSProperties) : undefined}>
62 <svg aria-hidden width="100%" height="12">
63 <line x1="0" y1="6" x2="100%" y2="6" strokeWidth="2" stroke="currentColor" />
64 <circle
65 cx="6"
66 cy="6"
67 r="5"
68 strokeWidth="2"
69 stroke="currentColor"
70 style={{fill: 'var(--indicator-circle-bg)'}}
71 />
72 <circle
73 cx="100%"
74 cy="6"
75 r="5"
76 strokeWidth="2"
77 stroke="currentColor"
78 style={{fill: 'var(--indicator-circle-bg)'}}
79 transform="translate(-6, 0)"
80 />
81 </svg>
82 </div>
83 )}
84 </DropIndicator>
85 );
86}
87
88let dragButton = style({
89 color: 'inherit',

Callers

nothing calls this directly

Calls 1

getItemMethod · 0.65

Tested by

no test coverage detected