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

Function CalendarButton

packages/@react-spectrum/s2/src/DatePicker.tsx:316–359  ·  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 // oxlint-disable react/react-compiler
324 return (
325 <Button
326 ref={buttonRef}
327 // Prevent press scale from sticking while DatePicker is open.
328 // @ts-ignore
329 isPressed={false}
330 onFocusChange={setButtonHasFocus}
331 style={pressScale(buttonRef)}
332 className={renderProps =>
333 inputButton({
334 ...renderProps,
335 size,
336 isOpen
337 })
338 }>
339 <Provider
340 values={[
341 [
342 IconContext,
343 {
344 styles: style({
345 '--iconPrimary': {
346 type: 'fill',
347 value: 'currentColor'
348 },
349 size: fontRelative(14)
350 })
351 }
352 ]
353 ]}>
354 <CalendarIcon />
355 </Provider>
356 </Button>
357 );
358 // oxlint-enable react/react-compiler
359}

Callers

nothing calls this directly

Calls 2

pressScaleFunction · 0.90
fontRelativeFunction · 0.90

Tested by

no test coverage detected