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

Function ColorWheel

starters/hooks/src/ColorWheel.tsx:14–46  ·  view source on GitHub ↗
(props: ColorWheelProps)

Source from the content-addressed store, hash-verified

12export type ColorWheelProps = Omit<AriaColorWheelProps, 'outerRadius' | 'innerRadius'>;
13
14export function ColorWheel(props: ColorWheelProps) {
15 // useColorWheelState manages the hue value behind the circular gradient track.
16 let state = useColorWheelState(props);
17 let inputRef = useRef<HTMLInputElement>(null);
18 /*- begin highlight -*/
19 let {trackProps, thumbProps, inputProps} = useColorWheel(
20 {...props, outerRadius: RADIUS, innerRadius: RADIUS - TRACK_THICKNESS},
21 state,
22 inputRef
23 );
24 /*- end highlight -*/
25 let {focusProps, isFocusVisible} = useFocusRing();
26
27 return (
28 <div
29 className="react-aria-ColorWheel"
30 data-disabled={state.isDisabled || undefined}
31 style={{position: 'relative', display: 'inline-block'}}>
32 <div {...trackProps} className="react-aria-ColorWheelTrack" style={trackProps.style} />
33 <div
34 {...thumbProps}
35 className="react-aria-ColorThumb"
36 data-focus-visible={isFocusVisible || undefined}
37 data-disabled={state.isDisabled || undefined}
38 style={{
39 ...thumbProps.style,
40 background: state.getDisplayColor().toString('css')
41 }}>
42 <input ref={inputRef} {...inputProps} {...focusProps} />
43 </div>
44 </div>
45 );
46}

Callers

nothing calls this directly

Calls 5

useColorWheelStateFunction · 0.90
useColorWheelFunction · 0.90
useFocusRingFunction · 0.90
toStringMethod · 0.65
getDisplayColorMethod · 0.65

Tested by

no test coverage detected