@fluentui/react-datepicker-compat 0.3.13 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.json +220 -1
  2. package/CHANGELOG.md +58 -2
  3. package/lib/components/Calendar/Calendar.js +2 -4
  4. package/lib/components/Calendar/Calendar.js.map +1 -1
  5. package/lib/components/CalendarDay/CalendarDay.js +1 -2
  6. package/lib/components/CalendarDay/CalendarDay.js.map +1 -1
  7. package/lib/components/CalendarDayGrid/CalendarDayGrid.js +3 -3
  8. package/lib/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
  9. package/lib/components/CalendarDayGrid/CalendarGridDayCell.js +3 -6
  10. package/lib/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
  11. package/lib/components/CalendarDayGrid/useWeeks.js +3 -4
  12. package/lib/components/CalendarDayGrid/useWeeks.js.map +1 -1
  13. package/lib/components/CalendarMonth/CalendarMonth.js +3 -5
  14. package/lib/components/CalendarMonth/CalendarMonth.js.map +1 -1
  15. package/lib/components/CalendarYear/CalendarYear.js +13 -18
  16. package/lib/components/CalendarYear/CalendarYear.js.map +1 -1
  17. package/lib/components/DatePicker/useDatePicker.js +7 -12
  18. package/lib/components/DatePicker/useDatePicker.js.map +1 -1
  19. package/lib/utils/dateGrid/getDayGrid.js +1 -2
  20. package/lib/utils/dateGrid/getDayGrid.js.map +1 -1
  21. package/lib-commonjs/components/Calendar/Calendar.js +2 -4
  22. package/lib-commonjs/components/Calendar/Calendar.js.map +1 -1
  23. package/lib-commonjs/components/CalendarDay/CalendarDay.js +1 -2
  24. package/lib-commonjs/components/CalendarDay/CalendarDay.js.map +1 -1
  25. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js +3 -3
  26. package/lib-commonjs/components/CalendarDayGrid/CalendarDayGrid.js.map +1 -1
  27. package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js +3 -6
  28. package/lib-commonjs/components/CalendarDayGrid/CalendarGridDayCell.js.map +1 -1
  29. package/lib-commonjs/components/CalendarDayGrid/useWeeks.js +3 -4
  30. package/lib-commonjs/components/CalendarDayGrid/useWeeks.js.map +1 -1
  31. package/lib-commonjs/components/CalendarMonth/CalendarMonth.js +3 -4
  32. package/lib-commonjs/components/CalendarMonth/CalendarMonth.js.map +1 -1
  33. package/lib-commonjs/components/CalendarYear/CalendarYear.js +13 -18
  34. package/lib-commonjs/components/CalendarYear/CalendarYear.js.map +1 -1
  35. package/lib-commonjs/components/DatePicker/useDatePicker.js +7 -12
  36. package/lib-commonjs/components/DatePicker/useDatePicker.js.map +1 -1
  37. package/lib-commonjs/utils/dateGrid/getDayGrid.js +1 -2
  38. package/lib-commonjs/utils/dateGrid/getDayGrid.js.map +1 -1
  39. package/package.json +13 -13
@@ -1 +1 @@
1
- {"version":3,"sources":["useDatePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport { mergeCallbacks, useControllableState, useEventCallback, useId, useMergedRefs, useOnClickOutside, useOnScrollOutside, slot } from '@fluentui/react-utilities';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nfunction isDateOutOfBounds(date, minDate, maxDate) {\n return !!minDate && compareDatePart(minDate, date) > 0 || !!maxDate && compareDatePart(maxDate, date) < 0;\n}\nfunction useFocusLogic() {\n const inputRef = React.useRef(null);\n const preventFocusOpeningPicker = React.useRef(false);\n const focus = React.useCallback(()=>{\n var _inputRef_current_focus, _inputRef_current;\n (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : (_inputRef_current_focus = _inputRef_current.focus) === null || _inputRef_current_focus === void 0 ? void 0 : _inputRef_current_focus.call(_inputRef_current);\n }, []);\n const preventNextFocusOpeningPicker = React.useCallback(()=>{\n preventFocusOpeningPicker.current = true;\n }, []);\n return [\n focus,\n inputRef,\n preventFocusOpeningPicker,\n preventNextFocusOpeningPicker\n ];\n}\nfunction usePopupVisibility(props) {\n const [open, setOpen] = useControllableState({\n initialState: false,\n defaultState: props.defaultOpen,\n state: props.open\n });\n const isMounted = React.useRef(false);\n React.useEffect(()=>{\n if (isMounted.current && !open) {\n var // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n _props_onOpenChange, _props;\n (_props_onOpenChange = (_props = props).onOpenChange) === null || _props_onOpenChange === void 0 ? void 0 : _props_onOpenChange.call(_props, false);\n }\n isMounted.current = true;\n }, // Should only run on allowTextInput or open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n props.allowTextInput,\n open\n ]);\n return [\n open,\n setOpen\n ];\n}\nfunction useSelectedDate({ formatDate, onSelectDate, value }) {\n const [selectedDate, setSelectedDateState] = useControllableState({\n initialState: null,\n state: value\n });\n const [formattedDate, setFormattedDate] = React.useState(()=>value && formatDate ? formatDate(value) : '');\n const setSelectedDate = (newDate)=>{\n var _onSelectDate;\n (_onSelectDate = onSelectDate) === null || _onSelectDate === void 0 ? void 0 : _onSelectDate(newDate);\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n React.useEffect(()=>{\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [\n formatDate,\n value\n ]);\n return [\n selectedDate,\n formattedDate,\n setSelectedDate,\n setFormattedDate\n ];\n}\nconst defaultFormatDate = (date)=>date ? date.toDateString() : '';\nconst defaultParseDateFromString = (dateStr)=>{\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\n};\n/**\n * Create the state required to render DatePicker.\n *\n * The returned state can be modified with hooks such as useDatePickerStyles_unstable,\n * before being passed to renderDatePicker_unstable.\n *\n * @param props - props from this instance of DatePicker\n * @param ref - reference to root Input slot\n */ export const useDatePicker_unstable = (props, ref)=>{\n var _fieldContext;\n const { allowTextInput = false, allFocusable = false, borderless = false, dateTimeFormatter, defaultOpen = false, disableAutoFocus = true, firstDayOfWeek = DayOfWeek.Sunday, firstWeekOfYear = FirstWeekOfYear.FirstDay, formatDate = defaultFormatDate, highlightCurrentMonth = false, highlightSelectedMonth = false, initialPickerDate = new Date(), inlinePopup = false, isMonthPickerVisible = true, maxDate, minDate, mountNode, onOpenChange, onSelectDate: onUserSelectDate, openOnClick = true, onValidationResult, parseDateFromString = defaultParseDateFromString, showCloseButton = false, showGoToToday = true, showMonthPickerAsOverlay = false, showWeekNumbers = false, strings = defaultDatePickerStrings, today, underlined = false, value, ...restOfProps } = props;\n const calendar = React.useRef(null);\n const [focus, rootRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();\n const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({\n formatDate,\n onSelectDate: onUserSelectDate,\n value\n });\n const [open, setOpenState] = usePopupVisibility(props);\n const fieldContext = useFieldContext();\n var _fieldContext_required;\n const required = (_fieldContext_required = (_fieldContext = fieldContext) === null || _fieldContext === void 0 ? void 0 : _fieldContext.required) !== null && _fieldContext_required !== void 0 ? _fieldContext_required : props.required;\n const popupSurfaceId = useId('datePicker-popupSurface');\n const validateTextInput = React.useCallback((date = null)=>{\n var _onValidationResult;\n let error;\n if (allowTextInput) {\n if (formattedDate || date) {\n // Don't parse if the selected date has the same formatted string as what we're about to parse.\n // The formatted string might be ambiguous (ex: \"1/2/3\" or \"New Year Eve\") and the parser might\n // not be able to come up with the exact same date.\n if (selectedDate && formatDate && formatDate(date !== null && date !== void 0 ? date : selectedDate) === formattedDate) {\n return;\n }\n date = date || parseDateFromString(formattedDate);\n // Check if date is null or date is an invalid date\n if (!date || isNaN(date.getTime())) {\n // Reset input if formatting is available\n setSelectedDate(selectedDate);\n error = 'invalid-input';\n } else {\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n error = 'out-of-bounds';\n } else {\n setSelectedDate(date);\n }\n }\n } else {\n var _onUserSelectDate;\n if (required) {\n error = 'required-input';\n }\n (_onUserSelectDate = onUserSelectDate) === null || _onUserSelectDate === void 0 ? void 0 : _onUserSelectDate(date);\n }\n } else if (required && !formattedDate) {\n error = 'required-input';\n }\n (_onValidationResult = onValidationResult) === null || _onValidationResult === void 0 ? void 0 : _onValidationResult({\n error\n });\n }, [\n allowTextInput,\n formatDate,\n formattedDate,\n maxDate,\n minDate,\n onUserSelectDate,\n onValidationResult,\n parseDateFromString,\n required,\n selectedDate,\n setSelectedDate\n ]);\n const setOpen = React.useCallback((newState)=>{\n var _onOpenChange;\n (_onOpenChange = onOpenChange) === null || _onOpenChange === void 0 ? void 0 : _onOpenChange(newState);\n setOpenState(newState);\n if (!open && !props.disabled) {\n focus();\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n focus,\n onOpenChange,\n props.disabled,\n setOpenState\n ]);\n const dismissDatePickerPopup = React.useCallback((newlySelectedDate)=>{\n if (open) {\n setOpen(false);\n validateTextInput(newlySelectedDate);\n if (!allowTextInput && newlySelectedDate) {\n setSelectedDate(newlySelectedDate);\n }\n }\n }, [\n allowTextInput,\n open,\n setOpen,\n setSelectedDate,\n validateTextInput\n ]);\n const showDatePickerPopup = React.useCallback(()=>{\n if (!open) {\n preventNextFocusOpeningPicker();\n setOpen(true);\n }\n }, [\n open,\n preventNextFocusOpeningPicker,\n setOpen\n ]);\n /**\n * Callback for closing the calendar callout\n */ const calendarDismissed = React.useCallback((newlySelectedDate)=>{\n preventNextFocusOpeningPicker();\n dismissDatePickerPopup(newlySelectedDate);\n }, [\n dismissDatePickerPopup,\n preventNextFocusOpeningPicker\n ]);\n const onInputChange = React.useCallback((ev, data)=>{\n const { value: newValue } = data;\n if (allowTextInput) {\n if (open) {\n dismissDatePickerPopup();\n }\n setFormattedDate(newValue);\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n setFormattedDate\n ]);\n const onInputBlur = React.useCallback(()=>{\n validateTextInput();\n }, [\n validateTextInput\n ]);\n const onInputKeyDown = React.useCallback((ev)=>{\n switch(ev.key){\n case Enter:\n ev.preventDefault();\n ev.stopPropagation();\n if (!open) {\n validateTextInput();\n showDatePickerPopup();\n } else {\n // When DatePicker allows input date string directly,\n // it is expected to hit another enter to close the popup\n if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n }\n break;\n case Escape:\n ev.stopPropagation();\n ev.preventDefault();\n if (open) {\n calendarDismissed();\n }\n break;\n case ArrowDown:\n ev.preventDefault();\n if (ev.altKey && !open) {\n showDatePickerPopup();\n }\n break;\n default:\n break;\n }\n }, [\n calendarDismissed,\n dismissDatePickerPopup,\n open,\n props.allowTextInput,\n showDatePickerPopup,\n validateTextInput\n ]);\n const onInputFocus = React.useCallback(()=>{\n if (disableAutoFocus) {\n return;\n }\n if (!allowTextInput) {\n if (!preventFocusOpeningPicker.current) {\n showDatePickerPopup();\n }\n preventFocusOpeningPicker.current = false;\n }\n }, [\n allowTextInput,\n disableAutoFocus,\n preventFocusOpeningPicker,\n showDatePickerPopup\n ]);\n const onInputClick = React.useCallback(()=>{\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n if ((props.openOnClick || !props.disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n props.disabled,\n props.disableAutoFocus,\n props.openOnClick,\n showDatePickerPopup\n ]);\n const onIconClick = (ev)=>{\n ev.stopPropagation();\n if (!open && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n const inputAppearance = underlined ? 'underline' : borderless ? 'filled-lighter' : 'outline';\n const [triggerWrapperRef, popupRef] = usePopupPositioning(props);\n const root = slot.always(restOfProps, {\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: /*#__PURE__*/ React.createElement(CalendarMonthRegular, {\n onClick: onIconClick\n }),\n readOnly: !allowTextInput,\n role: 'combobox'\n },\n elementType: Input\n });\n const inputRoot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': open ? popupSurfaceId : undefined,\n ref: triggerWrapperRef\n },\n elementType: 'span'\n });\n inputRoot.ref = useMergedRefs(inputRoot.ref, triggerWrapperRef);\n root.root = inputRoot;\n const inputShorthand = slot.always(props.input, {\n elementType: 'input'\n });\n inputShorthand.ref = useMergedRefs(inputShorthand.ref, ref, rootRef);\n root.input = inputShorthand;\n root.onChange = useEventCallback(mergeCallbacks(root.onChange, onInputChange));\n root.onBlur = useEventCallback(mergeCallbacks(root.onBlur, onInputBlur));\n root.onKeyDown = useEventCallback(mergeCallbacks(root.onKeyDown, onInputKeyDown));\n root.onFocus = useEventCallback(mergeCallbacks(root.onFocus, onInputFocus));\n root.onClick = useEventCallback(mergeCallbacks(root.onClick, onInputClick));\n const { modalAttributes } = useModalAttributes({\n trapFocus: true,\n alwaysFocusable: true,\n legacyTrapFocus: false\n });\n const popupSurface = open ? slot.optional(props.popupSurface, {\n renderByDefault: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes\n },\n elementType: 'div'\n }) : undefined;\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n });\n useOnScrollOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n }); // When the popup is opened, focus should go to the calendar.\n // In v8 this was done by focusing after the callout was positioned, but in v9 this can be simulated by using a\n // useEffect hook.\n React.useEffect(()=>{\n if (open && !props.disabled && calendar.current) {\n calendar.current.focus();\n }\n }, [\n disableAutoFocus,\n open,\n props.disabled\n ]);\n const calendarShorthand = slot.always(props.calendar, {\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate\n },\n elementType: Calendar\n });\n calendarShorthand.onDismiss = useEventCallback(mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed));\n calendarShorthand.onSelectDate = useEventCallback(mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed));\n const state = {\n disabled: !!props.disabled,\n inlinePopup,\n components: {\n root: Input,\n calendar: Calendar,\n popupSurface: 'div'\n },\n calendar: calendarShorthand,\n mountNode,\n root,\n popupSurface\n };\n state.root.value = formattedDate;\n return state;\n};\n"],"names":["useDatePicker_unstable","isDateOutOfBounds","date","minDate","maxDate","compareDatePart","useFocusLogic","inputRef","React","useRef","preventFocusOpeningPicker","focus","useCallback","_inputRef_current_focus","_inputRef_current","current","call","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","useControllableState","initialState","defaultState","defaultOpen","state","isMounted","useEffect","_props_onOpenChange","_props","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","formattedDate","setFormattedDate","useState","setSelectedDate","newDate","_onSelectDate","defaultFormatDate","toDateString","defaultParseDateFromString","dateStr","Date","parse","ref","_fieldContext","allFocusable","borderless","dateTimeFormatter","disableAutoFocus","firstDayOfWeek","DayOfWeek","Sunday","firstWeekOfYear","FirstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","inlinePopup","isMonthPickerVisible","mountNode","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","defaultDatePickerStrings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","useFieldContext","_fieldContext_required","required","popupSurfaceId","useId","validateTextInput","_onValidationResult","error","isNaN","getTime","_onUserSelectDate","newState","_onOpenChange","disabled","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","Enter","preventDefault","stopPropagation","Escape","ArrowDown","altKey","onInputFocus","onInputClick","onIconClick","inputAppearance","triggerWrapperRef","popupRef","usePopupPositioning","root","slot","always","defaultProps","appearance","undefined","contentAfter","createElement","CalendarMonthRegular","onClick","readOnly","role","elementType","Input","inputRoot","useMergedRefs","inputShorthand","input","onChange","useEventCallback","mergeCallbacks","onBlur","onKeyDown","onFocus","modalAttributes","useModalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurface","optional","renderByDefault","id","targetDocument","useFluent","useOnClickOutside","element","callback","refs","useOnScrollOutside","calendarShorthand","componentRef","Calendar","onDismiss","components"],"mappings":";;;;+BA+FiBA;;;eAAAA;;;;iEA/FM;8BACkB;0BAChB;4BACY;uBACuB;0BACnB;4BACnB;gCACoH;4BAC9E;qCACZ;8BACb;qCACC;AACpC,SAASC,kBAAkBC,IAAI,EAAEC,OAAO,EAAEC,OAAO;IAC7C,OAAO,CAAC,CAACD,WAAWE,IAAAA,sBAAe,EAACF,SAASD,QAAQ,KAAK,CAAC,CAACE,WAAWC,IAAAA,sBAAe,EAACD,SAASF,QAAQ;AAC5G;AACA,SAASI;IACL,MAAMC,WAAWC,OAAMC,MAAM,CAAC;IAC9B,MAAMC,4BAA4BF,OAAMC,MAAM,CAAC;IAC/C,MAAME,QAAQH,OAAMI,WAAW,CAAC;QAC5B,IAAIC,yBAAyBC;QAC5BA,CAAAA,oB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jB;IACD,MAAMiE,oBAAoBvC,oBAAI,CAACC,MAAM,CAAC3G,MAAM+D,QAAQ,EAAE;QAClD6C,cAAc;YACV1E;YACAgH,cAAcnF;YACd3B;YACAE;YACAG;YACAG;YACAC;YACAG;YACA/D;YACAD;YACAsE;YACAC;YACAC;YACAC;YACAC;YACAE;YACA3C,OAAOC,gBAAgB4B;QAC3B;QACAuE,aAAa8B,kBAAQ;IACzB;IACAF,kBAAkBG,SAAS,GAAGxB,IAAAA,gCAAgB,EAACC,IAAAA,8BAAc,EAACoB,kBAAkBG,SAAS,EAAEhE;IAC3F6D,kBAAkBjI,YAAY,GAAG4G,IAAAA,gCAAgB,EAACC,IAAAA,8BAAc,EAACoB,kBAAkBjI,YAAY,EAAEoE;IACjG,MAAM7E,QAAQ;QACVyE,UAAU,CAAC,CAAChF,MAAMgF,QAAQ;QAC1BjC;QACAsG,YAAY;YACR5C,MAAMa,iBAAK;YACXvD,UAAUoF,kBAAQ;YAClBb,cAAc;QAClB;QACAvE,UAAUkF;QACVhG;QACAwD;QACA6B;IACJ;IACA/H,MAAMkG,IAAI,CAACxF,KAAK,GAAGG;IACnB,OAAOb;AACX"}
1
+ {"version":3,"sources":["useDatePicker.js"],"sourcesContent":["import * as React from 'react';\nimport { ArrowDown, Enter, Escape } from '@fluentui/keyboard-keys';\nimport { Calendar } from '../Calendar/Calendar';\nimport { CalendarMonthRegular } from '@fluentui/react-icons';\nimport { compareDatePart, DayOfWeek, FirstWeekOfYear } from '../../utils';\nimport { defaultDatePickerStrings } from './defaults';\nimport { Input } from '@fluentui/react-input';\nimport { mergeCallbacks, useControllableState, useEventCallback, useId, useMergedRefs, useOnClickOutside, useOnScrollOutside, slot } from '@fluentui/react-utilities';\nimport { useFieldContext_unstable as useFieldContext } from '@fluentui/react-field';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopupPositioning } from '../../utils/usePopupPositioning';\nfunction isDateOutOfBounds(date, minDate, maxDate) {\n return !!minDate && compareDatePart(minDate, date) > 0 || !!maxDate && compareDatePart(maxDate, date) < 0;\n}\nfunction useFocusLogic() {\n const inputRef = React.useRef(null);\n const preventFocusOpeningPicker = React.useRef(false);\n const focus = React.useCallback(()=>{\n var _inputRef_current_focus, _inputRef_current;\n (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : (_inputRef_current_focus = _inputRef_current.focus) === null || _inputRef_current_focus === void 0 ? void 0 : _inputRef_current_focus.call(_inputRef_current);\n }, []);\n const preventNextFocusOpeningPicker = React.useCallback(()=>{\n preventFocusOpeningPicker.current = true;\n }, []);\n return [\n focus,\n inputRef,\n preventFocusOpeningPicker,\n preventNextFocusOpeningPicker\n ];\n}\nfunction usePopupVisibility(props) {\n const [open, setOpen] = useControllableState({\n initialState: false,\n defaultState: props.defaultOpen,\n state: props.open\n });\n const isMounted = React.useRef(false);\n React.useEffect(()=>{\n if (isMounted.current && !open) {\n var // If DatePicker's menu (Calendar) is closed, run onAfterMenuDismiss\n _props_onOpenChange;\n (_props_onOpenChange = props.onOpenChange) === null || _props_onOpenChange === void 0 ? void 0 : _props_onOpenChange.call(props, false);\n }\n isMounted.current = true;\n }, // Should only run on allowTextInput or open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n props.allowTextInput,\n open\n ]);\n return [\n open,\n setOpen\n ];\n}\nfunction useSelectedDate({ formatDate, onSelectDate, value }) {\n const [selectedDate, setSelectedDateState] = useControllableState({\n initialState: null,\n state: value\n });\n const [formattedDate, setFormattedDate] = React.useState(()=>value && formatDate ? formatDate(value) : '');\n const setSelectedDate = (newDate)=>{\n onSelectDate === null || onSelectDate === void 0 ? void 0 : onSelectDate(newDate);\n setSelectedDateState(newDate);\n setFormattedDate(newDate && formatDate ? formatDate(newDate) : '');\n };\n React.useEffect(()=>{\n setFormattedDate(value && formatDate ? formatDate(value) : '');\n }, [\n formatDate,\n value\n ]);\n return [\n selectedDate,\n formattedDate,\n setSelectedDate,\n setFormattedDate\n ];\n}\nconst defaultFormatDate = (date)=>date ? date.toDateString() : '';\nconst defaultParseDateFromString = (dateStr)=>{\n const date = Date.parse(dateStr);\n return date ? new Date(date) : null;\n};\n/**\n * Create the state required to render DatePicker.\n *\n * The returned state can be modified with hooks such as useDatePickerStyles_unstable,\n * before being passed to renderDatePicker_unstable.\n *\n * @param props - props from this instance of DatePicker\n * @param ref - reference to root Input slot\n */ export const useDatePicker_unstable = (props, ref)=>{\n const { allowTextInput = false, allFocusable = false, borderless = false, dateTimeFormatter, defaultOpen = false, disableAutoFocus = true, firstDayOfWeek = DayOfWeek.Sunday, firstWeekOfYear = FirstWeekOfYear.FirstDay, formatDate = defaultFormatDate, highlightCurrentMonth = false, highlightSelectedMonth = false, initialPickerDate = new Date(), inlinePopup = false, isMonthPickerVisible = true, maxDate, minDate, mountNode, onOpenChange, onSelectDate: onUserSelectDate, openOnClick = true, onValidationResult, parseDateFromString = defaultParseDateFromString, showCloseButton = false, showGoToToday = true, showMonthPickerAsOverlay = false, showWeekNumbers = false, strings = defaultDatePickerStrings, today, underlined = false, value, ...restOfProps } = props;\n const calendar = React.useRef(null);\n const [focus, rootRef, preventFocusOpeningPicker, preventNextFocusOpeningPicker] = useFocusLogic();\n const [selectedDate, formattedDate, setSelectedDate, setFormattedDate] = useSelectedDate({\n formatDate,\n onSelectDate: onUserSelectDate,\n value\n });\n const [open, setOpenState] = usePopupVisibility(props);\n const fieldContext = useFieldContext();\n var _fieldContext_required;\n const required = (_fieldContext_required = fieldContext === null || fieldContext === void 0 ? void 0 : fieldContext.required) !== null && _fieldContext_required !== void 0 ? _fieldContext_required : props.required;\n const popupSurfaceId = useId('datePicker-popupSurface');\n const validateTextInput = React.useCallback((date = null)=>{\n let error;\n if (allowTextInput) {\n if (formattedDate || date) {\n // Don't parse if the selected date has the same formatted string as what we're about to parse.\n // The formatted string might be ambiguous (ex: \"1/2/3\" or \"New Year Eve\") and the parser might\n // not be able to come up with the exact same date.\n if (selectedDate && formatDate && formatDate(date !== null && date !== void 0 ? date : selectedDate) === formattedDate) {\n return;\n }\n date = date || parseDateFromString(formattedDate);\n // Check if date is null or date is an invalid date\n if (!date || isNaN(date.getTime())) {\n // Reset input if formatting is available\n setSelectedDate(selectedDate);\n error = 'invalid-input';\n } else {\n if (isDateOutOfBounds(date, minDate, maxDate)) {\n error = 'out-of-bounds';\n } else {\n setSelectedDate(date);\n }\n }\n } else {\n if (required) {\n error = 'required-input';\n }\n onUserSelectDate === null || onUserSelectDate === void 0 ? void 0 : onUserSelectDate(date);\n }\n } else if (required && !formattedDate) {\n error = 'required-input';\n }\n onValidationResult === null || onValidationResult === void 0 ? void 0 : onValidationResult({\n error\n });\n }, [\n allowTextInput,\n formatDate,\n formattedDate,\n maxDate,\n minDate,\n onUserSelectDate,\n onValidationResult,\n parseDateFromString,\n required,\n selectedDate,\n setSelectedDate\n ]);\n const setOpen = React.useCallback((newState)=>{\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(newState);\n setOpenState(newState);\n if (!open && !props.disabled) {\n focus();\n }\n }, // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n focus,\n onOpenChange,\n props.disabled,\n setOpenState\n ]);\n const dismissDatePickerPopup = React.useCallback((newlySelectedDate)=>{\n if (open) {\n setOpen(false);\n validateTextInput(newlySelectedDate);\n if (!allowTextInput && newlySelectedDate) {\n setSelectedDate(newlySelectedDate);\n }\n }\n }, [\n allowTextInput,\n open,\n setOpen,\n setSelectedDate,\n validateTextInput\n ]);\n const showDatePickerPopup = React.useCallback(()=>{\n if (!open) {\n preventNextFocusOpeningPicker();\n setOpen(true);\n }\n }, [\n open,\n preventNextFocusOpeningPicker,\n setOpen\n ]);\n /**\n * Callback for closing the calendar callout\n */ const calendarDismissed = React.useCallback((newlySelectedDate)=>{\n preventNextFocusOpeningPicker();\n dismissDatePickerPopup(newlySelectedDate);\n }, [\n dismissDatePickerPopup,\n preventNextFocusOpeningPicker\n ]);\n const onInputChange = React.useCallback((ev, data)=>{\n const { value: newValue } = data;\n if (allowTextInput) {\n if (open) {\n dismissDatePickerPopup();\n }\n setFormattedDate(newValue);\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n setFormattedDate\n ]);\n const onInputBlur = React.useCallback(()=>{\n validateTextInput();\n }, [\n validateTextInput\n ]);\n const onInputKeyDown = React.useCallback((ev)=>{\n switch(ev.key){\n case Enter:\n ev.preventDefault();\n ev.stopPropagation();\n if (!open) {\n validateTextInput();\n showDatePickerPopup();\n } else {\n // When DatePicker allows input date string directly,\n // it is expected to hit another enter to close the popup\n if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n }\n break;\n case Escape:\n ev.stopPropagation();\n ev.preventDefault();\n if (open) {\n calendarDismissed();\n }\n break;\n case ArrowDown:\n ev.preventDefault();\n if (ev.altKey && !open) {\n showDatePickerPopup();\n }\n break;\n default:\n break;\n }\n }, [\n calendarDismissed,\n dismissDatePickerPopup,\n open,\n props.allowTextInput,\n showDatePickerPopup,\n validateTextInput\n ]);\n const onInputFocus = React.useCallback(()=>{\n if (disableAutoFocus) {\n return;\n }\n if (!allowTextInput) {\n if (!preventFocusOpeningPicker.current) {\n showDatePickerPopup();\n }\n preventFocusOpeningPicker.current = false;\n }\n }, [\n allowTextInput,\n disableAutoFocus,\n preventFocusOpeningPicker,\n showDatePickerPopup\n ]);\n const onInputClick = React.useCallback(()=>{\n // default openOnClick to !props.disableAutoFocus for legacy support of disableAutoFocus behavior\n if ((props.openOnClick || !props.disableAutoFocus) && !open && !props.disabled) {\n showDatePickerPopup();\n return;\n }\n if (allowTextInput) {\n dismissDatePickerPopup();\n }\n }, [\n allowTextInput,\n dismissDatePickerPopup,\n open,\n props.disabled,\n props.disableAutoFocus,\n props.openOnClick,\n showDatePickerPopup\n ]);\n const onIconClick = (ev)=>{\n ev.stopPropagation();\n if (!open && !props.disabled) {\n showDatePickerPopup();\n } else if (props.allowTextInput) {\n dismissDatePickerPopup();\n }\n };\n const inputAppearance = underlined ? 'underline' : borderless ? 'filled-lighter' : 'outline';\n const [triggerWrapperRef, popupRef] = usePopupPositioning(props);\n const root = slot.always(restOfProps, {\n defaultProps: {\n appearance: inputAppearance,\n 'aria-controls': open ? popupSurfaceId : undefined,\n 'aria-expanded': open,\n 'aria-haspopup': 'dialog',\n contentAfter: /*#__PURE__*/ React.createElement(CalendarMonthRegular, {\n onClick: onIconClick\n }),\n readOnly: !allowTextInput,\n role: 'combobox'\n },\n elementType: Input\n });\n const inputRoot = slot.always(props.root, {\n defaultProps: {\n 'aria-owns': open ? popupSurfaceId : undefined,\n ref: triggerWrapperRef\n },\n elementType: 'span'\n });\n inputRoot.ref = useMergedRefs(inputRoot.ref, triggerWrapperRef);\n root.root = inputRoot;\n const inputShorthand = slot.always(props.input, {\n elementType: 'input'\n });\n inputShorthand.ref = useMergedRefs(inputShorthand.ref, ref, rootRef);\n root.input = inputShorthand;\n root.onChange = useEventCallback(mergeCallbacks(root.onChange, onInputChange));\n root.onBlur = useEventCallback(mergeCallbacks(root.onBlur, onInputBlur));\n root.onKeyDown = useEventCallback(mergeCallbacks(root.onKeyDown, onInputKeyDown));\n root.onFocus = useEventCallback(mergeCallbacks(root.onFocus, onInputFocus));\n root.onClick = useEventCallback(mergeCallbacks(root.onClick, onInputClick));\n const { modalAttributes } = useModalAttributes({\n trapFocus: true,\n alwaysFocusable: true,\n legacyTrapFocus: false\n });\n const popupSurface = open ? slot.optional(props.popupSurface, {\n renderByDefault: true,\n defaultProps: {\n 'aria-label': 'Calendar',\n 'aria-modal': true,\n id: popupSurfaceId,\n role: 'dialog',\n ref: popupRef,\n ...modalAttributes\n },\n elementType: 'div'\n }) : undefined;\n const { targetDocument } = useFluent();\n useOnClickOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n });\n useOnScrollOutside({\n element: targetDocument,\n callback: (ev)=>dismissDatePickerPopup(),\n refs: [\n triggerWrapperRef,\n popupRef\n ],\n disabled: !open\n }); // When the popup is opened, focus should go to the calendar.\n // In v8 this was done by focusing after the callout was positioned, but in v9 this can be simulated by using a\n // useEffect hook.\n React.useEffect(()=>{\n if (open && !props.disabled && calendar.current) {\n calendar.current.focus();\n }\n }, [\n disableAutoFocus,\n open,\n props.disabled\n ]);\n const calendarShorthand = slot.always(props.calendar, {\n defaultProps: {\n allFocusable,\n componentRef: calendar,\n dateTimeFormatter,\n firstDayOfWeek,\n firstWeekOfYear,\n highlightCurrentMonth,\n highlightSelectedMonth,\n isMonthPickerVisible,\n maxDate,\n minDate,\n showCloseButton,\n showGoToToday,\n showMonthPickerAsOverlay,\n showWeekNumbers,\n strings,\n today,\n value: selectedDate || initialPickerDate\n },\n elementType: Calendar\n });\n calendarShorthand.onDismiss = useEventCallback(mergeCallbacks(calendarShorthand.onDismiss, calendarDismissed));\n calendarShorthand.onSelectDate = useEventCallback(mergeCallbacks(calendarShorthand.onSelectDate, calendarDismissed));\n const state = {\n disabled: !!props.disabled,\n inlinePopup,\n components: {\n root: Input,\n calendar: Calendar,\n popupSurface: 'div'\n },\n calendar: calendarShorthand,\n mountNode,\n root,\n popupSurface\n };\n state.root.value = formattedDate;\n return state;\n};\n"],"names":["useDatePicker_unstable","isDateOutOfBounds","date","minDate","maxDate","compareDatePart","useFocusLogic","inputRef","React","useRef","preventFocusOpeningPicker","focus","useCallback","_inputRef_current_focus","_inputRef_current","current","call","preventNextFocusOpeningPicker","usePopupVisibility","props","open","setOpen","useControllableState","initialState","defaultState","defaultOpen","state","isMounted","useEffect","_props_onOpenChange","onOpenChange","allowTextInput","useSelectedDate","formatDate","onSelectDate","value","selectedDate","setSelectedDateState","formattedDate","setFormattedDate","useState","setSelectedDate","newDate","defaultFormatDate","toDateString","defaultParseDateFromString","dateStr","Date","parse","ref","allFocusable","borderless","dateTimeFormatter","disableAutoFocus","firstDayOfWeek","DayOfWeek","Sunday","firstWeekOfYear","FirstWeekOfYear","FirstDay","highlightCurrentMonth","highlightSelectedMonth","initialPickerDate","inlinePopup","isMonthPickerVisible","mountNode","onUserSelectDate","openOnClick","onValidationResult","parseDateFromString","showCloseButton","showGoToToday","showMonthPickerAsOverlay","showWeekNumbers","strings","defaultDatePickerStrings","today","underlined","restOfProps","calendar","rootRef","setOpenState","fieldContext","useFieldContext","_fieldContext_required","required","popupSurfaceId","useId","validateTextInput","error","isNaN","getTime","newState","disabled","dismissDatePickerPopup","newlySelectedDate","showDatePickerPopup","calendarDismissed","onInputChange","ev","data","newValue","onInputBlur","onInputKeyDown","key","Enter","preventDefault","stopPropagation","Escape","ArrowDown","altKey","onInputFocus","onInputClick","onIconClick","inputAppearance","triggerWrapperRef","popupRef","usePopupPositioning","root","slot","always","defaultProps","appearance","undefined","contentAfter","createElement","CalendarMonthRegular","onClick","readOnly","role","elementType","Input","inputRoot","useMergedRefs","inputShorthand","input","onChange","useEventCallback","mergeCallbacks","onBlur","onKeyDown","onFocus","modalAttributes","useModalAttributes","trapFocus","alwaysFocusable","legacyTrapFocus","popupSurface","optional","renderByDefault","id","targetDocument","useFluent","useOnClickOutside","element","callback","refs","useOnScrollOutside","calendarShorthand","componentRef","Calendar","onDismiss","components"],"mappings":";;;;+BA8FiBA;;;eAAAA;;;;iEA9FM;8BACkB;0BAChB;4BACY;uBACuB;0BACnB;4BACnB;gCACoH;4BAC9E;qCACZ;8BACb;qCACC;AACpC,SAASC,kBAAkBC,IAAI,EAAEC,OAAO,EAAEC,OAAO;IAC7C,OAAO,CAAC,CAACD,WAAWE,IAAAA,sBAAe,EAACF,SAASD,QAAQ,KAAK,CAAC,CAACE,WAAWC,IAAAA,sBAAe,EAACD,SAASF,QAAQ;AAC5G;AACA,SAASI;IACL,MAAMC,WAAWC,OAAMC,MAAM,CAAC;IAC9B,MAAMC,4BAA4BF,OAAMC,MAAM,CAAC;IAC/C,MAAME,QAAQH,OAAMI,WAAW,CAAC;QAC5B,IAAIC,yBAAyBC;QAC5BA,CAAAA,oBAAoBP,SAAS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Q;IACzB;IACAF,kBAAkBG,SAAS,GAAGxB,IAAAA,gCAAgB,EAACC,IAAAA,8BAAc,EAACoB,kBAAkBG,SAAS,EAAEhE;IAC3F6D,kBAAkB5H,YAAY,GAAGuG,IAAAA,gCAAgB,EAACC,IAAAA,8BAAc,EAACoB,kBAAkB5H,YAAY,EAAE+D;IACjG,MAAMvE,QAAQ;QACVmE,UAAU,CAAC,CAAC1E,MAAM0E,QAAQ;QAC1B9B;QACAmG,YAAY;YACR5C,MAAMa,iBAAK;YACXpD,UAAUiF,kBAAQ;YAClBb,cAAc;QAClB;QACApE,UAAU+E;QACV7F;QACAqD;QACA6B;IACJ;IACAzH,MAAM4F,IAAI,CAACnF,KAAK,GAAGG;IACnB,OAAOZ;AACX"}
@@ -50,7 +50,6 @@ const getDayGrid = (options)=>{
50
50
  const week = [];
51
51
  isAllDaysOfWeekOutOfMonth = true;
52
52
  for(let dayIndex = 0; dayIndex < _constants.DAYS_IN_WEEK; dayIndex++){
53
- var _markedDays;
54
53
  const originalDate = new Date(date.getTime());
55
54
  const dayInfo = {
56
55
  key: date.toString(),
@@ -60,7 +59,7 @@ const getDayGrid = (options)=>{
60
59
  isToday: (0, _dateMath.compareDates)(todaysDate, date),
61
60
  isSelected: (0, _dateMath.isInDateRangeArray)(date, selectedDates),
62
61
  isInBounds: !(0, _isRestrictedDate.isRestrictedDate)(date, restrictedDateOptions),
63
- isMarked: ((_markedDays = markedDays) === null || _markedDays === void 0 ? void 0 : _markedDays.some((markedDay)=>(0, _dateMath.compareDates)(originalDate, markedDay))) || false
62
+ isMarked: (markedDays === null || markedDays === void 0 ? void 0 : markedDays.some((markedDay)=>(0, _dateMath.compareDates)(originalDate, markedDay))) || false
64
63
  };
65
64
  week.push(dayInfo);
66
65
  if (dayInfo.isInMonth) {
@@ -1 +1 @@
1
- {"version":3,"sources":["getDayGrid.js"],"sourcesContent":["import { addDays, compareDates, getDateRangeArray, isInDateRangeArray } from '../dateMath/dateMath';\nimport { DAYS_IN_WEEK } from '../constants';\nimport { getDateRangeTypeToUse } from './getDateRangeTypeToUse';\nimport { getBoundedDateRange } from './getBoundedDateRange';\nimport { isRestrictedDate } from './isRestrictedDate';\n/**\n * Generates a grid of days, given the `options`.\n * Returns one additional week at the begining from the previous range\n * and one at the end from the future range\n * @param options - parameters to specify date related restrictions for the resulting grid\n */ export const getDayGrid = (options)=>{\n const { selectedDate, dateRangeType, firstDayOfWeek, today, minDate, maxDate, weeksToShow, workWeekDays, daysToSelectInDayView, restrictedDates, markedDays } = options;\n const restrictedDateOptions = {\n minDate,\n maxDate,\n restrictedDates\n };\n const todaysDate = today || new Date();\n const navigatedDate = options.navigatedDate ? options.navigatedDate : todaysDate;\n let date;\n if (weeksToShow && weeksToShow <= 4) {\n // if showing less than a full month, just use date == navigatedDate\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), navigatedDate.getDate());\n } else {\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), 1);\n }\n const weeks = [];\n // Cycle the date backwards to get to the first day of the week.\n while(date.getDay() !== firstDayOfWeek){\n date.setDate(date.getDate() - 1);\n }\n // add the transition week as last week of previous range\n date = addDays(date, -DAYS_IN_WEEK);\n // a flag to indicate whether all days of the week are outside the month\n let isAllDaysOfWeekOutOfMonth = false;\n // in work week view if the days aren't contiguous we use week view instead\n const selectedDateRangeType = getDateRangeTypeToUse(dateRangeType, workWeekDays, firstDayOfWeek);\n let selectedDates = [];\n if (selectedDate) {\n selectedDates = getDateRangeArray(selectedDate, selectedDateRangeType, firstDayOfWeek, workWeekDays, daysToSelectInDayView);\n selectedDates = getBoundedDateRange(selectedDates, minDate, maxDate);\n }\n let shouldGetWeeks = true;\n for(let weekIndex = 0; shouldGetWeeks; weekIndex++){\n const week = [];\n isAllDaysOfWeekOutOfMonth = true;\n for(let dayIndex = 0; dayIndex < DAYS_IN_WEEK; dayIndex++){\n var _markedDays;\n const originalDate = new Date(date.getTime());\n const dayInfo = {\n key: date.toString(),\n date: date.getDate().toString(),\n originalDate,\n isInMonth: date.getMonth() === navigatedDate.getMonth(),\n isToday: compareDates(todaysDate, date),\n isSelected: isInDateRangeArray(date, selectedDates),\n isInBounds: !isRestrictedDate(date, restrictedDateOptions),\n isMarked: ((_markedDays = markedDays) === null || _markedDays === void 0 ? void 0 : _markedDays.some((markedDay)=>compareDates(originalDate, markedDay))) || false\n };\n week.push(dayInfo);\n if (dayInfo.isInMonth) {\n isAllDaysOfWeekOutOfMonth = false;\n }\n date.setDate(date.getDate() + 1);\n }\n // We append the condition of the loop depending upon the showSixWeeksByDefault prop.\n shouldGetWeeks = weeksToShow ? weekIndex < weeksToShow + 1 : !isAllDaysOfWeekOutOfMonth || weekIndex === 0;\n // we don't check shouldGetWeeks before pushing because we want to add one extra week for transition state\n weeks.push(week);\n }\n return weeks;\n};\n"],"names":["getDayGrid","options","selectedDate","dateRangeType","firstDayOfWeek","today","minDate","maxDate","weeksToShow","workWeekDays","daysToSelectInDayView","restrictedDates","markedDays","restrictedDateOptions","todaysDate","Date","navigatedDate","date","getFullYear","getMonth","getDate","weeks","getDay","setDate","addDays","DAYS_IN_WEEK","isAllDaysOfWeekOutOfMonth","selectedDateRangeType","getDateRangeTypeToUse","selectedDates","getDateRangeArray","getBoundedDateRange","shouldGetWeeks","weekIndex","week","dayIndex","_markedDays","originalDate","getTime","dayInfo","key","toString","isInMonth","isToday","compareDates","isSelected","isInDateRangeArray","isInBounds","isRestrictedDate","isMarked","some","markedDay","push"],"mappings":";;;;+BAUiBA;;;eAAAA;;;0BAV4D;2BAChD;uCACS;qCACF;kCACH;AAMtB,MAAMA,aAAa,CAACC;IAC3B,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAEC,cAAc,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAEC,YAAY,EAAEC,qBAAqB,EAAEC,eAAe,EAAEC,UAAU,EAAE,GAAGX;IAChK,MAAMY,wBAAwB;QAC1BP;QACAC;QACAI;IACJ;IACA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AA,sBAAY,EAAC9B,YAAYG;gBAClC4B,YAAYC,IAAAA,4BAAkB,EAAC7B,MAAMY;gBACrCkB,YAAY,CAACC,IAAAA,kCAAgB,EAAC/B,MAAMJ;gBACpCoC,UAAU,AAAC,CAAA,AAACb,CAAAA,cAAcxB,UAAS,MAAO,QAAQwB,gBAAgB,KAAK,IAAI,KAAK,IAAIA,YAAYc,IAAI,CAAC,CAACC,YAAYP,IAAAA,sBAAY,EAACP,cAAcc,WAAU,KAAM;YACjK;YACAjB,KAAKkB,IAAI,CAACb;YACV,IAAIA,QAAQG,SAAS,EAAE;gBACnBhB,4BAA4B;YAChC;YACAT,KAAKM,OAAO,CAACN,KAAKG,OAAO,KAAK;QAClC;QACA,qFAAqF;QACrFY,iBAAiBxB,cAAcyB,YAAYzB,cAAc,IAAI,CAACkB,6BAA6BO,cAAc;QACzG,0GAA0G;QAC1GZ,MAAM+B,IAAI,CAAClB;IACf;IACA,OAAOb;AACX"}
1
+ {"version":3,"sources":["getDayGrid.js"],"sourcesContent":["import { addDays, compareDates, getDateRangeArray, isInDateRangeArray } from '../dateMath/dateMath';\nimport { DAYS_IN_WEEK } from '../constants';\nimport { getDateRangeTypeToUse } from './getDateRangeTypeToUse';\nimport { getBoundedDateRange } from './getBoundedDateRange';\nimport { isRestrictedDate } from './isRestrictedDate';\n/**\n * Generates a grid of days, given the `options`.\n * Returns one additional week at the begining from the previous range\n * and one at the end from the future range\n * @param options - parameters to specify date related restrictions for the resulting grid\n */ export const getDayGrid = (options)=>{\n const { selectedDate, dateRangeType, firstDayOfWeek, today, minDate, maxDate, weeksToShow, workWeekDays, daysToSelectInDayView, restrictedDates, markedDays } = options;\n const restrictedDateOptions = {\n minDate,\n maxDate,\n restrictedDates\n };\n const todaysDate = today || new Date();\n const navigatedDate = options.navigatedDate ? options.navigatedDate : todaysDate;\n let date;\n if (weeksToShow && weeksToShow <= 4) {\n // if showing less than a full month, just use date == navigatedDate\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), navigatedDate.getDate());\n } else {\n date = new Date(navigatedDate.getFullYear(), navigatedDate.getMonth(), 1);\n }\n const weeks = [];\n // Cycle the date backwards to get to the first day of the week.\n while(date.getDay() !== firstDayOfWeek){\n date.setDate(date.getDate() - 1);\n }\n // add the transition week as last week of previous range\n date = addDays(date, -DAYS_IN_WEEK);\n // a flag to indicate whether all days of the week are outside the month\n let isAllDaysOfWeekOutOfMonth = false;\n // in work week view if the days aren't contiguous we use week view instead\n const selectedDateRangeType = getDateRangeTypeToUse(dateRangeType, workWeekDays, firstDayOfWeek);\n let selectedDates = [];\n if (selectedDate) {\n selectedDates = getDateRangeArray(selectedDate, selectedDateRangeType, firstDayOfWeek, workWeekDays, daysToSelectInDayView);\n selectedDates = getBoundedDateRange(selectedDates, minDate, maxDate);\n }\n let shouldGetWeeks = true;\n for(let weekIndex = 0; shouldGetWeeks; weekIndex++){\n const week = [];\n isAllDaysOfWeekOutOfMonth = true;\n for(let dayIndex = 0; dayIndex < DAYS_IN_WEEK; dayIndex++){\n const originalDate = new Date(date.getTime());\n const dayInfo = {\n key: date.toString(),\n date: date.getDate().toString(),\n originalDate,\n isInMonth: date.getMonth() === navigatedDate.getMonth(),\n isToday: compareDates(todaysDate, date),\n isSelected: isInDateRangeArray(date, selectedDates),\n isInBounds: !isRestrictedDate(date, restrictedDateOptions),\n isMarked: (markedDays === null || markedDays === void 0 ? void 0 : markedDays.some((markedDay)=>compareDates(originalDate, markedDay))) || false\n };\n week.push(dayInfo);\n if (dayInfo.isInMonth) {\n isAllDaysOfWeekOutOfMonth = false;\n }\n date.setDate(date.getDate() + 1);\n }\n // We append the condition of the loop depending upon the showSixWeeksByDefault prop.\n shouldGetWeeks = weeksToShow ? weekIndex < weeksToShow + 1 : !isAllDaysOfWeekOutOfMonth || weekIndex === 0;\n // we don't check shouldGetWeeks before pushing because we want to add one extra week for transition state\n weeks.push(week);\n }\n return weeks;\n};\n"],"names":["getDayGrid","options","selectedDate","dateRangeType","firstDayOfWeek","today","minDate","maxDate","weeksToShow","workWeekDays","daysToSelectInDayView","restrictedDates","markedDays","restrictedDateOptions","todaysDate","Date","navigatedDate","date","getFullYear","getMonth","getDate","weeks","getDay","setDate","addDays","DAYS_IN_WEEK","isAllDaysOfWeekOutOfMonth","selectedDateRangeType","getDateRangeTypeToUse","selectedDates","getDateRangeArray","getBoundedDateRange","shouldGetWeeks","weekIndex","week","dayIndex","originalDate","getTime","dayInfo","key","toString","isInMonth","isToday","compareDates","isSelected","isInDateRangeArray","isInBounds","isRestrictedDate","isMarked","some","markedDay","push"],"mappings":";;;;+BAUiBA;;;eAAAA;;;0BAV4D;2BAChD;uCACS;qCACF;kCACH;AAMtB,MAAMA,aAAa,CAACC;IAC3B,MAAM,EAAEC,YAAY,EAAEC,aAAa,EAAEC,cAAc,EAAEC,KAAK,EAAEC,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAEC,YAAY,EAAEC,qBAAqB,EAAEC,eAAe,EAAEC,UAAU,EAAE,GAAGX;IAChK,MAAMY,wBAAwB;QAC1BP;QACAC;QACAI;IACJ;IACA,MAAMG,aAAaT,SAAS,IAAIU;IAChC,MAAMC,gBAAgBf,QAAQe,aAAa,GAAGf,QAAQe,aAAa,GAAGF;IACtE,IAAIG;IACJ,IAAIT,eAAeA,eAAe,GAAG;QACjC,oEAAoE;QACpES,OAAO,IAAIF,KAAKC,cAAcE,WAAW,IAAIF,cAAcG,QAAQ,IAAIH,cAAcI,OAAO;IAChG,OAAO;QACHH,OAAO,IAAIF,KAAKC,cAAcE,WAAW,IAAIF,cAAcG,QAAQ,IAAI;IAC3E;IACA,MAAME,QAAQ,EAAE;IAChB,gEAAgE;IAChE,MAAMJ,KAAKK,MAAM,OAAOlB,eAAe;QACnCa,KAAKM,OAAO,CAACN,KAAKG,OAAO,KAAK;IAClC;IACA,yDAAyD;IACzDH,OAAOO,IAAAA,iBAAO,EAACP,MAAM,CAACQ,uBAAY;IAClC,wEAAwE;IACxE,IAAIC,4BAA4B;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-datepicker-compat",
3
- "version": "0.3.13",
3
+ "version": "0.3.16",
4
4
  "description": "React components for building web experiences",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -35,18 +35,18 @@
35
35
  "@fluentui/scripts-tasks": "*"
36
36
  },
37
37
  "dependencies": {
38
- "@fluentui/keyboard-keys": "^9.0.4",
39
- "@fluentui/react-field": "^9.1.29",
40
- "@fluentui/react-icons": "^2.0.207",
41
- "@fluentui/react-input": "^9.4.39",
42
- "@fluentui/react-jsx-runtime": "^9.0.10",
43
- "@fluentui/react-popover": "^9.8.7",
44
- "@fluentui/react-portal": "^9.3.16",
45
- "@fluentui/react-positioning": "^9.9.13",
46
- "@fluentui/react-shared-contexts": "^9.8.1",
47
- "@fluentui/react-tabster": "^9.12.11",
48
- "@fluentui/react-theme": "^9.1.12",
49
- "@fluentui/react-utilities": "^9.13.3",
38
+ "@fluentui/keyboard-keys": "^9.0.6",
39
+ "@fluentui/react-field": "^9.1.32",
40
+ "@fluentui/react-icons": "^2.0.217",
41
+ "@fluentui/react-input": "^9.4.42",
42
+ "@fluentui/react-jsx-runtime": "^9.0.12",
43
+ "@fluentui/react-popover": "^9.8.10",
44
+ "@fluentui/react-portal": "^9.3.19",
45
+ "@fluentui/react-positioning": "^9.9.16",
46
+ "@fluentui/react-shared-contexts": "^9.9.2",
47
+ "@fluentui/react-tabster": "^9.13.2",
48
+ "@fluentui/react-theme": "^9.1.14",
49
+ "@fluentui/react-utilities": "^9.13.5",
50
50
  "@griffel/react": "^1.5.14",
51
51
  "@swc/helpers": "^0.5.1"
52
52
  },