(props: ColorAreaProps)
| 12 | } |
| 13 | |
| 14 | export function ColorArea(props: ColorAreaProps) { |
| 15 | let inputXRef = useRef<HTMLInputElement>(null); |
| 16 | let inputYRef = useRef<HTMLInputElement>(null); |
| 17 | let containerRef = useRef<HTMLDivElement>(null); |
| 18 | // useColorAreaState manages the two channel values behind the 2D gradient. |
| 19 | let state = useColorAreaState(props); |
| 20 | /*- begin highlight -*/ |
| 21 | let {colorAreaProps, xInputProps, yInputProps, thumbProps} = useColorArea( |
| 22 | {...props, inputXRef, inputYRef, containerRef}, |
| 23 | state |
| 24 | ); |
| 25 | /*- end highlight -*/ |
| 26 | let {focusProps, isFocusVisible} = useFocusRing(); |
| 27 | |
| 28 | return ( |
| 29 | <div |
| 30 | {...colorAreaProps} |
| 31 | ref={containerRef} |
| 32 | className="react-aria-ColorArea" |
| 33 | data-disabled={props.isDisabled || undefined} |
| 34 | style={{...colorAreaProps.style, ...props.style}}> |
| 35 | <div |
| 36 | {...thumbProps} |
| 37 | className="react-aria-ColorThumb" |
| 38 | data-focus-visible={isFocusVisible || undefined} |
| 39 | data-disabled={props.isDisabled || undefined} |
| 40 | style={{ |
| 41 | ...thumbProps.style, |
| 42 | background: state.getDisplayColor().toString('css') |
| 43 | }}> |
| 44 | {/* Two hidden range inputs drive the X and Y color channels. */} |
| 45 | <input ref={inputXRef} {...xInputProps} {...focusProps} /> |
| 46 | <input ref={inputYRef} {...yInputProps} {...focusProps} /> |
| 47 | </div> |
| 48 | </div> |
| 49 | ); |
| 50 | } |
nothing calls this directly
no test coverage detected