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

Function CalendarButton

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

pressScaleFunction · 0.90
fontRelativeFunction · 0.90

Tested by

no test coverage detected