@ssa-ui-kit/core 2.3.0 → 2.4.0
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/components/DatePicker/types.d.ts +1 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/DateRangePickerContext.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePickerProvider.d.ts +2 -0
- package/dist/components/DateRangePicker/components/Calendar.d.ts +1 -0
- package/dist/components/DateRangePicker/components/Content.d.ts +1 -0
- package/dist/components/DateRangePicker/components/DatesListWrapper.d.ts +10 -0
- package/dist/components/DateRangePicker/components/DaysView.d.ts +1 -0
- package/dist/components/DateRangePicker/components/Header.d.ts +1 -0
- package/dist/components/DateRangePicker/components/MonthsSwitch.d.ts +1 -0
- package/dist/components/DateRangePicker/components/MonthsView.d.ts +1 -0
- package/dist/components/DateRangePicker/components/Trigger.d.ts +1 -0
- package/dist/components/DateRangePicker/components/TriggerInput.d.ts +6 -0
- package/dist/components/DateRangePicker/components/YearsView.d.ts +1 -0
- package/dist/components/DateRangePicker/components/index.d.ts +9 -0
- package/dist/components/DateRangePicker/constants.d.ts +1 -0
- package/dist/components/DateRangePicker/helpers/ClassnameArray.d.ts +3 -0
- package/dist/components/DateRangePicker/helpers/index.d.ts +1 -0
- package/dist/components/DateRangePicker/hooks/index.d.ts +3 -0
- package/dist/components/DateRangePicker/hooks/useDatePickerMask.d.ts +10 -0
- package/dist/components/DateRangePicker/hooks/useDateRangePicker.d.ts +40 -0
- package/dist/components/DateRangePicker/hooks/useRangeHighlighting.d.ts +10 -0
- package/dist/components/DateRangePicker/styles.d.ts +34 -0
- package/dist/components/DateRangePicker/types.d.ts +35 -9
- package/dist/components/DateRangePicker/useDateRangePickerContext.d.ts +1 -0
- package/dist/components/DateRangePicker/utils/dates.d.ts +11 -0
- package/dist/components/DateRangePicker/utils/index.d.ts +1 -0
- package/dist/components/FormHelperText/types.d.ts +1 -0
- package/dist/index.js +1630 -385
- package/dist/index.js.map +1 -1
- package/dist/types/emotion.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -943,6 +943,8 @@ const main = {
|
|
|
943
943
|
// #ffffff
|
|
944
944
|
greyLighter: 'rgba(238, 241, 247, 1)',
|
|
945
945
|
// #eef1f7
|
|
946
|
+
greyLighter20: 'rgba(238, 241, 247, 0.2)',
|
|
947
|
+
//#eef1f766
|
|
946
948
|
greyLighter40: 'rgba(238, 241, 247, 0.4)',
|
|
947
949
|
//#eef1f766
|
|
948
950
|
greyLighter60: 'rgba(238, 241, 247, 0.6)',
|
|
@@ -9447,11 +9449,6 @@ const DatePickerProvider = ({
|
|
|
9447
9449
|
restHook.handleBlur(e);
|
|
9448
9450
|
rest.onBlur?.(e);
|
|
9449
9451
|
};
|
|
9450
|
-
(0,external_react_namespaceObject.useEffect)(() => {
|
|
9451
|
-
if (typeof rest.isOpenToggle === 'boolean') {
|
|
9452
|
-
restHook.setIsOpen(current => !current);
|
|
9453
|
-
}
|
|
9454
|
-
}, [rest.isOpenToggle]);
|
|
9455
9452
|
return (0,jsx_runtime_namespaceObject.jsx)(DatePickerContext.Provider, {
|
|
9456
9453
|
value: {
|
|
9457
9454
|
...rest,
|
|
@@ -10056,205 +10053,367 @@ const DatePickerInner = ({
|
|
|
10056
10053
|
format = DEFAULT_MASK_FORMAT,
|
|
10057
10054
|
openCalendarMode = 'icon',
|
|
10058
10055
|
showCalendarIcon = true,
|
|
10059
|
-
isOpenToggle,
|
|
10060
10056
|
...rest
|
|
10061
10057
|
}, inputRef) => (0,jsx_runtime_namespaceObject.jsx)(DatePickerProvider, {
|
|
10062
10058
|
format: format,
|
|
10063
10059
|
openCalendarMode: openCalendarMode,
|
|
10064
10060
|
inputRef: inputRef,
|
|
10065
10061
|
showCalendarIcon: showCalendarIcon,
|
|
10066
|
-
isOpenToggle: isOpenToggle,
|
|
10067
10062
|
...rest,
|
|
10068
10063
|
children: (0,jsx_runtime_namespaceObject.jsx)(DatePickerContent, {})
|
|
10069
10064
|
});
|
|
10070
10065
|
const DatePicker = /*#__PURE__*/(0,external_react_namespaceObject.forwardRef)(DatePickerInner);
|
|
10071
10066
|
;// ./src/components/DatePicker/index.ts
|
|
10072
10067
|
|
|
10073
|
-
;// ./src/components/
|
|
10074
|
-
|
|
10075
|
-
const
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
const
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
}) => {
|
|
10084
|
-
const {
|
|
10085
|
-
disabled = false,
|
|
10086
|
-
status = 'basic',
|
|
10087
|
-
forwardFocus = true,
|
|
10088
|
-
asChild = false,
|
|
10089
|
-
...divProps
|
|
10090
|
-
} = props;
|
|
10091
|
-
const Wrapper = asChild ? external_react_namespaceObject.Fragment : 'div';
|
|
10092
|
-
const wrapperProps = asChild ? {} : divProps;
|
|
10093
|
-
return (0,jsx_runtime_namespaceObject.jsx)(Wrapper, {
|
|
10094
|
-
...wrapperProps,
|
|
10095
|
-
children: (0,jsx_runtime_namespaceObject.jsx)(FieldProvider, {
|
|
10096
|
-
value: {
|
|
10097
|
-
disabled,
|
|
10098
|
-
status,
|
|
10099
|
-
forwardFocus
|
|
10100
|
-
},
|
|
10101
|
-
children: children
|
|
10102
|
-
})
|
|
10103
|
-
});
|
|
10104
|
-
};
|
|
10105
|
-
;// ./src/components/Field/FieldLabel.tsx
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
const FieldLabel = ({
|
|
10110
|
-
children,
|
|
10111
|
-
...props
|
|
10112
|
-
}) => {
|
|
10113
|
-
const ctx = useFieldContext();
|
|
10114
|
-
return (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
|
|
10115
|
-
isDisabled: ctx.disabled,
|
|
10116
|
-
...props,
|
|
10117
|
-
children: children
|
|
10118
|
-
});
|
|
10119
|
-
};
|
|
10120
|
-
;// ./src/components/Field/FieldControl.tsx
|
|
10068
|
+
;// ./src/components/DateRangePicker/constants.ts
|
|
10069
|
+
const constants_DEFAULT_MASK_FORMAT = 'mm/dd/yyyy';
|
|
10070
|
+
const constants_DEFAULT_MASK = '__/__/____';
|
|
10071
|
+
const constants_MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
10072
|
+
const constants_DATE_MIN = '01/01/1900';
|
|
10073
|
+
const constants_DATE_MAX = '01/01/2150';
|
|
10074
|
+
const constants_OUT_OF_RANGE = 'The date is out of the defined range';
|
|
10075
|
+
const constants_INVALID_DATE = 'Invalid date';
|
|
10076
|
+
const FULL_DATE_LENGTH = 10;
|
|
10077
|
+
;// ./src/components/DateRangePicker/components/DatesListWrapper.tsx
|
|
10121
10078
|
|
|
10122
10079
|
|
|
10080
|
+
const DatesListWrapper = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
10081
|
+
target: "e10i52w40"
|
|
10082
|
+
} : 0)("flex-wrap:wrap;&>div.hover-range-from.date-hovered,&>div.hover-range-to.date-hovered{background:", ({
|
|
10083
|
+
theme
|
|
10084
|
+
}) => theme.colors.greyLighter, ";border-left:none;border-top-left-radius:6px;border-bottom-left-radius:6px;}&>div.hover-range-from:not(.selected-range-from, .date-hovered),&>div.hover-range-to:not(.selected-range-to, .date-hovered){background:", ({
|
|
10085
|
+
theme
|
|
10086
|
+
}) => theme.colors.greyLighter60, ";border-radius:0;}&>div.hover-range-from.selected-range-from::after,&>div.hover-range-from.date-hovered::after,&>div.hover-range-to.selected-range-to::after,&>div.hover-range-to.date-hovered::after{content:'';position:absolute;width:10px;height:40px;z-index:-1;background:", ({
|
|
10087
|
+
theme
|
|
10088
|
+
}) => theme.colors.greyLighter60, ";}&>div.hover-range-from.selected-range-from::after,&>div.hover-range-to.date-hovered::after{left:0;}&>div.hover-range-from.date-hovered::after,&>div.hover-range-to.selected-range-to::after{right:0;}&>div.hover-range-form.selected-range-from:has(~ div.date-hovered)::after,&>div.hover-range-to.selected-range-to:has(+ div.date-hovered)::after,&>div.date-hovered:has(+ div.selected-range-from)::after,&>div.hover-range-to.selected-range-to+div.date-hovered::after,&>div.date-hovered+div.selected-range-from::after{background:", ({
|
|
10089
|
+
theme
|
|
10090
|
+
}) => theme.colors.greyLighter, ";}" + ( true ? "" : 0));
|
|
10091
|
+
;// ./src/components/DateRangePicker/styles.ts
|
|
10123
10092
|
|
|
10124
10093
|
|
|
10125
|
-
const
|
|
10126
|
-
target: "
|
|
10127
|
-
} : 0)("
|
|
10128
|
-
|
|
10094
|
+
const styles_DaysViewCell = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
10095
|
+
target: "e19l41fq2"
|
|
10096
|
+
} : 0)("position:relative;width:40px;height:40px;justify-content:center;font-size:14px;font-weight:500;border-radius:", ({
|
|
10097
|
+
isHighlighted
|
|
10098
|
+
}) => isHighlighted ? 0 : '6px', ";border:", ({
|
|
10099
|
+
theme,
|
|
10100
|
+
isCalendarDateNow
|
|
10101
|
+
}) => isCalendarDateNow ? `1px solid ${theme.colors.greyFocused}` : 'none', ";color:", ({
|
|
10102
|
+
theme,
|
|
10103
|
+
isCalendarDateSelected
|
|
10104
|
+
}) => isCalendarDateSelected ? theme.colors.white : theme.colors.greyDarker, ";background:", ({
|
|
10105
|
+
theme,
|
|
10106
|
+
isCalendarDateSelected
|
|
10107
|
+
}) => isCalendarDateSelected && `linear-gradient(247deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)`, ";cursor:pointer;user-select:none;&[aria-disabled='true']{color:", ({
|
|
10129
10108
|
theme
|
|
10130
|
-
}) => {
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
}, "
|
|
10135
|
-
disabled,
|
|
10109
|
+
}) => theme.colors.grey, ";cursor:default;pointer-events:none;}&[aria-disabled='false']{background:", ({
|
|
10110
|
+
theme,
|
|
10111
|
+
isCalendarDateSelected,
|
|
10112
|
+
isHighlighted
|
|
10113
|
+
}) => isHighlighted && !isCalendarDateSelected && theme.colors.blueRoyal16, ";&:hover{background:", ({
|
|
10136
10114
|
theme
|
|
10137
|
-
}) =>
|
|
10138
|
-
disabled,
|
|
10115
|
+
}) => theme.colors.greyLighter, ";color:", ({
|
|
10139
10116
|
theme
|
|
10140
|
-
}) =>
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10117
|
+
}) => theme.colors.greyDarker, ";}&::before{content:'';display:", ({
|
|
10118
|
+
isCalendarFirstDateSelected,
|
|
10119
|
+
isCalendarSecondDateSelected
|
|
10120
|
+
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
10121
|
+
isCalendarSecondDateSelected
|
|
10122
|
+
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
10123
|
+
isCalendarFirstDateSelected
|
|
10124
|
+
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
10145
10125
|
theme
|
|
10146
|
-
}) => {
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10126
|
+
}) => theme.colors.blueRoyal16, ";}}&:hover{border:", ({
|
|
10127
|
+
theme,
|
|
10128
|
+
isCalendarDateNow
|
|
10129
|
+
}) => isCalendarDateNow && `1px solid ${theme.colors.greyFocused}`, ";}" + ( true ? "" : 0));
|
|
10130
|
+
const styles_YearsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
10131
|
+
target: "e19l41fq1"
|
|
10132
|
+
} : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:70px;height:40px;border-radius:", ({
|
|
10133
|
+
isCalendarFirstDateSelected,
|
|
10134
|
+
isCalendarSecondDateSelected
|
|
10135
|
+
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? '6px' : 0, ";font-size:14px;font-weight:500px;user-select:none;cursor:pointer;color:", ({
|
|
10136
|
+
theme,
|
|
10137
|
+
isCalendarYear,
|
|
10138
|
+
isCalendarFirstDateSelected,
|
|
10139
|
+
isCalendarSecondDateSelected
|
|
10140
|
+
}) => (isCalendarYear || isCalendarFirstDateSelected || isCalendarSecondDateSelected) && theme.colors.white, ";background:", ({
|
|
10141
|
+
theme,
|
|
10142
|
+
isCalendarYear,
|
|
10143
|
+
isCalendarFirstDateSelected,
|
|
10144
|
+
isCalendarSecondDateSelected
|
|
10145
|
+
}) => isCalendarYear || isCalendarFirstDateSelected || isCalendarSecondDateSelected ? `linear-gradient(247.37deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";background:", ({
|
|
10146
|
+
theme,
|
|
10147
|
+
isHighlighted,
|
|
10148
|
+
isCalendarYear
|
|
10149
|
+
}) => isHighlighted && !isCalendarYear && theme.colors.blueRoyal16, ";&:hover{background:", ({
|
|
10150
|
+
theme
|
|
10151
|
+
}) => theme.colors.greyLighter, ";color:", ({
|
|
10152
|
+
theme
|
|
10153
|
+
}) => theme.colors.greyDarker, ";border-radius:6px;}&::before{content:'';display:", ({
|
|
10154
|
+
isCalendarFirstDateSelected,
|
|
10155
|
+
isCalendarSecondDateSelected
|
|
10156
|
+
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
10157
|
+
isCalendarSecondDateSelected
|
|
10158
|
+
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
10159
|
+
isCalendarFirstDateSelected
|
|
10160
|
+
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
10161
|
+
theme
|
|
10162
|
+
}) => theme.colors.blueRoyal16, ";}" + ( true ? "" : 0));
|
|
10163
|
+
const styles_MonthsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
10164
|
+
target: "e19l41fq0"
|
|
10165
|
+
} : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:99px;height:40px;border-radius:", ({
|
|
10166
|
+
isCalendarFirstDateSelected,
|
|
10167
|
+
isCalendarSecondDateSelected
|
|
10168
|
+
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? '6px' : 0, ";font-size:14px;font-weight:500;cursor:pointer;color:", ({
|
|
10169
|
+
theme,
|
|
10170
|
+
isCalendarMonth,
|
|
10171
|
+
isCalendarFirstDateSelected,
|
|
10172
|
+
isCalendarSecondDateSelected
|
|
10173
|
+
}) => (isCalendarMonth || isCalendarFirstDateSelected || isCalendarSecondDateSelected) && theme.colors.white, ";user-select:none;background:", ({
|
|
10174
|
+
theme,
|
|
10175
|
+
isCalendarMonth,
|
|
10176
|
+
isCalendarFirstDateSelected,
|
|
10177
|
+
isCalendarSecondDateSelected
|
|
10178
|
+
}) => isCalendarMonth || isCalendarFirstDateSelected || isCalendarSecondDateSelected ? `linear-gradient(247.37deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";&[aria-disabled='true']{cursor:default;pointer-events:none;color:", ({
|
|
10179
|
+
theme
|
|
10180
|
+
}) => theme.colors.greyDarker, ";background:", ({
|
|
10181
|
+
theme
|
|
10182
|
+
}) => theme.colors.grey, ";}&[aria-disabled='false']{background:", ({
|
|
10183
|
+
theme,
|
|
10184
|
+
isHighlighted,
|
|
10185
|
+
isCalendarMonth,
|
|
10186
|
+
isCalendarSecondDateSelected
|
|
10187
|
+
}) => isHighlighted && !isCalendarMonth && !isCalendarSecondDateSelected && theme.colors.blueRoyal16, ";&:hover{background:", ({
|
|
10188
|
+
theme
|
|
10189
|
+
}) => theme.colors.greyLighter, ";color:", ({
|
|
10190
|
+
theme
|
|
10191
|
+
}) => theme.colors.greyDarker, ";}&::before{content:'';display:", ({
|
|
10192
|
+
isCalendarFirstDateSelected,
|
|
10193
|
+
isCalendarSecondDateSelected
|
|
10194
|
+
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
10195
|
+
isCalendarSecondDateSelected
|
|
10196
|
+
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
10197
|
+
isCalendarFirstDateSelected
|
|
10198
|
+
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
10199
|
+
theme
|
|
10200
|
+
}) => theme.colors.blueRoyal16, ";}}" + ( true ? "" : 0));
|
|
10201
|
+
;// ./src/components/DateRangePicker/utils/dates.ts
|
|
10202
|
+
|
|
10203
|
+
const dates_getDaysForCalendarMonth = date => {
|
|
10204
|
+
if (!date) {
|
|
10205
|
+
return [];
|
|
10155
10206
|
}
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
const
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
...props,
|
|
10166
|
-
...ctx
|
|
10167
|
-
};
|
|
10168
|
-
const internalRef = (0,external_react_namespaceObject.useRef)(null);
|
|
10169
|
-
let _children = typeof children === 'function' ? children(ctx) : children;
|
|
10170
|
-
if (ctx.forwardFocus && /*#__PURE__*/(0,external_react_namespaceObject.isValidElement)(_children) && isForwardRefComponent(_children)) {
|
|
10171
|
-
const setRef = defaultRef => element => {
|
|
10172
|
-
internalRef.current = element;
|
|
10173
|
-
if (defaultRef) {
|
|
10174
|
-
if (typeof defaultRef === 'function') {
|
|
10175
|
-
defaultRef(element);
|
|
10176
|
-
} else {
|
|
10177
|
-
defaultRef.current = element;
|
|
10178
|
-
}
|
|
10179
|
-
}
|
|
10180
|
-
};
|
|
10181
|
-
_children = /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(_children, {
|
|
10182
|
-
ref: setRef(children.ref)
|
|
10207
|
+
const firstDayOfMonth = external_luxon_namespaceObject.DateTime.fromJSDate(date).startOf('month');
|
|
10208
|
+
const firstDayOfCal = firstDayOfMonth.startOf('week');
|
|
10209
|
+
const lastDayOfMonth = firstDayOfMonth.endOf('month');
|
|
10210
|
+
const lastDayOfCal = lastDayOfMonth.endOf('week');
|
|
10211
|
+
const days = [firstDayOfCal.toJSDate()];
|
|
10212
|
+
let temp = firstDayOfCal;
|
|
10213
|
+
while (temp.toMillis() < lastDayOfCal.toMillis() && days.length < 42) {
|
|
10214
|
+
temp = temp.plus({
|
|
10215
|
+
days: 1
|
|
10183
10216
|
});
|
|
10217
|
+
days.push(temp.toJSDate());
|
|
10184
10218
|
}
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
if (controlRef) {
|
|
10191
|
-
controlRef.current?.focus?.();
|
|
10192
|
-
} else if (internalRef.current) {
|
|
10193
|
-
internalRef.current?.focus?.();
|
|
10194
|
-
}
|
|
10195
|
-
},
|
|
10196
|
-
children: _children
|
|
10197
|
-
});
|
|
10198
|
-
});
|
|
10199
|
-
;// ./src/components/Field/FieldDescription.tsx
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
const FieldDescription = ({
|
|
10204
|
-
children
|
|
10205
|
-
}) => {
|
|
10206
|
-
const ctx = useFieldContext();
|
|
10207
|
-
if (ctx.status !== 'basic') {
|
|
10208
|
-
return null;
|
|
10219
|
+
while (days.length < 42) {
|
|
10220
|
+
temp = temp.plus({
|
|
10221
|
+
days: 1
|
|
10222
|
+
});
|
|
10223
|
+
days.push(temp.toJSDate());
|
|
10209
10224
|
}
|
|
10210
|
-
return
|
|
10211
|
-
status: "basic",
|
|
10212
|
-
children: children
|
|
10213
|
-
});
|
|
10225
|
+
return days;
|
|
10214
10226
|
};
|
|
10215
|
-
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
const
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10227
|
+
const dates_getWeekDays = () => {
|
|
10228
|
+
const firstDayOfMonth = external_luxon_namespaceObject.DateTime.fromJSDate(new Date()).startOf('month');
|
|
10229
|
+
const firstDayOfWeek = firstDayOfMonth.startOf('week');
|
|
10230
|
+
const lastDayOfWeek = firstDayOfMonth.endOf('week');
|
|
10231
|
+
const days = [firstDayOfWeek.toFormat('ccccc')];
|
|
10232
|
+
let temp = firstDayOfWeek;
|
|
10233
|
+
while (temp.toMillis() < lastDayOfWeek.toMillis()) {
|
|
10234
|
+
temp = temp.plus({
|
|
10235
|
+
days: 1
|
|
10236
|
+
});
|
|
10237
|
+
days.push(temp.toFormat('ccccc'));
|
|
10225
10238
|
}
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
children: children
|
|
10229
|
-
});
|
|
10239
|
+
days.pop();
|
|
10240
|
+
return days;
|
|
10230
10241
|
};
|
|
10231
|
-
|
|
10242
|
+
const dates_getYearsList = props => {
|
|
10243
|
+
const {
|
|
10244
|
+
yearsFrom = 1900,
|
|
10245
|
+
yearsCount = 250
|
|
10246
|
+
} = props || {};
|
|
10247
|
+
return Array.from({
|
|
10248
|
+
length: yearsCount
|
|
10249
|
+
}, (value, index) => yearsFrom + index);
|
|
10250
|
+
};
|
|
10251
|
+
const dates_processDate = (dateParts, yearMin, yearMax) => {
|
|
10252
|
+
const yearMinStr = yearMin.toString();
|
|
10253
|
+
const yearMaxStr = yearMax.toString();
|
|
10254
|
+
const {
|
|
10255
|
+
day,
|
|
10256
|
+
month,
|
|
10257
|
+
year
|
|
10258
|
+
} = dateParts;
|
|
10259
|
+
if (typeof month === 'string' && month.length === 2) {
|
|
10260
|
+
const monthN = Number(month);
|
|
10261
|
+
if (monthN < 1 || monthN > 12) {
|
|
10262
|
+
return false;
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
if (typeof day === 'string' && day.length === 2) {
|
|
10266
|
+
const dayN = Number(day);
|
|
10267
|
+
if (dayN < 1 || dayN > 31) {
|
|
10268
|
+
return false;
|
|
10269
|
+
}
|
|
10270
|
+
}
|
|
10271
|
+
if (typeof year === 'string' && year.length > 0) {
|
|
10272
|
+
const yearN = Number(year);
|
|
10273
|
+
const yearMinPart = Number(yearMinStr.slice(0, year.length));
|
|
10274
|
+
const yearMaxPart = Number(yearMaxStr.slice(0, year.length));
|
|
10275
|
+
if (yearN < yearMinPart || yearN > yearMaxPart) {
|
|
10276
|
+
return false;
|
|
10277
|
+
}
|
|
10278
|
+
}
|
|
10279
|
+
return true;
|
|
10280
|
+
};
|
|
10281
|
+
;// ./src/components/DateRangePicker/DateRangePickerContext.tsx
|
|
10232
10282
|
|
|
10233
10283
|
|
|
10234
10284
|
|
|
10235
|
-
const
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10285
|
+
const DateRangePickerContext = /*#__PURE__*/(0,external_react_namespaceObject.createContext)({
|
|
10286
|
+
format: constants_DEFAULT_MASK_FORMAT,
|
|
10287
|
+
name: '',
|
|
10288
|
+
nameFrom: '',
|
|
10289
|
+
nameTo: '',
|
|
10290
|
+
maskOptions: {},
|
|
10291
|
+
openCalendarMode: 'icon',
|
|
10292
|
+
inputFromRef: {
|
|
10293
|
+
current: null
|
|
10294
|
+
},
|
|
10295
|
+
inputToRef: {
|
|
10296
|
+
current: null
|
|
10297
|
+
},
|
|
10298
|
+
inputProps: {},
|
|
10299
|
+
isOpen: false,
|
|
10300
|
+
isOpenState: false,
|
|
10301
|
+
calendarType: 'days',
|
|
10302
|
+
inputValueFrom: undefined,
|
|
10303
|
+
inputValueTo: undefined,
|
|
10304
|
+
dateTime: [undefined, undefined],
|
|
10305
|
+
calendarViewDateTime: [undefined, undefined],
|
|
10306
|
+
dateMinParts: constants_DATE_MIN.split('/').map(Number),
|
|
10307
|
+
dateMaxParts: constants_DATE_MAX.split('/').map(Number),
|
|
10308
|
+
dateMinDT: external_luxon_namespaceObject.DateTime.fromFormat(constants_DATE_MIN, constants_DEFAULT_MASK_FORMAT),
|
|
10309
|
+
dateMaxDT: external_luxon_namespaceObject.DateTime.fromFormat(constants_DATE_MAX, constants_DEFAULT_MASK_FORMAT),
|
|
10310
|
+
formatIndexes: {
|
|
10311
|
+
day: 1,
|
|
10312
|
+
month: 0,
|
|
10313
|
+
year: 2
|
|
10314
|
+
},
|
|
10315
|
+
lastFocusedElement: 'from',
|
|
10316
|
+
currentCalendarViewDT: external_luxon_namespaceObject.DateTime.now().set({
|
|
10317
|
+
day: 1
|
|
10318
|
+
}),
|
|
10319
|
+
currentIndex: 0,
|
|
10320
|
+
handleSetIsOpen: () => {
|
|
10321
|
+
// no-op
|
|
10322
|
+
},
|
|
10323
|
+
handleToggleOpen: () => {
|
|
10324
|
+
// no-op
|
|
10325
|
+
},
|
|
10326
|
+
setIsOpen: () => {
|
|
10327
|
+
// no-op
|
|
10328
|
+
},
|
|
10329
|
+
setCalendarType: () => {
|
|
10330
|
+
// no-op
|
|
10331
|
+
},
|
|
10332
|
+
setCalendarViewDateTime: () => {
|
|
10333
|
+
// no-op
|
|
10334
|
+
},
|
|
10335
|
+
setDateTime: () => {
|
|
10336
|
+
// no-op
|
|
10337
|
+
},
|
|
10338
|
+
setLastFocusedElement: () => {
|
|
10339
|
+
// no-op
|
|
10241
10340
|
}
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10341
|
+
});
|
|
10342
|
+
;// ./src/components/DateRangePicker/useDateRangePickerContext.tsx
|
|
10343
|
+
|
|
10344
|
+
|
|
10345
|
+
const useDateRangePickerContext = () => (0,external_react_namespaceObject.useContext)(DateRangePickerContext);
|
|
10346
|
+
;// ./src/components/DateRangePicker/helpers/ClassnameArray.ts
|
|
10347
|
+
class ClassnameArray extends Array {
|
|
10348
|
+
toggle(className, condition) {
|
|
10349
|
+
const index = this.indexOf(className);
|
|
10350
|
+
if (condition) {
|
|
10351
|
+
if (index === -1) {
|
|
10352
|
+
this.push(className);
|
|
10353
|
+
}
|
|
10354
|
+
} else {
|
|
10355
|
+
if (index > -1) {
|
|
10356
|
+
this.splice(index, 1);
|
|
10357
|
+
}
|
|
10358
|
+
}
|
|
10359
|
+
return this;
|
|
10360
|
+
}
|
|
10361
|
+
}
|
|
10362
|
+
;// ./src/components/DateRangePicker/hooks/useRangeHighlighting.ts
|
|
10363
|
+
|
|
10364
|
+
|
|
10365
|
+
|
|
10366
|
+
const useRangeHighlighting = () => {
|
|
10367
|
+
const [hoveredDate, setHoveredDate] = (0,external_react_namespaceObject.useState)(null);
|
|
10368
|
+
const {
|
|
10369
|
+
dateTime,
|
|
10370
|
+
lastFocusedElement
|
|
10371
|
+
} = useDateRangePickerContext();
|
|
10372
|
+
const handleDateHover = currentDT => {
|
|
10373
|
+
setHoveredDate(currentDT);
|
|
10374
|
+
};
|
|
10375
|
+
const getClassNames = (currentDT, {
|
|
10376
|
+
isCalendarFirstDateSelected,
|
|
10377
|
+
isCalendarSecondDateSelected
|
|
10378
|
+
}) => {
|
|
10379
|
+
const classNames = new ClassnameArray();
|
|
10380
|
+
let isHoverRangeHighlightFrom = false;
|
|
10381
|
+
let isHoverRangeHighlightTo = false;
|
|
10382
|
+
if (hoveredDate !== null) {
|
|
10383
|
+
if (dateTime[0] && lastFocusedElement === 'from' && hoveredDate < dateTime[0]) {
|
|
10384
|
+
isHoverRangeHighlightFrom = currentDT >= hoveredDate && currentDT <= dateTime[0];
|
|
10385
|
+
}
|
|
10386
|
+
if (dateTime[1] && lastFocusedElement === 'to' && hoveredDate > dateTime[1]) {
|
|
10387
|
+
isHoverRangeHighlightTo = currentDT <= hoveredDate && currentDT >= dateTime[1];
|
|
10388
|
+
}
|
|
10389
|
+
}
|
|
10390
|
+
classNames.toggle('hover-range-from', isHoverRangeHighlightFrom);
|
|
10391
|
+
classNames.toggle('hover-range-to', isHoverRangeHighlightTo);
|
|
10392
|
+
classNames.toggle('selected-range-from', isCalendarFirstDateSelected);
|
|
10393
|
+
classNames.toggle('selected-range-to', isCalendarSecondDateSelected);
|
|
10394
|
+
classNames.toggle('date-hovered', hoveredDate?.toISODate() === currentDT.toISODate());
|
|
10395
|
+
return classNames.values().toArray();
|
|
10396
|
+
};
|
|
10397
|
+
const isHighlightDate = currentDT => {
|
|
10398
|
+
if (dateTime[0] && dateTime[1]) {
|
|
10399
|
+
return currentDT > dateTime[0] && currentDT < dateTime[1];
|
|
10400
|
+
} else if (dateTime[0] && hoveredDate) {
|
|
10401
|
+
return currentDT > dateTime[0] && currentDT < hoveredDate;
|
|
10402
|
+
} else if (dateTime[1] && hoveredDate) {
|
|
10403
|
+
return currentDT < dateTime[1] && currentDT > hoveredDate;
|
|
10404
|
+
}
|
|
10405
|
+
return false;
|
|
10406
|
+
};
|
|
10407
|
+
return {
|
|
10408
|
+
handleDateHover,
|
|
10409
|
+
getClassNames,
|
|
10410
|
+
isHighlightDate,
|
|
10411
|
+
hoveredDate
|
|
10412
|
+
};
|
|
10246
10413
|
};
|
|
10247
|
-
;// ./src/components/DateRangePicker/
|
|
10248
|
-
|
|
10249
|
-
const constants_DEFAULT_MASK = '__/__/____';
|
|
10250
|
-
const constants_MONTHS = (/* unused pure expression or super */ null && (['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']));
|
|
10251
|
-
const constants_DATE_MIN = '01/01/1900';
|
|
10252
|
-
const constants_DATE_MAX = '01/01/2150';
|
|
10253
|
-
const constants_OUT_OF_RANGE = 'The date is out of the defined range';
|
|
10254
|
-
const constants_INVALID_DATE = 'Invalid date';
|
|
10255
|
-
;// ./src/components/DateRangePicker/DateRangePicker.tsx
|
|
10414
|
+
;// ./src/components/DateRangePicker/components/DaysView.tsx
|
|
10415
|
+
function components_DaysView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10256
10416
|
|
|
10257
|
-
function DateRangePicker_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10258
10417
|
|
|
10259
10418
|
|
|
10260
10419
|
|
|
@@ -10262,234 +10421,1320 @@ function DateRangePicker_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tri
|
|
|
10262
10421
|
|
|
10263
10422
|
|
|
10264
10423
|
|
|
10265
|
-
// keep the same place for datepicker (from / to)
|
|
10266
|
-
// don't close the datepicker while switching between from / to
|
|
10267
|
-
// add errors (date to less than date from...)
|
|
10268
|
-
// add a logic to reset date to when date to less than date from
|
|
10269
|
-
// create subcomponents
|
|
10270
|
-
// hover daterange effect for the datepicker (from design)
|
|
10271
10424
|
|
|
10272
|
-
var
|
|
10273
|
-
name: "
|
|
10274
|
-
styles: "
|
|
10425
|
+
var components_DaysView_ref = true ? {
|
|
10426
|
+
name: "hisq2i",
|
|
10427
|
+
styles: "padding-left:9px"
|
|
10275
10428
|
} : 0;
|
|
10276
|
-
var
|
|
10277
|
-
name: "
|
|
10278
|
-
styles: "
|
|
10429
|
+
var components_DaysView_ref2 = true ? {
|
|
10430
|
+
name: "yzljcr",
|
|
10431
|
+
styles: "width:40px;height:40px;justify-content:center;font-size:12px;font-weight:600;cursor:default;user-select:none"
|
|
10279
10432
|
} : 0;
|
|
10280
|
-
var
|
|
10281
|
-
name: "
|
|
10282
|
-
styles: "
|
|
10433
|
+
var components_DaysView_ref3 = true ? {
|
|
10434
|
+
name: "hisq2i",
|
|
10435
|
+
styles: "padding-left:9px"
|
|
10283
10436
|
} : 0;
|
|
10284
|
-
const
|
|
10285
|
-
|
|
10286
|
-
openCalendarMode = 'both',
|
|
10287
|
-
name,
|
|
10288
|
-
label,
|
|
10289
|
-
value,
|
|
10290
|
-
defaultValue,
|
|
10291
|
-
...rest
|
|
10292
|
-
}) => {
|
|
10293
|
-
const theme = (0,react_namespaceObject.useTheme)();
|
|
10294
|
-
// const [_value, _setValue] = useState(value || []);
|
|
10295
|
-
const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)();
|
|
10296
|
-
const [currentStatus, setCurrentStatus] = (0,external_react_namespaceObject.useState)(rest.status);
|
|
10297
|
-
const errorsFrom = formContext.formState.errors[`${name}From`]?.message;
|
|
10298
|
-
const errorsTo = formContext.formState.errors[`${name}To`]?.message;
|
|
10299
|
-
const errorMessage = [errorsFrom, errorsTo].filter(Boolean);
|
|
10437
|
+
const DaysView_DaysView = () => {
|
|
10438
|
+
const weekDays = dates_getWeekDays();
|
|
10300
10439
|
const {
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
(
|
|
10320
|
-
|
|
10321
|
-
}, [rest.status]);
|
|
10322
|
-
(0,external_react_namespaceObject.useEffect)(() => {
|
|
10323
|
-
if (errorMessage.length) {
|
|
10324
|
-
setCurrentStatus('error');
|
|
10325
|
-
} else {
|
|
10326
|
-
setCurrentStatus(rest.status || 'basic');
|
|
10327
|
-
}
|
|
10328
|
-
}, [errorMessage]);
|
|
10329
|
-
const toggleOpen = () => {
|
|
10330
|
-
if (lastFocusedElement === 'from') {
|
|
10331
|
-
setFromOpenToggle(current => !current);
|
|
10332
|
-
setTimeout(() => datepickerFromRef.current?.focus(), 5);
|
|
10333
|
-
} else {
|
|
10334
|
-
setToOpenToggle(current => !current);
|
|
10335
|
-
setTimeout(() => datepickerToRef.current?.focus(), 5);
|
|
10336
|
-
}
|
|
10337
|
-
};
|
|
10338
|
-
const handleToggleOpen = e => {
|
|
10339
|
-
const tagName = e.currentTarget.tagName.toLowerCase();
|
|
10340
|
-
if (openCalendarMode === 'both' || openCalendarMode === 'input' && tagName === 'input' || openCalendarMode === 'icon' && tagName === 'button') {
|
|
10341
|
-
toggleOpen();
|
|
10342
|
-
}
|
|
10343
|
-
if (tagName === 'input' && rest.inputProps?.inputProps?.onClick) {
|
|
10344
|
-
rest.inputProps.inputProps.onClick(e);
|
|
10345
|
-
}
|
|
10346
|
-
};
|
|
10347
|
-
const handleFocus = e => {
|
|
10440
|
+
dateTime,
|
|
10441
|
+
calendarViewDateTime,
|
|
10442
|
+
dateMinDT,
|
|
10443
|
+
dateMaxDT,
|
|
10444
|
+
lastFocusedElement,
|
|
10445
|
+
currentCalendarViewDT,
|
|
10446
|
+
setCalendarViewDateTime,
|
|
10447
|
+
setDateTime,
|
|
10448
|
+
setIsOpen
|
|
10449
|
+
} = useDateRangePickerContext();
|
|
10450
|
+
const currentDate = currentCalendarViewDT.toJSDate();
|
|
10451
|
+
const currentMonth = currentDate?.getMonth();
|
|
10452
|
+
const dates = dates_getDaysForCalendarMonth(currentDate);
|
|
10453
|
+
const nowDate = external_luxon_namespaceObject.DateTime.fromJSDate(new Date()).toFormat('D');
|
|
10454
|
+
const {
|
|
10455
|
+
handleDateHover,
|
|
10456
|
+
getClassNames,
|
|
10457
|
+
isHighlightDate
|
|
10458
|
+
} = useRangeHighlighting();
|
|
10459
|
+
const handleDaySelect = event => {
|
|
10348
10460
|
const {
|
|
10349
|
-
|
|
10350
|
-
} =
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
const
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
}
|
|
10363
|
-
rest.onChange?.(changedData);
|
|
10364
|
-
}
|
|
10365
|
-
};
|
|
10366
|
-
const onChangeTo = date => {
|
|
10367
|
-
const newDate = date || null;
|
|
10368
|
-
if (changedDate[0] && newDate) {
|
|
10369
|
-
const selectedDateFromDT = external_luxon_namespaceObject.DateTime.fromJSDate(changedDate[0]);
|
|
10370
|
-
const selectedDateToDT = external_luxon_namespaceObject.DateTime.fromJSDate(newDate);
|
|
10371
|
-
if (selectedDateFromDT > selectedDateToDT) {
|
|
10372
|
-
const changedData = [newDate, null];
|
|
10373
|
-
setChangedDate(changedData);
|
|
10374
|
-
|
|
10375
|
-
// const dateStr = DateTime.fromJSDate(newDate).toFormat(
|
|
10376
|
-
// format.replace('mm', 'MM'),
|
|
10377
|
-
// );
|
|
10378
|
-
// _setValue([dateStr, _value[1] === undefined ? '' : undefined]);
|
|
10379
|
-
// _setValue([dateStr, undefined]);
|
|
10380
|
-
datepickerToRef.current?.focus();
|
|
10381
|
-
rest.onChange?.(changedData);
|
|
10382
|
-
return;
|
|
10461
|
+
target
|
|
10462
|
+
} = event;
|
|
10463
|
+
const selectedDay = Number(target.innerHTML);
|
|
10464
|
+
const isEnabled = target.getAttribute('aria-disabled') === 'false';
|
|
10465
|
+
if (isEnabled) {
|
|
10466
|
+
const newDate = currentCalendarViewDT.set({
|
|
10467
|
+
day: selectedDay
|
|
10468
|
+
});
|
|
10469
|
+
const newDateTuple = lastFocusedElement === 'from' ? [newDate, dateTime[1]] : [dateTime[0], newDate];
|
|
10470
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, dateTime[1] ? calendarViewDateTime?.[1] : newDate] : [dateTime[0] ? calendarViewDateTime?.[0] : newDate, newDate]);
|
|
10471
|
+
setDateTime(newDateTuple);
|
|
10472
|
+
if (newDateTuple[0] && newDateTuple[1]) {
|
|
10473
|
+
setIsOpen(false);
|
|
10383
10474
|
}
|
|
10384
10475
|
}
|
|
10385
|
-
if (newDate !== changedDate?.[1]) {
|
|
10386
|
-
const changedData = [changedDate ? changedDate[0] : null, newDate];
|
|
10387
|
-
setChangedDate(changedData);
|
|
10388
|
-
datepickerToRef.current?.focus();
|
|
10389
|
-
rest.onChange?.(changedData);
|
|
10390
|
-
}
|
|
10391
10476
|
};
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
},
|
|
10420
|
-
inputProps: {
|
|
10421
|
-
showStatusIcon: false,
|
|
10422
|
-
...rest.inputProps,
|
|
10423
|
-
inputProps: {
|
|
10424
|
-
...rest.inputProps?.inputProps,
|
|
10425
|
-
onFocus: handleFocus,
|
|
10426
|
-
onClick: handleToggleOpen
|
|
10427
|
-
}
|
|
10477
|
+
return (0,jsx_runtime_namespaceObject.jsxs)((external_react_default()).Fragment, {
|
|
10478
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
10479
|
+
css: components_DaysView_ref,
|
|
10480
|
+
children: weekDays.map((weekDay, index) => (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
10481
|
+
css: components_DaysView_ref2,
|
|
10482
|
+
children: weekDay
|
|
10483
|
+
}, `week-day-${weekDay}-${index}`))
|
|
10484
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
|
|
10485
|
+
css: components_DaysView_ref3,
|
|
10486
|
+
onClick: handleDaySelect,
|
|
10487
|
+
children: dates.map((currentDate, index) => {
|
|
10488
|
+
const currentDT = external_luxon_namespaceObject.DateTime.fromJSDate(currentDate);
|
|
10489
|
+
const calendarDate = currentDT.toFormat('D');
|
|
10490
|
+
const calendarDay = currentDate.getDate();
|
|
10491
|
+
const calendarMonth = currentDate.getMonth();
|
|
10492
|
+
const ariaLabel = currentDT.toLocaleString(external_luxon_namespaceObject.DateTime.DATE_HUGE);
|
|
10493
|
+
const isCalendarDateNow = nowDate === calendarDate;
|
|
10494
|
+
const isCalendarMonth = currentMonth === calendarMonth;
|
|
10495
|
+
const isCalendarFirstDateSelected = calendarDate === dateTime[0]?.toFormat('D');
|
|
10496
|
+
const isCalendarSecondDateSelected = calendarDate === dateTime[1]?.toFormat('D');
|
|
10497
|
+
const isCalendarDateSelected = isCalendarFirstDateSelected || isCalendarSecondDateSelected;
|
|
10498
|
+
let isAriaDisabled = false;
|
|
10499
|
+
if (dateMinDT && dateMaxDT) {
|
|
10500
|
+
isAriaDisabled = currentDT < dateMinDT || currentDT > dateMaxDT || !isCalendarMonth;
|
|
10501
|
+
} else {
|
|
10502
|
+
if (dateMinDT) {
|
|
10503
|
+
isAriaDisabled = currentDT < dateMinDT || !isCalendarMonth;
|
|
10428
10504
|
}
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
size: 18,
|
|
10432
|
-
color: theme.colors.greyDarker80,
|
|
10433
|
-
css: DateRangePicker_ref2
|
|
10434
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(DatePicker, {
|
|
10435
|
-
format: format,
|
|
10436
|
-
openCalendarMode: openCalendarMode,
|
|
10437
|
-
isOpenToggle: toOpenToggle,
|
|
10438
|
-
name: `${name}To`,
|
|
10439
|
-
value: valueTo,
|
|
10440
|
-
defaultValue: defaultValueTo,
|
|
10441
|
-
label: '',
|
|
10442
|
-
showCalendarIcon: false,
|
|
10443
|
-
...rest,
|
|
10444
|
-
ref: datepickerToRef,
|
|
10445
|
-
onChange: onChangeTo,
|
|
10446
|
-
highlightDates: {
|
|
10447
|
-
enabled: true,
|
|
10448
|
-
mode: 'dateTo',
|
|
10449
|
-
otherDate: changedDate[0]
|
|
10450
|
-
},
|
|
10451
|
-
inputProps: {
|
|
10452
|
-
showStatusIcon: false,
|
|
10453
|
-
...rest.inputProps,
|
|
10454
|
-
inputProps: {
|
|
10455
|
-
...rest.inputProps?.inputProps,
|
|
10456
|
-
onFocus: handleFocus,
|
|
10457
|
-
onClick: handleToggleOpen
|
|
10458
|
-
}
|
|
10505
|
+
if (dateMaxDT) {
|
|
10506
|
+
isAriaDisabled = currentDT > dateMaxDT || !isCalendarMonth;
|
|
10459
10507
|
}
|
|
10460
|
-
}
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
"
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
})]
|
|
10508
|
+
}
|
|
10509
|
+
const classNames = getClassNames(currentDT, {
|
|
10510
|
+
isCalendarFirstDateSelected,
|
|
10511
|
+
isCalendarSecondDateSelected
|
|
10512
|
+
});
|
|
10513
|
+
return (0,jsx_runtime_namespaceObject.jsx)(styles_DaysViewCell, {
|
|
10514
|
+
"aria-disabled": isAriaDisabled,
|
|
10515
|
+
"aria-label": ariaLabel,
|
|
10516
|
+
"data-day": calendarDate,
|
|
10517
|
+
isCalendarDateNow: isCalendarDateNow,
|
|
10518
|
+
isCalendarDateSelected: isCalendarDateSelected,
|
|
10519
|
+
isCalendarFirstDateSelected: isCalendarFirstDateSelected,
|
|
10520
|
+
isCalendarSecondDateSelected: isCalendarSecondDateSelected,
|
|
10521
|
+
isHighlighted: isHighlightDate(currentDT),
|
|
10522
|
+
className: classNames.join(' '),
|
|
10523
|
+
onMouseEnter: () => handleDateHover(currentDT),
|
|
10524
|
+
onMouseLeave: () => handleDateHover(null),
|
|
10525
|
+
children: calendarDay
|
|
10526
|
+
}, `day-${currentDate.getFullYear()}-${currentDate.getMonth()}-${currentDate.getDate()}-${index}`);
|
|
10480
10527
|
})
|
|
10481
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(FieldDescription, {
|
|
10482
|
-
children: rest.helperText
|
|
10483
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(FieldError, {
|
|
10484
|
-
children: errorMessage ? errorMessage.map((error, index) => (0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
10485
|
-
css: DateRangePicker_ref3,
|
|
10486
|
-
children: error
|
|
10487
|
-
}, `error-${index}`)) : rest.helperText
|
|
10488
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(FieldSuccess, {
|
|
10489
|
-
children: rest.helperText
|
|
10490
10528
|
})]
|
|
10491
10529
|
});
|
|
10492
10530
|
};
|
|
10531
|
+
;// ./src/components/DateRangePicker/components/MonthsView.tsx
|
|
10532
|
+
function components_MonthsView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10533
|
+
|
|
10534
|
+
|
|
10535
|
+
|
|
10536
|
+
|
|
10537
|
+
|
|
10538
|
+
|
|
10539
|
+
|
|
10540
|
+
var components_MonthsView_ref = true ? {
|
|
10541
|
+
name: "icns00",
|
|
10542
|
+
styles: "padding-top:10px"
|
|
10543
|
+
} : 0;
|
|
10544
|
+
const MonthsView_MonthsView = () => {
|
|
10545
|
+
const {
|
|
10546
|
+
dateTime,
|
|
10547
|
+
calendarViewDateTime,
|
|
10548
|
+
dateMinDT,
|
|
10549
|
+
dateMaxDT,
|
|
10550
|
+
lastFocusedElement,
|
|
10551
|
+
currentCalendarViewDT,
|
|
10552
|
+
setCalendarType,
|
|
10553
|
+
setCalendarViewDateTime,
|
|
10554
|
+
onMonthChange
|
|
10555
|
+
} = useDateRangePickerContext();
|
|
10556
|
+
const {
|
|
10557
|
+
handleDateHover,
|
|
10558
|
+
getClassNames,
|
|
10559
|
+
isHighlightDate
|
|
10560
|
+
} = useRangeHighlighting();
|
|
10561
|
+
const handleMonthSelect = event => {
|
|
10562
|
+
const {
|
|
10563
|
+
target
|
|
10564
|
+
} = event;
|
|
10565
|
+
if (target.getAttribute('aria-disabled') === null) {
|
|
10566
|
+
event.stopPropagation();
|
|
10567
|
+
event.preventDefault();
|
|
10568
|
+
return;
|
|
10569
|
+
}
|
|
10570
|
+
const selectedMonth = target.innerHTML;
|
|
10571
|
+
const monthNumber = constants_MONTHS.findIndex(month => month === selectedMonth);
|
|
10572
|
+
const newDate = currentCalendarViewDT?.set({
|
|
10573
|
+
month: monthNumber + 1
|
|
10574
|
+
});
|
|
10575
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
10576
|
+
if (newDate) {
|
|
10577
|
+
onMonthChange?.(newDate.toJSDate());
|
|
10578
|
+
}
|
|
10579
|
+
setCalendarType('days');
|
|
10580
|
+
};
|
|
10581
|
+
return (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
|
|
10582
|
+
css: components_MonthsView_ref,
|
|
10583
|
+
onClick: handleMonthSelect,
|
|
10584
|
+
children: constants_MONTHS.map((month, index) => {
|
|
10585
|
+
const isCalendarMonth = currentCalendarViewDT ? currentCalendarViewDT.month === index + 1 : false;
|
|
10586
|
+
const currentMonthDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
10587
|
+
year: currentCalendarViewDT?.year,
|
|
10588
|
+
month: index + 1,
|
|
10589
|
+
day: 1
|
|
10590
|
+
});
|
|
10591
|
+
const isMinMonthReached = dateMinDT ? currentMonthDT.month < dateMinDT.month && currentMonthDT.year === dateMinDT.year : false;
|
|
10592
|
+
const isMaxMonthReached = dateMaxDT ? currentMonthDT.month > dateMaxDT.month && currentMonthDT.year === dateMaxDT.year : false;
|
|
10593
|
+
const isAriaDisabled = isMinMonthReached || isMaxMonthReached;
|
|
10594
|
+
const isCalendarFirstDateSelected = currentMonthDT.toFormat('yyyy-MM') === dateTime[0]?.toFormat('yyyy-MM');
|
|
10595
|
+
const isCalendarSecondDateSelected = currentMonthDT.toFormat('yyyy-MM') === dateTime[1]?.toFormat('yyyy-MM');
|
|
10596
|
+
const classNames = getClassNames(currentMonthDT, {
|
|
10597
|
+
isCalendarFirstDateSelected,
|
|
10598
|
+
isCalendarSecondDateSelected
|
|
10599
|
+
});
|
|
10600
|
+
return (0,jsx_runtime_namespaceObject.jsx)(styles_MonthsViewCell, {
|
|
10601
|
+
isCalendarMonth: isCalendarMonth,
|
|
10602
|
+
"aria-disabled": isAriaDisabled,
|
|
10603
|
+
"aria-label": `${month}, ${currentCalendarViewDT?.year}`,
|
|
10604
|
+
isCalendarFirstDateSelected: isCalendarFirstDateSelected,
|
|
10605
|
+
isCalendarSecondDateSelected: isCalendarSecondDateSelected,
|
|
10606
|
+
isHighlighted: isHighlightDate(currentMonthDT),
|
|
10607
|
+
className: classNames.join(' '),
|
|
10608
|
+
onMouseEnter: () => handleDateHover(currentMonthDT),
|
|
10609
|
+
onMouseLeave: () => handleDateHover(null),
|
|
10610
|
+
children: month
|
|
10611
|
+
}, month);
|
|
10612
|
+
})
|
|
10613
|
+
});
|
|
10614
|
+
};
|
|
10615
|
+
;// ./src/components/DateRangePicker/components/YearsView.tsx
|
|
10616
|
+
function components_YearsView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10617
|
+
|
|
10618
|
+
|
|
10619
|
+
|
|
10620
|
+
|
|
10621
|
+
|
|
10622
|
+
|
|
10623
|
+
|
|
10624
|
+
|
|
10625
|
+
var components_YearsView_ref = true ? {
|
|
10626
|
+
name: "1lqam8u",
|
|
10627
|
+
styles: "overflow-y:auto;height:280px;align-content:flex-start"
|
|
10628
|
+
} : 0;
|
|
10629
|
+
const YearsView_YearsView = () => {
|
|
10630
|
+
const {
|
|
10631
|
+
dateTime,
|
|
10632
|
+
calendarViewDateTime,
|
|
10633
|
+
currentCalendarViewDT,
|
|
10634
|
+
dateMinParts,
|
|
10635
|
+
dateMaxParts,
|
|
10636
|
+
formatIndexes,
|
|
10637
|
+
lastFocusedElement,
|
|
10638
|
+
setCalendarType,
|
|
10639
|
+
setCalendarViewDateTime,
|
|
10640
|
+
onYearChange
|
|
10641
|
+
} = useDateRangePickerContext();
|
|
10642
|
+
const wrapper = (0,external_react_namespaceObject.useRef)(null);
|
|
10643
|
+
const yearsList = dates_getYearsList({
|
|
10644
|
+
yearsFrom: dateMinParts[formatIndexes['year']],
|
|
10645
|
+
yearsCount: dateMaxParts[formatIndexes['year']] - dateMinParts[formatIndexes['year']] + 1
|
|
10646
|
+
});
|
|
10647
|
+
const {
|
|
10648
|
+
handleDateHover,
|
|
10649
|
+
getClassNames,
|
|
10650
|
+
isHighlightDate
|
|
10651
|
+
} = useRangeHighlighting();
|
|
10652
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
10653
|
+
if (currentCalendarViewDT && wrapper.current) {
|
|
10654
|
+
wrapper.current.querySelector('[aria-current=date]')?.scrollIntoView({
|
|
10655
|
+
behavior: 'instant',
|
|
10656
|
+
block: 'center'
|
|
10657
|
+
});
|
|
10658
|
+
}
|
|
10659
|
+
}, [calendarViewDateTime, lastFocusedElement]);
|
|
10660
|
+
const handleYearSelect = event => {
|
|
10661
|
+
const {
|
|
10662
|
+
target
|
|
10663
|
+
} = event;
|
|
10664
|
+
const selectedYear = Number(target.innerHTML);
|
|
10665
|
+
const newDate = currentCalendarViewDT.set({
|
|
10666
|
+
year: selectedYear
|
|
10667
|
+
});
|
|
10668
|
+
setCalendarType('months');
|
|
10669
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
10670
|
+
if (newDate) {
|
|
10671
|
+
onYearChange?.(newDate.toJSDate());
|
|
10672
|
+
}
|
|
10673
|
+
};
|
|
10674
|
+
return (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
|
|
10675
|
+
css: components_YearsView_ref,
|
|
10676
|
+
ref: wrapper,
|
|
10677
|
+
onClick: handleYearSelect,
|
|
10678
|
+
children: yearsList.map(year => {
|
|
10679
|
+
const additionalProps = {};
|
|
10680
|
+
const currentYearDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
10681
|
+
year,
|
|
10682
|
+
month: 1,
|
|
10683
|
+
day: 1
|
|
10684
|
+
});
|
|
10685
|
+
const isCalendarYear = currentCalendarViewDT ? currentCalendarViewDT.year === year : false;
|
|
10686
|
+
if (isCalendarYear) {
|
|
10687
|
+
additionalProps['aria-current'] = 'date';
|
|
10688
|
+
}
|
|
10689
|
+
const isCalendarFirstDateSelected = year.toString() === dateTime[0]?.toFormat('yyyy');
|
|
10690
|
+
const isCalendarSecondDateSelected = year.toString() === dateTime[1]?.toFormat('yyyy');
|
|
10691
|
+
const classNames = getClassNames(currentYearDT, {
|
|
10692
|
+
isCalendarFirstDateSelected,
|
|
10693
|
+
isCalendarSecondDateSelected
|
|
10694
|
+
});
|
|
10695
|
+
return (0,jsx_runtime_namespaceObject.jsx)(styles_YearsViewCell, {
|
|
10696
|
+
className: classNames.join(' '),
|
|
10697
|
+
isCalendarYear: isCalendarYear,
|
|
10698
|
+
isCalendarFirstDateSelected: isCalendarFirstDateSelected,
|
|
10699
|
+
isCalendarSecondDateSelected: isCalendarSecondDateSelected,
|
|
10700
|
+
isHighlighted: isHighlightDate(currentYearDT),
|
|
10701
|
+
onMouseEnter: () => handleDateHover(currentYearDT),
|
|
10702
|
+
onMouseLeave: () => handleDateHover(null),
|
|
10703
|
+
...additionalProps,
|
|
10704
|
+
children: year
|
|
10705
|
+
}, `year-${year}`);
|
|
10706
|
+
})
|
|
10707
|
+
});
|
|
10708
|
+
};
|
|
10709
|
+
;// ./src/components/DateRangePicker/components/MonthsSwitch.tsx
|
|
10710
|
+
|
|
10711
|
+
function MonthsSwitch_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10712
|
+
|
|
10713
|
+
|
|
10714
|
+
|
|
10715
|
+
|
|
10716
|
+
|
|
10717
|
+
var MonthsSwitch_ref = true ? {
|
|
10718
|
+
name: "9cmux7",
|
|
10719
|
+
styles: "width:72px;gap:24px"
|
|
10720
|
+
} : 0;
|
|
10721
|
+
const MonthsSwitch = () => {
|
|
10722
|
+
const {
|
|
10723
|
+
calendarType,
|
|
10724
|
+
calendarViewDateTime,
|
|
10725
|
+
dateMinDT,
|
|
10726
|
+
dateMaxDT,
|
|
10727
|
+
lastFocusedElement,
|
|
10728
|
+
setCalendarViewDateTime,
|
|
10729
|
+
onMonthChange
|
|
10730
|
+
} = useDateRangePickerContext();
|
|
10731
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
10732
|
+
const isDayCalendarType = calendarType === 'days';
|
|
10733
|
+
const currentIndex = lastFocusedElement === 'from' ? 0 : 1;
|
|
10734
|
+
const currentCalendarViewDT = calendarViewDateTime[currentIndex] || external_luxon_namespaceObject.DateTime.now().set({
|
|
10735
|
+
day: 1
|
|
10736
|
+
});
|
|
10737
|
+
const isMinMonthReached = calendarViewDateTime ? currentCalendarViewDT?.month === dateMinDT.month && currentCalendarViewDT.year === dateMinDT.year : false;
|
|
10738
|
+
const isMaxMonthReached = calendarViewDateTime ? currentCalendarViewDT?.month === dateMaxDT.month && currentCalendarViewDT.year === dateMaxDT.year : false;
|
|
10739
|
+
const handlePreviousMonth = () => {
|
|
10740
|
+
const newDate = currentCalendarViewDT?.minus({
|
|
10741
|
+
month: 1
|
|
10742
|
+
});
|
|
10743
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
10744
|
+
if (newDate) {
|
|
10745
|
+
onMonthChange?.(newDate.toJSDate());
|
|
10746
|
+
}
|
|
10747
|
+
};
|
|
10748
|
+
const handleNextMonth = () => {
|
|
10749
|
+
const newDate = currentCalendarViewDT?.plus({
|
|
10750
|
+
month: 1
|
|
10751
|
+
});
|
|
10752
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
10753
|
+
if (newDate) {
|
|
10754
|
+
onMonthChange?.(newDate.toJSDate());
|
|
10755
|
+
}
|
|
10756
|
+
};
|
|
10757
|
+
if (!isDayCalendarType) {
|
|
10758
|
+
return null;
|
|
10759
|
+
}
|
|
10760
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
|
|
10761
|
+
css: MonthsSwitch_ref,
|
|
10762
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
10763
|
+
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
10764
|
+
name: "carrot-left",
|
|
10765
|
+
size: 14,
|
|
10766
|
+
tooltip: "Previous month",
|
|
10767
|
+
color: isMinMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
10768
|
+
}),
|
|
10769
|
+
variant: 'tertiary',
|
|
10770
|
+
"aria-label": "Previous month",
|
|
10771
|
+
"data-testid": "previous-month",
|
|
10772
|
+
onClick: handlePreviousMonth,
|
|
10773
|
+
isDisabled: isMinMonthReached,
|
|
10774
|
+
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
10775
|
+
padding: 4,
|
|
10776
|
+
height: 32,
|
|
10777
|
+
cursor: isMinMonthReached ? 'default' : 'pointer',
|
|
10778
|
+
'&:focus::before': {
|
|
10779
|
+
display: 'none'
|
|
10780
|
+
}
|
|
10781
|
+
}, true ? "" : 0, true ? "" : 0)
|
|
10782
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
10783
|
+
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
10784
|
+
name: "carrot-right",
|
|
10785
|
+
size: 14,
|
|
10786
|
+
tooltip: "Next month",
|
|
10787
|
+
color: isMaxMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
10788
|
+
}),
|
|
10789
|
+
variant: 'tertiary',
|
|
10790
|
+
onClick: handleNextMonth,
|
|
10791
|
+
isDisabled: isMaxMonthReached,
|
|
10792
|
+
"aria-label": "Next month",
|
|
10793
|
+
"data-testid": "next-month",
|
|
10794
|
+
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
10795
|
+
padding: 4,
|
|
10796
|
+
height: 32,
|
|
10797
|
+
cursor: isMaxMonthReached ? 'default' : 'pointer',
|
|
10798
|
+
'&:focus::before': {
|
|
10799
|
+
display: 'none'
|
|
10800
|
+
}
|
|
10801
|
+
}, true ? "" : 0, true ? "" : 0)
|
|
10802
|
+
})]
|
|
10803
|
+
});
|
|
10804
|
+
};
|
|
10805
|
+
;// ./src/components/DateRangePicker/components/Header.tsx
|
|
10806
|
+
function components_Header_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10807
|
+
|
|
10808
|
+
|
|
10809
|
+
|
|
10810
|
+
|
|
10811
|
+
var components_Header_ref = true ? {
|
|
10812
|
+
name: "ugcp8m",
|
|
10813
|
+
styles: "display:flex;justify-content:space-between;width:100%;height:32px;margin-bottom:12px"
|
|
10814
|
+
} : 0;
|
|
10815
|
+
var Header_ref2 = true ? {
|
|
10816
|
+
name: "1bk2bba",
|
|
10817
|
+
styles: "padding:0;font-size:18px;font-weight:700;line-height:24px;height:32px;gap:16px;&:focus::before{display:none;}"
|
|
10818
|
+
} : 0;
|
|
10819
|
+
const Header_Header = () => {
|
|
10820
|
+
const {
|
|
10821
|
+
calendarType,
|
|
10822
|
+
currentCalendarViewDT,
|
|
10823
|
+
setCalendarType
|
|
10824
|
+
} = useDateRangePickerContext();
|
|
10825
|
+
const handleCalendarTypeChange = () => {
|
|
10826
|
+
setCalendarType(calendarType === 'days' ? 'years' : 'days');
|
|
10827
|
+
};
|
|
10828
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(PopoverHeading, {
|
|
10829
|
+
css: components_Header_ref,
|
|
10830
|
+
as: 'div',
|
|
10831
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
10832
|
+
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
10833
|
+
name: calendarType === 'days' ? 'carrot-down' : 'carrot-up',
|
|
10834
|
+
size: 14,
|
|
10835
|
+
tooltip: ""
|
|
10836
|
+
}),
|
|
10837
|
+
variant: "tertiary",
|
|
10838
|
+
onClick: handleCalendarTypeChange,
|
|
10839
|
+
"data-testid": "calendar-type-change-button",
|
|
10840
|
+
css: Header_ref2,
|
|
10841
|
+
children: currentCalendarViewDT.toFormat('LLLL yyyy')
|
|
10842
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(MonthsSwitch, {})]
|
|
10843
|
+
});
|
|
10844
|
+
};
|
|
10845
|
+
;// ./src/components/DateRangePicker/components/Calendar.tsx
|
|
10846
|
+
function Calendar_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10847
|
+
|
|
10848
|
+
|
|
10849
|
+
|
|
10850
|
+
|
|
10851
|
+
|
|
10852
|
+
var Calendar_ref = true ? {
|
|
10853
|
+
name: "14ggdrv",
|
|
10854
|
+
styles: "height:100%;display:flex;flex-direction:column;justify-content:space-between"
|
|
10855
|
+
} : 0;
|
|
10856
|
+
const Calendar_DatePickerCalendar = () => {
|
|
10857
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
10858
|
+
const components = {
|
|
10859
|
+
days: DaysView_DaysView,
|
|
10860
|
+
months: MonthsView_MonthsView,
|
|
10861
|
+
years: YearsView_YearsView
|
|
10862
|
+
};
|
|
10863
|
+
const {
|
|
10864
|
+
calendarType,
|
|
10865
|
+
calendarClassname
|
|
10866
|
+
} = useDateRangePickerContext();
|
|
10867
|
+
const Component = components[calendarType];
|
|
10868
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(PopoverContent, {
|
|
10869
|
+
className: ['popover', calendarClassname].filter(Boolean).join(' '),
|
|
10870
|
+
"data-testid": "daterangepicker-calendar",
|
|
10871
|
+
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
10872
|
+
background: theme.colors.white,
|
|
10873
|
+
boxShadow: `-4px 4px 14px 0px ${theme.colors.greyDarker14}`,
|
|
10874
|
+
borderRadius: 16,
|
|
10875
|
+
padding: 24,
|
|
10876
|
+
paddingTop: 16,
|
|
10877
|
+
width: 346,
|
|
10878
|
+
height: 370,
|
|
10879
|
+
alignItems: 'flex-start'
|
|
10880
|
+
}, true ? "" : 0, true ? "" : 0),
|
|
10881
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(Header_Header, {}), (0,jsx_runtime_namespaceObject.jsx)(PopoverDescription, {
|
|
10882
|
+
as: "div",
|
|
10883
|
+
css: Calendar_ref,
|
|
10884
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(Component, {})
|
|
10885
|
+
})]
|
|
10886
|
+
});
|
|
10887
|
+
};
|
|
10888
|
+
;// ./src/components/Field/FieldProvider.ts
|
|
10889
|
+
|
|
10890
|
+
const [FieldProvider, useFieldContext] = (0,hooks_namespaceObject.createSafeContext)('useFieldContext must be used within a FieldProvider');
|
|
10891
|
+
;// ./src/components/Field/FieldRoot.tsx
|
|
10892
|
+
|
|
10893
|
+
|
|
10894
|
+
|
|
10895
|
+
const FieldRoot = ({
|
|
10896
|
+
children,
|
|
10897
|
+
...props
|
|
10898
|
+
}) => {
|
|
10899
|
+
const {
|
|
10900
|
+
disabled = false,
|
|
10901
|
+
status = 'basic',
|
|
10902
|
+
forwardFocus = true,
|
|
10903
|
+
asChild = false,
|
|
10904
|
+
...divProps
|
|
10905
|
+
} = props;
|
|
10906
|
+
const Wrapper = asChild ? external_react_namespaceObject.Fragment : 'div';
|
|
10907
|
+
const wrapperProps = asChild ? {} : divProps;
|
|
10908
|
+
return (0,jsx_runtime_namespaceObject.jsx)(Wrapper, {
|
|
10909
|
+
...wrapperProps,
|
|
10910
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(FieldProvider, {
|
|
10911
|
+
value: {
|
|
10912
|
+
disabled,
|
|
10913
|
+
status,
|
|
10914
|
+
forwardFocus
|
|
10915
|
+
},
|
|
10916
|
+
children: children
|
|
10917
|
+
})
|
|
10918
|
+
});
|
|
10919
|
+
};
|
|
10920
|
+
;// ./src/components/Field/FieldLabel.tsx
|
|
10921
|
+
|
|
10922
|
+
|
|
10923
|
+
|
|
10924
|
+
const FieldLabel = ({
|
|
10925
|
+
children,
|
|
10926
|
+
...props
|
|
10927
|
+
}) => {
|
|
10928
|
+
const ctx = useFieldContext();
|
|
10929
|
+
return (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
|
|
10930
|
+
isDisabled: ctx.disabled,
|
|
10931
|
+
...props,
|
|
10932
|
+
children: children
|
|
10933
|
+
});
|
|
10934
|
+
};
|
|
10935
|
+
;// ./src/components/Field/FieldControl.tsx
|
|
10936
|
+
|
|
10937
|
+
|
|
10938
|
+
|
|
10939
|
+
|
|
10940
|
+
const FieldControlBase = /*#__PURE__*/base_default()("div", true ? {
|
|
10941
|
+
target: "e1lr2tz0"
|
|
10942
|
+
} : 0)("display:flex;align-items:center;min-height:44px;height:auto;border-radius:8px;overflow:hidden;border:1px solid ", ({
|
|
10943
|
+
status,
|
|
10944
|
+
theme
|
|
10945
|
+
}) => {
|
|
10946
|
+
if (status === 'error') return theme.colors.red;
|
|
10947
|
+
if (status === 'success') return theme.colors.greenLighter;
|
|
10948
|
+
return theme.colors.grey;
|
|
10949
|
+
}, ";background:", ({
|
|
10950
|
+
disabled,
|
|
10951
|
+
theme
|
|
10952
|
+
}) => disabled ? theme.colors.greyLighter : theme.colors.white, ";&>*{background:transparent;}&:active,&:hover{background:", ({
|
|
10953
|
+
disabled,
|
|
10954
|
+
theme
|
|
10955
|
+
}) => disabled ? theme.colors.greyLighter : theme.colors.white, ";box-shadow:none;}&:hover{cursor:", ({
|
|
10956
|
+
disabled
|
|
10957
|
+
}) => disabled ? 'default' : 'pointer', ";}&:focus-within,&:active{border-color:", ({
|
|
10958
|
+
status,
|
|
10959
|
+
disabled,
|
|
10960
|
+
theme
|
|
10961
|
+
}) => {
|
|
10962
|
+
if (disabled) return theme.colors.grey;
|
|
10963
|
+
if (status === 'error') return theme.colors.red;
|
|
10964
|
+
if (status === 'success') return theme.colors.greenLighter;
|
|
10965
|
+
return theme.colors.blueRoyal;
|
|
10966
|
+
}, ";}" + ( true ? "" : 0));
|
|
10967
|
+
const isForwardRefComponent = component => {
|
|
10968
|
+
if (typeof component.type === 'object' && component.type.$$typeof?.toString() === 'Symbol(react.forward_ref)') {
|
|
10969
|
+
return true;
|
|
10970
|
+
}
|
|
10971
|
+
return false;
|
|
10972
|
+
};
|
|
10973
|
+
const FieldControl = /*#__PURE__*/external_react_default().forwardRef(function FieldControl({
|
|
10974
|
+
children,
|
|
10975
|
+
controlRef,
|
|
10976
|
+
...props
|
|
10977
|
+
}, ref) {
|
|
10978
|
+
const ctx = useFieldContext();
|
|
10979
|
+
const baseProps = {
|
|
10980
|
+
...props,
|
|
10981
|
+
...ctx
|
|
10982
|
+
};
|
|
10983
|
+
const internalRef = (0,external_react_namespaceObject.useRef)(null);
|
|
10984
|
+
let _children = typeof children === 'function' ? children(ctx) : children;
|
|
10985
|
+
if (ctx.forwardFocus && /*#__PURE__*/(0,external_react_namespaceObject.isValidElement)(_children) && isForwardRefComponent(_children)) {
|
|
10986
|
+
const setRef = defaultRef => element => {
|
|
10987
|
+
internalRef.current = element;
|
|
10988
|
+
if (defaultRef) {
|
|
10989
|
+
if (typeof defaultRef === 'function') {
|
|
10990
|
+
defaultRef(element);
|
|
10991
|
+
} else {
|
|
10992
|
+
defaultRef.current = element;
|
|
10993
|
+
}
|
|
10994
|
+
}
|
|
10995
|
+
};
|
|
10996
|
+
_children = /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(_children, {
|
|
10997
|
+
ref: setRef(children.ref)
|
|
10998
|
+
});
|
|
10999
|
+
}
|
|
11000
|
+
return (0,jsx_runtime_namespaceObject.jsx)(FieldControlBase, {
|
|
11001
|
+
...baseProps,
|
|
11002
|
+
ref: ref,
|
|
11003
|
+
onClick: event => {
|
|
11004
|
+
baseProps.onClick?.(event);
|
|
11005
|
+
if (controlRef) {
|
|
11006
|
+
controlRef.current?.focus?.();
|
|
11007
|
+
} else if (internalRef.current) {
|
|
11008
|
+
internalRef.current?.focus?.();
|
|
11009
|
+
}
|
|
11010
|
+
},
|
|
11011
|
+
children: _children
|
|
11012
|
+
});
|
|
11013
|
+
});
|
|
11014
|
+
;// ./src/components/Field/FieldDescription.tsx
|
|
11015
|
+
|
|
11016
|
+
|
|
11017
|
+
|
|
11018
|
+
const FieldDescription = ({
|
|
11019
|
+
children
|
|
11020
|
+
}) => {
|
|
11021
|
+
const ctx = useFieldContext();
|
|
11022
|
+
if (ctx.status !== 'basic') {
|
|
11023
|
+
return null;
|
|
11024
|
+
}
|
|
11025
|
+
return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
|
|
11026
|
+
status: "basic",
|
|
11027
|
+
children: children
|
|
11028
|
+
});
|
|
11029
|
+
};
|
|
11030
|
+
;// ./src/components/Field/FieldError.tsx
|
|
11031
|
+
|
|
11032
|
+
|
|
11033
|
+
|
|
11034
|
+
const FieldError = ({
|
|
11035
|
+
children
|
|
11036
|
+
}) => {
|
|
11037
|
+
const ctx = useFieldContext();
|
|
11038
|
+
if (ctx.status !== 'error') {
|
|
11039
|
+
return null;
|
|
11040
|
+
}
|
|
11041
|
+
return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
|
|
11042
|
+
status: "error",
|
|
11043
|
+
"data-testid": "field-error",
|
|
11044
|
+
children: children
|
|
11045
|
+
});
|
|
11046
|
+
};
|
|
11047
|
+
;// ./src/components/Field/FieldSuccess.tsx
|
|
11048
|
+
|
|
11049
|
+
|
|
11050
|
+
|
|
11051
|
+
const FieldSuccess = ({
|
|
11052
|
+
children
|
|
11053
|
+
}) => {
|
|
11054
|
+
const ctx = useFieldContext();
|
|
11055
|
+
if (ctx.status !== 'success') {
|
|
11056
|
+
return null;
|
|
11057
|
+
}
|
|
11058
|
+
return (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
|
|
11059
|
+
status: "success",
|
|
11060
|
+
children: children
|
|
11061
|
+
});
|
|
11062
|
+
};
|
|
11063
|
+
;// ./src/components/DateRangePicker/components/TriggerInput.tsx
|
|
11064
|
+
function TriggerInput_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
11065
|
+
|
|
11066
|
+
|
|
11067
|
+
|
|
11068
|
+
|
|
11069
|
+
|
|
11070
|
+
|
|
11071
|
+
const WithTriggerPopover = ({
|
|
11072
|
+
isEnabled,
|
|
11073
|
+
children
|
|
11074
|
+
}) => {
|
|
11075
|
+
return isEnabled ? (0,jsx_runtime_namespaceObject.jsx)(PopoverTrigger, {
|
|
11076
|
+
asChild: true,
|
|
11077
|
+
children: /*#__PURE__*/external_react_default().cloneElement(children, {
|
|
11078
|
+
...children.props
|
|
11079
|
+
})
|
|
11080
|
+
}) : (/*#__PURE__*/external_react_default().cloneElement(children, {
|
|
11081
|
+
...children.props
|
|
11082
|
+
}));
|
|
11083
|
+
};
|
|
11084
|
+
const TriggerInput = ({
|
|
11085
|
+
datepickerType,
|
|
11086
|
+
withPopover = false,
|
|
11087
|
+
onClick
|
|
11088
|
+
}) => {
|
|
11089
|
+
const {
|
|
11090
|
+
format,
|
|
11091
|
+
nameFrom,
|
|
11092
|
+
nameTo,
|
|
11093
|
+
inputFromRef,
|
|
11094
|
+
inputToRef,
|
|
11095
|
+
inputProps,
|
|
11096
|
+
disabled,
|
|
11097
|
+
helperText,
|
|
11098
|
+
setLastFocusedElement,
|
|
11099
|
+
onBlur: handleBlur
|
|
11100
|
+
} = useDateRangePickerContext();
|
|
11101
|
+
const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)(); // Using FormProvider from react-hook-form
|
|
11102
|
+
const useFormResult = (0,external_react_hook_form_namespaceObject.useForm)();
|
|
11103
|
+
const currentName = datepickerType === 'from' ? nameFrom : nameTo;
|
|
11104
|
+
const hookFormResult = formContext ?? useFormResult;
|
|
11105
|
+
const {
|
|
11106
|
+
register,
|
|
11107
|
+
formState: {
|
|
11108
|
+
errors
|
|
11109
|
+
}
|
|
11110
|
+
} = hookFormResult;
|
|
11111
|
+
const {
|
|
11112
|
+
inputProps: inputElementProps,
|
|
11113
|
+
...restInputProps
|
|
11114
|
+
} = inputProps || {};
|
|
11115
|
+
const fieldError = errors[currentName];
|
|
11116
|
+
const fieldStatus = fieldError?.message ? 'error' : 'basic';
|
|
11117
|
+
const handleFocus = e => {
|
|
11118
|
+
setLastFocusedElement(datepickerType);
|
|
11119
|
+
inputProps?.inputProps?.onFocus?.(e);
|
|
11120
|
+
};
|
|
11121
|
+
const handleOpen = event => {
|
|
11122
|
+
onClick?.(event);
|
|
11123
|
+
};
|
|
11124
|
+
return (0,jsx_runtime_namespaceObject.jsx)(WithTriggerPopover, {
|
|
11125
|
+
isEnabled: withPopover,
|
|
11126
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(Input_Input, {
|
|
11127
|
+
name: currentName,
|
|
11128
|
+
placeholder: format,
|
|
11129
|
+
ref: datepickerType === 'from' ? inputFromRef : inputToRef,
|
|
11130
|
+
disabled: disabled,
|
|
11131
|
+
register: register,
|
|
11132
|
+
inputProps: {
|
|
11133
|
+
onBlur: handleBlur,
|
|
11134
|
+
onClick: handleOpen,
|
|
11135
|
+
onFocus: handleFocus,
|
|
11136
|
+
id: inputProps?.inputProps?.id || currentName,
|
|
11137
|
+
'data-testid': `daterangepicker-input-${datepickerType}`,
|
|
11138
|
+
autoComplete: 'off',
|
|
11139
|
+
className: /*#__PURE__*/(0,css_namespaceObject.css)( true ? {
|
|
11140
|
+
name: "150iz59",
|
|
11141
|
+
styles: "border:none!important"
|
|
11142
|
+
} : 0),
|
|
11143
|
+
...inputElementProps
|
|
11144
|
+
},
|
|
11145
|
+
showStatusIcon: false,
|
|
11146
|
+
errors: fieldError,
|
|
11147
|
+
status: fieldStatus,
|
|
11148
|
+
helperText: helperText,
|
|
11149
|
+
helperClassName: /*#__PURE__*/(0,css_namespaceObject.css)( true ? {
|
|
11150
|
+
name: "lhoo11",
|
|
11151
|
+
styles: "&>span::first-letter{text-transform:uppercase;}"
|
|
11152
|
+
} : 0),
|
|
11153
|
+
...restInputProps
|
|
11154
|
+
})
|
|
11155
|
+
});
|
|
11156
|
+
};
|
|
11157
|
+
;// ./src/components/DateRangePicker/components/Trigger.tsx
|
|
11158
|
+
|
|
11159
|
+
function Trigger_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
11160
|
+
|
|
11161
|
+
|
|
11162
|
+
|
|
11163
|
+
|
|
11164
|
+
|
|
11165
|
+
|
|
11166
|
+
|
|
11167
|
+
|
|
11168
|
+
var Trigger_ref = true ? {
|
|
11169
|
+
name: "jpxugn",
|
|
11170
|
+
styles: "margin:0 14px"
|
|
11171
|
+
} : 0;
|
|
11172
|
+
var Trigger_ref2 = true ? {
|
|
11173
|
+
name: "ud49p1",
|
|
11174
|
+
styles: "color:inherit;&::first-letter{text-transform:uppercase;}"
|
|
11175
|
+
} : 0;
|
|
11176
|
+
const Trigger = () => {
|
|
11177
|
+
const {
|
|
11178
|
+
nameFrom,
|
|
11179
|
+
nameTo,
|
|
11180
|
+
label,
|
|
11181
|
+
lastFocusedElement,
|
|
11182
|
+
disabled,
|
|
11183
|
+
status,
|
|
11184
|
+
helperText,
|
|
11185
|
+
openCalendarMode,
|
|
11186
|
+
isOpen,
|
|
11187
|
+
showCalendarIcon,
|
|
11188
|
+
triggerClassname,
|
|
11189
|
+
setIsOpen,
|
|
11190
|
+
handleToggleOpen
|
|
11191
|
+
} = useDateRangePickerContext();
|
|
11192
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
11193
|
+
const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)();
|
|
11194
|
+
const wrapperRef = (0,external_react_namespaceObject.useRef)(null);
|
|
11195
|
+
(0,hooks_namespaceObject.useClickOutside)(wrapperRef, event => {
|
|
11196
|
+
const {
|
|
11197
|
+
target
|
|
11198
|
+
} = event;
|
|
11199
|
+
const closestPopover = target.closest('div.popover');
|
|
11200
|
+
if (isOpen && !closestPopover) {
|
|
11201
|
+
setIsOpen(false);
|
|
11202
|
+
}
|
|
11203
|
+
});
|
|
11204
|
+
const errorsFrom = formContext.formState.errors[nameFrom]?.message;
|
|
11205
|
+
const errorsTo = formContext.formState.errors[nameTo]?.message;
|
|
11206
|
+
const errorMessage = [errorsFrom, errorsTo].filter(Boolean);
|
|
11207
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(FieldRoot, {
|
|
11208
|
+
status: status,
|
|
11209
|
+
disabled: disabled,
|
|
11210
|
+
"data-testid": "daterangepicker",
|
|
11211
|
+
className: triggerClassname,
|
|
11212
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(FieldLabel, {
|
|
11213
|
+
htmlFor: lastFocusedElement === 'from' ? nameFrom : nameTo,
|
|
11214
|
+
children: label
|
|
11215
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(FieldControl, {
|
|
11216
|
+
children: (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
|
|
11217
|
+
ref: wrapperRef,
|
|
11218
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(TriggerInput, {
|
|
11219
|
+
withPopover: true,
|
|
11220
|
+
datepickerType: "from",
|
|
11221
|
+
onClick: () => {
|
|
11222
|
+
if (!isOpen) {
|
|
11223
|
+
setIsOpen(true);
|
|
11224
|
+
}
|
|
11225
|
+
}
|
|
11226
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
11227
|
+
name: "carrot-right",
|
|
11228
|
+
size: 18,
|
|
11229
|
+
color: theme.colors.greyDarker80,
|
|
11230
|
+
css: Trigger_ref
|
|
11231
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(TriggerInput, {
|
|
11232
|
+
datepickerType: "to",
|
|
11233
|
+
onClick: () => {
|
|
11234
|
+
if (!isOpen) {
|
|
11235
|
+
setIsOpen(true);
|
|
11236
|
+
}
|
|
11237
|
+
}
|
|
11238
|
+
}), showCalendarIcon && (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
11239
|
+
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
11240
|
+
name: "calendar",
|
|
11241
|
+
size: 16,
|
|
11242
|
+
color: disabled ? theme.colors.grey : theme.colors.greyDarker
|
|
11243
|
+
}),
|
|
11244
|
+
"data-testid": 'daterangepicker-button',
|
|
11245
|
+
onClick: handleToggleOpen,
|
|
11246
|
+
variant: "tertiary",
|
|
11247
|
+
"aria-label": "Calendar",
|
|
11248
|
+
isDisabled: disabled,
|
|
11249
|
+
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
11250
|
+
padding: 0,
|
|
11251
|
+
margin: '0 8px 0 14px',
|
|
11252
|
+
cursor: openCalendarMode === 'input' || disabled ? 'default' : 'pointer',
|
|
11253
|
+
'&:focus::before': {
|
|
11254
|
+
display: 'none'
|
|
11255
|
+
}
|
|
11256
|
+
}, true ? "" : 0, true ? "" : 0)
|
|
11257
|
+
})]
|
|
11258
|
+
})
|
|
11259
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(FieldDescription, {
|
|
11260
|
+
children: helperText
|
|
11261
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(FieldError, {
|
|
11262
|
+
children: errorMessage ? errorMessage.map((error, index) => (0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
11263
|
+
css: Trigger_ref2,
|
|
11264
|
+
children: error
|
|
11265
|
+
}, `error-${index}`)) : helperText
|
|
11266
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(FieldSuccess, {
|
|
11267
|
+
children: helperText
|
|
11268
|
+
})]
|
|
11269
|
+
});
|
|
11270
|
+
};
|
|
11271
|
+
;// ./src/components/DateRangePicker/components/Content.tsx
|
|
11272
|
+
|
|
11273
|
+
|
|
11274
|
+
|
|
11275
|
+
|
|
11276
|
+
|
|
11277
|
+
const Content_DatePickerContent = () => {
|
|
11278
|
+
const {
|
|
11279
|
+
isOpen
|
|
11280
|
+
} = useDateRangePickerContext();
|
|
11281
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(Popover, {
|
|
11282
|
+
interactionsEnabled: 'click',
|
|
11283
|
+
placement: 'top-start',
|
|
11284
|
+
open: isOpen,
|
|
11285
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(Trigger, {}), (0,jsx_runtime_namespaceObject.jsx)(Calendar_DatePickerCalendar, {})]
|
|
11286
|
+
});
|
|
11287
|
+
};
|
|
11288
|
+
;// ./src/components/DateRangePicker/hooks/useDatePickerMask.tsx
|
|
11289
|
+
|
|
11290
|
+
|
|
11291
|
+
|
|
11292
|
+
const useDatePickerMask_useDatePickerMask = ({
|
|
11293
|
+
maskOptions,
|
|
11294
|
+
formatIndexes,
|
|
11295
|
+
dateMinParts,
|
|
11296
|
+
dateMaxParts
|
|
11297
|
+
}) => {
|
|
11298
|
+
const {
|
|
11299
|
+
mask = constants_DEFAULT_MASK,
|
|
11300
|
+
replacement = {
|
|
11301
|
+
_: /\d/
|
|
11302
|
+
},
|
|
11303
|
+
...restMaskOptions
|
|
11304
|
+
} = maskOptions || {};
|
|
11305
|
+
const useMaskResult = (0,mask_namespaceObject.useMask)({
|
|
11306
|
+
mask,
|
|
11307
|
+
replacement,
|
|
11308
|
+
track: ({
|
|
11309
|
+
data,
|
|
11310
|
+
selectionStart,
|
|
11311
|
+
selectionEnd,
|
|
11312
|
+
value: currentValue
|
|
11313
|
+
}) => {
|
|
11314
|
+
if (mask === constants_DEFAULT_MASK) {
|
|
11315
|
+
const newValue = currentValue.slice(0, selectionStart) + data + currentValue.slice(selectionEnd);
|
|
11316
|
+
const updatedValue = (0,mask_namespaceObject.format)(newValue, {
|
|
11317
|
+
mask,
|
|
11318
|
+
replacement
|
|
11319
|
+
});
|
|
11320
|
+
const splittedValue = updatedValue.split('/');
|
|
11321
|
+
const isChecked = dates_processDate({
|
|
11322
|
+
day: splittedValue[formatIndexes['day']],
|
|
11323
|
+
month: splittedValue[formatIndexes['month']],
|
|
11324
|
+
year: splittedValue[formatIndexes['year']]
|
|
11325
|
+
}, dateMinParts[formatIndexes['year']], dateMaxParts[formatIndexes['year']]);
|
|
11326
|
+
return isChecked ? data : '';
|
|
11327
|
+
} else {
|
|
11328
|
+
return data;
|
|
11329
|
+
}
|
|
11330
|
+
},
|
|
11331
|
+
...restMaskOptions
|
|
11332
|
+
});
|
|
11333
|
+
return useMaskResult;
|
|
11334
|
+
};
|
|
11335
|
+
;// ./src/components/DateRangePicker/hooks/useDateRangePicker.ts
|
|
11336
|
+
|
|
11337
|
+
|
|
11338
|
+
|
|
11339
|
+
|
|
11340
|
+
|
|
11341
|
+
|
|
11342
|
+
const useDateRangePicker = ({
|
|
11343
|
+
dateMin = constants_DATE_MIN,
|
|
11344
|
+
dateMax = constants_DATE_MAX,
|
|
11345
|
+
name: _name,
|
|
11346
|
+
format = 'mm/dd/yyyy',
|
|
11347
|
+
maskOptions,
|
|
11348
|
+
isOpenState = false,
|
|
11349
|
+
defaultValue,
|
|
11350
|
+
onOpen,
|
|
11351
|
+
onClose,
|
|
11352
|
+
onError,
|
|
11353
|
+
onChange,
|
|
11354
|
+
...rest
|
|
11355
|
+
}) => {
|
|
11356
|
+
const inputFromRef = (0,external_react_namespaceObject.useRef)(null);
|
|
11357
|
+
const inputToRef = (0,external_react_namespaceObject.useRef)(null);
|
|
11358
|
+
const [isOpen, setIsOpen] = (0,external_react_namespaceObject.useState)(isOpenState);
|
|
11359
|
+
const [status, setStatus] = (0,external_react_namespaceObject.useState)(rest.status);
|
|
11360
|
+
const previousOpenState = (0,external_react_namespaceObject.useRef)(isOpenState);
|
|
11361
|
+
const handleSetIsOpen = open => {
|
|
11362
|
+
setIsOpen(open);
|
|
11363
|
+
};
|
|
11364
|
+
const {
|
|
11365
|
+
clearErrors,
|
|
11366
|
+
setError,
|
|
11367
|
+
setValue,
|
|
11368
|
+
resetField,
|
|
11369
|
+
setFocus
|
|
11370
|
+
} = (0,external_react_hook_form_namespaceObject.useFormContext)();
|
|
11371
|
+
const nameFrom = `${_name}From`;
|
|
11372
|
+
const nameTo = `${_name}To`;
|
|
11373
|
+
const inputValueFrom = (0,external_react_hook_form_namespaceObject.useWatch)({
|
|
11374
|
+
name: nameFrom
|
|
11375
|
+
});
|
|
11376
|
+
const inputValueTo = (0,external_react_hook_form_namespaceObject.useWatch)({
|
|
11377
|
+
name: nameTo
|
|
11378
|
+
});
|
|
11379
|
+
const [dateTime, setDateTime] = (0,external_react_namespaceObject.useState)([undefined, undefined]);
|
|
11380
|
+
const [lastChangedDate, setLastChangedDate] = (0,external_react_namespaceObject.useState)([undefined, undefined]);
|
|
11381
|
+
const [lastFocusedElement, setLastFocusedElement] = (0,external_react_namespaceObject.useState)('from');
|
|
11382
|
+
const currentIndex = lastFocusedElement === 'from' ? 0 : 1;
|
|
11383
|
+
const currentName = lastFocusedElement === 'from' ? nameFrom : nameTo;
|
|
11384
|
+
const [dateTimeForChangeEvent, setDateTimeForChangeEvent] = (0,external_react_namespaceObject.useState)(undefined);
|
|
11385
|
+
const [currentError, setCurrentError] = (0,external_react_namespaceObject.useState)({
|
|
11386
|
+
date: null,
|
|
11387
|
+
error: null
|
|
11388
|
+
});
|
|
11389
|
+
const splittedFormat = format.split('/');
|
|
11390
|
+
const [formatIndexes, setFormatIndexes] = (0,external_react_namespaceObject.useState)({
|
|
11391
|
+
day: splittedFormat.findIndex(item => item === 'dd'),
|
|
11392
|
+
month: splittedFormat.findIndex(item => item === 'mm'),
|
|
11393
|
+
year: splittedFormat.findIndex(item => item === 'yyyy')
|
|
11394
|
+
});
|
|
11395
|
+
const [calendarType, setCalendarType] = (0,external_react_namespaceObject.useState)('days');
|
|
11396
|
+
const [calendarViewDateTime, setCalendarViewDateTime] = (0,external_react_namespaceObject.useState)([undefined, undefined]);
|
|
11397
|
+
const currentCalendarViewDT = calendarViewDateTime[currentIndex] || external_luxon_namespaceObject.DateTime.now().set({
|
|
11398
|
+
day: 1
|
|
11399
|
+
});
|
|
11400
|
+
const luxonFormat = format.replace('mm', 'MM');
|
|
11401
|
+
const dateMinParts = dateMin.split('/').map(Number);
|
|
11402
|
+
const dateMaxParts = dateMax.split('/').map(Number);
|
|
11403
|
+
const maskInputRef = useDatePickerMask_useDatePickerMask({
|
|
11404
|
+
maskOptions,
|
|
11405
|
+
dateMaxParts,
|
|
11406
|
+
dateMinParts,
|
|
11407
|
+
formatIndexes
|
|
11408
|
+
});
|
|
11409
|
+
const dateMaxDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
11410
|
+
year: dateMaxParts[formatIndexes['year']],
|
|
11411
|
+
month: dateMaxParts[formatIndexes['month']],
|
|
11412
|
+
day: dateMaxParts[formatIndexes['day']]
|
|
11413
|
+
});
|
|
11414
|
+
const dateMinDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
11415
|
+
year: dateMinParts[formatIndexes['year']],
|
|
11416
|
+
month: dateMinParts[formatIndexes['month']],
|
|
11417
|
+
day: dateMinParts[formatIndexes['day']]
|
|
11418
|
+
});
|
|
11419
|
+
const safeOnChange = newDateTime => {
|
|
11420
|
+
const _newDateTime = newDateTime ? newDateTime.startOf('day') : undefined;
|
|
11421
|
+
const _dateTimeForChangeEvent = dateTimeForChangeEvent ? dateTimeForChangeEvent.startOf('day') : undefined;
|
|
11422
|
+
if (_newDateTime?.toMillis() !== _dateTimeForChangeEvent?.toMillis()) {
|
|
11423
|
+
setDateTimeForChangeEvent(newDateTime);
|
|
11424
|
+
if (_newDateTime) {
|
|
11425
|
+
const _newDateTimeJS = _newDateTime.toJSDate();
|
|
11426
|
+
if (lastFocusedElement === 'from') {
|
|
11427
|
+
setLastChangedDate([_newDateTimeJS, lastChangedDate[1]]);
|
|
11428
|
+
onChange?.([_newDateTimeJS, lastChangedDate[1] || null]);
|
|
11429
|
+
} else {
|
|
11430
|
+
setLastChangedDate([lastChangedDate[0], _newDateTimeJS]);
|
|
11431
|
+
onChange?.([lastChangedDate[0] || null, _newDateTimeJS]);
|
|
11432
|
+
}
|
|
11433
|
+
} else {
|
|
11434
|
+
setLastChangedDate([lastFocusedElement === 'from' ? undefined : lastChangedDate[0], lastFocusedElement === 'to' ? undefined : lastChangedDate[1]]);
|
|
11435
|
+
onChange?.();
|
|
11436
|
+
}
|
|
11437
|
+
}
|
|
11438
|
+
};
|
|
11439
|
+
|
|
11440
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11441
|
+
const safeOnError = (date, error) => {
|
|
11442
|
+
if (currentError.date !== date && currentError.error !== error) {
|
|
11443
|
+
setCurrentError({
|
|
11444
|
+
date,
|
|
11445
|
+
error
|
|
11446
|
+
});
|
|
11447
|
+
onError?.(date, error);
|
|
11448
|
+
}
|
|
11449
|
+
};
|
|
11450
|
+
const processValue = (newValue, elementName) => {
|
|
11451
|
+
const currentElementType = elementName || lastFocusedElement;
|
|
11452
|
+
const currentName = currentElementType === 'from' ? nameFrom : nameTo;
|
|
11453
|
+
const newDateTime = typeof newValue === 'string' && newValue.length === FULL_DATE_LENGTH ? external_luxon_namespaceObject.DateTime.fromFormat(newValue, luxonFormat) : undefined;
|
|
11454
|
+
const newDateTimeIfInvalid = [currentElementType === 'from' ? undefined : dateTime?.[0], currentElementType === 'to' ? undefined : dateTime?.[1]];
|
|
11455
|
+
const newDateTimeIfValid = [currentElementType === 'from' ? newDateTime : dateTime?.[0], currentElementType === 'to' ? newDateTime : dateTime?.[1]];
|
|
11456
|
+
if (!newDateTime?.isValid) {
|
|
11457
|
+
const errorMessage = newDateTime?.invalidExplanation || constants_INVALID_DATE;
|
|
11458
|
+
setError(currentName, {
|
|
11459
|
+
message: errorMessage
|
|
11460
|
+
}, {
|
|
11461
|
+
shouldFocus: true
|
|
11462
|
+
});
|
|
11463
|
+
setStatus('error');
|
|
11464
|
+
setDateTime(newDateTimeIfInvalid);
|
|
11465
|
+
safeOnError?.(newValue, errorMessage);
|
|
11466
|
+
safeOnChange();
|
|
11467
|
+
} else if (newDateTime !== undefined) {
|
|
11468
|
+
if (newDateTime < dateMinDT || newDateTime > dateMaxDT) {
|
|
11469
|
+
const errorMessage = constants_OUT_OF_RANGE;
|
|
11470
|
+
setError(currentName, {
|
|
11471
|
+
message: errorMessage
|
|
11472
|
+
}, {
|
|
11473
|
+
shouldFocus: true
|
|
11474
|
+
});
|
|
11475
|
+
setStatus('error');
|
|
11476
|
+
setDateTime(newDateTimeIfInvalid);
|
|
11477
|
+
safeOnError?.(newValue, errorMessage);
|
|
11478
|
+
safeOnChange();
|
|
11479
|
+
} else {
|
|
11480
|
+
setDateTime(newDateTimeIfValid);
|
|
11481
|
+
clearErrors();
|
|
11482
|
+
setStatus('basic');
|
|
11483
|
+
safeOnError?.(null);
|
|
11484
|
+
safeOnChange?.(newDateTime);
|
|
11485
|
+
}
|
|
11486
|
+
}
|
|
11487
|
+
};
|
|
11488
|
+
const handleBlur = event => {
|
|
11489
|
+
event.preventDefault();
|
|
11490
|
+
const blurredValue = event.currentTarget.value;
|
|
11491
|
+
if (blurredValue.length > 0) {
|
|
11492
|
+
processValue(blurredValue);
|
|
11493
|
+
}
|
|
11494
|
+
};
|
|
11495
|
+
const processInputValue = (inputValue, elementName) => {
|
|
11496
|
+
const currentElementType = elementName || lastFocusedElement;
|
|
11497
|
+
const currentName = currentElementType === 'from' ? nameFrom : nameTo;
|
|
11498
|
+
if (typeof inputValue === 'string' && inputValue.length && inputValue.length < FULL_DATE_LENGTH) {
|
|
11499
|
+
setIsOpen(false);
|
|
11500
|
+
setTimeout(() => {
|
|
11501
|
+
maskInputRef.current.focus();
|
|
11502
|
+
}, 10);
|
|
11503
|
+
}
|
|
11504
|
+
let newDateTime;
|
|
11505
|
+
if (typeof inputValue === 'string' && inputValue.length === FULL_DATE_LENGTH) {
|
|
11506
|
+
newDateTime = external_luxon_namespaceObject.DateTime.fromFormat(inputValue, luxonFormat);
|
|
11507
|
+
setValue(currentName, inputValue);
|
|
11508
|
+
processValue(inputValue, elementName);
|
|
11509
|
+
}
|
|
11510
|
+
const newCalendarViewDateTime = newDateTime && newDateTime.isValid ? newDateTime : undefined;
|
|
11511
|
+
if (newCalendarViewDateTime) {
|
|
11512
|
+
if (newCalendarViewDateTime < dateMinDT) {
|
|
11513
|
+
const {
|
|
11514
|
+
year,
|
|
11515
|
+
month,
|
|
11516
|
+
day
|
|
11517
|
+
} = dateMinDT;
|
|
11518
|
+
newCalendarViewDateTime.set({
|
|
11519
|
+
year,
|
|
11520
|
+
month,
|
|
11521
|
+
day
|
|
11522
|
+
});
|
|
11523
|
+
}
|
|
11524
|
+
if (newCalendarViewDateTime > dateMaxDT) {
|
|
11525
|
+
const {
|
|
11526
|
+
year,
|
|
11527
|
+
month,
|
|
11528
|
+
day
|
|
11529
|
+
} = dateMaxDT;
|
|
11530
|
+
newCalendarViewDateTime.set({
|
|
11531
|
+
year,
|
|
11532
|
+
month,
|
|
11533
|
+
day
|
|
11534
|
+
});
|
|
11535
|
+
}
|
|
11536
|
+
setCalendarViewDateTime(currentElementType === 'from' ? [newCalendarViewDateTime, calendarViewDateTime[1]] : [calendarViewDateTime[0], newCalendarViewDateTime]);
|
|
11537
|
+
}
|
|
11538
|
+
};
|
|
11539
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11540
|
+
processInputValue(lastFocusedElement === 'from' ? inputValueFrom : inputValueTo);
|
|
11541
|
+
}, [lastFocusedElement]);
|
|
11542
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11543
|
+
if (inputValueFrom && inputValueFrom.length === FULL_DATE_LENGTH) {
|
|
11544
|
+
processInputValue(lastFocusedElement === 'from' ? inputValueFrom : inputValueTo);
|
|
11545
|
+
}
|
|
11546
|
+
}, [inputValueFrom]);
|
|
11547
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11548
|
+
if (inputValueTo && inputValueTo.length === FULL_DATE_LENGTH) {
|
|
11549
|
+
processInputValue(lastFocusedElement === 'from' ? inputValueFrom : inputValueTo);
|
|
11550
|
+
}
|
|
11551
|
+
}, [inputValueTo]);
|
|
11552
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11553
|
+
const currentIndex = lastFocusedElement === 'from' ? 0 : 1;
|
|
11554
|
+
const currentInputValue = currentIndex === 0 ? inputValueFrom : inputValueTo;
|
|
11555
|
+
if (dateTime?.[currentIndex]) {
|
|
11556
|
+
const newValue = dateTime[currentIndex].toFormat(luxonFormat);
|
|
11557
|
+
if (currentInputValue !== newValue) {
|
|
11558
|
+
setValue(currentName, newValue);
|
|
11559
|
+
}
|
|
11560
|
+
}
|
|
11561
|
+
}, [dateTime, lastFocusedElement, currentName]);
|
|
11562
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11563
|
+
if (dateTime[0] && dateTime[1] && dateTime[0] > dateTime[1]) {
|
|
11564
|
+
resetField(nameFrom);
|
|
11565
|
+
resetField(nameTo);
|
|
11566
|
+
setDateTime([dateTime[1], undefined]);
|
|
11567
|
+
setLastChangedDate([dateTime[1].toJSDate(), undefined]);
|
|
11568
|
+
setValue(nameFrom, dateTime[1].toFormat(luxonFormat));
|
|
11569
|
+
setLastFocusedElement('to');
|
|
11570
|
+
setTimeout(() => {
|
|
11571
|
+
setFocus(nameTo, {
|
|
11572
|
+
shouldSelect: true
|
|
11573
|
+
});
|
|
11574
|
+
}, 50);
|
|
11575
|
+
setIsOpen(true);
|
|
11576
|
+
}
|
|
11577
|
+
}, [dateTime]);
|
|
11578
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11579
|
+
if (previousOpenState.current !== isOpen) {
|
|
11580
|
+
if (isOpen) {
|
|
11581
|
+
onOpen?.();
|
|
11582
|
+
} else {
|
|
11583
|
+
onClose?.();
|
|
11584
|
+
setCalendarType('days');
|
|
11585
|
+
setCalendarViewDateTime([dateTime[0], dateTime[1]]);
|
|
11586
|
+
}
|
|
11587
|
+
previousOpenState.current = isOpen;
|
|
11588
|
+
}
|
|
11589
|
+
}, [isOpen]);
|
|
11590
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11591
|
+
const splittedFormat = format.split('/');
|
|
11592
|
+
setFormatIndexes({
|
|
11593
|
+
day: splittedFormat.findIndex(item => item === 'dd'),
|
|
11594
|
+
month: splittedFormat.findIndex(item => item === 'mm'),
|
|
11595
|
+
year: splittedFormat.findIndex(item => item === 'yyyy')
|
|
11596
|
+
});
|
|
11597
|
+
}, [format]);
|
|
11598
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11599
|
+
if (Array.isArray(rest.value)) {
|
|
11600
|
+
const newDateTimeFrom = typeof rest.value[0] === 'string' && rest.value[0].length === FULL_DATE_LENGTH ? external_luxon_namespaceObject.DateTime.fromFormat(rest.value[0], luxonFormat) : undefined;
|
|
11601
|
+
const newDateTimeTo = typeof rest.value[1] === 'string' && rest.value[1].length === FULL_DATE_LENGTH ? external_luxon_namespaceObject.DateTime.fromFormat(rest.value[1], luxonFormat) : undefined;
|
|
11602
|
+
const newDateTime = [newDateTimeFrom?.isValid ? newDateTimeFrom : undefined, newDateTimeTo?.isValid ? newDateTimeTo : undefined];
|
|
11603
|
+
setDateTime(newDateTime);
|
|
11604
|
+
setLastChangedDate([newDateTime[0]?.toJSDate(), newDateTime[1]?.toJSDate()]);
|
|
11605
|
+
setValue(nameFrom, newDateTime[0]?.toFormat(luxonFormat));
|
|
11606
|
+
setValue(nameTo, newDateTime[1]?.toFormat(luxonFormat));
|
|
11607
|
+
}
|
|
11608
|
+
}, [rest.value]);
|
|
11609
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11610
|
+
setStatus(rest.status);
|
|
11611
|
+
}, [rest.status]);
|
|
11612
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11613
|
+
if (lastChangedDate[0] || lastChangedDate[1]) {
|
|
11614
|
+
if (lastFocusedElement === 'from' && !lastChangedDate[1]) {
|
|
11615
|
+
setFocus(nameTo);
|
|
11616
|
+
}
|
|
11617
|
+
if (lastFocusedElement === 'to' && !lastChangedDate[0]) {
|
|
11618
|
+
setFocus(nameFrom);
|
|
11619
|
+
inputFromRef.current?.focus();
|
|
11620
|
+
}
|
|
11621
|
+
}
|
|
11622
|
+
}, [lastChangedDate]);
|
|
11623
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11624
|
+
if (calendarViewDateTime[0] && !calendarViewDateTime[1]) {
|
|
11625
|
+
setCalendarViewDateTime([calendarViewDateTime[0], calendarViewDateTime[0]]);
|
|
11626
|
+
}
|
|
11627
|
+
if (calendarViewDateTime[1] && !calendarViewDateTime[0]) {
|
|
11628
|
+
setCalendarViewDateTime([calendarViewDateTime[1], calendarViewDateTime[1]]);
|
|
11629
|
+
}
|
|
11630
|
+
}, [calendarViewDateTime]);
|
|
11631
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11632
|
+
if (isOpenState !== isOpen) {
|
|
11633
|
+
setIsOpen(isOpenState);
|
|
11634
|
+
}
|
|
11635
|
+
}, [isOpenState]);
|
|
11636
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
11637
|
+
if (defaultValue) {
|
|
11638
|
+
setValue(nameFrom, defaultValue[0]);
|
|
11639
|
+
setValue(nameTo, defaultValue[1]);
|
|
11640
|
+
}
|
|
11641
|
+
}, []);
|
|
11642
|
+
return {
|
|
11643
|
+
formatIndexes,
|
|
11644
|
+
dateMinParts,
|
|
11645
|
+
dateMaxParts,
|
|
11646
|
+
dateMinDT,
|
|
11647
|
+
dateMaxDT,
|
|
11648
|
+
dateTime,
|
|
11649
|
+
inputValueFrom,
|
|
11650
|
+
inputValueTo,
|
|
11651
|
+
calendarViewDateTime,
|
|
11652
|
+
maskInputRef,
|
|
11653
|
+
calendarType,
|
|
11654
|
+
lastChangedDate,
|
|
11655
|
+
luxonFormat,
|
|
11656
|
+
lastFocusedElement,
|
|
11657
|
+
nameFrom,
|
|
11658
|
+
nameTo,
|
|
11659
|
+
currentIndex,
|
|
11660
|
+
currentCalendarViewDT,
|
|
11661
|
+
isOpen,
|
|
11662
|
+
status,
|
|
11663
|
+
inputFromRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRef, inputFromRef]),
|
|
11664
|
+
inputToRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRef, inputToRef]),
|
|
11665
|
+
setIsOpen,
|
|
11666
|
+
handleSetIsOpen,
|
|
11667
|
+
setLastFocusedElement,
|
|
11668
|
+
safeOnChange,
|
|
11669
|
+
setCalendarType,
|
|
11670
|
+
setCalendarViewDateTime,
|
|
11671
|
+
setDateTime,
|
|
11672
|
+
handleBlur
|
|
11673
|
+
};
|
|
11674
|
+
};
|
|
11675
|
+
;// ./src/components/DateRangePicker/DateRangePickerProvider.tsx
|
|
11676
|
+
|
|
11677
|
+
|
|
11678
|
+
|
|
11679
|
+
const DateRangePickerProvider = ({
|
|
11680
|
+
children,
|
|
11681
|
+
...rest
|
|
11682
|
+
}) => {
|
|
11683
|
+
const {
|
|
11684
|
+
formatIndexes,
|
|
11685
|
+
inputFromRef,
|
|
11686
|
+
inputToRef,
|
|
11687
|
+
...restHook
|
|
11688
|
+
} = useDateRangePicker({
|
|
11689
|
+
...rest,
|
|
11690
|
+
isOpenState: rest.isOpenState
|
|
11691
|
+
});
|
|
11692
|
+
const handleBlur = e => {
|
|
11693
|
+
restHook.handleBlur(e);
|
|
11694
|
+
rest.onBlur?.(e);
|
|
11695
|
+
};
|
|
11696
|
+
const toggleOpen = () => {
|
|
11697
|
+
restHook.setIsOpen(current => !current);
|
|
11698
|
+
};
|
|
11699
|
+
const handleToggleOpen = e => {
|
|
11700
|
+
const tagName = e.currentTarget.tagName.toLowerCase();
|
|
11701
|
+
if (rest.openCalendarMode === 'both' || rest.openCalendarMode === 'input' && tagName === 'input' || rest.openCalendarMode === 'icon' && tagName === 'button') {
|
|
11702
|
+
toggleOpen();
|
|
11703
|
+
}
|
|
11704
|
+
if (tagName === 'input' && rest.inputProps?.inputProps?.onClick) {
|
|
11705
|
+
rest.inputProps.inputProps.onClick(e);
|
|
11706
|
+
}
|
|
11707
|
+
};
|
|
11708
|
+
return (0,jsx_runtime_namespaceObject.jsx)(DateRangePickerContext.Provider, {
|
|
11709
|
+
value: {
|
|
11710
|
+
...rest,
|
|
11711
|
+
...restHook,
|
|
11712
|
+
formatIndexes,
|
|
11713
|
+
inputFromRef,
|
|
11714
|
+
inputToRef,
|
|
11715
|
+
handleToggleOpen,
|
|
11716
|
+
onBlur: handleBlur
|
|
11717
|
+
},
|
|
11718
|
+
children: children
|
|
11719
|
+
});
|
|
11720
|
+
};
|
|
11721
|
+
;// ./src/components/DateRangePicker/DateRangePicker.tsx
|
|
11722
|
+
|
|
11723
|
+
|
|
11724
|
+
|
|
11725
|
+
|
|
11726
|
+
const DateRangePicker = ({
|
|
11727
|
+
format = constants_DEFAULT_MASK_FORMAT,
|
|
11728
|
+
openCalendarMode = 'icon',
|
|
11729
|
+
showCalendarIcon = true,
|
|
11730
|
+
...rest
|
|
11731
|
+
}) => (0,jsx_runtime_namespaceObject.jsx)(DateRangePickerProvider, {
|
|
11732
|
+
format: format,
|
|
11733
|
+
openCalendarMode: openCalendarMode,
|
|
11734
|
+
showCalendarIcon: showCalendarIcon,
|
|
11735
|
+
...rest,
|
|
11736
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(Content_DatePickerContent, {})
|
|
11737
|
+
});
|
|
10493
11738
|
;// ./src/components/DateRangePicker/index.ts
|
|
10494
11739
|
|
|
10495
11740
|
;// ./src/components/Drawer/DrawerProvider.tsx
|
|
@@ -12483,7 +13728,7 @@ const WithNestedTableRow = ({
|
|
|
12483
13728
|
setIsCollapsed: setIsCollapsed,
|
|
12484
13729
|
isSubHeader: isSubHeader,
|
|
12485
13730
|
childRowsCount: childRowsCount,
|
|
12486
|
-
children:
|
|
13731
|
+
children: child
|
|
12487
13732
|
});
|
|
12488
13733
|
}
|
|
12489
13734
|
});
|