@elliemae/ds-form-date-time-picker 3.16.0-next.2 → 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
|
@@ -30,7 +30,7 @@ __export(ControlledDateTimePicker_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(ControlledDateTimePicker_exports);
|
|
31
31
|
var React = __toESM(require("react"));
|
|
32
32
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
-
var
|
|
33
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
34
34
|
var import_theming = require("./exported-related/theming");
|
|
35
35
|
var import_propTypes = require("./propTypes");
|
|
36
36
|
var import_useControlledDateTimePicker = require("./config/useControlledDateTimePicker");
|
|
@@ -41,6 +41,6 @@ const DSControlledDateTimePicker = (props) => {
|
|
|
41
41
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ControlledDateTimePickerContent.ControlledDateTimePickerContent, {}) });
|
|
42
42
|
};
|
|
43
43
|
DSControlledDateTimePicker.displayName = import_theming.DSControlledDateTimePickerName;
|
|
44
|
-
const DSControlledDateTimePickerWithSchema = (0,
|
|
44
|
+
const DSControlledDateTimePickerWithSchema = (0, import_ds_props_helpers.describe)(DSControlledDateTimePicker);
|
|
45
45
|
DSControlledDateTimePickerWithSchema.propTypes = import_propTypes.propTypes;
|
|
46
46
|
//# sourceMappingURL=ControlledDateTimePicker.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ControlledDateTimePicker.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcjB;AAZN,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { DSControlledDateTimePickerName } from './exported-related/theming';\nimport { propTypes } from './propTypes';\nimport { useControlledDateTimePicker } from './config/useControlledDateTimePicker';\nimport { ControlledDateTimePickerContent } from './parts/ControlledDateTimePickerContent';\nimport { ControlledDateTimePickerContext } from './ControlledDateTimePickerCTX';\nimport type { DSControlledDateTimePickerT } from './propTypes';\n\nconst DSControlledDateTimePicker = (props: DSControlledDateTimePickerT.Props): JSX.Element => {\n const ctx = useControlledDateTimePicker(props);\n return (\n <ControlledDateTimePickerContext.Provider value={ctx}>\n <ControlledDateTimePickerContent />\n </ControlledDateTimePickerContext.Provider>\n );\n};\n\nDSControlledDateTimePicker.displayName = DSControlledDateTimePickerName;\nconst DSControlledDateTimePickerWithSchema = describe(DSControlledDateTimePicker);\nDSControlledDateTimePickerWithSchema.propTypes = propTypes;\n\nexport { DSControlledDateTimePickerWithSchema, DSControlledDateTimePicker };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcjB;AAZN,8BAAyB;AACzB,qBAA+C;AAC/C,uBAA0B;AAC1B,yCAA4C;AAC5C,6CAAgD;AAChD,yCAAgD;AAGhD,MAAM,6BAA6B,CAAC,UAA0D;AAC5F,QAAM,UAAM,gEAA4B,KAAK;AAC7C,SACE,4CAAC,mEAAgC,UAAhC,EAAyC,OAAO,KAC/C,sDAAC,0EAAgC,GACnC;AAEJ;AAEA,2BAA2B,cAAc;AACzC,MAAM,2CAAuC,kCAAS,0BAA0B;AAChF,qCAAqC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useChangeHandlers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useCallback, useMemo } from 'react';\nimport type { useRelevantValueFromProps } from './useRelevantValueFromProps';\nimport type { useGetDestructuredValues } from './useGetDestructuredValues';\nimport type { useGetPropsBasedOnType } from './useGetPropsBasedOnType';\nimport type { useGetReferences } from './useGetReferences';\nimport type { useFocusTracker } from './useFocusTracker';\nimport { getValidationDateStringMetaInfo } from '../utils/dateHelpers';\nimport { getValidationTimeStringMetaInfo } from '../utils/timeHelpers';\nimport {\n isEmptyDateStringMask,\n isEmptyTimeStringMask,\n isEmptyDateTimeStringMask,\n getFormattedDateString,\n getFormattedTimeString,\n} from '../utils/stringHelpers';\nimport type { DSControlledDateTimePickerT } from '../propTypes';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes';\n\nimport { defaultMetaInfo } from '../utils/constants';\ninterface Config {\n relevantValues: ReturnType<typeof useRelevantValueFromProps>;\n destructuredValues: ReturnType<typeof useGetDestructuredValues>;\n propsBasedOnType: ReturnType<typeof useGetPropsBasedOnType>;\n DOMRefs: ReturnType<typeof useGetReferences>;\n focusTrackers: ReturnType<typeof useFocusTracker>;\n}\n\nexport const useChangeHandlers = ({ relevantValues, destructuredValues, propsBasedOnType, focusTrackers }: Config) => {\n const { tempDateString, setTempDateString, tempTimeString, setTimeString } = relevantValues;\n const {\n getIsDisabledDay,\n getIsOutOfRangeDay,\n appOnDateChange,\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n getIsDisabledTime,\n appOnTimeChange,\n appOnHourChange,\n appOnMinuteChange,\n appOnMeridiemChange,\n appOnDateTimeChange,\n isDateTime,\n isDate,\n isTime,\n } = propsBasedOnType;\n const { month, day, year, hours, minutes, meridiem } = destructuredValues;\n const { trackFocusFirstSegment } = focusTrackers;\n\n const getDateMetaInfo = useCallback(\n (\n newDateString: string | null = null,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {},\n ): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const finalDateString = newDateString || tempDateString;\n const finalMetaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(finalDateString, getIsOutOfRangeDay, getIsDisabledDay),\n };\n return finalMetaInfo;\n },\n [tempDateString, getIsDisabledDay, getIsOutOfRangeDay],\n );\n\n const getTimeMetaInfo = useCallback(\n (\n newTimeString: string | null = null,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {},\n ): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const finalTimeString = newTimeString || tempTimeString;\n const finalMetaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(finalTimeString, getIsDisabledTime),\n };\n return finalMetaInfo;\n },\n [tempTimeString, getIsDisabledTime],\n );\n\n const handleChangeComposedDateTimeString = useCallback(\n (\n newDateString: string,\n newTimeString: string,\n metaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo,\n ): void => {\n const appDateString = isEmptyDateStringMask(newDateString) ? '' : newDateString;\n const appTimeString = isEmptyTimeStringMask(newTimeString) ? '' : newTimeString;\n appOnDateChange(appDateString, metaInfo); // don't do this on useEffect to avoid complete chaos\n setTempDateString(newDateString);\n\n appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos\n setTimeString(newTimeString);\n\n const newDateTimeString = `${newDateString} ${newTimeString}`;\n const newMetaInfo = {\n ...metaInfo,\n ...getTimeMetaInfo(newTimeString, metaInfo),\n ...getDateMetaInfo(newDateString, metaInfo),\n newDateString,\n newTimeString,\n newDateTimeString,\n };\n\n const appDateTimeString = isEmptyDateTimeStringMask(newDateTimeString) ? '' : newDateTimeString;\n appOnDateTimeChange(appDateTimeString, newMetaInfo); // don't do this on useEffect to avoid complete chaos\n },\n [\n appOnDateChange,\n setTempDateString,\n appOnTimeChange,\n setTimeString,\n getTimeMetaInfo,\n getDateMetaInfo,\n appOnDateTimeChange,\n ],\n );\n const handleChangeComposedDateString = useCallback(\n (newDateString: string, metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo>) => {\n // if we receive an \"empty\" mask, we comunicate empty string to the app\n const appDateString = isEmptyDateStringMask(newDateString) ? '' : newDateString;\n appOnDateChange(appDateString, metaInfo); // don't do this on useEffect to avoid complete chaos\n setTempDateString(newDateString);\n const newDateTimeString = `${newDateString} ${tempTimeString}`;\n const newMetaInfo = {\n ...metaInfo,\n ...getTimeMetaInfo(tempTimeString, metaInfo),\n ...getDateMetaInfo(newDateString, metaInfo),\n newDateString,\n newTimeString: tempTimeString,\n newDateTimeString,\n };\n\n const appDateTimeString = isEmptyDateTimeStringMask(newDateTimeString) ? '' : newDateTimeString;\n appOnDateTimeChange(appDateTimeString, newMetaInfo); // don't do this on useEffect to avoid complete chaos\n },\n [appOnDateChange, setTempDateString, tempTimeString, getTimeMetaInfo, getDateMetaInfo, appOnDateTimeChange],\n );\n const handleChangeComposedTimeString = useCallback(\n (newTimeString: string, metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo>) => {\n const appTimeString = isEmptyTimeStringMask(newTimeString) ? '' : newTimeString;\n appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos\n\n setTimeString(newTimeString);\n const newDateTimeString = `${tempDateString} ${newTimeString}`;\n const newMetaInfo = {\n ...metaInfo,\n ...getTimeMetaInfo(newTimeString, metaInfo),\n ...getDateMetaInfo(tempDateString, metaInfo),\n newDateTimeString,\n newDateString: tempDateString,\n newTimeString,\n };\n\n const appDateTimeString = isEmptyDateTimeStringMask(newDateTimeString) ? '' : newDateTimeString;\n appOnDateTimeChange(appDateTimeString, newMetaInfo); // don't do this on useEffect to avoid complete chaos\n },\n [appOnTimeChange, setTimeString, tempDateString, getTimeMetaInfo, getDateMetaInfo, appOnDateTimeChange],\n );\n\n const handleChangeMonth: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newMonth, e, metaInfo = defaultMetaInfo) => {\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 handleChangeDay: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newDay, e, metaInfo = defaultMetaInfo) => {\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 handleChangeYear: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newYear, e, metaInfo = defaultMetaInfo) => {\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\n const handleChangeHours: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newHours, e, metaInfo = defaultMetaInfo) => {\n const newTimeString = getFormattedTimeString({\n hours: newHours,\n minutes,\n // seconds,\n meridiem,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(newTimeString, getIsDisabledTime),\n newTimeString,\n };\n appOnHourChange(newHours, e, finalMetaInfo);\n handleChangeComposedTimeString(newTimeString, finalMetaInfo);\n },\n [minutes, meridiem, getIsDisabledTime, appOnHourChange, handleChangeComposedTimeString],\n );\n const handleChangeMinutes: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newMinutes, e, metaInfo = defaultMetaInfo) => {\n const newTimeString = getFormattedTimeString({\n hours,\n minutes: newMinutes,\n meridiem,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(newTimeString, getIsDisabledTime),\n newTimeString,\n };\n appOnMinuteChange(newMinutes, e, finalMetaInfo);\n handleChangeComposedTimeString(newTimeString, finalMetaInfo);\n },\n [hours, meridiem, getIsDisabledTime, appOnMinuteChange, handleChangeComposedTimeString],\n );\n const handleChangeMeridiem: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newMeridiem, e, metaInfo = defaultMetaInfo) => {\n const newTimeString = getFormattedTimeString({\n hours,\n minutes,\n meridiem: newMeridiem,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(newTimeString, getIsDisabledTime),\n newTimeString,\n };\n appOnMeridiemChange(newMeridiem, e, finalMetaInfo);\n handleChangeComposedTimeString(newTimeString, finalMetaInfo);\n },\n [hours, minutes, getIsDisabledTime, appOnMeridiemChange, handleChangeComposedTimeString],\n );\n\n const handleClearAll: DSControlledDateTimePickerInternalsT.OnDSBtnClick = useCallback(\n (e) => {\n const metaInfo = {\n isAutomaticFillTrigger: false,\n isClearButtonAction: true,\n newDateString: '',\n newTimeString: '',\n newDateTimeString: '',\n };\n appOnMonthChange('', e, metaInfo);\n appOnDayChange('', e, metaInfo);\n appOnYearChange('', e, metaInfo);\n appOnHourChange('', e, metaInfo);\n appOnMinuteChange('', e, metaInfo);\n appOnMeridiemChange('', e, metaInfo);\n if (isDateTime) handleChangeComposedDateTimeString('__/__/____', '__:__ __', metaInfo);\n if (isDate) handleChangeComposedDateString('__/__/____', metaInfo);\n if (isTime) handleChangeComposedTimeString('__:__ __', metaInfo);\n trackFocusFirstSegment();\n },\n [\n appOnDayChange,\n appOnHourChange,\n appOnMeridiemChange,\n appOnMinuteChange,\n appOnMonthChange,\n appOnYearChange,\n handleChangeComposedDateString,\n handleChangeComposedDateTimeString,\n handleChangeComposedTimeString,\n isDate,\n isDateTime,\n isTime,\n trackFocusFirstSegment,\n ],\n );\n\n return useMemo(\n () => ({\n handleChangeComposedDateTimeString,\n handleChangeComposedDateString,\n handleChangeComposedTimeString,\n handleChangeMonth,\n handleChangeDay,\n handleChangeYear,\n handleChangeHours,\n handleChangeMinutes,\n handleChangeMeridiem,\n handleClearAll,\n }),\n [\n handleChangeComposedDateString,\n handleChangeComposedDateTimeString,\n handleChangeComposedTimeString,\n handleChangeDay,\n handleChangeHours,\n handleChangeMeridiem,\n handleChangeMinutes,\n handleChangeMonth,\n handleChangeYear,\n handleClearAll,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAqC;AAMrC,yBAAgD;AAChD,yBAAgD;AAChD,2BAMO;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useCallback, useMemo } from 'react';\nimport type { useRelevantValueFromProps } from './useRelevantValueFromProps';\nimport type { useGetDestructuredValues } from './useGetDestructuredValues';\nimport type { useGetPropsBasedOnType } from './useGetPropsBasedOnType';\nimport type { useGetReferences } from './useGetReferences';\nimport type { useFocusTracker } from './useFocusTracker';\nimport { getValidationDateStringMetaInfo } from '../utils/dateHelpers';\nimport { getValidationTimeStringMetaInfo } from '../utils/timeHelpers';\nimport {\n isEmptyDateStringMask,\n isEmptyTimeStringMask,\n isEmptyDateTimeStringMask,\n getFormattedDateString,\n getFormattedTimeString,\n} from '../utils/stringHelpers';\nimport type { DSControlledDateTimePickerT } from '../propTypes';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes';\nimport { defaultMetaInfo } from '../utils/constants';\ninterface Config {\n relevantValues: ReturnType<typeof useRelevantValueFromProps>;\n destructuredValues: ReturnType<typeof useGetDestructuredValues>;\n propsBasedOnType: ReturnType<typeof useGetPropsBasedOnType>;\n DOMRefs: ReturnType<typeof useGetReferences>;\n focusTrackers: ReturnType<typeof useFocusTracker>;\n}\n\nexport const useChangeHandlers = ({ relevantValues, destructuredValues, propsBasedOnType, focusTrackers }: Config) => {\n const { tempDateString, setTempDateString, tempTimeString, setTimeString } = relevantValues;\n const {\n getIsDisabledDay,\n getIsOutOfRangeDay,\n appOnDateChange,\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n getIsDisabledTime,\n appOnTimeChange,\n appOnHourChange,\n appOnMinuteChange,\n appOnMeridiemChange,\n appOnDateTimeChange,\n isDateTime,\n isDate,\n isTime,\n } = propsBasedOnType;\n const { month, day, year, hours, minutes, meridiem } = destructuredValues;\n const { trackFocusFirstSegment } = focusTrackers;\n\n const getDateMetaInfo = useCallback(\n (\n newDateString: string | null = null,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {},\n ): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const finalDateString = newDateString || tempDateString;\n const finalMetaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(finalDateString, getIsOutOfRangeDay, getIsDisabledDay),\n };\n return finalMetaInfo;\n },\n [tempDateString, getIsDisabledDay, getIsOutOfRangeDay],\n );\n\n const getTimeMetaInfo = useCallback(\n (\n newTimeString: string | null = null,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {},\n ): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const finalTimeString = newTimeString || tempTimeString;\n const finalMetaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(finalTimeString, getIsDisabledTime),\n };\n return finalMetaInfo;\n },\n [tempTimeString, getIsDisabledTime],\n );\n\n const handleChangeComposedDateTimeString = useCallback(\n (\n newDateString: string,\n newTimeString: string,\n metaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo,\n ): void => {\n const appDateString = isEmptyDateStringMask(newDateString) ? '' : newDateString;\n const appTimeString = isEmptyTimeStringMask(newTimeString) ? '' : newTimeString;\n appOnDateChange(appDateString, metaInfo); // don't do this on useEffect to avoid complete chaos\n setTempDateString(newDateString);\n\n appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos\n setTimeString(newTimeString);\n\n const newDateTimeString = `${newDateString} ${newTimeString}`;\n const newMetaInfo = {\n ...metaInfo,\n ...getTimeMetaInfo(newTimeString, metaInfo),\n ...getDateMetaInfo(newDateString, metaInfo),\n newDateString,\n newTimeString,\n newDateTimeString,\n };\n\n const appDateTimeString = isEmptyDateTimeStringMask(newDateTimeString) ? '' : newDateTimeString;\n appOnDateTimeChange(appDateTimeString, newMetaInfo); // don't do this on useEffect to avoid complete chaos\n },\n [\n appOnDateChange,\n setTempDateString,\n appOnTimeChange,\n setTimeString,\n getTimeMetaInfo,\n getDateMetaInfo,\n appOnDateTimeChange,\n ],\n );\n const handleChangeComposedDateString = useCallback(\n (newDateString: string, metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo>) => {\n // if we receive an \"empty\" mask, we comunicate empty string to the app\n const appDateString = isEmptyDateStringMask(newDateString) ? '' : newDateString;\n appOnDateChange(appDateString, metaInfo); // don't do this on useEffect to avoid complete chaos\n setTempDateString(newDateString);\n const newDateTimeString = `${newDateString} ${tempTimeString}`;\n const newMetaInfo = {\n ...metaInfo,\n ...getTimeMetaInfo(tempTimeString, metaInfo),\n ...getDateMetaInfo(newDateString, metaInfo),\n newDateString,\n newTimeString: tempTimeString,\n newDateTimeString,\n };\n\n const appDateTimeString = isEmptyDateTimeStringMask(newDateTimeString) ? '' : newDateTimeString;\n appOnDateTimeChange(appDateTimeString, newMetaInfo); // don't do this on useEffect to avoid complete chaos\n },\n [appOnDateChange, setTempDateString, tempTimeString, getTimeMetaInfo, getDateMetaInfo, appOnDateTimeChange],\n );\n const handleChangeComposedTimeString = useCallback(\n (newTimeString: string, metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo>) => {\n const appTimeString = isEmptyTimeStringMask(newTimeString) ? '' : newTimeString;\n appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos\n\n setTimeString(newTimeString);\n const newDateTimeString = `${tempDateString} ${newTimeString}`;\n const newMetaInfo = {\n ...metaInfo,\n ...getTimeMetaInfo(newTimeString, metaInfo),\n ...getDateMetaInfo(tempDateString, metaInfo),\n newDateTimeString,\n newDateString: tempDateString,\n newTimeString,\n };\n\n const appDateTimeString = isEmptyDateTimeStringMask(newDateTimeString) ? '' : newDateTimeString;\n appOnDateTimeChange(appDateTimeString, newMetaInfo); // don't do this on useEffect to avoid complete chaos\n },\n [appOnTimeChange, setTimeString, tempDateString, getTimeMetaInfo, getDateMetaInfo, appOnDateTimeChange],\n );\n\n const handleChangeMonth: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newMonth, e, metaInfo = defaultMetaInfo) => {\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 handleChangeDay: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newDay, e, metaInfo = defaultMetaInfo) => {\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 handleChangeYear: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newYear, e, metaInfo = defaultMetaInfo) => {\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\n const handleChangeHours: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newHours, e, metaInfo = defaultMetaInfo) => {\n const newTimeString = getFormattedTimeString({\n hours: newHours,\n minutes,\n // seconds,\n meridiem,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(newTimeString, getIsDisabledTime),\n newTimeString,\n };\n appOnHourChange(newHours, e, finalMetaInfo);\n handleChangeComposedTimeString(newTimeString, finalMetaInfo);\n },\n [minutes, meridiem, getIsDisabledTime, appOnHourChange, handleChangeComposedTimeString],\n );\n const handleChangeMinutes: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newMinutes, e, metaInfo = defaultMetaInfo) => {\n const newTimeString = getFormattedTimeString({\n hours,\n minutes: newMinutes,\n meridiem,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(newTimeString, getIsDisabledTime),\n newTimeString,\n };\n appOnMinuteChange(newMinutes, e, finalMetaInfo);\n handleChangeComposedTimeString(newTimeString, finalMetaInfo);\n },\n [hours, meridiem, getIsDisabledTime, appOnMinuteChange, handleChangeComposedTimeString],\n );\n const handleChangeMeridiem: DSControlledDateTimePickerT.OnInternalInputsChange = useCallback(\n (newMeridiem, e, metaInfo = defaultMetaInfo) => {\n const newTimeString = getFormattedTimeString({\n hours,\n minutes,\n meridiem: newMeridiem,\n });\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationTimeStringMetaInfo(newTimeString, getIsDisabledTime),\n newTimeString,\n };\n appOnMeridiemChange(newMeridiem, e, finalMetaInfo);\n handleChangeComposedTimeString(newTimeString, finalMetaInfo);\n },\n [hours, minutes, getIsDisabledTime, appOnMeridiemChange, handleChangeComposedTimeString],\n );\n\n const handleClearAll: DSControlledDateTimePickerInternalsT.OnDSBtnClick = useCallback(\n (e) => {\n const metaInfo = {\n isAutomaticFillTrigger: false,\n isClearButtonAction: true,\n newDateString: '',\n newTimeString: '',\n newDateTimeString: '',\n };\n appOnMonthChange('', e, metaInfo);\n appOnDayChange('', e, metaInfo);\n appOnYearChange('', e, metaInfo);\n appOnHourChange('', e, metaInfo);\n appOnMinuteChange('', e, metaInfo);\n appOnMeridiemChange('', e, metaInfo);\n if (isDateTime) handleChangeComposedDateTimeString('__/__/____', '__:__ __', metaInfo);\n if (isDate) handleChangeComposedDateString('__/__/____', metaInfo);\n if (isTime) handleChangeComposedTimeString('__:__ __', metaInfo);\n trackFocusFirstSegment();\n },\n [\n appOnDayChange,\n appOnHourChange,\n appOnMeridiemChange,\n appOnMinuteChange,\n appOnMonthChange,\n appOnYearChange,\n handleChangeComposedDateString,\n handleChangeComposedDateTimeString,\n handleChangeComposedTimeString,\n isDate,\n isDateTime,\n isTime,\n trackFocusFirstSegment,\n ],\n );\n\n return useMemo(\n () => ({\n handleChangeComposedDateTimeString,\n handleChangeComposedDateString,\n handleChangeComposedTimeString,\n handleChangeMonth,\n handleChangeDay,\n handleChangeYear,\n handleChangeHours,\n handleChangeMinutes,\n handleChangeMeridiem,\n handleClearAll,\n }),\n [\n handleChangeComposedDateString,\n handleChangeComposedDateTimeString,\n handleChangeComposedTimeString,\n handleChangeDay,\n handleChangeHours,\n handleChangeMeridiem,\n handleChangeMinutes,\n handleChangeMonth,\n handleChangeYear,\n handleClearAll,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,mBAAqC;AAMrC,yBAAgD;AAChD,yBAAgD;AAChD,2BAMO;AAGP,uBAAgC;AASzB,MAAM,oBAAoB,CAAC,EAAE,gBAAgB,oBAAoB,kBAAkB,cAAc,MAAc;AACpH,QAAM,EAAE,gBAAgB,mBAAmB,gBAAgB,cAAc,IAAI;AAC7E,QAAM;AAAA,IACJ;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;AACJ,QAAM,EAAE,OAAO,KAAK,MAAM,OAAO,SAAS,SAAS,IAAI;AACvD,QAAM,EAAE,uBAAuB,IAAI;AAEnC,QAAM,sBAAkB;AAAA,IACtB,CACE,gBAA+B,MAC/B,WAA8E,CAAC,MACT;AACtE,YAAM,kBAAkB,iBAAiB;AACzC,YAAM,gBAAmF;AAAA,QACvF,GAAG;AAAA,QACH,OAAG,oDAAgC,iBAAiB,oBAAoB,gBAAgB;AAAA,MAC1F;AACA,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,6BAAuB;AAAA,IACzB;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;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;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,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,7 +29,7 @@ __export(useControlledDateTimePicker_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(useControlledDateTimePicker_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_react = __toESM(require("react"));
|
|
32
|
-
var
|
|
32
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
33
33
|
var import_useGetPropsWithDefault = require("./useGetPropsWithDefault");
|
|
34
34
|
var import_useFocusTracker = require("./useFocusTracker");
|
|
35
35
|
var import_useGetFlags = require("./useGetFlags");
|
|
@@ -57,8 +57,8 @@ const useControlledDateTimePicker = (props) => {
|
|
|
57
57
|
focusTrackers
|
|
58
58
|
});
|
|
59
59
|
const globalKeyHandlers = (0, import_useGlobalKeyHandlers.useGlobalKeyHandlers)({ changeHandlers, propsBasedOnType, DOMRefs, flags, focusTrackers });
|
|
60
|
-
const xstyledAttrs = (0,
|
|
61
|
-
const globalAttrs = (0,
|
|
60
|
+
const xstyledAttrs = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefaults);
|
|
61
|
+
const globalAttrs = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefaults);
|
|
62
62
|
const { announcedDateValues, announcedTimeValues } = destructuredValues;
|
|
63
63
|
const { isWithDateInputs, isDateTimeSelector, isWithTimeInputs } = flags;
|
|
64
64
|
const ariaCurrentValueForInputs = `current values: ${isWithDateInputs ? `${announcedDateValues}` : ""}${isDateTimeSelector ? ", " : ""}${isWithTimeInputs ? `${announcedTimeValues}` : ""}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useControlledDateTimePicker.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { useGetDatePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useFocusTracker } from './useFocusTracker';\nimport { useGetFlags } from './useGetFlags';\nimport { useGetReferences } from './useGetReferences';\nimport { useRelevantValueFromProps } from './useRelevantValueFromProps';\nimport { useGetPropsBasedOnType } from './useGetPropsBasedOnType';\nimport { useGetDestructuredValues } from './useGetDestructuredValues';\nimport { useChangeHandlers } from './useChangeHandlers';\nimport { useGlobalKeyHandlers } from './useGlobalKeyHandlers';\nimport { useValidateProps } from './useValidateProps';\nimport type { DSControlledDateTimePickerT } from '../propTypes';\n\nexport type ControlledDateTimePickerContextT = ReturnType<typeof useGetFlags> &\n ReturnType<typeof useFocusTracker> &\n ReturnType<typeof useGetReferences> &\n ReturnType<typeof useGetPropsBasedOnType> &\n ReturnType<typeof useRelevantValueFromProps> &\n ReturnType<typeof useGetDestructuredValues> &\n ReturnType<typeof useChangeHandlers> &\n ReturnType<typeof useGlobalKeyHandlers> & {\n props: DSControlledDateTimePickerT.InternalProps;\n ariaCurrentValueForInputs: string;\n globalAttrs: Record<string, unknown>;\n xstyledAttrs: Record<string, unknown>;\n };\n\nexport const useControlledDateTimePicker = (\n props: DSControlledDateTimePickerT.Props,\n): ControlledDateTimePickerContextT => {\n // if we detect wrong props configuration we throw meaningful errors\n useValidateProps(props);\n\n const propsWithDefaults = useGetDatePickerWithDefaultsProps(props);\n\n const flags = useGetFlags(propsWithDefaults);\n const DOMRefs = useGetReferences(flags); // refs are used for \"auto-advance\" feature\n const focusTrackers = useFocusTracker({ DOMRefs, flags, propsWithDefaults });\n const relevantValues = useRelevantValueFromProps(propsWithDefaults);\n const propsBasedOnType = useGetPropsBasedOnType(propsWithDefaults);\n const destructuredValues = useGetDestructuredValues({ ...propsBasedOnType, ...flags });\n const changeHandlers = useChangeHandlers({\n relevantValues,\n destructuredValues,\n propsBasedOnType,\n DOMRefs,\n focusTrackers,\n });\n\n const globalKeyHandlers = useGlobalKeyHandlers({ changeHandlers, propsBasedOnType, DOMRefs, flags, focusTrackers });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call\n // const dataAttrs = getDataProps<DSControlledDateTimePickerT.InternalProps>(propsWithDefaults);\n\n const xstyledAttrs = useGetXstyledProps(propsWithDefaults) as Record<string, unknown>;\n\n const globalAttrs = useGetGlobalAttributes(propsWithDefaults) as Record<string, unknown>;\n\n const { announcedDateValues, announcedTimeValues } = destructuredValues;\n const { isWithDateInputs, isDateTimeSelector, isWithTimeInputs } = flags;\n\n const ariaCurrentValueForInputs = `current values: ${isWithDateInputs ? `${announcedDateValues}` : ''}${\n isDateTimeSelector ? ', ' : ''\n }${isWithTimeInputs ? `${announcedTimeValues}` : ''}`;\n\n const ctx = React.useMemo(\n () => ({\n props: propsWithDefaults,\n ariaCurrentValueForInputs,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n xstyledAttrs,\n globalAttrs,\n ...focusTrackers,\n ...flags,\n ...DOMRefs,\n ...relevantValues,\n ...propsBasedOnType,\n ...destructuredValues,\n ...changeHandlers,\n ...globalKeyHandlers,\n }),\n [\n propsWithDefaults,\n ariaCurrentValueForInputs,\n focusTrackers,\n flags,\n DOMRefs,\n relevantValues,\n propsBasedOnType,\n destructuredValues,\n changeHandlers,\n globalKeyHandlers,\n xstyledAttrs,\n globalAttrs,\n ],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAA2D;AAC3D,oCAAkD;AAClD,6BAAgC;AAChC,yBAA4B;AAC5B,8BAAiC;AACjC,uCAA0C;AAC1C,oCAAuC;AACvC,sCAAyC;AACzC,+BAAkC;AAClC,kCAAqC;AACrC,8BAAiC;AAiB1B,MAAM,8BAA8B,CACzC,UACqC;AAErC,gDAAiB,KAAK;AAEtB,QAAM,wBAAoB,iEAAkC,KAAK;AAEjE,QAAM,YAAQ,gCAAY,iBAAiB;AAC3C,QAAM,cAAU,0CAAiB,KAAK;AACtC,QAAM,oBAAgB,wCAAgB,EAAE,SAAS,OAAO,kBAAkB,CAAC;AAC3E,QAAM,qBAAiB,4DAA0B,iBAAiB;AAClE,QAAM,uBAAmB,sDAAuB,iBAAiB;AACjE,QAAM,yBAAqB,0DAAyB,EAAE,GAAG,kBAAkB,GAAG,MAAM,CAAC;AACrF,QAAM,qBAAiB,4CAAkB;AAAA,IACvC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,wBAAoB,kDAAqB,EAAE,gBAAgB,kBAAkB,SAAS,OAAO,cAAc,CAAC;AAKlH,QAAM,mBAAe,4CAAmB,iBAAiB;AAEzD,QAAM,kBAAc,gDAAuB,iBAAiB;AAE5D,QAAM,EAAE,qBAAqB,oBAAoB,IAAI;AACrD,QAAM,EAAE,kBAAkB,oBAAoB,iBAAiB,IAAI;AAEnE,QAAM,4BAA4B,mBAAmB,mBAAmB,GAAG,wBAAwB,KACjG,qBAAqB,OAAO,KAC3B,mBAAmB,GAAG,wBAAwB;AAEjD,QAAM,MAAM,aAAAA,QAAM;AAAA,IAChB,OAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MAEA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,IACL;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,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -64,8 +64,8 @@ const getDateTimeFlags = (props) => {
|
|
|
64
64
|
isWithTimeInputs: withAnyInputs,
|
|
65
65
|
autoFocusMonthInput: withAnyInputs && autoFocus,
|
|
66
66
|
autoFocusPrevMonthArrow: isControllerOnly && autoFocus,
|
|
67
|
-
innerRefMonthInput: withAnyInputs
|
|
68
|
-
innerRefPrevMonthArrow: isControllerOnly
|
|
67
|
+
innerRefMonthInput: withAnyInputs ? innerRef : void 0,
|
|
68
|
+
innerRefPrevMonthArrow: isControllerOnly ? innerRef : void 0,
|
|
69
69
|
shouldPreserveClearableSpace,
|
|
70
70
|
withAnyRightController: withAnyPicker || withClearBtn || shouldPreserveClearableSpace,
|
|
71
71
|
...constants
|
|
@@ -105,8 +105,8 @@ const getDateFlags = (props) => {
|
|
|
105
105
|
isWithDateInputsOnly: withAnyInputs,
|
|
106
106
|
autoFocusMonthInput: withAnyInputs && autoFocus,
|
|
107
107
|
autoFocusPrevMonthArrow: isControllerOnly && autoFocus,
|
|
108
|
-
innerRefMonthInput: withAnyInputs
|
|
109
|
-
innerRefPrevMonthArrow: isControllerOnly
|
|
108
|
+
innerRefMonthInput: withAnyInputs ? innerRef : void 0,
|
|
109
|
+
innerRefPrevMonthArrow: isControllerOnly ? innerRef : void 0,
|
|
110
110
|
shouldPreserveClearableSpace,
|
|
111
111
|
withAnyRightController: withAnyPicker || withClearBtn || shouldPreserveClearableSpace,
|
|
112
112
|
...constants
|
|
@@ -148,8 +148,8 @@ const getTimeFlags = (props) => {
|
|
|
148
148
|
isWithTimeInputsOnly: withAnyInputs,
|
|
149
149
|
autoFocusHourInput: withAnyInputs && autoFocus,
|
|
150
150
|
autoFocusHourTimeWheel: isControllerOnly && autoFocus,
|
|
151
|
-
innerRefHourInput: withAnyInputs
|
|
152
|
-
innerRefHourTimeWheel: isControllerOnly
|
|
151
|
+
innerRefHourInput: withAnyInputs ? innerRef : void 0,
|
|
152
|
+
innerRefHourTimeWheel: isControllerOnly ? innerRef : void 0,
|
|
153
153
|
shouldPreserveClearableSpace,
|
|
154
154
|
withAnyRightController: withAnyPicker || withClearBtn || shouldPreserveClearableSpace,
|
|
155
155
|
...constants
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useGetFlags.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo } from 'react';\nimport { CONTROLLED_DATE_TIME_PICKER_TYPES } from '../ControlledDateTimePickerTypes';\nimport { getIsDateTime, getIsDate } from '../utils/typeGuards';\nimport type { DSControlledDateTimePickerT } from '../propTypes';\n\nconst getDateTimeFlags = (props: DSControlledDateTimePickerT.InternalDateTimePickerProps) => {\n const { type, isClearable, dateTime, autoFocus, innerRef } = props;\n const constants = {\n hideDatePicker: true,\n hideTimePicker: true,\n isDateSelector: false,\n isTimeSelector: false,\n isDateTimeSelector: true,\n isWithDateInputsOnly: false,\n isWithTimeInputsOnly: false,\n autoFocusHourInput: false,\n autoFocusHourTimeWheel: false,\n };\n const withAnyInputs =\n type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.FULL ||\n type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.INPUTS;\n const hideDateTimePicker =\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.FULL &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.PICKER &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.CONTROLLER_ONLY;\n const isControllerOnly = type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.CONTROLLER_ONLY;\n const withAnyPicker = !hideDateTimePicker;\n const withClearBtn = withAnyInputs && isClearable && dateTime !== '' && dateTime !== '__/__/____ __:__ __';\n const shouldPreserveClearableSpace = isClearable && withAnyInputs;\n const finalFlags = {\n hideDate: !withAnyInputs,\n hideTime: !withAnyInputs,\n hideDateTimePicker,\n isControllerOnly,\n isWithTimeWheelToo: !hideDateTimePicker,\n isWithCalendarToo: !hideDateTimePicker,\n withAnyInputs,\n withAnyPicker,\n withClearBtn,\n isWithDateInputs: withAnyInputs,\n isWithTimeInputs: withAnyInputs,\n autoFocusMonthInput: withAnyInputs && autoFocus,\n autoFocusPrevMonthArrow: isControllerOnly && autoFocus,\n innerRefMonthInput: withAnyInputs
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;AACxB,2CAAkD;AAClD,wBAAyC;AAGzC,MAAM,mBAAmB,CAAC,UAAmE;AAC3F,QAAM,EAAE,MAAM,aAAa,UAAU,WAAW,SAAS,IAAI;AAC7D,QAAM,YAAY;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,sBAAsB;AAAA,IACtB,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,wBAAwB;AAAA,EAC1B;AACA,QAAM,gBACJ,SAAS,uEAAkC,UAAU,QACrD,SAAS,uEAAkC,UAAU;AACvD,QAAM,qBACJ,SAAS,uEAAkC,UAAU,QACrD,SAAS,uEAAkC,UAAU,UACrD,SAAS,uEAAkC,UAAU;AACvD,QAAM,mBAAmB,SAAS,uEAAkC,UAAU;AAC9E,QAAM,gBAAgB,CAAC;AACvB,QAAM,eAAe,iBAAiB,eAAe,aAAa,MAAM,aAAa;AACrF,QAAM,+BAA+B,eAAe;AACpD,QAAM,aAAa;AAAA,IACjB,UAAU,CAAC;AAAA,IACX,UAAU,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA,oBAAoB,CAAC;AAAA,IACrB,mBAAmB,CAAC;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,qBAAqB,iBAAiB;AAAA,IACtC,yBAAyB,oBAAoB;AAAA,IAC7C,oBAAoB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo } from 'react';\nimport { CONTROLLED_DATE_TIME_PICKER_TYPES } from '../ControlledDateTimePickerTypes';\nimport { getIsDateTime, getIsDate } from '../utils/typeGuards';\nimport type { DSControlledDateTimePickerT } from '../propTypes';\n\nconst getDateTimeFlags = (props: DSControlledDateTimePickerT.InternalDateTimePickerProps) => {\n const { type, isClearable, dateTime, autoFocus, innerRef } = props;\n const constants = {\n hideDatePicker: true,\n hideTimePicker: true,\n isDateSelector: false,\n isTimeSelector: false,\n isDateTimeSelector: true,\n isWithDateInputsOnly: false,\n isWithTimeInputsOnly: false,\n autoFocusHourInput: false,\n autoFocusHourTimeWheel: false,\n };\n const withAnyInputs =\n type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.FULL ||\n type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.INPUTS;\n const hideDateTimePicker =\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.FULL &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.PICKER &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.CONTROLLER_ONLY;\n const isControllerOnly = type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.CONTROLLER_ONLY;\n const withAnyPicker = !hideDateTimePicker;\n const withClearBtn = withAnyInputs && isClearable && dateTime !== '' && dateTime !== '__/__/____ __:__ __';\n const shouldPreserveClearableSpace = isClearable && withAnyInputs;\n const finalFlags = {\n hideDate: !withAnyInputs,\n hideTime: !withAnyInputs,\n hideDateTimePicker,\n isControllerOnly,\n isWithTimeWheelToo: !hideDateTimePicker,\n isWithCalendarToo: !hideDateTimePicker,\n withAnyInputs,\n withAnyPicker,\n withClearBtn,\n isWithDateInputs: withAnyInputs,\n isWithTimeInputs: withAnyInputs,\n autoFocusMonthInput: withAnyInputs && autoFocus,\n autoFocusPrevMonthArrow: isControllerOnly && autoFocus,\n innerRefMonthInput: withAnyInputs ? innerRef : undefined,\n innerRefPrevMonthArrow: isControllerOnly ? innerRef : undefined,\n shouldPreserveClearableSpace,\n withAnyRightController: withAnyPicker || withClearBtn || shouldPreserveClearableSpace,\n ...constants,\n };\n return finalFlags;\n};\nconst getDateFlags = (props: DSControlledDateTimePickerT.InternalDatePickerProps) => {\n const { type, isClearable, date, autoFocus, innerRef } = props;\n\n const constants = {\n isDateSelector: true,\n hideTime: true,\n hideDateTimePicker: true,\n hideTimePicker: true,\n isTimeSelector: false,\n isDateTimeSelector: false,\n isWithCalendarToo: false,\n isWithTimeWheelToo: false,\n isWithTimeInputs: false,\n isWithTimeInputsOnly: false,\n autoFocusHourTimeWheel: false,\n autoFocusHourInput: false,\n };\n\n const withAnyInputs =\n type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.FULL || type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.INPUTS;\n const hideDatePicker =\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.FULL &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.PICKER &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.CONTROLLER_ONLY;\n const isControllerOnly = type === CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.CONTROLLER_ONLY;\n\n const withAnyPicker = !hideDatePicker;\n const withClearBtn = withAnyInputs && isClearable && date !== '' && date !== '__/__/____';\n const shouldPreserveClearableSpace = isClearable && withAnyInputs;\n\n const finalFlags = {\n hideDate: !withAnyInputs,\n hideDatePicker,\n isControllerOnly,\n withAnyInputs,\n withAnyPicker,\n withClearBtn,\n isWithDateInputs: withAnyInputs,\n isWithDateInputsOnly: withAnyInputs,\n autoFocusMonthInput: withAnyInputs && autoFocus,\n autoFocusPrevMonthArrow: isControllerOnly && autoFocus,\n innerRefMonthInput: withAnyInputs ? innerRef : undefined,\n innerRefPrevMonthArrow: isControllerOnly ? innerRef : undefined,\n shouldPreserveClearableSpace,\n withAnyRightController: withAnyPicker || withClearBtn || shouldPreserveClearableSpace,\n ...constants,\n };\n return finalFlags;\n};\nconst getTimeFlags = (props: DSControlledDateTimePickerT.InternalTimePickerProps) => {\n const { type, isClearable, time, autoFocus, innerRef } = props;\n const constants = {\n hideDate: true,\n hideDateTimePicker: true,\n hideDatePicker: true,\n isDateSelector: false,\n isDateTimeSelector: false,\n isWithDateInputs: false,\n isWithDateInputsOnly: false,\n isTimeSelector: true,\n isWithTimeWheelToo: false,\n isWithCalendarToo: false,\n autoFocusMonthInput: false,\n autoFocusPrevMonthArrow: false,\n innerRefMonthInput: undefined,\n innerRefPrevMonthArrow: undefined,\n };\n const withAnyInputs =\n type === CONTROLLED_DATE_TIME_PICKER_TYPES.TIME.FULL || type === CONTROLLED_DATE_TIME_PICKER_TYPES.TIME.INPUTS;\n const hideTimePicker =\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.TIME.FULL &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.TIME.PICKER &&\n type !== CONTROLLED_DATE_TIME_PICKER_TYPES.TIME.CONTROLLER_ONLY;\n const isControllerOnly = type === CONTROLLED_DATE_TIME_PICKER_TYPES.TIME.CONTROLLER_ONLY;\n const withClearBtn = withAnyInputs && isClearable && time !== '' && time !== '__:__ __';\n const shouldPreserveClearableSpace = isClearable && withAnyInputs;\n const withAnyPicker = !hideTimePicker;\n const finalFlags = {\n hideTime: !withAnyInputs,\n hideTimePicker,\n isControllerOnly,\n withAnyInputs,\n withAnyPicker,\n withClearBtn,\n isWithTimeInputs: withAnyInputs,\n isWithTimeInputsOnly: withAnyInputs,\n autoFocusHourInput: withAnyInputs && autoFocus,\n autoFocusHourTimeWheel: isControllerOnly && autoFocus,\n innerRefHourInput: withAnyInputs ? innerRef : undefined,\n innerRefHourTimeWheel: isControllerOnly ? innerRef : undefined,\n shouldPreserveClearableSpace,\n withAnyRightController: withAnyPicker || withClearBtn || shouldPreserveClearableSpace,\n ...constants,\n };\n return finalFlags;\n};\n\nexport const useGetFlags = (props: DSControlledDateTimePickerT.InternalProps) =>\n useMemo(() => {\n if (getIsDateTime(props)) {\n return getDateTimeFlags(props);\n }\n if (getIsDate(props)) {\n return getDateFlags(props);\n }\n return getTimeFlags(props);\n }, [props]);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;AACxB,2CAAkD;AAClD,wBAAyC;AAGzC,MAAM,mBAAmB,CAAC,UAAmE;AAC3F,QAAM,EAAE,MAAM,aAAa,UAAU,WAAW,SAAS,IAAI;AAC7D,QAAM,YAAY;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,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BAAmB,SAAS,uEAAkC,KAAK;AACzE,QAAM,eAAe,iBAAiB,eAAe,SAAS,MAAM,SAAS;AAC7E,QAAM,+BAA+B,eAAe;AACpD,QAAM,gBAAgB,CAAC;AACvB,QAAM,aAAa;AAAA,IACjB,UAAU,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB,sBAAsB;AAAA,IACtB,oBAAoB,iBAAiB;AAAA,IACrC,wBAAwB,oBAAoB;AAAA,IAC5C,mBAAmB,gBAAgB,WAAW;AAAA,IAC9C,uBAAuB,mBAAmB,WAAW;AAAA,IACrD;AAAA,IACA,wBAAwB,iBAAiB,gBAAgB;AAAA,IACzD,GAAG;AAAA,EACL;AACA,SAAO;AACT;AAEO,MAAM,cAAc,CAAC,cAC1B,sBAAQ,MAAM;AACZ,UAAI,iCAAc,KAAK,GAAG;AACxB,WAAO,iBAAiB,KAAK;AAAA,EAC/B;AACA,UAAI,6BAAU,KAAK,GAAG;AACpB,WAAO,aAAa,KAAK;AAAA,EAC3B;AACA,SAAO,aAAa,KAAK;AAC3B,GAAG,CAAC,KAAK,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -28,7 +28,7 @@ __export(useGetPropsWithDefault_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(useGetPropsWithDefault_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
31
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
32
32
|
var import_propTypes = require("../propTypes");
|
|
33
|
-
const useGetDatePickerWithDefaultsProps = (props) => (0,
|
|
33
|
+
const useGetDatePickerWithDefaultsProps = (props) => (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_propTypes.defaultProps);
|
|
34
34
|
//# sourceMappingURL=useGetPropsWithDefault.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useGetPropsWithDefault.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemoMergePropsWithDefault } from '@elliemae/ds-
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport type { DSControlledDateTimePickerT } from '../propTypes';\nimport { defaultProps } from '../propTypes';\n// we have to merge the \"default\" nested default values with what the user gives us...\nexport const useGetDatePickerWithDefaultsProps = (\n props: DSControlledDateTimePickerT.Props,\n): DSControlledDateTimePickerT.InternalProps =>\n useMemoMergePropsWithDefault<DSControlledDateTimePickerT.InternalProps>(props, defaultProps);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA6C;AAE7C,uBAA6B;AAEtB,MAAM,oCAAoC,CAC/C,cAEA,sDAAwE,OAAO,6BAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,10 +29,11 @@ __export(ClearButton_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(ClearButton_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var import_react = require("react");
|
|
32
|
+
var import_react = __toESM(require("react"));
|
|
33
33
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
34
34
|
var import_ds_icon = require("@elliemae/ds-icon");
|
|
35
35
|
var import_ds_button = require("@elliemae/ds-button");
|
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
37
|
var import_Styleds = require("../Styleds");
|
|
37
38
|
var import_ControlledDateTimePickerDatatestid = require("../../ControlledDateTimePickerDatatestid");
|
|
38
39
|
var import_ControlledDateTimePickerCTX = require("../../ControlledDateTimePickerCTX");
|
|
@@ -42,7 +43,11 @@ const ClearButton = () => {
|
|
|
42
43
|
const styledsAttrs = {
|
|
43
44
|
shouldDisplay: withClearBtn
|
|
44
45
|
};
|
|
45
|
-
const { latestInteractionRegion, currFocusDescriber } = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
46
|
+
const { latestInteractionRegion, currFocusDescriber, props } = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
47
|
+
const ariaAndDataProps = import_react.default.useMemo(
|
|
48
|
+
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CLEAR_BUTTON]),
|
|
49
|
+
[props]
|
|
50
|
+
);
|
|
46
51
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
52
|
import_Styleds.StyledClearButton,
|
|
48
53
|
{
|
|
@@ -59,6 +64,7 @@ const ClearButton = () => {
|
|
|
59
64
|
onKeyDown: onClearButtonKeyDown,
|
|
60
65
|
type: "button",
|
|
61
66
|
...styledsAttrs,
|
|
67
|
+
...ariaAndDataProps,
|
|
62
68
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.CloseMedium, { color: import_ds_icon.DSIconColors.PRIMARY })
|
|
63
69
|
}
|
|
64
70
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/ClearButton/ClearButton.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */\nimport React, { useContext } from 'react';\nimport { CloseMedium } from '@elliemae/ds-icons';\nimport { DSIconColors } from '@elliemae/ds-icon';\nimport { BUTTON_SIZES } from '@elliemae/ds-button';\nimport { StyledClearButton } from '../Styleds';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX';\nimport { useClearButton } from './useClearButton';\n\nexport const ClearButton = (): JSX.Element => {\n const { onClearClick, onClearButtonKeyDown, clearButtonRef, withClearBtn } = useClearButton();\n const styledsAttrs = {\n shouldDisplay: withClearBtn,\n };\n const { latestInteractionRegion, currFocusDescriber } = useContext(ControlledDateTimePickerContext);\n\n return (\n <StyledClearButton\n aria-label=\"clear selected date\"\n buttonType=\"icon\"\n size={BUTTON_SIZES.M}\n data-testid={ControlledDateTimePickerDatatestid.CLEAR_BUTTON}\n innerRef={(DomElem: HTMLButtonElement) => {\n clearButtonRef.current = DomElem;\n if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem?.focus?.();\n }}\n onClick={onClearClick}\n onKeyDown={onClearButtonKeyDown}\n type=\"button\"\n {...styledsAttrs}\n >\n <CloseMedium color={DSIconColors.PRIMARY} />\n </StyledClearButton>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */\nimport React, { useContext } from 'react';\nimport { CloseMedium } from '@elliemae/ds-icons';\nimport { DSIconColors } from '@elliemae/ds-icon';\nimport { BUTTON_SIZES } from '@elliemae/ds-button';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { StyledClearButton } from '../Styleds';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX';\nimport { useClearButton } from './useClearButton';\n\nexport const ClearButton = (): JSX.Element => {\n const { onClearClick, onClearButtonKeyDown, clearButtonRef, withClearBtn } = useClearButton();\n const styledsAttrs = {\n shouldDisplay: withClearBtn,\n };\n const { latestInteractionRegion, currFocusDescriber, props } = useContext(ControlledDateTimePickerContext);\n const ariaAndDataProps = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CLEAR_BUTTON]),\n [props],\n );\n\n return (\n <StyledClearButton\n aria-label=\"clear selected date\"\n buttonType=\"icon\"\n size={BUTTON_SIZES.M}\n data-testid={ControlledDateTimePickerDatatestid.CLEAR_BUTTON}\n innerRef={(DomElem: HTMLButtonElement) => {\n clearButtonRef.current = DomElem;\n if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem?.focus?.();\n }}\n onClick={onClearClick}\n onKeyDown={onClearButtonKeyDown}\n type=\"button\"\n {...styledsAttrs}\n {...ariaAndDataProps}\n >\n <CloseMedium color={DSIconColors.PRIMARY} />\n </StyledClearButton>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsCjB;AArCN,mBAAkC;AAClC,sBAA4B;AAC5B,qBAA6B;AAC7B,uBAA6B;AAC7B,8BAAsC;AACtC,qBAAkC;AAClC,gDAAmD;AACnD,yCAAgD;AAChD,4BAA+B;AAExB,MAAM,cAAc,MAAmB;AAC5C,QAAM,EAAE,cAAc,sBAAsB,gBAAgB,aAAa,QAAI,sCAAe;AAC5F,QAAM,eAAe;AAAA,IACnB,eAAe;AAAA,EACjB;AACA,QAAM,EAAE,yBAAyB,oBAAoB,MAAM,QAAI,yBAAW,kEAA+B;AACzG,QAAM,mBAAmB,aAAAA,QAAM;AAAA,IAC7B,UAAM,+CAAsB,MAAM,6EAAmC,aAAa;AAAA,IAClF,CAAC,KAAK;AAAA,EACR;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,cAAW;AAAA,MACX,YAAW;AAAA,MACX,MAAM,8BAAa;AAAA,MACnB,eAAa,6EAAmC;AAAA,MAChD,UAAU,CAAC,YAA+B;AACxC,uBAAe,UAAU;AACzB,YAAI,4BAA4B,eAAe,uBAAuB;AAAa,mBAAS,QAAQ;AAAA,MACtG;AAAA,MACA,SAAS;AAAA,MACT,WAAW;AAAA,MACX,MAAK;AAAA,MACJ,GAAG;AAAA,MACH,GAAG;AAAA,MAEJ,sDAAC,+BAAY,OAAO,4BAAa,SAAS;AAAA;AAAA,EAC5C;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -29,8 +29,9 @@ __export(ControlledDateTimePickerContent_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(ControlledDateTimePickerContent_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var import_react = require("react");
|
|
32
|
+
var import_react = __toESM(require("react"));
|
|
33
33
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
34
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
34
35
|
var import_ControlledDateTimePickerCTX = require("../ControlledDateTimePickerCTX");
|
|
35
36
|
var import_Styleds = require("./Styleds");
|
|
36
37
|
var import_DateInputs = require("./DateInputs/DateInputs");
|
|
@@ -40,6 +41,7 @@ var import_ClearButton = require("./ClearButton/ClearButton");
|
|
|
40
41
|
var import_ControlledDateTimePickerDatatestid = require("../ControlledDateTimePickerDatatestid");
|
|
41
42
|
const ControlledDateTimePickerContent = () => {
|
|
42
43
|
const {
|
|
44
|
+
props,
|
|
43
45
|
props: { hasError, disabled },
|
|
44
46
|
hideDate,
|
|
45
47
|
hideTime,
|
|
@@ -52,6 +54,10 @@ const ControlledDateTimePickerContent = () => {
|
|
|
52
54
|
onGlobalKeyDown,
|
|
53
55
|
trackFocusResetter
|
|
54
56
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
57
|
+
const ariaAndDataProps = import_react.default.useMemo(
|
|
58
|
+
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CONTAINER]),
|
|
59
|
+
[props]
|
|
60
|
+
);
|
|
55
61
|
const styledsAttrs = {
|
|
56
62
|
justPicker: hideDate && hideTime,
|
|
57
63
|
withAnyPicker,
|
|
@@ -81,6 +87,7 @@ const ControlledDateTimePickerContent = () => {
|
|
|
81
87
|
onBlur: trackFocusResetter,
|
|
82
88
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CONTAINER,
|
|
83
89
|
...styledsAttrs,
|
|
90
|
+
...ariaAndDataProps,
|
|
84
91
|
...globalAttrs,
|
|
85
92
|
...xstyledAttrs,
|
|
86
93
|
children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/ControlledDateTimePickerContent.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { ControlledDateTimePickerContext } from '../ControlledDateTimePickerCTX';\nimport { StyledInputsWrapperGrid } from './Styleds';\nimport { DateInputs } from './DateInputs/DateInputs';\nimport { TimeInputs } from './TimeInputs/TimeInputs';\nimport { PickersIcons } from './Pickers/PickersIcons';\nimport { ClearButton } from './ClearButton/ClearButton';\nimport { ControlledDateTimePickerDatatestid } from '../ControlledDateTimePickerDatatestid';\n\nexport const ControlledDateTimePickerContent = (): JSX.Element => {\n const {\n props: { hasError, disabled },\n hideDate,\n hideTime,\n withAnyPicker,\n withAnyRightController,\n shouldPreserveClearableSpace,\n isControllerOnly,\n globalAttrs,\n xstyledAttrs,\n onGlobalKeyDown,\n trackFocusResetter,\n } = useContext(ControlledDateTimePickerContext);\n\n const styledsAttrs = {\n justPicker: hideDate && hideTime,\n withAnyPicker,\n hasError,\n isControllerOnly,\n };\n\n const mainCols = [];\n if (!hideDate) mainCols.push('auto');\n if (!hideTime) mainCols.push('auto');\n if (withAnyRightController) mainCols.push('auto');\n\n const rightControlCols = [];\n if (shouldPreserveClearableSpace) rightControlCols.push('28px');\n if (withAnyPicker) rightControlCols.push('auto');\n\n return (\n <>\n {/* The <div> element is catching the component-wise global hotkeys, there is no valid aria role for this */}\n {/* eslint-disable-next-line max-len */}\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 <StyledInputsWrapperGrid\n cols={mainCols}\n gutter=\"xxs\"\n pr={!withAnyRightController ? '2px' : '0px'}\n onKeyDown={onGlobalKeyDown}\n disabled={disabled}\n onBlur={trackFocusResetter}\n data-testid={ControlledDateTimePickerDatatestid.CONTAINER}\n {...styledsAttrs}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n {hideDate ? null : <DateInputs />}\n {hideTime ? null : <TimeInputs />}\n {withAnyRightController ? (\n <Grid cols={rightControlCols}>\n {shouldPreserveClearableSpace ? <ClearButton /> : null}\n {withAnyPicker ? <PickersIcons /> : null}\n </Grid>\n ) : null}\n </StyledInputsWrapperGrid>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { ControlledDateTimePickerContext } from '../ControlledDateTimePickerCTX';\nimport { StyledInputsWrapperGrid } from './Styleds';\nimport { DateInputs } from './DateInputs/DateInputs';\nimport { TimeInputs } from './TimeInputs/TimeInputs';\nimport { PickersIcons } from './Pickers/PickersIcons';\nimport { ClearButton } from './ClearButton/ClearButton';\nimport { ControlledDateTimePickerDatatestid } from '../ControlledDateTimePickerDatatestid';\n\nexport const ControlledDateTimePickerContent = (): JSX.Element => {\n const {\n props,\n props: { hasError, disabled },\n hideDate,\n hideTime,\n withAnyPicker,\n withAnyRightController,\n shouldPreserveClearableSpace,\n isControllerOnly,\n globalAttrs,\n xstyledAttrs,\n onGlobalKeyDown,\n trackFocusResetter,\n } = useContext(ControlledDateTimePickerContext);\n const ariaAndDataProps = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.CONTAINER]),\n [props],\n );\n\n const styledsAttrs = {\n justPicker: hideDate && hideTime,\n withAnyPicker,\n hasError,\n isControllerOnly,\n };\n\n const mainCols = [];\n if (!hideDate) mainCols.push('auto');\n if (!hideTime) mainCols.push('auto');\n if (withAnyRightController) mainCols.push('auto');\n\n const rightControlCols = [];\n if (shouldPreserveClearableSpace) rightControlCols.push('28px');\n if (withAnyPicker) rightControlCols.push('auto');\n\n return (\n <>\n {/* The <div> element is catching the component-wise global hotkeys, there is no valid aria role for this */}\n {/* eslint-disable-next-line max-len */}\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 <StyledInputsWrapperGrid\n cols={mainCols}\n gutter=\"xxs\"\n pr={!withAnyRightController ? '2px' : '0px'}\n onKeyDown={onGlobalKeyDown}\n disabled={disabled}\n onBlur={trackFocusResetter}\n data-testid={ControlledDateTimePickerDatatestid.CONTAINER}\n {...styledsAttrs}\n {...ariaAndDataProps}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n {hideDate ? null : <DateInputs />}\n {hideTime ? null : <TimeInputs />}\n {withAnyRightController ? (\n <Grid cols={rightControlCols}>\n {shouldPreserveClearableSpace ? <ClearButton /> : null}\n {withAnyPicker ? <PickersIcons /> : null}\n </Grid>\n ) : null}\n </StyledInputsWrapperGrid>\n </>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiDnB;AAhDJ,mBAAkC;AAClC,qBAAqB;AACrB,8BAAsC;AACtC,yCAAgD;AAChD,qBAAwC;AACxC,wBAA2B;AAC3B,wBAA2B;AAC3B,0BAA6B;AAC7B,yBAA4B;AAC5B,gDAAmD;AAE5C,MAAM,kCAAkC,MAAmB;AAChE,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAU,SAAS;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,QAAM,mBAAmB,aAAAA,QAAM;AAAA,IAC7B,UAAM,+CAAsB,MAAM,6EAAmC,UAAU;AAAA,IAC/E,CAAC,KAAK;AAAA,EACR;AAEA,QAAM,eAAe;AAAA,IACnB,YAAY,YAAY;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW,CAAC;AAClB,MAAI,CAAC;AAAU,aAAS,KAAK,MAAM;AACnC,MAAI,CAAC;AAAU,aAAS,KAAK,MAAM;AACnC,MAAI;AAAwB,aAAS,KAAK,MAAM;AAEhD,QAAM,mBAAmB,CAAC;AAC1B,MAAI;AAA8B,qBAAiB,KAAK,MAAM;AAC9D,MAAI;AAAe,qBAAiB,KAAK,MAAM;AAE/C,SACE,2EAKE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,QAAO;AAAA,MACP,IAAI,CAAC,yBAAyB,QAAQ;AAAA,MACtC,WAAW;AAAA,MACX;AAAA,MACA,QAAQ;AAAA,MACR,eAAa,6EAAmC;AAAA,MAC/C,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA,mBAAW,OAAO,4CAAC,gCAAW;AAAA,QAC9B,WAAW,OAAO,4CAAC,gCAAW;AAAA,QAC9B,yBACC,6CAAC,uBAAK,MAAM,kBACT;AAAA,yCAA+B,4CAAC,kCAAY,IAAK;AAAA,UACjD,gBAAgB,4CAAC,oCAAa,IAAK;AAAA,WACtC,IACE;AAAA;AAAA;AAAA,EACN,GACF;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -50,7 +50,8 @@ const DDInput = import_react.default.memo(
|
|
|
50
50
|
contextRef,
|
|
51
51
|
placeholder,
|
|
52
52
|
ariaCurrentValueForInputs,
|
|
53
|
-
isFocused
|
|
53
|
+
isFocused,
|
|
54
|
+
ariaAndDataProps
|
|
54
55
|
}) => {
|
|
55
56
|
const validateOnChange = (0, import_react.useCallback)(
|
|
56
57
|
(e) => {
|
|
@@ -79,7 +80,8 @@ const DDInput = import_react.default.memo(
|
|
|
79
80
|
"aria-label": `day input field, ${ariaCurrentValueForInputs}`,
|
|
80
81
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY,
|
|
81
82
|
disabled,
|
|
82
|
-
"aria-disabled": disabled
|
|
83
|
+
"aria-disabled": disabled,
|
|
84
|
+
...ariaAndDataProps
|
|
83
85
|
}
|
|
84
86
|
);
|
|
85
87
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DateInputs/DDInput.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid';\nimport { Styled2DigitsInput } from '../Styleds';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidDay = (day: string) => {\n if (day === '') return false;\n const numberOnly = regExpNumbers.test(day);\n return day.length > 2 || day === '00' || !numberOnly || Number.parseInt(day, 10) > 31;\n};\n\ninterface DDInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n isFocused: boolean;\n}\nexport const DDInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n contextRef,\n placeholder,\n ariaCurrentValueForInputs,\n isFocused,\n }: DDInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidDay(e?.currentTarget?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n return (\n <Styled2DigitsInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n ref={(DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n placeholder={placeholder}\n aria-label={`day input field, ${ariaCurrentValueForInputs}`}\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY}\n disabled={disabled}\n aria-disabled={disabled}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid';\nimport { Styled2DigitsInput } from '../Styleds';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidDay = (day: string) => {\n if (day === '') return false;\n const numberOnly = regExpNumbers.test(day);\n return day.length > 2 || day === '00' || !numberOnly || Number.parseInt(day, 10) > 31;\n};\n\ninterface DDInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n isFocused: boolean;\n ariaAndDataProps?: AriaAndDataProps;\n}\nexport const DDInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n contextRef,\n placeholder,\n ariaCurrentValueForInputs,\n isFocused,\n ariaAndDataProps,\n }: DDInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidDay(e?.currentTarget?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n return (\n <Styled2DigitsInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n ref={(DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n placeholder={placeholder}\n aria-label={`day input field, ${ariaCurrentValueForInputs}`}\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY}\n disabled={disabled}\n aria-disabled={disabled}\n {...ariaAndDataProps}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkDjB;AAlDN,mBAAmC;AACnC,gDAAmD;AACnD,qBAAmC;AAGnC,MAAM,gBAAgB;AACtB,MAAM,eAAe,CAAC,QAAgB;AACpC,MAAI,QAAQ;AAAI,WAAO;AACvB,QAAM,aAAa,cAAc,KAAK,GAAG;AACzC,SAAO,IAAI,SAAS,KAAK,QAAQ,QAAQ,CAAC,cAAc,OAAO,SAAS,KAAK,EAAE,IAAI;AACrF;AAeO,MAAM,UAAU,aAAAA,QAAM;AAAA,EAC3B,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAmC;AACjC,UAAM,uBAAmB;AAAA,MACvB,CAAC,MAA2C;AAC1C,YAAI,aAAa,GAAG,eAAe,KAAK,GAAG;AACzC,YAAE,eAAe;AACjB;AAAA,QACF;AACA,iBAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,QAAQ;AAAA,IACX;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK,CAAC,YAA8B;AAClC,UAAC,WAAwD,UAAU;AACnE,cAAI;AAAW,qBAAS,QAAQ;AAAA,QAClC;AAAA,QACA;AAAA,QACA,cAAY,oBAAoB;AAAA,QAChC,eAAa,6EAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,iBAAe;AAAA,QACd,GAAG;AAAA;AAAA,IACN;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -29,8 +29,10 @@ __export(DateInputs_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(DateInputs_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var import_react = require("react");
|
|
32
|
+
var import_react = __toESM(require("react"));
|
|
33
33
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
34
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
35
|
+
var import_ControlledDateTimePickerDatatestid = require("../../ControlledDateTimePickerDatatestid");
|
|
34
36
|
var import_ControlledDateTimePickerCTX = require("../../ControlledDateTimePickerCTX");
|
|
35
37
|
var import_MMInput = require("./MMInput");
|
|
36
38
|
var import_DDInput = require("./DDInput");
|
|
@@ -65,8 +67,21 @@ const DateInputs = () => {
|
|
|
65
67
|
yearInputRef,
|
|
66
68
|
ariaCurrentValueForInputs,
|
|
67
69
|
latestInteractionRegion,
|
|
68
|
-
currFocusDescriber
|
|
70
|
+
currFocusDescriber,
|
|
71
|
+
props
|
|
69
72
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
73
|
+
const ariaAndDataPropsMonth = import_react.default.useMemo(
|
|
74
|
+
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH]),
|
|
75
|
+
[props]
|
|
76
|
+
);
|
|
77
|
+
const ariaAndDataPropsDay = import_react.default.useMemo(
|
|
78
|
+
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY]),
|
|
79
|
+
[props]
|
|
80
|
+
);
|
|
81
|
+
const ariaAndDataPropsYear = import_react.default.useMemo(
|
|
82
|
+
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR]),
|
|
83
|
+
[props]
|
|
84
|
+
);
|
|
70
85
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
71
86
|
import_ds_grid.Grid,
|
|
72
87
|
{
|
|
@@ -92,7 +107,8 @@ const DateInputs = () => {
|
|
|
92
107
|
placeholder: "MM",
|
|
93
108
|
ariaCurrentValueForInputs,
|
|
94
109
|
disabled,
|
|
95
|
-
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "month-input"
|
|
110
|
+
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "month-input",
|
|
111
|
+
ariaAndDataProps: ariaAndDataPropsMonth
|
|
96
112
|
}
|
|
97
113
|
) }),
|
|
98
114
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Styleds.StyledSeparator, { alignItems: "center", children: "/" }),
|
|
@@ -108,7 +124,8 @@ const DateInputs = () => {
|
|
|
108
124
|
placeholder: "DD",
|
|
109
125
|
ariaCurrentValueForInputs,
|
|
110
126
|
disabled,
|
|
111
|
-
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "day-input"
|
|
127
|
+
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "day-input",
|
|
128
|
+
ariaAndDataProps: ariaAndDataPropsDay
|
|
112
129
|
}
|
|
113
130
|
) }),
|
|
114
131
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Styleds.StyledSeparator, { alignItems: "center", children: "/" }),
|
|
@@ -124,7 +141,8 @@ const DateInputs = () => {
|
|
|
124
141
|
placeholder: "YYYY",
|
|
125
142
|
ariaCurrentValueForInputs,
|
|
126
143
|
disabled,
|
|
127
|
-
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "year-input"
|
|
144
|
+
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "year-input",
|
|
145
|
+
ariaAndDataProps: ariaAndDataPropsYear
|
|
128
146
|
}
|
|
129
147
|
) })
|
|
130
148
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DateInputs/DateInputs.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { getPropsPerDatatestid } from '@elliemae/ds-props-helpers';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX';\nimport { MMInput } from './MMInput';\nimport { DDInput } from './DDInput';\nimport { YYYYInput } from './YYYYInput';\nimport { StyledFocusWithIn, StyledSeparator } from '../Styleds';\nimport { useDateInputs } from './useDateInputs';\nimport { fixedValues } from '../config';\n\nexport const DateInputs = (): JSX.Element => {\n const {\n month,\n day,\n year,\n autoFocusMonthInput,\n innerRefMonthInput,\n onMonthChange,\n onDayChange,\n onYearChange,\n onMonthBlur,\n onDayBlur,\n onYearBlur,\n onMonthFocus,\n onDayFocus,\n onYearFocus,\n onMonthKeyDown,\n onDayKeyDown,\n onYearKeyDown,\n disabled,\n } = useDateInputs();\n // we do this here so MMInput,DDInput,YYYYInput can be pure component memoized via React.memo\n const {\n monthInputRef,\n dayInputRef,\n yearInputRef,\n ariaCurrentValueForInputs,\n latestInteractionRegion,\n currFocusDescriber,\n props,\n } = useContext(ControlledDateTimePickerContext);\n const ariaAndDataPropsMonth = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH]),\n [props],\n );\n const ariaAndDataPropsDay = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY]),\n [props],\n );\n const ariaAndDataPropsYear = React.useMemo(\n () => getPropsPerDatatestid(props[ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR]),\n [props],\n );\n\n return (\n <Grid\n cols={[\n fixedValues.smallInputWidth,\n fixedValues.separatorWidth,\n fixedValues.smallInputWidth,\n fixedValues.separatorWidth,\n fixedValues.largeInputWidth,\n ]}\n >\n <StyledFocusWithIn>\n <MMInput\n onChange={onMonthChange}\n onBlur={onMonthBlur}\n onFocus={onMonthFocus}\n onKeyDown={onMonthKeyDown}\n value={month}\n contextRef={monthInputRef}\n innerRef={innerRefMonthInput}\n autoFocusMonthInput={autoFocusMonthInput}\n placeholder=\"MM\"\n ariaCurrentValueForInputs={ariaCurrentValueForInputs}\n disabled={disabled}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'month-input'}\n ariaAndDataProps={ariaAndDataPropsMonth}\n />\n </StyledFocusWithIn>\n <StyledSeparator alignItems=\"center\">/</StyledSeparator>\n <StyledFocusWithIn>\n <DDInput\n onChange={onDayChange}\n onBlur={onDayBlur}\n onFocus={onDayFocus}\n onKeyDown={onDayKeyDown}\n value={day}\n contextRef={dayInputRef}\n placeholder=\"DD\"\n ariaCurrentValueForInputs={ariaCurrentValueForInputs}\n disabled={disabled}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'day-input'}\n ariaAndDataProps={ariaAndDataPropsDay}\n />\n </StyledFocusWithIn>\n <StyledSeparator alignItems=\"center\">/</StyledSeparator>\n <StyledFocusWithIn>\n <YYYYInput\n onChange={onYearChange}\n onBlur={onYearBlur}\n onFocus={onYearFocus}\n onKeyDown={onYearKeyDown}\n value={year}\n contextRef={yearInputRef}\n placeholder=\"YYYY\"\n ariaCurrentValueForInputs={ariaCurrentValueForInputs}\n disabled={disabled}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'year-input'}\n ariaAndDataProps={ariaAndDataPropsYear}\n />\n </StyledFocusWithIn>\n </Grid>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|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Q;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,YACX,OAAO;AAAA,YACP,YAAY;AAAA,YACZ,UAAU;AAAA,YACV;AAAA,YACA,aAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACA,WAAW,4BAA4B,iBAAiB,uBAAuB;AAAA,YAC/E,kBAAkB;AAAA;AAAA,QACpB,GACF;AAAA,QACA,4CAAC,kCAAgB,YAAW,UAAS,eAAC;AAAA,QACtC,4CAAC,oCACC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,YACX,OAAO;AAAA,YACP,YAAY;AAAA,YACZ,aAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACA,WAAW,4BAA4B,iBAAiB,uBAAuB;AAAA,YAC/E,kBAAkB;AAAA;AAAA,QACpB,GACF;AAAA,QACA,4CAAC,kCAAgB,YAAW,UAAS,eAAC;AAAA,QACtC,4CAAC,oCACC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,YACX,OAAO;AAAA,YACP,YAAY;AAAA,YACZ,aAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACA,WAAW,4BAA4B,iBAAiB,uBAAuB;AAAA,YAC/E,kBAAkB;AAAA;AAAA,QACpB,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -53,7 +53,8 @@ const MMInput = import_react.default.memo(
|
|
|
53
53
|
innerRef,
|
|
54
54
|
autoFocusMonthInput,
|
|
55
55
|
ariaCurrentValueForInputs,
|
|
56
|
-
isFocused
|
|
56
|
+
isFocused,
|
|
57
|
+
ariaAndDataProps
|
|
57
58
|
}) => {
|
|
58
59
|
const validateOnChange = (0, import_react.useCallback)(
|
|
59
60
|
(e) => {
|
|
@@ -93,7 +94,8 @@ const MMInput = import_react.default.memo(
|
|
|
93
94
|
"aria-label": `month input field, ${ariaCurrentValueForInputs}`,
|
|
94
95
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH,
|
|
95
96
|
disabled,
|
|
96
|
-
"aria-disabled": disabled
|
|
97
|
+
"aria-disabled": disabled,
|
|
98
|
+
...ariaAndDataProps
|
|
97
99
|
}
|
|
98
100
|
);
|
|
99
101
|
}
|