@elliemae/ds-form-date-time-picker 3.80.0-next.71 → 3.80.0-next.75
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/config/useControlledDateTimePicker.js +14 -1
- package/dist/cjs/config/useControlledDateTimePicker.js.map +2 -2
- package/dist/cjs/config/useGlobalKeyHandlers.js +9 -2
- package/dist/cjs/config/useGlobalKeyHandlers.js.map +2 -2
- package/dist/cjs/parts/ClearButton/ClearButton.js +3 -1
- package/dist/cjs/parts/ClearButton/ClearButton.js.map +2 -2
- package/dist/cjs/parts/ClearButton/useClearButton.js +4 -2
- package/dist/cjs/parts/ClearButton/useClearButton.js.map +2 -2
- package/dist/cjs/parts/ControlledDateTimePickerContent.js +20 -6
- package/dist/cjs/parts/ControlledDateTimePickerContent.js.map +2 -2
- 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 +7 -3
- package/dist/cjs/parts/DateInputs/DateInputs.js.map +2 -2
- 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 +2 -1
- package/dist/cjs/parts/DateInputs/useDateInputs.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js +6 -1
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/Day.js +4 -3
- package/dist/cjs/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/Styleds.js +2 -1
- package/dist/cjs/parts/Pickers/Calendar/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +6 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js +3 -2
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js +3 -1
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js +3 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/Styleds.js +2 -1
- package/dist/cjs/parts/Pickers/TimeWheel/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +6 -1
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +2 -2
- package/dist/cjs/parts/Styleds.js +3 -4
- package/dist/cjs/parts/Styleds.js.map +2 -2
- 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 +7 -6
- package/dist/cjs/parts/TimeInputs/TimeInputs.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/useTimeInputs.js +2 -1
- package/dist/cjs/parts/TimeInputs/useTimeInputs.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +4 -2
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/config/useControlledDateTimePicker.js +14 -1
- package/dist/esm/config/useControlledDateTimePicker.js.map +2 -2
- package/dist/esm/config/useGlobalKeyHandlers.js +9 -2
- package/dist/esm/config/useGlobalKeyHandlers.js.map +2 -2
- package/dist/esm/parts/ClearButton/ClearButton.js +3 -1
- package/dist/esm/parts/ClearButton/ClearButton.js.map +2 -2
- package/dist/esm/parts/ClearButton/useClearButton.js +4 -2
- package/dist/esm/parts/ClearButton/useClearButton.js.map +2 -2
- package/dist/esm/parts/ControlledDateTimePickerContent.js +20 -6
- package/dist/esm/parts/ControlledDateTimePickerContent.js.map +2 -2
- 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 +7 -3
- package/dist/esm/parts/DateInputs/DateInputs.js.map +2 -2
- 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 +2 -1
- package/dist/esm/parts/DateInputs/useDateInputs.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js +6 -1
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/Day.js +4 -3
- package/dist/esm/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/Styleds.js +3 -2
- package/dist/esm/parts/Pickers/Calendar/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +6 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js +3 -2
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js +3 -1
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js +3 -2
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/Styleds.js +3 -2
- package/dist/esm/parts/Pickers/TimeWheel/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +6 -1
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +2 -2
- package/dist/esm/parts/Styleds.js +4 -5
- package/dist/esm/parts/Styleds.js.map +2 -2
- 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 +7 -6
- package/dist/esm/parts/TimeInputs/TimeInputs.js.map +2 -2
- package/dist/esm/parts/TimeInputs/useTimeInputs.js +2 -1
- package/dist/esm/parts/TimeInputs/useTimeInputs.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +4 -2
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/types/config/useControlledDateTimePicker.d.ts +2 -0
- package/dist/types/config/useGlobalKeyHandlers.d.ts +3 -1
- package/dist/types/parts/DateInputs/DDInput.d.ts +2 -1
- package/dist/types/parts/DateInputs/MMInput.d.ts +2 -1
- package/dist/types/parts/DateInputs/YYYYInput.d.ts +2 -1
- package/dist/types/parts/Styleds.d.ts +8 -8
- 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/package.json +10 -10
|
@@ -48,6 +48,7 @@ var import_useValidateProps = require("./useValidateProps.js");
|
|
|
48
48
|
const useControlledDateTimePicker = (props) => {
|
|
49
49
|
(0, import_useValidateProps.useValidateProps)(props);
|
|
50
50
|
const instanceUid = (0, import_react.useMemo)(() => `ds-dtp-${(0, import_uid.uid)(6)}`, []);
|
|
51
|
+
const readOnlyHelperMsgId = `${instanceUid}-read-only-helper-msg`;
|
|
51
52
|
const propsWithDefaults = (0, import_useGetPropsWithDefault.useGetDatePickerWithDefaultsProps)(props);
|
|
52
53
|
const flags = (0, import_useGetFlags.useGetFlags)(propsWithDefaults);
|
|
53
54
|
const DOMRefs = (0, import_useGetReferences.useGetReferences)(flags);
|
|
@@ -62,7 +63,17 @@ const useControlledDateTimePicker = (props) => {
|
|
|
62
63
|
DOMRefs,
|
|
63
64
|
focusTrackers
|
|
64
65
|
});
|
|
65
|
-
const globalKeyHandlers = (0, import_useGlobalKeyHandlers.useGlobalKeyHandlers)({
|
|
66
|
+
const globalKeyHandlers = (0, import_useGlobalKeyHandlers.useGlobalKeyHandlers)({
|
|
67
|
+
changeHandlers,
|
|
68
|
+
propsBasedOnType,
|
|
69
|
+
DOMRefs,
|
|
70
|
+
flags,
|
|
71
|
+
focusTrackers,
|
|
72
|
+
// disabled, applyAriaDisabled and readOnly lock every global shortcut that changes the value
|
|
73
|
+
isInteractionLocked: Boolean(
|
|
74
|
+
propsWithDefaults.disabled || propsWithDefaults.applyAriaDisabled || propsWithDefaults.readOnly
|
|
75
|
+
)
|
|
76
|
+
});
|
|
66
77
|
const xstyledAttrs = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefaults);
|
|
67
78
|
const globalAttrs = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefaults);
|
|
68
79
|
const { announcedDateValues, announcedTimeValues } = destructuredValues;
|
|
@@ -75,6 +86,7 @@ const useControlledDateTimePicker = (props) => {
|
|
|
75
86
|
getProps,
|
|
76
87
|
ariaCurrentValueForInputs,
|
|
77
88
|
instanceUid,
|
|
89
|
+
readOnlyHelperMsgId,
|
|
78
90
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
79
91
|
xstyledAttrs,
|
|
80
92
|
globalAttrs,
|
|
@@ -92,6 +104,7 @@ const useControlledDateTimePicker = (props) => {
|
|
|
92
104
|
getProps,
|
|
93
105
|
ariaCurrentValueForInputs,
|
|
94
106
|
instanceUid,
|
|
107
|
+
readOnlyHelperMsgId,
|
|
95
108
|
xstyledAttrs,
|
|
96
109
|
globalAttrs,
|
|
97
110
|
focusTrackers,
|
|
@@ -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, { useCallback, useMemo } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { useGetDatePickerWithDefaultsProps } from './useGetPropsWithDefault.js';\nimport { useFocusTracker } from './useFocusTracker.js';\nimport { useGetFlags } from './useGetFlags.js';\nimport { useGetReferences } from './useGetReferences.js';\nimport { useRelevantValueFromProps } from './useRelevantValueFromProps.js';\nimport { useGetPropsBasedOnType } from './useGetPropsBasedOnType.js';\nimport { useGetDestructuredValues } from './useGetDestructuredValues.js';\nimport { useChangeHandlers } from './useChangeHandlers.js';\nimport { useGlobalKeyHandlers } from './useGlobalKeyHandlers.js';\nimport { useValidateProps } from './useValidateProps.js';\nimport type { DSControlledDateTimePickerT } from '../react-desc-prop-types.js';\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 getProps: () => DSControlledDateTimePickerT.InternalProps;\n ariaCurrentValueForInputs: string;\n globalAttrs: Record<string, unknown>;\n xstyledAttrs: Record<string, unknown>;\n instanceUid: string;\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 instanceUid = useMemo(() => `ds-dtp-${uid(6)}`, []);\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 });\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({
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA4C;AAC5C,8BAA2D;AAC3D,iBAAoB;AACpB,oCAAkD;AAClD,6BAAgC;AAChC,yBAA4B;AAC5B,8BAAiC;AACjC,uCAA0C;AAC1C,oCAAuC;AACvC,sCAAyC;AACzC,+BAAkC;AAClC,kCAAqC;AACrC,8BAAiC;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useMemo } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\nimport { uid } from 'uid';\nimport { useGetDatePickerWithDefaultsProps } from './useGetPropsWithDefault.js';\nimport { useFocusTracker } from './useFocusTracker.js';\nimport { useGetFlags } from './useGetFlags.js';\nimport { useGetReferences } from './useGetReferences.js';\nimport { useRelevantValueFromProps } from './useRelevantValueFromProps.js';\nimport { useGetPropsBasedOnType } from './useGetPropsBasedOnType.js';\nimport { useGetDestructuredValues } from './useGetDestructuredValues.js';\nimport { useChangeHandlers } from './useChangeHandlers.js';\nimport { useGlobalKeyHandlers } from './useGlobalKeyHandlers.js';\nimport { useValidateProps } from './useValidateProps.js';\nimport type { DSControlledDateTimePickerT } from '../react-desc-prop-types.js';\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 getProps: () => DSControlledDateTimePickerT.InternalProps;\n ariaCurrentValueForInputs: string;\n globalAttrs: Record<string, unknown>;\n xstyledAttrs: Record<string, unknown>;\n instanceUid: string;\n /** id of the hidden \"Read only\" helper rendered when readOnly; referenced via aria-describedby */\n readOnlyHelperMsgId: string;\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 instanceUid = useMemo(() => `ds-dtp-${uid(6)}`, []);\n const readOnlyHelperMsgId = `${instanceUid}-read-only-helper-msg`;\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 });\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({\n changeHandlers,\n propsBasedOnType,\n DOMRefs,\n flags,\n focusTrackers,\n // disabled, applyAriaDisabled and readOnly lock every global shortcut that changes the value\n isInteractionLocked: Boolean(\n propsWithDefaults.disabled || propsWithDefaults.applyAriaDisabled || propsWithDefaults.readOnly,\n ),\n });\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 getProps = useCallback(() => propsWithDefaults, [propsWithDefaults]);\n\n const ctx = React.useMemo(\n () => ({\n props: propsWithDefaults,\n getProps,\n ariaCurrentValueForInputs,\n instanceUid,\n readOnlyHelperMsgId,\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 getProps,\n ariaCurrentValueForInputs,\n instanceUid,\n readOnlyHelperMsgId,\n xstyledAttrs,\n globalAttrs,\n focusTrackers,\n flags,\n DOMRefs,\n relevantValues,\n propsBasedOnType,\n destructuredValues,\n changeHandlers,\n globalKeyHandlers,\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,mBAA4C;AAC5C,8BAA2D;AAC3D,iBAAoB;AACpB,oCAAkD;AAClD,6BAAgC;AAChC,yBAA4B;AAC5B,8BAAiC;AACjC,uCAA0C;AAC1C,oCAAuC;AACvC,sCAAyC;AACzC,+BAAkC;AAClC,kCAAqC;AACrC,8BAAiC;AAqB1B,MAAM,8BAA8B,CACzC,UACqC;AAErC,gDAAiB,KAAK;AAEtB,QAAM,kBAAc,sBAAQ,MAAM,cAAU,gBAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AACxD,QAAM,sBAAsB,GAAG,WAAW;AAC1C,QAAM,wBAAoB,iEAAkC,KAAK;AAEjE,QAAM,YAAQ,gCAAY,iBAAiB;AAC3C,QAAM,cAAU,0CAAiB,KAAK;AACtC,QAAM,oBAAgB,wCAAgB,EAAE,SAAS,MAAM,CAAC;AACxD,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;AAAA,IAC7C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,IAEA,qBAAqB;AAAA,MACnB,kBAAkB,YAAY,kBAAkB,qBAAqB,kBAAkB;AAAA,IACzF;AAAA,EACF,CAAC;AAKD,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,mBAAmB,KAAK,EAAE,GACnG,qBAAqB,OAAO,EAC9B,GAAG,mBAAmB,GAAG,mBAAmB,KAAK,EAAE;AAEnD,QAAM,eAAW,0BAAY,MAAM,mBAAmB,CAAC,iBAAiB,CAAC;AAEzE,QAAM,MAAM,aAAAA,QAAM;AAAA,IAChB,OAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;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,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -36,7 +36,13 @@ var import_react = require("react");
|
|
|
36
36
|
var import_dateHelpers = require("../utils/dateHelpers.js");
|
|
37
37
|
var import_timeHelpers = require("../utils/timeHelpers.js");
|
|
38
38
|
var import_stringHelpers = require("../utils/stringHelpers.js");
|
|
39
|
-
const useGlobalKeyHandlers = ({
|
|
39
|
+
const useGlobalKeyHandlers = ({
|
|
40
|
+
propsBasedOnType,
|
|
41
|
+
changeHandlers,
|
|
42
|
+
focusTrackers,
|
|
43
|
+
flags,
|
|
44
|
+
isInteractionLocked
|
|
45
|
+
}) => {
|
|
40
46
|
const {
|
|
41
47
|
getIsOutOfRangeDay,
|
|
42
48
|
getIsDisabledDay,
|
|
@@ -93,13 +99,14 @@ const useGlobalKeyHandlers = ({ propsBasedOnType, changeHandlers, focusTrackers,
|
|
|
93
99
|
);
|
|
94
100
|
const onGlobalKeyDown = (0, import_react.useCallback)(
|
|
95
101
|
(e) => {
|
|
102
|
+
if (isInteractionLocked) return;
|
|
96
103
|
const { key, ctrlKey, metaKey } = e;
|
|
97
104
|
if ((ctrlKey || metaKey) && key === ";") {
|
|
98
105
|
onFillWithCurrentDateKeys(e);
|
|
99
106
|
}
|
|
100
107
|
if ((ctrlKey || metaKey) && (key === "Delete" || key === "Backspace")) handleClearAll(e);
|
|
101
108
|
},
|
|
102
|
-
[handleClearAll, onFillWithCurrentDateKeys]
|
|
109
|
+
[isInteractionLocked, handleClearAll, onFillWithCurrentDateKeys]
|
|
103
110
|
);
|
|
104
111
|
return (0, import_react.useMemo)(
|
|
105
112
|
() => ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useGlobalKeyHandlers.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-nested-ternary */\n/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useCallback, useMemo } from 'react';\nimport type { useChangeHandlers } from './useChangeHandlers.js';\nimport type { useGetPropsBasedOnType } from './useGetPropsBasedOnType.js';\nimport type { useGetReferences } from './useGetReferences.js';\nimport type { useGetFlags } from './useGetFlags.js';\nimport type { useFocusTracker } from './useFocusTracker.js';\nimport { getValidationDateStringMetaInfo, getDateStringFromDay, getTimeStringFromDay } from '../utils/dateHelpers.js';\nimport { getValidationTimeStringMetaInfo } from '../utils/timeHelpers.js';\nimport { deconstructValuesFromDateString, deconstructValuesFromTimeString } from '../utils/stringHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../react-desc-prop-types.js';\n\ninterface Config {\n propsBasedOnType: ReturnType<typeof useGetPropsBasedOnType>;\n changeHandlers: ReturnType<typeof useChangeHandlers>;\n DOMRefs: ReturnType<typeof useGetReferences>;\n flags: ReturnType<typeof useGetFlags>;\n focusTrackers: ReturnType<typeof useFocusTracker>;\n}\n\nexport const useGlobalKeyHandlers = ({
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,mBAAqC;AAMrC,yBAA4F;AAC5F,yBAAgD;AAChD,2BAAiF;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-nested-ternary */\n/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useCallback, useMemo } from 'react';\nimport type { useChangeHandlers } from './useChangeHandlers.js';\nimport type { useGetPropsBasedOnType } from './useGetPropsBasedOnType.js';\nimport type { useGetReferences } from './useGetReferences.js';\nimport type { useGetFlags } from './useGetFlags.js';\nimport type { useFocusTracker } from './useFocusTracker.js';\nimport { getValidationDateStringMetaInfo, getDateStringFromDay, getTimeStringFromDay } from '../utils/dateHelpers.js';\nimport { getValidationTimeStringMetaInfo } from '../utils/timeHelpers.js';\nimport { deconstructValuesFromDateString, deconstructValuesFromTimeString } from '../utils/stringHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../react-desc-prop-types.js';\n\ninterface Config {\n /** disabled, applyAriaDisabled or readOnly: the global keys must not fill or clear the value (PUI-16695) */\n isInteractionLocked: boolean;\n propsBasedOnType: ReturnType<typeof useGetPropsBasedOnType>;\n changeHandlers: ReturnType<typeof useChangeHandlers>;\n DOMRefs: ReturnType<typeof useGetReferences>;\n flags: ReturnType<typeof useGetFlags>;\n focusTrackers: ReturnType<typeof useFocusTracker>;\n}\n\nexport const useGlobalKeyHandlers = ({\n propsBasedOnType,\n changeHandlers,\n focusTrackers,\n flags,\n isInteractionLocked,\n}: Config) => {\n const {\n getIsOutOfRangeDay,\n getIsDisabledDay,\n getIsDisabledTime,\n appOnMonthChange,\n appOnDayChange,\n appOnYearChange,\n appOnHourChange,\n appOnMinuteChange,\n appOnMeridiemChange,\n } = propsBasedOnType;\n const { handleChangeComposedDateTimeString, handleClearAll } = changeHandlers;\n const { trackFocusLastSegment, trackFocusClearBtn } = focusTrackers;\n const { withAnyPicker, shouldPreserveClearableSpace } = flags;\n\n const onFillWithCurrentDateKeys = useCallback(\n (\n e: React.KeyboardEvent<HTMLDivElement>,\n metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = { isAutomaticFillTrigger: true },\n ) => {\n const now = new Date();\n const nowDateString = getDateStringFromDay(now);\n const nowTimeString = getTimeStringFromDay(now);\n const finalMetaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo = {\n ...metaInfo,\n ...getValidationDateStringMetaInfo(nowDateString, getIsOutOfRangeDay, getIsDisabledDay),\n ...getValidationTimeStringMetaInfo(nowTimeString, getIsDisabledTime),\n newDateString: nowDateString,\n };\n const { month, day, year } = deconstructValuesFromDateString(nowDateString);\n appOnMonthChange(month, e, metaInfo);\n appOnDayChange(day, e, metaInfo);\n appOnYearChange(year, e, metaInfo);\n const { hours, minutes, meridiem } = deconstructValuesFromTimeString(nowTimeString);\n appOnHourChange(hours, e, metaInfo);\n appOnMinuteChange(minutes, e, metaInfo);\n appOnMeridiemChange(meridiem, e, metaInfo);\n handleChangeComposedDateTimeString(nowDateString, nowTimeString, finalMetaInfo);\n // trackFocusLastSegment is not enough here,\n // after this key combination the value may change from empty to non-empty\n // when non empty the last segment may become the clear-btn (clear btn only appears when non empty)\n // as such this must be micro-managed here\n if (shouldPreserveClearableSpace && !withAnyPicker) trackFocusClearBtn();\n else trackFocusLastSegment();\n },\n [\n appOnDayChange,\n appOnHourChange,\n appOnMeridiemChange,\n appOnMinuteChange,\n appOnMonthChange,\n appOnYearChange,\n getIsDisabledDay,\n getIsDisabledTime,\n getIsOutOfRangeDay,\n handleChangeComposedDateTimeString,\n shouldPreserveClearableSpace,\n trackFocusClearBtn,\n trackFocusLastSegment,\n withAnyPicker,\n ],\n );\n\n const onGlobalKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (isInteractionLocked) return;\n const { key, ctrlKey, metaKey } = e;\n if ((ctrlKey || metaKey) && key === ';') {\n onFillWithCurrentDateKeys(e);\n }\n if ((ctrlKey || metaKey) && (key === 'Delete' || key === 'Backspace')) handleClearAll(e);\n },\n [isInteractionLocked, handleClearAll, onFillWithCurrentDateKeys],\n );\n\n return useMemo(\n () => ({\n onFillWithCurrentDateKeys,\n onGlobalKeyDown,\n }),\n [onFillWithCurrentDateKeys, onGlobalKeyDown],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,mBAAqC;AAMrC,yBAA4F;AAC5F,yBAAgD;AAChD,2BAAiF;AAa1E,MAAM,uBAAuB,CAAC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAc;AACZ,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,EAAE,oCAAoC,eAAe,IAAI;AAC/D,QAAM,EAAE,uBAAuB,mBAAmB,IAAI;AACtD,QAAM,EAAE,eAAe,6BAA6B,IAAI;AAExD,QAAM,gCAA4B;AAAA,IAChC,CACE,GACA,WAA8E,EAAE,wBAAwB,KAAK,MAC1G;AACH,YAAM,MAAM,oBAAI,KAAK;AACrB,YAAM,oBAAgB,yCAAqB,GAAG;AAC9C,YAAM,oBAAgB,yCAAqB,GAAG;AAC9C,YAAM,gBAA0E;AAAA,QAC9E,GAAG;AAAA,QACH,OAAG,oDAAgC,eAAe,oBAAoB,gBAAgB;AAAA,QACtF,OAAG,oDAAgC,eAAe,iBAAiB;AAAA,QACnE,eAAe;AAAA,MACjB;AACA,YAAM,EAAE,OAAO,KAAK,KAAK,QAAI,sDAAgC,aAAa;AAC1E,uBAAiB,OAAO,GAAG,QAAQ;AACnC,qBAAe,KAAK,GAAG,QAAQ;AAC/B,sBAAgB,MAAM,GAAG,QAAQ;AACjC,YAAM,EAAE,OAAO,SAAS,SAAS,QAAI,sDAAgC,aAAa;AAClF,sBAAgB,OAAO,GAAG,QAAQ;AAClC,wBAAkB,SAAS,GAAG,QAAQ;AACtC,0BAAoB,UAAU,GAAG,QAAQ;AACzC,yCAAmC,eAAe,eAAe,aAAa;AAK9E,UAAI,gCAAgC,CAAC,cAAe,oBAAmB;AAAA,UAClE,uBAAsB;AAAA,IAC7B;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,IACF;AAAA,EACF;AAEA,QAAM,sBAAkB;AAAA,IACtB,CAAC,MAA2C;AAC1C,UAAI,oBAAqB;AACzB,YAAM,EAAE,KAAK,SAAS,QAAQ,IAAI;AAClC,WAAK,WAAW,YAAY,QAAQ,KAAK;AACvC,kCAA0B,CAAC;AAAA,MAC7B;AACA,WAAK,WAAW,aAAa,QAAQ,YAAY,QAAQ,aAAc,gBAAe,CAAC;AAAA,IACzF;AAAA,IACA,CAAC,qBAAqB,gBAAgB,yBAAyB;AAAA,EACjE;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,2BAA2B,eAAe;AAAA,EAC7C;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -49,7 +49,7 @@ const ClearButton = () => {
|
|
|
49
49
|
latestInteractionRegion,
|
|
50
50
|
currFocusDescriber,
|
|
51
51
|
getProps,
|
|
52
|
-
props: { tabIndex }
|
|
52
|
+
props: { tabIndex, disabled, applyAriaDisabled, readOnly }
|
|
53
53
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
54
54
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
55
|
import_Styleds.StyledClearButton,
|
|
@@ -63,6 +63,8 @@ const ClearButton = () => {
|
|
|
63
63
|
if (latestInteractionRegion === "clear-btn" && currFocusDescriber === "clear-btn") DomElem?.focus?.();
|
|
64
64
|
},
|
|
65
65
|
tabIndex,
|
|
66
|
+
disabled,
|
|
67
|
+
applyAriaDisabled: applyAriaDisabled || readOnly,
|
|
66
68
|
onClick: onClearClick,
|
|
67
69
|
onKeyDown: onClearButtonKeyDown,
|
|
68
70
|
type: "button",
|
|
@@ -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 { BUTTON_SIZES } from '@elliemae/ds-button-v2';\nimport { CloseMedium } from '@elliemae/ds-icons';\nimport { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';\nimport { StyledClearButton } from '../Styleds.js';\nimport { useClearButton } from './useClearButton.js';\n\nexport const ClearButton = (): JSX.Element => {\n const { onClearClick, onClearButtonKeyDown, clearButtonRef, withClearBtn } = useClearButton();\n const styledsAttrs = {\n shouldDisplay: withClearBtn,\n };\n const {\n latestInteractionRegion,\n currFocusDescriber,\n getProps,\n props: { tabIndex },\n } = 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 tabIndex={tabIndex}\n onClick={onClearClick}\n onKeyDown={onClearButtonKeyDown}\n type=\"button\"\n getOwnerProps={getProps}\n {...styledsAttrs}\n >\n <CloseMedium color={['brand-primary', '600']} />\n </StyledClearButton>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */\nimport { BUTTON_SIZES } from '@elliemae/ds-button-v2';\nimport { CloseMedium } from '@elliemae/ds-icons';\nimport { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';\nimport { StyledClearButton } from '../Styleds.js';\nimport { useClearButton } from './useClearButton.js';\n\nexport const ClearButton = (): JSX.Element => {\n const { onClearClick, onClearButtonKeyDown, clearButtonRef, withClearBtn } = useClearButton();\n const styledsAttrs = {\n shouldDisplay: withClearBtn,\n };\n const {\n latestInteractionRegion,\n currFocusDescriber,\n getProps,\n props: { tabIndex, disabled, applyAriaDisabled, readOnly },\n } = 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 tabIndex={tabIndex}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled || readOnly}\n onClick={onClearClick}\n onKeyDown={onClearButtonKeyDown}\n type=\"button\"\n getOwnerProps={getProps}\n {...styledsAttrs}\n >\n <CloseMedium color={['brand-primary', '600']} />\n </StyledClearButton>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwCjB;AAvCN,0BAA6B;AAC7B,sBAA4B;AAC5B,mBAA2B;AAC3B,uBAAmD;AACnD,yCAAgD;AAChD,qBAAkC;AAClC,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;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,UAAU,UAAU,mBAAmB,SAAS;AAAA,EAC3D,QAAI,yBAAW,kEAA+B;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,cAAW;AAAA,MACX,YAAW;AAAA,MACX,MAAM,iCAAa;AAAA,MACnB,eAAa,oDAAmC;AAAA,MAChD,UAAU,CAAC,YAA+B;AACxC,uBAAe,UAAU;AACzB,YAAI,4BAA4B,eAAe,uBAAuB,YAAa,UAAS,QAAQ;AAAA,MACtG;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAmB,qBAAqB;AAAA,MACxC,SAAS;AAAA,MACT,WAAW;AAAA,MACX,MAAK;AAAA,MACL,eAAe;AAAA,MACd,GAAG;AAAA,MAEJ,sDAAC,+BAAY,OAAO,CAAC,iBAAiB,KAAK,GAAG;AAAA;AAAA,EAChD;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -46,14 +46,16 @@ const useClearButton = () => {
|
|
|
46
46
|
trackFocusFirstSegment,
|
|
47
47
|
trackFocusMeridiemInput,
|
|
48
48
|
trackFocusYearInput,
|
|
49
|
-
trackFocusPicker
|
|
49
|
+
trackFocusPicker,
|
|
50
|
+
props: { disabled, applyAriaDisabled, readOnly }
|
|
50
51
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
51
52
|
const onClearClick = (0, import_react.useCallback)(
|
|
52
53
|
(e) => {
|
|
54
|
+
if (disabled || applyAriaDisabled || readOnly) return;
|
|
53
55
|
handleClearAll(e);
|
|
54
56
|
trackFocusFirstSegment();
|
|
55
57
|
},
|
|
56
|
-
[handleClearAll, trackFocusFirstSegment]
|
|
58
|
+
[disabled, applyAriaDisabled, readOnly, handleClearAll, trackFocusFirstSegment]
|
|
57
59
|
);
|
|
58
60
|
const onHomeKeyDown = (0, import_react.useCallback)(() => {
|
|
59
61
|
trackFocusFirstSegment();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/ClearButton/useClearButton.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useCallback, useMemo, useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\n\ninterface UseOnClearClickR {\n onClearClick: DSControlledDateTimePickerInternalsT.OnDSBtnClick;\n onClearButtonKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown<HTMLButtonElement>;\n clearButtonRef: React.MutableRefObject<HTMLButtonElement | null>;\n withAnyPicker: boolean;\n withClearBtn: boolean;\n}\nexport const useClearButton = (): UseOnClearClickR => {\n const {\n handleClearAll,\n clearButtonRef,\n withAnyPicker,\n withClearBtn,\n withAnyInputs,\n isWithTimeInputs,\n isWithDateInputs,\n trackFocusFirstSegment,\n trackFocusMeridiemInput,\n trackFocusYearInput,\n trackFocusPicker,\n } = useContext(ControlledDateTimePickerContext);\n\n const onClearClick: DSControlledDateTimePickerInternalsT.OnDSBtnClick = useCallback(\n (e) => {\n handleClearAll(e);\n trackFocusFirstSegment();\n },\n [handleClearAll, trackFocusFirstSegment],\n );\n const onHomeKeyDown = useCallback(() => {\n trackFocusFirstSegment();\n }, [trackFocusFirstSegment]);\n const onEndKeyDown = useCallback(() => {\n if (withAnyPicker) trackFocusPicker();\n }, [withAnyPicker, trackFocusPicker]);\n\n const onClearButtonKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown<HTMLButtonElement> = useCallback(\n (e) => {\n const { key } = e;\n const preventDefaultKeys = ['Home', 'End'];\n const stopPropagationKeys = ['Home', 'End'];\n if (preventDefaultKeys.includes(key)) e.preventDefault();\n if (stopPropagationKeys.includes(key)) e.stopPropagation();\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n if (key === 'Backspace' && withAnyInputs) {\n if (isWithTimeInputs) trackFocusMeridiemInput();\n else if (isWithDateInputs) trackFocusYearInput();\n }\n },\n [\n isWithDateInputs,\n isWithTimeInputs,\n onEndKeyDown,\n onHomeKeyDown,\n trackFocusMeridiemInput,\n trackFocusYearInput,\n withAnyInputs,\n ],\n );\n\n return useMemo(\n () => ({ onClearClick, onClearButtonKeyDown, clearButtonRef, withAnyPicker, withClearBtn }),\n [onClearClick, onClearButtonKeyDown, clearButtonRef, withAnyPicker, withClearBtn],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAiD;AACjD,yCAAgD;AAUzC,MAAM,iBAAiB,MAAwB;AACpD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-statements */\n/* eslint-disable max-lines */\nimport { useCallback, useMemo, useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\n\ninterface UseOnClearClickR {\n onClearClick: DSControlledDateTimePickerInternalsT.OnDSBtnClick;\n onClearButtonKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown<HTMLButtonElement>;\n clearButtonRef: React.MutableRefObject<HTMLButtonElement | null>;\n withAnyPicker: boolean;\n withClearBtn: boolean;\n}\nexport const useClearButton = (): UseOnClearClickR => {\n const {\n handleClearAll,\n clearButtonRef,\n withAnyPicker,\n withClearBtn,\n withAnyInputs,\n isWithTimeInputs,\n isWithDateInputs,\n trackFocusFirstSegment,\n trackFocusMeridiemInput,\n trackFocusYearInput,\n trackFocusPicker,\n props: { disabled, applyAriaDisabled, readOnly },\n } = useContext(ControlledDateTimePickerContext);\n\n // PUI-16695: clearing is an action, so every lock blocks it (the button keeps focus under applyAriaDisabled/readOnly)\n const onClearClick: DSControlledDateTimePickerInternalsT.OnDSBtnClick = useCallback(\n (e) => {\n if (disabled || applyAriaDisabled || readOnly) return;\n handleClearAll(e);\n trackFocusFirstSegment();\n },\n [disabled, applyAriaDisabled, readOnly, handleClearAll, trackFocusFirstSegment],\n );\n const onHomeKeyDown = useCallback(() => {\n trackFocusFirstSegment();\n }, [trackFocusFirstSegment]);\n const onEndKeyDown = useCallback(() => {\n if (withAnyPicker) trackFocusPicker();\n }, [withAnyPicker, trackFocusPicker]);\n\n const onClearButtonKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown<HTMLButtonElement> = useCallback(\n (e) => {\n const { key } = e;\n const preventDefaultKeys = ['Home', 'End'];\n const stopPropagationKeys = ['Home', 'End'];\n if (preventDefaultKeys.includes(key)) e.preventDefault();\n if (stopPropagationKeys.includes(key)) e.stopPropagation();\n if (key === 'Home') onHomeKeyDown();\n if (key === 'End') onEndKeyDown();\n if (key === 'Backspace' && withAnyInputs) {\n if (isWithTimeInputs) trackFocusMeridiemInput();\n else if (isWithDateInputs) trackFocusYearInput();\n }\n },\n [\n isWithDateInputs,\n isWithTimeInputs,\n onEndKeyDown,\n onHomeKeyDown,\n trackFocusMeridiemInput,\n trackFocusYearInput,\n withAnyInputs,\n ],\n );\n\n return useMemo(\n () => ({ onClearClick, onClearButtonKeyDown, clearButtonRef, withAnyPicker, withClearBtn }),\n [onClearClick, onClearButtonKeyDown, clearButtonRef, withAnyPicker, withClearBtn],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAiD;AACjD,yCAAgD;AAUzC,MAAM,iBAAiB,MAAwB;AACpD,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,OAAO,EAAE,UAAU,mBAAmB,SAAS;AAAA,EACjD,QAAI,yBAAW,kEAA+B;AAG9C,QAAM,mBAAkE;AAAA,IACtE,CAAC,MAAM;AACL,UAAI,YAAY,qBAAqB,SAAU;AAC/C,qBAAe,CAAC;AAChB,6BAAuB;AAAA,IACzB;AAAA,IACA,CAAC,UAAU,mBAAmB,UAAU,gBAAgB,sBAAsB;AAAA,EAChF;AACA,QAAM,oBAAgB,0BAAY,MAAM;AACtC,2BAAuB;AAAA,EACzB,GAAG,CAAC,sBAAsB,CAAC;AAC3B,QAAM,mBAAe,0BAAY,MAAM;AACrC,QAAI,cAAe,kBAAiB;AAAA,EACtC,GAAG,CAAC,eAAe,gBAAgB,CAAC;AAEpC,QAAM,2BAA0F;AAAA,IAC9F,CAAC,MAAM;AACL,YAAM,EAAE,IAAI,IAAI;AAChB,YAAM,qBAAqB,CAAC,QAAQ,KAAK;AACzC,YAAM,sBAAsB,CAAC,QAAQ,KAAK;AAC1C,UAAI,mBAAmB,SAAS,GAAG,EAAG,GAAE,eAAe;AACvD,UAAI,oBAAoB,SAAS,GAAG,EAAG,GAAE,gBAAgB;AACzD,UAAI,QAAQ,OAAQ,eAAc;AAClC,UAAI,QAAQ,MAAO,cAAa;AAChC,UAAI,QAAQ,eAAe,eAAe;AACxC,YAAI,iBAAkB,yBAAwB;AAAA,iBACrC,iBAAkB,qBAAoB;AAAA,MACjD;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,aAAO;AAAA,IACL,OAAO,EAAE,cAAc,sBAAsB,gBAAgB,eAAe,aAAa;AAAA,IACzF,CAAC,cAAc,sBAAsB,gBAAgB,eAAe,YAAY;AAAA,EAClF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(ControlledDateTimePickerContent_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
38
|
var import_react = require("react");
|
|
38
39
|
var import_constants = require("../constants/index.js");
|
|
39
40
|
var import_ControlledDateTimePickerCTX = require("../ControlledDateTimePickerCTX.js");
|
|
@@ -55,7 +56,8 @@ const ControlledDateTimePickerContent = () => {
|
|
|
55
56
|
globalAttrs,
|
|
56
57
|
xstyledAttrs,
|
|
57
58
|
onGlobalKeyDown,
|
|
58
|
-
handleComponentBlurs
|
|
59
|
+
handleComponentBlurs,
|
|
60
|
+
readOnlyHelperMsgId
|
|
59
61
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
60
62
|
const styledsAttrs = {
|
|
61
63
|
justPicker: hideDate && hideTime,
|
|
@@ -71,22 +73,33 @@ const ControlledDateTimePickerContent = () => {
|
|
|
71
73
|
if (shouldPreserveClearableSpace) rightControlCols.push("28px");
|
|
72
74
|
if (withAnyPicker) rightControlCols.push("auto");
|
|
73
75
|
const onlyPicker = hideDate && hideTime;
|
|
74
|
-
const { tabIndex, autoFocus, ...
|
|
76
|
+
const { tabIndex, autoFocus, ...globalAttrsWithoutFocusWithLock } = globalAttrs;
|
|
77
|
+
const globalAttrsWithoutFocus = (0, import_ds_props_helpers.omitLockAttributes)(globalAttrsWithoutFocusWithLock);
|
|
78
|
+
const locked = (0, import_ds_props_helpers.isLocked)({ disabled, applyAriaDisabled, readOnly });
|
|
79
|
+
const { onKeyDown: rawConsumerOnKeyDown, ...globalAttrsWithoutKeyDown } = (0, import_ds_props_helpers.omitLockedHandlers)(
|
|
80
|
+
globalAttrsWithoutFocus,
|
|
81
|
+
locked
|
|
82
|
+
);
|
|
83
|
+
const consumerOnKeyDown = rawConsumerOnKeyDown;
|
|
84
|
+
const handleKeyDown = (e) => {
|
|
85
|
+
consumerOnKeyDown?.(e);
|
|
86
|
+
onGlobalKeyDown(e);
|
|
87
|
+
};
|
|
75
88
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
76
89
|
import_Styleds.StyledInputsWrapperGrid,
|
|
77
90
|
{
|
|
78
91
|
cols: mainCols,
|
|
79
92
|
gutter: "xxs",
|
|
80
93
|
pr: !withAnyRightController ? "2px" : "0px",
|
|
81
|
-
onKeyDown:
|
|
82
|
-
disabled,
|
|
94
|
+
onKeyDown: handleKeyDown,
|
|
95
|
+
$disabled: disabled,
|
|
83
96
|
onBlur: handleComponentBlurs,
|
|
84
97
|
"data-testid": import_constants.ControlledDateTimePickerDatatestid.CONTAINER,
|
|
85
98
|
getOwnerProps: getProps,
|
|
86
99
|
onlyPicker,
|
|
87
100
|
$readOnlyStyles: readOnly || applyAriaDisabled,
|
|
88
101
|
...styledsAttrs,
|
|
89
|
-
...
|
|
102
|
+
...globalAttrsWithoutKeyDown,
|
|
90
103
|
...xstyledAttrs,
|
|
91
104
|
children: [
|
|
92
105
|
hideDate ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DateInputs.DateInputs, {}),
|
|
@@ -94,7 +107,8 @@ const ControlledDateTimePickerContent = () => {
|
|
|
94
107
|
withAnyRightController ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.Grid, { cols: rightControlCols, children: [
|
|
95
108
|
shouldPreserveClearableSpace ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ClearButton.ClearButton, {}) : null,
|
|
96
109
|
withAnyPicker ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_PickersIcons.PickersIcons, {}) : null
|
|
97
|
-
] }) : null
|
|
110
|
+
] }) : null,
|
|
111
|
+
readOnly ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { hidden: true, id: readOnlyHelperMsgId, children: "Read only" }) : null
|
|
98
112
|
]
|
|
99
113
|
}
|
|
100
114
|
) });
|
|
@@ -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 { Grid } from '@elliemae/ds-grid';\nimport { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../constants/index.js';\nimport { ControlledDateTimePickerContext } from '../ControlledDateTimePickerCTX.js';\nimport { ClearButton } from './ClearButton/ClearButton.js';\nimport { DateInputs } from './DateInputs/DateInputs.js';\nimport { PickersIcons } from './Pickers/PickersIcons.js';\nimport { StyledInputsWrapperGrid } from './Styleds.js';\nimport { TimeInputs } from './TimeInputs/TimeInputs.js';\n\nexport const ControlledDateTimePickerContent = (): JSX.Element => {\n const {\n props: { hasError, disabled, readOnly, applyAriaDisabled },\n getProps,\n hideDate,\n hideTime,\n withAnyPicker,\n withAnyRightController,\n shouldPreserveClearableSpace,\n isControllerOnly,\n globalAttrs,\n xstyledAttrs,\n onGlobalKeyDown,\n handleComponentBlurs,\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 const onlyPicker = hideDate && hideTime;\n\n const { tabIndex, autoFocus, ...
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport { Grid } from '@elliemae/ds-grid';\nimport { isLocked, omitLockAttributes, omitLockedHandlers } from '@elliemae/ds-props-helpers';\nimport { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../constants/index.js';\nimport { ControlledDateTimePickerContext } from '../ControlledDateTimePickerCTX.js';\nimport { ClearButton } from './ClearButton/ClearButton.js';\nimport { DateInputs } from './DateInputs/DateInputs.js';\nimport { PickersIcons } from './Pickers/PickersIcons.js';\nimport { StyledInputsWrapperGrid } from './Styleds.js';\nimport { TimeInputs } from './TimeInputs/TimeInputs.js';\n\nexport const ControlledDateTimePickerContent = (): JSX.Element => {\n const {\n props: { hasError, disabled, readOnly, applyAriaDisabled },\n getProps,\n hideDate,\n hideTime,\n withAnyPicker,\n withAnyRightController,\n shouldPreserveClearableSpace,\n isControllerOnly,\n globalAttrs,\n xstyledAttrs,\n onGlobalKeyDown,\n handleComponentBlurs,\n readOnlyHelperMsgId,\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 const onlyPicker = hideDate && hideTime;\n\n // disabled and readOnly are global attributes too: the root is a div, so they are not spread onto it\n const { tabIndex, autoFocus, ...globalAttrsWithoutFocusWithLock } = globalAttrs;\n const globalAttrsWithoutFocus = omitLockAttributes(globalAttrsWithoutFocusWithLock);\n // the consumer's action handlers (click, paste, drop...) are dropped from the spread while locked (PUI-16695).\n const locked = isLocked({ disabled, applyAriaDisabled, readOnly });\n const { onKeyDown: rawConsumerOnKeyDown, ...globalAttrsWithoutKeyDown } = omitLockedHandlers(\n globalAttrsWithoutFocus,\n locked,\n );\n const consumerOnKeyDown = rawConsumerOnKeyDown as React.KeyboardEventHandler<HTMLElement> | undefined;\n // the consumer's onKeyDown runs first and the component's own hotkeys (fill with now, clear) run after it:\n // passing a handler must not silently disable the shortcuts. The inputs already preventDefault on the hotkeys\n // before the event reaches this container, so defaultPrevented cannot be used as an opt-out here.\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n consumerOnKeyDown?.(e);\n onGlobalKeyDown(e);\n };\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={handleKeyDown}\n $disabled={disabled}\n onBlur={handleComponentBlurs}\n data-testid={ControlledDateTimePickerDatatestid.CONTAINER}\n getOwnerProps={getProps}\n onlyPicker={onlyPicker}\n $readOnlyStyles={readOnly || applyAriaDisabled}\n {...styledsAttrs}\n {...globalAttrsWithoutKeyDown}\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 {/* hidden: takes no grid track; referenced by aria-describedby of readOnly inputs and wheel items */}\n {readOnly ? (\n <p hidden id={readOnlyHelperMsgId}>\n Read only\n </p>\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;ADkEnB;AAjEJ,qBAAqB;AACrB,8BAAiE;AACjE,mBAA2B;AAC3B,uBAAmD;AACnD,yCAAgD;AAChD,yBAA4B;AAC5B,wBAA2B;AAC3B,0BAA6B;AAC7B,qBAAwC;AACxC,wBAA2B;AAEpB,MAAM,kCAAkC,MAAmB;AAChE,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,UAAU,UAAU,kBAAkB;AAAA,IACzD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAE9C,QAAM,eAAe;AAAA,IACnB,YAAY,YAAY;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,WAAW,CAAC;AAClB,MAAI,CAAC,SAAU,UAAS,KAAK,MAAM;AACnC,MAAI,CAAC,SAAU,UAAS,KAAK,MAAM;AACnC,MAAI,uBAAwB,UAAS,KAAK,MAAM;AAEhD,QAAM,mBAAmB,CAAC;AAC1B,MAAI,6BAA8B,kBAAiB,KAAK,MAAM;AAC9D,MAAI,cAAe,kBAAiB,KAAK,MAAM;AAE/C,QAAM,aAAa,YAAY;AAG/B,QAAM,EAAE,UAAU,WAAW,GAAG,gCAAgC,IAAI;AACpE,QAAM,8BAA0B,4CAAmB,+BAA+B;AAElF,QAAM,aAAS,kCAAS,EAAE,UAAU,mBAAmB,SAAS,CAAC;AACjE,QAAM,EAAE,WAAW,sBAAsB,GAAG,0BAA0B,QAAI;AAAA,IACxE;AAAA,IACA;AAAA,EACF;AACA,QAAM,oBAAoB;AAI1B,QAAM,gBAAgB,CAAC,MAA2C;AAChE,wBAAoB,CAAC;AACrB,oBAAgB,CAAC;AAAA,EACnB;AAEA,SACE,2EAKE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,QAAO;AAAA,MACP,IAAI,CAAC,yBAAyB,QAAQ;AAAA,MACtC,WAAW;AAAA,MACX,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,eAAa,oDAAmC;AAAA,MAChD,eAAe;AAAA,MACf;AAAA,MACA,iBAAiB,YAAY;AAAA,MAC5B,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,QAEH,WACC,4CAAC,OAAE,QAAM,MAAC,IAAI,qBAAqB,uBAEnC,IACE;AAAA;AAAA;AAAA,EACN,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -59,7 +59,8 @@ const DDInput = import_react.default.memo(
|
|
|
59
59
|
placeholder,
|
|
60
60
|
isFocused,
|
|
61
61
|
getProps,
|
|
62
|
-
readOnly
|
|
62
|
+
readOnly,
|
|
63
|
+
readOnlyHelperMsgId
|
|
63
64
|
}) => {
|
|
64
65
|
const validateOnChange = (0, import_react.useCallback)(
|
|
65
66
|
(e) => {
|
|
@@ -89,7 +90,8 @@ const DDInput = import_react.default.memo(
|
|
|
89
90
|
"aria-label": "day",
|
|
90
91
|
"data-testid": import_constants.ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY,
|
|
91
92
|
disabled,
|
|
92
|
-
"aria-disabled": applyAriaDisabled,
|
|
93
|
+
"aria-disabled": !disabled && (applyAriaDisabled || readOnly) ? true : void 0,
|
|
94
|
+
"aria-describedby": readOnly ? readOnlyHelperMsgId : void 0,
|
|
93
95
|
"aria-invalid": hasError,
|
|
94
96
|
getOwnerProps: getProps,
|
|
95
97
|
readOnly,
|
|
@@ -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 { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback } from 'react';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport { StyledDateInput } from '../Styleds.js';\nimport { announcableCardinalDays } from '../../utils/constants.js';\nimport { convertToPositiveNumberIfPossible } from '../../utils/numberHelpers.js';\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 applyAriaDisabled?: boolean;\n hasError: boolean;\n placeholder: string;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n tabIndex?: TypescriptHelpersT.WCAGTabIndex;\n isFocused: boolean;\n getProps: ControlledDateTimePickerContextT['getProps'];\n readOnly: boolean;\n}\nexport const DDInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n applyAriaDisabled,\n hasError,\n contextRef,\n tabIndex,\n placeholder,\n isFocused,\n getProps,\n readOnly,\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 const dayNum = convertToPositiveNumberIfPossible(value) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n\n return (\n <StyledDateInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n innerRef={(DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n tabIndex={tabIndex}\n placeholder={placeholder}\n aria-label=\"day\"\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY}\n disabled={disabled}\n aria-disabled={applyAriaDisabled}\n aria-invalid={hasError}\n getOwnerProps={getProps}\n readOnly={readOnly}\n role=\"spinbutton\"\n aria-valuemin={1}\n aria-valuemax={31}\n // when empty, valuenow falls back to the min (not omitted) so VoiceOver honors\n // aria-valuetext=\"empty\" instead of announcing a computed position percentage\n aria-valuenow={dayNum === -1 ? 1 : dayNum}\n aria-valuetext={dayNum === -1 ? 'empty' : announcableCardinalDays[dayNum]}\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 { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback } from 'react';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport { StyledDateInput } from '../Styleds.js';\nimport { announcableCardinalDays } from '../../utils/constants.js';\nimport { convertToPositiveNumberIfPossible } from '../../utils/numberHelpers.js';\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 applyAriaDisabled?: boolean;\n hasError: boolean;\n placeholder: string;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n tabIndex?: TypescriptHelpersT.WCAGTabIndex;\n isFocused: boolean;\n getProps: ControlledDateTimePickerContextT['getProps'];\n readOnly: boolean;\n readOnlyHelperMsgId: string;\n}\nexport const DDInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n applyAriaDisabled,\n hasError,\n contextRef,\n tabIndex,\n placeholder,\n isFocused,\n getProps,\n readOnly,\n readOnlyHelperMsgId,\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 const dayNum = convertToPositiveNumberIfPossible(value) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n\n return (\n <StyledDateInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n innerRef={(DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n tabIndex={tabIndex}\n placeholder={placeholder}\n aria-label=\"day\"\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY}\n disabled={disabled}\n aria-disabled={!disabled && (applyAriaDisabled || readOnly) ? true : undefined}\n aria-describedby={readOnly ? readOnlyHelperMsgId : undefined}\n aria-invalid={hasError}\n getOwnerProps={getProps}\n readOnly={readOnly}\n role=\"spinbutton\"\n aria-valuemin={1}\n aria-valuemax={31}\n // when empty, valuenow falls back to the min (not omitted) so VoiceOver honors\n // aria-valuetext=\"empty\" instead of announcing a computed position percentage\n aria-valuenow={dayNum === -1 ? 1 : dayNum}\n aria-valuetext={dayNum === -1 ? 'empty' : announcableCardinalDays[dayNum]}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgEjB;AA/DN,mBAAmC;AAEnC,uBAAmD;AAEnD,qBAAgC;AAChC,IAAAA,oBAAwC;AACxC,2BAAkD;AAElD,MAAM,gBAAgB;AACtB,MAAM,eAAe,CAAC,QAAgB;AACpC,MAAI,QAAQ,GAAI,QAAO;AACvB,QAAM,aAAa,cAAc,KAAK,GAAG;AACzC,SAAO,IAAI,SAAS,KAAK,QAAQ,QAAQ,CAAC,cAAc,OAAO,SAAS,KAAK,EAAE,IAAI;AACrF;AAmBO,MAAM,UAAU,aAAAC,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,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,UAAM,aAAS,wDAAkC,KAAK;AAEtD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,CAAC,YAA8B;AACvC,UAAC,WAAwD,UAAU;AACnE,cAAI,UAAW,UAAS,QAAQ;AAAA,QAClC;AAAA,QACA;AAAA,QACA;AAAA,QACA,cAAW;AAAA,QACX,eAAa,oDAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,iBAAe,CAAC,aAAa,qBAAqB,YAAY,OAAO;AAAA,QACrE,oBAAkB,WAAW,sBAAsB;AAAA,QACnD,gBAAc;AAAA,QACd,eAAe;AAAA,QACf;AAAA,QACA,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,iBAAe;AAAA,QAGf,iBAAe,WAAW,KAAK,IAAI;AAAA,QACnC,kBAAgB,WAAW,KAAK,UAAU,0CAAwB,MAAM;AAAA;AAAA,IAC1E;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["import_constants", "React"]
|
|
7
7
|
}
|
|
@@ -71,6 +71,7 @@ const DateInputs = () => {
|
|
|
71
71
|
latestInteractionRegion,
|
|
72
72
|
currFocusDescriber,
|
|
73
73
|
getProps,
|
|
74
|
+
readOnlyHelperMsgId,
|
|
74
75
|
props: { tabIndex, hasError, readOnly }
|
|
75
76
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
76
77
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -102,7 +103,8 @@ const DateInputs = () => {
|
|
|
102
103
|
hasError,
|
|
103
104
|
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "month-input",
|
|
104
105
|
getProps,
|
|
105
|
-
readOnly
|
|
106
|
+
readOnly,
|
|
107
|
+
readOnlyHelperMsgId
|
|
106
108
|
}
|
|
107
109
|
) }),
|
|
108
110
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Styleds.StyledSeparator, { alignItems: "center", getOwnerProps: getProps, children: "/" }),
|
|
@@ -122,7 +124,8 @@ const DateInputs = () => {
|
|
|
122
124
|
hasError,
|
|
123
125
|
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "day-input",
|
|
124
126
|
getProps,
|
|
125
|
-
readOnly
|
|
127
|
+
readOnly,
|
|
128
|
+
readOnlyHelperMsgId
|
|
126
129
|
}
|
|
127
130
|
) }),
|
|
128
131
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Styleds.StyledSeparator, { alignItems: "center", getOwnerProps: getProps, children: "/" }),
|
|
@@ -142,7 +145,8 @@ const DateInputs = () => {
|
|
|
142
145
|
hasError,
|
|
143
146
|
isFocused: latestInteractionRegion === "date-inputs" && currFocusDescriber === "year-input",
|
|
144
147
|
getProps,
|
|
145
|
-
readOnly
|
|
148
|
+
readOnly,
|
|
149
|
+
readOnlyHelperMsgId
|
|
146
150
|
}
|
|
147
151
|
) })
|
|
148
152
|
]
|
|
@@ -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';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';\nimport { MMInput } from './MMInput.js';\nimport { DDInput } from './DDInput.js';\nimport { YYYYInput } from './YYYYInput.js';\nimport { StyledFocusWithIn, StyledSeparator } from '../Styleds.js';\nimport { useDateInputs } from './useDateInputs.js';\nimport { fixedValues } from '../config.js';\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 applyAriaDisabled,\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 latestInteractionRegion,\n currFocusDescriber,\n getProps,\n props: { tabIndex, hasError, readOnly },\n } = useContext(ControlledDateTimePickerContext);\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 getOwnerProps={getProps}>\n <MMInput\n onChange={onMonthChange}\n onBlur={onMonthBlur}\n onFocus={onMonthFocus}\n onKeyDown={onMonthKeyDown}\n value={month}\n contextRef={monthInputRef}\n innerRef={innerRefMonthInput}\n tabIndex={tabIndex}\n autoFocusMonthInput={autoFocusMonthInput}\n placeholder=\"MM\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n hasError={hasError}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'month-input'}\n getProps={getProps}\n readOnly={readOnly}\n />\n </StyledFocusWithIn>\n <StyledSeparator alignItems=\"center\" getOwnerProps={getProps}>\n /\n </StyledSeparator>\n <StyledFocusWithIn getOwnerProps={getProps}>\n <DDInput\n onChange={onDayChange}\n onBlur={onDayBlur}\n onFocus={onDayFocus}\n onKeyDown={onDayKeyDown}\n value={day}\n contextRef={dayInputRef}\n tabIndex={tabIndex}\n placeholder=\"DD\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n hasError={hasError}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'day-input'}\n getProps={getProps}\n readOnly={readOnly}\n />\n </StyledFocusWithIn>\n <StyledSeparator alignItems=\"center\" getOwnerProps={getProps}>\n /\n </StyledSeparator>\n <StyledFocusWithIn getOwnerProps={getProps}>\n <YYYYInput\n onChange={onYearChange}\n onBlur={onYearBlur}\n onFocus={onYearFocus}\n onKeyDown={onYearKeyDown}\n value={year}\n contextRef={yearInputRef}\n tabIndex={tabIndex}\n placeholder=\"YYYY\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n hasError={hasError}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'year-input'}\n getProps={getProps}\n readOnly={readOnly}\n />\n </StyledFocusWithIn>\n </Grid>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';\nimport { MMInput } from './MMInput.js';\nimport { DDInput } from './DDInput.js';\nimport { YYYYInput } from './YYYYInput.js';\nimport { StyledFocusWithIn, StyledSeparator } from '../Styleds.js';\nimport { useDateInputs } from './useDateInputs.js';\nimport { fixedValues } from '../config.js';\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 applyAriaDisabled,\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 latestInteractionRegion,\n currFocusDescriber,\n getProps,\n readOnlyHelperMsgId,\n props: { tabIndex, hasError, readOnly },\n } = useContext(ControlledDateTimePickerContext);\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 getOwnerProps={getProps}>\n <MMInput\n onChange={onMonthChange}\n onBlur={onMonthBlur}\n onFocus={onMonthFocus}\n onKeyDown={onMonthKeyDown}\n value={month}\n contextRef={monthInputRef}\n innerRef={innerRefMonthInput}\n tabIndex={tabIndex}\n autoFocusMonthInput={autoFocusMonthInput}\n placeholder=\"MM\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n hasError={hasError}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'month-input'}\n getProps={getProps}\n readOnly={readOnly}\n readOnlyHelperMsgId={readOnlyHelperMsgId}\n />\n </StyledFocusWithIn>\n <StyledSeparator alignItems=\"center\" getOwnerProps={getProps}>\n /\n </StyledSeparator>\n <StyledFocusWithIn getOwnerProps={getProps}>\n <DDInput\n onChange={onDayChange}\n onBlur={onDayBlur}\n onFocus={onDayFocus}\n onKeyDown={onDayKeyDown}\n value={day}\n contextRef={dayInputRef}\n tabIndex={tabIndex}\n placeholder=\"DD\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n hasError={hasError}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'day-input'}\n getProps={getProps}\n readOnly={readOnly}\n readOnlyHelperMsgId={readOnlyHelperMsgId}\n />\n </StyledFocusWithIn>\n <StyledSeparator alignItems=\"center\" getOwnerProps={getProps}>\n /\n </StyledSeparator>\n <StyledFocusWithIn getOwnerProps={getProps}>\n <YYYYInput\n onChange={onYearChange}\n onBlur={onYearBlur}\n onFocus={onYearFocus}\n onKeyDown={onYearKeyDown}\n value={year}\n contextRef={yearInputRef}\n tabIndex={tabIndex}\n placeholder=\"YYYY\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n hasError={hasError}\n isFocused={latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'year-input'}\n getProps={getProps}\n readOnly={readOnly}\n readOnlyHelperMsgId={readOnlyHelperMsgId}\n />\n </StyledFocusWithIn>\n </Grid>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD6CnB;AA7CJ,mBAAkC;AAClC,qBAAqB;AACrB,yCAAgD;AAChD,qBAAwB;AACxB,qBAAwB;AACxB,uBAA0B;AAC1B,qBAAmD;AACnD,2BAA8B;AAC9B,oBAA4B;AAErB,MAAM,aAAa,MAAmB;AAC3C,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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,oCAAc;AAElB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,EAAE,UAAU,UAAU,SAAS;AAAA,EACxC,QAAI,yBAAW,kEAA+B;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,QACJ,0BAAY;AAAA,QACZ,0BAAY;AAAA,QACZ,0BAAY;AAAA,QACZ,0BAAY;AAAA,QACZ,0BAAY;AAAA,MACd;AAAA,MAEA;AAAA,oDAAC,oCAAkB,eAAe,UAChC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,YACX,OAAO;AAAA,YACP,YAAY;AAAA,YACZ,UAAU;AAAA,YACV;AAAA,YACA;AAAA,YACA,aAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACA;AAAA,YACA,WAAW,4BAA4B,iBAAiB,uBAAuB;AAAA,YAC/E;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF,GACF;AAAA,QACA,4CAAC,kCAAgB,YAAW,UAAS,eAAe,UAAU,eAE9D;AAAA,QACA,4CAAC,oCAAkB,eAAe,UAChC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,YACX,OAAO;AAAA,YACP,YAAY;AAAA,YACZ;AAAA,YACA,aAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACA;AAAA,YACA,WAAW,4BAA4B,iBAAiB,uBAAuB;AAAA,YAC/E;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF,GACF;AAAA,QACA,4CAAC,kCAAgB,YAAW,UAAS,eAAe,UAAU,eAE9D;AAAA,QACA,4CAAC,oCAAkB,eAAe,UAChC;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,YACX,OAAO;AAAA,YACP,YAAY;AAAA,YACZ;AAAA,YACA,aAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACA;AAAA,YACA,WAAW,4BAA4B,iBAAiB,uBAAuB;AAAA,YAC/E;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -62,7 +62,8 @@ const MMInput = import_react.default.memo(
|
|
|
62
62
|
autoFocusMonthInput,
|
|
63
63
|
isFocused,
|
|
64
64
|
getProps,
|
|
65
|
-
readOnly
|
|
65
|
+
readOnly,
|
|
66
|
+
readOnlyHelperMsgId
|
|
66
67
|
}) => {
|
|
67
68
|
const validateOnChange = (0, import_react.useCallback)(
|
|
68
69
|
(e) => {
|
|
@@ -103,7 +104,8 @@ const MMInput = import_react.default.memo(
|
|
|
103
104
|
"aria-label": "month",
|
|
104
105
|
"data-testid": import_constants.ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH,
|
|
105
106
|
disabled,
|
|
106
|
-
"aria-disabled": applyAriaDisabled,
|
|
107
|
+
"aria-disabled": !disabled && (applyAriaDisabled || readOnly) ? true : void 0,
|
|
108
|
+
"aria-describedby": readOnly ? readOnlyHelperMsgId : void 0,
|
|
107
109
|
"aria-invalid": hasError,
|
|
108
110
|
getOwnerProps: getProps,
|
|
109
111
|
readOnly,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DateInputs/MMInput.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { setMultipleRefs } from '@elliemae/ds-system';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback, useMemo } from 'react';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport { StyledMonthInput } from '../Styleds.js';\nimport { convertToPositiveNumberIfPossible } from '../../utils/numberHelpers.js';\nimport { monthNames } from '../../utils/constants.js';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidMonth = (month: string) => {\n if (month === '') return false;\n const numberOnly = regExpNumbers.test(month);\n return month.length > 2 || month === '00' || !numberOnly || Number.parseInt(month, 10) > 12;\n};\ninterface MMInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n autoFocusMonthInput: boolean;\n value: string;\n disabled: boolean;\n applyAriaDisabled?: boolean;\n hasError: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n isFocused: boolean;\n innerRef?:\n | React.MutableRefObject<HTMLInputElement | HTMLButtonElement | null>\n | ((ref: HTMLInputElement | HTMLButtonElement | null) => void);\n tabIndex?: TypescriptHelpersT.WCAGTabIndex;\n getProps: ControlledDateTimePickerContextT['getProps'];\n readOnly: boolean;\n}\nexport const MMInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n applyAriaDisabled,\n hasError,\n placeholder,\n contextRef,\n innerRef,\n tabIndex,\n autoFocusMonthInput,\n isFocused,\n getProps,\n readOnly,\n }: MMInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidMonth(e?.target?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n\n const handleRef = useCallback(\n (DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n },\n [contextRef, isFocused],\n );\n\n const currentRef = useMemo(() => {\n if (innerRef) {\n return setMultipleRefs([handleRef, innerRef]);\n }\n return handleRef;\n }, [handleRef, innerRef]);\n\n const monthNum = convertToPositiveNumberIfPossible(value);\n\n return (\n <StyledMonthInput\n autoFocus={autoFocusMonthInput}\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n innerRef={currentRef}\n tabIndex={tabIndex}\n placeholder={placeholder}\n aria-label=\"month\"\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH}\n disabled={disabled}\n aria-disabled={applyAriaDisabled}\n aria-invalid={hasError}\n getOwnerProps={getProps}\n readOnly={readOnly}\n role=\"spinbutton\"\n aria-valuemin={1}\n aria-valuemax={12}\n // when empty, valuenow falls back to the min (not omitted) so VoiceOver honors\n // aria-valuetext=\"empty\" instead of announcing a computed position percentage\n aria-valuenow={monthNum === -1 ? 1 : monthNum}\n aria-valuetext={monthNum === -1 ? 'empty' : monthNames[monthNum - 1]}\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 { setMultipleRefs } from '@elliemae/ds-system';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback, useMemo } from 'react';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport { StyledMonthInput } from '../Styleds.js';\nimport { convertToPositiveNumberIfPossible } from '../../utils/numberHelpers.js';\nimport { monthNames } from '../../utils/constants.js';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidMonth = (month: string) => {\n if (month === '') return false;\n const numberOnly = regExpNumbers.test(month);\n return month.length > 2 || month === '00' || !numberOnly || Number.parseInt(month, 10) > 12;\n};\ninterface MMInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n autoFocusMonthInput: boolean;\n value: string;\n disabled: boolean;\n applyAriaDisabled?: boolean;\n hasError: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n isFocused: boolean;\n innerRef?:\n | React.MutableRefObject<HTMLInputElement | HTMLButtonElement | null>\n | ((ref: HTMLInputElement | HTMLButtonElement | null) => void);\n tabIndex?: TypescriptHelpersT.WCAGTabIndex;\n getProps: ControlledDateTimePickerContextT['getProps'];\n readOnly: boolean;\n readOnlyHelperMsgId: string;\n}\nexport const MMInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n applyAriaDisabled,\n hasError,\n placeholder,\n contextRef,\n innerRef,\n tabIndex,\n autoFocusMonthInput,\n isFocused,\n getProps,\n readOnly,\n readOnlyHelperMsgId,\n }: MMInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidMonth(e?.target?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n\n const handleRef = useCallback(\n (DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n },\n [contextRef, isFocused],\n );\n\n const currentRef = useMemo(() => {\n if (innerRef) {\n return setMultipleRefs([handleRef, innerRef]);\n }\n return handleRef;\n }, [handleRef, innerRef]);\n\n const monthNum = convertToPositiveNumberIfPossible(value);\n\n return (\n <StyledMonthInput\n autoFocus={autoFocusMonthInput}\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n innerRef={currentRef}\n tabIndex={tabIndex}\n placeholder={placeholder}\n aria-label=\"month\"\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH}\n disabled={disabled}\n aria-disabled={!disabled && (applyAriaDisabled || readOnly) ? true : undefined}\n aria-describedby={readOnly ? readOnlyHelperMsgId : undefined}\n aria-invalid={hasError}\n getOwnerProps={getProps}\n readOnly={readOnly}\n role=\"spinbutton\"\n aria-valuemin={1}\n aria-valuemax={12}\n // when empty, valuenow falls back to the min (not omitted) so VoiceOver honors\n // aria-valuetext=\"empty\" instead of announcing a computed position percentage\n aria-valuenow={monthNum === -1 ? 1 : monthNum}\n aria-valuetext={monthNum === -1 ? 'empty' : monthNames[monthNum - 1]}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsFjB;AAtFN,uBAAgC;AAEhC,mBAA4C;AAE5C,uBAAmD;AAEnD,qBAAiC;AACjC,2BAAkD;AAClD,IAAAA,oBAA2B;AAE3B,MAAM,gBAAgB;AACtB,MAAM,iBAAiB,CAAC,UAAkB;AACxC,MAAI,UAAU,GAAI,QAAO;AACzB,QAAM,aAAa,cAAc,KAAK,KAAK;AAC3C,SAAO,MAAM,SAAS,KAAK,UAAU,QAAQ,CAAC,cAAc,OAAO,SAAS,OAAO,EAAE,IAAI;AAC3F;AAsBO,MAAM,UAAU,aAAAC,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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAmC;AACjC,UAAM,uBAAmB;AAAA,MACvB,CAAC,MAA2C;AAC1C,YAAI,eAAe,GAAG,QAAQ,KAAK,GAAG;AACpC,YAAE,eAAe;AACjB;AAAA,QACF;AACA,iBAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,QAAQ;AAAA,IACX;AAEA,UAAM,gBAAY;AAAA,MAChB,CAAC,YAA8B;AAC7B,QAAC,WAAwD,UAAU;AACnE,YAAI,UAAW,UAAS,QAAQ;AAAA,MAClC;AAAA,MACA,CAAC,YAAY,SAAS;AAAA,IACxB;AAEA,UAAM,iBAAa,sBAAQ,MAAM;AAC/B,UAAI,UAAU;AACZ,mBAAO,kCAAgB,CAAC,WAAW,QAAQ,CAAC;AAAA,MAC9C;AACA,aAAO;AAAA,IACT,GAAG,CAAC,WAAW,QAAQ,CAAC;AAExB,UAAM,eAAW,wDAAkC,KAAK;AAExD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,cAAW;AAAA,QACX,eAAa,oDAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,iBAAe,CAAC,aAAa,qBAAqB,YAAY,OAAO;AAAA,QACrE,oBAAkB,WAAW,sBAAsB;AAAA,QACnD,gBAAc;AAAA,QACd,eAAe;AAAA,QACf;AAAA,QACA,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,iBAAe;AAAA,QAGf,iBAAe,aAAa,KAAK,IAAI;AAAA,QACrC,kBAAgB,aAAa,KAAK,UAAU,6BAAW,WAAW,CAAC;AAAA;AAAA,IACrE;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["import_constants", "React"]
|
|
7
7
|
}
|
|
@@ -59,7 +59,8 @@ const YYYYInput = import_react.default.memo(
|
|
|
59
59
|
tabIndex,
|
|
60
60
|
isFocused,
|
|
61
61
|
getProps,
|
|
62
|
-
readOnly
|
|
62
|
+
readOnly,
|
|
63
|
+
readOnlyHelperMsgId
|
|
63
64
|
}) => {
|
|
64
65
|
const validateOnChange = (0, import_react.useCallback)(
|
|
65
66
|
(e) => {
|
|
@@ -89,7 +90,8 @@ const YYYYInput = import_react.default.memo(
|
|
|
89
90
|
placeholder,
|
|
90
91
|
"aria-label": "year",
|
|
91
92
|
disabled,
|
|
92
|
-
"aria-disabled": applyAriaDisabled,
|
|
93
|
+
"aria-disabled": !disabled && (applyAriaDisabled || readOnly) ? true : void 0,
|
|
94
|
+
"aria-describedby": readOnly ? readOnlyHelperMsgId : void 0,
|
|
93
95
|
"aria-invalid": hasError,
|
|
94
96
|
getOwnerProps: getProps,
|
|
95
97
|
readOnly,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/DateInputs/YYYYInput.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback } from 'react';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport { StyledYearInput } from '../Styleds.js';\nimport { convertToPositiveNumberIfPossible } from '../../utils/numberHelpers.js';\nimport { fillStringWithPlaceHolders } from '../../utils/stringHelpers.js';\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidYear = (year: string) => {\n if (year === '') return false;\n const numberOnly = regExpNumbers.test(year);\n return year.length > 4 || !numberOnly || Number.parseInt(year, 10) > 9999;\n};\n\ninterface YYYYInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n applyAriaDisabled?: boolean;\n hasError: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n tabIndex?: TypescriptHelpersT.WCAGTabIndex;\n placeholder: string;\n isFocused: boolean;\n getProps: ControlledDateTimePickerContextT['getProps'];\n readOnly: boolean;\n}\nexport const YYYYInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n applyAriaDisabled,\n hasError,\n placeholder,\n contextRef,\n tabIndex,\n isFocused,\n getProps,\n readOnly,\n }: YYYYInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidYear(e?.currentTarget?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n\n const yearNum = convertToPositiveNumberIfPossible(value);\n\n return (\n <StyledYearInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n innerRef={(DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n tabIndex={tabIndex}\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR}\n placeholder={placeholder}\n aria-label=\"year\"\n disabled={disabled}\n aria-disabled={applyAriaDisabled}\n aria-invalid={hasError}\n getOwnerProps={getProps}\n readOnly={readOnly}\n role=\"spinbutton\"\n aria-valuemin={0}\n aria-valuemax={9999}\n // when empty, valuenow falls back to the min (not omitted) so VoiceOver honors\n // aria-valuetext=\"empty\" instead of announcing a computed position percentage\n aria-valuenow={yearNum === -1 ? 0 : yearNum}\n aria-valuetext={yearNum === -1 ? 'empty' : fillStringWithPlaceHolders(`${yearNum}`, 4, '0')}\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 { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport React, { useCallback } from 'react';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\nimport { ControlledDateTimePickerDatatestid } from '../../constants/index.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport { StyledYearInput } from '../Styleds.js';\nimport { convertToPositiveNumberIfPossible } from '../../utils/numberHelpers.js';\nimport { fillStringWithPlaceHolders } from '../../utils/stringHelpers.js';\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidYear = (year: string) => {\n if (year === '') return false;\n const numberOnly = regExpNumbers.test(year);\n return year.length > 4 || !numberOnly || Number.parseInt(year, 10) > 9999;\n};\n\ninterface YYYYInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n applyAriaDisabled?: boolean;\n hasError: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n tabIndex?: TypescriptHelpersT.WCAGTabIndex;\n placeholder: string;\n isFocused: boolean;\n getProps: ControlledDateTimePickerContextT['getProps'];\n readOnly: boolean;\n readOnlyHelperMsgId: string;\n}\nexport const YYYYInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n applyAriaDisabled,\n hasError,\n placeholder,\n contextRef,\n tabIndex,\n isFocused,\n getProps,\n readOnly,\n readOnlyHelperMsgId,\n }: YYYYInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidYear(e?.currentTarget?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n\n const yearNum = convertToPositiveNumberIfPossible(value);\n\n return (\n <StyledYearInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n innerRef={(DomElem: HTMLInputElement) => {\n (contextRef as React.MutableRefObject<HTMLInputElement>).current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n tabIndex={tabIndex}\n data-testid={ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR}\n placeholder={placeholder}\n aria-label=\"year\"\n disabled={disabled}\n aria-disabled={!disabled && (applyAriaDisabled || readOnly) ? true : undefined}\n aria-describedby={readOnly ? readOnlyHelperMsgId : undefined}\n aria-invalid={hasError}\n getOwnerProps={getProps}\n readOnly={readOnly}\n role=\"spinbutton\"\n aria-valuemin={0}\n aria-valuemax={9999}\n // when empty, valuenow falls back to the min (not omitted) so VoiceOver honors\n // aria-valuetext=\"empty\" instead of announcing a computed position percentage\n aria-valuenow={yearNum === -1 ? 0 : yearNum}\n aria-valuetext={yearNum === -1 ? 'empty' : fillStringWithPlaceHolders(`${yearNum}`, 4, '0')}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgEjB;AA/DN,mBAAmC;AAEnC,uBAAmD;AAEnD,qBAAgC;AAChC,2BAAkD;AAClD,2BAA2C;AAC3C,MAAM,gBAAgB;AACtB,MAAM,gBAAgB,CAAC,SAAiB;AACtC,MAAI,SAAS,GAAI,QAAO;AACxB,QAAM,aAAa,cAAc,KAAK,IAAI;AAC1C,SAAO,KAAK,SAAS,KAAK,CAAC,cAAc,OAAO,SAAS,MAAM,EAAE,IAAI;AACvE;AAmBO,MAAM,YAAY,aAAAA,QAAM;AAAA,EAC7B,CAAC;AAAA,IACC;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,MAAqC;AACnC,UAAM,uBAAmB;AAAA,MACvB,CAAC,MAA2C;AAC1C,YAAI,cAAc,GAAG,eAAe,KAAK,GAAG;AAC1C,YAAE,eAAe;AACjB;AAAA,QACF;AACA,iBAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,QAAQ;AAAA,IACX;AAEA,UAAM,cAAU,wDAAkC,KAAK;AAEvD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,UAAU,CAAC,YAA8B;AACvC,UAAC,WAAwD,UAAU;AACnE,cAAI,UAAW,UAAS,QAAQ;AAAA,QAClC;AAAA,QACA;AAAA,QACA,eAAa,oDAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,cAAW;AAAA,QACX;AAAA,QACA,iBAAe,CAAC,aAAa,qBAAqB,YAAY,OAAO;AAAA,QACrE,oBAAkB,WAAW,sBAAsB;AAAA,QACnD,gBAAc;AAAA,QACd,eAAe;AAAA,QACf;AAAA,QACA,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,iBAAe;AAAA,QAGf,iBAAe,YAAY,KAAK,IAAI;AAAA,QACpC,kBAAgB,YAAY,KAAK,cAAU,iDAA2B,GAAG,OAAO,IAAI,GAAG,GAAG;AAAA;AAAA,IAC5F;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -33,6 +33,7 @@ __export(useDateInputs_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(useDateInputs_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = require("react");
|
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
37
|
var import_ControlledDateTimePickerCTX = require("../../ControlledDateTimePickerCTX.js");
|
|
37
38
|
var import_constants = require("../../utils/constants.js");
|
|
38
39
|
var import_dateHelpers = require("../../utils/dateHelpers.js");
|
|
@@ -65,7 +66,7 @@ const useDateInputs = () => {
|
|
|
65
66
|
trackFocusClearBtn,
|
|
66
67
|
trackFocusPicker
|
|
67
68
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
68
|
-
const shouldPreventValueChanges = disabled
|
|
69
|
+
const shouldPreventValueChanges = (0, import_ds_props_helpers.isLocked)({ disabled, applyAriaDisabled, readOnly });
|
|
69
70
|
const onHomeKeyDown = (0, import_react.useCallback)(() => {
|
|
70
71
|
trackFocusFirstSegment();
|
|
71
72
|
}, [trackFocusFirstSegment]);
|