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

Function setOpen

packages/react-stately/src/datepicker/useDatePickerState.ts:212–224  ·  view source on GitHub ↗
(isOpen)

Source from the content-addressed store, hash-verified

210 hasTime,
211 ...overlayState,
212 setOpen(isOpen) {
213 // Commit the selected date when the calendar is closed. Use a placeholder time if one wasn't set.
214 // If only the time was set and not the date, don't commit. The state will be preserved until
215 // the user opens the popover again.
216 if (!isOpen && !value && selectedDate && hasTime) {
217 commitValue(
218 selectedDate,
219 selectedTime || getPlaceholderTime(props.defaultValue || props.placeholderValue)
220 );
221 }
222
223 overlayState.setOpen(isOpen);
224 },
225 validationState,
226 isInvalid: isValueInvalid,
227 formatValue(locale, fieldOptions) {

Callers 14

onDropActivateFunction · 0.50
NestedDialogFunction · 0.50
ExampleFunction · 0.50
onOpenChangeFunction · 0.50
useOverlayTriggerStateFunction · 0.50
performFunction · 0.50
A11yFunction · 0.50
onOpenChangeFunction · 0.50
DialogContainerExampleFunction · 0.50
MenuExampleFunction · 0.50
handleOpenChangeFunction · 0.50

Calls 3

getPlaceholderTimeFunction · 0.90
commitValueFunction · 0.70
setOpenMethod · 0.65

Tested by 1

onOpenChangeFunction · 0.40