@elliemae/ds-form-date-time-picker 3.18.0-next.0 → 3.18.0-next.2
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 +7 -4
- package/dist/cjs/config/useControlledDateTimePicker.js.map +2 -2
- package/dist/cjs/config/useGlobalKeyHandlers.js.map +2 -2
- package/dist/cjs/parts/ClearButton/ClearButton.js +4 -10
- package/dist/cjs/parts/ClearButton/ClearButton.js.map +3 -3
- package/dist/cjs/parts/ControlledDateTimePickerContent.js +3 -8
- package/dist/cjs/parts/ControlledDateTimePickerContent.js.map +3 -3
- package/dist/cjs/parts/DateInputs/DDInput.js +2 -2
- package/dist/cjs/parts/DateInputs/DDInput.js.map +2 -2
- package/dist/cjs/parts/DateInputs/DateInputs.js +5 -19
- package/dist/cjs/parts/DateInputs/DateInputs.js.map +3 -3
- package/dist/cjs/parts/DateInputs/MMInput.js +2 -2
- package/dist/cjs/parts/DateInputs/MMInput.js.map +2 -2
- package/dist/cjs/parts/DateInputs/YYYYInput.js +2 -2
- package/dist/cjs/parts/DateInputs/YYYYInput.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js +3 -8
- package/dist/cjs/parts/Pickers/Calendar/CalendarContent.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js +3 -8
- package/dist/cjs/parts/Pickers/Calendar/CalendarFooter.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/CalendarHead.js +6 -27
- package/dist/cjs/parts/Pickers/Calendar/CalendarHead.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js +4 -16
- package/dist/cjs/parts/Pickers/Calendar/CalendarIconTrigger.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js +6 -9
- package/dist/cjs/parts/Pickers/Calendar/CalendarWrapper.js.map +3 -3
- package/dist/cjs/parts/Pickers/Calendar/Day.js +3 -5
- package/dist/cjs/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/cjs/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +1 -1
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +3 -9
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +3 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +4 -9
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +3 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +4 -9
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +3 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +6 -9
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js.map +3 -3
- package/dist/cjs/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js +5 -22
- package/dist/cjs/parts/Pickers/TimeWheel/HoursList.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js +6 -23
- package/dist/cjs/parts/Pickers/TimeWheel/MeridiemList.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js +5 -22
- package/dist/cjs/parts/Pickers/TimeWheel/MinutesList.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/Styleds.js.map +1 -1
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js +3 -12
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js +3 -8
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +4 -9
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +3 -3
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelWrapper.js +6 -9
- package/dist/cjs/parts/Pickers/TimeWheel/TimeWheelWrapper.js.map +3 -3
- package/dist/cjs/parts/Styleds.js.map +1 -1
- package/dist/cjs/parts/TimeInputs/HHInput.js +2 -2
- package/dist/cjs/parts/TimeInputs/HHInput.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/MeridiemInput.js +2 -2
- package/dist/cjs/parts/TimeInputs/MeridiemInput.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/MinutesInput.js +2 -2
- package/dist/cjs/parts/TimeInputs/MinutesInput.js.map +2 -2
- package/dist/cjs/parts/TimeInputs/TimeInputs.js +5 -19
- package/dist/cjs/parts/TimeInputs/TimeInputs.js.map +3 -3
- package/dist/cjs/sharedTypes.js.map +1 -1
- package/dist/cjs/utils/dateHelpers.js.map +1 -1
- package/dist/esm/config/useControlledDateTimePicker.js +8 -5
- package/dist/esm/config/useControlledDateTimePicker.js.map +2 -2
- package/dist/esm/config/useGlobalKeyHandlers.js.map +2 -2
- package/dist/esm/parts/ClearButton/ClearButton.js +4 -10
- package/dist/esm/parts/ClearButton/ClearButton.js.map +3 -3
- package/dist/esm/parts/ControlledDateTimePickerContent.js +3 -8
- package/dist/esm/parts/ControlledDateTimePickerContent.js.map +3 -3
- package/dist/esm/parts/DateInputs/DDInput.js +2 -2
- package/dist/esm/parts/DateInputs/DDInput.js.map +2 -2
- package/dist/esm/parts/DateInputs/DateInputs.js +5 -19
- package/dist/esm/parts/DateInputs/DateInputs.js.map +3 -3
- package/dist/esm/parts/DateInputs/MMInput.js +2 -2
- package/dist/esm/parts/DateInputs/MMInput.js.map +2 -2
- package/dist/esm/parts/DateInputs/YYYYInput.js +2 -2
- package/dist/esm/parts/DateInputs/YYYYInput.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js +3 -8
- package/dist/esm/parts/Pickers/Calendar/CalendarContent.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js +3 -8
- package/dist/esm/parts/Pickers/Calendar/CalendarFooter.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/CalendarHead.js +6 -27
- package/dist/esm/parts/Pickers/Calendar/CalendarHead.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js +4 -16
- package/dist/esm/parts/Pickers/Calendar/CalendarIconTrigger.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js +6 -9
- package/dist/esm/parts/Pickers/Calendar/CalendarWrapper.js.map +3 -3
- package/dist/esm/parts/Pickers/Calendar/Day.js +3 -5
- package/dist/esm/parts/Pickers/Calendar/Day.js.map +2 -2
- package/dist/esm/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js.map +1 -1
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +3 -9
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js.map +3 -3
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +4 -9
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js.map +3 -3
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +4 -9
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js.map +3 -3
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +6 -9
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js.map +3 -3
- package/dist/esm/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js +5 -22
- package/dist/esm/parts/Pickers/TimeWheel/HoursList.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js +6 -23
- package/dist/esm/parts/Pickers/TimeWheel/MeridiemList.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js +5 -22
- package/dist/esm/parts/Pickers/TimeWheel/MinutesList.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/Styleds.js.map +1 -1
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js +3 -12
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelContent.js.map +2 -2
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js +3 -8
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelFooter.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +4 -9
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js.map +3 -3
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelWrapper.js +6 -9
- package/dist/esm/parts/Pickers/TimeWheel/TimeWheelWrapper.js.map +3 -3
- package/dist/esm/parts/Styleds.js.map +1 -1
- package/dist/esm/parts/TimeInputs/HHInput.js +2 -2
- package/dist/esm/parts/TimeInputs/HHInput.js.map +2 -2
- package/dist/esm/parts/TimeInputs/MeridiemInput.js +2 -2
- package/dist/esm/parts/TimeInputs/MeridiemInput.js.map +2 -2
- package/dist/esm/parts/TimeInputs/MinutesInput.js +2 -2
- package/dist/esm/parts/TimeInputs/MinutesInput.js.map +2 -2
- package/dist/esm/parts/TimeInputs/TimeInputs.js +5 -19
- package/dist/esm/parts/TimeInputs/TimeInputs.js.map +3 -3
- package/dist/esm/utils/dateHelpers.js.map +1 -1
- package/dist/types/config/useControlledDateTimePicker.d.ts +1 -0
- package/dist/types/config/useGlobalKeyHandlers.d.ts +2 -2
- package/dist/types/parts/DateInputs/DDInput.d.ts +3 -2
- package/dist/types/parts/DateInputs/MMInput.d.ts +4 -3
- package/dist/types/parts/DateInputs/YYYYInput.d.ts +3 -2
- package/dist/types/parts/Pickers/Calendar/Styleds.d.ts +11 -11
- package/dist/types/parts/Pickers/CalendarWithTimeWheel/Styleds.d.ts +4 -4
- package/dist/types/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.d.ts +1 -1
- package/dist/types/parts/Pickers/TimeWheel/Styleds.d.ts +24 -0
- package/dist/types/parts/Styleds.d.ts +17 -10
- package/dist/types/parts/TimeInputs/HHInput.d.ts +3 -2
- package/dist/types/parts/TimeInputs/MeridiemInput.d.ts +3 -2
- package/dist/types/parts/TimeInputs/MinutesInput.d.ts +3 -2
- package/dist/types/sharedTypes.d.ts +1 -1
- package/package.json +11 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/TimeWheel/TimeWheelFooter.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { TimeWheelFooterMessage } from './Styleds.js';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { TimeWheelFooterMessage } from './Styleds.js';\n\nexport const TimeWheelFooter: React.ComponentType = () => {\n const {\n props: { pickerFooterMsg, hasError },\n getProps,\n isWithCalendarToo,\n } = useContext(ControlledDateTimePickerContext);\n if (!isWithCalendarToo && pickerFooterMsg !== undefined && hasError)\n return (\n <TimeWheelFooterMessage\n role=\"alert\"\n data-testid={ControlledDateTimePickerDatatestid.FOOTERS.TIMEWHEEL}\n getOwnerProps={getProps}\n >\n {pickerFooterMsg}\n </TimeWheelFooterMessage>\n );\n return null;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADajB;AAbN,mBAAkC;AAClC,gDAAmD;AACnD,yCAAgD;AAChD,qBAAuC;AAEhC,MAAM,kBAAuC,MAAM;AACxD,QAAM;AAAA,IACJ,OAAO,EAAE,iBAAiB,SAAS;AAAA,IACnC;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,MAAI,CAAC,qBAAqB,oBAAoB,UAAa;AACzD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,eAAa,6EAAmC,QAAQ;AAAA,QACxD,eAAe;AAAA,QAEd;AAAA;AAAA,IACH;AAEJ,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -33,8 +33,7 @@ __export(TimeWheelIconTrigger_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(TimeWheelIconTrigger_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react =
|
|
37
|
-
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
var import_react = require("react");
|
|
38
37
|
var import_ds_button = require("@elliemae/ds-button");
|
|
39
38
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
40
39
|
var import_TimeWheelContext = require("./TimeWheelContext.js");
|
|
@@ -44,14 +43,10 @@ var import_Styleds = require("./Styleds.js");
|
|
|
44
43
|
const TimeWheelIconTrigger = () => {
|
|
45
44
|
const { handleSetTriggerRef, handleToggleTimePicker, handlePickerIconKeyDown } = (0, import_react.useContext)(import_TimeWheelContext.TimeWheelContext);
|
|
46
45
|
const {
|
|
47
|
-
props,
|
|
48
46
|
props: { disabled },
|
|
47
|
+
getProps,
|
|
49
48
|
ariaCurrentValueForInputs
|
|
50
49
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
51
|
-
const ariaAndDataProps = import_react.default.useMemo(
|
|
52
|
-
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.PICKER_ICONS.TIMEWHEEL]),
|
|
53
|
-
[props]
|
|
54
|
-
);
|
|
55
50
|
return (0, import_react.useMemo)(
|
|
56
51
|
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
52
|
import_Styleds.StyledIconTriggerButton,
|
|
@@ -65,14 +60,14 @@ const TimeWheelIconTrigger = () => {
|
|
|
65
60
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.PICKER_ICONS.TIMEWHEEL,
|
|
66
61
|
disabled,
|
|
67
62
|
type: "button",
|
|
68
|
-
|
|
63
|
+
getOwnerProps: getProps,
|
|
69
64
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.RecentDocuments, {})
|
|
70
65
|
}
|
|
71
66
|
),
|
|
72
67
|
[
|
|
73
|
-
ariaAndDataProps,
|
|
74
68
|
ariaCurrentValueForInputs,
|
|
75
69
|
disabled,
|
|
70
|
+
getProps,
|
|
76
71
|
handlePickerIconKeyDown,
|
|
77
72
|
handleSetTriggerRef,
|
|
78
73
|
handleToggleTimePicker
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/TimeWheel/TimeWheelIconTrigger.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import React, { useContext, useMemo } from 'react';\nimport { BUTTON_SIZES } from '@elliemae/ds-button';\nimport { RecentDocuments } from '@elliemae/ds-icons';\nimport { TimeWheelContext } from './TimeWheelContext.js';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { StyledIconTriggerButton } from './Styleds.js';\n\n// we memoize the Icon for maximum optimization\n// this is particularly useful due to how usePopper needs to check the references\n// since references are saved in a immutable way, we make sure to shortcircuit useless-re-renders\nexport const TimeWheelIconTrigger = (): JSX.Element => {\n const { handleSetTriggerRef, handleToggleTimePicker, handlePickerIconKeyDown } = useContext(TimeWheelContext);\n const {\n props: { disabled },\n getProps,\n ariaCurrentValueForInputs,\n } = useContext(ControlledDateTimePickerContext);\n return useMemo(\n () => (\n <StyledIconTriggerButton\n aria-label={`time picker context menu trigger, ${ariaCurrentValueForInputs}`}\n buttonType=\"icon\"\n size={BUTTON_SIZES.M}\n innerRef={handleSetTriggerRef}\n onClick={handleToggleTimePicker}\n onKeyDown={handlePickerIconKeyDown}\n data-testid={ControlledDateTimePickerDatatestid.PICKER_ICONS.TIMEWHEEL}\n disabled={disabled}\n type=\"button\"\n getOwnerProps={getProps}\n >\n <RecentDocuments />\n </StyledIconTriggerButton>\n ),\n [\n ariaCurrentValueForInputs,\n disabled,\n getProps,\n handlePickerIconKeyDown,\n handleSetTriggerRef,\n handleToggleTimePicker,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgCf;AAhCR,mBAA2C;AAC3C,uBAA6B;AAC7B,sBAAgC;AAChC,8BAAiC;AACjC,gDAAmD;AACnD,yCAAgD;AAChD,qBAAwC;AAKjC,MAAM,uBAAuB,MAAmB;AACrD,QAAM,EAAE,qBAAqB,wBAAwB,wBAAwB,QAAI,yBAAW,wCAAgB;AAC5G,QAAM;AAAA,IACJ,OAAO,EAAE,SAAS;AAAA,IAClB;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,kEAA+B;AAC9C,aAAO;AAAA,IACL,MACE;AAAA,MAAC;AAAA;AAAA,QACC,cAAY,qCAAqC;AAAA,QACjD,YAAW;AAAA,QACX,MAAM,8BAAa;AAAA,QACnB,UAAU;AAAA,QACV,SAAS;AAAA,QACT,WAAW;AAAA,QACX,eAAa,6EAAmC,aAAa;AAAA,QAC7D;AAAA,QACA,MAAK;AAAA,QACL,eAAe;AAAA,QAEf,sDAAC,mCAAgB;AAAA;AAAA,IACnB;AAAA,IAEF;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -33,31 +33,28 @@ __export(TimeWheelWrapper_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(TimeWheelWrapper_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react =
|
|
37
|
-
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
var import_react = require("react");
|
|
38
37
|
var import_ds_popperjs = require("@elliemae/ds-popperjs");
|
|
39
38
|
var import_ControlledDateTimePickerDatatestid = require("../../../ControlledDateTimePickerDatatestid.js");
|
|
40
39
|
var import_ControlledDateTimePickerCTX = require("../../../ControlledDateTimePickerCTX.js");
|
|
41
40
|
var import_TimeWheelContent = require("./TimeWheelContent.js");
|
|
42
41
|
var import_TimeWheelContext = require("./TimeWheelContext.js");
|
|
42
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
43
|
+
const StyledPopper = (0, import_ds_system.styled)(import_ds_popperjs.DSPopperJS)``;
|
|
43
44
|
const TimeWheelWrapper = () => {
|
|
44
45
|
const { referenceElement, closeTimePicker } = (0, import_react.useContext)(import_TimeWheelContext.TimeWheelContext);
|
|
45
|
-
const { isControllerOnly,
|
|
46
|
-
const ariaAndDataProps = import_react.default.useMemo(
|
|
47
|
-
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.TIMEWHEEL]),
|
|
48
|
-
[props]
|
|
49
|
-
);
|
|
46
|
+
const { isControllerOnly, getProps } = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
50
47
|
if (isControllerOnly)
|
|
51
48
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TimeWheelContent.TimeWheelContent, {});
|
|
52
49
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
53
|
-
|
|
50
|
+
StyledPopper,
|
|
54
51
|
{
|
|
55
52
|
showPopover: true,
|
|
56
53
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.TIMEWHEEL,
|
|
57
54
|
referenceElement,
|
|
58
55
|
withoutArrow: true,
|
|
59
56
|
onClickOutside: closeTimePicker,
|
|
60
|
-
|
|
57
|
+
getOwnerProps: getProps,
|
|
61
58
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TimeWheelContent.TimeWheelContent, {})
|
|
62
59
|
}
|
|
63
60
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/parts/Pickers/TimeWheel/TimeWheelWrapper.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';\nimport { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';\nimport { TimeWheelContent } from './TimeWheelContent.js';\nimport { TimeWheelContext } from './TimeWheelContext.js';\nimport { styled } from '@elliemae/ds-system';\n\nconst StyledPopper = styled(DSPopperJS)``;\n\nexport const TimeWheelWrapper = (): JSX.Element => {\n const { referenceElement, closeTimePicker } = useContext(TimeWheelContext);\n const { isControllerOnly, getProps } = useContext(ControlledDateTimePickerContext);\n if (isControllerOnly) return <TimeWheelContent />;\n return (\n <StyledPopper\n showPopover\n data-testid={ControlledDateTimePickerDatatestid.CONTEXTUAL_MENU.TIMEWHEEL}\n referenceElement={referenceElement}\n withoutArrow\n onClickOutside={closeTimePicker}\n getOwnerProps={getProps}\n >\n <TimeWheelContent />\n </StyledPopper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADaQ;AAb/B,mBAAkC;AAClC,yBAA2B;AAC3B,gDAAmD;AACnD,yCAAgD;AAChD,8BAAiC;AACjC,8BAAiC;AACjC,uBAAuB;AAEvB,MAAM,mBAAe,yBAAO,6BAAU;AAE/B,MAAM,mBAAmB,MAAmB;AACjD,QAAM,EAAE,kBAAkB,gBAAgB,QAAI,yBAAW,wCAAgB;AACzE,QAAM,EAAE,kBAAkB,SAAS,QAAI,yBAAW,kEAA+B;AACjF,MAAI;AAAkB,WAAO,4CAAC,4CAAiB;AAC/C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAW;AAAA,MACX,eAAa,6EAAmC,gBAAgB;AAAA,MAChE;AAAA,MACA,cAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,eAAe;AAAA,MAEf,sDAAC,4CAAiB;AAAA;AAAA,EACpB;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/Styleds.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { styled, th } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { DSControlledDateTimePickerName, DSControlledDateTimePickerSlots } from '../exported-related/theming.js';\n\nconst ResettedInput = styled('input', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.INPUT,\n})`\n border: none;\n box-shadow: none;\n background: none;\n text-align: center;\n height: 100%;\n display: flex;\n align-items: center;\n :focus {\n outline: none;\n }\n padding-top: 2px;\n\n ::placeholder {\n font-weight: ${th.fontWeight('regular')};\n color: ${th.color('neutral-500')};\n }\n`;\n\nexport const StyledSeparator = styled(Grid)`\n padding-top: 2px;\n margin: auto;\n color: neutral-500;\n`;\n\nexport const StyledColonSeparator = styled(Grid)`\n padding-bottom: 1px;\n margin: auto;\n`;\n\nexport const Styled2DigitsInput = styled(ResettedInput)`\n width: 100%;\n height: 100%;\n ${({ disabled }) => (disabled ? `color: #616b7f;` : ``)}\n`;\n\nexport const StyledMin4DigitsInput = styled(ResettedInput)`\n width: 100%;\n height: 100%;\n ${({ disabled }) => (disabled ? `color: #616b7f;` : ``)}\n`;\n\nexport const StyledInputsWrapperGrid = styled(Grid, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CONTAINER,\n})
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { styled, th } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSButtonV2 } from '@elliemae/ds-button';\nimport { DSControlledDateTimePickerName, DSControlledDateTimePickerSlots } from '../exported-related/theming.js';\n\nconst ResettedInput = styled('input', {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.INPUT,\n})`\n border: none;\n box-shadow: none;\n background: none;\n text-align: center;\n height: 100%;\n display: flex;\n align-items: center;\n :focus {\n outline: none;\n }\n padding-top: 2px;\n\n ::placeholder {\n font-weight: ${th.fontWeight('regular')};\n color: ${th.color('neutral-500')};\n }\n`;\n\nexport const StyledSeparator = styled(Grid)`\n padding-top: 2px;\n margin: auto;\n color: neutral-500;\n`;\n\nexport const StyledColonSeparator = styled(Grid)`\n padding-bottom: 1px;\n margin: auto;\n`;\n\nexport const Styled2DigitsInput = styled(ResettedInput)`\n width: 100%;\n height: 100%;\n ${({ disabled }) => (disabled ? `color: #616b7f;` : ``)}\n`;\n\nexport const StyledMin4DigitsInput = styled(ResettedInput)`\n width: 100%;\n height: 100%;\n ${({ disabled }) => (disabled ? `color: #616b7f;` : ``)}\n`;\n\nexport const StyledInputsWrapperGrid = styled(Grid, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CONTAINER,\n})<{ isControllerOnly: boolean; hasError: boolean; justPicker: boolean }>`\n width: max-content;\n align-items: center;\n background-color: white;\n ${({ isControllerOnly }) =>\n isControllerOnly\n ? ``\n : `\n height: 28px; \n border-width: 1px;\n border-style: solid;\n `}\n\n border-color: ${({ theme, hasError, disabled }) => {\n if (hasError) return theme.colors.danger[900];\n if (disabled) return theme.colors.neutral[400];\n return theme.colors.neutral[200];\n }};\n\n border-radius: 2px;\n padding-left: ${({ justPicker }) => (justPicker ? '0' : '2px')};\n\n position: relative;\n ${({ theme, disabled }) => (disabled ? `background-color: ${theme.colors.neutral[100]};` : ``)}\n`;\n\nexport const StyledDateInputsWrapperGrid = styled.div`\n display: grid;\n grid-template-columns: 24px min-content 24px min-content 48px;\n grid-template-rows: min-content;\n padding: 6px 0;\n gap: 0px 0px;\n align-items: center;\n input,\n p {\n margin: 0;\n }\n`;\n\nexport const StyledTimeInputsWrapperGrid = styled.div`\n display: grid;\n grid-template-columns: 24px min-content 24px min-content 24px min-content 24px;\n grid-template-rows: min-content;\n padding: 6px 0;\n gap: 0px 0px;\n align-items: center;\n input,\n p {\n margin: 0;\n }\n`;\n\nexport const StyledPickersIconsWrapperGrid = styled(Grid)<{ isControllerOnly: boolean; hasError: boolean }>`\n position: relative;\n ${({ isControllerOnly }) => (isControllerOnly ? `` : `height: 26px;`)}\n :before {\n content: '';\n position: absolute;\n top: 0px;\n left: -1px;\n width: 100%;\n height: 100%;\n border-radius: 2px;\n ${({ theme, isControllerOnly, hasError }) =>\n isControllerOnly\n ? ``\n : `\n border-left: 1px solid ${hasError ? theme.colors.danger[900] : theme.colors.neutral[200]}\n `}\n }\n`;\n\nexport const StyledFocusWithIn = styled(Grid)`\n position: relative;\n &:focus-within {\n &:after {\n display: block;\n content: ' ';\n position: absolute;\n top: -5px;\n left: -2px;\n width: calc(100% + 4px);\n height: calc(100% + 10px);\n border: 2px solid ${({ theme }) => theme.colors.brand[700]};\n border-radius: 2px;\n pointer-events: none;\n }\n }\n`;\n\nexport const StyledClearButton = styled(DSButtonV2, {\n name: DSControlledDateTimePickerName,\n slot: DSControlledDateTimePickerSlots.CLEAR_BUTTON,\n})<{ shouldDisplay: boolean }>`\n height: 26px;\n position: relative;\n visibility: ${({ shouldDisplay }) => (shouldDisplay ? 'visible' : 'hidden')};\n &:focus {\n &:after {\n z-index: 1;\n }\n }\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAA2B;AAC3B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AAA;AAAA;AAAA;AAAA;AAa3C,MAAM,8BAA8B,wBAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAa3C,MAAM,oCAAgC,yBAAO,mBAAI;AAAA;AAAA,IAEpD,CAAC,EAAE,iBAAiB,MAAO,mBAAmB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASjD,CAAC,EAAE,OAAO,kBAAkB,SAAS,MACrC,mBACI,KACA;AAAA,6BACmB,WAAW,MAAM,OAAO,OAAO,GAAG,IAAI,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAKpF,MAAM,wBAAoB,yBAAO,mBAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAWlB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,GAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAOxD,MAAM,wBAAoB,yBAAO,6BAAY;AAAA,EAClD,MAAM;AAAA,EACN,MAAM,+CAAgC;AACxC,CAAC;AAAA;AAAA;AAAA,gBAGe,CAAC,EAAE,cAAc,MAAO,gBAAgB,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -56,7 +56,7 @@ const HHInput = import_react.default.memo(
|
|
|
56
56
|
contextRef,
|
|
57
57
|
autoFocusHourInput,
|
|
58
58
|
isFocused,
|
|
59
|
-
|
|
59
|
+
getProps
|
|
60
60
|
}) => {
|
|
61
61
|
const validateOnChange = (0, import_react.useCallback)(
|
|
62
62
|
(e) => {
|
|
@@ -87,7 +87,7 @@ const HHInput = import_react.default.memo(
|
|
|
87
87
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.HOUR,
|
|
88
88
|
disabled,
|
|
89
89
|
"aria-disabled": disabled,
|
|
90
|
-
|
|
90
|
+
getOwnerProps: getProps
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
93
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/TimeInputs/HHInput.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { Styled2DigitsInput } from '../Styleds.js';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidHour = (hours: string) => {\n if (hours === '') return false;\n const numberOnly = regExpNumbers.test(hours);\n return hours.length > 2 || hours === '00' || !numberOnly || Number.parseInt(hours, 10) > 12;\n};\ninterface HHInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n autoFocusHourInput: boolean;\n isFocused: boolean;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { Styled2DigitsInput } from '../Styleds.js';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidHour = (hours: string) => {\n if (hours === '') return false;\n const numberOnly = regExpNumbers.test(hours);\n return hours.length > 2 || hours === '00' || !numberOnly || Number.parseInt(hours, 10) > 12;\n};\ninterface HHInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n autoFocusHourInput: boolean;\n isFocused: boolean;\n getProps: ControlledDateTimePickerContextT['getProps'];\n}\nexport const HHInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n placeholder,\n ariaCurrentValueForInputs,\n contextRef,\n autoFocusHourInput,\n isFocused,\n getProps,\n }: HHInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidHour(e.target.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n return (\n <Styled2DigitsInput\n autoFocus={autoFocusHourInput}\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n ref={(DomElem: HTMLInputElement) => {\n contextRef.current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n placeholder={placeholder}\n aria-label={`hours input field ${ariaCurrentValueForInputs}`}\n data-testid={ControlledDateTimePickerDatatestid.TIME_INPUTS.HOUR}\n disabled={disabled}\n aria-disabled={disabled}\n getOwnerProps={getProps}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoDjB;AApDN,mBAAmC;AACnC,qBAAmC;AACnC,gDAAmD;AAInD,MAAM,gBAAgB;AACtB,MAAM,gBAAgB,CAAC,UAAkB;AACvC,MAAI,UAAU;AAAI,WAAO;AACzB,QAAM,aAAa,cAAc,KAAK,KAAK;AAC3C,SAAO,MAAM,SAAS,KAAK,UAAU,QAAQ,CAAC,cAAc,OAAO,SAAS,OAAO,EAAE,IAAI;AAC3F;AAeO,MAAM,UAAU,aAAAA,QAAM;AAAA,EAC3B,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAmC;AACjC,UAAM,uBAAmB;AAAA,MACvB,CAAC,MAA2C;AAC1C,YAAI,cAAc,EAAE,OAAO,KAAK,GAAG;AACjC,YAAE,eAAe;AACjB;AAAA,QACF;AACA,iBAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,QAAQ;AAAA,IACX;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK,CAAC,YAA8B;AAClC,qBAAW,UAAU;AACrB,cAAI;AAAW,qBAAS,QAAQ;AAAA,QAClC;AAAA,QACA;AAAA,QACA,cAAY,qBAAqB;AAAA,QACjC,eAAa,6EAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,iBAAe;AAAA,QACf,eAAe;AAAA;AAAA,IACjB;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -58,7 +58,7 @@ const MeridiemInput = import_react.default.memo(
|
|
|
58
58
|
ariaCurrentValueForInputs,
|
|
59
59
|
contextRef,
|
|
60
60
|
isFocused,
|
|
61
|
-
|
|
61
|
+
getProps
|
|
62
62
|
}) => {
|
|
63
63
|
const validateOnChange = (0, import_react.useCallback)(
|
|
64
64
|
(e) => {
|
|
@@ -88,7 +88,7 @@ const MeridiemInput = import_react.default.memo(
|
|
|
88
88
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.MERIDIEM,
|
|
89
89
|
disabled,
|
|
90
90
|
"aria-disabled": disabled,
|
|
91
|
-
|
|
91
|
+
getOwnerProps: getProps
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
94
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/TimeInputs/MeridiemInput.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { Styled2DigitsInput } from '../Styleds.js';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\n\nconst validFirstDigits = ['a', 'A', 'p', 'P'];\nconst validSecondDigits = ['m', 'M'];\nconst isInvalidMeridiem = (meridiem: string) => {\n if (meridiem === '') return false;\n const [firstDigit, secondDigit] = meridiem.split('');\n const isValidFirstDigit = (meridiem.length < 1 && !firstDigit) || validFirstDigits.includes(firstDigit);\n const isValidSecondDigit = !secondDigit || validSecondDigits.includes(secondDigit);\n return meridiem.length > 2 || !isValidFirstDigit || !isValidSecondDigit;\n};\n\ninterface MeridiemInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n isFocused: boolean;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { Styled2DigitsInput } from '../Styleds.js';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\n\nconst validFirstDigits = ['a', 'A', 'p', 'P'];\nconst validSecondDigits = ['m', 'M'];\nconst isInvalidMeridiem = (meridiem: string) => {\n if (meridiem === '') return false;\n const [firstDigit, secondDigit] = meridiem.split('');\n const isValidFirstDigit = (meridiem.length < 1 && !firstDigit) || validFirstDigits.includes(firstDigit);\n const isValidSecondDigit = !secondDigit || validSecondDigits.includes(secondDigit);\n return meridiem.length > 2 || !isValidFirstDigit || !isValidSecondDigit;\n};\n\ninterface MeridiemInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n isFocused: boolean;\n getProps: ControlledDateTimePickerContextT['getProps'];\n}\nexport const MeridiemInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n placeholder,\n ariaCurrentValueForInputs,\n contextRef,\n isFocused,\n getProps,\n }: MeridiemInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidMeridiem(e?.target?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n return (\n <Styled2DigitsInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n ref={(DomElem: HTMLInputElement) => {\n contextRef.current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n placeholder={placeholder}\n aria-label={`meridiem input field ${ariaCurrentValueForInputs}`}\n data-testid={ControlledDateTimePickerDatatestid.TIME_INPUTS.MERIDIEM}\n disabled={disabled}\n aria-disabled={disabled}\n getOwnerProps={getProps}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsDjB;AAtDN,mBAAmC;AACnC,qBAAmC;AACnC,gDAAmD;AAInD,MAAM,mBAAmB,CAAC,KAAK,KAAK,KAAK,GAAG;AAC5C,MAAM,oBAAoB,CAAC,KAAK,GAAG;AACnC,MAAM,oBAAoB,CAAC,aAAqB;AAC9C,MAAI,aAAa;AAAI,WAAO;AAC5B,QAAM,CAAC,YAAY,WAAW,IAAI,SAAS,MAAM,EAAE;AACnD,QAAM,oBAAqB,SAAS,SAAS,KAAK,CAAC,cAAe,iBAAiB,SAAS,UAAU;AACtG,QAAM,qBAAqB,CAAC,eAAe,kBAAkB,SAAS,WAAW;AACjF,SAAO,SAAS,SAAS,KAAK,CAAC,qBAAqB,CAAC;AACvD;AAeO,MAAM,gBAAgB,aAAAA,QAAM;AAAA,EACjC,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAyC;AACvC,UAAM,uBAAmB;AAAA,MACvB,CAAC,MAA2C;AAC1C,YAAI,kBAAkB,GAAG,QAAQ,KAAK,GAAG;AACvC,YAAE,eAAe;AACjB;AAAA,QACF;AACA,iBAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,QAAQ;AAAA,IACX;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK,CAAC,YAA8B;AAClC,qBAAW,UAAU;AACrB,cAAI;AAAW,qBAAS,QAAQ;AAAA,QAClC;AAAA,QACA;AAAA,QACA,cAAY,wBAAwB;AAAA,QACpC,eAAa,6EAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,iBAAe;AAAA,QACf,eAAe;AAAA;AAAA,IACjB;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -55,7 +55,7 @@ const MinutesInput = import_react.default.memo(
|
|
|
55
55
|
ariaCurrentValueForInputs,
|
|
56
56
|
contextRef,
|
|
57
57
|
isFocused,
|
|
58
|
-
|
|
58
|
+
getProps
|
|
59
59
|
}) => {
|
|
60
60
|
const validateOnChange = (0, import_react.useCallback)(
|
|
61
61
|
(e) => {
|
|
@@ -85,7 +85,7 @@ const MinutesInput = import_react.default.memo(
|
|
|
85
85
|
"data-testid": import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.MINUTE,
|
|
86
86
|
disabled,
|
|
87
87
|
"aria-disabled": disabled,
|
|
88
|
-
|
|
88
|
+
getOwnerProps: getProps
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
91
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/TimeInputs/MinutesInput.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid.js';\nimport { Styled2DigitsInput } from '../Styleds.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidMinute = (minutes: string) => {\n if (minutes === '') return false;\n const numberOnly = regExpNumbers.test(minutes);\n return minutes.length > 2 || !numberOnly || Number.parseInt(minutes, 10) > 60;\n};\ninterface MinutesInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n isFocused: boolean;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from 'react';\nimport { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid.js';\nimport { Styled2DigitsInput } from '../Styleds.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../../sharedTypes.js';\nimport type { ControlledDateTimePickerContextT } from '../../config/useControlledDateTimePicker.js';\n\nconst regExpNumbers = /^[0-9]+$/;\nconst isInvalidMinute = (minutes: string) => {\n if (minutes === '') return false;\n const numberOnly = regExpNumbers.test(minutes);\n return minutes.length > 2 || !numberOnly || Number.parseInt(minutes, 10) > 60;\n};\ninterface MinutesInputsPropsT {\n onChange: DSControlledDateTimePickerInternalsT.OnChangeFunc;\n onBlur: DSControlledDateTimePickerInternalsT.OnBlurFunc;\n onFocus: DSControlledDateTimePickerInternalsT.OnFocusFunc;\n onKeyDown: DSControlledDateTimePickerInternalsT.OnKeyDown;\n value: string;\n disabled: boolean;\n contextRef: React.MutableRefObject<HTMLInputElement | null>;\n placeholder: string;\n ariaCurrentValueForInputs: string;\n isFocused: boolean;\n getProps: ControlledDateTimePickerContextT['getProps'];\n}\nexport const MinutesInput = React.memo(\n ({\n onChange,\n onBlur,\n onFocus,\n onKeyDown,\n value,\n disabled,\n placeholder,\n ariaCurrentValueForInputs,\n contextRef,\n isFocused,\n getProps,\n }: MinutesInputsPropsT): JSX.Element => {\n const validateOnChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isInvalidMinute(e?.target?.value)) {\n e.preventDefault();\n return;\n }\n onChange(e);\n },\n [onChange],\n );\n return (\n <Styled2DigitsInput\n onChange={validateOnChange}\n onBlur={onBlur}\n onFocus={onFocus}\n onKeyDown={onKeyDown}\n value={value}\n ref={(DomElem: HTMLInputElement) => {\n contextRef.current = DomElem;\n if (isFocused) DomElem?.focus?.();\n }}\n placeholder={placeholder}\n aria-label={`minutes input field ${ariaCurrentValueForInputs}`}\n data-testid={ControlledDateTimePickerDatatestid.TIME_INPUTS.MINUTE}\n disabled={disabled}\n aria-disabled={disabled}\n getOwnerProps={getProps}\n />\n );\n },\n);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADkDjB;AAlDN,mBAAmC;AACnC,gDAAmD;AACnD,qBAAmC;AAInC,MAAM,gBAAgB;AACtB,MAAM,kBAAkB,CAAC,YAAoB;AAC3C,MAAI,YAAY;AAAI,WAAO;AAC3B,QAAM,aAAa,cAAc,KAAK,OAAO;AAC7C,SAAO,QAAQ,SAAS,KAAK,CAAC,cAAc,OAAO,SAAS,SAAS,EAAE,IAAI;AAC7E;AAcO,MAAM,eAAe,aAAAA,QAAM;AAAA,EAChC,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,MAAwC;AACtC,UAAM,uBAAmB;AAAA,MACvB,CAAC,MAA2C;AAC1C,YAAI,gBAAgB,GAAG,QAAQ,KAAK,GAAG;AACrC,YAAE,eAAe;AACjB;AAAA,QACF;AACA,iBAAS,CAAC;AAAA,MACZ;AAAA,MACA,CAAC,QAAQ;AAAA,IACX;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,KAAK,CAAC,YAA8B;AAClC,qBAAW,UAAU;AACrB,cAAI;AAAW,qBAAS,QAAQ;AAAA,QAClC;AAAA,QACA;AAAA,QACA,cAAY,uBAAuB;AAAA,QACnC,eAAa,6EAAmC,YAAY;AAAA,QAC5D;AAAA,QACA,iBAAe;AAAA,QACf,eAAe;AAAA;AAAA,IACjB;AAAA,EAEJ;AACF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -33,11 +33,9 @@ __export(TimeInputs_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(TimeInputs_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var import_react =
|
|
36
|
+
var import_react = require("react");
|
|
37
37
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
38
|
-
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
38
|
var import_ControlledDateTimePickerCTX = require("../../ControlledDateTimePickerCTX.js");
|
|
40
|
-
var import_ControlledDateTimePickerDatatestid = require("../../ControlledDateTimePickerDatatestid.js");
|
|
41
39
|
var import_HHInput = require("./HHInput.js");
|
|
42
40
|
var import_MinutesInput = require("./MinutesInput.js");
|
|
43
41
|
var import_MeridiemInput = require("./MeridiemInput.js");
|
|
@@ -71,20 +69,8 @@ const TimeInputs = () => {
|
|
|
71
69
|
ariaCurrentValueForInputs,
|
|
72
70
|
latestInteractionRegion,
|
|
73
71
|
currFocusDescriber,
|
|
74
|
-
|
|
72
|
+
getProps
|
|
75
73
|
} = (0, import_react.useContext)(import_ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
76
|
-
const ariaAndDataPropsHoursInput = import_react.default.useMemo(
|
|
77
|
-
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.HOUR]),
|
|
78
|
-
[props]
|
|
79
|
-
);
|
|
80
|
-
const ariaAndDataPropsMinutesInput = import_react.default.useMemo(
|
|
81
|
-
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.MINUTE]),
|
|
82
|
-
[props]
|
|
83
|
-
);
|
|
84
|
-
const ariaAndDataPropsMeridiemInput = import_react.default.useMemo(
|
|
85
|
-
() => (0, import_ds_props_helpers.getPropsPerDatatestid)(props[import_ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.MERIDIEM]),
|
|
86
|
-
[props]
|
|
87
|
-
);
|
|
88
74
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
89
75
|
import_ds_grid.Grid,
|
|
90
76
|
{
|
|
@@ -110,7 +96,7 @@ const TimeInputs = () => {
|
|
|
110
96
|
autoFocusHourInput,
|
|
111
97
|
disabled,
|
|
112
98
|
isFocused: latestInteractionRegion === "time-inputs" && currFocusDescriber === "hour-input",
|
|
113
|
-
|
|
99
|
+
getProps
|
|
114
100
|
}
|
|
115
101
|
) }),
|
|
116
102
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Styleds.StyledColonSeparator, { alignItems: "center", children: ":" }),
|
|
@@ -127,7 +113,7 @@ const TimeInputs = () => {
|
|
|
127
113
|
ariaCurrentValueForInputs,
|
|
128
114
|
disabled,
|
|
129
115
|
isFocused: latestInteractionRegion === "time-inputs" && currFocusDescriber === "minute-input",
|
|
130
|
-
|
|
116
|
+
getProps
|
|
131
117
|
}
|
|
132
118
|
) }),
|
|
133
119
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Styleds.StyledSeparator, { children: " " }),
|
|
@@ -144,7 +130,7 @@ const TimeInputs = () => {
|
|
|
144
130
|
ariaCurrentValueForInputs,
|
|
145
131
|
disabled,
|
|
146
132
|
isFocused: latestInteractionRegion === "time-inputs" && currFocusDescriber === "meridiem-input",
|
|
147
|
-
|
|
133
|
+
getProps
|
|
148
134
|
}
|
|
149
135
|
) })
|
|
150
136
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/TimeInputs/TimeInputs.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';\nimport { HHInput } from './HHInput.js';\nimport { MinutesInput } from './MinutesInput.js';\nimport { MeridiemInput } from './MeridiemInput.js';\nimport { useTimeInputs } from './useTimeInputs.js';\nimport { fixedValues } from '../config.js';\nimport { StyledColonSeparator, StyledSeparator, StyledFocusWithIn } from '../Styleds.js';\n\nexport const TimeInputs = (): JSX.Element => {\n const {\n autoFocusHourInput,\n disabled,\n onHoursChange,\n onMinutesChange,\n onMeridiemChange,\n onHoursBlur,\n onMinutesBlur,\n onMeridiemBlur,\n onHoursFocus,\n onMeridiemFocus,\n onMinutesFocus,\n onHoursKeyDown,\n onMinutesKeyDown,\n onMeridiemKeyDown,\n } = useTimeInputs();\n\n // we do this here so HHInput,MinutesInput, MeridiemInput can be pure components memoized via React.memo\n const {\n hours,\n minutes,\n meridiem,\n hourInputRef,\n minutesInputRef,\n meridiemInputRef,\n ariaCurrentValueForInputs,\n latestInteractionRegion,\n currFocusDescriber,\n getProps,\n } = useContext(ControlledDateTimePickerContext);\n\n return (\n <Grid\n cols={[\n fixedValues.smallInputWidth,\n fixedValues.separatorWidth,\n fixedValues.smallInputWidth,\n fixedValues.separatorWidth,\n fixedValues.smallInputWidth,\n ]}\n >\n <StyledFocusWithIn>\n <HHInput\n value={hours}\n onChange={onHoursChange}\n onBlur={onHoursBlur}\n onFocus={onHoursFocus}\n onKeyDown={onHoursKeyDown}\n contextRef={hourInputRef}\n placeholder=\"HH\"\n ariaCurrentValueForInputs={ariaCurrentValueForInputs}\n autoFocusHourInput={autoFocusHourInput}\n disabled={disabled}\n isFocused={latestInteractionRegion === 'time-inputs' && currFocusDescriber === 'hour-input'}\n getProps={getProps}\n />\n </StyledFocusWithIn>\n <StyledColonSeparator alignItems=\"center\">:</StyledColonSeparator>\n <StyledFocusWithIn>\n <MinutesInput\n value={minutes}\n onChange={onMinutesChange}\n onBlur={onMinutesBlur}\n onFocus={onMinutesFocus}\n onKeyDown={onMinutesKeyDown}\n contextRef={minutesInputRef}\n placeholder=\"MM\"\n ariaCurrentValueForInputs={ariaCurrentValueForInputs}\n disabled={disabled}\n isFocused={latestInteractionRegion === 'time-inputs' && currFocusDescriber === 'minute-input'}\n getProps={getProps}\n />\n </StyledFocusWithIn>\n <StyledSeparator> </StyledSeparator>\n <StyledFocusWithIn>\n <MeridiemInput\n value={meridiem}\n onChange={onMeridiemChange}\n onBlur={onMeridiemBlur}\n onFocus={onMeridiemFocus}\n onKeyDown={onMeridiemKeyDown}\n contextRef={meridiemInputRef}\n placeholder=\"AM\"\n ariaCurrentValueForInputs={ariaCurrentValueForInputs}\n disabled={disabled}\n isFocused={latestInteractionRegion === 'time-inputs' && currFocusDescriber === 'meridiem-input'}\n getProps={getProps}\n />\n </StyledFocusWithIn>\n </Grid>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2CnB;AA3CJ,mBAAkC;AAClC,qBAAqB;AACrB,yCAAgD;AAChD,qBAAwB;AACxB,0BAA6B;AAC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AAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,YACP,UAAU;AAAA,YACV,QAAQ;AAAA,YACR,SAAS;AAAA,YACT,WAAW;AAAA,YACX,YAAY;AAAA,YACZ,aAAY;AAAA,YACZ;AAAA,YACA;AAAA,YACA,WAAW,4BAA4B,iBAAiB,uBAAuB;AAAA,YAC/E;AAAA;AAAA,QACF,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sharedTypes.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport type React from 'react';\nimport type { DSControlledDateTimePickerT } from './propTypes.js';\n\nexport declare namespace DSControlledDateTimePickerInternalsT {\n export type DateDay =\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | 9\n | 10\n | 11\n | 12\n | 13\n | 14\n | 15\n | 16\n | 17\n | 18\n | 19\n | 20\n | 21\n | 22\n | 23\n | 24\n | 25\n | 26\n | 27\n | 28\n | 29\n | 30\n | 31;\n export type DateMonth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n export interface MetaMonthDay {\n day: Date;\n dayAsString: string;\n isPrevMonthDay: boolean;\n isNextMonthDay: boolean;\n isCurrMonthDay: boolean;\n isHidden: boolean;\n dayBtnRef: React.MutableRefObject<HTMLButtonElement>;\n }\n export type OnKeyDown<HTMLT = HTMLInputElement> = (e: React.KeyboardEvent<HTMLT>) => void;\n export type OnChangeFunc = (e: React.ChangeEvent<HTMLInputElement>) => void;\n export type OnDSBtnClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement> | React.KeyboardEvent,\n ) => void;\n export type HandleOnChangeFunc = (\n newVal: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo?: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo,\n ) => void;\n export type OnBlurFunc = (e: React.FocusEvent<HTMLInputElement>) => void;\n export type OnFocusFunc = (e: React.FocusEvent<HTMLInputElement>) => void;\n\n export interface UseDateInputsR {\n month: string;\n day: string;\n year: string;\n autoFocusMonthInput: boolean;\n innerRefMonthInput
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport type React from 'react';\nimport type { DSControlledDateTimePickerT } from './propTypes.js';\n\nexport declare namespace DSControlledDateTimePickerInternalsT {\n export type DateDay =\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6\n | 7\n | 8\n | 9\n | 10\n | 11\n | 12\n | 13\n | 14\n | 15\n | 16\n | 17\n | 18\n | 19\n | 20\n | 21\n | 22\n | 23\n | 24\n | 25\n | 26\n | 27\n | 28\n | 29\n | 30\n | 31;\n export type DateMonth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n export interface MetaMonthDay {\n day: Date;\n dayAsString: string;\n isPrevMonthDay: boolean;\n isNextMonthDay: boolean;\n isCurrMonthDay: boolean;\n isHidden: boolean;\n dayBtnRef: React.MutableRefObject<HTMLButtonElement>;\n }\n export type OnKeyDown<HTMLT = HTMLInputElement> = (e: React.KeyboardEvent<HTMLT>) => void;\n export type OnChangeFunc = (e: React.ChangeEvent<HTMLInputElement>) => void;\n export type OnDSBtnClick = (\n e: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement> | React.KeyboardEvent,\n ) => void;\n export type HandleOnChangeFunc = (\n newVal: string,\n e: DSControlledDateTimePickerT.OnInternalValuesChangeEvent,\n metaInfo?: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo,\n ) => void;\n export type OnBlurFunc = (e: React.FocusEvent<HTMLInputElement>) => void;\n export type OnFocusFunc = (e: React.FocusEvent<HTMLInputElement>) => void;\n\n export interface UseDateInputsR {\n month: string;\n day: string;\n year: string;\n autoFocusMonthInput: boolean;\n innerRefMonthInput?:\n | React.MutableRefObject<HTMLInputElement | HTMLButtonElement | null>\n | ((ref: HTMLInputElement | HTMLButtonElement | null) => void);\n disabled: boolean;\n onMonthChange: OnChangeFunc;\n onDayChange: OnChangeFunc;\n onYearChange: OnChangeFunc;\n onMonthFocus: OnFocusFunc;\n onDayFocus: OnFocusFunc;\n onYearFocus: OnFocusFunc;\n onMonthBlur: OnBlurFunc;\n onDayBlur: OnBlurFunc;\n onYearBlur: OnBlurFunc;\n onMonthKeyDown: OnKeyDown;\n onDayKeyDown: OnKeyDown;\n onYearKeyDown: OnKeyDown;\n }\n export interface InputsReferences {\n monthInputRef: React.RefObject<HTMLInputElement>;\n dayInputRef: React.RefObject<HTMLInputElement>;\n yearInputRef: React.RefObject<HTMLInputElement>;\n hourInputRef: React.RefObject<HTMLInputElement>;\n minutesInputRef: React.RefObject<HTMLInputElement>;\n meridiemInputRef: React.RefObject<HTMLInputElement>;\n clearButtonRef: React.MutableRefObject<HTMLButtonElement>;\n pickerButtonRef: React.MutableRefObject<HTMLButtonElement>;\n }\n export interface CalendarReferences {\n prevYearBtnRef: React.MutableRefObject<HTMLButtonElement>;\n prevMonthBtnRef: React.MutableRefObject<HTMLButtonElement>;\n nextMonthBtnRef: React.MutableRefObject<HTMLButtonElement>;\n nextYearBtnRef: React.MutableRefObject<HTMLButtonElement>;\n calendarDaysWrapperRef: React.MutableRefObject<HTMLDivElement>;\n }\n export interface TimewheelReferences {\n prevHourBtnRef: React.MutableRefObject<HTMLButtonElement>;\n currHourBtnRef: React.MutableRefObject<HTMLButtonElement>;\n nextHourBtnRef: React.MutableRefObject<HTMLButtonElement>;\n prevMinutesBtnRef: React.MutableRefObject<HTMLButtonElement>;\n currMinutesBtnRef: React.MutableRefObject<HTMLButtonElement>;\n nextMinutesBtnRef: React.MutableRefObject<HTMLButtonElement>;\n prevMeridiemBtnRef: React.MutableRefObject<HTMLButtonElement>;\n currMeridiemBtnRef: React.MutableRefObject<HTMLButtonElement>;\n nextMeridiemBtnRef: React.MutableRefObject<HTMLButtonElement>;\n }\n export interface InternalPrecalculatedFlags {\n isControllerOnly: boolean;\n shouldPreserveClearableSpace: boolean;\n isWithTimeWheelToo: boolean;\n isWithCalendarToo: boolean;\n isWithDateInputs: boolean;\n isWithDateInputsOnly: boolean;\n isWithTimeInputs: boolean;\n isWithTimeInputsOnly: boolean;\n autoFocusMonthInput: boolean;\n autoFocusHourInput: boolean;\n autoFocusPrevMonthArrow: boolean;\n autoFocusHourTimeWheel: boolean;\n hideDate: boolean;\n hideTime: boolean;\n hideDateTimePicker: boolean;\n hideDatePicker: boolean;\n hideTimePicker: boolean;\n withAnyInputs: boolean;\n withAnyPicker: boolean;\n withClearBtn: boolean;\n withAnyRightController: boolean;\n isDateSelector: boolean;\n isTimeSelector: boolean;\n isDateTimeSelector: boolean;\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/dateHelpers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport { createRef } from 'react';\nimport { monthNames } from './constants.js';\nimport { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';\nimport { convertToPositiveNumberIfPossible } from './numberHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../propTypes.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes.js';\n\nexport const getDateValuesFromDate = (day: Date): DateValuesT => ({\n month: day?.getMonth?.() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: day?.getDate?.() as DSControlledDateTimePickerInternalsT.DateDay,\n year: day?.getFullYear?.(),\n});\nexport const getDateStringFromDay = (day: Date): string => {\n const monthFromDay = prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12\n const dayFromDay = prependStringWithPlaceHolders(`${day.getDate()}`, 2);\n const yearFromDay = prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);\n\n return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;\n};\nexport const getTimeStringFromDay = (day: Date): string => {\n const hoursNum = day.getHours();\n const meridiem = hoursNum > 12 ? 'PM' : 'AM';\n const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;\n const minutesNum = day.getMinutes();\n\n const hoursFromDay = prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);\n const minutesFromDay = prependStringWithPlaceHolders(`${minutesNum}`, 2);\n\n return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;\n};\nexport const getMonthNameByMonthNumber = (monthNumber: number): string => monthNames[monthNumber];\nexport const isSameDateMoment = (dateA: Date, dateB: Date): boolean => dateA?.getTime?.() === dateB?.getTime?.();\n\nexport const compareTwoDatesDayEquality = (dayA: Date, dayB: Date): boolean => {\n const { day: currD, month: currM, year: currY } = getDateValuesFromDate(dayA);\n const { day: focusD, month: focusM, year: focusY } = getDateValuesFromDate(dayB);\n return currD === focusD && currM === focusM && currY === focusY;\n};\n\nexport const getLastDayOfMonth = (month: DSControlledDateTimePickerInternalsT.DateMonth, year: number): Date =>\n new Date(year, month + 1, 0);\nexport const isValidDayForTheMonth = (\n month: DSControlledDateTimePickerInternalsT.DateMonth,\n year: number,\n day: DSControlledDateTimePickerInternalsT.DateDay,\n): boolean => new Date(year, month, day)?.getMonth?.() === month;\nexport const getDayFromDateString = (dateString: string): Date | null => {\n const { month, day, year } = deconstructValuesFromDateString(dateString);\n const monthNum = convertToPositiveNumberIfPossible(month);\n const dayNum = convertToPositiveNumberIfPossible(day) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n const yearNum = convertToPositiveNumberIfPossible(year);\n if (\n monthNum !== -1 &&\n dayNum !== -1 &&\n yearNum !== -1 &&\n isValidDayForTheMonth((monthNum - 1) as DSControlledDateTimePickerInternalsT.DateMonth, yearNum, dayNum)\n )\n return new Date(yearNum, monthNum - 1, dayNum);\n return null;\n};\nexport const isValidDayForTheMonthDateString = (dateString: string): boolean => {\n if (isIncompleteString(dateString)) return true;\n const { month } = deconstructValuesFromDateString(dateString);\n const monthInt = convertToPositiveNumberIfPossible(month);\n if (monthInt === -1) return false;\n const monthDateMonth = (monthInt - 1) as DSControlledDateTimePickerInternalsT.DateMonth;\n return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;\n};\n\nexport const getValidationDateStringMetaInfo = (\n dateString: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsOutOfRangeDay = (day: string) => false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsDisabledDay = (day: string) => false,\n): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {};\n if (!isIncompleteString(dateString)) {\n metaInfo.isDayPresentInMonth = isValidDayForTheMonthDateString(dateString);\n if (!metaInfo.isDayPresentInMonth)\n metaInfo.suggestedErrorMsg = 'The selected day is not part of the selected month';\n const day = getDayFromDateString(dateString);\n if (day) {\n metaInfo.isOutOfRangeDay = getIsOutOfRangeDay(dateString);\n metaInfo.isDisabledDay = getIsDisabledDay(dateString);\n if (metaInfo.isOutOfRangeDay || metaInfo.isDisabledDay)\n metaInfo.suggestedErrorMsg = 'The selected day is not allowed';\n }\n }\n return metaInfo;\n};\n// code adapted from https://github.com/datejs/Datejs/blob/master/src/core.js\nexport const isLeapYear = (year: number): boolean => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\nexport const getHowManyDaysInMonth = (year: number, month: number): number => {\n const daysPerMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n return daysPerMonth[month];\n};\n\nexport const dateIsLeapYear = (date: Date): boolean => isLeapYear(date.getFullYear());\n\nexport const dateGetDaysInMonth = (date: Date): number => getHowManyDaysInMonth(date.getFullYear(), date.getMonth());\n\nexport const dateAddMonths = (date: Date, value: number): Date => {\n const copiedDate = new Date(date.getTime());\n const n = copiedDate.getDate();\n copiedDate.setDate(1);\n copiedDate.setMonth(copiedDate.getMonth() + value);\n copiedDate.setDate(Math.min(n, dateGetDaysInMonth(copiedDate)));\n return copiedDate;\n};\nexport const dateAddYear = (date: Date, value: number): Date => dateAddMonths(date, value * 12);\n\ninterface DateValuesT {\n month: DSControlledDateTimePickerInternalsT.DateMonth;\n year: number;\n day?: DSControlledDateTimePickerInternalsT.DateDay;\n}\ninterface DateSumValuesT {\n monthsToSum?: number;\n yearsToSum?: number;\n daysToSum?: number;\n}\n// sumFromDateValues supports negative values to \"subtract\"\nexport const sumFromDateValues = (\n { month, year, day = 1 }: DateValuesT,\n { monthsToSum = 0, yearsToSum = 0, daysToSum = 0 }: DateSumValuesT,\n): DateValuesT => {\n let newDate = new Date(year, month, day);\n if (yearsToSum) newDate = dateAddYear(newDate, yearsToSum);\n\n if (monthsToSum) newDate = dateAddMonths(newDate, monthsToSum);\n\n if (daysToSum) newDate.setDate(newDate.getDate() + daysToSum);\n\n return {\n month: newDate.getMonth() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: newDate.getDate() as DSControlledDateTimePickerInternalsT.DateDay,\n year: newDate.getFullYear(),\n };\n};\nexport const sumValuesToDate = (day: Date, sumValues: DateSumValuesT): Date => {\n const dateAsVals = getDateValuesFromDate(day);\n const { month, year, day: newD } = sumFromDateValues(dateAsVals, sumValues);\n return new Date(year, month, newD);\n};\nexport const subtractYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() - howManyMore);\n return newDate;\n};\nexport const subtractMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() - howManyMore);\n return newDate;\n};\nexport const sumMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() + howManyMore);\n return newDate;\n};\nexport const sumYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() + howManyMore);\n return newDate;\n};\n\nexport const getDaysInMonth = (month: number, year: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (date.getMonth() === month) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\nexport const getLastXDaysFromPreviousMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n date.setDate(date.getDate() - 1);\n days.push(new Date(date));\n }\n return days.reverse();\n};\nexport const getFirstXDaysFromNextMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = sumMonths(new Date(year, month, 1), 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\n\nexport const getFiveBySevenCurrentMonthDaysMatrix = (\n month: number,\n year: number,\n): DSControlledDateTimePickerInternalsT.MetaMonthDay[] => {\n const currentMonthDays = getDaysInMonth(month, year).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: false,\n isCurrMonthDay: true,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>(),\n }));\n const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();\n const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(\n (day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>(),\n }),\n );\n const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();\n const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>(),\n }));\n\n return [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport { createRef } from 'react';\nimport { monthNames } from './constants.js';\nimport { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';\nimport { convertToPositiveNumberIfPossible } from './numberHelpers.js';\nimport type { DSControlledDateTimePickerT } from '../propTypes.js';\nimport type { DSControlledDateTimePickerInternalsT } from '../sharedTypes.js';\n\nexport const getDateValuesFromDate = (day: Date): DateValuesT => ({\n month: day?.getMonth?.() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: day?.getDate?.() as DSControlledDateTimePickerInternalsT.DateDay,\n year: day?.getFullYear?.(),\n});\nexport const getDateStringFromDay = (day: Date): string => {\n const monthFromDay = prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12\n const dayFromDay = prependStringWithPlaceHolders(`${day.getDate()}`, 2);\n const yearFromDay = prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);\n\n return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;\n};\nexport const getTimeStringFromDay = (day: Date): string => {\n const hoursNum = day.getHours();\n const meridiem = hoursNum > 12 ? 'PM' : 'AM';\n const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;\n const minutesNum = day.getMinutes();\n\n const hoursFromDay = prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);\n const minutesFromDay = prependStringWithPlaceHolders(`${minutesNum}`, 2);\n\n return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;\n};\nexport const getMonthNameByMonthNumber = (monthNumber: number): string => monthNames[monthNumber];\nexport const isSameDateMoment = (dateA: Date, dateB: Date): boolean => dateA?.getTime?.() === dateB?.getTime?.();\n\nexport const compareTwoDatesDayEquality = (dayA: Date, dayB: Date): boolean => {\n const { day: currD, month: currM, year: currY } = getDateValuesFromDate(dayA);\n const { day: focusD, month: focusM, year: focusY } = getDateValuesFromDate(dayB);\n return currD === focusD && currM === focusM && currY === focusY;\n};\n\nexport const getLastDayOfMonth = (month: DSControlledDateTimePickerInternalsT.DateMonth, year: number): Date =>\n new Date(year, month + 1, 0);\nexport const isValidDayForTheMonth = (\n month: DSControlledDateTimePickerInternalsT.DateMonth,\n year: number,\n day: DSControlledDateTimePickerInternalsT.DateDay,\n): boolean => new Date(year, month, day)?.getMonth?.() === month;\nexport const getDayFromDateString = (dateString: string): Date | null => {\n const { month, day, year } = deconstructValuesFromDateString(dateString);\n const monthNum = convertToPositiveNumberIfPossible(month);\n const dayNum = convertToPositiveNumberIfPossible(day) as DSControlledDateTimePickerInternalsT.DateDay | -1;\n const yearNum = convertToPositiveNumberIfPossible(year);\n if (\n monthNum !== -1 &&\n dayNum !== -1 &&\n yearNum !== -1 &&\n isValidDayForTheMonth((monthNum - 1) as DSControlledDateTimePickerInternalsT.DateMonth, yearNum, dayNum)\n )\n return new Date(yearNum, monthNum - 1, dayNum);\n return null;\n};\nexport const isValidDayForTheMonthDateString = (dateString: string): boolean => {\n if (isIncompleteString(dateString)) return true;\n const { month } = deconstructValuesFromDateString(dateString);\n const monthInt = convertToPositiveNumberIfPossible(month);\n if (monthInt === -1) return false;\n const monthDateMonth = (monthInt - 1) as DSControlledDateTimePickerInternalsT.DateMonth;\n return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;\n};\n\nexport const getValidationDateStringMetaInfo = (\n dateString: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsOutOfRangeDay = (day: string) => false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n getIsDisabledDay = (day: string) => false,\n): Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> => {\n const metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo> = {};\n if (!isIncompleteString(dateString)) {\n metaInfo.isDayPresentInMonth = isValidDayForTheMonthDateString(dateString);\n if (!metaInfo.isDayPresentInMonth)\n metaInfo.suggestedErrorMsg = 'The selected day is not part of the selected month';\n const day = getDayFromDateString(dateString);\n if (day) {\n metaInfo.isOutOfRangeDay = getIsOutOfRangeDay(dateString);\n metaInfo.isDisabledDay = getIsDisabledDay(dateString);\n if (metaInfo.isOutOfRangeDay || metaInfo.isDisabledDay)\n metaInfo.suggestedErrorMsg = 'The selected day is not allowed';\n }\n }\n return metaInfo;\n};\n// code adapted from https://github.com/datejs/Datejs/blob/master/src/core.js\nexport const isLeapYear = (year: number): boolean => (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n\nexport const getHowManyDaysInMonth = (year: number, month: number): number => {\n const daysPerMonth = [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n return daysPerMonth[month];\n};\n\nexport const dateIsLeapYear = (date: Date): boolean => isLeapYear(date.getFullYear());\n\nexport const dateGetDaysInMonth = (date: Date): number => getHowManyDaysInMonth(date.getFullYear(), date.getMonth());\n\nexport const dateAddMonths = (date: Date, value: number): Date => {\n const copiedDate = new Date(date.getTime());\n const n = copiedDate.getDate();\n copiedDate.setDate(1);\n copiedDate.setMonth(copiedDate.getMonth() + value);\n copiedDate.setDate(Math.min(n, dateGetDaysInMonth(copiedDate)));\n return copiedDate;\n};\nexport const dateAddYear = (date: Date, value: number): Date => dateAddMonths(date, value * 12);\n\ninterface DateValuesT {\n month: DSControlledDateTimePickerInternalsT.DateMonth;\n year: number;\n day?: DSControlledDateTimePickerInternalsT.DateDay;\n}\ninterface DateSumValuesT {\n monthsToSum?: number;\n yearsToSum?: number;\n daysToSum?: number;\n}\n// sumFromDateValues supports negative values to \"subtract\"\nexport const sumFromDateValues = (\n { month, year, day = 1 }: DateValuesT,\n { monthsToSum = 0, yearsToSum = 0, daysToSum = 0 }: DateSumValuesT,\n): DateValuesT => {\n let newDate = new Date(year, month, day);\n if (yearsToSum) newDate = dateAddYear(newDate, yearsToSum);\n\n if (monthsToSum) newDate = dateAddMonths(newDate, monthsToSum);\n\n if (daysToSum) newDate.setDate(newDate.getDate() + daysToSum);\n\n return {\n month: newDate.getMonth() as DSControlledDateTimePickerInternalsT.DateMonth,\n day: newDate.getDate() as DSControlledDateTimePickerInternalsT.DateDay,\n year: newDate.getFullYear(),\n };\n};\nexport const sumValuesToDate = (day: Date, sumValues: DateSumValuesT): Date => {\n const dateAsVals = getDateValuesFromDate(day);\n const { month, year, day: newD } = sumFromDateValues(dateAsVals, sumValues);\n return new Date(year, month, newD);\n};\nexport const subtractYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() - howManyMore);\n return newDate;\n};\nexport const subtractMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() - howManyMore);\n return newDate;\n};\nexport const sumMonths = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setMonth(date.getMonth() + howManyMore);\n return newDate;\n};\nexport const sumYears = (date: Date, howManyMore = 1): Date => {\n const newDate = new Date(date.getTime());\n newDate.setFullYear(date.getFullYear() + howManyMore);\n return newDate;\n};\n\nexport const getDaysInMonth = (month: number, year: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (date.getMonth() === month) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\nexport const getLastXDaysFromPreviousMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = new Date(year, month, 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n date.setDate(date.getDate() - 1);\n days.push(new Date(date));\n }\n return days.reverse();\n};\nexport const getFirstXDaysFromNextMonth = (month: number, year: number, howMany: number): Date[] => {\n const date = sumMonths(new Date(year, month, 1), 1);\n const days: Date[] = [];\n while (days.length !== howMany) {\n days.push(new Date(date));\n date.setDate(date.getDate() + 1);\n }\n return days;\n};\n\nexport const getFiveBySevenCurrentMonthDaysMatrix = (\n month: number,\n year: number,\n): DSControlledDateTimePickerInternalsT.MetaMonthDay[] => {\n const currentMonthDays = getDaysInMonth(month, year).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: false,\n isCurrMonthDay: true,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();\n const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(\n (day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: true,\n isNextMonthDay: false,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }),\n );\n const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();\n const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map((day) => ({\n day,\n dayAsString: getDateStringFromDay(day),\n isPrevMonthDay: false,\n isNextMonthDay: true,\n isCurrMonthDay: false,\n isHidden: false,\n dayBtnRef: createRef<HTMLButtonElement>() as React.MutableRefObject<HTMLButtonElement>,\n }));\n\n return [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,CAAC,GAAG,4BAA4B,GAAG,kBAAkB,GAAG,qBAAqB;AACtF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import React2 from "react";
|
|
2
|
+
import React2, { useCallback } from "react";
|
|
3
3
|
import { useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-props-helpers";
|
|
4
4
|
import { useGetDatePickerWithDefaultsProps } from "./useGetPropsWithDefault.js";
|
|
5
5
|
import { useFocusTracker } from "./useFocusTracker.js";
|
|
@@ -16,7 +16,7 @@ const useControlledDateTimePicker = (props) => {
|
|
|
16
16
|
const propsWithDefaults = useGetDatePickerWithDefaultsProps(props);
|
|
17
17
|
const flags = useGetFlags(propsWithDefaults);
|
|
18
18
|
const DOMRefs = useGetReferences(flags);
|
|
19
|
-
const focusTrackers = useFocusTracker({ DOMRefs, flags
|
|
19
|
+
const focusTrackers = useFocusTracker({ DOMRefs, flags });
|
|
20
20
|
const relevantValues = useRelevantValueFromProps(propsWithDefaults);
|
|
21
21
|
const propsBasedOnType = useGetPropsBasedOnType(propsWithDefaults);
|
|
22
22
|
const destructuredValues = useGetDestructuredValues({ ...propsBasedOnType, ...flags });
|
|
@@ -33,9 +33,11 @@ const useControlledDateTimePicker = (props) => {
|
|
|
33
33
|
const { announcedDateValues, announcedTimeValues } = destructuredValues;
|
|
34
34
|
const { isWithDateInputs, isDateTimeSelector, isWithTimeInputs } = flags;
|
|
35
35
|
const ariaCurrentValueForInputs = `current values: ${isWithDateInputs ? `${announcedDateValues}` : ""}${isDateTimeSelector ? ", " : ""}${isWithTimeInputs ? `${announcedTimeValues}` : ""}`;
|
|
36
|
+
const getProps = useCallback(() => propsWithDefaults, [propsWithDefaults]);
|
|
36
37
|
const ctx = React2.useMemo(
|
|
37
38
|
() => ({
|
|
38
39
|
props: propsWithDefaults,
|
|
40
|
+
getProps,
|
|
39
41
|
ariaCurrentValueForInputs,
|
|
40
42
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
41
43
|
xstyledAttrs,
|
|
@@ -51,7 +53,10 @@ const useControlledDateTimePicker = (props) => {
|
|
|
51
53
|
}),
|
|
52
54
|
[
|
|
53
55
|
propsWithDefaults,
|
|
56
|
+
getProps,
|
|
54
57
|
ariaCurrentValueForInputs,
|
|
58
|
+
xstyledAttrs,
|
|
59
|
+
globalAttrs,
|
|
55
60
|
focusTrackers,
|
|
56
61
|
flags,
|
|
57
62
|
DOMRefs,
|
|
@@ -59,9 +64,7 @@ const useControlledDateTimePicker = (props) => {
|
|
|
59
64
|
propsBasedOnType,
|
|
60
65
|
destructuredValues,
|
|
61
66
|
changeHandlers,
|
|
62
|
-
globalKeyHandlers
|
|
63
|
-
xstyledAttrs,
|
|
64
|
-
globalAttrs
|
|
67
|
+
globalKeyHandlers
|
|
65
68
|
]
|
|
66
69
|
);
|
|
67
70
|
return ctx;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useControlledDateTimePicker.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React 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 '../propTypes.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 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
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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 '../propTypes.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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,UAAS,mBAAmB;AACnC,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,yCAAyC;AAClD,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,wBAAwB;AACjC,SAAS,iCAAiC;AAC1C,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAS,4BAA4B;AACrC,SAAS,wBAAwB;AAkB1B,MAAM,8BAA8B,CACzC,UACqC;AAErC,mBAAiB,KAAK;AAEtB,QAAM,oBAAoB,kCAAkC,KAAK;AAEjE,QAAM,QAAQ,YAAY,iBAAiB;AAC3C,QAAM,UAAU,iBAAiB,KAAK;AACtC,QAAM,gBAAgB,gBAAgB,EAAE,SAAS,MAAM,CAAC;AACxD,QAAM,iBAAiB,0BAA0B,iBAAiB;AAClE,QAAM,mBAAmB,uBAAuB,iBAAiB;AACjE,QAAM,qBAAqB,yBAAyB,EAAE,GAAG,kBAAkB,GAAG,MAAM,CAAC;AACrF,QAAM,iBAAiB,kBAAkB;AAAA,IACvC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAA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