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

Function CalendarButton

packages/@react-spectrum/s2/src/DatePicker.tsx:316–357  ·  view source on GitHub ↗
(props: {
  isOpen: boolean;
  size: 'S' | 'M' | 'L' | 'XL';
  setButtonHasFocus: (hasFocus: boolean) => void;
})

Source from the content-addressed store, hash-verified

314}
315
316export function CalendarButton(props: {
317 isOpen: boolean;
318 size: 'S' | 'M' | 'L' | 'XL';
319 setButtonHasFocus: (hasFocus: boolean) => void;
320}): ReactElement {
321 let buttonRef = useRef<HTMLButtonElement>(null);
322 let {isOpen, size, setButtonHasFocus} = props;
323 return (
324 <Button
325 ref={buttonRef}
326 // Prevent press scale from sticking while DatePicker is open.
327 // @ts-ignore
328 isPressed={false}
329 onFocusChange={setButtonHasFocus}
330 style={pressScale(buttonRef)}
331 className={renderProps =>
332 inputButton({
333 ...renderProps,
334 size,
335 isOpen
336 })
337 }>
338 <Provider
339 values={[
340 [
341 IconContext,
342 {
343 styles: style({
344 '--iconPrimary': {
345 type: 'fill',
346 value: 'currentColor'
347 },
348 size: fontRelative(14)
349 })
350 }
351 ]
352 ]}>
353 <CalendarIcon />
354 </Provider>
355 </Button>
356 );
357}

Callers

nothing calls this directly

Calls 2

pressScaleFunction · 0.90
fontRelativeFunction · 0.90

Tested by

no test coverage detected