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

Function useWrapper

packages/@react-spectrum/s2/src/ColorSwatchPicker.tsx:101–146  ·  view source on GitHub ↗
(swatch: ReactElement, color: Color, rounding: ColorSwatchProps['rounding'])

Source from the content-addressed store, hash-verified

99});
100
101function useWrapper(swatch: ReactElement, color: Color, rounding: ColorSwatchProps['rounding']) {
102 return (
103 <AriaColorSwatchPickerItem
104 color={color}
105 className={renderProps =>
106 style({
107 ...focusRing(),
108 position: 'relative',
109 borderRadius: {
110 rounding: {
111 none: 'none',
112 default: 'sm',
113 full: 'full'
114 }
115 },
116 disableTapHighlight: true
117 })({...renderProps, rounding})
118 }>
119 {({isSelected}) => (
120 <>
121 {swatch}
122 {isSelected && (
123 <div
124 aria-hidden
125 className={style({
126 position: 'absolute',
127 pointerEvents: 'none',
128 inset: 0,
129 boxSizing: 'border-box',
130 borderColor: 'gray-900',
131 borderStyle: 'solid',
132 borderWidth: 2,
133 outlineColor: 'gray-25',
134 outlineStyle: 'solid',
135 outlineWidth: 2,
136 outlineOffset: -4,
137 forcedColorAdjust: 'none',
138 borderRadius: 'inherit'
139 })}
140 />
141 )}
142 </>
143 )}
144 </AriaColorSwatchPickerItem>
145 );
146}

Callers

nothing calls this directly

Calls 1

focusRingFunction · 0.90

Tested by

no test coverage detected