@elliemae/ds-form-date-range-picker 3.0.0-next.42 → 3.0.0-next.43
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/ControlledDateRangePickerCTX.js +2 -1
- package/dist/cjs/ControlledDateRangePickerCTX.js.map +2 -2
- package/dist/cjs/config/useControlledDateRangePicker.js +3 -1
- package/dist/cjs/config/useControlledDateRangePicker.js.map +2 -2
- package/dist/cjs/index.d.js.map +1 -1
- package/dist/cjs/parts/ControlledDateRangeContent.js +9 -5
- package/dist/cjs/parts/ControlledDateRangeContent.js.map +2 -2
- package/dist/cjs/utils/utils.js +40 -0
- package/dist/cjs/utils/utils.js.map +7 -0
- package/dist/esm/ControlledDateRangePickerCTX.js +2 -1
- package/dist/esm/ControlledDateRangePickerCTX.js.map +2 -2
- package/dist/esm/config/useControlledDateRangePicker.js +3 -1
- package/dist/esm/config/useControlledDateRangePicker.js.map +2 -2
- package/dist/esm/parts/ControlledDateRangeContent.js +9 -5
- package/dist/esm/parts/ControlledDateRangeContent.js.map +2 -2
- package/dist/esm/utils/utils.js +11 -0
- package/dist/esm/utils/utils.js.map +7 -0
- package/package.json +4 -4
|
@@ -76,7 +76,8 @@ const defaultContext = {
|
|
|
76
76
|
instanceUID: "",
|
|
77
77
|
withInputs: false,
|
|
78
78
|
withIcon: false,
|
|
79
|
-
isControllerOnly: false
|
|
79
|
+
isControllerOnly: false,
|
|
80
|
+
isPickerOnly: false
|
|
80
81
|
};
|
|
81
82
|
const ControlledDateRangePickerContext = (0, import_react.createContext)(defaultContext);
|
|
82
83
|
var ControlledDateRangePickerCTX_default = ControlledDateRangePickerContext;
|
|
@@ -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 { DateRangePickerPropsT, ControlledDateRangePickerContextT } from './index.d';\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\nconst defaultReturnFalse = (): boolean => false;\nexport const defaultProps: DateRangePickerPropsT = {\n type: 'full-date-range',\n fromDate: '',\n onFromDateChange: noop,\n onMonthFromChange: noop,\n onDayFromChange: noop,\n onYearFromChange: noop,\n hasError: false,\n pickerFooterMsg: '',\n\n toDate: '',\n onToDateChange: noop,\n onMonthToChange: noop,\n onDayToChange: noop,\n onYearToChange: noop,\n\n emptyPickerStartingMonth: undefined,\n onCalendarOpenFocusedDay: undefined,\n isClearable: false,\n getIsDisabledDay: defaultReturnFalse,\n getIsOutOfRangeDay: defaultReturnFalse,\n autoFocus: false,\n};\nconst defaultContext = {\n props: defaultProps,\n rangePickerLogic: {\n latestChangedDate: '',\n onCalendarOpen: noop,\n onCalendarClose: noop,\n handleFromDateChange: noop,\n handleToDateChange: noop,\n handlePickerDateChange: noop,\n handlePickerMonthDateChange: noop,\n handlePickerDayDateChange: noop,\n handlePickerYearDateChange: noop,\n getIsStartRangeDay: defaultReturnFalse,\n getIsDayInRange: defaultReturnFalse,\n getIsEndRangeDay: defaultReturnFalse,\n },\n instanceUID: '',\n withInputs: false,\n withIcon: false,\n isControllerOnly: false,\n};\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,OAAO,MAAY;AAAC;AAC1B,MAAM,qBAAqB,MAAe;AACnC,MAAM,eAAsC;AAAA,EACjD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,iBAAiB;AAAA,EAEjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAEhB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,WAAW;AACb;AACA,MAAM,iBAAiB;AAAA,EACrB,OAAO;AAAA,EACP,kBAAkB;AAAA,IAChB,mBAAmB;AAAA,IACnB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,wBAAwB;AAAA,IACxB,6BAA6B;AAAA,IAC7B,2BAA2B;AAAA,IAC3B,4BAA4B;AAAA,IAC5B,oBAAoB;AAAA,IACpB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,EACpB;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,kBAAkB;
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\nimport type { DateRangePickerPropsT, ControlledDateRangePickerContextT } from './index.d';\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\nconst defaultReturnFalse = (): boolean => false;\nexport const defaultProps: DateRangePickerPropsT = {\n type: 'full-date-range',\n fromDate: '',\n onFromDateChange: noop,\n onMonthFromChange: noop,\n onDayFromChange: noop,\n onYearFromChange: noop,\n hasError: false,\n pickerFooterMsg: '',\n\n toDate: '',\n onToDateChange: noop,\n onMonthToChange: noop,\n onDayToChange: noop,\n onYearToChange: noop,\n\n emptyPickerStartingMonth: undefined,\n onCalendarOpenFocusedDay: undefined,\n isClearable: false,\n getIsDisabledDay: defaultReturnFalse,\n getIsOutOfRangeDay: defaultReturnFalse,\n autoFocus: false,\n};\nconst defaultContext = {\n props: defaultProps,\n rangePickerLogic: {\n latestChangedDate: '',\n onCalendarOpen: noop,\n onCalendarClose: noop,\n handleFromDateChange: noop,\n handleToDateChange: noop,\n handlePickerDateChange: noop,\n handlePickerMonthDateChange: noop,\n handlePickerDayDateChange: noop,\n handlePickerYearDateChange: noop,\n getIsStartRangeDay: defaultReturnFalse,\n getIsDayInRange: defaultReturnFalse,\n getIsEndRangeDay: defaultReturnFalse,\n },\n instanceUID: '',\n withInputs: false,\n withIcon: false,\n isControllerOnly: false,\n isPickerOnly: false,\n};\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,OAAO,MAAY;AAAC;AAC1B,MAAM,qBAAqB,MAAe;AACnC,MAAM,eAAsC;AAAA,EACjD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,iBAAiB;AAAA,EAEjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAEhB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,WAAW;AACb;AACA,MAAM,iBAAiB;AAAA,EACrB,OAAO;AAAA,EACP,kBAAkB;AAAA,IAChB,mBAAmB;AAAA,IACnB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,wBAAwB;AAAA,IACxB,6BAA6B;AAAA,IAC7B,2BAA2B;AAAA,IAC3B,4BAA4B;AAAA,IAC5B,oBAAoB;AAAA,IACpB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,EACpB;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,cAAc;AAChB;AAEO,MAAM,mCAAmC,gCAAiD,cAAc;AAE/G,IAAO,uCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -63,6 +63,7 @@ const useControlledDateRangePicker = (props) => {
|
|
|
63
63
|
const withInputs = type === import_ControlledDateRangePickerTypes.CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === import_ControlledDateRangePickerTypes.CONTROLLED_DATE_RANGE_PICKER_TYPES.INPUTS;
|
|
64
64
|
const withIcon = type === import_ControlledDateRangePickerTypes.CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === import_ControlledDateRangePickerTypes.CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;
|
|
65
65
|
const isControllerOnly = type === import_ControlledDateRangePickerTypes.CONTROLLED_DATE_RANGE_PICKER_TYPES.CONTROLLER_ONLY;
|
|
66
|
+
const isPickerOnly = type === import_ControlledDateRangePickerTypes.CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;
|
|
66
67
|
const rangePickerLogic = (0, import_useRangePickerLogic.useRangePickerLogic)(propsWithDefaults);
|
|
67
68
|
const ctx = (0, import_react.useMemo)(() => ({
|
|
68
69
|
props: __spreadProps(__spreadValues({}, propsWithDefaults), { dataAttrs }),
|
|
@@ -70,7 +71,8 @@ const useControlledDateRangePicker = (props) => {
|
|
|
70
71
|
rangePickerLogic,
|
|
71
72
|
withInputs,
|
|
72
73
|
withIcon,
|
|
73
|
-
isControllerOnly
|
|
74
|
+
isControllerOnly,
|
|
75
|
+
isPickerOnly
|
|
74
76
|
}), [instanceUID, isControllerOnly, dataAttrs, propsWithDefaults, rangePickerLogic, withIcon, withInputs]);
|
|
75
77
|
return ctx;
|
|
76
78
|
};
|
|
@@ -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 { getDataProps } from '@elliemae/ds-utilities';\n\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type { DateRangePickerPropsT, ControlledDateRangePickerContextT } from '../index.d';\n\nexport const useControlledDateRangePicker = (\n props: Partial<DateRangePickerPropsT>,\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 const dataAttrs = getDataProps(props);\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\n const rangePickerLogic = useRangePickerLogic(propsWithDefaults);\n\n const ctx = useMemo(\n () => ({\n props: { ...propsWithDefaults, dataAttrs },\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n }),\n [instanceUID, isControllerOnly, dataAttrs, propsWithDefaults, rangePickerLogic, withIcon, withInputs],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAwB;AACxB,iBAAoB;AACpB,0BAA6B;AAE7B,oCAAuD;AACvD,8BAAiC;AACjC,iCAAoC;AACpC,4CAAmD;AAG5C,MAAM,+BAA+B,CAC1C,UACsC;AAEtC,gDAAiB,KAAK;AACtB,QAAM,cAAc,0BAAQ,MAAM,oBAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAM,oBAAoB,0EAAuC,KAAK;AACtE,QAAM,YAAY,sCAAa,KAAK;AACpC,QAAM,EAAE,SAAS;AAEjB,QAAM,aACJ,SAAS,yEAAmC,QAAQ,SAAS,yEAAmC;AAClG,QAAM,WACJ,SAAS,yEAAmC,QAAQ,SAAS,yEAAmC;AAClG,QAAM,mBAAmB,SAAS,yEAAmC;
|
|
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 { getDataProps } from '@elliemae/ds-utilities';\n\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type { DateRangePickerPropsT, ControlledDateRangePickerContextT } from '../index.d';\n\nexport const useControlledDateRangePicker = (\n props: Partial<DateRangePickerPropsT>,\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 const dataAttrs = getDataProps(props);\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, dataAttrs },\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n isPickerOnly,\n }),\n [instanceUID, isControllerOnly, dataAttrs, propsWithDefaults, rangePickerLogic, withIcon, withInputs],\n );\n\n return ctx;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,mBAAwB;AACxB,iBAAoB;AACpB,0BAA6B;AAE7B,oCAAuD;AACvD,8BAAiC;AACjC,iCAAoC;AACpC,4CAAmD;AAG5C,MAAM,+BAA+B,CAC1C,UACsC;AAEtC,gDAAiB,KAAK;AACtB,QAAM,cAAc,0BAAQ,MAAM,oBAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAM,oBAAoB,0EAAuC,KAAK;AACtE,QAAM,YAAY,sCAAa,KAAK;AACpC,QAAM,EAAE,SAAS;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,mBAAmB,oDAAoB,iBAAiB;AAE9D,QAAM,MAAM,0BACV,MAAO;AAAA,IACL,OAAO,iCAAK,oBAAL,EAAwB,UAAU;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IACA,CAAC,aAAa,kBAAkB,WAAW,mBAAmB,kBAAkB,UAAU,UAAU,CACtG;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.d.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 type {
|
|
4
|
+
"sourcesContent": ["import type { DSFormLayoutBlockItemPropsT } from '@elliemae/ds-form-layout-blocks';\nimport type { onDateChangeT, onInternalInputsChangeT, internalInputsChangeMetaInfo } from '../date-time-picker/index.d';\n\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 dataAttrs?: Record<string, unknown>;\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}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -51,11 +51,12 @@ var import_ControlledDateRangeFromDate = require("./ControlledDateRangeFromDate"
|
|
|
51
51
|
var import_ControlledDateRangeToDate = require("./ControlledDateRangeToDate");
|
|
52
52
|
var import_ControlledDateRangeCalendar = require("./ControlledDateRangeCalendar");
|
|
53
53
|
var import_ControlledDateRangePickerDatatestid = require("../ControlledDateRangePickerDatatestid");
|
|
54
|
+
var import_utils = require("../utils/utils");
|
|
54
55
|
const StyledWrapper = import_styled_components.default.div`
|
|
55
56
|
display: grid;
|
|
56
|
-
grid-template-columns:
|
|
57
|
+
grid-template-columns: ${({ type }) => import_utils.gridMap[type]};
|
|
57
58
|
grid-template-rows: auto;
|
|
58
|
-
${({ isControllerOnly }) => isControllerOnly ?
|
|
59
|
+
${({ isControllerOnly, isPickerOnly }) => isControllerOnly || isPickerOnly ? "" : "gap: 0px 8px;"}
|
|
59
60
|
grid-auto-flow: row;
|
|
60
61
|
grid-template-areas: '. .';
|
|
61
62
|
justify-content: center;
|
|
@@ -63,14 +64,17 @@ const StyledWrapper = import_styled_components.default.div`
|
|
|
63
64
|
`;
|
|
64
65
|
const ControlledDateRangeContent = () => {
|
|
65
66
|
const {
|
|
66
|
-
props: { dataAttrs },
|
|
67
|
+
props: { dataAttrs, type },
|
|
67
68
|
withIcon,
|
|
68
69
|
withInputs,
|
|
69
|
-
isControllerOnly
|
|
70
|
+
isControllerOnly,
|
|
71
|
+
isPickerOnly
|
|
70
72
|
} = (0, import_react.useContext)(import_ControlledDateRangePickerCTX.ControlledDateRangePickerContext);
|
|
71
73
|
return /* @__PURE__ */ import_react.default.createElement(StyledWrapper, __spreadValues({
|
|
72
74
|
isControllerOnly,
|
|
73
|
-
|
|
75
|
+
isPickerOnly,
|
|
76
|
+
"data-testid": import_ControlledDateRangePickerDatatestid.ControlledDateRangePickerDatatestid.WRAPPER,
|
|
77
|
+
type
|
|
74
78
|
}, dataAttrs), withInputs ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_ControlledDateRangeFromDate.ControlledDateRangeFromDate, null), /* @__PURE__ */ import_react.default.createElement(import_ControlledDateRangeToDate.ControlledDateRangeToDate, null)) : null, withIcon || isControllerOnly ? /* @__PURE__ */ import_react.default.createElement(import_ControlledDateRangeCalendar.ControlledDateRangeCalendar, null) : null);
|
|
75
79
|
};
|
|
76
80
|
module.exports = __toCommonJS(ControlledDateRangeContent_exports);
|
|
@@ -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 from 'styled-components';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\nimport { ControlledDateRangeFromDate } from './ControlledDateRangeFromDate';\nimport { ControlledDateRangeToDate } from './ControlledDateRangeToDate';\nimport { ControlledDateRangeCalendar } from './ControlledDateRangeCalendar';\nimport { ControlledDateRangePickerDatatestid } from '../ControlledDateRangePickerDatatestid';\n\nconst StyledWrapper = styled.div<
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,+BAAmB;AACnB,0CAAiD;AACjD,yCAA4C;AAC5C,uCAA0C;AAC1C,yCAA4C;AAC5C,iDAAoD;
|
|
4
|
+
"sourcesContent": ["import React, { useContext } from 'react';\nimport styled from 'styled-components';\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 { ControlledDateRangeTypeT } from '../index.d';\n\ninterface StyledWrapperT {\n isControllerOnly: boolean;\n isPickerOnly: boolean;\n type: ControlledDateRangeTypeT;\n}\n\nconst StyledWrapper = styled.div<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`;\n\nexport const ControlledDateRangeContent = (): JSX.Element => {\n const {\n props: { dataAttrs, type },\n withIcon,\n withInputs,\n isControllerOnly,\n isPickerOnly,\n } = useContext(ControlledDateRangePickerContext);\n\n return (\n <StyledWrapper\n isControllerOnly={isControllerOnly}\n isPickerOnly={isPickerOnly}\n data-testid={ControlledDateRangePickerDatatestid.WRAPPER}\n type={type}\n {...dataAttrs}\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
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkC;AAClC,+BAAmB;AACnB,0CAAiD;AACjD,yCAA4C;AAC5C,uCAA0C;AAC1C,yCAA4C;AAC5C,iDAAoD;AACpD,mBAAwB;AASxB,MAAM,gBAAgB,iCAAO;AAAA;AAAA,2BAEF,CAAC,EAAE,WAAW,qBAAQ;AAAA;AAAA,IAE7C,CAAC,EAAE,kBAAkB,mBAAoB,oBAAoB,eAAe,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9E,MAAM,6BAA6B,MAAmB;AAC3D,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,6BAAW,oEAAgC;AAE/C,SACE,mDAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,eAAa,+EAAoC;AAAA,IACjD;AAAA,KACI,YAEH,aACC,wFACE,mDAAC,oEAA4B,GAC7B,mDAAC,gEAA0B,CAC7B,IACE,MACH,YAAY,mBAAmB,mDAAC,oEAA4B,IAAK,IACpE;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var utils_exports = {};
|
|
29
|
+
__export(utils_exports, {
|
|
30
|
+
gridMap: () => gridMap
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
const gridMap = {
|
|
34
|
+
"full-date-range": "auto auto auto",
|
|
35
|
+
"date-range-inputs": "auto auto",
|
|
36
|
+
"date-range-picker-controller-only": "auto",
|
|
37
|
+
"date-range-picker": "auto"
|
|
38
|
+
};
|
|
39
|
+
module.exports = __toCommonJS(utils_exports);
|
|
40
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/utils/utils.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const gridMap = {\n 'full-date-range': 'auto auto auto',\n 'date-range-inputs': 'auto auto',\n 'date-range-picker-controller-only': 'auto',\n 'date-range-picker': 'auto',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,UAAU;AAAA,EACrB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,qCAAqC;AAAA,EACrC,qBAAqB;AACvB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -43,7 +43,8 @@ const defaultContext = {
|
|
|
43
43
|
instanceUID: "",
|
|
44
44
|
withInputs: false,
|
|
45
45
|
withIcon: false,
|
|
46
|
-
isControllerOnly: false
|
|
46
|
+
isControllerOnly: false,
|
|
47
|
+
isPickerOnly: false
|
|
47
48
|
};
|
|
48
49
|
const ControlledDateRangePickerContext = createContext(defaultContext);
|
|
49
50
|
var ControlledDateRangePickerCTX_default = ControlledDateRangePickerContext;
|
|
@@ -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 { DateRangePickerPropsT, ControlledDateRangePickerContextT } from './index.d';\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\nconst defaultReturnFalse = (): boolean => false;\nexport const defaultProps: DateRangePickerPropsT = {\n type: 'full-date-range',\n fromDate: '',\n onFromDateChange: noop,\n onMonthFromChange: noop,\n onDayFromChange: noop,\n onYearFromChange: noop,\n hasError: false,\n pickerFooterMsg: '',\n\n toDate: '',\n onToDateChange: noop,\n onMonthToChange: noop,\n onDayToChange: noop,\n onYearToChange: noop,\n\n emptyPickerStartingMonth: undefined,\n onCalendarOpenFocusedDay: undefined,\n isClearable: false,\n getIsDisabledDay: defaultReturnFalse,\n getIsOutOfRangeDay: defaultReturnFalse,\n autoFocus: false,\n};\nconst defaultContext = {\n props: defaultProps,\n rangePickerLogic: {\n latestChangedDate: '',\n onCalendarOpen: noop,\n onCalendarClose: noop,\n handleFromDateChange: noop,\n handleToDateChange: noop,\n handlePickerDateChange: noop,\n handlePickerMonthDateChange: noop,\n handlePickerDayDateChange: noop,\n handlePickerYearDateChange: noop,\n getIsStartRangeDay: defaultReturnFalse,\n getIsDayInRange: defaultReturnFalse,\n getIsEndRangeDay: defaultReturnFalse,\n },\n instanceUID: '',\n withInputs: false,\n withIcon: false,\n isControllerOnly: false,\n};\n/** Context for cross component communication */\nexport const ControlledDateRangePickerContext = createContext<ControlledDateRangePickerContextT>(defaultContext);\n\nexport default ControlledDateRangePickerContext;\n"],
|
|
5
|
-
"mappings": "AAAA;ACAA;AAGA,MAAM,OAAO,MAAY;AAAC;AAC1B,MAAM,qBAAqB,MAAe;AACnC,MAAM,eAAsC;AAAA,EACjD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,iBAAiB;AAAA,EAEjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAEhB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,WAAW;AACb;AACA,MAAM,iBAAiB;AAAA,EACrB,OAAO;AAAA,EACP,kBAAkB;AAAA,IAChB,mBAAmB;AAAA,IACnB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,wBAAwB;AAAA,IACxB,6BAA6B;AAAA,IAC7B,2BAA2B;AAAA,IAC3B,4BAA4B;AAAA,IAC5B,oBAAoB;AAAA,IACpB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,EACpB;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,kBAAkB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type { DateRangePickerPropsT, ControlledDateRangePickerContextT } from './index.d';\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\nconst defaultReturnFalse = (): boolean => false;\nexport const defaultProps: DateRangePickerPropsT = {\n type: 'full-date-range',\n fromDate: '',\n onFromDateChange: noop,\n onMonthFromChange: noop,\n onDayFromChange: noop,\n onYearFromChange: noop,\n hasError: false,\n pickerFooterMsg: '',\n\n toDate: '',\n onToDateChange: noop,\n onMonthToChange: noop,\n onDayToChange: noop,\n onYearToChange: noop,\n\n emptyPickerStartingMonth: undefined,\n onCalendarOpenFocusedDay: undefined,\n isClearable: false,\n getIsDisabledDay: defaultReturnFalse,\n getIsOutOfRangeDay: defaultReturnFalse,\n autoFocus: false,\n};\nconst defaultContext = {\n props: defaultProps,\n rangePickerLogic: {\n latestChangedDate: '',\n onCalendarOpen: noop,\n onCalendarClose: noop,\n handleFromDateChange: noop,\n handleToDateChange: noop,\n handlePickerDateChange: noop,\n handlePickerMonthDateChange: noop,\n handlePickerDayDateChange: noop,\n handlePickerYearDateChange: noop,\n getIsStartRangeDay: defaultReturnFalse,\n getIsDayInRange: defaultReturnFalse,\n getIsEndRangeDay: defaultReturnFalse,\n },\n instanceUID: '',\n withInputs: false,\n withIcon: false,\n isControllerOnly: false,\n isPickerOnly: false,\n};\n/** Context for cross component communication */\nexport const ControlledDateRangePickerContext = createContext<ControlledDateRangePickerContextT>(defaultContext);\n\nexport default ControlledDateRangePickerContext;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAGA,MAAM,OAAO,MAAY;AAAC;AAC1B,MAAM,qBAAqB,MAAe;AACnC,MAAM,eAAsC;AAAA,EACjD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,iBAAiB;AAAA,EAEjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAEhB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,aAAa;AAAA,EACb,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,WAAW;AACb;AACA,MAAM,iBAAiB;AAAA,EACrB,OAAO;AAAA,EACP,kBAAkB;AAAA,IAChB,mBAAmB;AAAA,IACnB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,sBAAsB;AAAA,IACtB,oBAAoB;AAAA,IACpB,wBAAwB;AAAA,IACxB,6BAA6B;AAAA,IAC7B,2BAA2B;AAAA,IAC3B,4BAA4B;AAAA,IAC5B,oBAAoB;AAAA,IACpB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,EACpB;AAAA,EACA,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,kBAAkB;AAAA,EAClB,cAAc;AAChB;AAEO,MAAM,mCAAmC,cAAiD,cAAc;AAE/G,IAAO,uCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,6 +34,7 @@ const useControlledDateRangePicker = (props) => {
|
|
|
34
34
|
const withInputs = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === CONTROLLED_DATE_RANGE_PICKER_TYPES.INPUTS;
|
|
35
35
|
const withIcon = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.FULL || type === CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;
|
|
36
36
|
const isControllerOnly = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.CONTROLLER_ONLY;
|
|
37
|
+
const isPickerOnly = type === CONTROLLED_DATE_RANGE_PICKER_TYPES.PICKER;
|
|
37
38
|
const rangePickerLogic = useRangePickerLogic(propsWithDefaults);
|
|
38
39
|
const ctx = useMemo(() => ({
|
|
39
40
|
props: __spreadProps(__spreadValues({}, propsWithDefaults), { dataAttrs }),
|
|
@@ -41,7 +42,8 @@ const useControlledDateRangePicker = (props) => {
|
|
|
41
42
|
rangePickerLogic,
|
|
42
43
|
withInputs,
|
|
43
44
|
withIcon,
|
|
44
|
-
isControllerOnly
|
|
45
|
+
isControllerOnly,
|
|
46
|
+
isPickerOnly
|
|
45
47
|
}), [instanceUID, isControllerOnly, dataAttrs, propsWithDefaults, rangePickerLogic, withIcon, withInputs]);
|
|
46
48
|
return ctx;
|
|
47
49
|
};
|
|
@@ -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 { getDataProps } from '@elliemae/ds-utilities';\n\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type { DateRangePickerPropsT, ControlledDateRangePickerContextT } from '../index.d';\n\nexport const useControlledDateRangePicker = (\n props: Partial<DateRangePickerPropsT>,\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 const dataAttrs = getDataProps(props);\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\n const rangePickerLogic = useRangePickerLogic(propsWithDefaults);\n\n const ctx = useMemo(\n () => ({\n props: { ...propsWithDefaults, dataAttrs },\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n }),\n [instanceUID, isControllerOnly, dataAttrs, propsWithDefaults, rangePickerLogic, withIcon, withInputs],\n );\n\n return ctx;\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACIA;AACA;AACA;AAEA;AACA;AACA;AACA;AAGO,MAAM,+BAA+B,CAC1C,UACsC;AAEtC,mBAAiB,KAAK;AACtB,QAAM,cAAc,QAAQ,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAM,oBAAoB,uCAAuC,KAAK;AACtE,QAAM,YAAY,aAAa,KAAK;AACpC,QAAM,EAAE,SAAS;AAEjB,QAAM,aACJ,SAAS,mCAAmC,QAAQ,SAAS,mCAAmC;AAClG,QAAM,WACJ,SAAS,mCAAmC,QAAQ,SAAS,mCAAmC;AAClG,QAAM,mBAAmB,SAAS,mCAAmC;
|
|
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 { getDataProps } from '@elliemae/ds-utilities';\n\nimport { useGetDateRangePickerWithDefaultsProps } from './useGetPropsWithDefault';\nimport { useValidateProps } from './useValidateProps';\nimport { useRangePickerLogic } from './useRangePickerLogic';\nimport { CONTROLLED_DATE_RANGE_PICKER_TYPES } from '../ControlledDateRangePickerTypes';\nimport type { DateRangePickerPropsT, ControlledDateRangePickerContextT } from '../index.d';\n\nexport const useControlledDateRangePicker = (\n props: Partial<DateRangePickerPropsT>,\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 const dataAttrs = getDataProps(props);\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, dataAttrs },\n instanceUID,\n rangePickerLogic,\n withInputs,\n withIcon,\n isControllerOnly,\n isPickerOnly,\n }),\n [instanceUID, isControllerOnly, dataAttrs, propsWithDefaults, rangePickerLogic, withIcon, withInputs],\n );\n\n return ctx;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACIA;AACA;AACA;AAEA;AACA;AACA;AACA;AAGO,MAAM,+BAA+B,CAC1C,UACsC;AAEtC,mBAAiB,KAAK;AACtB,QAAM,cAAc,QAAQ,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5C,QAAM,oBAAoB,uCAAuC,KAAK;AACtE,QAAM,YAAY,aAAa,KAAK;AACpC,QAAM,EAAE,SAAS;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,QACV,MAAO;AAAA,IACL,OAAO,iCAAK,oBAAL,EAAwB,UAAU;AAAA,IACzC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IACA,CAAC,aAAa,kBAAkB,WAAW,mBAAmB,kBAAkB,UAAU,UAAU,CACtG;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,11 +22,12 @@ import { ControlledDateRangeFromDate } from "./ControlledDateRangeFromDate";
|
|
|
22
22
|
import { ControlledDateRangeToDate } from "./ControlledDateRangeToDate";
|
|
23
23
|
import { ControlledDateRangeCalendar } from "./ControlledDateRangeCalendar";
|
|
24
24
|
import { ControlledDateRangePickerDatatestid } from "../ControlledDateRangePickerDatatestid";
|
|
25
|
+
import { gridMap } from "../utils/utils";
|
|
25
26
|
const StyledWrapper = styled.div`
|
|
26
27
|
display: grid;
|
|
27
|
-
grid-template-columns:
|
|
28
|
+
grid-template-columns: ${({ type }) => gridMap[type]};
|
|
28
29
|
grid-template-rows: auto;
|
|
29
|
-
${({ isControllerOnly }) => isControllerOnly ?
|
|
30
|
+
${({ isControllerOnly, isPickerOnly }) => isControllerOnly || isPickerOnly ? "" : "gap: 0px 8px;"}
|
|
30
31
|
grid-auto-flow: row;
|
|
31
32
|
grid-template-areas: '. .';
|
|
32
33
|
justify-content: center;
|
|
@@ -34,14 +35,17 @@ const StyledWrapper = styled.div`
|
|
|
34
35
|
`;
|
|
35
36
|
const ControlledDateRangeContent = () => {
|
|
36
37
|
const {
|
|
37
|
-
props: { dataAttrs },
|
|
38
|
+
props: { dataAttrs, type },
|
|
38
39
|
withIcon,
|
|
39
40
|
withInputs,
|
|
40
|
-
isControllerOnly
|
|
41
|
+
isControllerOnly,
|
|
42
|
+
isPickerOnly
|
|
41
43
|
} = useContext(ControlledDateRangePickerContext);
|
|
42
44
|
return /* @__PURE__ */ React2.createElement(StyledWrapper, __spreadValues({
|
|
43
45
|
isControllerOnly,
|
|
44
|
-
|
|
46
|
+
isPickerOnly,
|
|
47
|
+
"data-testid": ControlledDateRangePickerDatatestid.WRAPPER,
|
|
48
|
+
type
|
|
45
49
|
}, dataAttrs), withInputs ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ControlledDateRangeFromDate, null), /* @__PURE__ */ React2.createElement(ControlledDateRangeToDate, null)) : null, withIcon || isControllerOnly ? /* @__PURE__ */ React2.createElement(ControlledDateRangeCalendar, null) : null);
|
|
46
50
|
};
|
|
47
51
|
export {
|
|
@@ -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 from 'styled-components';\nimport { ControlledDateRangePickerContext } from '../ControlledDateRangePickerCTX';\nimport { ControlledDateRangeFromDate } from './ControlledDateRangeFromDate';\nimport { ControlledDateRangeToDate } from './ControlledDateRangeToDate';\nimport { ControlledDateRangeCalendar } from './ControlledDateRangeCalendar';\nimport { ControlledDateRangePickerDatatestid } from '../ControlledDateRangePickerDatatestid';\n\nconst StyledWrapper = styled.div<
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport styled from 'styled-components';\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 { ControlledDateRangeTypeT } from '../index.d';\n\ninterface StyledWrapperT {\n isControllerOnly: boolean;\n isPickerOnly: boolean;\n type: ControlledDateRangeTypeT;\n}\n\nconst StyledWrapper = styled.div<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`;\n\nexport const ControlledDateRangeContent = (): JSX.Element => {\n const {\n props: { dataAttrs, type },\n withIcon,\n withInputs,\n isControllerOnly,\n isPickerOnly,\n } = useContext(ControlledDateRangePickerContext);\n\n return (\n <StyledWrapper\n isControllerOnly={isControllerOnly}\n isPickerOnly={isPickerOnly}\n data-testid={ControlledDateRangePickerDatatestid.WRAPPER}\n type={type}\n {...dataAttrs}\n >\n {withInputs ? (\n <>\n <ControlledDateRangeFromDate />\n <ControlledDateRangeToDate />\n </>\n ) : null}\n {withIcon || isControllerOnly ? <ControlledDateRangeCalendar /> : null}\n </StyledWrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA,MAAM,gBAAgB,OAAO;AAAA;AAAA,2BAEF,CAAC,EAAE,WAAW,QAAQ;AAAA;AAAA,IAE7C,CAAC,EAAE,kBAAkB,mBAAoB,oBAAoB,eAAe,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAO9E,MAAM,6BAA6B,MAAmB;AAC3D,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,WAAW,gCAAgC;AAE/C,SACE,qCAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,eAAa,oCAAoC;AAAA,IACjD;AAAA,KACI,YAEH,aACC,4DACE,qCAAC,iCAA4B,GAC7B,qCAAC,+BAA0B,CAC7B,IACE,MACH,YAAY,mBAAmB,qCAAC,iCAA4B,IAAK,IACpE;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const gridMap = {
|
|
3
|
+
"full-date-range": "auto auto auto",
|
|
4
|
+
"date-range-inputs": "auto auto",
|
|
5
|
+
"date-range-picker-controller-only": "auto",
|
|
6
|
+
"date-range-picker": "auto"
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
gridMap
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/utils.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const gridMap = {\n 'full-date-range': 'auto auto auto',\n 'date-range-inputs': 'auto auto',\n 'date-range-picker-controller-only': 'auto',\n 'date-range-picker': 'auto',\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,UAAU;AAAA,EACrB,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,qCAAqC;AAAA,EACrC,qBAAqB;AACvB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-form-date-range-picker",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.43",
|
|
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.0.0-next.
|
|
39
|
-
"@elliemae/ds-form-layout-blocks": "3.0.0-next.
|
|
38
|
+
"@elliemae/ds-form-date-time-picker": "3.0.0-next.43",
|
|
39
|
+
"@elliemae/ds-form-layout-blocks": "3.0.0-next.43",
|
|
40
40
|
"@elliemae/ds-system": "3.0.0-next.29",
|
|
41
|
-
"@elliemae/ds-utilities": "3.0.0-next.
|
|
41
|
+
"@elliemae/ds-utilities": "3.0.0-next.43",
|
|
42
42
|
"react-desc": "~4.1.3",
|
|
43
43
|
"styled-components": "~5.3.3",
|
|
44
44
|
"uid": "~2.0.0"
|