@elliemae/ds-form-date-range-picker 3.10.0-next.9 → 3.10.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/ControlledDateRangePicker.js.map +2 -2
- package/dist/cjs/ControlledDateRangePickerCTX.js +2 -50
- package/dist/cjs/ControlledDateRangePickerCTX.js.map +2 -2
- package/dist/cjs/ControlledDateRangePickerDatatestid.js.map +1 -1
- package/dist/cjs/ControlledDateRangePickerTypes.js.map +1 -1
- package/dist/cjs/config/useControlledDateRangePicker.js.map +2 -2
- package/dist/cjs/config/useGetPropsWithDefault.js +2 -2
- package/dist/cjs/config/useGetPropsWithDefault.js.map +2 -2
- package/dist/cjs/config/useRangePickerLogic.js +6 -6
- package/dist/cjs/config/useRangePickerLogic.js.map +2 -2
- package/dist/cjs/config/useValidateProps.js.map +2 -2
- package/dist/cjs/parts/ControlledDateRangeCalendar.js +0 -1
- package/dist/cjs/parts/ControlledDateRangeCalendar.js.map +2 -2
- package/dist/cjs/parts/ControlledDateRangeContent.js.map +1 -1
- package/dist/cjs/propTypes.js +53 -1
- package/dist/cjs/propTypes.js.map +2 -2
- package/dist/esm/ControlledDateRangePicker.js.map +2 -2
- package/dist/esm/ControlledDateRangePickerCTX.js +2 -50
- package/dist/esm/ControlledDateRangePickerCTX.js.map +2 -2
- package/dist/esm/ControlledDateRangePickerDatatestid.js.map +1 -1
- package/dist/esm/ControlledDateRangePickerTypes.js.map +1 -1
- package/dist/esm/config/useControlledDateRangePicker.js.map +2 -2
- package/dist/esm/config/useGetPropsWithDefault.js +1 -1
- package/dist/esm/config/useGetPropsWithDefault.js.map +2 -2
- package/dist/esm/config/useRangePickerLogic.js +6 -6
- package/dist/esm/config/useRangePickerLogic.js.map +2 -2
- package/dist/esm/config/useValidateProps.js.map +2 -2
- package/dist/esm/parts/ControlledDateRangeCalendar.js +0 -1
- package/dist/esm/parts/ControlledDateRangeCalendar.js.map +2 -2
- package/dist/esm/parts/ControlledDateRangeContent.js.map +1 -1
- package/dist/esm/propTypes.js +53 -1
- package/dist/esm/propTypes.js.map +2 -2
- package/package.json +8 -5
- package/dist/cjs/index.d.js +0 -24
- package/dist/cjs/index.d.js.map +0 -7
- package/dist/esm/index.d.js +0 -2
- package/dist/esm/index.d.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ControlledDateRangePicker.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useControlledDateRangePicker } from './config/useControlledDateRangePicker';\nimport { ControlledDateRangeContent } from './parts/ControlledDateRangeContent';\nimport { propTypes } from './propTypes';\nimport { ControlledDateRangePickerContext } from './ControlledDateRangePickerCTX';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAEA,0BAAyB;AACzB,0CAA6C;AAC7C,wCAA2C;AAC3C,uBAA0B;AAC1B,0CAAiD;AAEjD,qBAAgD;AAEhD,MAAM,8BAA8B,CAAC,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useControlledDateRangePicker } from './config/useControlledDateRangePicker';\nimport { ControlledDateRangeContent } from './parts/ControlledDateRangeContent';\nimport { propTypes } from './propTypes';\nimport { ControlledDateRangePickerContext } from './ControlledDateRangePickerCTX';\nimport type { DSControlledDateRangePickerT } from './propTypes';\nimport { DSControlledDateRangePickerName } from './exported-related/theming';\n\nconst DSControlledDateRangePicker = (props: DSControlledDateRangePickerT.Props): JSX.Element => {\n const ctx = useControlledDateRangePicker(props);\n return (\n <ControlledDateRangePickerContext.Provider value={ctx}>\n <ControlledDateRangeContent />\n </ControlledDateRangePickerContext.Provider>\n );\n};\n\nDSControlledDateRangePicker.displayName = DSControlledDateRangePickerName;\nconst DSControlledDateRangePickerWithSchema = describe(DSControlledDateRangePicker);\nDSControlledDateRangePickerWithSchema.propTypes = propTypes;\n\nexport { DSControlledDateRangePickerWithSchema, DSControlledDateRangePicker };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAEA,0BAAyB;AACzB,0CAA6C;AAC7C,wCAA2C;AAC3C,uBAA0B;AAC1B,0CAAiD;AAEjD,qBAAgD;AAEhD,MAAM,8BAA8B,CAAC,UAA2D;AAC9F,QAAM,UAAM,kEAA6B,KAAK;AAC9C,SACE,4CAAC,qEAAiC,UAAjC;AAAA,IAA0C,OAAO;AAAA,IAChD,sDAAC,gEAA2B;AAAA,GAC9B;AAEJ;AAEA,4BAA4B,cAAc;AAC1C,MAAM,4CAAwC,8BAAS,2BAA2B;AAClF,sCAAsC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -25,60 +25,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
var ControlledDateRangePickerCTX_exports = {};
|
|
26
26
|
__export(ControlledDateRangePickerCTX_exports, {
|
|
27
27
|
ControlledDateRangePickerContext: () => ControlledDateRangePickerContext,
|
|
28
|
-
default: () => ControlledDateRangePickerCTX_default
|
|
29
|
-
defaultProps: () => defaultProps
|
|
28
|
+
default: () => ControlledDateRangePickerCTX_default
|
|
30
29
|
});
|
|
31
30
|
module.exports = __toCommonJS(ControlledDateRangePickerCTX_exports);
|
|
32
31
|
var React = __toESM(require("react"));
|
|
33
32
|
var import_react = require("react");
|
|
34
|
-
const
|
|
35
|
-
};
|
|
36
|
-
const defaultReturnFalse = () => false;
|
|
37
|
-
const defaultProps = {
|
|
38
|
-
type: "full-date-range",
|
|
39
|
-
fromDate: "",
|
|
40
|
-
onFromDateChange: noop,
|
|
41
|
-
onMonthFromChange: noop,
|
|
42
|
-
onDayFromChange: noop,
|
|
43
|
-
onYearFromChange: noop,
|
|
44
|
-
hasError: false,
|
|
45
|
-
pickerFooterMsg: "",
|
|
46
|
-
toDate: "",
|
|
47
|
-
onToDateChange: noop,
|
|
48
|
-
onMonthToChange: noop,
|
|
49
|
-
onDayToChange: noop,
|
|
50
|
-
onYearToChange: noop,
|
|
51
|
-
emptyPickerStartingMonth: void 0,
|
|
52
|
-
onCalendarOpenFocusedDay: void 0,
|
|
53
|
-
isClearable: false,
|
|
54
|
-
getIsDisabledDay: defaultReturnFalse,
|
|
55
|
-
getIsOutOfRangeDay: defaultReturnFalse,
|
|
56
|
-
autoFocus: false
|
|
57
|
-
};
|
|
58
|
-
const defaultContext = {
|
|
59
|
-
props: defaultProps,
|
|
60
|
-
rangePickerLogic: {
|
|
61
|
-
latestChangedDate: "",
|
|
62
|
-
onCalendarOpen: noop,
|
|
63
|
-
onCalendarClose: noop,
|
|
64
|
-
handleFromDateChange: noop,
|
|
65
|
-
handleToDateChange: noop,
|
|
66
|
-
handlePickerDateChange: noop,
|
|
67
|
-
handlePickerMonthDateChange: noop,
|
|
68
|
-
handlePickerDayDateChange: noop,
|
|
69
|
-
handlePickerYearDateChange: noop,
|
|
70
|
-
getIsStartRangeDay: defaultReturnFalse,
|
|
71
|
-
getIsDayInRange: defaultReturnFalse,
|
|
72
|
-
getIsEndRangeDay: defaultReturnFalse
|
|
73
|
-
},
|
|
74
|
-
instanceUID: "",
|
|
75
|
-
withInputs: false,
|
|
76
|
-
withIcon: false,
|
|
77
|
-
isControllerOnly: false,
|
|
78
|
-
isPickerOnly: false,
|
|
79
|
-
xstyledAttrs: {},
|
|
80
|
-
globalAttrs: {}
|
|
81
|
-
};
|
|
33
|
+
const defaultContext = {};
|
|
82
34
|
const ControlledDateRangePickerContext = (0, import_react.createContext)(defaultContext);
|
|
83
35
|
var ControlledDateRangePickerCTX_default = ControlledDateRangePickerContext;
|
|
84
36
|
//# sourceMappingURL=ControlledDateRangePickerCTX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ControlledDateRangePickerCTX.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\nimport type { ControlledDateRangePickerContextT } from './config/useControlledDateRangePicker';\n\nconst defaultContext = {} as ControlledDateRangePickerContextT;\n/** Context for cross component communication */\nexport const ControlledDateRangePickerContext = createContext<ControlledDateRangePickerContextT>(defaultContext);\n\nexport default ControlledDateRangePickerContext;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAG9B,MAAM,iBAAiB,CAAC;AAEjB,MAAM,uCAAmC,4BAAiD,cAAc;AAE/G,IAAO,uCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ControlledDateRangePickerDatatestid.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const ControlledDateRangePickerDatatestid = {\n WRAPPER: 'ds-controlled-date-range-picker-wrapper',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
4
|
+
"sourcesContent": ["export const ControlledDateRangePickerDatatestid = {\n WRAPPER: 'ds-controlled-date-range-picker-wrapper',\n} as const;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,sCAAsC;AAAA,EACjD,SAAS;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ControlledDateRangePickerTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable @typescript-eslint/prefer-as-const */\nexport const CONTROLLED_DATE_RANGE_PICKER_TYPES = {\n FULL: 'full-date-range'
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/prefer-as-const */\nexport const CONTROLLED_DATE_RANGE_PICKER_TYPES = {\n FULL: 'full-date-range',\n CONTROLLER_ONLY: 'date-range-picker-controller-only',\n PICKER: 'date-range-picker',\n INPUTS: 'date-range-inputs',\n} as const;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADChB,MAAM,qCAAqC;AAAA,EAChD,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,QAAQ;AACV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useControlledDateRangePicker.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo } from 'react';\nimport { uid } from 'uid';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAwB;AACxB,iBAAoB;AACpB,0BAA2D;AAC3D,oCAAuD;AACvD,8BAAiC;AACjC,iCAAoC;AACpC,4CAAmD;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo } from 'react';\nimport { uid } from 'uid';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type { DSControlledDateRangePickerT } from '../propTypes';\n\ninterface RangePickerLogicT {\n latestChangedDate: string;\n\n onCalendarOpen: () => void;\n onCalendarClose: () => void;\n\n handleFromDateChange: DSControlledDateRangePickerT.RangeOnDateChange;\n handleToDateChange: DSControlledDateRangePickerT.RangeOnDateChange;\n\n handlePickerDateChange: DSControlledDateRangePickerT.RangeOnDateChange;\n handlePickerMonthDateChange: DSControlledDateRangePickerT.AppOnInputChange;\n handlePickerDayDateChange: DSControlledDateRangePickerT.AppOnInputChange;\n handlePickerYearDateChange: DSControlledDateRangePickerT.AppOnInputChange;\n\n getIsStartRangeDay: (day: string) => boolean;\n getIsDayInRange: (day: string) => boolean;\n getIsEndRangeDay: (day: string) => boolean;\n}\n\nexport interface ControlledDateRangePickerContextT {\n props: DSControlledDateRangePickerT.InternalProps;\n instanceUID: string;\n rangePickerLogic: RangePickerLogicT;\n withInputs: boolean;\n withIcon: boolean;\n isControllerOnly: boolean;\n isPickerOnly: boolean;\n xstyledAttrs: Record<string, unknown>;\n globalAttrs: Record<string, unknown>;\n}\n\nexport const useControlledDateRangePicker = (\n props: DSControlledDateRangePickerT.Props,\n): ControlledDateRangePickerContextT => {\n // if we detect wrong props configuration we throw meaningful errors\n useValidateProps(props);\n const instanceUID = useMemo(() => uid(6), []);\n const propsWithDefaults = useGetDateRangePickerWithDefaultsProps(props);\n\n const xstyledAttrs = useGetXstyledProps(propsWithDefaults) as Record<string, unknown>;\n\n const globalAttrs = useGetGlobalAttributes(propsWithDefaults) as Record<string, unknown>;\n\n const { type } = propsWithDefaults;\n\n const withInputs =\n type === CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === CONTROLLED_DATE_RANGE_PICKER_TYPES.INPUTS;\n const withIcon =\n type === CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;\n const isControllerOnly = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.CONTROLLER_ONLY;\n const isPickerOnly = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;\n\n const rangePickerLogic = useRangePickerLogic(propsWithDefaults);\n\n const ctx = useMemo(\n () => ({\n props: { ...propsWithDefaults },\n xstyledAttrs,\n globalAttrs,\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n isPickerOnly,\n }),\n [\n propsWithDefaults,\n xstyledAttrs,\n globalAttrs,\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n isPickerOnly,\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;ADIvB,mBAAwB;AACxB,iBAAoB;AACpB,0BAA2D;AAC3D,oCAAuD;AACvD,8BAAiC;AACjC,iCAAoC;AACpC,4CAAmD;AAkC5C,MAAM,+BAA+B,CAC1C,UACsC;AAEtC,gDAAiB,KAAK;AACtB,QAAM,kBAAc,sBAAQ,UAAM,gBAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAM,wBAAoB,sEAAuC,KAAK;AAEtE,QAAM,mBAAe,wCAAmB,iBAAiB;AAEzD,QAAM,kBAAc,4CAAuB,iBAAiB;AAE5D,QAAM,EAAE,KAAK,IAAI;AAEjB,QAAM,aACJ,SAAS,yEAAmC,QAAQ,SAAS,yEAAmC;AAClG,QAAM,WACJ,SAAS,yEAAmC,QAAQ,SAAS,yEAAmC;AAClG,QAAM,mBAAmB,SAAS,yEAAmC;AACrE,QAAM,eAAe,SAAS,yEAAmC;AAEjE,QAAM,uBAAmB,gDAAoB,iBAAiB;AAE9D,QAAM,UAAM;AAAA,IACV,OAAO;AAAA,MACL,OAAO,EAAE,GAAG,kBAAkB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,6 +29,6 @@ __export(useGetPropsWithDefault_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(useGetPropsWithDefault_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
32
|
-
var
|
|
33
|
-
const useGetDateRangePickerWithDefaultsProps = (props) => (0, import_ds_utilities.useMemoMergePropsWithDefault)(props,
|
|
32
|
+
var import_propTypes = require("../propTypes");
|
|
33
|
+
const useGetDateRangePickerWithDefaultsProps = (props) => (0, import_ds_utilities.useMemoMergePropsWithDefault)(props, import_propTypes.defaultProps);
|
|
34
34
|
//# sourceMappingURL=useGetPropsWithDefault.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useGetPropsWithDefault.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { defaultProps
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA6C;AAC7C,
|
|
4
|
+
"sourcesContent": ["import { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { defaultProps, type DSControlledDateRangePickerT } from '../propTypes';\n// we have to merge the \"default\" nested default values with what the user gives us...\nexport const useGetDateRangePickerWithDefaultsProps = (\n props: DSControlledDateRangePickerT.Props,\n): DSControlledDateRangePickerT.InternalProps => useMemoMergePropsWithDefault(props, defaultProps);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAA6C;AAC7C,uBAAgE;AAEzD,MAAM,yCAAyC,CACpD,cAC+C,kDAA6B,OAAO,6BAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -56,7 +56,7 @@ const useRangePickerLogic = ({
|
|
|
56
56
|
const dateFrom = (0, import_ds_form_date_time_picker.getDayFromDateString)(dateFromString);
|
|
57
57
|
const dateToString = calendarChangeIsFrom ? toDate : changedDay;
|
|
58
58
|
const dateTo = (0, import_ds_form_date_time_picker.getDayFromDateString)(dateToString);
|
|
59
|
-
const isToBeforeFrom = dateTo?.getTime() < dateFrom?.getTime();
|
|
59
|
+
const isToBeforeFrom = !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();
|
|
60
60
|
const newDateFromString = isToBeforeFrom ? dateToString : dateFromString;
|
|
61
61
|
const forcingFromDatePick = isToBeforeFrom ? !calendarChangeIsFrom : false;
|
|
62
62
|
const newDateToString = isToBeforeFrom ? dateFromString : dateToString;
|
|
@@ -80,7 +80,7 @@ const useRangePickerLogic = ({
|
|
|
80
80
|
);
|
|
81
81
|
const handlePickerMonthDateChange = (0, import_react.useCallback)(
|
|
82
82
|
(newMonth, e, metaInfo) => {
|
|
83
|
-
const { newDateString } = metaInfo;
|
|
83
|
+
const { newDateString = "" } = metaInfo;
|
|
84
84
|
const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);
|
|
85
85
|
if (currentClickCountAsFrom)
|
|
86
86
|
onMonthFromChange(newMonth, e, metaInfo);
|
|
@@ -91,7 +91,7 @@ const useRangePickerLogic = ({
|
|
|
91
91
|
);
|
|
92
92
|
const handlePickerDayDateChange = (0, import_react.useCallback)(
|
|
93
93
|
(newDay, e, metaInfo) => {
|
|
94
|
-
const { newDateString } = metaInfo;
|
|
94
|
+
const { newDateString = "" } = metaInfo;
|
|
95
95
|
const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);
|
|
96
96
|
if (currentClickCountAsFrom)
|
|
97
97
|
onDayFromChange(newDay, e, metaInfo);
|
|
@@ -102,7 +102,7 @@ const useRangePickerLogic = ({
|
|
|
102
102
|
);
|
|
103
103
|
const handlePickerYearDateChange = (0, import_react.useCallback)(
|
|
104
104
|
(newYear, e, metaInfo) => {
|
|
105
|
-
const { newDateString } = metaInfo;
|
|
105
|
+
const { newDateString = "" } = metaInfo;
|
|
106
106
|
const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);
|
|
107
107
|
if (currentClickCountAsFrom)
|
|
108
108
|
onYearFromChange(newYear, e, metaInfo);
|
|
@@ -137,7 +137,7 @@ const useRangePickerLogic = ({
|
|
|
137
137
|
if (!dayFrom || !dayTo || !dayString)
|
|
138
138
|
return false;
|
|
139
139
|
const newDayTime = (0, import_ds_form_date_time_picker.getDayFromDateString)(dayString)?.getTime();
|
|
140
|
-
return newDayTime <= dayTo.getTime() && newDayTime >= dayFrom.getTime();
|
|
140
|
+
return !!newDayTime && newDayTime <= dayTo.getTime() && newDayTime >= dayFrom.getTime();
|
|
141
141
|
},
|
|
142
142
|
[fromDate, toDate]
|
|
143
143
|
);
|
|
@@ -148,7 +148,7 @@ const useRangePickerLogic = ({
|
|
|
148
148
|
const getIsToBeforeFrom = (0, import_react.useCallback)((fromString, toString) => {
|
|
149
149
|
const dateFrom = (0, import_ds_form_date_time_picker.getDayFromDateString)(fromString);
|
|
150
150
|
const dateTo = (0, import_ds_form_date_time_picker.getDayFromDateString)(toString);
|
|
151
|
-
return dateTo?.getTime() < dateFrom?.getTime();
|
|
151
|
+
return !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();
|
|
152
152
|
}, []);
|
|
153
153
|
const handleFromDateChange = (0, import_react.useCallback)(
|
|
154
154
|
(newVal, metaInfo) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useRangePickerLogic.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport { useCallback, useState, useMemo, useEffect } from 'react';\n\nimport { getDayFromDateString } from '@elliemae/ds-form-date-time-picker';\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA0D;AAE1D,sCAAqC;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport { useCallback, useState, useMemo, useEffect } from 'react';\n\nimport { getDayFromDateString } from '@elliemae/ds-form-date-time-picker';\nimport type { ControlledDateRangePickerContextT } from './useControlledDateRangePicker';\nimport type { DSControlledDateRangePickerT } from '../propTypes';\n\nexport const useRangePickerLogic = ({\n fromDate,\n onFromDateChange,\n onMonthFromChange,\n onDayFromChange,\n onYearFromChange,\n toDate,\n onMonthToChange,\n onDayToChange,\n onYearToChange,\n onToDateChange,\n}: DSControlledDateRangePickerT.InternalProps): ControlledDateRangePickerContextT['rangePickerLogic'] => {\n // the implementation is based on controlled-date-time-picker that is not meant to \"understand\"\n // the \"from\" - \"to\" logic on click, we are \"overloading\" the \"from\" - \"to\" logic here\n // we track wheter we are going to set the \"from\" OR \"to\" controlled date based on this toggle\n const [calendarChangeIsFrom, setCalendarChangeIsFrom] = useState(true);\n const [latestChangedDate, setLatestChangedDate] = useState(fromDate);\n useEffect(() => {\n setLatestChangedDate(fromDate);\n }, [fromDate]);\n useEffect(() => {\n setLatestChangedDate(toDate);\n }, [toDate]);\n\n const getChangedDayStringValues = useCallback(\n (changedDay: string) => {\n // based on wheter we are handling a \"from\"/\"to\" change, we calculate some values\n const dateFromString = calendarChangeIsFrom ? changedDay : fromDate;\n const dateFrom = getDayFromDateString(dateFromString);\n const dateToString = calendarChangeIsFrom ? toDate : changedDay;\n const dateTo = getDayFromDateString(dateToString);\n // we force the \"from\" to ALWAYS be before the \"to\" date\n const isToBeforeFrom = !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();\n const newDateFromString = isToBeforeFrom ? dateToString : dateFromString;\n const forcingFromDatePick = isToBeforeFrom ? !calendarChangeIsFrom : false;\n const newDateToString = isToBeforeFrom ? dateFromString : dateToString;\n const forcingToDatePick = isToBeforeFrom ? calendarChangeIsFrom : false;\n\n // next change should be based on\n // the force pick next interactions\n // toggle between from/to if we didn't force any pick\n let nextToggleStateIsFrom = !calendarChangeIsFrom;\n if (forcingFromDatePick) nextToggleStateIsFrom = false;\n if (forcingToDatePick) nextToggleStateIsFrom = true;\n\n return {\n newDateFromString,\n forcingFromDatePick,\n newDateToString,\n forcingToDatePick,\n isToBeforeFrom,\n nextToggleStateIsFrom,\n currentClickCountAsFrom: !nextToggleStateIsFrom,\n };\n },\n [fromDate, calendarChangeIsFrom, toDate],\n );\n const handlePickerMonthDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerMonthDateChange'] =\n useCallback(\n (newMonth, e, metaInfo) => {\n const { newDateString = '' } = metaInfo;\n const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);\n if (currentClickCountAsFrom) onMonthFromChange(newMonth, e, metaInfo);\n else onMonthToChange(newMonth, e, metaInfo);\n },\n [getChangedDayStringValues, onMonthFromChange, onMonthToChange],\n );\n const handlePickerDayDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerDayDateChange'] =\n useCallback(\n (newDay, e, metaInfo) => {\n const { newDateString = '' } = metaInfo;\n const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);\n if (currentClickCountAsFrom) onDayFromChange(newDay, e, metaInfo);\n else onDayToChange(newDay, e, metaInfo);\n },\n [getChangedDayStringValues, onDayFromChange, onDayToChange],\n );\n const handlePickerYearDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerYearDateChange'] =\n useCallback(\n (newYear, e, metaInfo) => {\n const { newDateString = '' } = metaInfo;\n const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);\n if (currentClickCountAsFrom) onYearFromChange(newYear, e, metaInfo);\n else onYearToChange(newYear, e, metaInfo);\n },\n [getChangedDayStringValues, onYearFromChange, onYearToChange],\n );\n\n // every time the calendar opens/closes, we assume first click is \"from\"\n const onCalendarOpen: ControlledDateRangePickerContextT['rangePickerLogic']['onCalendarOpen'] = useCallback(() => {\n setCalendarChangeIsFrom(true);\n }, []);\n const onCalendarClose: ControlledDateRangePickerContextT['rangePickerLogic']['onCalendarClose'] = useCallback(() => {\n setCalendarChangeIsFrom(true);\n }, []);\n const handlePickerDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerDateChange'] =\n useCallback(\n (changedDay, metaInfo) => {\n const { newDateFromString, newDateToString, nextToggleStateIsFrom, isToBeforeFrom } =\n getChangedDayStringValues(changedDay);\n\n // every \"change\" on the picker range we calculate it as a new \"onChange\" for both values\n // and we pass over the correct \"new\" from/to value\n onFromDateChange(newDateFromString, { ...metaInfo, automaticSwitchedDates: isToBeforeFrom });\n onToDateChange(newDateToString, { ...metaInfo, automaticSwitchedDates: isToBeforeFrom });\n\n // and we notify what the next change type should be\n setCalendarChangeIsFrom(nextToggleStateIsFrom);\n },\n [getChangedDayStringValues, onFromDateChange, onToDateChange],\n );\n\n const getIsStartRangeDay: ControlledDateRangePickerContextT['rangePickerLogic']['getIsStartRangeDay'] = useCallback(\n (dayString) => dayString === fromDate,\n [fromDate],\n );\n const getIsDayInRange: ControlledDateRangePickerContextT['rangePickerLogic']['getIsDayInRange'] = useCallback(\n (dayString) => {\n const dayFrom = getDayFromDateString(fromDate);\n const dayTo = getDayFromDateString(toDate);\n if (!dayFrom || !dayTo || !dayString) return false;\n const newDayTime = getDayFromDateString(dayString)?.getTime();\n return !!newDayTime && newDayTime <= dayTo.getTime() && newDayTime >= dayFrom.getTime();\n },\n [fromDate, toDate],\n );\n const getIsEndRangeDay: ControlledDateRangePickerContextT['rangePickerLogic']['getIsEndRangeDay'] = useCallback(\n (dayString) => dayString === toDate,\n [toDate],\n );\n\n const getIsToBeforeFrom = useCallback((fromString: string, toString: string) => {\n const dateFrom = getDayFromDateString(fromString);\n const dateTo = getDayFromDateString(toString);\n return !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();\n }, []);\n const handleFromDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handleFromDateChange'] =\n useCallback(\n (newVal, metaInfo) => {\n const isIncorrectOrder = getIsToBeforeFrom(newVal, toDate);\n onFromDateChange(newVal, { ...metaInfo, rangeDateChangeType: 'from', isIncorrectOrder });\n },\n [getIsToBeforeFrom, onFromDateChange, toDate],\n );\n const handleToDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handleToDateChange'] = useCallback(\n (newVal, metaInfo) => {\n const isIncorrectOrder = getIsToBeforeFrom(fromDate, newVal);\n onToDateChange(newVal, { ...metaInfo, rangeDateChangeType: 'to', isIncorrectOrder });\n },\n [fromDate, getIsToBeforeFrom, onToDateChange],\n );\n\n return useMemo(\n () => ({\n latestChangedDate,\n onCalendarOpen,\n onCalendarClose,\n handleFromDateChange,\n handleToDateChange,\n handlePickerDateChange,\n handlePickerMonthDateChange,\n handlePickerDayDateChange,\n handlePickerYearDateChange,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n }),\n [\n latestChangedDate,\n onCalendarOpen,\n onCalendarClose,\n handleFromDateChange,\n handleToDateChange,\n handlePickerDateChange,\n handlePickerMonthDateChange,\n handlePickerDayDateChange,\n handlePickerYearDateChange,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAA0D;AAE1D,sCAAqC;AAI9B,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyG;AAIvG,QAAM,CAAC,sBAAsB,uBAAuB,QAAI,uBAAS,IAAI;AACrE,QAAM,CAAC,mBAAmB,oBAAoB,QAAI,uBAAS,QAAQ;AACnE,8BAAU,MAAM;AACd,yBAAqB,QAAQ;AAAA,EAC/B,GAAG,CAAC,QAAQ,CAAC;AACb,8BAAU,MAAM;AACd,yBAAqB,MAAM;AAAA,EAC7B,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,gCAA4B;AAAA,IAChC,CAAC,eAAuB;AAEtB,YAAM,iBAAiB,uBAAuB,aAAa;AAC3D,YAAM,eAAW,sDAAqB,cAAc;AACpD,YAAM,eAAe,uBAAuB,SAAS;AACrD,YAAM,aAAS,sDAAqB,YAAY;AAEhD,YAAM,iBAAiB,CAAC,CAAC,UAAU,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S,sDAAqB,QAAQ;AAC5C,WAAO,CAAC,CAAC,UAAU,CAAC,CAAC,YAAY,QAAQ,QAAQ,IAAI,UAAU,QAAQ;AAAA,EACzE,GAAG,CAAC,CAAC;AACL,QAAM,2BACJ;AAAA,IACE,CAAC,QAAQ,aAAa;AACpB,YAAM,mBAAmB,kBAAkB,QAAQ,MAAM;AACzD,uBAAiB,QAAQ,EAAE,GAAG,UAAU,qBAAqB,QAAQ,iBAAiB,CAAC;AAAA,IACzF;AAAA,IACA,CAAC,mBAAmB,kBAAkB,MAAM;AAAA,EAC9C;AACF,QAAM,yBAAkG;AAAA,IACtG,CAAC,QAAQ,aAAa;AACpB,YAAM,mBAAmB,kBAAkB,UAAU,MAAM;AAC3D,qBAAe,QAAQ,EAAE,GAAG,UAAU,qBAAqB,MAAM,iBAAiB,CAAC;AAAA,IACrF;AAAA,IACA,CAAC,UAAU,mBAAmB,cAAc;AAAA,EAC9C;AAEA,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useValidateProps.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-unused-vars */\nimport type { DSControlledDateRangePickerT } from '../propTypes';\n\nexport const useValidateProps = (props: DSControlledDateRangePickerT.Props): void => {};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIhB,MAAM,mBAAmB,CAAC,UAAoD;AAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/ControlledDateRangeCalendar.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { CONTROLLED_DATE_TIME_PICKER_TYPES, DSControlledDateTimePicker } from '@elliemae/ds-form-date-time-picker';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\n\nexport const ControlledDateRangeCalendar = (): JSX.Element => {\n const {\n props: {\n emptyPickerStartingMonth,\n onCalendarOpenFocusedDay,\n isClearable,\n getIsDisabledDay,\n getIsOutOfRangeDay,\n hasError,\n autoFocus,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkC;AAClC,sCAA8E;AAC9E,0CAAiD;AAE1C,MAAM,8BAA8B,MAAmB;AAC5D,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { CONTROLLED_DATE_TIME_PICKER_TYPES, DSControlledDateTimePicker } from '@elliemae/ds-form-date-time-picker';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\n\nexport const ControlledDateRangeCalendar = (): JSX.Element => {\n const {\n props: {\n emptyPickerStartingMonth,\n onCalendarOpenFocusedDay,\n isClearable,\n getIsDisabledDay,\n getIsOutOfRangeDay,\n hasError,\n autoFocus,\n pickerFooterMsg,\n },\n rangePickerLogic: {\n latestChangedDate,\n onCalendarOpen,\n onCalendarClose,\n handlePickerDateChange,\n handlePickerMonthDateChange,\n handlePickerDayDateChange,\n handlePickerYearDateChange,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n },\n isControllerOnly,\n } = useContext(ControlledDateRangePickerContext);\n\n return (\n <DSControlledDateTimePicker\n type={\n isControllerOnly\n ? CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.CONTROLLER_ONLY\n : CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.PICKER\n }\n date={latestChangedDate}\n onDateChange={handlePickerDateChange}\n onMonthChange={handlePickerMonthDateChange}\n onDayChange={handlePickerDayDateChange}\n onYearChange={handlePickerYearDateChange}\n getIsStartRangeDay={getIsStartRangeDay}\n getIsDayInRange={getIsDayInRange}\n getIsEndRangeDay={getIsEndRangeDay}\n onPickerOpen={onCalendarOpen}\n onPickerClose={onCalendarClose}\n isClearable={isClearable}\n getIsDisabledDay={getIsDisabledDay}\n getIsOutOfRangeDay={getIsOutOfRangeDay}\n emptyPickerStartingMonth={emptyPickerStartingMonth}\n onCalendarOpenFocusedDay={onCalendarOpenFocusedDay}\n preventCloseOnSelection\n hasError={hasError}\n pickerFooterMsg={pickerFooterMsg}\n autoFocus={autoFocus}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkC;AAClC,sCAA8E;AAC9E,0CAAiD;AAE1C,MAAM,8BAA8B,MAAmB;AAC5D,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,oEAAgC;AAE/C,SACE,4CAAC;AAAA,IACC,MACE,mBACI,kEAAkC,KAAK,kBACvC,kEAAkC,KAAK;AAAA,IAE7C,MAAM;AAAA,IACN,cAAc;AAAA,IACd,eAAe;AAAA,IACf,aAAa;AAAA,IACb,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,yBAAuB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/parts/ControlledDateRangeContent.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useContext } from 'react';\nimport { styled, sizing, space, layout } from '@elliemae/ds-system';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\nimport { ControlledDateRangeFromDate } from './ControlledDateRangeFromDate';\nimport { ControlledDateRangeToDate } from './ControlledDateRangeToDate';\nimport { ControlledDateRangeCalendar } from './ControlledDateRangeCalendar';\nimport { ControlledDateRangePickerDatatestid } from '../ControlledDateRangePickerDatatestid';\nimport { gridMap } from '../utils/utils';\nimport type {
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport { styled, sizing, space, layout } from '@elliemae/ds-system';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\nimport { ControlledDateRangeFromDate } from './ControlledDateRangeFromDate';\nimport { ControlledDateRangeToDate } from './ControlledDateRangeToDate';\nimport { ControlledDateRangeCalendar } from './ControlledDateRangeCalendar';\nimport { ControlledDateRangePickerDatatestid } from '../ControlledDateRangePickerDatatestid';\nimport { gridMap } from '../utils/utils';\nimport type { DSControlledDateRangePickerT } from '../propTypes';\nimport { DSControlledDateRangePickerName, DSControlledDateRangePickerSlots } from '../exported-related/theming';\n\ninterface StyledWrapperT {\n isControllerOnly: boolean;\n isPickerOnly: boolean;\n type: DSControlledDateRangePickerT.ControlledDateRangeType;\n}\n\nconst StyledWrapper = styled('div', {\n name: DSControlledDateRangePickerName,\n slot: DSControlledDateRangePickerSlots.CONTAINER,\n})<StyledWrapperT>`\n display: grid;\n grid-template-columns: ${({ type }) => gridMap[type]};\n grid-template-rows: auto;\n ${({ isControllerOnly, isPickerOnly }) => (isControllerOnly || isPickerOnly ? '' : 'gap: 0px 8px;')}\n grid-auto-flow: row;\n grid-template-areas: '. .';\n justify-content: center;\n align-items: center;\n ${sizing}\n ${space}\n ${layout}\n`;\n\nexport const ControlledDateRangeContent = (): JSX.Element => {\n const {\n props: { type },\n withIcon,\n withInputs,\n isControllerOnly,\n isPickerOnly,\n xstyledAttrs,\n globalAttrs,\n } = useContext(ControlledDateRangePickerContext);\n\n return (\n <StyledWrapper\n isControllerOnly={isControllerOnly}\n isPickerOnly={isPickerOnly}\n data-testid={ControlledDateRangePickerDatatestid.WRAPPER}\n type={type}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n {withInputs ? (\n <>\n <ControlledDateRangeFromDate />\n <ControlledDateRangeToDate />\n </>\n ) : null}\n {withIcon || isControllerOnly ? <ControlledDateRangeCalendar /> : null}\n </StyledWrapper>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkC;AAClC,uBAA8C;AAC9C,0CAAiD;AACjD,yCAA4C;AAC5C,uCAA0C;AAC1C,yCAA4C;AAC5C,iDAAoD;AACpD,mBAAwB;AAExB,qBAAkF;AAQlF,MAAM,oBAAgB,yBAAO,OAAO;AAAA,EAClC,MAAM;AAAA,EACN,MAAM,gDAAiC;AACzC,CAAC;AAAA;AAAA,2BAE0B,CAAC,EAAE,KAAK,MAAM,qBAAQ;AAAA;AAAA,IAE7C,CAAC,EAAE,kBAAkB,aAAa,MAAO,oBAAoB,eAAe,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,IAKjF;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,6BAA6B,MAAmB;AAC3D,QAAM;AAAA,IACJ,OAAO,EAAE,KAAK;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,QAAI,yBAAW,oEAAgC;AAE/C,SACE,6CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,eAAa,+EAAoC;AAAA,IACjD;AAAA,IACC,GAAG;AAAA,IACH,GAAG;AAAA,IAEH;AAAA,mBACC;AAAA,QACE;AAAA,sDAAC,kEAA4B;AAAA,UAC7B,4CAAC,8DAA0B;AAAA;AAAA,OAC7B,IACE;AAAA,MACH,YAAY,mBAAmB,4CAAC,kEAA4B,IAAK;AAAA;AAAA,GACpE;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/propTypes.js
CHANGED
|
@@ -24,11 +24,34 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
25
|
var propTypes_exports = {};
|
|
26
26
|
__export(propTypes_exports, {
|
|
27
|
+
defaultProps: () => defaultProps,
|
|
27
28
|
propTypes: () => propTypes
|
|
28
29
|
});
|
|
29
30
|
module.exports = __toCommonJS(propTypes_exports);
|
|
30
31
|
var React = __toESM(require("react"));
|
|
31
32
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
|
+
const noop = () => {
|
|
34
|
+
};
|
|
35
|
+
const defaultReturnFalse = () => false;
|
|
36
|
+
const defaultProps = {
|
|
37
|
+
type: "full-date-range",
|
|
38
|
+
fromDate: "",
|
|
39
|
+
onFromDateChange: noop,
|
|
40
|
+
onMonthFromChange: noop,
|
|
41
|
+
onDayFromChange: noop,
|
|
42
|
+
onYearFromChange: noop,
|
|
43
|
+
pickerFooterMsg: "",
|
|
44
|
+
toDate: "",
|
|
45
|
+
onToDateChange: noop,
|
|
46
|
+
onMonthToChange: noop,
|
|
47
|
+
onDayToChange: noop,
|
|
48
|
+
onYearToChange: noop,
|
|
49
|
+
getIsDisabledDay: defaultReturnFalse,
|
|
50
|
+
getIsOutOfRangeDay: defaultReturnFalse,
|
|
51
|
+
hasError: false,
|
|
52
|
+
isClearable: false,
|
|
53
|
+
autoFocus: false
|
|
54
|
+
};
|
|
32
55
|
const propTypes = {
|
|
33
56
|
...import_ds_utilities.globalAttributesPropTypes,
|
|
34
57
|
...import_ds_utilities.xstyledPropTypes,
|
|
@@ -37,6 +60,35 @@ const propTypes = {
|
|
|
37
60
|
"date-range-picker-controller-only",
|
|
38
61
|
"date-range-picker",
|
|
39
62
|
"date-range-inputs"
|
|
40
|
-
]).description("Type of date range form control to use")
|
|
63
|
+
]).description("Type of date range form control to use").defaultValue("full-date-range"),
|
|
64
|
+
fromDate: import_ds_utilities.PropTypes.string.description(`strictly formatted string representing user's selected "from" date`).isRequired,
|
|
65
|
+
onFromDateChange: import_ds_utilities.PropTypes.func.description('function to react to "from" date changing').signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )").isRequired,
|
|
66
|
+
onMonthFromChange: import_ds_utilities.PropTypes.func.description('function to react to "from" month changing').defaultValue(() => {
|
|
67
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
68
|
+
onDayFromChange: import_ds_utilities.PropTypes.func.description('function to react to "from" day changing').defaultValue(() => {
|
|
69
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
70
|
+
onYearFromChange: import_ds_utilities.PropTypes.func.description('function to react to "from" year changing').defaultValue(() => {
|
|
71
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
72
|
+
toDate: import_ds_utilities.PropTypes.string.description(`strictly formatted string representing user's selected "to" date`).isRequired,
|
|
73
|
+
onToDateChange: import_ds_utilities.PropTypes.func.description('function to react to "to" date changing').signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )").isRequired,
|
|
74
|
+
onMonthToChange: import_ds_utilities.PropTypes.func.description('function to react to "to" month changing').defaultValue(() => {
|
|
75
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
76
|
+
onDayToChange: import_ds_utilities.PropTypes.func.description('function to react to "to" day changing').defaultValue(() => {
|
|
77
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
78
|
+
onYearToChange: import_ds_utilities.PropTypes.func.description('function to react to "to" year changing').defaultValue(() => {
|
|
79
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
80
|
+
getIsDisabledDay: import_ds_utilities.PropTypes.func.description('function used to mark day as "disable"').defaultValue(() => false).signature("(( day: string ) => boolean )"),
|
|
81
|
+
getIsOutOfRangeDay: import_ds_utilities.PropTypes.func.description('function used to mark day as "out of range"').defaultValue(() => false).signature("(( day: string ) => boolean )"),
|
|
82
|
+
pickerFooterMsg: import_ds_utilities.PropTypes.string.description(""),
|
|
83
|
+
hasError: import_ds_utilities.PropTypes.bool.description("boolean indicating wheter the selected range is to be marked as wrong").defaultValue(false),
|
|
84
|
+
isClearable: import_ds_utilities.PropTypes.bool.description('boolean to optionally activate "clearable" icons in the inputs').defaultValue(false),
|
|
85
|
+
autoFocus: import_ds_utilities.PropTypes.bool.description('boolean to auto-focus the "from" date month on render as per html auto-focus propriety').defaultValue(false),
|
|
86
|
+
emptyPickerStartingMonth: import_ds_utilities.PropTypes.string.description(
|
|
87
|
+
"strictly formatted string representing the starting month to be displayed when calendar context menu is invoked without any selected dates"
|
|
88
|
+
),
|
|
89
|
+
onCalendarOpenFocusedDay: import_ds_utilities.PropTypes.string.description(
|
|
90
|
+
"strictly formatted string representing the day to be focused when calendar context menu is invoked without any selected dates"
|
|
91
|
+
),
|
|
92
|
+
innerRef: import_ds_utilities.PropTypes.string.description('"from" month input html node reference')
|
|
41
93
|
};
|
|
42
94
|
//# sourceMappingURL=propTypes.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/propTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-utilities';\nimport { WeakValidationMap } from 'react';\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n type: PropTypes.oneOf([\n 'full-date-range',\n 'date-range-picker-controller-only',\n 'date-range-picker',\n 'date-range-inputs',\n ]).description('Type of date range form control to use'),\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAAuE;
|
|
4
|
+
"sourcesContent": ["import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-utilities';\nimport { type DSControlledDateTimePickerT } from '@elliemae/ds-form-date-time-picker';\nimport { WeakValidationMap } from 'react';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\nconst defaultReturnFalse = (): boolean => false;\nexport declare namespace DSControlledDateRangePickerT {\n export interface RangePickerMetaInfoT extends DSControlledDateTimePickerT.InternalInputsChangeMetaInfo {\n rangeDateChangeType?: 'from' | 'to';\n automaticSwitchedDates?: boolean;\n isIncorrectOrder?: boolean;\n }\n export type RangeOnDateChange = (val: string, metaInfo: RangePickerMetaInfoT) => void;\n export type AppOnInputChange = DSControlledDateTimePickerT.AppOnInputChange;\n export type ControlledDateRangeType =\n | 'full-date-range'\n | 'date-range-picker-controller-only'\n | 'date-range-picker'\n | 'date-range-inputs';\n export interface DefaultProps {\n type: ControlledDateRangeType;\n fromDate: string;\n onFromDateChange: RangeOnDateChange;\n onMonthFromChange: AppOnInputChange;\n onDayFromChange: AppOnInputChange;\n onYearFromChange: AppOnInputChange;\n hasError: boolean;\n pickerFooterMsg: string;\n\n toDate: string;\n onToDateChange: RangeOnDateChange;\n onMonthToChange: AppOnInputChange;\n onDayToChange: AppOnInputChange;\n onYearToChange: AppOnInputChange;\n\n isClearable: boolean;\n getIsDisabledDay: (day: string) => boolean;\n getIsOutOfRangeDay: (day: string) => boolean;\n autoFocus: boolean;\n }\n\n export interface OptionalProps {\n emptyPickerStartingMonth?: string;\n onCalendarOpenFocusedDay?: string;\n innerRef?: React.MutableRefObject<HTMLInputElement | HTMLButtonElement | null>;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSControlledDateRangePickerT.DefaultProps = {\n type: 'full-date-range',\n fromDate: '',\n onFromDateChange: noop,\n onMonthFromChange: noop,\n onDayFromChange: noop,\n onYearFromChange: noop,\n pickerFooterMsg: '',\n toDate: '',\n onToDateChange: noop,\n onMonthToChange: noop,\n onDayToChange: noop,\n onYearToChange: noop,\n getIsDisabledDay: defaultReturnFalse,\n getIsOutOfRangeDay: defaultReturnFalse,\n hasError: false,\n isClearable: false,\n autoFocus: false,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n type: PropTypes.oneOf([\n 'full-date-range',\n 'date-range-picker-controller-only',\n 'date-range-picker',\n 'date-range-inputs',\n ])\n .description('Type of date range form control to use')\n .defaultValue('full-date-range'),\n fromDate: PropTypes.string.description(`strictly formatted string representing user's selected \"from\" date`)\n .isRequired,\n onFromDateChange: PropTypes.func\n .description('function to react to \"from\" date changing')\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )').isRequired,\n onMonthFromChange: PropTypes.func\n .description('function to react to \"from\" month changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onDayFromChange: PropTypes.func\n .description('function to react to \"from\" day changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onYearFromChange: PropTypes.func\n .description('function to react to \"from\" year changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n toDate: PropTypes.string.description(`strictly formatted string representing user's selected \"to\" date`).isRequired,\n onToDateChange: PropTypes.func\n .description('function to react to \"to\" date changing')\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )').isRequired,\n onMonthToChange: PropTypes.func\n .description('function to react to \"to\" month changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onDayToChange: PropTypes.func\n .description('function to react to \"to\" day changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onYearToChange: PropTypes.func\n .description('function to react to \"to\" year changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n getIsDisabledDay: PropTypes.func\n .description('function used to mark day as \"disable\"')\n .defaultValue(() => false)\n .signature('(( day: string ) => boolean )'),\n getIsOutOfRangeDay: PropTypes.func\n .description('function used to mark day as \"out of range\"')\n .defaultValue(() => false)\n .signature('(( day: string ) => boolean )'),\n pickerFooterMsg: PropTypes.string.description(''),\n hasError: PropTypes.bool\n .description('boolean indicating wheter the selected range is to be marked as wrong')\n .defaultValue(false),\n isClearable: PropTypes.bool\n .description('boolean to optionally activate \"clearable\" icons in the inputs')\n .defaultValue(false),\n autoFocus: PropTypes.bool\n .description('boolean to auto-focus the \"from\" date month on render as per html auto-focus propriety')\n .defaultValue(false),\n emptyPickerStartingMonth: PropTypes.string.description(\n 'strictly formatted string representing the starting month to be displayed when calendar context menu is invoked without any selected dates',\n ),\n onCalendarOpenFocusedDay: PropTypes.string.description(\n 'strictly formatted string representing the day to be focused when calendar context menu is invoked without any selected dates',\n ),\n innerRef: PropTypes.string.description('\"from\" month input html node reference'),\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAAuE;AAKvE,MAAM,OAAO,MAAY;AAAC;AAC1B,MAAM,qBAAqB,MAAe;AA+CnC,MAAM,eAA0D;AAAA,EACrE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,aAAa;AAAA,EACb,WAAW;AACb;AAEO,MAAM,YAAY;AAAA,EACvB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,8BAAU,MAAM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U,8BAAU,KACjB,YAAY,uEAAuE,EACnF,aAAa,KAAK;AAAA,EACrB,aAAa,8BAAU,KACpB,YAAY,gEAAgE,EAC5E,aAAa,KAAK;AAAA,EACrB,WAAW,8BAAU,KAClB,YAAY,wFAAwF,EACpG,aAAa,KAAK;AAAA,EACrB,0BAA0B,8BAAU,OAAO;AAAA,IACzC;AAAA,EACF;AAAA,EACA,0BAA0B,8BAAU,OAAO;AAAA,IACzC;AAAA,EACF;AAAA,EACA,UAAU,8BAAU,OAAO,YAAY,wCAAwC;AACjF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ControlledDateRangePicker.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useControlledDateRangePicker } from './config/useControlledDateRangePicker';\nimport { ControlledDateRangeContent } from './parts/ControlledDateRangeContent';\nimport { propTypes } from './propTypes';\nimport { ControlledDateRangePickerContext } from './ControlledDateRangePickerCTX';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAS,gBAAgB;AACzB,SAAS,oCAAoC;AAC7C,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,wCAAwC;AAEjD,SAAS,uCAAuC;AAEhD,MAAM,8BAA8B,CAAC,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { useControlledDateRangePicker } from './config/useControlledDateRangePicker';\nimport { ControlledDateRangeContent } from './parts/ControlledDateRangeContent';\nimport { propTypes } from './propTypes';\nimport { ControlledDateRangePickerContext } from './ControlledDateRangePickerCTX';\nimport type { DSControlledDateRangePickerT } from './propTypes';\nimport { DSControlledDateRangePickerName } from './exported-related/theming';\n\nconst DSControlledDateRangePicker = (props: DSControlledDateRangePickerT.Props): JSX.Element => {\n const ctx = useControlledDateRangePicker(props);\n return (\n <ControlledDateRangePickerContext.Provider value={ctx}>\n <ControlledDateRangeContent />\n </ControlledDateRangePickerContext.Provider>\n );\n};\n\nDSControlledDateRangePicker.displayName = DSControlledDateRangePickerName;\nconst DSControlledDateRangePickerWithSchema = describe(DSControlledDateRangePicker);\nDSControlledDateRangePickerWithSchema.propTypes = propTypes;\n\nexport { DSControlledDateRangePickerWithSchema, DSControlledDateRangePicker };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAS,gBAAgB;AACzB,SAAS,oCAAoC;AAC7C,SAAS,kCAAkC;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,wCAAwC;AAEjD,SAAS,uCAAuC;AAEhD,MAAM,8BAA8B,CAAC,UAA2D;AAC9F,QAAM,MAAM,6BAA6B,KAAK;AAC9C,SACE,oBAAC,iCAAiC,UAAjC;AAAA,IAA0C,OAAO;AAAA,IAChD,8BAAC,8BAA2B;AAAA,GAC9B;AAEJ;AAEA,4BAA4B,cAAc;AAC1C,MAAM,wCAAwC,SAAS,2BAA2B;AAClF,sCAAsC,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,58 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { createContext } from "react";
|
|
3
|
-
const
|
|
4
|
-
};
|
|
5
|
-
const defaultReturnFalse = () => false;
|
|
6
|
-
const defaultProps = {
|
|
7
|
-
type: "full-date-range",
|
|
8
|
-
fromDate: "",
|
|
9
|
-
onFromDateChange: noop,
|
|
10
|
-
onMonthFromChange: noop,
|
|
11
|
-
onDayFromChange: noop,
|
|
12
|
-
onYearFromChange: noop,
|
|
13
|
-
hasError: false,
|
|
14
|
-
pickerFooterMsg: "",
|
|
15
|
-
toDate: "",
|
|
16
|
-
onToDateChange: noop,
|
|
17
|
-
onMonthToChange: noop,
|
|
18
|
-
onDayToChange: noop,
|
|
19
|
-
onYearToChange: noop,
|
|
20
|
-
emptyPickerStartingMonth: void 0,
|
|
21
|
-
onCalendarOpenFocusedDay: void 0,
|
|
22
|
-
isClearable: false,
|
|
23
|
-
getIsDisabledDay: defaultReturnFalse,
|
|
24
|
-
getIsOutOfRangeDay: defaultReturnFalse,
|
|
25
|
-
autoFocus: false
|
|
26
|
-
};
|
|
27
|
-
const defaultContext = {
|
|
28
|
-
props: defaultProps,
|
|
29
|
-
rangePickerLogic: {
|
|
30
|
-
latestChangedDate: "",
|
|
31
|
-
onCalendarOpen: noop,
|
|
32
|
-
onCalendarClose: noop,
|
|
33
|
-
handleFromDateChange: noop,
|
|
34
|
-
handleToDateChange: noop,
|
|
35
|
-
handlePickerDateChange: noop,
|
|
36
|
-
handlePickerMonthDateChange: noop,
|
|
37
|
-
handlePickerDayDateChange: noop,
|
|
38
|
-
handlePickerYearDateChange: noop,
|
|
39
|
-
getIsStartRangeDay: defaultReturnFalse,
|
|
40
|
-
getIsDayInRange: defaultReturnFalse,
|
|
41
|
-
getIsEndRangeDay: defaultReturnFalse
|
|
42
|
-
},
|
|
43
|
-
instanceUID: "",
|
|
44
|
-
withInputs: false,
|
|
45
|
-
withIcon: false,
|
|
46
|
-
isControllerOnly: false,
|
|
47
|
-
isPickerOnly: false,
|
|
48
|
-
xstyledAttrs: {},
|
|
49
|
-
globalAttrs: {}
|
|
50
|
-
};
|
|
3
|
+
const defaultContext = {};
|
|
51
4
|
const ControlledDateRangePickerContext = createContext(defaultContext);
|
|
52
5
|
var ControlledDateRangePickerCTX_default = ControlledDateRangePickerContext;
|
|
53
6
|
export {
|
|
54
7
|
ControlledDateRangePickerContext,
|
|
55
|
-
ControlledDateRangePickerCTX_default as default
|
|
56
|
-
defaultProps
|
|
8
|
+
ControlledDateRangePickerCTX_default as default
|
|
57
9
|
};
|
|
58
10
|
//# sourceMappingURL=ControlledDateRangePickerCTX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ControlledDateRangePickerCTX.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAG9B,MAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type { ControlledDateRangePickerContextT } from './config/useControlledDateRangePicker';\n\nconst defaultContext = {} as ControlledDateRangePickerContextT;\n/** Context for cross component communication */\nexport const ControlledDateRangePickerContext = createContext<ControlledDateRangePickerContextT>(defaultContext);\n\nexport default ControlledDateRangePickerContext;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAG9B,MAAM,iBAAiB,CAAC;AAEjB,MAAM,mCAAmC,cAAiD,cAAc;AAE/G,IAAO,uCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ControlledDateRangePickerDatatestid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const ControlledDateRangePickerDatatestid = {\n WRAPPER: 'ds-controlled-date-range-picker-wrapper',\n};\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const ControlledDateRangePickerDatatestid = {\n WRAPPER: 'ds-controlled-date-range-picker-wrapper',\n} as const;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,sCAAsC;AAAA,EACjD,SAAS;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ControlledDateRangePickerTypes.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/prefer-as-const */\nexport const CONTROLLED_DATE_RANGE_PICKER_TYPES = {\n FULL: 'full-date-range'
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/prefer-as-const */\nexport const CONTROLLED_DATE_RANGE_PICKER_TYPES = {\n FULL: 'full-date-range',\n CONTROLLER_ONLY: 'date-range-picker-controller-only',\n PICKER: 'date-range-picker',\n INPUTS: 'date-range-inputs',\n} as const;\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACChB,MAAM,qCAAqC;AAAA,EAChD,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,QAAQ;AACV;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useControlledDateRangePicker.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo } from 'react';\nimport { uid } from 'uid';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,eAAe;AACxB,SAAS,WAAW;AACpB,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,8CAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,0CAA0C;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable import/prefer-default-export */\n/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport { useMemo } from 'react';\nimport { uid } from 'uid';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type { DSControlledDateRangePickerT } from '../propTypes';\n\ninterface RangePickerLogicT {\n latestChangedDate: string;\n\n onCalendarOpen: () => void;\n onCalendarClose: () => void;\n\n handleFromDateChange: DSControlledDateRangePickerT.RangeOnDateChange;\n handleToDateChange: DSControlledDateRangePickerT.RangeOnDateChange;\n\n handlePickerDateChange: DSControlledDateRangePickerT.RangeOnDateChange;\n handlePickerMonthDateChange: DSControlledDateRangePickerT.AppOnInputChange;\n handlePickerDayDateChange: DSControlledDateRangePickerT.AppOnInputChange;\n handlePickerYearDateChange: DSControlledDateRangePickerT.AppOnInputChange;\n\n getIsStartRangeDay: (day: string) => boolean;\n getIsDayInRange: (day: string) => boolean;\n getIsEndRangeDay: (day: string) => boolean;\n}\n\nexport interface ControlledDateRangePickerContextT {\n props: DSControlledDateRangePickerT.InternalProps;\n instanceUID: string;\n rangePickerLogic: RangePickerLogicT;\n withInputs: boolean;\n withIcon: boolean;\n isControllerOnly: boolean;\n isPickerOnly: boolean;\n xstyledAttrs: Record<string, unknown>;\n globalAttrs: Record<string, unknown>;\n}\n\nexport const useControlledDateRangePicker = (\n props: DSControlledDateRangePickerT.Props,\n): ControlledDateRangePickerContextT => {\n // if we detect wrong props configuration we throw meaningful errors\n useValidateProps(props);\n const instanceUID = useMemo(() => uid(6), []);\n const propsWithDefaults = useGetDateRangePickerWithDefaultsProps(props);\n\n const xstyledAttrs = useGetXstyledProps(propsWithDefaults) as Record<string, unknown>;\n\n const globalAttrs = useGetGlobalAttributes(propsWithDefaults) as Record<string, unknown>;\n\n const { type } = propsWithDefaults;\n\n const withInputs =\n type === CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === CONTROLLED_DATE_RANGE_PICKER_TYPES.INPUTS;\n const withIcon =\n type === CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;\n const isControllerOnly = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.CONTROLLER_ONLY;\n const isPickerOnly = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;\n\n const rangePickerLogic = useRangePickerLogic(propsWithDefaults);\n\n const ctx = useMemo(\n () => ({\n props: { ...propsWithDefaults },\n xstyledAttrs,\n globalAttrs,\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n isPickerOnly,\n }),\n [\n propsWithDefaults,\n xstyledAttrs,\n globalAttrs,\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n isPickerOnly,\n ],\n );\n\n return ctx;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACIvB,SAAS,eAAe;AACxB,SAAS,WAAW;AACpB,SAAS,wBAAwB,0BAA0B;AAC3D,SAAS,8CAA8C;AACvD,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,0CAA0C;AAkC5C,MAAM,+BAA+B,CAC1C,UACsC;AAEtC,mBAAiB,KAAK;AACtB,QAAM,cAAc,QAAQ,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAM,oBAAoB,uCAAuC,KAAK;AAEtE,QAAM,eAAe,mBAAmB,iBAAiB;AAEzD,QAAM,cAAc,uBAAuB,iBAAiB;AAE5D,QAAM,EAAE,KAAK,IAAI;AAEjB,QAAM,aACJ,SAAS,mCAAmC,QAAQ,SAAS,mCAAmC;AAClG,QAAM,WACJ,SAAS,mCAAmC,QAAQ,SAAS,mCAAmC;AAClG,QAAM,mBAAmB,SAAS,mCAAmC;AACrE,QAAM,eAAe,SAAS,mCAAmC;AAEjE,QAAM,mBAAmB,oBAAoB,iBAAiB;AAE9D,QAAM,MAAM;AAAA,IACV,OAAO;AAAA,MACL,OAAO,EAAE,GAAG,kBAAkB;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useMemoMergePropsWithDefault } from "@elliemae/ds-utilities";
|
|
3
|
-
import { defaultProps } from "../
|
|
3
|
+
import { defaultProps } from "../propTypes";
|
|
4
4
|
const useGetDateRangePickerWithDefaultsProps = (props) => useMemoMergePropsWithDefault(props, defaultProps);
|
|
5
5
|
export {
|
|
6
6
|
useGetDateRangePickerWithDefaultsProps
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useGetPropsWithDefault.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { defaultProps
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oCAAoC;AAC7C,SAAS,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { defaultProps, type DSControlledDateRangePickerT } from '../propTypes';\n// we have to merge the \"default\" nested default values with what the user gives us...\nexport const useGetDateRangePickerWithDefaultsProps = (\n props: DSControlledDateRangePickerT.Props,\n): DSControlledDateRangePickerT.InternalProps => useMemoMergePropsWithDefault(props, defaultProps);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,oCAAoC;AAC7C,SAAS,oBAAuD;AAEzD,MAAM,yCAAyC,CACpD,UAC+C,6BAA6B,OAAO,YAAY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -27,7 +27,7 @@ const useRangePickerLogic = ({
|
|
|
27
27
|
const dateFrom = getDayFromDateString(dateFromString);
|
|
28
28
|
const dateToString = calendarChangeIsFrom ? toDate : changedDay;
|
|
29
29
|
const dateTo = getDayFromDateString(dateToString);
|
|
30
|
-
const isToBeforeFrom = dateTo?.getTime() < dateFrom?.getTime();
|
|
30
|
+
const isToBeforeFrom = !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();
|
|
31
31
|
const newDateFromString = isToBeforeFrom ? dateToString : dateFromString;
|
|
32
32
|
const forcingFromDatePick = isToBeforeFrom ? !calendarChangeIsFrom : false;
|
|
33
33
|
const newDateToString = isToBeforeFrom ? dateFromString : dateToString;
|
|
@@ -51,7 +51,7 @@ const useRangePickerLogic = ({
|
|
|
51
51
|
);
|
|
52
52
|
const handlePickerMonthDateChange = useCallback(
|
|
53
53
|
(newMonth, e, metaInfo) => {
|
|
54
|
-
const { newDateString } = metaInfo;
|
|
54
|
+
const { newDateString = "" } = metaInfo;
|
|
55
55
|
const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);
|
|
56
56
|
if (currentClickCountAsFrom)
|
|
57
57
|
onMonthFromChange(newMonth, e, metaInfo);
|
|
@@ -62,7 +62,7 @@ const useRangePickerLogic = ({
|
|
|
62
62
|
);
|
|
63
63
|
const handlePickerDayDateChange = useCallback(
|
|
64
64
|
(newDay, e, metaInfo) => {
|
|
65
|
-
const { newDateString } = metaInfo;
|
|
65
|
+
const { newDateString = "" } = metaInfo;
|
|
66
66
|
const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);
|
|
67
67
|
if (currentClickCountAsFrom)
|
|
68
68
|
onDayFromChange(newDay, e, metaInfo);
|
|
@@ -73,7 +73,7 @@ const useRangePickerLogic = ({
|
|
|
73
73
|
);
|
|
74
74
|
const handlePickerYearDateChange = useCallback(
|
|
75
75
|
(newYear, e, metaInfo) => {
|
|
76
|
-
const { newDateString } = metaInfo;
|
|
76
|
+
const { newDateString = "" } = metaInfo;
|
|
77
77
|
const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);
|
|
78
78
|
if (currentClickCountAsFrom)
|
|
79
79
|
onYearFromChange(newYear, e, metaInfo);
|
|
@@ -108,7 +108,7 @@ const useRangePickerLogic = ({
|
|
|
108
108
|
if (!dayFrom || !dayTo || !dayString)
|
|
109
109
|
return false;
|
|
110
110
|
const newDayTime = getDayFromDateString(dayString)?.getTime();
|
|
111
|
-
return newDayTime <= dayTo.getTime() && newDayTime >= dayFrom.getTime();
|
|
111
|
+
return !!newDayTime && newDayTime <= dayTo.getTime() && newDayTime >= dayFrom.getTime();
|
|
112
112
|
},
|
|
113
113
|
[fromDate, toDate]
|
|
114
114
|
);
|
|
@@ -119,7 +119,7 @@ const useRangePickerLogic = ({
|
|
|
119
119
|
const getIsToBeforeFrom = useCallback((fromString, toString) => {
|
|
120
120
|
const dateFrom = getDayFromDateString(fromString);
|
|
121
121
|
const dateTo = getDayFromDateString(toString);
|
|
122
|
-
return dateTo?.getTime() < dateFrom?.getTime();
|
|
122
|
+
return !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();
|
|
123
123
|
}, []);
|
|
124
124
|
const handleFromDateChange = useCallback(
|
|
125
125
|
(newVal, metaInfo) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useRangePickerLogic.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport { useCallback, useState, useMemo, useEffect } from 'react';\n\nimport { getDayFromDateString } from '@elliemae/ds-form-date-time-picker';\nimport type {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,aAAa,UAAU,SAAS,iBAAiB;AAE1D,SAAS,4BAA4B;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable complexity */\nimport { useCallback, useState, useMemo, useEffect } from 'react';\n\nimport { getDayFromDateString } from '@elliemae/ds-form-date-time-picker';\nimport type { ControlledDateRangePickerContextT } from './useControlledDateRangePicker';\nimport type { DSControlledDateRangePickerT } from '../propTypes';\n\nexport const useRangePickerLogic = ({\n fromDate,\n onFromDateChange,\n onMonthFromChange,\n onDayFromChange,\n onYearFromChange,\n toDate,\n onMonthToChange,\n onDayToChange,\n onYearToChange,\n onToDateChange,\n}: DSControlledDateRangePickerT.InternalProps): ControlledDateRangePickerContextT['rangePickerLogic'] => {\n // the implementation is based on controlled-date-time-picker that is not meant to \"understand\"\n // the \"from\" - \"to\" logic on click, we are \"overloading\" the \"from\" - \"to\" logic here\n // we track wheter we are going to set the \"from\" OR \"to\" controlled date based on this toggle\n const [calendarChangeIsFrom, setCalendarChangeIsFrom] = useState(true);\n const [latestChangedDate, setLatestChangedDate] = useState(fromDate);\n useEffect(() => {\n setLatestChangedDate(fromDate);\n }, [fromDate]);\n useEffect(() => {\n setLatestChangedDate(toDate);\n }, [toDate]);\n\n const getChangedDayStringValues = useCallback(\n (changedDay: string) => {\n // based on wheter we are handling a \"from\"/\"to\" change, we calculate some values\n const dateFromString = calendarChangeIsFrom ? changedDay : fromDate;\n const dateFrom = getDayFromDateString(dateFromString);\n const dateToString = calendarChangeIsFrom ? toDate : changedDay;\n const dateTo = getDayFromDateString(dateToString);\n // we force the \"from\" to ALWAYS be before the \"to\" date\n const isToBeforeFrom = !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();\n const newDateFromString = isToBeforeFrom ? dateToString : dateFromString;\n const forcingFromDatePick = isToBeforeFrom ? !calendarChangeIsFrom : false;\n const newDateToString = isToBeforeFrom ? dateFromString : dateToString;\n const forcingToDatePick = isToBeforeFrom ? calendarChangeIsFrom : false;\n\n // next change should be based on\n // the force pick next interactions\n // toggle between from/to if we didn't force any pick\n let nextToggleStateIsFrom = !calendarChangeIsFrom;\n if (forcingFromDatePick) nextToggleStateIsFrom = false;\n if (forcingToDatePick) nextToggleStateIsFrom = true;\n\n return {\n newDateFromString,\n forcingFromDatePick,\n newDateToString,\n forcingToDatePick,\n isToBeforeFrom,\n nextToggleStateIsFrom,\n currentClickCountAsFrom: !nextToggleStateIsFrom,\n };\n },\n [fromDate, calendarChangeIsFrom, toDate],\n );\n const handlePickerMonthDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerMonthDateChange'] =\n useCallback(\n (newMonth, e, metaInfo) => {\n const { newDateString = '' } = metaInfo;\n const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);\n if (currentClickCountAsFrom) onMonthFromChange(newMonth, e, metaInfo);\n else onMonthToChange(newMonth, e, metaInfo);\n },\n [getChangedDayStringValues, onMonthFromChange, onMonthToChange],\n );\n const handlePickerDayDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerDayDateChange'] =\n useCallback(\n (newDay, e, metaInfo) => {\n const { newDateString = '' } = metaInfo;\n const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);\n if (currentClickCountAsFrom) onDayFromChange(newDay, e, metaInfo);\n else onDayToChange(newDay, e, metaInfo);\n },\n [getChangedDayStringValues, onDayFromChange, onDayToChange],\n );\n const handlePickerYearDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerYearDateChange'] =\n useCallback(\n (newYear, e, metaInfo) => {\n const { newDateString = '' } = metaInfo;\n const { currentClickCountAsFrom } = getChangedDayStringValues(newDateString);\n if (currentClickCountAsFrom) onYearFromChange(newYear, e, metaInfo);\n else onYearToChange(newYear, e, metaInfo);\n },\n [getChangedDayStringValues, onYearFromChange, onYearToChange],\n );\n\n // every time the calendar opens/closes, we assume first click is \"from\"\n const onCalendarOpen: ControlledDateRangePickerContextT['rangePickerLogic']['onCalendarOpen'] = useCallback(() => {\n setCalendarChangeIsFrom(true);\n }, []);\n const onCalendarClose: ControlledDateRangePickerContextT['rangePickerLogic']['onCalendarClose'] = useCallback(() => {\n setCalendarChangeIsFrom(true);\n }, []);\n const handlePickerDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handlePickerDateChange'] =\n useCallback(\n (changedDay, metaInfo) => {\n const { newDateFromString, newDateToString, nextToggleStateIsFrom, isToBeforeFrom } =\n getChangedDayStringValues(changedDay);\n\n // every \"change\" on the picker range we calculate it as a new \"onChange\" for both values\n // and we pass over the correct \"new\" from/to value\n onFromDateChange(newDateFromString, { ...metaInfo, automaticSwitchedDates: isToBeforeFrom });\n onToDateChange(newDateToString, { ...metaInfo, automaticSwitchedDates: isToBeforeFrom });\n\n // and we notify what the next change type should be\n setCalendarChangeIsFrom(nextToggleStateIsFrom);\n },\n [getChangedDayStringValues, onFromDateChange, onToDateChange],\n );\n\n const getIsStartRangeDay: ControlledDateRangePickerContextT['rangePickerLogic']['getIsStartRangeDay'] = useCallback(\n (dayString) => dayString === fromDate,\n [fromDate],\n );\n const getIsDayInRange: ControlledDateRangePickerContextT['rangePickerLogic']['getIsDayInRange'] = useCallback(\n (dayString) => {\n const dayFrom = getDayFromDateString(fromDate);\n const dayTo = getDayFromDateString(toDate);\n if (!dayFrom || !dayTo || !dayString) return false;\n const newDayTime = getDayFromDateString(dayString)?.getTime();\n return !!newDayTime && newDayTime <= dayTo.getTime() && newDayTime >= dayFrom.getTime();\n },\n [fromDate, toDate],\n );\n const getIsEndRangeDay: ControlledDateRangePickerContextT['rangePickerLogic']['getIsEndRangeDay'] = useCallback(\n (dayString) => dayString === toDate,\n [toDate],\n );\n\n const getIsToBeforeFrom = useCallback((fromString: string, toString: string) => {\n const dateFrom = getDayFromDateString(fromString);\n const dateTo = getDayFromDateString(toString);\n return !!dateTo && !!dateFrom && dateTo?.getTime() < dateFrom?.getTime();\n }, []);\n const handleFromDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handleFromDateChange'] =\n useCallback(\n (newVal, metaInfo) => {\n const isIncorrectOrder = getIsToBeforeFrom(newVal, toDate);\n onFromDateChange(newVal, { ...metaInfo, rangeDateChangeType: 'from', isIncorrectOrder });\n },\n [getIsToBeforeFrom, onFromDateChange, toDate],\n );\n const handleToDateChange: ControlledDateRangePickerContextT['rangePickerLogic']['handleToDateChange'] = useCallback(\n (newVal, metaInfo) => {\n const isIncorrectOrder = getIsToBeforeFrom(fromDate, newVal);\n onToDateChange(newVal, { ...metaInfo, rangeDateChangeType: 'to', isIncorrectOrder });\n },\n [fromDate, getIsToBeforeFrom, onToDateChange],\n );\n\n return useMemo(\n () => ({\n latestChangedDate,\n onCalendarOpen,\n onCalendarClose,\n handleFromDateChange,\n handleToDateChange,\n handlePickerDateChange,\n handlePickerMonthDateChange,\n handlePickerDayDateChange,\n handlePickerYearDateChange,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n }),\n [\n latestChangedDate,\n onCalendarOpen,\n onCalendarClose,\n handleFromDateChange,\n handleToDateChange,\n handlePickerDateChange,\n handlePickerMonthDateChange,\n handlePickerDayDateChange,\n handlePickerYearDateChange,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n ],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,aAAa,UAAU,SAAS,iBAAiB;A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O;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable no-unused-vars */\nimport type { DSControlledDateRangePickerT } from '../propTypes';\n\nexport const useValidateProps = (props: DSControlledDateRangePickerT.Props): void => {};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACIhB,MAAM,mBAAmB,CAAC,UAAoD;AAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/ControlledDateRangeCalendar.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { CONTROLLED_DATE_TIME_PICKER_TYPES, DSControlledDateTimePicker } from '@elliemae/ds-form-date-time-picker';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\n\nexport const ControlledDateRangeCalendar = (): JSX.Element => {\n const {\n props: {\n emptyPickerStartingMonth,\n onCalendarOpenFocusedDay,\n isClearable,\n getIsDisabledDay,\n getIsOutOfRangeDay,\n hasError,\n autoFocus,\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,mCAAmC,kCAAkC;AAC9E,SAAS,wCAAwC;AAE1C,MAAM,8BAA8B,MAAmB;AAC5D,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { CONTROLLED_DATE_TIME_PICKER_TYPES, DSControlledDateTimePicker } from '@elliemae/ds-form-date-time-picker';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\n\nexport const ControlledDateRangeCalendar = (): JSX.Element => {\n const {\n props: {\n emptyPickerStartingMonth,\n onCalendarOpenFocusedDay,\n isClearable,\n getIsDisabledDay,\n getIsOutOfRangeDay,\n hasError,\n autoFocus,\n pickerFooterMsg,\n },\n rangePickerLogic: {\n latestChangedDate,\n onCalendarOpen,\n onCalendarClose,\n handlePickerDateChange,\n handlePickerMonthDateChange,\n handlePickerDayDateChange,\n handlePickerYearDateChange,\n getIsStartRangeDay,\n getIsDayInRange,\n getIsEndRangeDay,\n },\n isControllerOnly,\n } = useContext(ControlledDateRangePickerContext);\n\n return (\n <DSControlledDateTimePicker\n type={\n isControllerOnly\n ? CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.CONTROLLER_ONLY\n : CONTROLLED_DATE_TIME_PICKER_TYPES.DATE.PICKER\n }\n date={latestChangedDate}\n onDateChange={handlePickerDateChange}\n onMonthChange={handlePickerMonthDateChange}\n onDayChange={handlePickerDayDateChange}\n onYearChange={handlePickerYearDateChange}\n getIsStartRangeDay={getIsStartRangeDay}\n getIsDayInRange={getIsDayInRange}\n getIsEndRangeDay={getIsEndRangeDay}\n onPickerOpen={onCalendarOpen}\n onPickerClose={onCalendarClose}\n isClearable={isClearable}\n getIsDisabledDay={getIsDisabledDay}\n getIsOutOfRangeDay={getIsOutOfRangeDay}\n emptyPickerStartingMonth={emptyPickerStartingMonth}\n onCalendarOpenFocusedDay={onCalendarOpenFocusedDay}\n preventCloseOnSelection\n hasError={hasError}\n pickerFooterMsg={pickerFooterMsg}\n autoFocus={autoFocus}\n />\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,mCAAmC,kCAAkC;AAC9E,SAAS,wCAAwC;AAE1C,MAAM,8BAA8B,MAAmB;AAC5D,QAAM;AAAA,IACJ,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,EACF,IAAI,WAAW,gCAAgC;AAE/C,SACE,oBAAC;AAAA,IACC,MACE,mBACI,kCAAkC,KAAK,kBACvC,kCAAkC,KAAK;AAAA,IAE7C,MAAM;AAAA,IACN,cAAc;AAAA,IACd,eAAe;AAAA,IACf,aAAa;AAAA,IACb,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,yBAAuB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/ControlledDateRangeContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { styled, sizing, space, layout } from '@elliemae/ds-system';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\nimport { ControlledDateRangeFromDate } from './ControlledDateRangeFromDate';\nimport { ControlledDateRangeToDate } from './ControlledDateRangeToDate';\nimport { ControlledDateRangeCalendar } from './ControlledDateRangeCalendar';\nimport { ControlledDateRangePickerDatatestid } from '../ControlledDateRangePickerDatatestid';\nimport { gridMap } from '../utils/utils';\nimport type {
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { styled, sizing, space, layout } from '@elliemae/ds-system';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\nimport { ControlledDateRangeFromDate } from './ControlledDateRangeFromDate';\nimport { ControlledDateRangeToDate } from './ControlledDateRangeToDate';\nimport { ControlledDateRangeCalendar } from './ControlledDateRangeCalendar';\nimport { ControlledDateRangePickerDatatestid } from '../ControlledDateRangePickerDatatestid';\nimport { gridMap } from '../utils/utils';\nimport type { DSControlledDateRangePickerT } from '../propTypes';\nimport { DSControlledDateRangePickerName, DSControlledDateRangePickerSlots } from '../exported-related/theming';\n\ninterface StyledWrapperT {\n isControllerOnly: boolean;\n isPickerOnly: boolean;\n type: DSControlledDateRangePickerT.ControlledDateRangeType;\n}\n\nconst StyledWrapper = styled('div', {\n name: DSControlledDateRangePickerName,\n slot: DSControlledDateRangePickerSlots.CONTAINER,\n})<StyledWrapperT>`\n display: grid;\n grid-template-columns: ${({ type }) => gridMap[type]};\n grid-template-rows: auto;\n ${({ isControllerOnly, isPickerOnly }) => (isControllerOnly || isPickerOnly ? '' : 'gap: 0px 8px;')}\n grid-auto-flow: row;\n grid-template-areas: '. .';\n justify-content: center;\n align-items: center;\n ${sizing}\n ${space}\n ${layout}\n`;\n\nexport const ControlledDateRangeContent = (): JSX.Element => {\n const {\n props: { type },\n withIcon,\n withInputs,\n isControllerOnly,\n isPickerOnly,\n xstyledAttrs,\n globalAttrs,\n } = useContext(ControlledDateRangePickerContext);\n\n return (\n <StyledWrapper\n isControllerOnly={isControllerOnly}\n isPickerOnly={isPickerOnly}\n data-testid={ControlledDateRangePickerDatatestid.WRAPPER}\n type={type}\n {...globalAttrs}\n {...xstyledAttrs}\n >\n {withInputs ? (\n <>\n <ControlledDateRangeFromDate />\n <ControlledDateRangeToDate />\n </>\n ) : null}\n {withIcon || isControllerOnly ? <ControlledDateRangeCalendar /> : null}\n </StyledWrapper>\n );\n};\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,QAAQ,QAAQ,OAAO,cAAc;AAC9C,SAAS,wCAAwC;AACjD,SAAS,mCAAmC;AAC5C,SAAS,iCAAiC;AAC1C,SAAS,mCAAmC;AAC5C,SAAS,2CAA2C;AACpD,SAAS,eAAe;AAExB,SAAS,iCAAiC,wCAAwC;AAQlF,MAAM,gBAAgB,OAAO,OAAO;AAAA,EAClC,MAAM;AAAA,EACN,MAAM,iCAAiC;AACzC,CAAC;AAAA;AAAA,2BAE0B,CAAC,EAAE,KAAK,MAAM,QAAQ;AAAA;AAAA,IAE7C,CAAC,EAAE,kBAAkB,aAAa,MAAO,oBAAoB,eAAe,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,IAKjF;AAAA,IACA;AAAA,IACA;AAAA;AAGG,MAAM,6BAA6B,MAAmB;AAC3D,QAAM;AAAA,IACJ,OAAO,EAAE,KAAK;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,WAAW,gCAAgC;AAE/C,SACE,qBAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,eAAa,oCAAoC;AAAA,IACjD;AAAA,IACC,GAAG;AAAA,IACH,GAAG;AAAA,IAEH;AAAA,mBACC;AAAA,QACE;AAAA,8BAAC,+BAA4B;AAAA,UAC7B,oBAAC,6BAA0B;AAAA;AAAA,OAC7B,IACE;AAAA,MACH,YAAY,mBAAmB,oBAAC,+BAA4B,IAAK;AAAA;AAAA,GACpE;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/propTypes.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-utilities";
|
|
3
|
+
const noop = () => {
|
|
4
|
+
};
|
|
5
|
+
const defaultReturnFalse = () => false;
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
type: "full-date-range",
|
|
8
|
+
fromDate: "",
|
|
9
|
+
onFromDateChange: noop,
|
|
10
|
+
onMonthFromChange: noop,
|
|
11
|
+
onDayFromChange: noop,
|
|
12
|
+
onYearFromChange: noop,
|
|
13
|
+
pickerFooterMsg: "",
|
|
14
|
+
toDate: "",
|
|
15
|
+
onToDateChange: noop,
|
|
16
|
+
onMonthToChange: noop,
|
|
17
|
+
onDayToChange: noop,
|
|
18
|
+
onYearToChange: noop,
|
|
19
|
+
getIsDisabledDay: defaultReturnFalse,
|
|
20
|
+
getIsOutOfRangeDay: defaultReturnFalse,
|
|
21
|
+
hasError: false,
|
|
22
|
+
isClearable: false,
|
|
23
|
+
autoFocus: false
|
|
24
|
+
};
|
|
3
25
|
const propTypes = {
|
|
4
26
|
...globalAttributesPropTypes,
|
|
5
27
|
...xstyledPropTypes,
|
|
@@ -8,9 +30,39 @@ const propTypes = {
|
|
|
8
30
|
"date-range-picker-controller-only",
|
|
9
31
|
"date-range-picker",
|
|
10
32
|
"date-range-inputs"
|
|
11
|
-
]).description("Type of date range form control to use")
|
|
33
|
+
]).description("Type of date range form control to use").defaultValue("full-date-range"),
|
|
34
|
+
fromDate: PropTypes.string.description(`strictly formatted string representing user's selected "from" date`).isRequired,
|
|
35
|
+
onFromDateChange: PropTypes.func.description('function to react to "from" date changing').signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )").isRequired,
|
|
36
|
+
onMonthFromChange: PropTypes.func.description('function to react to "from" month changing').defaultValue(() => {
|
|
37
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
38
|
+
onDayFromChange: PropTypes.func.description('function to react to "from" day changing').defaultValue(() => {
|
|
39
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
40
|
+
onYearFromChange: PropTypes.func.description('function to react to "from" year changing').defaultValue(() => {
|
|
41
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
42
|
+
toDate: PropTypes.string.description(`strictly formatted string representing user's selected "to" date`).isRequired,
|
|
43
|
+
onToDateChange: PropTypes.func.description('function to react to "to" date changing').signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )").isRequired,
|
|
44
|
+
onMonthToChange: PropTypes.func.description('function to react to "to" month changing').defaultValue(() => {
|
|
45
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
46
|
+
onDayToChange: PropTypes.func.description('function to react to "to" day changing').defaultValue(() => {
|
|
47
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
48
|
+
onYearToChange: PropTypes.func.description('function to react to "to" year changing').defaultValue(() => {
|
|
49
|
+
}).signature("(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )"),
|
|
50
|
+
getIsDisabledDay: PropTypes.func.description('function used to mark day as "disable"').defaultValue(() => false).signature("(( day: string ) => boolean )"),
|
|
51
|
+
getIsOutOfRangeDay: PropTypes.func.description('function used to mark day as "out of range"').defaultValue(() => false).signature("(( day: string ) => boolean )"),
|
|
52
|
+
pickerFooterMsg: PropTypes.string.description(""),
|
|
53
|
+
hasError: PropTypes.bool.description("boolean indicating wheter the selected range is to be marked as wrong").defaultValue(false),
|
|
54
|
+
isClearable: PropTypes.bool.description('boolean to optionally activate "clearable" icons in the inputs').defaultValue(false),
|
|
55
|
+
autoFocus: PropTypes.bool.description('boolean to auto-focus the "from" date month on render as per html auto-focus propriety').defaultValue(false),
|
|
56
|
+
emptyPickerStartingMonth: PropTypes.string.description(
|
|
57
|
+
"strictly formatted string representing the starting month to be displayed when calendar context menu is invoked without any selected dates"
|
|
58
|
+
),
|
|
59
|
+
onCalendarOpenFocusedDay: PropTypes.string.description(
|
|
60
|
+
"strictly formatted string representing the day to be focused when calendar context menu is invoked without any selected dates"
|
|
61
|
+
),
|
|
62
|
+
innerRef: PropTypes.string.description('"from" month input html node reference')
|
|
12
63
|
};
|
|
13
64
|
export {
|
|
65
|
+
defaultProps,
|
|
14
66
|
propTypes
|
|
15
67
|
};
|
|
16
68
|
//# sourceMappingURL=propTypes.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-utilities';\nimport { WeakValidationMap } from 'react';\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n type: PropTypes.oneOf([\n 'full-date-range',\n 'date-range-picker-controller-only',\n 'date-range-picker',\n 'date-range-inputs',\n ]).description('Type of date range form control to use'),\n} as WeakValidationMap<unknown>;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,2BAA2B,wBAAwB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-utilities';\nimport { type DSControlledDateTimePickerT } from '@elliemae/ds-form-date-time-picker';\nimport { WeakValidationMap } from 'react';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\nconst defaultReturnFalse = (): boolean => false;\nexport declare namespace DSControlledDateRangePickerT {\n export interface RangePickerMetaInfoT extends DSControlledDateTimePickerT.InternalInputsChangeMetaInfo {\n rangeDateChangeType?: 'from' | 'to';\n automaticSwitchedDates?: boolean;\n isIncorrectOrder?: boolean;\n }\n export type RangeOnDateChange = (val: string, metaInfo: RangePickerMetaInfoT) => void;\n export type AppOnInputChange = DSControlledDateTimePickerT.AppOnInputChange;\n export type ControlledDateRangeType =\n | 'full-date-range'\n | 'date-range-picker-controller-only'\n | 'date-range-picker'\n | 'date-range-inputs';\n export interface DefaultProps {\n type: ControlledDateRangeType;\n fromDate: string;\n onFromDateChange: RangeOnDateChange;\n onMonthFromChange: AppOnInputChange;\n onDayFromChange: AppOnInputChange;\n onYearFromChange: AppOnInputChange;\n hasError: boolean;\n pickerFooterMsg: string;\n\n toDate: string;\n onToDateChange: RangeOnDateChange;\n onMonthToChange: AppOnInputChange;\n onDayToChange: AppOnInputChange;\n onYearToChange: AppOnInputChange;\n\n isClearable: boolean;\n getIsDisabledDay: (day: string) => boolean;\n getIsOutOfRangeDay: (day: string) => boolean;\n autoFocus: boolean;\n }\n\n export interface OptionalProps {\n emptyPickerStartingMonth?: string;\n onCalendarOpenFocusedDay?: string;\n innerRef?: React.MutableRefObject<HTMLInputElement | HTMLButtonElement | null>;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps {}\n}\n\nexport const defaultProps: DSControlledDateRangePickerT.DefaultProps = {\n type: 'full-date-range',\n fromDate: '',\n onFromDateChange: noop,\n onMonthFromChange: noop,\n onDayFromChange: noop,\n onYearFromChange: noop,\n pickerFooterMsg: '',\n toDate: '',\n onToDateChange: noop,\n onMonthToChange: noop,\n onDayToChange: noop,\n onYearToChange: noop,\n getIsDisabledDay: defaultReturnFalse,\n getIsOutOfRangeDay: defaultReturnFalse,\n hasError: false,\n isClearable: false,\n autoFocus: false,\n};\n\nexport const propTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n type: PropTypes.oneOf([\n 'full-date-range',\n 'date-range-picker-controller-only',\n 'date-range-picker',\n 'date-range-inputs',\n ])\n .description('Type of date range form control to use')\n .defaultValue('full-date-range'),\n fromDate: PropTypes.string.description(`strictly formatted string representing user's selected \"from\" date`)\n .isRequired,\n onFromDateChange: PropTypes.func\n .description('function to react to \"from\" date changing')\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )').isRequired,\n onMonthFromChange: PropTypes.func\n .description('function to react to \"from\" month changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onDayFromChange: PropTypes.func\n .description('function to react to \"from\" day changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onYearFromChange: PropTypes.func\n .description('function to react to \"from\" year changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n toDate: PropTypes.string.description(`strictly formatted string representing user's selected \"to\" date`).isRequired,\n onToDateChange: PropTypes.func\n .description('function to react to \"to\" date changing')\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )').isRequired,\n onMonthToChange: PropTypes.func\n .description('function to react to \"to\" month changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onDayToChange: PropTypes.func\n .description('function to react to \"to\" day changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n onYearToChange: PropTypes.func\n .description('function to react to \"to\" year changing')\n .defaultValue(() => {})\n .signature('(( newVal: string, e: React.SyntheticEvent, metaInfo: Record<string,unknown> ) => void )'),\n getIsDisabledDay: PropTypes.func\n .description('function used to mark day as \"disable\"')\n .defaultValue(() => false)\n .signature('(( day: string ) => boolean )'),\n getIsOutOfRangeDay: PropTypes.func\n .description('function used to mark day as \"out of range\"')\n .defaultValue(() => false)\n .signature('(( day: string ) => boolean )'),\n pickerFooterMsg: PropTypes.string.description(''),\n hasError: PropTypes.bool\n .description('boolean indicating wheter the selected range is to be marked as wrong')\n .defaultValue(false),\n isClearable: PropTypes.bool\n .description('boolean to optionally activate \"clearable\" icons in the inputs')\n .defaultValue(false),\n autoFocus: PropTypes.bool\n .description('boolean to auto-focus the \"from\" date month on render as per html auto-focus propriety')\n .defaultValue(false),\n emptyPickerStartingMonth: PropTypes.string.description(\n 'strictly formatted string representing the starting month to be displayed when calendar context menu is invoked without any selected dates',\n ),\n onCalendarOpenFocusedDay: PropTypes.string.description(\n 'strictly formatted string representing the day to be focused when calendar context menu is invoked without any selected dates',\n ),\n innerRef: PropTypes.string.description('\"from\" month input html node reference'),\n} as WeakValidationMap<unknown>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAW,2BAA2B,wBAAwB;AAKvE,MAAM,OAAO,MAAY;AAAC;AAC1B,MAAM,qBAAqB,MAAe;AA+CnC,MAAM,eAA0D;AAAA,EACrE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,aAAa;AAAA,EACb,WAA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U,+BAA+B;AAAA,EAC5C,iBAAiB,UAAU,OAAO,YAAY,EAAE;AAAA,EAChD,UAAU,UAAU,KACjB,YAAY,uEAAuE,EACnF,aAAa,KAAK;AAAA,EACrB,aAAa,UAAU,KACpB,YAAY,gEAAgE,EAC5E,aAAa,KAAK;AAAA,EACrB,WAAW,UAAU,KAClB,YAAY,wFAAwF,EACpG,aAAa,KAAK;AAAA,EACrB,0BAA0B,UAAU,OAAO;AAAA,IACzC;AAAA,EACF;AAAA,EACA,0BAA0B,UAAU,OAAO;AAAA,IACzC;AAAA,EACF;AAAA,EACA,UAAU,UAAU,OAAO,YAAY,wCAAwC;AACjF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-date-range-picker",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Date Range Picker",
|
|
6
6
|
"files": [
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"indent": 4
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@elliemae/ds-form-date-time-picker": "3.10.
|
|
39
|
-
"@elliemae/ds-form-layout-blocks": "3.10.
|
|
40
|
-
"@elliemae/ds-system": "3.10.
|
|
41
|
-
"@elliemae/ds-utilities": "3.10.
|
|
38
|
+
"@elliemae/ds-form-date-time-picker": "3.10.2",
|
|
39
|
+
"@elliemae/ds-form-layout-blocks": "3.10.2",
|
|
40
|
+
"@elliemae/ds-system": "3.10.2",
|
|
41
|
+
"@elliemae/ds-utilities": "3.10.2",
|
|
42
42
|
"styled-components": "~5.3.5",
|
|
43
43
|
"uid": "~2.0.0"
|
|
44
44
|
},
|
|
@@ -67,7 +67,10 @@
|
|
|
67
67
|
"test": "node ../../scripts/testing/test.mjs",
|
|
68
68
|
"lint": "node ../../scripts/lint.mjs",
|
|
69
69
|
"dts": "node ../../scripts/dts.mjs",
|
|
70
|
+
"dts:withdeps": "pnpm --filter {.}... dts",
|
|
70
71
|
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
|
|
72
|
+
"dev:build": "pnpm --filter {.}... build && pnpm --filter {.}... dts",
|
|
73
|
+
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
|
71
74
|
"checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
72
75
|
}
|
|
73
76
|
}
|
package/dist/cjs/index.d.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
-
mod
|
|
19
|
-
));
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
var index_d_exports = {};
|
|
22
|
-
module.exports = __toCommonJS(index_d_exports);
|
|
23
|
-
var React = __toESM(require("react"));
|
|
24
|
-
//# sourceMappingURL=index.d.js.map
|
package/dist/cjs/index.d.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.d.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import type { DSFormLayoutBlockItemPropsT } from '@elliemae/ds-form-layout-blocks';\nimport React from 'react';\nimport type { onDateChangeT, onInternalInputsChangeT, internalInputsChangeMetaInfo } from '../date-time-picker/index.d';\nexport interface RangePickerMetaInfoT extends internalInputsChangeMetaInfo {\n rangeDateChangeType?: 'from' | 'to';\n automaticSwitchedDates?: boolean;\n isIncorrectOrder?: boolean;\n}\nexport type rangeOnDateChangeT = (val: string, metaInfo: RangePickerMetaInfoT) => void;\nexport type ControlledDateRangeTypeT =\n | 'full-date-range'\n | 'date-range-picker-controller-only'\n | 'date-range-picker'\n | 'date-range-inputs';\n\nexport interface DateRangePickerPropsT {\n type: ControlledDateRangeTypeT;\n fromDate: string;\n onFromDateChange: rangeOnDateChangeT;\n onMonthFromChange: onInternalInputsChangeT;\n onDayFromChange: onInternalInputsChangeT;\n onYearFromChange: onInternalInputsChangeT;\n hasError: boolean;\n pickerFooterMsg: string;\n\n toDate: string;\n onToDateChange: rangeOnDateChangeT;\n onMonthToChange: onInternalInputsChangeT;\n onDayToChange: onInternalInputsChangeT;\n onYearToChange: onInternalInputsChangeT;\n\n emptyPickerStartingMonth?: string;\n onCalendarOpenFocusedDay?: string;\n isClearable?: boolean;\n getIsDisabledDay?: (day: string) => boolean;\n getIsOutOfRangeDay?: (day: string) => boolean;\n autoFocus?: boolean;\n innerRef?: React.MutableRefObject<HTMLInputElement | HTMLButtonElement | null>;\n}\n\nexport interface RangePickerLogicT {\n latestChangedDate: string;\n\n onCalendarOpen: () => void;\n onCalendarClose: () => void;\n\n handleFromDateChange: rangeOnDateChangeT;\n handleToDateChange: rangeOnDateChangeT;\n\n handlePickerDateChange: rangeOnDateChangeT;\n handlePickerMonthDateChange: onInternalInputsChangeT;\n handlePickerDayDateChange: onInternalInputsChangeT;\n handlePickerYearDateChange: onInternalInputsChangeT;\n\n getIsStartRangeDay: (day: string) => boolean;\n getIsDayInRange: (day: string) => boolean;\n getIsEndRangeDay: (day: string) => boolean;\n}\nexport interface ControlledDateRangePickerContextT {\n props: DateRangePickerPropsT;\n instanceUID: string;\n rangePickerLogic: RangePickerLogicT;\n withInputs: boolean;\n withIcon: boolean;\n isControllerOnly: boolean;\n isPickerOnly: boolean;\n isPickerOnly: boolean;\n xstyledAttrs: Record<string, unknown>;\n globalAttrs: Record<string, unknown>;\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/index.d.js
DELETED