@elliemae/ds-form-date-time-picker 3.60.0-next.6 → 3.60.0-next.60
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 +4 -0
- package/dist/cjs/config/useControlledDateTimePicker.js.map +2 -2
- package/dist/cjs/config/useFocusTracker.js +23 -12
- package/dist/cjs/config/useFocusTracker.js.map +2 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/parts/ControlledDateTimePickerContent.js +1 -1
- package/dist/cjs/parts/ControlledDateTimePickerContent.js.map +2 -2
- package/dist/cjs/parts/DateInputs/DDInput.js +9 -1
- package/dist/cjs/parts/DateInputs/DDInput.js.map +3 -3
- package/dist/cjs/parts/DateInputs/MMInput.js +9 -1
- package/dist/cjs/parts/DateInputs/MMInput.js.map +3 -3
- package/dist/cjs/parts/DateInputs/YYYYInput.js +9 -1
- package/dist/cjs/parts/DateInputs/YYYYInput.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js +1 -1
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarDaysList.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js +1 -1
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/Day.js +59 -74
- package/dist/cjs/parts/Pickers/Calendar/Day.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/Styleds.js +64 -8
- package/dist/cjs/parts/Pickers/Calendar/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useFocusLogic.js +1 -3
- package/dist/cjs/parts/Pickers/Calendar/useFocusLogic.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useGetDayFlags.js +89 -0
- package/dist/cjs/parts/Pickers/Calendar/useGetDayFlags.js.map +7 -0
- package/dist/cjs/parts/Pickers/Calendar/useKeyboardHandlers.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +1 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +1 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/Styleds.js +2 -2
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js +28 -18
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js +114 -60
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js +36 -30
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/Styleds.js +115 -92
- package/dist/cjs/parts/Pickers/TimeWheel/Styleds.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js +1 -1
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +2 -2
- package/dist/cjs/parts/Styleds.js +7 -4
- package/dist/cjs/parts/Styleds.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/HHInput.js +8 -1
- package/dist/cjs/parts/TimeInputs/HHInput.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/MinutesInput.js +8 -1
- package/dist/cjs/parts/TimeInputs/MinutesInput.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +3 -0
- package/dist/cjs/react-desc-prop-types.js.map +3 -3
- package/dist/cjs/sharedTypes.js.map +1 -1
- package/dist/cjs/slot-arguments-polymorphic-typescript.js +28 -0
- package/dist/cjs/slot-arguments-polymorphic-typescript.js.map +7 -0
- package/dist/cjs/typescript-testing/slot-arguments-engine.js +25 -0
- package/dist/cjs/typescript-testing/slot-arguments-engine.js.map +7 -0
- package/dist/cjs/typescript-testing/slot-props.js +159 -57
- package/dist/cjs/typescript-testing/slot-props.js.map +2 -2
- package/dist/cjs/utils/constants.js +9 -9
- package/dist/cjs/utils/constants.js.map +1 -1
- package/dist/cjs/utils/dateHelpers.js.map +2 -2
- package/dist/esm/config/useControlledDateTimePicker.js +5 -1
- package/dist/esm/config/useControlledDateTimePicker.js.map +2 -2
- package/dist/esm/config/useFocusTracker.js +23 -12
- package/dist/esm/config/useFocusTracker.js.map +2 -2
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/parts/ControlledDateTimePickerContent.js +1 -1
- package/dist/esm/parts/ControlledDateTimePickerContent.js.map +2 -2
- package/dist/esm/parts/DateInputs/DDInput.js +9 -1
- package/dist/esm/parts/DateInputs/DDInput.js.map +2 -2
- package/dist/esm/parts/DateInputs/MMInput.js +9 -1
- package/dist/esm/parts/DateInputs/MMInput.js.map +2 -2
- package/dist/esm/parts/DateInputs/YYYYInput.js +9 -1
- package/dist/esm/parts/DateInputs/YYYYInput.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js +1 -1
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarDaysList.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js +1 -1
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/Day.js +61 -82
- package/dist/esm/parts/Pickers/Calendar/Day.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/Styleds.js +64 -8
- package/dist/esm/parts/Pickers/Calendar/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useFocusLogic.js +1 -3
- package/dist/esm/parts/Pickers/Calendar/useFocusLogic.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useGetDayFlags.js +59 -0
- package/dist/esm/parts/Pickers/Calendar/useGetDayFlags.js.map +7 -0
- package/dist/esm/parts/Pickers/Calendar/useKeyboardHandlers.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +1 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +1 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/Styleds.js +2 -2
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js +29 -19
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js +116 -62
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js +37 -31
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/Styleds.js +115 -92
- package/dist/esm/parts/Pickers/TimeWheel/Styleds.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js +1 -1
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +2 -2
- package/dist/esm/parts/Styleds.js +7 -4
- package/dist/esm/parts/Styleds.js.map +2 -2
- package/dist/esm/parts/TimeInputs/HHInput.js +8 -1
- package/dist/esm/parts/TimeInputs/HHInput.js.map +2 -2
- package/dist/esm/parts/TimeInputs/MinutesInput.js +8 -1
- package/dist/esm/parts/TimeInputs/MinutesInput.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +3 -0
- package/dist/esm/react-desc-prop-types.js.map +3 -3
- package/dist/esm/slot-arguments-polymorphic-typescript.js +2 -0
- package/dist/esm/slot-arguments-polymorphic-typescript.js.map +7 -0
- package/dist/esm/typescript-testing/slot-arguments-engine.js +2 -0
- package/dist/esm/typescript-testing/slot-arguments-engine.js.map +7 -0
- package/dist/esm/typescript-testing/slot-props.js +161 -59
- package/dist/esm/typescript-testing/slot-props.js.map +2 -2
- package/dist/esm/utils/constants.js +9 -9
- package/dist/esm/utils/constants.js.map +1 -1
- package/dist/esm/utils/dateHelpers.js.map +2 -2
- package/dist/types/config/useControlledDateTimePicker.d.ts +1 -0
- package/dist/types/config/useFocusTracker.d.ts +1 -1
- package/dist/types/config/useGetFlags.d.ts +2 -2
- package/dist/types/config/useGetReferences.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/parts/Pickers/Calendar/CalendarDaysList.d.ts +5 -5
- package/dist/types/parts/Pickers/Calendar/Day.d.ts +2 -2
- package/dist/types/parts/Pickers/Calendar/Styleds.d.ts +3 -3
- package/dist/types/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.d.ts +6 -5
- package/dist/types/parts/Pickers/Calendar/useFocusLogic.d.ts +3 -3
- package/dist/types/parts/Pickers/Calendar/useGetDayFlags.d.ts +14 -0
- package/dist/types/parts/Pickers/Calendar/useKeyboardHandlers.d.ts +2 -2
- package/dist/types/parts/Pickers/CalendarWithTimeWheel/Styleds.d.ts +2 -2
- package/dist/types/parts/Pickers/TimeWheel/Styleds.d.ts +19 -17
- package/dist/types/parts/Styleds.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +51 -35
- package/dist/types/sharedTypes.d.ts +0 -9
- package/dist/types/slot-arguments-polymorphic-typescript.d.ts +80 -0
- package/dist/types/tests/DSControlledDateTimePicker.data-testid.test.d.ts +1 -0
- package/dist/types/tests/DSControlledDateTimePicker.exports.test.d.ts +1 -0
- package/dist/types/tests/playwright-tests/full/ControlledTestRenderer.d.ts +2 -0
- package/dist/types/tests/playwright-tests/full/DSControlledDateTimePicker.full.navigation.test.playwright.d.ts +1 -0
- package/dist/types/typescript-testing/slot-arguments-engine.d.ts +95 -0
- package/dist/types/utils/constants.d.ts +9 -9
- package/dist/types/utils/dateHelpers.d.ts +1 -1
- package/package.json +31 -32
- /package/dist/types/tests/{date-time-picker.calendar-navigation-days.test.d.ts → DSControlledDateTimePicker.PUI-17323.test.d.ts} +0 -0
|
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(useControlledDateTimePicker_exports);
|
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
+
var import_uid = require("uid");
|
|
37
38
|
var import_useGetPropsWithDefault = require("./useGetPropsWithDefault.js");
|
|
38
39
|
var import_useFocusTracker = require("./useFocusTracker.js");
|
|
39
40
|
var import_useGetFlags = require("./useGetFlags.js");
|
|
@@ -46,6 +47,7 @@ var import_useGlobalKeyHandlers = require("./useGlobalKeyHandlers.js");
|
|
|
46
47
|
var import_useValidateProps = require("./useValidateProps.js");
|
|
47
48
|
const useControlledDateTimePicker = (props) => {
|
|
48
49
|
(0, import_useValidateProps.useValidateProps)(props);
|
|
50
|
+
const instanceUid = (0, import_react.useMemo)(() => `ds-dtp-${(0, import_uid.uid)(6)}`, []);
|
|
49
51
|
const propsWithDefaults = (0, import_useGetPropsWithDefault.useGetDatePickerWithDefaultsProps)(props);
|
|
50
52
|
const flags = (0, import_useGetFlags.useGetFlags)(propsWithDefaults);
|
|
51
53
|
const DOMRefs = (0, import_useGetReferences.useGetReferences)(flags);
|
|
@@ -72,6 +74,7 @@ const useControlledDateTimePicker = (props) => {
|
|
|
72
74
|
props: propsWithDefaults,
|
|
73
75
|
getProps,
|
|
74
76
|
ariaCurrentValueForInputs,
|
|
77
|
+
instanceUid,
|
|
75
78
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
76
79
|
xstyledAttrs,
|
|
77
80
|
globalAttrs,
|
|
@@ -88,6 +91,7 @@ const useControlledDateTimePicker = (props) => {
|
|
|
88
91
|
propsWithDefaults,
|
|
89
92
|
getProps,
|
|
90
93
|
ariaCurrentValueForInputs,
|
|
94
|
+
instanceUid,
|
|
91
95
|
xstyledAttrs,
|
|
92
96
|
globalAttrs,
|
|
93
97
|
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 } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';\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 };\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 });\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 getProps = useCallback(() => propsWithDefaults, [propsWithDefaults]);\n\n const ctx = React.useMemo(\n () => ({\n props: propsWithDefaults,\n getProps,\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 getProps,\n ariaCurrentValueForInputs,\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,
|
|
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({ 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 getProps = useCallback(() => propsWithDefaults, [propsWithDefaults]);\n\n const ctx = React.useMemo(\n () => ({\n props: propsWithDefaults,\n getProps,\n ariaCurrentValueForInputs,\n instanceUid,\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 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;AAmB1B,MAAM,8BAA8B,CACzC,UACqC;AAErC,gDAAiB,KAAK;AAEtB,QAAM,kBAAc,sBAAQ,MAAM,cAAU,gBAAI,CAAC,CAAC,IAAI,CAAC,CAAC;AACxD,QAAM,wBAAoB,iEAAkC,KAAK;AAEjE,QAAM,YAAQ,gCAAY,iBAAiB;AAC3C,QAAM,cAAU,0CAAiB,KAAK;AAC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|
7
7
|
}
|
|
@@ -37,7 +37,7 @@ const useFocusTracker = ({ DOMRefs, flags }) => {
|
|
|
37
37
|
const [latestInteractionRegion, setLatestInteractionRegion] = (0, import_react.useState)("");
|
|
38
38
|
const [currFocusDescriber, setCurrFocusDescriber] = (0, import_react.useState)("");
|
|
39
39
|
const { firstSegment, lastSegment } = DOMRefs;
|
|
40
|
-
const { isDateSelector, isTimeSelector } = flags;
|
|
40
|
+
const { isDateSelector, isTimeSelector, isControllerOnly } = flags;
|
|
41
41
|
const trackFocusPicker = (0, import_react.useCallback)(() => {
|
|
42
42
|
let picker = "datetime-picker-icon";
|
|
43
43
|
if (isDateSelector) picker = "date-picker-icon";
|
|
@@ -68,17 +68,28 @@ const useFocusTracker = ({ DOMRefs, flags }) => {
|
|
|
68
68
|
if (latestInteractionRegion !== "") setLatestInteractionRegion("");
|
|
69
69
|
if (currFocusDescriber !== "") setCurrFocusDescriber("");
|
|
70
70
|
}, [currFocusDescriber, latestInteractionRegion]);
|
|
71
|
-
const handleComponentBlurs = (0, import_react.useCallback)(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
const handleComponentBlurs = (0, import_react.useCallback)(
|
|
72
|
+
(e) => {
|
|
73
|
+
if (isControllerOnly) {
|
|
74
|
+
const relatedTarget = e.relatedTarget;
|
|
75
|
+
if (relatedTarget && e.currentTarget.contains(relatedTarget)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
trackFocusResetter();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
let shouldShortCircuit = false;
|
|
82
|
+
if (latestInteractionRegion === "calendar-days" && currFocusDescriber === "calendar-metafocused-day")
|
|
83
|
+
shouldShortCircuit = true;
|
|
84
|
+
if (latestInteractionRegion === "calendar-head" && currFocusDescriber === "calendar-prev-month")
|
|
85
|
+
shouldShortCircuit = true;
|
|
86
|
+
if (latestInteractionRegion === "timewheel" && currFocusDescriber === "timewheel-curr-hour")
|
|
87
|
+
shouldShortCircuit = true;
|
|
88
|
+
if (shouldShortCircuit) return;
|
|
89
|
+
trackFocusResetter();
|
|
90
|
+
},
|
|
91
|
+
[currFocusDescriber, isControllerOnly, latestInteractionRegion, trackFocusResetter]
|
|
92
|
+
);
|
|
82
93
|
return (0, import_react.useMemo)(
|
|
83
94
|
() => ({
|
|
84
95
|
latestInteractionRegion,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useFocusTracker.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-lines */\n/* eslint-disable indent */\n/* eslint-disable max-params */\n/* eslint-disable max-statements */\nimport { useCallback, useMemo, useState } from 'react';\nimport type { useGetReferences } from './useGetReferences.js';\nimport type { useGetFlags } from './useGetFlags.js';\n\ntype LatestInteractionRegion =\n | 'calendar-days'\n | 'calendar-head'\n | 'timewheel'\n | 'date-inputs'\n | 'time-inputs'\n | 'clear-btn'\n | 'picker-icon'\n | '';\ntype CurrFocusDescriber =\n | 'first-segment'\n | 'month-input'\n | 'day-input'\n | 'year-input'\n | 'hour-input'\n | 'minute-input'\n | 'meridiem-input'\n | 'last-segment'\n | 'clear-btn'\n | 'date-picker-icon'\n | 'time-picker-icon'\n | 'datetime-picker-icon'\n | 'calendar-prev-month'\n | 'calendar-next-month'\n | 'calendar-prev-year'\n | 'calendar-next-year'\n | 'calendar-metafocused-day'\n | 'timewheel-curr-hour'\n | 'timewheel-curr-minute'\n | 'timewheel-curr-meridiem'\n | '';\n\ninterface Config {\n DOMRefs: ReturnType<typeof useGetReferences>;\n flags: ReturnType<typeof useGetFlags>;\n}\nexport const useFocusTracker = ({ DOMRefs, flags }: Config) => {\n const [latestInteractionRegion, setLatestInteractionRegion] = useState<LatestInteractionRegion>('');\n const [currFocusDescriber, setCurrFocusDescriber] = useState<CurrFocusDescriber>('');\n const { firstSegment, lastSegment } = DOMRefs;\n const { isDateSelector, isTimeSelector } = flags;\n\n const trackFocusPicker = useCallback(() => {\n let picker = 'datetime-picker-icon' as CurrFocusDescriber;\n if (isDateSelector) picker = 'date-picker-icon';\n if (isTimeSelector) picker = 'time-picker-icon';\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (picker !== currFocusDescriber) setCurrFocusDescriber(picker);\n }, [currFocusDescriber, isDateSelector, isTimeSelector, latestInteractionRegion]);\n\n /*\n depending on the polymorphic props, the first segment can be:\n - month-input (when date inputs are present)\n - hour-input (when ONLY time inputs are present)\n - datetime-picker-icon (when picker is present and we are selecting both date and time)\n - date-picker-icon (when picker is present and no time selection is involved)\n - time-picker-icon (when picker is present and no date selection is involved)\n */\n const trackFocusFirstSegment = useCallback(() => {\n let region = 'date-inputs' as LatestInteractionRegion;\n if (firstSegment === 'hour-input') region = 'time-inputs';\n if (firstSegment === 'date-picker-icon') region = 'picker-icon';\n if (firstSegment === 'time-picker-icon') region = 'picker-icon';\n if (firstSegment === 'datetime-picker-icon') region = 'picker-icon';\n if (region !== latestInteractionRegion) setLatestInteractionRegion(region);\n if (firstSegment !== currFocusDescriber) setCurrFocusDescriber(firstSegment);\n }, [currFocusDescriber, firstSegment, latestInteractionRegion]);\n\n /*\n depending on the polymorphic props, the last segment can be:\n - year-input (when ONLY date inputs are present)\n - meridiem-input (when time inputs are present)\n - clear-btn (when clearable is true and there is no picker)\n - datetime-picker-icon (when picker is present and we are selecting both date and time)\n - date-picker-icon (when picker is present and no time selection is involved)\n - time-picker-icon (when picker is present and no date selection is involved)\n */\n const trackFocusLastSegment = useCallback(() => {\n let region = 'date-inputs' as LatestInteractionRegion;\n if (lastSegment === 'meridiem-input') region = 'time-inputs';\n if (lastSegment === 'clear-btn') region = 'clear-btn';\n if (lastSegment === 'date-picker-icon') region = 'picker-icon';\n if (lastSegment === 'time-picker-icon') region = 'picker-icon';\n if (lastSegment === 'datetime-picker-icon') region = 'picker-icon';\n if (region !== latestInteractionRegion) setLatestInteractionRegion(region);\n if (lastSegment !== currFocusDescriber) setCurrFocusDescriber(lastSegment);\n }, [currFocusDescriber, lastSegment, latestInteractionRegion]);\n\n const trackFocusResetter = useCallback(() => {\n if (latestInteractionRegion !== '') setLatestInteractionRegion('');\n if (currFocusDescriber !== '') setCurrFocusDescriber('');\n }, [currFocusDescriber, latestInteractionRegion]);\n\n const handleComponentBlurs = useCallback(() => {\n /* our code base is trying to avoid side-effects and we also try to be imperative\n due to how \"portals\" work, when we open a portal the \"blur\" event is triggered\n we need to distinguish between\n - a blur that is caused by a portal opening\n vs\n - a blur that is caused by a user moving focus to another element\n we can do this by checking the currFocusDescriber and latestInteractionRegion\n we know that blur is triggered by portal opening when:\n - latestInteractionRegion === 'calendar-days' && currFocusDescriber === 'calendar-metafocused-day'\n (this is the case when we open the calendar or calendarWithTimeWheel with a preselected date)\n - latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month'\n (this is the case when we open the calendar or calendarWithTimeWheel without a preselected date)\n - latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-hour'\n (this is the case when we open any timewheel ONLY)\n */\n let shouldShortCircuit = false;\n // preselected date OR filled date value OR onCalendarOpenFocusedDay is present\n if (latestInteractionRegion === 'calendar-days' && currFocusDescriber === 'calendar-metafocused-day')\n shouldShortCircuit = true;\n // empty date value AND no onCalendarOpenFocusedDay is present\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month')\n shouldShortCircuit = true;\n\n // only time wheel is present in the contextual region\n if (latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-hour')\n shouldShortCircuit = true;\n\n if (shouldShortCircuit) return;\n trackFocusResetter();\n }, [currFocusDescriber, latestInteractionRegion, trackFocusResetter]);\n\n return useMemo(\n () => ({\n latestInteractionRegion,\n setLatestInteractionRegion,\n currFocusDescriber,\n setCurrFocusDescriber,\n trackFocusResetter,\n trackFocusMonthInput: () => {\n if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');\n if (currFocusDescriber !== 'month-input') setCurrFocusDescriber('month-input');\n },\n trackFocusDayInput: () => {\n if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');\n if (currFocusDescriber !== 'day-input') setCurrFocusDescriber('day-input');\n },\n trackFocusYearInput: () => {\n if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');\n if (currFocusDescriber !== 'year-input') setCurrFocusDescriber('year-input');\n },\n trackFocusHourInput: () => {\n if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');\n if (currFocusDescriber !== 'hour-input') setCurrFocusDescriber('hour-input');\n },\n trackFocusMinuteInput: () => {\n if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');\n if (currFocusDescriber !== 'minute-input') setCurrFocusDescriber('minute-input');\n },\n trackFocusMeridiemInput: () => {\n if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');\n if (currFocusDescriber !== 'meridiem-input') setCurrFocusDescriber('meridiem-input');\n },\n trackFocusClearBtn: () => {\n if (latestInteractionRegion !== 'clear-btn') setLatestInteractionRegion('clear-btn');\n if (currFocusDescriber !== 'clear-btn') setCurrFocusDescriber('clear-btn');\n },\n trackFocusDatePickerIcon: () => {\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (currFocusDescriber !== 'date-picker-icon') setCurrFocusDescriber('date-picker-icon');\n },\n trackFocusTimePickerIcon: () => {\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (currFocusDescriber !== 'time-picker-icon') setCurrFocusDescriber('time-picker-icon');\n },\n trackFocusDatetimePickerIcon: () => {\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (currFocusDescriber !== 'datetime-picker-icon') setCurrFocusDescriber('datetime-picker-icon');\n },\n trackFocusCalendarPrevMonth: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-prev-month') setCurrFocusDescriber('calendar-prev-month');\n },\n trackFocusCalendarNextMonth: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-next-month') setCurrFocusDescriber('calendar-next-month');\n },\n trackFocusCalendarPrevYear: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-prev-year') setCurrFocusDescriber('calendar-prev-year');\n },\n trackFocusCalendarNextYear: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-next-year') setCurrFocusDescriber('calendar-next-year');\n },\n trackFocusCalendarMetafocusedDay: () => {\n if (latestInteractionRegion !== 'calendar-days') setLatestInteractionRegion('calendar-days');\n if (currFocusDescriber !== 'calendar-metafocused-day') setCurrFocusDescriber('calendar-metafocused-day');\n },\n trackFocusTimewheelCurrHour: () => {\n if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');\n if (currFocusDescriber !== 'timewheel-curr-hour') setCurrFocusDescriber('timewheel-curr-hour');\n },\n trackFocusTimewheelCurrMinute: () => {\n if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');\n if (currFocusDescriber !== 'timewheel-curr-minute') setCurrFocusDescriber('timewheel-curr-minute');\n },\n trackFocusTimewheelCurrMeridiem: () => {\n if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');\n if (currFocusDescriber !== 'timewheel-curr-meridiem') setCurrFocusDescriber('timewheel-curr-meridiem');\n },\n trackFocusPicker,\n trackFocusFirstSegment,\n trackFocusLastSegment,\n handleComponentBlurs,\n }),\n [\n latestInteractionRegion,\n currFocusDescriber,\n trackFocusResetter,\n trackFocusPicker,\n trackFocusFirstSegment,\n trackFocusLastSegment,\n handleComponentBlurs,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,mBAA+C;AAwCxC,MAAM,kBAAkB,CAAC,EAAE,SAAS,MAAM,MAAc;AAC7D,QAAM,CAAC,yBAAyB,0BAA0B,QAAI,uBAAkC,EAAE;AAClG,QAAM,CAAC,oBAAoB,qBAAqB,QAAI,uBAA6B,EAAE;AACnF,QAAM,EAAE,cAAc,YAAY,IAAI;AACtC,QAAM,EAAE,gBAAgB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-lines */\n/* eslint-disable indent */\n/* eslint-disable max-params */\n/* eslint-disable max-statements */\nimport { useCallback, useMemo, useState } from 'react';\nimport type { useGetReferences } from './useGetReferences.js';\nimport type { useGetFlags } from './useGetFlags.js';\n\ntype LatestInteractionRegion =\n | 'calendar-days'\n | 'calendar-head'\n | 'timewheel'\n | 'date-inputs'\n | 'time-inputs'\n | 'clear-btn'\n | 'picker-icon'\n | '';\ntype CurrFocusDescriber =\n | 'first-segment'\n | 'month-input'\n | 'day-input'\n | 'year-input'\n | 'hour-input'\n | 'minute-input'\n | 'meridiem-input'\n | 'last-segment'\n | 'clear-btn'\n | 'date-picker-icon'\n | 'time-picker-icon'\n | 'datetime-picker-icon'\n | 'calendar-prev-month'\n | 'calendar-next-month'\n | 'calendar-prev-year'\n | 'calendar-next-year'\n | 'calendar-metafocused-day'\n | 'timewheel-curr-hour'\n | 'timewheel-curr-minute'\n | 'timewheel-curr-meridiem'\n | '';\n\ninterface Config {\n DOMRefs: ReturnType<typeof useGetReferences>;\n flags: ReturnType<typeof useGetFlags>;\n}\nexport const useFocusTracker = ({ DOMRefs, flags }: Config) => {\n const [latestInteractionRegion, setLatestInteractionRegion] = useState<LatestInteractionRegion>('');\n const [currFocusDescriber, setCurrFocusDescriber] = useState<CurrFocusDescriber>('');\n const { firstSegment, lastSegment } = DOMRefs;\n const { isDateSelector, isTimeSelector, isControllerOnly } = flags;\n\n const trackFocusPicker = useCallback(() => {\n let picker = 'datetime-picker-icon' as CurrFocusDescriber;\n if (isDateSelector) picker = 'date-picker-icon';\n if (isTimeSelector) picker = 'time-picker-icon';\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (picker !== currFocusDescriber) setCurrFocusDescriber(picker);\n }, [currFocusDescriber, isDateSelector, isTimeSelector, latestInteractionRegion]);\n\n /*\n depending on the polymorphic props, the first segment can be:\n - month-input (when date inputs are present)\n - hour-input (when ONLY time inputs are present)\n - datetime-picker-icon (when picker is present and we are selecting both date and time)\n - date-picker-icon (when picker is present and no time selection is involved)\n - time-picker-icon (when picker is present and no date selection is involved)\n */\n const trackFocusFirstSegment = useCallback(() => {\n let region = 'date-inputs' as LatestInteractionRegion;\n if (firstSegment === 'hour-input') region = 'time-inputs';\n if (firstSegment === 'date-picker-icon') region = 'picker-icon';\n if (firstSegment === 'time-picker-icon') region = 'picker-icon';\n if (firstSegment === 'datetime-picker-icon') region = 'picker-icon';\n if (region !== latestInteractionRegion) setLatestInteractionRegion(region);\n if (firstSegment !== currFocusDescriber) setCurrFocusDescriber(firstSegment);\n }, [currFocusDescriber, firstSegment, latestInteractionRegion]);\n\n /*\n depending on the polymorphic props, the last segment can be:\n - year-input (when ONLY date inputs are present)\n - meridiem-input (when time inputs are present)\n - clear-btn (when clearable is true and there is no picker)\n - datetime-picker-icon (when picker is present and we are selecting both date and time)\n - date-picker-icon (when picker is present and no time selection is involved)\n - time-picker-icon (when picker is present and no date selection is involved)\n */\n const trackFocusLastSegment = useCallback(() => {\n let region = 'date-inputs' as LatestInteractionRegion;\n if (lastSegment === 'meridiem-input') region = 'time-inputs';\n if (lastSegment === 'clear-btn') region = 'clear-btn';\n if (lastSegment === 'date-picker-icon') region = 'picker-icon';\n if (lastSegment === 'time-picker-icon') region = 'picker-icon';\n if (lastSegment === 'datetime-picker-icon') region = 'picker-icon';\n if (region !== latestInteractionRegion) setLatestInteractionRegion(region);\n if (lastSegment !== currFocusDescriber) setCurrFocusDescriber(lastSegment);\n }, [currFocusDescriber, lastSegment, latestInteractionRegion]);\n\n const trackFocusResetter = useCallback(() => {\n if (latestInteractionRegion !== '') setLatestInteractionRegion('');\n if (currFocusDescriber !== '') setCurrFocusDescriber('');\n }, [currFocusDescriber, latestInteractionRegion]);\n\n const handleComponentBlurs = useCallback(\n (e: React.FocusEvent<HTMLElement>) => {\n /**\n * In controller only mode, we want to reset the focus tracker when the user moves focus outside of the component\n * this is because in controller only mode we don't have a portal that we need to account for,\n * so any blur event that happens when we are in controller only mode should be treated as a user moving focus outside of the component\n */\n if (isControllerOnly) {\n const relatedTarget = e.relatedTarget as HTMLElement | null;\n if (relatedTarget && (e.currentTarget as HTMLElement).contains(relatedTarget)) {\n return;\n }\n trackFocusResetter();\n return;\n }\n /* our code base is trying to avoid side-effects and we also try to be imperative\n due to how \"portals\" work, when we open a portal the \"blur\" event is triggered\n we need to distinguish between\n - a blur that is caused by a portal opening\n vs\n - a blur that is caused by a user moving focus to another element\n we can do this by checking the currFocusDescriber and latestInteractionRegion\n we know that blur is triggered by portal opening when:\n - latestInteractionRegion === 'calendar-days' && currFocusDescriber === 'calendar-metafocused-day'\n (this is the case when we open the calendar or calendarWithTimeWheel with a preselected date)\n - latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month'\n (this is the case when we open the calendar or calendarWithTimeWheel without a preselected date)\n - latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-hour'\n (this is the case when we open any timewheel ONLY)\n */\n let shouldShortCircuit = false;\n // preselected date OR filled date value OR onCalendarOpenFocusedDay is present\n if (latestInteractionRegion === 'calendar-days' && currFocusDescriber === 'calendar-metafocused-day')\n shouldShortCircuit = true;\n // empty date value AND no onCalendarOpenFocusedDay is present\n if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month')\n shouldShortCircuit = true;\n\n // only time wheel is present in the contextual region\n if (latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-hour')\n shouldShortCircuit = true;\n\n if (shouldShortCircuit) return;\n trackFocusResetter();\n },\n [currFocusDescriber, isControllerOnly, latestInteractionRegion, trackFocusResetter],\n );\n\n return useMemo(\n () => ({\n latestInteractionRegion,\n setLatestInteractionRegion,\n currFocusDescriber,\n setCurrFocusDescriber,\n trackFocusResetter,\n trackFocusMonthInput: () => {\n if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');\n if (currFocusDescriber !== 'month-input') setCurrFocusDescriber('month-input');\n },\n trackFocusDayInput: () => {\n if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');\n if (currFocusDescriber !== 'day-input') setCurrFocusDescriber('day-input');\n },\n trackFocusYearInput: () => {\n if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');\n if (currFocusDescriber !== 'year-input') setCurrFocusDescriber('year-input');\n },\n trackFocusHourInput: () => {\n if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');\n if (currFocusDescriber !== 'hour-input') setCurrFocusDescriber('hour-input');\n },\n trackFocusMinuteInput: () => {\n if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');\n if (currFocusDescriber !== 'minute-input') setCurrFocusDescriber('minute-input');\n },\n trackFocusMeridiemInput: () => {\n if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');\n if (currFocusDescriber !== 'meridiem-input') setCurrFocusDescriber('meridiem-input');\n },\n trackFocusClearBtn: () => {\n if (latestInteractionRegion !== 'clear-btn') setLatestInteractionRegion('clear-btn');\n if (currFocusDescriber !== 'clear-btn') setCurrFocusDescriber('clear-btn');\n },\n trackFocusDatePickerIcon: () => {\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (currFocusDescriber !== 'date-picker-icon') setCurrFocusDescriber('date-picker-icon');\n },\n trackFocusTimePickerIcon: () => {\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (currFocusDescriber !== 'time-picker-icon') setCurrFocusDescriber('time-picker-icon');\n },\n trackFocusDatetimePickerIcon: () => {\n if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');\n if (currFocusDescriber !== 'datetime-picker-icon') setCurrFocusDescriber('datetime-picker-icon');\n },\n trackFocusCalendarPrevMonth: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-prev-month') setCurrFocusDescriber('calendar-prev-month');\n },\n trackFocusCalendarNextMonth: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-next-month') setCurrFocusDescriber('calendar-next-month');\n },\n trackFocusCalendarPrevYear: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-prev-year') setCurrFocusDescriber('calendar-prev-year');\n },\n trackFocusCalendarNextYear: () => {\n if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');\n if (currFocusDescriber !== 'calendar-next-year') setCurrFocusDescriber('calendar-next-year');\n },\n trackFocusCalendarMetafocusedDay: () => {\n if (latestInteractionRegion !== 'calendar-days') setLatestInteractionRegion('calendar-days');\n if (currFocusDescriber !== 'calendar-metafocused-day') setCurrFocusDescriber('calendar-metafocused-day');\n },\n trackFocusTimewheelCurrHour: () => {\n if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');\n if (currFocusDescriber !== 'timewheel-curr-hour') setCurrFocusDescriber('timewheel-curr-hour');\n },\n trackFocusTimewheelCurrMinute: () => {\n if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');\n if (currFocusDescriber !== 'timewheel-curr-minute') setCurrFocusDescriber('timewheel-curr-minute');\n },\n trackFocusTimewheelCurrMeridiem: () => {\n if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');\n if (currFocusDescriber !== 'timewheel-curr-meridiem') setCurrFocusDescriber('timewheel-curr-meridiem');\n },\n trackFocusPicker,\n trackFocusFirstSegment,\n trackFocusLastSegment,\n handleComponentBlurs,\n }),\n [\n latestInteractionRegion,\n currFocusDescriber,\n trackFocusResetter,\n trackFocusPicker,\n trackFocusFirstSegment,\n trackFocusLastSegment,\n handleComponentBlurs,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADKvB,mBAA+C;AAwCxC,MAAM,kBAAkB,CAAC,EAAE,SAAS,MAAM,MAAc;AAC7D,QAAM,CAAC,yBAAyB,0BAA0B,QAAI,uBAAkC,EAAE;AAClG,QAAM,CAAC,oBAAoB,qBAAqB,QAAI,uBAA6B,EAAE;AACnF,QAAM,EAAE,cAAc,YAAY,IAAI;AACtC,QAAM,EAAE,gBAAgB,gBAAgB,iBAAiB,IAAI;AAE7D,QAAM,uBAAmB,0BAAY,MAAM;AACzC,QAAI,SAAS;AACb,QAAI,eAAgB,UAAS;AAC7B,QAAI,eAAgB,UAAS;AAC7B,QAAI,4BAA4B,cAAe,4BAA2B,aAAa;AACvF,QAAI,WAAW,mBAAoB,uBAAsB,MAAM;AAAA,EACjE,GAAG,CAAC,oBAAoB,gBAAgB,gBAAgB,uBAAuB,CAAC;AAUhF,QAAM,6BAAyB,0BAAY,MAAM;AAC/C,QAAI,SAAS;AACb,QAAI,iBAAiB,aAAc,UAAS;AAC5C,QAAI,iBAAiB,mBAAoB,UAAS;AAClD,QAAI,iBAAiB,mBAAoB,UAAS;AAClD,QAAI,iBAAiB,uBAAwB,UAAS;AACtD,QAAI,WAAW,wBAAyB,4B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__export(index_exports, {
|
|
|
37
37
|
DSControlledDateTimePickerSlotsFlatten: () => import_constants.DSControlledDateTimePickerSlotsFlatten,
|
|
38
38
|
DSControlledDateTimePickerWithSchema: () => import_ControlledDateTimePicker.DSControlledDateTimePickerWithSchema,
|
|
39
39
|
deconstructValuesFromDateString: () => import_stringHelpers.deconstructValuesFromDateString,
|
|
40
|
+
getAriaDayFromDateString: () => import_stringHelpers.getAriaDayFromDateString,
|
|
40
41
|
getDateStringFromDay: () => import_dateHelpers.getDateStringFromDay,
|
|
41
42
|
getDateValuesFromDate: () => import_dateHelpers.getDateValuesFromDate,
|
|
42
43
|
getDayFromDateString: () => import_dateHelpers.getDayFromDateString,
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export {\n ControlledDateTimePickerDatatestid,\n ControlledDateTimePickerDatatestidFlattened,\n DSControlledDateTimePickerName,\n DSControlledDateTimePickerSlots,\n DSControlledDateTimePickerSlotsFlatten,\n} from './constants/index.js';\nexport { DSControlledDateTimePicker, DSControlledDateTimePickerWithSchema } from './ControlledDateTimePicker.js';\n\nexport { CONTROLLED_DATE_TIME_PICKER_TYPES } from './constants/ControlledDateTimePickerTypes.js';\nexport { type DSControlledDateTimePickerT } from './react-desc-prop-types.js';\nexport {\n getDateStringFromDay,\n getDateValuesFromDate,\n getDayFromDateString,\n getValidationDateStringMetaInfo,\n} from './utils/dateHelpers.js';\nexport { getValidationDateTimeStringMetaInfo } from './utils/dateTimeHelpers.js';\nexport {\n deconstructValuesFromDateString,\n isValidDateString,\n isValidTimeString,\n prependStringWithPlaceHolders,\n} from './utils/stringHelpers.js';\nexport { getValidationTimeStringMetaInfo } from './utils/timeHelpers.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAMO;AACP,sCAAiF;AAEjF,2CAAkD;AAElD,yBAKO;AACP,6BAAoD;AACpD,
|
|
4
|
+
"sourcesContent": ["export {\n ControlledDateTimePickerDatatestid,\n ControlledDateTimePickerDatatestidFlattened,\n DSControlledDateTimePickerName,\n DSControlledDateTimePickerSlots,\n DSControlledDateTimePickerSlotsFlatten,\n} from './constants/index.js';\nexport { DSControlledDateTimePicker, DSControlledDateTimePickerWithSchema } from './ControlledDateTimePicker.js';\n\nexport { CONTROLLED_DATE_TIME_PICKER_TYPES } from './constants/ControlledDateTimePickerTypes.js';\nexport { type DSControlledDateTimePickerT } from './react-desc-prop-types.js';\nexport {\n getDateStringFromDay,\n getDateValuesFromDate,\n getDayFromDateString,\n getValidationDateStringMetaInfo,\n} from './utils/dateHelpers.js';\nexport { getValidationDateTimeStringMetaInfo } from './utils/dateTimeHelpers.js';\nexport {\n deconstructValuesFromDateString,\n isValidDateString,\n isValidTimeString,\n prependStringWithPlaceHolders,\n getAriaDayFromDateString,\n} from './utils/stringHelpers.js';\nexport { getValidationTimeStringMetaInfo } from './utils/timeHelpers.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAMO;AACP,sCAAiF;AAEjF,2CAAkD;AAElD,yBAKO;AACP,6BAAoD;AACpD,2BAMO;AACP,yBAAgD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -84,7 +84,7 @@ const ControlledDateTimePickerContent = () => {
|
|
|
84
84
|
"data-testid": import_constants.ControlledDateTimePickerDatatestid.CONTAINER,
|
|
85
85
|
getOwnerProps: getProps,
|
|
86
86
|
onlyPicker,
|
|
87
|
-
readOnlyStyles: readOnly || applyAriaDisabled,
|
|
87
|
+
$readOnlyStyles: readOnly || applyAriaDisabled,
|
|
88
88
|
...styledsAttrs,
|
|
89
89
|
...(0, import_lodash_es.omit)(globalAttrs, "tabIndex", "autoFocus"),
|
|
90
90
|
...xstyledAttrs,
|
|
@@ -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 { omit } from 'lodash-es';\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 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={handleComponentBlurs}\n data-testid={ControlledDateTimePickerDatatestid.CONTAINER}\n getOwnerProps={getProps}\n onlyPicker={onlyPicker}\n readOnlyStyles={readOnly || applyAriaDisabled}\n {...styledsAttrs}\n {...omit(globalAttrs, 'tabIndex', 'autoFocus')}\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;AD8CnB;AA7CJ,qBAAqB;AACrB,uBAAqB;AACrB,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,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;AAC/B,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,oDAAmC;AAAA,MAChD,eAAe;AAAA,MACf;AAAA,MACA,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\nimport { Grid } from '@elliemae/ds-grid';\nimport { omit } from 'lodash-es';\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 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={handleComponentBlurs}\n data-testid={ControlledDateTimePickerDatatestid.CONTAINER}\n getOwnerProps={getProps}\n onlyPicker={onlyPicker}\n $readOnlyStyles={readOnly || applyAriaDisabled}\n {...styledsAttrs}\n {...omit(globalAttrs, 'tabIndex', 'autoFocus')}\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;AD8CnB;A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,kCAAY,IAAK;AAAA,UACjD,gBAAgB,4CAAC,oCAAa,IAAK;AAAA,WACtC,IACE;AAAA;AAAA;AAAA,EACN,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,6 +36,8 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_constants = require("../../constants/index.js");
|
|
38
38
|
var import_Styleds = require("../Styleds.js");
|
|
39
|
+
var import_constants2 = require("../../utils/constants.js");
|
|
40
|
+
var import_numberHelpers = require("../../utils/numberHelpers.js");
|
|
39
41
|
const regExpNumbers = /^[0-9]+$/;
|
|
40
42
|
const isInvalidDay = (day) => {
|
|
41
43
|
if (day === "") return false;
|
|
@@ -70,6 +72,7 @@ const DDInput = import_react.default.memo(
|
|
|
70
72
|
},
|
|
71
73
|
[onChange]
|
|
72
74
|
);
|
|
75
|
+
const dayNum = (0, import_numberHelpers.convertToPositiveNumberIfPossible)(value);
|
|
73
76
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
77
|
import_Styleds.StyledDateInput,
|
|
75
78
|
{
|
|
@@ -90,7 +93,12 @@ const DDInput = import_react.default.memo(
|
|
|
90
93
|
"aria-disabled": applyAriaDisabled,
|
|
91
94
|
"aria-invalid": hasError,
|
|
92
95
|
getOwnerProps: getProps,
|
|
93
|
-
readOnly
|
|
96
|
+
readOnly,
|
|
97
|
+
role: "spinbutton",
|
|
98
|
+
"aria-valuemin": 1,
|
|
99
|
+
"aria-valuemax": 31,
|
|
100
|
+
"aria-valuenow": dayNum === -1 ? void 0 : dayNum,
|
|
101
|
+
"aria-valuetext": dayNum === -1 ? "empty" : import_constants2.announcableCardinalDays[dayNum]
|
|
94
102
|
}
|
|
95
103
|
);
|
|
96
104
|
}
|
|
@@ -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';\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 ariaCurrentValueForInputs: 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 ariaCurrentValueForInputs,\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 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 input field, ${ariaCurrentValueForInputs}`}\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 />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": ["React"]
|
|
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 ariaCurrentValueForInputs: 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 ariaCurrentValueForInputs,\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 input field, ${ariaCurrentValueForInputs}`}\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 aria-valuenow={dayNum === -1 ? undefined : 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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}
|
|
@@ -37,6 +37,8 @@ var import_ds_system = require("@elliemae/ds-system");
|
|
|
37
37
|
var import_react = __toESM(require("react"));
|
|
38
38
|
var import_constants = require("../../constants/index.js");
|
|
39
39
|
var import_Styleds = require("../Styleds.js");
|
|
40
|
+
var import_numberHelpers = require("../../utils/numberHelpers.js");
|
|
41
|
+
var import_constants2 = require("../../utils/constants.js");
|
|
40
42
|
const regExpNumbers = /^[0-9]+$/;
|
|
41
43
|
const isInvalidMonth = (month) => {
|
|
42
44
|
if (month === "") return false;
|
|
@@ -86,6 +88,7 @@ const MMInput = import_react.default.memo(
|
|
|
86
88
|
}
|
|
87
89
|
return handleRef;
|
|
88
90
|
}, [handleRef, innerRef]);
|
|
91
|
+
const monthNum = (0, import_numberHelpers.convertToPositiveNumberIfPossible)(value);
|
|
89
92
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
93
|
import_Styleds.StyledMonthInput,
|
|
91
94
|
{
|
|
@@ -104,7 +107,12 @@ const MMInput = import_react.default.memo(
|
|
|
104
107
|
"aria-disabled": applyAriaDisabled,
|
|
105
108
|
"aria-invalid": hasError,
|
|
106
109
|
getOwnerProps: getProps,
|
|
107
|
-
readOnly
|
|
110
|
+
readOnly,
|
|
111
|
+
role: "spinbutton",
|
|
112
|
+
"aria-valuemin": 1,
|
|
113
|
+
"aria-valuemax": 12,
|
|
114
|
+
"aria-valuenow": monthNum === -1 ? void 0 : monthNum,
|
|
115
|
+
"aria-valuetext": monthNum === -1 ? "empty" : import_constants2.monthNames[monthNum - 1]
|
|
108
116
|
}
|
|
109
117
|
);
|
|
110
118
|
}
|
|
@@ -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';\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 ariaCurrentValueForInputs: 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 ariaCurrentValueForInputs,\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 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 input field, ${ariaCurrentValueForInputs}`}\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 />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": ["React"]
|
|
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 ariaCurrentValueForInputs: 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 ariaCurrentValueForInputs,\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 input field, ${ariaCurrentValueForInputs}`}\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 aria-valuenow={monthNum === -1 ? undefined : 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,cAAY,sBAAsB,yBAAyB;AAAA,QAC3D,eAAa,oDAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,iBAAe;AAAA,QACf,gBAAc;AAAA,QACd,eAAe;AAAA,QACf;AAAA,QACA,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,iBAAe;AAAA,QACf,iBAAe,aAAa,KAAK,SAAY;AAAA,QAC7C,kBAAgB,aAAa,KAAK,UAAU,6BAAW,WAAW,CAAC;AAAA;AAAA,IACrE;AAAA,EAEJ;AACF;",
|
|
6
|
+
"names": ["import_constants", "React"]
|
|
7
7
|
}
|
|
@@ -36,6 +36,8 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_constants = require("../../constants/index.js");
|
|
38
38
|
var import_Styleds = require("../Styleds.js");
|
|
39
|
+
var import_numberHelpers = require("../../utils/numberHelpers.js");
|
|
40
|
+
var import_stringHelpers = require("../../utils/stringHelpers.js");
|
|
39
41
|
const regExpNumbers = /^[0-9]+$/;
|
|
40
42
|
const isInvalidYear = (year) => {
|
|
41
43
|
if (year === "") return false;
|
|
@@ -70,6 +72,7 @@ const YYYYInput = import_react.default.memo(
|
|
|
70
72
|
},
|
|
71
73
|
[onChange]
|
|
72
74
|
);
|
|
75
|
+
const yearNum = (0, import_numberHelpers.convertToPositiveNumberIfPossible)(value);
|
|
73
76
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
77
|
import_Styleds.StyledYearInput,
|
|
75
78
|
{
|
|
@@ -90,7 +93,12 @@ const YYYYInput = import_react.default.memo(
|
|
|
90
93
|
"aria-disabled": applyAriaDisabled,
|
|
91
94
|
"aria-invalid": hasError,
|
|
92
95
|
getOwnerProps: getProps,
|
|
93
|
-
readOnly
|
|
96
|
+
readOnly,
|
|
97
|
+
role: "spinbutton",
|
|
98
|
+
"aria-valuemin": 0,
|
|
99
|
+
"aria-valuemax": 9999,
|
|
100
|
+
"aria-valuenow": yearNum === -1 ? void 0 : yearNum,
|
|
101
|
+
"aria-valuetext": yearNum === -1 ? "empty" : (0, import_stringHelpers.fillStringWithPlaceHolders)(`${yearNum}`, 4, "0")
|
|
94
102
|
}
|
|
95
103
|
);
|
|
96
104
|
}
|
|
@@ -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';\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 ariaCurrentValueForInputs: 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 ariaCurrentValueForInputs,\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 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 input field, ${ariaCurrentValueForInputs}`}\n disabled={disabled}\n aria-disabled={applyAriaDisabled}\n aria-invalid={hasError}\n getOwnerProps={getProps}\n readOnly={readOnly}\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 ariaCurrentValueForInputs: 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 ariaCurrentValueForInputs,\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 input field, ${ariaCurrentValueForInputs}`}\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 aria-valuenow={yearNum === -1 ? undefined : 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,cAAY,qBAAqB,yBAAyB;AAAA,QAC1D;AAAA,QACA,iBAAe;AAAA,QACf,gBAAc;AAAA,QACd,eAAe;AAAA,QACf;AAAA,QACA,MAAK;AAAA,QACL,iBAAe;AAAA,QACf,iBAAe;AAAA,QACf,iBAAe,YAAY,KAAK,SAAY;AAAA,QAC5C,kBAAgB,YAAY,KAAK,cAAU,iDAA2B,GAAG,OAAO,IAAI,GAAG,GAAG;AAAA;AAAA,IAC5F;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -53,7 +53,7 @@ const CalendarContent = ({ className = "" }) => {
|
|
|
53
53
|
className,
|
|
54
54
|
"data-testid": import_constants.ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR,
|
|
55
55
|
getOwnerProps: getProps,
|
|
56
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Styleds.StyledCalendarWrapper, { readOnlyStyles: readOnly || applyAriaDisabled, children: [
|
|
56
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Styleds.StyledCalendarWrapper, { $readOnlyStyles: readOnly || applyAriaDisabled, children: [
|
|
57
57
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CalendarHead.CalendarHead, {}),
|
|
58
58
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CalendarBody.CalendarBody, { weekRowsNum: daysMatrixByWeekday.length }),
|
|
59
59
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CalendarFooter.CalendarFooter, {})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/CalendarContent.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-len */\nimport { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../constants/index.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarBody } from './CalendarBody.js';\nimport { CalendarContext } from './CalendarContext.js';\nimport { CalendarFooter } from './CalendarFooter.js';\nimport { CalendarHead } from './CalendarHead.js';\nimport { StyledCalendarWrapper, StyledShadowWrapper } from './Styleds.js';\n\n// ({ className = '' }: { className?: string })\n// <StyledShadowWrapper className={className}>\n// is required for styled-components, without this we can't styled(CalendarContent)...\n// https://stackoverflow.com/questions/52542817/styled-components-not-applying-style-to-custom-functional-react-component\nexport const CalendarContent = ({ className = '' }: { className?: string }): JSX.Element => {\n const {\n getProps,\n props: { readOnly, applyAriaDisabled },\n } = useContext(ControlledDateTimePickerContext);\n const { daysMatrixByWeekday } = useContext(CalendarContext);\n\n return (\n <StyledShadowWrapper\n className={className}\n data-testid={ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR}\n getOwnerProps={getProps}\n >\n <StyledCalendarWrapper readOnlyStyles={readOnly || applyAriaDisabled}>\n <CalendarHead />\n <CalendarBody weekRowsNum={daysMatrixByWeekday.length} />\n <CalendarFooter />\n </StyledCalendarWrapper>\n </StyledShadowWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2BjB;AA1BN,mBAA2B;AAC3B,uBAAmD;AACnD,yCAAgD;AAChD,0BAA6B;AAC7B,6BAAgC;AAChC,4BAA+B;AAC/B,0BAA6B;AAC7B,qBAA2D;AAMpD,MAAM,kBAAkB,CAAC,EAAE,YAAY,GAAG,MAA2C;AAC1F,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAU,kBAAkB;AAAA,EACvC,QAAI,yBAAW,kEAA+B;AAC9C,QAAM,EAAE,oBAAoB,QAAI,yBAAW,sCAAe;AAE1D,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa,oDAAmC,qBAAqB;AAAA,MACrE,eAAe;AAAA,MAEf,uDAAC,wCAAsB,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-len */\nimport { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../constants/index.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { CalendarBody } from './CalendarBody.js';\nimport { CalendarContext } from './CalendarContext.js';\nimport { CalendarFooter } from './CalendarFooter.js';\nimport { CalendarHead } from './CalendarHead.js';\nimport { StyledCalendarWrapper, StyledShadowWrapper } from './Styleds.js';\n\n// ({ className = '' }: { className?: string })\n// <StyledShadowWrapper className={className}>\n// is required for styled-components, without this we can't styled(CalendarContent)...\n// https://stackoverflow.com/questions/52542817/styled-components-not-applying-style-to-custom-functional-react-component\nexport const CalendarContent = ({ className = '' }: { className?: string }): JSX.Element => {\n const {\n getProps,\n props: { readOnly, applyAriaDisabled },\n } = useContext(ControlledDateTimePickerContext);\n const { daysMatrixByWeekday } = useContext(CalendarContext);\n\n return (\n <StyledShadowWrapper\n className={className}\n data-testid={ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR}\n getOwnerProps={getProps}\n >\n <StyledCalendarWrapper $readOnlyStyles={readOnly || applyAriaDisabled}>\n <CalendarHead />\n <CalendarBody weekRowsNum={daysMatrixByWeekday.length} />\n <CalendarFooter />\n </StyledCalendarWrapper>\n </StyledShadowWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2BjB;AA1BN,mBAA2B;AAC3B,uBAAmD;AACnD,yCAAgD;AAChD,0BAA6B;AAC7B,6BAAgC;AAChC,4BAA+B;AAC/B,0BAA6B;AAC7B,qBAA2D;AAMpD,MAAM,kBAAkB,CAAC,EAAE,YAAY,GAAG,MAA2C;AAC1F,QAAM;AAAA,IACJ;AAAA,IACA,OAAO,EAAE,UAAU,kBAAkB;AAAA,EACvC,QAAI,yBAAW,kEAA+B;AAC9C,QAAM,EAAE,oBAAoB,QAAI,yBAAW,sCAAe;AAE1D,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa,oDAAmC,qBAAqB;AAAA,MACrE,eAAe;AAAA,MAEf,uDAAC,wCAAsB,iBAAiB,YAAY,mBAClD;AAAA,oDAAC,oCAAa;AAAA,QACd,4CAAC,oCAAa,aAAa,oBAAoB,QAAQ;AAAA,QACvD,4CAAC,wCAAe;AAAA,SAClB;AAAA;AAAA,EACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/CalendarDaysList.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { Day } from './Day.js';\nimport { StyledWeekDaysListWrapper } from './Styleds.js';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { Day } from './Day.js';\nimport { StyledWeekDaysListWrapper } from './Styleds.js';\nimport type { DSControlledDateTimePickerT } from '../../../react-desc-prop-types.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\n\nexport interface CalendarDaysListPropsT {\n invisibleFirstDay?: DSControlledDateTimePickerT.MetaMonthDay;\n daysMatrixByWeekday: DSControlledDateTimePickerT.MetaMonthDay[][];\n invisibleLastDay?: DSControlledDateTimePickerT.MetaMonthDay;\n innerRef: React.RefObject<HTMLDivElement>;\n}\n\nexport const CalendarDaysList = React.memo(\n ({ invisibleFirstDay, daysMatrixByWeekday, invisibleLastDay, innerRef }: CalendarDaysListPropsT): JSX.Element => {\n const { getProps } = React.useContext(ControlledDateTimePickerContext);\n\n return (\n <div ref={innerRef} role=\"rowgroup\">\n {invisibleFirstDay ? (\n <div role=\"row\" style={{ display: 'none' }}>\n <Day key={`ds-calendar-${invisibleFirstDay.day.toString()}`} metaDay={invisibleFirstDay} isInvisible />\n </div>\n ) : null}\n {daysMatrixByWeekday.map((week, i) => (\n <StyledWeekDaysListWrapper\n key={`ds-calendar-week-${week[0].day.toString()}-${week[6].day.toString()}`}\n role=\"row\"\n aria-rowindex={i + 1}\n cols={['2.4615rem', '2.4615rem', '2.4615rem', '2.4615rem', '2.4615rem', '2.4615rem', '2.4615rem']}\n rows={['2.1538rem']}\n py=\"xxxs\"\n px=\"2px\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n getOwnerProps={getProps}\n >\n {week.map((metaDay, z) => (\n <Day key={`ds-calendar-${metaDay.day.toString()}`} metaDay={metaDay} colIndex={z + 1} />\n ))}\n </StyledWeekDaysListWrapper>\n ))}\n {invisibleLastDay ? (\n <div role=\"row\" style={{ display: 'none' }}>\n <Day key={`ds-calendar-${invisibleLastDay.day.toString()}`} metaDay={invisibleLastDay} isInvisible />\n </div>\n ) : null}\n </div>\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkB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Footer = () => {
|
|
|
51
51
|
role: "alert",
|
|
52
52
|
getOwnerProps: getProps,
|
|
53
53
|
"data-testid": import_constants.ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR,
|
|
54
|
-
readOnlyStyles: readOnly || applyAriaDisabled,
|
|
54
|
+
$readOnlyStyles: readOnly || applyAriaDisabled,
|
|
55
55
|
children: [
|
|
56
56
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
57
|
import_ds_icons.AlertsSmallFill,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/Calendar/CalendarFooter.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { AlertsSmallFill } from '@elliemae/ds-icons';\nimport React, { useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\n\nimport { ControlledDateTimePickerDatatestid } from '../../../constants/index.js';\nimport { CalendarFooterMessage } from './Styleds.js';\nexport const CalendarFooter: React.ComponentType = () => {\n const {\n props: { pickerFooterMsg, hasError, readOnly, applyAriaDisabled },\n getProps,\n isWithTimeWheelToo,\n } = useContext(ControlledDateTimePickerContext);\n if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError)\n return (\n <CalendarFooterMessage\n role=\"alert\"\n getOwnerProps={getProps}\n data-testid={ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR}\n readOnlyStyles={readOnly || applyAriaDisabled}\n >\n <AlertsSmallFill\n width={8}\n height={8}\n color={['danger', '900']}\n style={{ marginRight: '0.5rem', marginBottom: '2px' }}\n />\n {pickerFooterMsg}\n </CalendarFooterMessage>\n );\n return null;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcjB;AAdN,sBAAgC;AAChC,mBAAkC;AAClC,yCAAgD;AAEhD,uBAAmD;AACnD,qBAAsC;AAC/B,MAAM,iBAAsC,MAAM;AACvD,QAAM;AAAA,IACJ,OAAO,EAAE,iBAAiB,UAAU,UAAU,kBAAkB;AAAA,IAChE;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,MAAI,oBAAoB,UAAa,CAAC,sBAAsB;AAC1D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAe;AAAA,QACf,eAAa,oDAAmC,QAAQ;AAAA,QACxD,
|
|
4
|
+
"sourcesContent": ["import { AlertsSmallFill } from '@elliemae/ds-icons';\nimport React, { useContext } from 'react';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\n\nimport { ControlledDateTimePickerDatatestid } from '../../../constants/index.js';\nimport { CalendarFooterMessage } from './Styleds.js';\nexport const CalendarFooter: React.ComponentType = () => {\n const {\n props: { pickerFooterMsg, hasError, readOnly, applyAriaDisabled },\n getProps,\n isWithTimeWheelToo,\n } = useContext(ControlledDateTimePickerContext);\n if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError)\n return (\n <CalendarFooterMessage\n role=\"alert\"\n getOwnerProps={getProps}\n data-testid={ControlledDateTimePickerDatatestid.FOOTERS.CALENDAR}\n $readOnlyStyles={readOnly || applyAriaDisabled}\n >\n <AlertsSmallFill\n width={8}\n height={8}\n color={['danger', '900']}\n style={{ marginRight: '0.5rem', marginBottom: '2px' }}\n />\n {pickerFooterMsg}\n </CalendarFooterMessage>\n );\n return null;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcjB;AAdN,sBAAgC;AAChC,mBAAkC;AAClC,yCAAgD;AAEhD,uBAAmD;AACnD,qBAAsC;AAC/B,MAAM,iBAAsC,MAAM;AACvD,QAAM;AAAA,IACJ,OAAO,EAAE,iBAAiB,UAAU,UAAU,kBAAkB;AAAA,IAChE;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,MAAI,oBAAoB,UAAa,CAAC,sBAAsB;AAC1D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAe;AAAA,QACf,eAAa,oDAAmC,QAAQ;AAAA,QACxD,iBAAiB,YAAY;AAAA,QAE7B;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,OAAO,CAAC,UAAU,KAAK;AAAA,cACvB,OAAO,EAAE,aAAa,UAAU,cAAc,MAAM;AAAA;AAAA,UACtD;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAEJ,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|