@elliemae/ds-form-date-time-picker 3.16.0-next.1 → 3.16.0-next.3
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.
- package/dist/cjs/ControlledDateTimePicker.js +2 -2
- package/dist/cjs/ControlledDateTimePicker.js.map +2 -2
- package/dist/cjs/config/useChangeHandlers.js.map +2 -2
- package/dist/cjs/config/useControlledDateTimePicker.js +3 -3
- package/dist/cjs/config/useControlledDateTimePicker.js.map +2 -2
- package/dist/cjs/config/useGetFlags.js +6 -6
- package/dist/cjs/config/useGetFlags.js.map +2 -2
- package/dist/cjs/config/useGetPropsWithDefault.js +2 -2
- package/dist/cjs/config/useGetPropsWithDefault.js.map +2 -2
- package/dist/cjs/parts/ClearButton/ClearButton.js +8 -2
- package/dist/cjs/parts/ClearButton/ClearButton.js.map +3 -3
- package/dist/cjs/parts/ControlledDateTimePickerContent.js +8 -1
- package/dist/cjs/parts/ControlledDateTimePickerContent.js.map +3 -3
- package/dist/cjs/parts/DateInputs/DDInput.js +4 -2
- package/dist/cjs/parts/DateInputs/DDInput.js.map +2 -2
- package/dist/cjs/parts/DateInputs/DateInputs.js +23 -5
- package/dist/cjs/parts/DateInputs/DateInputs.js.map +3 -3
- package/dist/cjs/parts/DateInputs/MMInput.js +4 -2
- package/dist/cjs/parts/DateInputs/MMInput.js.map +2 -2
- package/dist/cjs/parts/DateInputs/YYYYInput.js +4 -2
- package/dist/cjs/parts/DateInputs/YYYYInput.js.map +2 -2
- package/dist/cjs/parts/DateInputs/useDateInputs.js +1 -1
- package/dist/cjs/parts/DateInputs/useDateInputs.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/Calendar.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js +9 -1
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js +16 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/CalendarHead.js +35 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarHead.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js +16 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/CalendarMonthDays.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js +8 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/Day.js +4 -0
- package/dist/cjs/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +8 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +3 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +8 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +3 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +10 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +3 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +9 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js +23 -2
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js +24 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js +23 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js +19 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js +16 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +16 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelWrapper.js +8 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelWrapper.js.map +3 -3
- package/dist/cjs/parts/TimeInputs/HHInput.js +4 -2
- package/dist/cjs/parts/TimeInputs/HHInput.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/MeridiemInput.js +4 -2
- package/dist/cjs/parts/TimeInputs/MeridiemInput.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/MinutesInput.js +4 -2
- package/dist/cjs/parts/TimeInputs/MinutesInput.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/TimeInputs.js +23 -5
- package/dist/cjs/parts/TimeInputs/TimeInputs.js.map +3 -3
- package/dist/cjs/propTypes.js +28 -26
- package/dist/cjs/propTypes.js.map +2 -2
- package/dist/cjs/sharedTypes.js.map +1 -1
- package/dist/cjs/tests/custom-props/customProps.js +233 -0
- package/dist/cjs/tests/custom-props/customProps.js.map +7 -0
- package/dist/esm/ControlledDateTimePicker.js +1 -1
- package/dist/esm/ControlledDateTimePicker.js.map +1 -1
- package/dist/esm/config/useChangeHandlers.js.map +2 -2
- package/dist/esm/config/useControlledDateTimePicker.js +1 -1
- package/dist/esm/config/useControlledDateTimePicker.js.map +1 -1
- package/dist/esm/config/useGetFlags.js +6 -6
- package/dist/esm/config/useGetFlags.js.map +2 -2
- package/dist/esm/config/useGetPropsWithDefault.js +1 -1
- package/dist/esm/config/useGetPropsWithDefault.js.map +1 -1
- package/dist/esm/parts/ClearButton/ClearButton.js +8 -2
- package/dist/esm/parts/ClearButton/ClearButton.js.map +3 -3
- package/dist/esm/parts/ControlledDateTimePickerContent.js +8 -1
- package/dist/esm/parts/ControlledDateTimePickerContent.js.map +3 -3
- package/dist/esm/parts/DateInputs/DDInput.js +4 -2
- package/dist/esm/parts/DateInputs/DDInput.js.map +2 -2
- package/dist/esm/parts/DateInputs/DateInputs.js +23 -5
- package/dist/esm/parts/DateInputs/DateInputs.js.map +3 -3
- package/dist/esm/parts/DateInputs/MMInput.js +4 -2
- package/dist/esm/parts/DateInputs/MMInput.js.map +2 -2
- package/dist/esm/parts/DateInputs/YYYYInput.js +4 -2
- package/dist/esm/parts/DateInputs/YYYYInput.js.map +2 -2
- package/dist/esm/parts/DateInputs/useDateInputs.js +1 -1
- package/dist/esm/parts/DateInputs/useDateInputs.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/Calendar.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js +9 -1
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js +16 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/CalendarHead.js +35 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarHead.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js +16 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/CalendarMonthDays.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js +8 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/Day.js +4 -0
- package/dist/esm/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +8 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +3 -3
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +8 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +3 -3
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +10 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +3 -3
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +9 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js +23 -2
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js +24 -2
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js +23 -2
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js +19 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js +16 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +16 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelWrapper.js +8 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelWrapper.js.map +3 -3
- package/dist/esm/parts/TimeInputs/HHInput.js +4 -2
- package/dist/esm/parts/TimeInputs/HHInput.js.map +2 -2
- package/dist/esm/parts/TimeInputs/MeridiemInput.js +4 -2
- package/dist/esm/parts/TimeInputs/MeridiemInput.js.map +2 -2
- package/dist/esm/parts/TimeInputs/MinutesInput.js +4 -2
- package/dist/esm/parts/TimeInputs/MinutesInput.js.map +2 -2
- package/dist/esm/parts/TimeInputs/TimeInputs.js +23 -5
- package/dist/esm/parts/TimeInputs/TimeInputs.js.map +3 -3
- package/dist/esm/propTypes.js +9 -2
- package/dist/esm/propTypes.js.map +2 -2
- package/dist/esm/tests/custom-props/customProps.js +207 -0
- package/dist/esm/tests/custom-props/customProps.js.map +7 -0
- package/dist/types/ControlledDateTimePicker.d.ts +1 -1
- package/dist/types/config/useGetFlags.d.ts +2 -2
- package/dist/types/parts/DateInputs/DDInput.d.ts +2 -1
- package/dist/types/parts/DateInputs/MMInput.d.ts +3 -2
- package/dist/types/parts/DateInputs/YYYYInput.d.ts +2 -1
- package/dist/types/parts/TimeInputs/HHInput.d.ts +2 -1
- package/dist/types/parts/TimeInputs/MeridiemInput.d.ts +2 -1
- package/dist/types/parts/TimeInputs/MinutesInput.d.ts +2 -1
- package/dist/types/propTypes.d.ts +11 -3
- package/dist/types/sharedTypes.d.ts +1 -1
- package/dist/types/tests/custom-props/customProps.d.ts +397 -0
- package/dist/types/tests/custom-props/date-time-picker.date-custom-props.test.d.ts +1 -0
- package/dist/types/tests/custom-props/date-time-picker.date-time-custom-props.test.d.ts +1 -0
- package/dist/types/tests/custom-props/date-time-picker.time-custom-props.test.d.ts +1 -0
- package/package.json +10 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/DateInputs/useDateInputs.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useCallback, useMemo, useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX';\nimport {\n getFormattedDateString,\n prependStringWithPlaceHolders,\n fillStringWithPlaceHolders,\n} from '../../utils/stringHelpers';\nimport { getValidationDateStringMetaInfo } from '../../utils/dateHelpers';\nimport { defaultMetaInfo } from '../../utils/constants';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes';\nimport type { DSControlledDateTimePickerT } from '../../propTypes';\n\nexport const useDateInputs = (): DSControlledDateTimePickerInternalsT.UseDateInputsR => {\n const {\n props: { disabled },\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n getIsDisabledDay,\n getIsOutOfRangeDay,\n month,\n day,\n year,\n hideTime,\n handleChangeComposedDateString,\n withClearBtn,\n withAnyPicker,\n withAnyRightController,\n autoFocusMonthInput,\n innerRefMonthInput,\n trackFocusResetter,\n trackFocusFirstSegment,\n trackFocusLastSegment,\n trackFocusDayInput,\n trackFocusMonthInput,\n trackFocusYearInput,\n trackFocusHourInput,\n trackFocusClearBtn,\n trackFocusPicker,\n } = useContext(ControlledDateTimePickerContext);\n\n const onHomeKeyDown = useCallback(() => {\n trackFocusFirstSegment();\n }, [trackFocusFirstSegment]);\n const onEndKeyDown = useCallback(() => {\n trackFocusLastSegment();\n }, [trackFocusLastSegment]);\n\n const handleChangeMonth = useCallback(\n (\n newMonth: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = defaultMetaInfo,\n ) => {\n const newDateString = getFormattedDateString({\n month: newMonth,\n day,\n year,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(newDateString, getIsOutOfRangeDay, getIsDisabledDay),\n newDateString,\n };\n appOnMonthChange(newMonth, e, finalMetaInfo);\n handleChangeComposedDateString(newDateString, finalMetaInfo);\n },\n [day, year, getIsOutOfRangeDay, getIsDisabledDay, appOnMonthChange, handleChangeComposedDateString],\n );\n const onMonthFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc = useCallback(() => {\n trackFocusMonthInput();\n }, [trackFocusMonthInput]);\n const onMonthChange: DSControlledDateTimePickerInternalsT.OnChangeFunc = useCallback(\n (e) => {\n let newMonth = e?.target?.value;\n // converts months 2~9 to 02~09\n if (Number.parseInt(newMonth, 10) > 1) newMonth = prependStringWithPlaceHolders(newMonth, 2);\n handleChangeMonth(newMonth, e);\n // auto-advance functionality:\n if (newMonth.length === 2) trackFocusDayInput();\n },\n [handleChangeMonth, trackFocusDayInput],\n );\n const onMonthKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown = useCallback(\n (e) => {\n const { key, ctrlKey, metaKey } = e;\n const monthStringConvertedToInteger = Number.parseInt(month, 10);\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.preventDefault();\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.stopPropagation();\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n if (key === 'ArrowUp' || key === 'ArrowDown') {\n const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;\n let newMonth;\n if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;\n else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;\n newMonth = prependStringWithPlaceHolders(`${newMonth}`, 2);\n handleChangeMonth(newMonth, e);\n }\n if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\\\')) {\n const newMonth = prependStringWithPlaceHolders(`${monthStringConvertedToInteger}`, 2);\n handleChangeMonth(newMonth, e);\n // auto-advance functionality:\n if (newMonth.length === 2) trackFocusDayInput();\n }\n\n // focus last fragment on fill with now\n if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();\n },\n [month, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeMonth],\n );\n const onMonthBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc = useCallback(\n (e) => {\n const newMonth = e?.target?.value;\n if (newMonth === '0') handleChangeMonth('01', e, { isAutomaticFillTrigger: true });\n else if (newMonth.length > 0 && newMonth.length < 2)\n handleChangeMonth(prependStringWithPlaceHolders(newMonth, 2), e, {\n isAutomaticFillTrigger: true,\n });\n },\n [handleChangeMonth],\n );\n\n const handleChangeDay = useCallback(\n (\n newDay: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = defaultMetaInfo,\n ) => {\n const newDateString = getFormattedDateString({\n month,\n day: newDay,\n year,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(newDateString, getIsOutOfRangeDay, getIsDisabledDay),\n newDateString,\n };\n appOnDayChange(newDay, e, finalMetaInfo);\n handleChangeComposedDateString(newDateString, finalMetaInfo);\n },\n [month, year, getIsOutOfRangeDay, getIsDisabledDay, appOnDayChange, handleChangeComposedDateString],\n );\n const onDayFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc = useCallback(() => {\n trackFocusDayInput();\n }, [trackFocusDayInput]);\n const onDayChange: DSControlledDateTimePickerInternalsT.OnChangeFunc = useCallback(\n (e) => {\n let newDay = e?.target?.value;\n // converts days 4~9 to 04~09\n if (Number.parseInt(newDay, 10) > 3) newDay = prependStringWithPlaceHolders(newDay, 2);\n handleChangeDay(newDay, e);\n // auto-advance functionality:\n if (newDay.length === 2) trackFocusYearInput();\n },\n [handleChangeDay, trackFocusYearInput],\n );\n const onDayKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown = useCallback(\n (e) => {\n const { key, ctrlKey, metaKey, target, currentTarget } = e;\n const dayStringConvertedToInteger = Number.parseInt(day, 10);\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.preventDefault();\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.stopPropagation();\n\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n if (key === 'ArrowUp' || key === 'ArrowDown') {\n const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;\n let newDay;\n if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;\n else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;\n newDay = prependStringWithPlaceHolders(`${newDay}`, 2);\n handleChangeDay(newDay, e);\n }\n if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\\\')) {\n const newDay = prependStringWithPlaceHolders(`${dayStringConvertedToInteger}`, 2);\n handleChangeDay(newDay, e);\n // auto-advance functionality:\n if (newDay.length === 2) trackFocusYearInput();\n }\n // regressive backspace functionality\n if (\n key === 'Backspace' &&\n target === currentTarget &&\n (target as HTMLInputElement).selectionStart === 0 &&\n (target as HTMLInputElement).selectionEnd === 0\n ) {\n e.preventDefault();\n trackFocusMonthInput();\n }\n // focus last fragment on fill with now\n if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();\n },\n [\n day,\n onHomeKeyDown,\n onEndKeyDown,\n trackFocusLastSegment,\n handleChangeDay,\n trackFocusYearInput,\n trackFocusMonthInput,\n ],\n );\n const onDayBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc = useCallback(\n (e) => {\n const newDay = e?.target?.value;\n if (newDay === '0') handleChangeDay('01', e, { isAutomaticFillTrigger: true });\n else if (newDay.length > 0 && newDay.length < 2)\n handleChangeDay(prependStringWithPlaceHolders(newDay, 2), e, {\n isAutomaticFillTrigger: true,\n });\n },\n [handleChangeDay],\n );\n\n const handleChangeYear = useCallback(\n (\n newYear: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = defaultMetaInfo,\n ) => {\n const newDateString = getFormattedDateString({\n month,\n day,\n year: newYear,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(newDateString, getIsOutOfRangeDay, getIsDisabledDay),\n newDateString,\n };\n appOnYearChange(newYear, e, finalMetaInfo);\n handleChangeComposedDateString(newDateString, finalMetaInfo);\n },\n [month, day, getIsOutOfRangeDay, getIsDisabledDay, appOnYearChange, handleChangeComposedDateString],\n );\n const onYearFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc = useCallback(() => {\n trackFocusYearInput();\n }, [trackFocusYearInput]);\n const onYearChange: DSControlledDateTimePickerInternalsT.OnChangeFunc = useCallback(\n (e) => {\n const newYear = e?.target?.value;\n handleChangeYear(newYear, e);\n // auto-advance functionality:\n if (newYear.length === 4) {\n if (!hideTime) trackFocusHourInput();\n else if (withAnyRightController) {\n if (withClearBtn) trackFocusClearBtn();\n else if (withAnyPicker) trackFocusPicker();\n // pending approval from Seda, check which one should be focused first...\n }\n }\n },\n [\n handleChangeYear,\n hideTime,\n trackFocusHourInput,\n withAnyRightController,\n withClearBtn,\n trackFocusClearBtn,\n withAnyPicker,\n trackFocusPicker,\n ],\n );\n const onYearKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown = useCallback(\n (e) => {\n const { key, ctrlKey, metaKey, target, currentTarget } = e;\n\n /* ****** New year value calculator logic ********* */\n const yearStringConvertedToInteger = Number.parseInt(year, 10);\n const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;\n let newYear = yearInteger !== 0 ? fillStringWithPlaceHolders(`${yearInteger}`, 4, '0') : '';\n if (key === 'ArrowUp' || key === 'ArrowDown') {\n let newYearInteger;\n if (key === 'ArrowUp') newYearInteger = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;\n else newYearInteger = yearInteger - 1 > 0 ? yearInteger - 1 : 1;\n newYear = prependStringWithPlaceHolders(`${newYearInteger}`, 4);\n }\n const isAutomaticFillTrigger = newYear !== year && ['Tab', ' '].includes(key);\n const metainfo = { isAutomaticFillTrigger };\n\n /* ************* new year apply logic ************* */\n // tab/spacebar applies auto-fill\n // arrows up/down applies increment/decrement\n if (key === 'ArrowUp' || key === 'ArrowDown' || isAutomaticFillTrigger) {\n handleChangeYear(newYear, e, metainfo);\n }\n\n /* ************* focus tracking logic ************* */\n let trackNextFocus = trackFocusResetter; // if nothing after, we reset internal focus tracker to avoid re-render unexpected focus shift\n if (!hideTime) trackNextFocus = trackFocusHourInput;\n else if (withClearBtn) trackNextFocus = trackFocusClearBtn;\n else if (withAnyPicker) trackNextFocus = trackFocusPicker;\n\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n\n /* ************** auto-advance logic ************** */\n if (key === ' ') {\n // auto-advance functionality:\n trackNextFocus();\n }\n /* ********** regressive backspace logic ********** */\n if (\n key === 'Backspace' &&\n target === currentTarget &&\n (target as HTMLInputElement).selectionStart === 0 &&\n (target as HTMLInputElement).selectionEnd === 0\n ) {\n e.preventDefault();\n trackFocusDayInput();\n }\n\n // focus last fragment on fill with now\n if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();\n },\n [\n year,\n trackFocusResetter,\n hideTime,\n trackFocusHourInput,\n withClearBtn,\n trackFocusClearBtn,\n withAnyPicker,\n trackFocusPicker,\n onHomeKeyDown,\n onEndKeyDown,\n trackFocusLastSegment,\n trackFocusDayInput,\n handleChangeYear,\n ],\n );\n const onYearBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc = useCallback((e) => {\n // this was used before, now that we have a wrapping onBlur resetting the focus tracker, this is unused;\n }, []);\n\n return useMemo(\n () => ({\n month,\n day,\n year,\n autoFocusMonthInput,\n innerRefMonthInput,\n disabled,\n onMonthFocus,\n onMonthChange,\n onDayFocus,\n onDayChange,\n onYearFocus,\n onYearChange,\n onMonthBlur,\n onDayBlur,\n onYearBlur,\n onMonthKeyDown,\n onDayKeyDown,\n onYearKeyDown,\n }),\n [\n month,\n day,\n year,\n autoFocusMonthInput,\n innerRefMonthInput,\n disabled,\n onMonthFocus,\n onMonthChange,\n onDayFocus,\n onDayChange,\n onYearFocus,\n onYearChange,\n onMonthBlur,\n onDayBlur,\n onYearBlur,\n onMonthKeyDown,\n onDayKeyDown,\n onYearKeyDown,\n ],\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,aAAa,SAAS,kBAAkB;AACjD,SAAS,uCAAuC;AAChD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAIzB,MAAM,gBAAgB,MAA2D;AACtF,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,+BAA+B;AAE9C,QAAM,gBAAgB,YAAY,MAAM;AACtC,2BAAuB;AAAA,EACzB,GAAG,CAAC,sBAAsB,CAAC;AAC3B,QAAM,eAAe,YAAY,MAAM;AACrC,0BAAsB;AAAA,EACxB,GAAG,CAAC,qBAAqB,CAAC;AAE1B,QAAM,oBAAoB;AAAA,IACxB,CACE,UACA,GACA,WAA8E,oBAC3E;AACH,YAAM,gBAAgB,uBAAuB;AAAA,QAC3C,OAAO;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,QAAQ;AAAQ,sBAAc;AAClC,UAAI,QAAQ;AAAO,qBAAa;AAGhC,UAAI,QAAQ,KAAK;AAEf,uBAAe;AAAA,MACjB;AAEA,UACE,QAAQ,eACR,WAAW,iBACV,OAA4B,mBAAmB,KAC/C,OAA4B,iBAAiB,GAC9C;AACA,UAAE,eAAe;AACjB,2BAAmB;AAAA,MACrB;AAGA,WAAK,WAAW,YAAY,QAAQ;AAAK,8BAAsB;AAAA,IACjE;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,QAAM,aAA8D,YAAY,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useCallback, useMemo, useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX';\nimport {\n getFormattedDateString,\n prependStringWithPlaceHolders,\n fillStringWithPlaceHolders,\n} from '../../utils/stringHelpers';\nimport { getValidationDateStringMetaInfo } from '../../utils/dateHelpers';\nimport { defaultMetaInfo } from '../../utils/constants';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes';\nimport type { DSControlledDateTimePickerT } from '../../propTypes';\n\nexport const useDateInputs = (): DSControlledDateTimePickerInternalsT.UseDateInputsR => {\n const {\n props: { disabled },\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n getIsDisabledDay,\n getIsOutOfRangeDay,\n month,\n day,\n year,\n hideTime,\n handleChangeComposedDateString,\n withClearBtn,\n withAnyPicker,\n withAnyRightController,\n autoFocusMonthInput,\n innerRefMonthInput,\n trackFocusResetter,\n trackFocusFirstSegment,\n trackFocusLastSegment,\n trackFocusDayInput,\n trackFocusMonthInput,\n trackFocusYearInput,\n trackFocusHourInput,\n trackFocusClearBtn,\n trackFocusPicker,\n } = useContext(ControlledDateTimePickerContext);\n\n const onHomeKeyDown = useCallback(() => {\n trackFocusFirstSegment();\n }, [trackFocusFirstSegment]);\n const onEndKeyDown = useCallback(() => {\n trackFocusLastSegment();\n }, [trackFocusLastSegment]);\n\n const handleChangeMonth = useCallback(\n (\n newMonth: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = defaultMetaInfo,\n ) => {\n const newDateString = getFormattedDateString({\n month: newMonth,\n day,\n year,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(newDateString, getIsOutOfRangeDay, getIsDisabledDay),\n newDateString,\n };\n appOnMonthChange(newMonth, e, finalMetaInfo);\n handleChangeComposedDateString(newDateString, finalMetaInfo);\n },\n [day, year, getIsOutOfRangeDay, getIsDisabledDay, appOnMonthChange, handleChangeComposedDateString],\n );\n const onMonthFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc = useCallback(() => {\n trackFocusMonthInput();\n }, [trackFocusMonthInput]);\n const onMonthChange: DSControlledDateTimePickerInternalsT.OnChangeFunc = useCallback(\n (e) => {\n let newMonth = e?.target?.value;\n // converts months 2~9 to 02~09\n if (Number.parseInt(newMonth, 10) > 1) newMonth = prependStringWithPlaceHolders(newMonth, 2);\n handleChangeMonth(newMonth, e);\n // auto-advance functionality:\n if (newMonth.length === 2) trackFocusDayInput();\n },\n [handleChangeMonth, trackFocusDayInput],\n );\n const onMonthKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown = useCallback(\n (e) => {\n const { key, ctrlKey, metaKey } = e;\n const monthStringConvertedToInteger = Number.parseInt(month, 10);\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.preventDefault();\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.stopPropagation();\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n if (key === 'ArrowUp' || key === 'ArrowDown') {\n const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;\n let newMonth;\n if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;\n else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;\n newMonth = prependStringWithPlaceHolders(`${newMonth}`, 2);\n handleChangeMonth(newMonth, e);\n }\n if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\\\')) {\n const newMonth = prependStringWithPlaceHolders(`${monthStringConvertedToInteger}`, 2);\n handleChangeMonth(newMonth, e);\n // auto-advance functionality:\n if (newMonth.length === 2) trackFocusDayInput();\n }\n\n // focus last fragment on fill with now\n if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();\n },\n [month, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeMonth],\n );\n const onMonthBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc = useCallback(\n (e) => {\n const newMonth = e?.target?.value;\n if (newMonth === '0') handleChangeMonth('01', e, { isAutomaticFillTrigger: true });\n else if (newMonth.length > 0 && newMonth.length < 2)\n handleChangeMonth(prependStringWithPlaceHolders(newMonth, 2), e, {\n isAutomaticFillTrigger: true,\n });\n },\n [handleChangeMonth],\n );\n\n const handleChangeDay = useCallback(\n (\n newDay: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = defaultMetaInfo,\n ) => {\n const newDateString = getFormattedDateString({\n month,\n day: newDay,\n year,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(newDateString, getIsOutOfRangeDay, getIsDisabledDay),\n newDateString,\n };\n appOnDayChange(newDay, e, finalMetaInfo);\n handleChangeComposedDateString(newDateString, finalMetaInfo);\n },\n [month, year, getIsOutOfRangeDay, getIsDisabledDay, appOnDayChange, handleChangeComposedDateString],\n );\n const onDayFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc = useCallback(() => {\n trackFocusDayInput();\n }, [trackFocusDayInput]);\n const onDayChange: DSControlledDateTimePickerInternalsT.OnChangeFunc = useCallback(\n (e) => {\n let newDay = e?.target?.value;\n // converts days 4~9 to 04~09\n if (Number.parseInt(newDay, 10) > 3) newDay = prependStringWithPlaceHolders(newDay, 2);\n handleChangeDay(newDay, e);\n // auto-advance functionality:\n if (newDay.length === 2) trackFocusYearInput();\n },\n [handleChangeDay, trackFocusYearInput],\n );\n const onDayKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown = useCallback(\n (e) => {\n const { key, ctrlKey, metaKey, target, currentTarget } = e;\n const dayStringConvertedToInteger = Number.parseInt(day, 10);\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.preventDefault();\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\\\'].includes(key)) e.stopPropagation();\n\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n if (key === 'ArrowUp' || key === 'ArrowDown') {\n const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;\n let newDay;\n if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;\n else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;\n newDay = prependStringWithPlaceHolders(`${newDay}`, 2);\n handleChangeDay(newDay, e);\n }\n if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\\\')) {\n const newDay = prependStringWithPlaceHolders(`${dayStringConvertedToInteger}`, 2);\n handleChangeDay(newDay, e);\n // auto-advance functionality:\n if (newDay.length === 2) trackFocusYearInput();\n }\n // regressive backspace functionality\n if (\n key === 'Backspace' &&\n target === currentTarget &&\n (target as HTMLInputElement).selectionStart === 0 &&\n (target as HTMLInputElement).selectionEnd === 0\n ) {\n e.preventDefault();\n trackFocusMonthInput();\n }\n // focus last fragment on fill with now\n if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();\n },\n [\n day,\n onHomeKeyDown,\n onEndKeyDown,\n trackFocusLastSegment,\n handleChangeDay,\n trackFocusYearInput,\n trackFocusMonthInput,\n ],\n );\n const onDayBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc = useCallback(\n (e) => {\n const newDay = e?.target?.value;\n if (newDay === '0') handleChangeDay('01', e, { isAutomaticFillTrigger: true });\n else if (newDay.length > 0 && newDay.length < 2)\n handleChangeDay(prependStringWithPlaceHolders(newDay, 2), e, {\n isAutomaticFillTrigger: true,\n });\n },\n [handleChangeDay],\n );\n\n const handleChangeYear = useCallback(\n (\n newYear: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = defaultMetaInfo,\n ) => {\n const newDateString = getFormattedDateString({\n month,\n day,\n year: newYear,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(newDateString, getIsOutOfRangeDay, getIsDisabledDay),\n newDateString,\n };\n appOnYearChange(newYear, e, finalMetaInfo);\n handleChangeComposedDateString(newDateString, finalMetaInfo);\n },\n [month, day, getIsOutOfRangeDay, getIsDisabledDay, appOnYearChange, handleChangeComposedDateString],\n );\n const onYearFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc = useCallback(() => {\n trackFocusYearInput();\n }, [trackFocusYearInput]);\n const onYearChange: DSControlledDateTimePickerInternalsT.OnChangeFunc = useCallback(\n (e) => {\n const newYear = e?.target?.value;\n handleChangeYear(newYear, e);\n // auto-advance functionality:\n if (newYear.length === 4) {\n if (!hideTime) trackFocusHourInput();\n else if (withAnyRightController) {\n if (withClearBtn) trackFocusClearBtn();\n else if (withAnyPicker) trackFocusPicker();\n // pending approval from Seda, check which one should be focused first...\n }\n }\n },\n [\n handleChangeYear,\n hideTime,\n trackFocusHourInput,\n withAnyRightController,\n withClearBtn,\n trackFocusClearBtn,\n withAnyPicker,\n trackFocusPicker,\n ],\n );\n const onYearKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown = useCallback(\n (e) => {\n const { key, ctrlKey, metaKey, target, currentTarget } = e;\n\n /* ****** New year value calculator logic ********* */\n const yearStringConvertedToInteger = Number.parseInt(year, 10);\n const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;\n let newYear = yearInteger !== 0 ? fillStringWithPlaceHolders(`${yearInteger}`, 4, '0') : '';\n if (key === 'ArrowUp' || key === 'ArrowDown') {\n let newYearInteger;\n if (key === 'ArrowUp') newYearInteger = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;\n else newYearInteger = yearInteger - 1 > 0 ? yearInteger - 1 : 1;\n newYear = prependStringWithPlaceHolders(`${newYearInteger}`, 4);\n }\n const isAutomaticFillTrigger = newYear !== year && ['Tab', ' '].includes(key);\n const metainfo = { isAutomaticFillTrigger };\n\n /* ************* new year apply logic ************* */\n // tab/spacebar applies auto-fill\n // arrows up/down applies increment/decrement\n if (key === 'ArrowUp' || key === 'ArrowDown' || isAutomaticFillTrigger) {\n handleChangeYear(newYear, e, metainfo);\n }\n\n /* ************* focus tracking logic ************* */\n let trackNextFocus = trackFocusResetter; // if nothing after, we reset internal focus tracker to avoid re-render unexpected focus shift\n if (!hideTime) trackNextFocus = trackFocusHourInput;\n else if (withClearBtn) trackNextFocus = trackFocusClearBtn;\n else if (withAnyPicker) trackNextFocus = trackFocusPicker;\n\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();\n if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n\n /* ************** auto-advance logic ************** */\n if (key === ' ') {\n // auto-advance functionality:\n trackNextFocus();\n }\n /* ********** regressive backspace logic ********** */\n if (\n key === 'Backspace' &&\n target === currentTarget &&\n (target as HTMLInputElement).selectionStart === 0 &&\n (target as HTMLInputElement).selectionEnd === 0\n ) {\n e.preventDefault();\n trackFocusDayInput();\n }\n\n // focus last fragment on fill with now\n if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();\n },\n [\n year,\n trackFocusResetter,\n hideTime,\n trackFocusHourInput,\n withClearBtn,\n trackFocusClearBtn,\n withAnyPicker,\n trackFocusPicker,\n onHomeKeyDown,\n onEndKeyDown,\n trackFocusLastSegment,\n trackFocusDayInput,\n handleChangeYear,\n ],\n );\n const onYearBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc = useCallback(() => {\n // this was used before, now that we have a wrapping onBlur resetting the focus tracker, this is unused;\n }, []);\n\n return useMemo(\n () => ({\n month,\n day,\n year,\n autoFocusMonthInput,\n innerRefMonthInput,\n disabled,\n onMonthFocus,\n onMonthChange,\n onDayFocus,\n onDayChange,\n onYearFocus,\n onYearChange,\n onMonthBlur,\n onDayBlur,\n onYearBlur,\n onMonthKeyDown,\n onDayKeyDown,\n onYearKeyDown,\n }),\n [\n month,\n day,\n year,\n autoFocusMonthInput,\n innerRefMonthInput,\n disabled,\n onMonthFocus,\n onMonthChange,\n onDayFocus,\n onDayChange,\n onYearFocus,\n onYearChange,\n onMonthBlur,\n onDayBlur,\n onYearBlur,\n onMonthKeyDown,\n onDayKeyDown,\n onYearKeyDown,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,aAAa,SAAS,kBAAkB;AACjD,SAAS,uCAAuC;AAChD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAIzB,MAAM,gBAAgB,MAA2D;AACtF,QAA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A;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/Calendar.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\nimport React, { useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarIconTrigger } from './CalendarIconTrigger';\nimport { CalendarWrapper } from './CalendarWrapper';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\nimport React, { useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarIconTrigger } from './CalendarIconTrigger';\nimport { CalendarWrapper } from './CalendarWrapper';\nimport { CalendarContext } from './CalendarContext';\nimport { useConfigCalendarCTX } from './useConfigCalendarCTX';\n\nexport const WrappedCalendarContext = ({ children }: { children: JSX.Element }) => {\n const ctx = useConfigCalendarCTX();\n return <CalendarContext.Provider value={ctx}>{children}</CalendarContext.Provider>;\n};\n\nconst CalendarContent = () => {\n const { showCalendar, handleMenuWrapperKeyDown } = useContext(CalendarContext);\n const { isControllerOnly } = useContext(ControlledDateTimePickerContext);\n return (\n <>\n {isControllerOnly ? null : <CalendarIconTrigger />}\n {isControllerOnly || showCalendar ? (\n <>\n {/* The <div> element is catching the \"ESC\" key to close the calendar, there is no valid aria role for this */}\n {/* https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-static-element-interactions.md#case-the-event-handler-is-only-being-used-to-capture-bubbled-events */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div onKeyDown={handleMenuWrapperKeyDown}>\n <CalendarWrapper />\n </div>\n </>\n ) : null}\n </>\n );\n};\n\n// we wrap in context in a separate statement so we can use the useContext and be sure it's correctly initialized\nexport const Calendar = () => (\n <WrappedCalendarContext>\n <CalendarContent />\n </WrappedCalendarContext>\n);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACUd,SAUD,UAVC,KAOL,YAPK;AATT,SAAgB,kBAAkB;AAClC,SAAS,uCAAuC;AAChD,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AAE9B,MAAM,yBAAyB,CAAC,EAAE,SAAS,MAAiC;AACjF,QAAM,MAAM,qBAAqB;AACjC,SAAO,oBAAC,gBAAgB,UAAhB,EAAyB,OAAO,KAAM,UAAS;AACzD;AAEA,MAAM,kBAAkB,MAAM;AAC5B,QAAM,EAAE,cAAc,yBAAyB,IAAI,WAAW,eAAe;AAC7E,QAAM,EAAE,iBAAiB,IAAI,WAAW,+BAA+B;AACvE,SACE,iCACG;AAAA,uBAAmB,OAAO,oBAAC,uBAAoB;AAAA,IAC/C,oBAAoB,eACnB,gCAIE,8BAAC,SAAI,WAAW,0BACd,8BAAC,mBAAgB,GACnB,GACF,IACE;AAAA,KACN;AAEJ;AAGO,MAAM,WAAW,MACtB,oBAAC,0BACC,8BAAC,mBAAgB,GACnB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from "react";
|
|
3
|
+
import React2, { useContext } from "react";
|
|
4
|
+
import { getPropsPerDatatestid } from "@elliemae/ds-props-helpers";
|
|
4
5
|
import { ControlledDateTimePickerDatatestid } from "../../../ControlledDateTimePickerDatatestid";
|
|
5
6
|
import { CalendarBody } from "./CalendarBody";
|
|
6
7
|
import { CalendarHead } from "./CalendarHead";
|
|
7
8
|
import { CalendarFooter } from "./CalendarFooter";
|
|
9
|
+
import { ControlledDateTimePickerContext } from "../../../ControlledDateTimePickerCTX";
|
|
8
10
|
import { CalendarContext } from "./CalendarContext";
|
|
9
11
|
import { StyledShadowWrapper, StyledCalendarWrapper } from "./Styleds";
|
|
10
12
|
const CalendarContent = ({ className = "" }) => {
|
|
13
|
+
const { props } = useContext(ControlledDateTimePickerContext);
|
|
11
14
|
const { daysMatrixByWeekday } = useContext(CalendarContext);
|
|
15
|
+
const ariaAndDataProps = React2.useMemo(
|
|
16
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR]),
|
|
17
|
+
[props]
|
|
18
|
+
);
|
|
12
19
|
return /* @__PURE__ */ jsx(
|
|
13
20
|
StyledShadowWrapper,
|
|
14
21
|
{
|
|
15
22
|
className,
|
|
16
23
|
"data-testid": ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR,
|
|
24
|
+
...ariaAndDataProps,
|
|
17
25
|
children: /* @__PURE__ */ jsxs(StyledCalendarWrapper, { children: [
|
|
18
26
|
/* @__PURE__ */ jsx(CalendarHead, {}),
|
|
19
27
|
/* @__PURE__ */ jsx(CalendarBody, { weekRowsNum: daysMatrixByWeekday.length }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/CalendarContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\nimport React, { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { CalendarBody } from './CalendarBody';\nimport { CalendarHead } from './CalendarHead';\nimport { CalendarFooter } from './CalendarFooter';\nimport { CalendarContext } from './CalendarContext';\nimport { StyledShadowWrapper, StyledCalendarWrapper } from './Styleds';\n\n// ({ className = '' }: { className?: string })\n// <StyledShadowWrapper className={className}>\n// is required for styled-components, without this we can't styled(CalendarContent)...\n// https://stackoverflow.com/questions/52542817/styled-components-not-applying-style-to-custom-functional-react-component\nexport const CalendarContent = ({ className = '' }: { className?: string }): JSX.Element => {\n const { daysMatrixByWeekday } = useContext(CalendarContext);\n\n return (\n <StyledShadowWrapper\n className={className}\n data-testid={ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR}\n >\n <StyledCalendarWrapper>\n <CalendarHead />\n <CalendarBody weekRowsNum={daysMatrixByWeekday.length} />\n <CalendarFooter />\n </StyledCalendarWrapper>\n </StyledShadowWrapper>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-len */\nimport React, { useContext } from 'react';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { CalendarBody } from './CalendarBody';\nimport { CalendarHead } from './CalendarHead';\nimport { CalendarFooter } from './CalendarFooter';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarContext } from './CalendarContext';\nimport { StyledShadowWrapper, StyledCalendarWrapper } from './Styleds';\n\n// ({ className = '' }: { className?: string })\n// <StyledShadowWrapper className={className}>\n// is required for styled-components, without this we can't styled(CalendarContent)...\n// https://stackoverflow.com/questions/52542817/styled-components-not-applying-style-to-custom-functional-react-component\nexport const CalendarContent = ({ className = '' }: { className?: string }): JSX.Element => {\n const { props } = useContext(ControlledDateTimePickerContext);\n const { daysMatrixByWeekday } = useContext(CalendarContext);\n const ariaAndDataProps = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR]),\n [props],\n );\n\n return (\n <StyledShadowWrapper\n className={className}\n data-testid={ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR}\n {...ariaAndDataProps}\n >\n <StyledCalendarWrapper>\n <CalendarHead />\n <CalendarBody weekRowsNum={daysMatrixByWeekday.length} />\n <CalendarFooter />\n </StyledCalendarWrapper>\n </StyledShadowWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC6BjB,SACE,KADF;AA5BN,OAAOA,UAAS,kBAAkB;AAClC,SAAS,6BAA6B;AACtC,SAAS,0CAA0C;AACnD,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAChC,SAAS,qBAAqB,6BAA6B;AAMpD,MAAM,kBAAkB,CAAC,EAAE,YAAY,GAAG,MAA2C;AAC1F,QAAM,EAAE,MAAM,IAAI,WAAW,+BAA+B;AAC5D,QAAM,EAAE,oBAAoB,IAAI,WAAW,eAAe;AAC1D,QAAM,mBAAmBA,OAAM;AAAA,IAC7B,MAAM,sBAAsB,MAAM,mCAAmC,qBAAqB,SAAS;AAAA,IACnG,CAAC,KAAK;AAAA,EACR;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa,mCAAmC,qBAAqB;AAAA,MACpE,GAAG;AAAA,MAEJ,+BAAC,yBACC;AAAA,4BAAC,gBAAa;AAAA,QACd,oBAAC,gBAAa,aAAa,oBAAoB,QAAQ;AAAA,QACvD,oBAAC,kBAAe;AAAA,SAClB;AAAA;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from "react";
|
|
3
|
+
import React2, { useContext } from "react";
|
|
4
|
+
import { getPropsPerDatatestid } from "@elliemae/ds-props-helpers";
|
|
4
5
|
import { ControlledDateTimePickerDatatestid } from "../../../ControlledDateTimePickerDatatestid";
|
|
5
6
|
import { ControlledDateTimePickerContext } from "../../../ControlledDateTimePickerCTX";
|
|
6
7
|
import { CalendarFooterMessage } from "./Styleds";
|
|
7
8
|
const CalendarFooter = () => {
|
|
8
9
|
const {
|
|
10
|
+
props,
|
|
9
11
|
props: { pickerFooterMsg, hasError },
|
|
10
12
|
isWithTimeWheelToo
|
|
11
13
|
} = useContext(ControlledDateTimePickerContext);
|
|
14
|
+
const ariaAndDataProps = React2.useMemo(
|
|
15
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR]),
|
|
16
|
+
[props]
|
|
17
|
+
);
|
|
12
18
|
if (pickerFooterMsg !== void 0 && !isWithTimeWheelToo && hasError)
|
|
13
|
-
return /* @__PURE__ */ jsx(
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
CalendarFooterMessage,
|
|
21
|
+
{
|
|
22
|
+
role: "alert",
|
|
23
|
+
"data-testid": ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR,
|
|
24
|
+
...ariaAndDataProps,
|
|
25
|
+
children: pickerFooterMsg
|
|
26
|
+
}
|
|
27
|
+
);
|
|
14
28
|
return null;
|
|
15
29
|
};
|
|
16
30
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/CalendarFooter.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarFooterMessage } from './Styleds';\n\nexport const CalendarFooter: React.ComponentType = () => {\n const {\n props: { pickerFooterMsg, hasError },\n isWithTimeWheelToo,\n } = useContext(ControlledDateTimePickerContext);\n if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError)\n return (\n <CalendarFooterMessage
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarFooterMessage } from './Styleds';\n\nexport const CalendarFooter: React.ComponentType = () => {\n const {\n props,\n props: { pickerFooterMsg, hasError },\n isWithTimeWheelToo,\n } = useContext(ControlledDateTimePickerContext);\n const ariaAndDataProps = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR]),\n [props],\n );\n if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError)\n return (\n <CalendarFooterMessage\n role=\"alert\"\n data-testid={ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR}\n {...ariaAndDataProps}\n >\n {pickerFooterMsg}\n </CalendarFooterMessage>\n );\n return null;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACkBjB;AAlBN,OAAOA,UAAS,kBAAkB;AAClC,SAAS,6BAA6B;AACtC,SAAS,0CAA0C;AACnD,SAAS,uCAAuC;AAChD,SAAS,6BAA6B;AAE/B,MAAM,iBAAsC,MAAM;AACvD,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,iBAAiB,SAAS;AAAA,IACnC;AAAA,EACF,IAAI,WAAW,+BAA+B;AAC9C,QAAM,mBAAmBA,OAAM;AAAA,IAC7B,MAAM,sBAAsB,MAAM,mCAAmC,QAAQ,SAAS;AAAA,IACtF,CAAC,KAAK;AAAA,EACR;AACA,MAAI,oBAAoB,UAAa,CAAC,sBAAsB;AAC1D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAa,mCAAmC,QAAQ;AAAA,QACvD,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAEJ,SAAO;AACT;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useContext, useMemo } from "react";
|
|
4
|
+
import { getPropsPerDatatestid } from "@elliemae/ds-props-helpers";
|
|
4
5
|
import { BUTTON_SIZES } from "@elliemae/ds-button";
|
|
5
6
|
import { ChevronDoubleLeft, ChevronLeft, ChevronDoubleRight, ChevronRight } from "@elliemae/ds-icons";
|
|
6
7
|
import { ControlledDateTimePickerDatatestid } from "../../../ControlledDateTimePickerDatatestid";
|
|
@@ -37,8 +38,29 @@ const CalendarHead = () => {
|
|
|
37
38
|
nextMonthBtnRef,
|
|
38
39
|
nextYearBtnRef,
|
|
39
40
|
latestInteractionRegion,
|
|
40
|
-
currFocusDescriber
|
|
41
|
+
currFocusDescriber,
|
|
42
|
+
props
|
|
41
43
|
} = useContext(ControlledDateTimePickerContext);
|
|
44
|
+
const ariaAndDataPropsPrevYear = useMemo(
|
|
45
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR]),
|
|
46
|
+
[props]
|
|
47
|
+
);
|
|
48
|
+
const ariaAndDataPropsPrevMonth = useMemo(
|
|
49
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH]),
|
|
50
|
+
[props]
|
|
51
|
+
);
|
|
52
|
+
const ariaAndDataPropsHeaderLabel = useMemo(
|
|
53
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.HEADER_LABEL]),
|
|
54
|
+
[props]
|
|
55
|
+
);
|
|
56
|
+
const ariaAndDataPropsNextMonth = useMemo(
|
|
57
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH]),
|
|
58
|
+
[props]
|
|
59
|
+
);
|
|
60
|
+
const ariaAndDataPropsNextYear = useMemo(
|
|
61
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR]),
|
|
62
|
+
[props]
|
|
63
|
+
);
|
|
42
64
|
const handlePrevYearRef = useCallback(
|
|
43
65
|
(ButtonDomNode) => {
|
|
44
66
|
prevYearBtnRef.current = ButtonDomNode;
|
|
@@ -85,6 +107,7 @@ const CalendarHead = () => {
|
|
|
85
107
|
tabIndex: isControllerOnly ? -1 : 0,
|
|
86
108
|
"data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR,
|
|
87
109
|
type: "button",
|
|
110
|
+
...ariaAndDataPropsPrevYear,
|
|
88
111
|
children: /* @__PURE__ */ jsx(ChevronDoubleLeft, { height: 14, width: 14, fill: "#25292f" })
|
|
89
112
|
}
|
|
90
113
|
),
|
|
@@ -101,10 +124,18 @@ const CalendarHead = () => {
|
|
|
101
124
|
onFocus: onPrevMonthFocus,
|
|
102
125
|
"data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH,
|
|
103
126
|
type: "button",
|
|
127
|
+
...ariaAndDataPropsPrevMonth,
|
|
104
128
|
children: /* @__PURE__ */ jsx(ChevronLeft, { height: 14, width: 14, fill: "#25292f" })
|
|
105
129
|
}
|
|
106
130
|
),
|
|
107
|
-
/* @__PURE__ */ jsx(
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
StyledHeaderLabel,
|
|
133
|
+
{
|
|
134
|
+
"data-testid": ControlledDateTimePickerDatatestid.CALENDAR.HEADER_LABEL,
|
|
135
|
+
...ariaAndDataPropsHeaderLabel,
|
|
136
|
+
children: currentFormatedDate
|
|
137
|
+
}
|
|
138
|
+
),
|
|
108
139
|
/* @__PURE__ */ jsx(
|
|
109
140
|
StyledHeaderButton,
|
|
110
141
|
{
|
|
@@ -117,6 +148,7 @@ const CalendarHead = () => {
|
|
|
117
148
|
onFocus: onNextMonthFocus,
|
|
118
149
|
"data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH,
|
|
119
150
|
type: "button",
|
|
151
|
+
...ariaAndDataPropsNextMonth,
|
|
120
152
|
children: /* @__PURE__ */ jsx(ChevronRight, { height: 14, width: 14, fill: "#25292f" })
|
|
121
153
|
}
|
|
122
154
|
),
|
|
@@ -132,6 +164,7 @@ const CalendarHead = () => {
|
|
|
132
164
|
onFocus: onNextYearFocus,
|
|
133
165
|
"data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR,
|
|
134
166
|
type: "button",
|
|
167
|
+
...ariaAndDataPropsNextYear,
|
|
135
168
|
children: /* @__PURE__ */ jsx(ChevronDoubleRight, { height: 14, width: 14, fill: "#25292f" })
|
|
136
169
|
}
|
|
137
170
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/CalendarHead.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { BUTTON_SIZES } from '@elliemae/ds-button';\nimport { ChevronDoubleLeft, ChevronLeft, ChevronDoubleRight, ChevronRight } from '@elliemae/ds-icons';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { getMonthNameByMonthNumber } from '../../../utils/dateHelpers';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { StyledHeader, StyledHeaderButton, StyledHeaderLabel } from './Styleds';\nimport { CalendarContext } from './CalendarContext';\n\nconst useGetFormattedCurrentDate = () => {\n const { currentMonth, currentYear } = useContext(CalendarContext);\n\n const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${getMonthNameByMonthNumber(currentMonth)} ` : '';\n\n return useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);\n};\nexport const CalendarHead = (): JSX.Element => {\n const currentFormatedDate = useGetFormattedCurrentDate();\n const {\n handlePrevYear,\n handlePrevMonth,\n handleNextMonth,\n handleNextYear,\n handlePrevYearKeyDown,\n handlePrevMonthKeyDown,\n handleNextMonthKeyDown,\n handleNextYearKeyDown,\n onPrevYearFocus,\n onPrevMonthFocus,\n onNextMonthFocus,\n onNextYearFocus,\n } = useContext(CalendarContext);\n\n const {\n isControllerOnly,\n autoFocusPrevMonthArrow,\n prevYearBtnRef,\n prevMonthBtnRef,\n nextMonthBtnRef,\n nextYearBtnRef,\n latestInteractionRegion,\n currFocusDescriber,\n } = useContext(ControlledDateTimePickerContext);\n\n const handlePrevYearRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n prevYearBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, prevYearBtnRef],\n );\n const handlePrevMonthRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n prevMonthBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, prevMonthBtnRef],\n );\n const handleNextMonthRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n nextMonthBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, nextMonthBtnRef],\n );\n const handleNextYearRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n nextYearBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, nextYearBtnRef],\n );\n\n return (\n <StyledHeader>\n <StyledHeaderButton\n aria-label=\"previous year\"\n buttonType=\"raw\"\n size={BUTTON_SIZES.M}\n onClick={handlePrevYear}\n innerRef={handlePrevYearRef}\n onKeyDown={handlePrevYearKeyDown}\n onFocus={onPrevYearFocus}\n tabIndex={isControllerOnly ? -1 : 0}\n data-testid={ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR}\n type=\"button\"\n >\n <ChevronDoubleLeft height={14} width={14} fill=\"#25292f\" />\n </StyledHeaderButton>\n <StyledHeaderButton\n autoFocus={autoFocusPrevMonthArrow}\n aria-label=\"previous month\"\n buttonType=\"raw\"\n size={BUTTON_SIZES.M}\n onClick={handlePrevMonth}\n innerRef={handlePrevMonthRef}\n onKeyDown={handlePrevMonthKeyDown}\n onFocus={onPrevMonthFocus}\n data-testid={ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH}\n type=\"button\"\n // this is a tabstop for when the calendar is open\n >\n <ChevronLeft height={14} width={14} fill=\"#25292f\" />\n </StyledHeaderButton>\n <StyledHeaderLabel
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { BUTTON_SIZES } from '@elliemae/ds-button';\nimport { ChevronDoubleLeft, ChevronLeft, ChevronDoubleRight, ChevronRight } from '@elliemae/ds-icons';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { getMonthNameByMonthNumber } from '../../../utils/dateHelpers';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { StyledHeader, StyledHeaderButton, StyledHeaderLabel } from './Styleds';\nimport { CalendarContext } from './CalendarContext';\n\nconst useGetFormattedCurrentDate = () => {\n const { currentMonth, currentYear } = useContext(CalendarContext);\n\n const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${getMonthNameByMonthNumber(currentMonth)} ` : '';\n\n return useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);\n};\nexport const CalendarHead = (): JSX.Element => {\n const currentFormatedDate = useGetFormattedCurrentDate();\n const {\n handlePrevYear,\n handlePrevMonth,\n handleNextMonth,\n handleNextYear,\n handlePrevYearKeyDown,\n handlePrevMonthKeyDown,\n handleNextMonthKeyDown,\n handleNextYearKeyDown,\n onPrevYearFocus,\n onPrevMonthFocus,\n onNextMonthFocus,\n onNextYearFocus,\n } = useContext(CalendarContext);\n\n const {\n isControllerOnly,\n autoFocusPrevMonthArrow,\n prevYearBtnRef,\n prevMonthBtnRef,\n nextMonthBtnRef,\n nextYearBtnRef,\n latestInteractionRegion,\n currFocusDescriber,\n props,\n } = useContext(ControlledDateTimePickerContext);\n const ariaAndDataPropsPrevYear = useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR]),\n [props],\n );\n const ariaAndDataPropsPrevMonth = useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH]),\n [props],\n );\n const ariaAndDataPropsHeaderLabel = useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.HEADER_LABEL]),\n [props],\n );\n const ariaAndDataPropsNextMonth = useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH]),\n [props],\n );\n const ariaAndDataPropsNextYear = useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR]),\n [props],\n );\n\n const handlePrevYearRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n prevYearBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, prevYearBtnRef],\n );\n const handlePrevMonthRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n prevMonthBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, prevMonthBtnRef],\n );\n const handleNextMonthRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n nextMonthBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, nextMonthBtnRef],\n );\n const handleNextYearRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n nextYearBtnRef.current = ButtonDomNode;\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year')\n ButtonDomNode?.focus?.();\n },\n [currFocusDescriber, latestInteractionRegion, nextYearBtnRef],\n );\n\n return (\n <StyledHeader>\n <StyledHeaderButton\n aria-label=\"previous year\"\n buttonType=\"raw\"\n size={BUTTON_SIZES.M}\n onClick={handlePrevYear}\n innerRef={handlePrevYearRef}\n onKeyDown={handlePrevYearKeyDown}\n onFocus={onPrevYearFocus}\n tabIndex={isControllerOnly ? -1 : 0}\n data-testid={ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR}\n type=\"button\"\n {...ariaAndDataPropsPrevYear}\n >\n <ChevronDoubleLeft height={14} width={14} fill=\"#25292f\" />\n </StyledHeaderButton>\n <StyledHeaderButton\n autoFocus={autoFocusPrevMonthArrow}\n aria-label=\"previous month\"\n buttonType=\"raw\"\n size={BUTTON_SIZES.M}\n onClick={handlePrevMonth}\n innerRef={handlePrevMonthRef}\n onKeyDown={handlePrevMonthKeyDown}\n onFocus={onPrevMonthFocus}\n data-testid={ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH}\n type=\"button\"\n {...ariaAndDataPropsPrevMonth}\n // this is a tabstop for when the calendar is open\n >\n <ChevronLeft height={14} width={14} fill=\"#25292f\" />\n </StyledHeaderButton>\n <StyledHeaderLabel\n data-testid={ControlledDateTimePickerDatatestid.CALENDAR.HEADER_LABEL}\n {...ariaAndDataPropsHeaderLabel}\n >\n {currentFormatedDate}\n </StyledHeaderLabel>\n <StyledHeaderButton\n aria-label=\"next month\"\n buttonType=\"raw\"\n size={BUTTON_SIZES.M}\n onClick={handleNextMonth}\n innerRef={handleNextMonthRef}\n onKeyDown={handleNextMonthKeyDown}\n onFocus={onNextMonthFocus}\n data-testid={ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH}\n type=\"button\"\n {...ariaAndDataPropsNextMonth}\n >\n <ChevronRight height={14} width={14} fill=\"#25292f\" />\n </StyledHeaderButton>\n <StyledHeaderButton\n aria-label=\"next year\"\n buttonType=\"raw\"\n size={BUTTON_SIZES.M}\n onClick={handleNextYear}\n innerRef={handleNextYearRef}\n onKeyDown={handleNextYearKeyDown}\n onFocus={onNextYearFocus}\n data-testid={ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR}\n type=\"button\"\n {...ariaAndDataPropsNextYear}\n >\n <ChevronDoubleRight height={14} width={14} fill=\"#25292f\" />\n </StyledHeaderButton>\n </StyledHeader>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAA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
|
|
3
|
-
import { useContext, useMemo } from "react";
|
|
3
|
+
import React2, { useContext, useMemo } from "react";
|
|
4
4
|
import { BUTTON_SIZES } from "@elliemae/ds-button";
|
|
5
5
|
import { DatePicker } from "@elliemae/ds-icons";
|
|
6
|
+
import { getPropsPerDatatestid } from "@elliemae/ds-props-helpers";
|
|
6
7
|
import { ControlledDateTimePickerDatatestid } from "../../../ControlledDateTimePickerDatatestid";
|
|
7
8
|
import { ControlledDateTimePickerContext } from "../../../ControlledDateTimePickerCTX";
|
|
8
9
|
import { CalendarContext } from "./CalendarContext";
|
|
@@ -10,9 +11,14 @@ import { StyledIconTriggerButton } from "./Styleds";
|
|
|
10
11
|
const CalendarIconTrigger = () => {
|
|
11
12
|
const { handleToggleCalendar, handleSetTriggerRef, handlePickerIconKeyDown } = useContext(CalendarContext);
|
|
12
13
|
const {
|
|
14
|
+
props,
|
|
13
15
|
props: { disabled },
|
|
14
16
|
ariaCurrentValueForInputs
|
|
15
17
|
} = useContext(ControlledDateTimePickerContext);
|
|
18
|
+
const ariaAndDataProps = React2.useMemo(
|
|
19
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR]),
|
|
20
|
+
[props]
|
|
21
|
+
);
|
|
16
22
|
return useMemo(
|
|
17
23
|
() => /* @__PURE__ */ jsx(
|
|
18
24
|
StyledIconTriggerButton,
|
|
@@ -26,10 +32,18 @@ const CalendarIconTrigger = () => {
|
|
|
26
32
|
"data-testid": ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR,
|
|
27
33
|
disabled,
|
|
28
34
|
type: "button",
|
|
35
|
+
...ariaAndDataProps,
|
|
29
36
|
children: /* @__PURE__ */ jsx(DatePicker, {})
|
|
30
37
|
}
|
|
31
38
|
),
|
|
32
|
-
[
|
|
39
|
+
[
|
|
40
|
+
ariaCurrentValueForInputs,
|
|
41
|
+
handleSetTriggerRef,
|
|
42
|
+
handleToggleCalendar,
|
|
43
|
+
handlePickerIconKeyDown,
|
|
44
|
+
disabled,
|
|
45
|
+
ariaAndDataProps
|
|
46
|
+
]
|
|
33
47
|
);
|
|
34
48
|
};
|
|
35
49
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/CalendarIconTrigger.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { BUTTON_SIZES } from '@elliemae/ds-button';\nimport { DatePicker } from '@elliemae/ds-icons';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarContext } from './CalendarContext';\nimport { StyledIconTriggerButton } from './Styleds';\n// we memoize the Icon for maximum optimization\n// this is particularly usefull due to how usePopper needs to check the references\n// since references are saved in a immutable way, we make sure to shortcircuit useless-re-renders\nexport const CalendarIconTrigger = (): JSX.Element => {\n const { handleToggleCalendar, handleSetTriggerRef, handlePickerIconKeyDown } = useContext(CalendarContext);\n const {\n props: { disabled },\n ariaCurrentValueForInputs,\n } = useContext(ControlledDateTimePickerContext);\n return useMemo(\n () => (\n <StyledIconTriggerButton\n aria-label={`date picker context menu trigger, ${ariaCurrentValueForInputs}`}\n buttonType=\"icon\"\n size={BUTTON_SIZES.M}\n innerRef={handleSetTriggerRef}\n onClick={handleToggleCalendar}\n onKeyDown={handlePickerIconKeyDown}\n data-testid={ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR}\n disabled={disabled}\n type=\"button\"\n >\n <DatePicker />\n </StyledIconTriggerButton>\n ),\n [ariaCurrentValueForInputs
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { BUTTON_SIZES } from '@elliemae/ds-button';\nimport { DatePicker } from '@elliemae/ds-icons';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarContext } from './CalendarContext';\nimport { StyledIconTriggerButton } from './Styleds';\n// we memoize the Icon for maximum optimization\n// this is particularly usefull due to how usePopper needs to check the references\n// since references are saved in a immutable way, we make sure to shortcircuit useless-re-renders\nexport const CalendarIconTrigger = (): JSX.Element => {\n const { handleToggleCalendar, handleSetTriggerRef, handlePickerIconKeyDown } = useContext(CalendarContext);\n const {\n props,\n props: { disabled },\n ariaCurrentValueForInputs,\n } = useContext(ControlledDateTimePickerContext);\n const ariaAndDataProps = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR]),\n [props],\n );\n return useMemo(\n () => (\n <StyledIconTriggerButton\n aria-label={`date picker context menu trigger, ${ariaCurrentValueForInputs}`}\n buttonType=\"icon\"\n size={BUTTON_SIZES.M}\n innerRef={handleSetTriggerRef}\n onClick={handleToggleCalendar}\n onKeyDown={handlePickerIconKeyDown}\n data-testid={ControlledDateTimePickerDatatestid.PICKER_ICONS.CALENDAR}\n disabled={disabled}\n type=\"button\"\n {...ariaAndDataProps}\n >\n <DatePicker />\n </StyledIconTriggerButton>\n ),\n [\n ariaCurrentValueForInputs,\n handleSetTriggerRef,\n handleToggleCalendar,\n handlePickerIconKeyDown,\n disabled,\n ariaAndDataProps,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoCf;AApCR,OAAOA,UAAS,YAAY,eAAe;AAC3C,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,6BAA6B;AACtC,SAAS,0CAA0C;AACnD,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAChC,SAAS,+BAA+B;AAIjC,MAAM,sBAAsB,MAAmB;AACpD,QAAM,EAAE,sBAAsB,qBAAqB,wBAAwB,IAAI,WAAW,eAAe;AACzG,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,EACF,IAAI,WAAW,+BAA+B;AAC9C,QAAM,mBAAmBA,OAAM;AAAA,IAC7B,MAAM,sBAAsB,MAAM,mCAAmC,aAAa,SAAS;AAAA,IAC3F,CAAC,KAAK;AAAA,EACR;AACA,SAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,cAAY,qCAAqC;AAAA,QACjD,YAAW;AAAA,QACX,MAAM,aAAa;AAAA,QACnB,UAAU;AAAA,QACV,SAAS;AAAA,QACT,WAAW;AAAA,QACX,eAAa,mCAAmC,aAAa;AAAA,QAC7D;AAAA,QACA,MAAK;AAAA,QACJ,GAAG;AAAA,QAEJ,8BAAC,cAAW;AAAA;AAAA,IACd;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/CalendarMonthDays.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarDaysList } from './CalendarDaysList';\nimport { CalendarContext } from './CalendarContext';\n\nexport const CalendarMonthDays = (): JSX.Element => {\n const { invisibleFirstDay, daysMatrixByWeekday, invisibleLastDay } = useContext(CalendarContext);\n const { calendarDaysWrapperRef } = useContext(ControlledDateTimePickerContext);\n\n return (\n <CalendarDaysList\n invisibleFirstDay={invisibleFirstDay}\n daysMatrixByWeekday={daysMatrixByWeekday}\n invisibleLastDay={invisibleLastDay}\n innerRef={calendarDaysWrapperRef}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACUnB;AAVJ,SAAgB,kBAAkB;AAClC,SAAS,uCAAuC;AAChD,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAEzB,MAAM,oBAAoB,MAAmB;AAClD,QAAM,EAAE,mBAAmB,qBAAqB,iBAAiB,IAAI,WAAW,eAAe;AAC/F,QAAM,EAAE,uBAAuB,IAAI,WAAW,+BAA+B;AAE7E,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA;AAAA,EACZ;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from "react";
|
|
3
|
+
import React2, { useContext } from "react";
|
|
4
|
+
import { getPropsPerDatatestid } from "@elliemae/ds-props-helpers";
|
|
4
5
|
import { DSPopperJS } from "@elliemae/ds-popperjs";
|
|
5
6
|
import { ControlledDateTimePickerDatatestid } from "../../../ControlledDateTimePickerDatatestid";
|
|
6
7
|
import { ControlledDateTimePickerContext } from "../../../ControlledDateTimePickerCTX";
|
|
7
8
|
import { CalendarContent } from "./CalendarContent";
|
|
8
9
|
import { CalendarContext } from "./CalendarContext";
|
|
9
10
|
const CalendarWrapper = () => {
|
|
10
|
-
const { isControllerOnly } = useContext(ControlledDateTimePickerContext);
|
|
11
|
+
const { isControllerOnly, props } = useContext(ControlledDateTimePickerContext);
|
|
12
|
+
const ariaAndDataProps = React2.useMemo(
|
|
13
|
+
() => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.CALENDAR]),
|
|
14
|
+
[props]
|
|
15
|
+
);
|
|
11
16
|
const { referenceElement, closeCalendar } = useContext(CalendarContext);
|
|
12
17
|
if (isControllerOnly)
|
|
13
18
|
return /* @__PURE__ */ jsx(CalendarContent, {});
|
|
@@ -19,6 +24,7 @@ const CalendarWrapper = () => {
|
|
|
19
24
|
referenceElement,
|
|
20
25
|
withoutArrow: true,
|
|
21
26
|
onClickOutside: closeCalendar,
|
|
27
|
+
...ariaAndDataProps,
|
|
22
28
|
children: /* @__PURE__ */ jsx(CalendarContent, {})
|
|
23
29
|
}
|
|
24
30
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/CalendarWrapper.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarContent } from './CalendarContent';\nimport { CalendarContext } from './CalendarContext';\n\nexport const CalendarWrapper = (): JSX.Element => {\n const { isControllerOnly } = useContext(ControlledDateTimePickerContext);\n const { referenceElement, closeCalendar } = useContext(CalendarContext);\n if (isControllerOnly) return <CalendarContent />;\n\n return (\n <DSPopperJS\n showPopover\n data-testid={ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.CALENDAR}\n referenceElement={referenceElement}\n withoutArrow\n onClickOutside={closeCalendar}\n >\n <CalendarContent />\n </DSPopperJS>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarContent } from './CalendarContent';\nimport { CalendarContext } from './CalendarContext';\n\nexport const CalendarWrapper = (): JSX.Element => {\n const { isControllerOnly, props } = useContext(ControlledDateTimePickerContext);\n const ariaAndDataProps = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.CALENDAR]),\n [props],\n );\n const { referenceElement, closeCalendar } = useContext(CalendarContext);\n if (isControllerOnly) return <CalendarContent />;\n\n return (\n <DSPopperJS\n showPopover\n data-testid={ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.CALENDAR}\n referenceElement={referenceElement}\n withoutArrow\n onClickOutside={closeCalendar}\n {...ariaAndDataProps}\n >\n <CalendarContent />\n </DSPopperJS>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACeQ;AAf/B,OAAOA,UAAS,kBAAkB;AAClC,SAAS,6BAA6B;AACtC,SAAS,kBAAkB;AAC3B,SAAS,0CAA0C;AACnD,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAEzB,MAAM,kBAAkB,MAAmB;AAChD,QAAM,EAAE,kBAAkB,MAAM,IAAI,WAAW,+BAA+B;AAC9E,QAAM,mBAAmBA,OAAM;AAAA,IAC7B,MAAM,sBAAsB,MAAM,mCAAmC,gBAAgB,SAAS;AAAA,IAC9F,CAAC,KAAK;AAAA,EACR;AACA,QAAM,EAAE,kBAAkB,cAAc,IAAI,WAAW,eAAe;AACtE,MAAI;AAAkB,WAAO,oBAAC,mBAAgB;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAW;AAAA,MACX,eAAa,mCAAmC,gBAAgB;AAAA,MAChE;AAAA,MACA,cAAY;AAAA,MACZ,gBAAgB;AAAA,MACf,GAAG;AAAA,MAEJ,8BAAC,mBAAgB;AAAA;AAAA,EACnB;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useCallback, useMemo } from "react";
|
|
4
|
+
import { getPropsPerDatatestid } from "@elliemae/ds-props-helpers";
|
|
4
5
|
import {
|
|
5
6
|
getDateStringFromDay,
|
|
6
7
|
getDayFromDateString,
|
|
@@ -20,6 +21,7 @@ const Day = ({ metaDay, colIndex, isInvisible }) => {
|
|
|
20
21
|
const {
|
|
21
22
|
handleChangeComposedDateString,
|
|
22
23
|
dateStringFromProps,
|
|
24
|
+
props,
|
|
23
25
|
props: { preventCloseOnSelection },
|
|
24
26
|
getIsDisabledDay,
|
|
25
27
|
getIsOutOfRangeDay,
|
|
@@ -118,6 +120,7 @@ const Day = ({ metaDay, colIndex, isInvisible }) => {
|
|
|
118
120
|
dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.END_RANGE_DAY;
|
|
119
121
|
if (isDayInRange)
|
|
120
122
|
dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.IN_RANGE_DAY;
|
|
123
|
+
const ariaAndDataProps = useMemo(() => getPropsPerDatatestid(props[dataTestid]), [dataTestid, props]);
|
|
121
124
|
return /* @__PURE__ */ jsx(
|
|
122
125
|
"div",
|
|
123
126
|
{
|
|
@@ -143,6 +146,7 @@ const Day = ({ metaDay, colIndex, isInvisible }) => {
|
|
|
143
146
|
"data-isfocused": isFocused,
|
|
144
147
|
"data-testid": dataTestid,
|
|
145
148
|
type: "button",
|
|
149
|
+
...ariaAndDataProps,
|
|
146
150
|
children: `${day.getDate()}`
|
|
147
151
|
}
|
|
148
152
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../src/parts/Pickers/Calendar/Day.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport {\n getDateStringFromDay,\n getDayFromDateString,\n getDateValuesFromDate,\n isSameDateMoment,\n compareTwoDatesDayEquality,\n} from '../../../utils/dateHelpers';\nimport { defaultMetaInfo, weekDays } from '../../../utils/constants';\nimport { getAriaDayFromDateString } from '../../../utils/stringHelpers';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarContext } from './CalendarContext';\nimport { StyledDayBtn } from './Styleds';\nimport type { DSControlledDateTimePickerT } from '../../../propTypes';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes';\n\ninterface CalendarDayPropsT {\n metaDay: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n colIndex?: number;\n isInvisible?: boolean;\n}\nconst displayNone = { display: 'none' };\n\nexport const Day = ({ metaDay, colIndex, isInvisible }: CalendarDayPropsT): JSX.Element => {\n const { day, isCurrMonthDay, isHidden, dayBtnRef, dayAsString } = metaDay;\n const {\n handleChangeComposedDateString,\n dateStringFromProps,\n props: { preventCloseOnSelection },\n getIsDisabledDay,\n getIsOutOfRangeDay,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n latestInteractionRegion,\n isWithTimeWheelToo,\n trackFocusCalendarMetafocusedDay,\n } = useContext(ControlledDateTimePickerContext);\n const { focusedDay, handleDayOnKeyDown, handleFocusMetaDayByDay, closeCalendar } = useContext(CalendarContext);\n const isFocusedMetaDay = focusedDay?.day ? compareTwoDatesDayEquality(metaDay?.day, focusedDay?.day) : false;\n const isSelected = useMemo(() => {\n const selectedDate = getDayFromDateString(dateStringFromProps);\n return selectedDate ? isSameDateMoment(day, selectedDate) : false;\n }, [dateStringFromProps, day]);\n const isFocused = latestInteractionRegion === 'calendar-days' && isFocusedMetaDay;\n const isDisabled = getIsDisabledDay(metaDay.dayAsString);\n const isOutOfRange = getIsOutOfRangeDay(metaDay.dayAsString);\n const isStartRangeDay = getIsStartRangeDay(metaDay.dayAsString);\n const isEndRangeDay = getIsEndRangeDay(metaDay.dayAsString);\n const isDayInRangeImproper = getIsDayInRange(metaDay.dayAsString);\n const isDayInRange = !isStartRangeDay && !isEndRangeDay && isDayInRangeImproper;\n\n const handleOnDayClick = useCallback(\n (e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent) => {\n handleFocusMetaDayByDay(day);\n if (!isDisabled && !isOutOfRange) {\n const newDateString = getDateStringFromDay(day);\n const metaInfo = { ...defaultMetaInfo, newDateString };\n const { month, day: dayNumber, year } = getDateValuesFromDate(day);\n appOnMonthChange(`${month + 1}`, e, metaInfo);\n if (dayNumber) appOnDayChange(`${dayNumber}`, e, metaInfo);\n appOnYearChange(`${year}`, e, metaInfo);\n handleChangeComposedDateString(newDateString, metaInfo);\n trackFocusCalendarMetafocusedDay();\n if (!isWithTimeWheelToo && !preventCloseOnSelection) closeCalendar();\n }\n },\n [\n handleFocusMetaDayByDay,\n day,\n isDisabled,\n isOutOfRange,\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n handleChangeComposedDateString,\n trackFocusCalendarMetafocusedDay,\n isWithTimeWheelToo,\n preventCloseOnSelection,\n closeCalendar,\n ],\n );\n\n const handleInnerRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n window.requestAnimationFrame(() => {\n dayBtnRef.current = ButtonDomNode;\n if (isFocused) ButtonDomNode?.focus?.();\n });\n },\n [dayBtnRef, isFocused],\n );\n\n const handleOnDayFocus = useCallback(() => {\n trackFocusCalendarMetafocusedDay('calendar-days');\n }, [trackFocusCalendarMetafocusedDay]);\n\n const dayClassModifiers = useMemo(\n () =>\n `dayWrapper ${isSelected ? 'selectedDay ' : ''}${isDisabled ? 'disabledDay ' : ''}${\n isOutOfRange ? 'outOfRangeDay ' : ''\n }${isFocused ? 'focusedDay ' : ''}${isStartRangeDay ? 'startRangeDay ' : ''}${\n isDayInRangeImproper ? 'inRangeImproperDay ' : ''\n }${isDayInRange ? 'inRangeDay ' : ''}${isEndRangeDay ? 'endRangeDay ' : ''}${\n isCurrMonthDay ? '' : 'notCurrentMonth'\n }`,\n [\n isSelected,\n isDisabled,\n isOutOfRange,\n isFocused,\n isStartRangeDay,\n isDayInRangeImproper,\n isDayInRange,\n isEndRangeDay,\n isCurrMonthDay,\n ],\n );\n\n let dataTestid:
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\n/* eslint-disable max-lines */\nimport React, { useContext, useCallback, useMemo } from 'react';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport {\n getDateStringFromDay,\n getDayFromDateString,\n getDateValuesFromDate,\n isSameDateMoment,\n compareTwoDatesDayEquality,\n} from '../../../utils/dateHelpers';\nimport { defaultMetaInfo, weekDays } from '../../../utils/constants';\nimport { getAriaDayFromDateString } from '../../../utils/stringHelpers';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX';\nimport { CalendarContext } from './CalendarContext';\nimport { StyledDayBtn } from './Styleds';\nimport type { DSControlledDateTimePickerT } from '../../../propTypes';\nimport type { DSControlledDateTimePickerInternalsT } from '../../../sharedTypes';\n\ninterface CalendarDayPropsT {\n metaDay: DSControlledDateTimePickerInternalsT.MetaMonthDay;\n colIndex?: number;\n isInvisible?: boolean;\n}\nconst displayNone = { display: 'none' };\n\nexport const Day = ({ metaDay, colIndex, isInvisible }: CalendarDayPropsT): JSX.Element => {\n const { day, isCurrMonthDay, isHidden, dayBtnRef, dayAsString } = metaDay;\n const {\n handleChangeComposedDateString,\n dateStringFromProps,\n props,\n props: { preventCloseOnSelection },\n getIsDisabledDay,\n getIsOutOfRangeDay,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n latestInteractionRegion,\n isWithTimeWheelToo,\n trackFocusCalendarMetafocusedDay,\n } = useContext(ControlledDateTimePickerContext);\n\n const { focusedDay, handleDayOnKeyDown, handleFocusMetaDayByDay, closeCalendar } = useContext(CalendarContext);\n const isFocusedMetaDay = focusedDay?.day ? compareTwoDatesDayEquality(metaDay?.day, focusedDay?.day) : false;\n const isSelected = useMemo(() => {\n const selectedDate = getDayFromDateString(dateStringFromProps);\n return selectedDate ? isSameDateMoment(day, selectedDate) : false;\n }, [dateStringFromProps, day]);\n const isFocused = latestInteractionRegion === 'calendar-days' && isFocusedMetaDay;\n const isDisabled = getIsDisabledDay(metaDay.dayAsString);\n const isOutOfRange = getIsOutOfRangeDay(metaDay.dayAsString);\n const isStartRangeDay = getIsStartRangeDay(metaDay.dayAsString);\n const isEndRangeDay = getIsEndRangeDay(metaDay.dayAsString);\n const isDayInRangeImproper = getIsDayInRange(metaDay.dayAsString);\n const isDayInRange = !isStartRangeDay && !isEndRangeDay && isDayInRangeImproper;\n\n const handleOnDayClick = useCallback(\n (e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent) => {\n handleFocusMetaDayByDay(day);\n if (!isDisabled && !isOutOfRange) {\n const newDateString = getDateStringFromDay(day);\n const metaInfo = { ...defaultMetaInfo, newDateString };\n const { month, day: dayNumber, year } = getDateValuesFromDate(day);\n appOnMonthChange(`${month + 1}`, e, metaInfo);\n if (dayNumber) appOnDayChange(`${dayNumber}`, e, metaInfo);\n appOnYearChange(`${year}`, e, metaInfo);\n handleChangeComposedDateString(newDateString, metaInfo);\n trackFocusCalendarMetafocusedDay();\n if (!isWithTimeWheelToo && !preventCloseOnSelection) closeCalendar();\n }\n },\n [\n handleFocusMetaDayByDay,\n day,\n isDisabled,\n isOutOfRange,\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n handleChangeComposedDateString,\n trackFocusCalendarMetafocusedDay,\n isWithTimeWheelToo,\n preventCloseOnSelection,\n closeCalendar,\n ],\n );\n\n const handleInnerRef = useCallback(\n (ButtonDomNode: HTMLButtonElement) => {\n window.requestAnimationFrame(() => {\n dayBtnRef.current = ButtonDomNode;\n if (isFocused) ButtonDomNode?.focus?.();\n });\n },\n [dayBtnRef, isFocused],\n );\n\n const handleOnDayFocus = useCallback(() => {\n trackFocusCalendarMetafocusedDay('calendar-days');\n }, [trackFocusCalendarMetafocusedDay]);\n\n const dayClassModifiers = useMemo(\n () =>\n `dayWrapper ${isSelected ? 'selectedDay ' : ''}${isDisabled ? 'disabledDay ' : ''}${\n isOutOfRange ? 'outOfRangeDay ' : ''\n }${isFocused ? 'focusedDay ' : ''}${isStartRangeDay ? 'startRangeDay ' : ''}${\n isDayInRangeImproper ? 'inRangeImproperDay ' : ''\n }${isDayInRange ? 'inRangeDay ' : ''}${isEndRangeDay ? 'endRangeDay ' : ''}${\n isCurrMonthDay ? '' : 'notCurrentMonth'\n }`,\n [\n isSelected,\n isDisabled,\n isOutOfRange,\n isFocused,\n isStartRangeDay,\n isDayInRangeImproper,\n isDayInRange,\n isEndRangeDay,\n isCurrMonthDay,\n ],\n );\n\n let dataTestid: (typeof ControlledDateTimePickerDatatestid)['CALENDAR'][keyof (typeof ControlledDateTimePickerDatatestid)['CALENDAR']] =\n ControlledDateTimePickerDatatestid.CALENDAR.DAY;\n\n if (isSelected) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.SELECTED_DAY;\n if (isFocused) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.FOCUSED_DAY;\n if (isFocused && isSelected) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.SELECTED_FOCUSED_DAY;\n if (isStartRangeDay) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.START_RANGE_DAY;\n if (isEndRangeDay) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.END_RANGE_DAY;\n if (isDayInRange) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.IN_RANGE_DAY;\n const ariaAndDataProps = useMemo(() => getPropsPerDatatestid(props[dataTestid]), [dataTestid, props]);\n return (\n <div\n className={dayClassModifiers}\n style={isHidden ? displayNone : undefined}\n role={!isInvisible ? 'gridcell' : undefined}\n {...(Number.isInteger(colIndex) && { 'aria-colindex': colIndex })}\n >\n <StyledDayBtn\n aria-label={`${getAriaDayFromDateString(dayAsString)}, ${weekDays[metaDay.day.getDay()]}`}\n aria-disabled={isOutOfRange || isDisabled}\n aria-hidden={!!isInvisible}\n buttonType=\"raw\"\n size=\"m\"\n onClick={handleOnDayClick} // DSButton triggers this with \"spacebar\" and \"enter\" too...\n onFocus={handleOnDayFocus}\n onKeyDown={(e: React.KeyboardEvent<Element>) => {\n handleDayOnKeyDown(e, metaDay);\n }}\n innerRef={handleInnerRef}\n tabIndex={-1}\n data-isfocused={isFocused}\n data-testid={dataTestid}\n type=\"button\"\n {...ariaAndDataProps}\n >\n {`${day.getDate()}`}\n </StyledDayBtn>\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACkJjB;AA/IN,SAAgB,YAAY,aAAa,eAAe;AACxD,SAAS,6BAA6B;AACtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB,gBAAgB;AAC1C,SAAS,gCAAgC;AACzC,SAAS,0CAA0C;AACnD,SAAS,uCAAuC;AAChD,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAS7B,MAAM,cAAc,EAAE,SAAS,OAAO;AAE/B,MAAM,MAAM,CAAC,EAAE,SAAS,UAAU,YAAY,MAAsC;AACzF,QAAM,EAAE,K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