()
| 13 | ]; |
| 14 | |
| 15 | export default function GraphEdgeControls() { |
| 16 | const { enabled, reduced, setEnabled } = useEdgeMotionPreference(); |
| 17 | const details = useRef<HTMLDetailsElement>(null); |
| 18 | useEffect(() => { |
| 19 | const close = (event: PointerEvent) => { |
| 20 | if (details.current?.open && !details.current.contains(event.target as Node)) details.current.open = false; |
| 21 | }; |
| 22 | document.addEventListener('pointerdown', close); |
| 23 | return () => document.removeEventListener('pointerdown', close); |
| 24 | }, []); |
| 25 | return <details ref={details} className="graph-edge-controls" onKeyDown={event => { |
| 26 | if (event.key === 'Escape') { event.currentTarget.open = false; event.currentTarget.querySelector('summary')?.focus(); } |
| 27 | }}> |
| 28 | <summary title="3D graph edge colors and motion">Edges</summary> |
| 29 | <div className="graph-edge-settings" role="group" aria-label="3D edge appearance"> |
| 30 | <label><input type="checkbox" checked={enabled && !reduced} disabled={reduced} onChange={event => setEnabled(event.target.checked)} />Direction pulse</label> |
| 31 | <p>{reduced ? 'Motion is paused by your reduced-motion setting.' : 'A subtle pulse shows relationship direction across all 3D graphs.'}</p> |
| 32 | <ul className="graph-edge-key" aria-label="Edge color key">{KEY.map(([type, label]) => <li key={type} title={type}><i style={{ backgroundColor: edgeColor(type) }} />{label}</li>)}</ul> |
| 33 | </div> |
| 34 | </details>; |
| 35 | } |
nothing calls this directly
no test coverage detected