(props: DividerProps)
| 37 | * ``` |
| 38 | */ |
| 39 | export function Divider(props: DividerProps) { |
| 40 | const { |
| 41 | direction, |
| 42 | index, |
| 43 | isDragging, |
| 44 | disabled, |
| 45 | onPointerDown, |
| 46 | onKeyDown, |
| 47 | className, |
| 48 | style, |
| 49 | currentSize, |
| 50 | minSize, |
| 51 | maxSize, |
| 52 | children, |
| 53 | } = props; |
| 54 | |
| 55 | const orientation = direction === 'horizontal' ? 'vertical' : 'horizontal'; |
| 56 | |
| 57 | const defaultStyle: CSSProperties = { |
| 58 | flex: 'none', |
| 59 | position: 'relative', |
| 60 | userSelect: 'none', |
| 61 | touchAction: 'none', |
| 62 | ...(direction === 'horizontal' |
| 63 | ? { |
| 64 | width: '1px', |
| 65 | cursor: disabled ? 'default' : 'col-resize', |
| 66 | } |
| 67 | : { |
| 68 | height: '1px', |
| 69 | cursor: disabled ? 'default' : 'row-resize', |
| 70 | }), |
| 71 | ...(isDragging && { |
| 72 | cursor: direction === 'horizontal' ? 'col-resize' : 'row-resize', |
| 73 | }), |
| 74 | }; |
| 75 | |
| 76 | const combinedStyle: CSSProperties = { |
| 77 | ...defaultStyle, |
| 78 | ...style, |
| 79 | }; |
| 80 | |
| 81 | const combinedClassName = cn( |
| 82 | DEFAULT_CLASSNAME, |
| 83 | direction, |
| 84 | isDragging && 'dragging', |
| 85 | className |
| 86 | ); |
| 87 | |
| 88 | const label = getDividerLabel(index, direction); |
| 89 | const instructions = getKeyboardInstructions(direction); |
| 90 | |
| 91 | // Don't pass Infinity to ARIA attributes - screen readers can't handle it |
| 92 | const ariaValueMax = |
| 93 | maxSize === undefined || maxSize === Infinity ? undefined : maxSize; |
| 94 | |
| 95 | return ( |
| 96 | <div |
nothing calls this directly
no test coverage detected
searching dependent graphs…