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

Function ColorHandle

packages/@react-spectrum/s2/src/ColorHandle.tsx:32–89  ·  view source on GitHub ↗
({containerRef, getPosition}: ColorHandleProps)

Source from the content-addressed store, hash-verified

30}
31
32export function ColorHandle({containerRef, getPosition}: ColorHandleProps): ReactNode {
33 return (
34 <ColorThumb
35 className={style({
36 transition: '[width, height]',
37 size: {
38 default: HANDLE_SIZE,
39 isFocusVisible: 32
40 },
41 backgroundColor: {
42 isDisabled: 'disabled'
43 },
44 borderRadius: 'full',
45 boxSizing: 'border-box',
46 borderStyle: 'solid',
47 borderWidth: 2,
48 borderColor: {
49 default: 'white',
50 isDisabled: 'disabled'
51 },
52 outlineStyle: 'solid',
53 outlineWidth: 1,
54 outlineColor: {
55 default: 'black/42',
56 forcedColors: 'ButtonBorder'
57 }
58 })}
59 style={({defaultStyle, isDisabled}) => ({
60 background: isDisabled
61 ? undefined
62 : `linear-gradient(${defaultStyle.backgroundColor}, ${defaultStyle.backgroundColor}), repeating-conic-gradient(#E1E1E1 0% 25%, white 0% 50%) 50% / 16px 16px`,
63 backgroundColor: undefined,
64 top: defaultStyle.top || '50%',
65 left: defaultStyle.left || '50%'
66 })}>
67 {({isDragging, color}) => (
68 <>
69 <div
70 className={style({
71 size: 'full',
72 borderRadius: 'full',
73 boxSizing: 'border-box',
74 borderStyle: 'solid',
75 borderWidth: 1,
76 borderColor: {
77 default: 'black/42',
78 forcedColors: 'ButtonBorder'
79 }
80 })}
81 />
82 <ColorLoupePortal isOpen={isDragging}>
83 <ColorLoupe containerRef={containerRef} color={color} getPosition={getPosition} />
84 </ColorLoupePortal>
85 </>
86 )}
87 </ColorThumb>
88 );
89}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected