@ssa-ui-kit/core 2.2.2 → 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/Charts/TreeMapChart/TreeMapChart.d.ts +23 -0
- package/dist/components/Charts/TreeMapChart/TreeMapChartHeader.d.ts +8 -0
- package/dist/components/Charts/TreeMapChart/TreeMapChartTooltip.d.ts +2 -0
- package/dist/components/Charts/TreeMapChart/index.d.ts +1 -0
- package/dist/components/Charts/index.d.ts +1 -0
- 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/components/WidgetCard/WithWidgetCard.d.ts +10 -3
- package/dist/index.js +1787 -385
- package/dist/index.js.map +1 -1
- package/dist/types/emotion.d.ts +3 -0
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -199,6 +199,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
199
199
|
TooltipTrigger: () => (/* reexport */ TooltipTrigger_TooltipTrigger),
|
|
200
200
|
TranslationContext: () => (/* reexport */ TranslationContext),
|
|
201
201
|
TranslationProvider: () => (/* reexport */ TranslationProvider),
|
|
202
|
+
TreeMapChart: () => (/* reexport */ TreeMapChart),
|
|
203
|
+
TreeMapChartComponent: () => (/* reexport */ TreeMapChartComponent),
|
|
202
204
|
Typeahead: () => (/* reexport */ Typeahead),
|
|
203
205
|
TypeaheadItemIcon: () => (/* reexport */ TypeaheadItemIcon),
|
|
204
206
|
TypeaheadItemImage: () => (/* reexport */ TypeaheadItemImage),
|
|
@@ -941,6 +943,8 @@ const main = {
|
|
|
941
943
|
// #ffffff
|
|
942
944
|
greyLighter: 'rgba(238, 241, 247, 1)',
|
|
943
945
|
// #eef1f7
|
|
946
|
+
greyLighter20: 'rgba(238, 241, 247, 0.2)',
|
|
947
|
+
//#eef1f766
|
|
944
948
|
greyLighter40: 'rgba(238, 241, 247, 0.4)',
|
|
945
949
|
//#eef1f766
|
|
946
950
|
greyLighter60: 'rgba(238, 241, 247, 0.6)',
|
|
@@ -1111,6 +1115,8 @@ const main = {
|
|
|
1111
1115
|
// #4178e1
|
|
1112
1116
|
blue20: 'rgba(65, 120, 225, 0.2)',
|
|
1113
1117
|
// #4178e1
|
|
1118
|
+
blueCool: 'rgba(108, 148, 247, 1)',
|
|
1119
|
+
// #6c94f7
|
|
1114
1120
|
blueDark: 'rgba(36, 101, 227, 1)',
|
|
1115
1121
|
// #2465e3
|
|
1116
1122
|
blueLightDarker: 'rgba(127, 159, 221)',
|
|
@@ -1157,6 +1163,8 @@ const main = {
|
|
|
1157
1163
|
//#487DE1
|
|
1158
1164
|
blueRoyal12: 'rgba(72, 125, 225, 0.12)',
|
|
1159
1165
|
//#487DE1
|
|
1166
|
+
cyanTeal: 'rgba(85, 214, 210, 1)',
|
|
1167
|
+
//#55D6D2
|
|
1160
1168
|
dangerShades300: 'rgb(253, 128, 122)',
|
|
1161
1169
|
//#FD807A
|
|
1162
1170
|
dangerShades500: 'rgb(223, 90, 96)',
|
|
@@ -5891,14 +5899,21 @@ const WidgetCard = ({
|
|
|
5891
5899
|
;// ./src/components/WidgetCard/WithWidgetCard.tsx
|
|
5892
5900
|
|
|
5893
5901
|
|
|
5894
|
-
|
|
5902
|
+
|
|
5903
|
+
// `Has<T, U>` = `true` if every string in `U` also appears in `T`.
|
|
5904
|
+
|
|
5905
|
+
function WithWidgetCard({
|
|
5895
5906
|
children,
|
|
5896
5907
|
features = [],
|
|
5897
5908
|
cardProps = {}
|
|
5898
|
-
})
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5909
|
+
}) {
|
|
5910
|
+
return features && features.includes('header') ? (0,jsx_runtime_namespaceObject.jsx)(WidgetCard, {
|
|
5911
|
+
...cardProps,
|
|
5912
|
+
children: children
|
|
5913
|
+
}) : (0,jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
5914
|
+
children: children
|
|
5915
|
+
});
|
|
5916
|
+
}
|
|
5902
5917
|
;// ./src/components/Charts/PieChart/PieChartBases.tsx
|
|
5903
5918
|
|
|
5904
5919
|
function PieChartBases_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)."; }
|
|
@@ -9434,11 +9449,6 @@ const DatePickerProvider = ({
|
|
|
9434
9449
|
restHook.handleBlur(e);
|
|
9435
9450
|
rest.onBlur?.(e);
|
|
9436
9451
|
};
|
|
9437
|
-
(0,external_react_namespaceObject.useEffect)(() => {
|
|
9438
|
-
if (typeof rest.isOpenToggle === 'boolean') {
|
|
9439
|
-
restHook.setIsOpen(current => !current);
|
|
9440
|
-
}
|
|
9441
|
-
}, [rest.isOpenToggle]);
|
|
9442
9452
|
return (0,jsx_runtime_namespaceObject.jsx)(DatePickerContext.Provider, {
|
|
9443
9453
|
value: {
|
|
9444
9454
|
...rest,
|
|
@@ -10043,440 +10053,1688 @@ const DatePickerInner = ({
|
|
|
10043
10053
|
format = DEFAULT_MASK_FORMAT,
|
|
10044
10054
|
openCalendarMode = 'icon',
|
|
10045
10055
|
showCalendarIcon = true,
|
|
10046
|
-
isOpenToggle,
|
|
10047
10056
|
...rest
|
|
10048
10057
|
}, inputRef) => (0,jsx_runtime_namespaceObject.jsx)(DatePickerProvider, {
|
|
10049
10058
|
format: format,
|
|
10050
10059
|
openCalendarMode: openCalendarMode,
|
|
10051
10060
|
inputRef: inputRef,
|
|
10052
10061
|
showCalendarIcon: showCalendarIcon,
|
|
10053
|
-
isOpenToggle: isOpenToggle,
|
|
10054
10062
|
...rest,
|
|
10055
10063
|
children: (0,jsx_runtime_namespaceObject.jsx)(DatePickerContent, {})
|
|
10056
10064
|
});
|
|
10057
10065
|
const DatePicker = /*#__PURE__*/(0,external_react_namespaceObject.forwardRef)(DatePickerInner);
|
|
10058
10066
|
;// ./src/components/DatePicker/index.ts
|
|
10059
10067
|
|
|
10060
|
-
;// ./src/components/
|
|
10061
|
-
|
|
10062
|
-
const
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
const
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
}) => {
|
|
10071
|
-
const {
|
|
10072
|
-
disabled = false,
|
|
10073
|
-
status = 'basic',
|
|
10074
|
-
forwardFocus = true,
|
|
10075
|
-
asChild = false,
|
|
10076
|
-
...divProps
|
|
10077
|
-
} = props;
|
|
10078
|
-
const Wrapper = asChild ? external_react_namespaceObject.Fragment : 'div';
|
|
10079
|
-
const wrapperProps = asChild ? {} : divProps;
|
|
10080
|
-
return (0,jsx_runtime_namespaceObject.jsx)(Wrapper, {
|
|
10081
|
-
...wrapperProps,
|
|
10082
|
-
children: (0,jsx_runtime_namespaceObject.jsx)(FieldProvider, {
|
|
10083
|
-
value: {
|
|
10084
|
-
disabled,
|
|
10085
|
-
status,
|
|
10086
|
-
forwardFocus
|
|
10087
|
-
},
|
|
10088
|
-
children: children
|
|
10089
|
-
})
|
|
10090
|
-
});
|
|
10091
|
-
};
|
|
10092
|
-
;// ./src/components/Field/FieldLabel.tsx
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
const FieldLabel = ({
|
|
10097
|
-
children,
|
|
10098
|
-
...props
|
|
10099
|
-
}) => {
|
|
10100
|
-
const ctx = useFieldContext();
|
|
10101
|
-
return (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
|
|
10102
|
-
isDisabled: ctx.disabled,
|
|
10103
|
-
...props,
|
|
10104
|
-
children: children
|
|
10105
|
-
});
|
|
10106
|
-
};
|
|
10107
|
-
;// ./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
|
|
10108
10078
|
|
|
10109
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
|
|
10110
10092
|
|
|
10111
10093
|
|
|
10112
|
-
const
|
|
10113
|
-
target: "
|
|
10114
|
-
} : 0)("
|
|
10115
|
-
|
|
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:", ({
|
|
10116
10108
|
theme
|
|
10117
|
-
}) => {
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
}, "
|
|
10122
|
-
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:", ({
|
|
10123
10114
|
theme
|
|
10124
|
-
}) =>
|
|
10125
|
-
disabled,
|
|
10115
|
+
}) => theme.colors.greyLighter, ";color:", ({
|
|
10126
10116
|
theme
|
|
10127
|
-
}) =>
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
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:", ({
|
|
10132
10125
|
theme
|
|
10133
|
-
}) => {
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
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 [];
|
|
10142
10206
|
}
|
|
10143
|
-
|
|
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
|
|
10216
|
+
});
|
|
10217
|
+
days.push(temp.toJSDate());
|
|
10218
|
+
}
|
|
10219
|
+
while (days.length < 42) {
|
|
10220
|
+
temp = temp.plus({
|
|
10221
|
+
days: 1
|
|
10222
|
+
});
|
|
10223
|
+
days.push(temp.toJSDate());
|
|
10224
|
+
}
|
|
10225
|
+
return days;
|
|
10144
10226
|
};
|
|
10145
|
-
const
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
};
|
|
10155
|
-
const internalRef = (0,external_react_namespaceObject.useRef)(null);
|
|
10156
|
-
let _children = typeof children === 'function' ? children(ctx) : children;
|
|
10157
|
-
if (ctx.forwardFocus && /*#__PURE__*/(0,external_react_namespaceObject.isValidElement)(_children) && isForwardRefComponent(_children)) {
|
|
10158
|
-
const setRef = defaultRef => element => {
|
|
10159
|
-
internalRef.current = element;
|
|
10160
|
-
if (defaultRef) {
|
|
10161
|
-
if (typeof defaultRef === 'function') {
|
|
10162
|
-
defaultRef(element);
|
|
10163
|
-
} else {
|
|
10164
|
-
defaultRef.current = element;
|
|
10165
|
-
}
|
|
10166
|
-
}
|
|
10167
|
-
};
|
|
10168
|
-
_children = /*#__PURE__*/(0,external_react_namespaceObject.cloneElement)(_children, {
|
|
10169
|
-
ref: setRef(children.ref)
|
|
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
|
|
10170
10236
|
});
|
|
10237
|
+
days.push(temp.toFormat('ccccc'));
|
|
10171
10238
|
}
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10239
|
+
days.pop();
|
|
10240
|
+
return days;
|
|
10241
|
+
};
|
|
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
|
|
10282
|
+
|
|
10283
|
+
|
|
10284
|
+
|
|
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
|
|
10340
|
+
}
|
|
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
|
+
};
|
|
10413
|
+
};
|
|
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)."; }
|
|
10416
|
+
|
|
10417
|
+
|
|
10418
|
+
|
|
10419
|
+
|
|
10420
|
+
|
|
10421
|
+
|
|
10422
|
+
|
|
10423
|
+
|
|
10424
|
+
|
|
10425
|
+
var components_DaysView_ref = true ? {
|
|
10426
|
+
name: "hisq2i",
|
|
10427
|
+
styles: "padding-left:9px"
|
|
10428
|
+
} : 0;
|
|
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"
|
|
10432
|
+
} : 0;
|
|
10433
|
+
var components_DaysView_ref3 = true ? {
|
|
10434
|
+
name: "hisq2i",
|
|
10435
|
+
styles: "padding-left:9px"
|
|
10436
|
+
} : 0;
|
|
10437
|
+
const DaysView_DaysView = () => {
|
|
10438
|
+
const weekDays = dates_getWeekDays();
|
|
10439
|
+
const {
|
|
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 => {
|
|
10460
|
+
const {
|
|
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);
|
|
10474
|
+
}
|
|
10475
|
+
}
|
|
10476
|
+
};
|
|
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;
|
|
10504
|
+
}
|
|
10505
|
+
if (dateMaxDT) {
|
|
10506
|
+
isAriaDisabled = currentDT > dateMaxDT || !isCalendarMonth;
|
|
10507
|
+
}
|
|
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}`);
|
|
10527
|
+
})
|
|
10528
|
+
})]
|
|
10529
|
+
});
|
|
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
|
+
}
|
|
10182
11010
|
},
|
|
10183
11011
|
children: _children
|
|
10184
11012
|
});
|
|
10185
|
-
});
|
|
10186
|
-
;// ./src/components/Field/FieldDescription.tsx
|
|
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
|
|
10187
11272
|
|
|
10188
11273
|
|
|
10189
11274
|
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
const
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
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, {})]
|
|
10200
11286
|
});
|
|
10201
11287
|
};
|
|
10202
|
-
;// ./src/components/
|
|
11288
|
+
;// ./src/components/DateRangePicker/hooks/useDatePickerMask.tsx
|
|
10203
11289
|
|
|
10204
11290
|
|
|
10205
11291
|
|
|
10206
|
-
const
|
|
10207
|
-
|
|
11292
|
+
const useDatePickerMask_useDatePickerMask = ({
|
|
11293
|
+
maskOptions,
|
|
11294
|
+
formatIndexes,
|
|
11295
|
+
dateMinParts,
|
|
11296
|
+
dateMaxParts
|
|
10208
11297
|
}) => {
|
|
10209
|
-
const
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
|
|
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
|
|
10216
11332
|
});
|
|
11333
|
+
return useMaskResult;
|
|
10217
11334
|
};
|
|
10218
|
-
;// ./src/components/
|
|
11335
|
+
;// ./src/components/DateRangePicker/hooks/useDateRangePicker.ts
|
|
10219
11336
|
|
|
10220
11337
|
|
|
10221
11338
|
|
|
10222
|
-
|
|
10223
|
-
|
|
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
|
|
10224
11355
|
}) => {
|
|
10225
|
-
const
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
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')
|
|
10232
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
|
+
};
|
|
10233
11674
|
};
|
|
10234
|
-
;// ./src/components/DateRangePicker/
|
|
10235
|
-
const constants_DEFAULT_MASK_FORMAT = 'mm/dd/yyyy';
|
|
10236
|
-
const constants_DEFAULT_MASK = '__/__/____';
|
|
10237
|
-
const constants_MONTHS = (/* unused pure expression or super */ null && (['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']));
|
|
10238
|
-
const constants_DATE_MIN = '01/01/1900';
|
|
10239
|
-
const constants_DATE_MAX = '01/01/2150';
|
|
10240
|
-
const constants_OUT_OF_RANGE = 'The date is out of the defined range';
|
|
10241
|
-
const constants_INVALID_DATE = 'Invalid date';
|
|
10242
|
-
;// ./src/components/DateRangePicker/DateRangePicker.tsx
|
|
11675
|
+
;// ./src/components/DateRangePicker/DateRangePickerProvider.tsx
|
|
10243
11676
|
|
|
10244
|
-
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)."; }
|
|
10245
11677
|
|
|
10246
11678
|
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
// keep the same place for datepicker (from / to)
|
|
10253
|
-
// don't close the datepicker while switching between from / to
|
|
10254
|
-
// add errors (date to less than date from...)
|
|
10255
|
-
// add a logic to reset date to when date to less than date from
|
|
10256
|
-
// create subcomponents
|
|
10257
|
-
// hover daterange effect for the datepicker (from design)
|
|
10258
|
-
|
|
10259
|
-
var DateRangePicker_ref = true ? {
|
|
10260
|
-
name: "mwgsbg",
|
|
10261
|
-
styles: "& input{border:none !important;}"
|
|
10262
|
-
} : 0;
|
|
10263
|
-
var DateRangePicker_ref2 = true ? {
|
|
10264
|
-
name: "jpxugn",
|
|
10265
|
-
styles: "margin:0 14px"
|
|
10266
|
-
} : 0;
|
|
10267
|
-
var DateRangePicker_ref3 = true ? {
|
|
10268
|
-
name: "ud49p1",
|
|
10269
|
-
styles: "color:inherit;&::first-letter{text-transform:uppercase;}"
|
|
10270
|
-
} : 0;
|
|
10271
|
-
const DateRangePicker = ({
|
|
10272
|
-
format = constants_DEFAULT_MASK_FORMAT,
|
|
10273
|
-
openCalendarMode = 'both',
|
|
10274
|
-
name,
|
|
10275
|
-
label,
|
|
10276
|
-
value,
|
|
10277
|
-
defaultValue,
|
|
11679
|
+
const DateRangePickerProvider = ({
|
|
11680
|
+
children,
|
|
10278
11681
|
...rest
|
|
10279
11682
|
}) => {
|
|
10280
|
-
const theme = (0,react_namespaceObject.useTheme)();
|
|
10281
|
-
// const [_value, _setValue] = useState(value || []);
|
|
10282
|
-
const formContext = (0,external_react_hook_form_namespaceObject.useFormContext)();
|
|
10283
|
-
const [currentStatus, setCurrentStatus] = (0,external_react_namespaceObject.useState)(rest.status);
|
|
10284
|
-
const errorsFrom = formContext.formState.errors[`${name}From`]?.message;
|
|
10285
|
-
const errorsTo = formContext.formState.errors[`${name}To`]?.message;
|
|
10286
|
-
const errorMessage = [errorsFrom, errorsTo].filter(Boolean);
|
|
10287
11683
|
const {
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
const
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
// const datepickerToAdditionalProps = {};
|
|
10301
|
-
|
|
10302
|
-
// useEffect(() => {
|
|
10303
|
-
// _setValue(value || []);
|
|
10304
|
-
// }, [value]);
|
|
10305
|
-
|
|
10306
|
-
(0,external_react_namespaceObject.useEffect)(() => {
|
|
10307
|
-
setCurrentStatus(rest.status);
|
|
10308
|
-
}, [rest.status]);
|
|
10309
|
-
(0,external_react_namespaceObject.useEffect)(() => {
|
|
10310
|
-
if (errorMessage.length) {
|
|
10311
|
-
setCurrentStatus('error');
|
|
10312
|
-
} else {
|
|
10313
|
-
setCurrentStatus(rest.status || 'basic');
|
|
10314
|
-
}
|
|
10315
|
-
}, [errorMessage]);
|
|
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
|
+
};
|
|
10316
11696
|
const toggleOpen = () => {
|
|
10317
|
-
|
|
10318
|
-
setFromOpenToggle(current => !current);
|
|
10319
|
-
setTimeout(() => datepickerFromRef.current?.focus(), 5);
|
|
10320
|
-
} else {
|
|
10321
|
-
setToOpenToggle(current => !current);
|
|
10322
|
-
setTimeout(() => datepickerToRef.current?.focus(), 5);
|
|
10323
|
-
}
|
|
11697
|
+
restHook.setIsOpen(current => !current);
|
|
10324
11698
|
};
|
|
10325
11699
|
const handleToggleOpen = e => {
|
|
10326
11700
|
const tagName = e.currentTarget.tagName.toLowerCase();
|
|
10327
|
-
if (openCalendarMode === 'both' || openCalendarMode === 'input' && tagName === 'input' || openCalendarMode === 'icon' && tagName === 'button') {
|
|
11701
|
+
if (rest.openCalendarMode === 'both' || rest.openCalendarMode === 'input' && tagName === 'input' || rest.openCalendarMode === 'icon' && tagName === 'button') {
|
|
10328
11702
|
toggleOpen();
|
|
10329
11703
|
}
|
|
10330
11704
|
if (tagName === 'input' && rest.inputProps?.inputProps?.onClick) {
|
|
10331
11705
|
rest.inputProps.inputProps.onClick(e);
|
|
10332
11706
|
}
|
|
10333
11707
|
};
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
setChangedDate(changedData);
|
|
10346
|
-
if (!changedDate?.[1]) {
|
|
10347
|
-
setLastFocusedElement('to');
|
|
10348
|
-
setToOpenToggle(true);
|
|
10349
|
-
}
|
|
10350
|
-
rest.onChange?.(changedData);
|
|
10351
|
-
}
|
|
10352
|
-
};
|
|
10353
|
-
const onChangeTo = date => {
|
|
10354
|
-
const newDate = date || null;
|
|
10355
|
-
if (changedDate[0] && newDate) {
|
|
10356
|
-
const selectedDateFromDT = external_luxon_namespaceObject.DateTime.fromJSDate(changedDate[0]);
|
|
10357
|
-
const selectedDateToDT = external_luxon_namespaceObject.DateTime.fromJSDate(newDate);
|
|
10358
|
-
if (selectedDateFromDT > selectedDateToDT) {
|
|
10359
|
-
const changedData = [newDate, null];
|
|
10360
|
-
setChangedDate(changedData);
|
|
10361
|
-
|
|
10362
|
-
// const dateStr = DateTime.fromJSDate(newDate).toFormat(
|
|
10363
|
-
// format.replace('mm', 'MM'),
|
|
10364
|
-
// );
|
|
10365
|
-
// _setValue([dateStr, _value[1] === undefined ? '' : undefined]);
|
|
10366
|
-
// _setValue([dateStr, undefined]);
|
|
10367
|
-
datepickerToRef.current?.focus();
|
|
10368
|
-
rest.onChange?.(changedData);
|
|
10369
|
-
return;
|
|
10370
|
-
}
|
|
10371
|
-
}
|
|
10372
|
-
if (newDate !== changedDate?.[1]) {
|
|
10373
|
-
const changedData = [changedDate ? changedDate[0] : null, newDate];
|
|
10374
|
-
setChangedDate(changedData);
|
|
10375
|
-
datepickerToRef.current?.focus();
|
|
10376
|
-
rest.onChange?.(changedData);
|
|
10377
|
-
}
|
|
10378
|
-
};
|
|
10379
|
-
|
|
10380
|
-
// TODO: change status dynamically
|
|
10381
|
-
return (0,jsx_runtime_namespaceObject.jsxs)(FieldRoot, {
|
|
10382
|
-
status: currentStatus,
|
|
10383
|
-
disabled: rest.disabled,
|
|
10384
|
-
children: [(0,jsx_runtime_namespaceObject.jsx)(FieldLabel, {
|
|
10385
|
-
htmlFor: lastFocusedElement === 'from' ? `${name}From` : `${name}To`,
|
|
10386
|
-
children: label
|
|
10387
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(FieldControl, {
|
|
10388
|
-
children: (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
|
|
10389
|
-
css: DateRangePicker_ref,
|
|
10390
|
-
children: [(0,jsx_runtime_namespaceObject.jsx)(DatePicker, {
|
|
10391
|
-
format: format,
|
|
10392
|
-
openCalendarMode: openCalendarMode,
|
|
10393
|
-
isOpenToggle: fromOpenToggle,
|
|
10394
|
-
name: `${name}From`,
|
|
10395
|
-
value: valueFrom,
|
|
10396
|
-
defaultValue: defaultValueFrom,
|
|
10397
|
-
label: '',
|
|
10398
|
-
showCalendarIcon: false,
|
|
10399
|
-
...rest,
|
|
10400
|
-
ref: datepickerFromRef,
|
|
10401
|
-
onChange: onChangeFrom,
|
|
10402
|
-
highlightDates: {
|
|
10403
|
-
enabled: true,
|
|
10404
|
-
mode: 'dateFrom',
|
|
10405
|
-
otherDate: changedDate[1]
|
|
10406
|
-
},
|
|
10407
|
-
inputProps: {
|
|
10408
|
-
showStatusIcon: false,
|
|
10409
|
-
...rest.inputProps,
|
|
10410
|
-
inputProps: {
|
|
10411
|
-
...rest.inputProps?.inputProps,
|
|
10412
|
-
onFocus: handleFocus,
|
|
10413
|
-
onClick: handleToggleOpen
|
|
10414
|
-
}
|
|
10415
|
-
}
|
|
10416
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
10417
|
-
name: "carrot-right",
|
|
10418
|
-
size: 18,
|
|
10419
|
-
color: theme.colors.greyDarker80,
|
|
10420
|
-
css: DateRangePicker_ref2
|
|
10421
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(DatePicker, {
|
|
10422
|
-
format: format,
|
|
10423
|
-
openCalendarMode: openCalendarMode,
|
|
10424
|
-
isOpenToggle: toOpenToggle,
|
|
10425
|
-
name: `${name}To`,
|
|
10426
|
-
value: valueTo,
|
|
10427
|
-
defaultValue: defaultValueTo,
|
|
10428
|
-
label: '',
|
|
10429
|
-
showCalendarIcon: false,
|
|
10430
|
-
...rest,
|
|
10431
|
-
ref: datepickerToRef,
|
|
10432
|
-
onChange: onChangeTo,
|
|
10433
|
-
highlightDates: {
|
|
10434
|
-
enabled: true,
|
|
10435
|
-
mode: 'dateTo',
|
|
10436
|
-
otherDate: changedDate[0]
|
|
10437
|
-
},
|
|
10438
|
-
inputProps: {
|
|
10439
|
-
showStatusIcon: false,
|
|
10440
|
-
...rest.inputProps,
|
|
10441
|
-
inputProps: {
|
|
10442
|
-
...rest.inputProps?.inputProps,
|
|
10443
|
-
onFocus: handleFocus,
|
|
10444
|
-
onClick: handleToggleOpen
|
|
10445
|
-
}
|
|
10446
|
-
}
|
|
10447
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
10448
|
-
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
10449
|
-
name: "calendar",
|
|
10450
|
-
size: 16,
|
|
10451
|
-
color: disabled ? theme.colors.grey : theme.colors.greyDarker
|
|
10452
|
-
}),
|
|
10453
|
-
"data-testid": 'daterangepicker-button',
|
|
10454
|
-
onClick: handleToggleOpen,
|
|
10455
|
-
variant: "tertiary",
|
|
10456
|
-
"aria-label": "Calendar",
|
|
10457
|
-
isDisabled: disabled,
|
|
10458
|
-
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
10459
|
-
padding: 0,
|
|
10460
|
-
margin: '0 8px 0 14px',
|
|
10461
|
-
cursor: openCalendarMode === 'input' || disabled ? 'default' : 'pointer',
|
|
10462
|
-
'&:focus::before': {
|
|
10463
|
-
display: 'none'
|
|
10464
|
-
}
|
|
10465
|
-
}, true ? "" : 0, true ? "" : 0)
|
|
10466
|
-
})]
|
|
10467
|
-
})
|
|
10468
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(FieldDescription, {
|
|
10469
|
-
children: rest.helperText
|
|
10470
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(FieldError, {
|
|
10471
|
-
children: errorMessage ? errorMessage.map((error, index) => (0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
10472
|
-
css: DateRangePicker_ref3,
|
|
10473
|
-
children: error
|
|
10474
|
-
}, `error-${index}`)) : rest.helperText
|
|
10475
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(FieldSuccess, {
|
|
10476
|
-
children: rest.helperText
|
|
10477
|
-
})]
|
|
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
|
|
10478
11719
|
});
|
|
10479
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
|
+
});
|
|
10480
11738
|
;// ./src/components/DateRangePicker/index.ts
|
|
10481
11739
|
|
|
10482
11740
|
;// ./src/components/Drawer/DrawerProvider.tsx
|
|
@@ -12470,7 +13728,7 @@ const WithNestedTableRow = ({
|
|
|
12470
13728
|
setIsCollapsed: setIsCollapsed,
|
|
12471
13729
|
isSubHeader: isSubHeader,
|
|
12472
13730
|
childRowsCount: childRowsCount,
|
|
12473
|
-
children:
|
|
13731
|
+
children: child
|
|
12474
13732
|
});
|
|
12475
13733
|
}
|
|
12476
13734
|
});
|
|
@@ -13038,8 +14296,8 @@ const WithPagination = Component => {
|
|
|
13038
14296
|
|
|
13039
14297
|
;// ./src/components/Charts/PieChart/colorPalettes.ts
|
|
13040
14298
|
const getBalancePalette = theme => {
|
|
13041
|
-
const legendColorNames = ['yellow', 'blue', 'green', 'yellowWarm', 'blueLight', 'turquoise', 'pink', 'purple', '
|
|
13042
|
-
const pieChartColors = [theme.colors.yellow, theme.colors.blue, theme.colors.green, theme.colors.yellowLighter, theme.colors.blueLight, theme.colors.turquoise, theme.colors.pink, theme.colors.purple,
|
|
14299
|
+
const legendColorNames = ['yellow', 'blue', 'green', 'yellowWarm', 'blueLight', 'turquoise', 'pink', 'purple', 'blueCool', 'cyanTeal'];
|
|
14300
|
+
const pieChartColors = [theme.colors.yellow, theme.colors.blue, theme.colors.green, theme.colors.yellowLighter, theme.colors.blueLight, theme.colors.turquoise, theme.colors.pink, theme.colors.purple, theme.colors.blueCool, theme.colors.cyanTeal];
|
|
13043
14301
|
return {
|
|
13044
14302
|
legendColorNames,
|
|
13045
14303
|
pieChartColors
|
|
@@ -14222,6 +15480,149 @@ const BarLineComplexChart = WithFullscreenMode(BarLineComplexChartComponent);
|
|
|
14222
15480
|
;// ./src/components/Charts/BarLineComplexChart/index.ts
|
|
14223
15481
|
|
|
14224
15482
|
|
|
15483
|
+
;// external "@nivo/treemap"
|
|
15484
|
+
const treemap_namespaceObject = require("@nivo/treemap");
|
|
15485
|
+
;// ./src/components/Charts/TreeMapChart/TreeMapChartHeader.tsx
|
|
15486
|
+
|
|
15487
|
+
function TreeMapChartHeader_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)."; }
|
|
15488
|
+
|
|
15489
|
+
|
|
15490
|
+
|
|
15491
|
+
|
|
15492
|
+
const FullScreenButton = /*#__PURE__*/base_default()(Button_Button, true ? {
|
|
15493
|
+
target: "e1nxcyi20"
|
|
15494
|
+
} : 0)("height:auto;padding:0;background:none;box-shadow:none;&:hover,&:focus{background:none;box-shadow:none;&::before{display:none;}}&:hover{svg path{fill:", ({
|
|
15495
|
+
theme
|
|
15496
|
+
}) => theme.colors.greyDarker, ";}}" + ( true ? "" : 0));
|
|
15497
|
+
var TreeMapChartHeader_ref = true ? {
|
|
15498
|
+
name: "1pqzlpx",
|
|
15499
|
+
styles: "width:auto;margin-left:auto"
|
|
15500
|
+
} : 0;
|
|
15501
|
+
var TreeMapChartHeader_ref2 = true ? {
|
|
15502
|
+
name: "e0dnmk",
|
|
15503
|
+
styles: "cursor:pointer"
|
|
15504
|
+
} : 0;
|
|
15505
|
+
const TreeMapChartHeader = ({
|
|
15506
|
+
features
|
|
15507
|
+
}) => {
|
|
15508
|
+
const {
|
|
15509
|
+
isFullscreenMode,
|
|
15510
|
+
toggleFullscreenMode
|
|
15511
|
+
} = useFullscreenMode();
|
|
15512
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
15513
|
+
return (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
15514
|
+
css: TreeMapChartHeader_ref,
|
|
15515
|
+
children: features.includes('fullscreenMode') && (0,jsx_runtime_namespaceObject.jsx)(FullScreenButton, {
|
|
15516
|
+
variant: "tertiary",
|
|
15517
|
+
onClick: toggleFullscreenMode,
|
|
15518
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
15519
|
+
name: isFullscreenMode ? 'cross' : 'maximize',
|
|
15520
|
+
css: TreeMapChartHeader_ref2,
|
|
15521
|
+
tooltip: isFullscreenMode ? 'Close' : 'Maximize',
|
|
15522
|
+
size: 18,
|
|
15523
|
+
color: theme.colors.greyFilterIcon
|
|
15524
|
+
})
|
|
15525
|
+
})
|
|
15526
|
+
});
|
|
15527
|
+
};
|
|
15528
|
+
;// ./src/components/Charts/TreeMapChart/TreeMapChartTooltip.tsx
|
|
15529
|
+
|
|
15530
|
+
function TreeMapChartTooltip_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)."; }
|
|
15531
|
+
|
|
15532
|
+
const TreeMapChartTooltip_Tooltip = /*#__PURE__*/base_default()("div", true ? {
|
|
15533
|
+
target: "eikatys0"
|
|
15534
|
+
} : 0)("background-color:", ({
|
|
15535
|
+
theme
|
|
15536
|
+
}) => theme.colors.white, ";border:1px solid ", ({
|
|
15537
|
+
theme
|
|
15538
|
+
}) => theme.colors.green20, ";border-radius:4px;font-size:12px;font-weight:500;padding:4px 8px;display:flex;gap:5px;" + ( true ? "" : 0));
|
|
15539
|
+
var TreeMapChartTooltip_ref = true ? {
|
|
15540
|
+
name: "1j389vi",
|
|
15541
|
+
styles: "font-weight:700"
|
|
15542
|
+
} : 0;
|
|
15543
|
+
const TreeMapChartTooltip = ({
|
|
15544
|
+
node
|
|
15545
|
+
}) => {
|
|
15546
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(TreeMapChartTooltip_Tooltip, {
|
|
15547
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
15548
|
+
children: node.id
|
|
15549
|
+
}), (0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
15550
|
+
css: TreeMapChartTooltip_ref,
|
|
15551
|
+
children: node.formattedValue
|
|
15552
|
+
})]
|
|
15553
|
+
});
|
|
15554
|
+
};
|
|
15555
|
+
;// ./src/components/Charts/TreeMapChart/TreeMapChart.tsx
|
|
15556
|
+
function TreeMapChart_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)."; }
|
|
15557
|
+
|
|
15558
|
+
|
|
15559
|
+
|
|
15560
|
+
|
|
15561
|
+
|
|
15562
|
+
|
|
15563
|
+
|
|
15564
|
+
|
|
15565
|
+
var TreeMapChart_ref = true ? {
|
|
15566
|
+
name: "1qkt16r",
|
|
15567
|
+
styles: "position:relative;height:100%;width:100%"
|
|
15568
|
+
} : 0;
|
|
15569
|
+
var TreeMapChart_ref2 = true ? {
|
|
15570
|
+
name: "19s8nj4",
|
|
15571
|
+
styles: "position:absolute;width:100%;height:100%"
|
|
15572
|
+
} : 0;
|
|
15573
|
+
const TreeMapChartComponent = ({
|
|
15574
|
+
data,
|
|
15575
|
+
title,
|
|
15576
|
+
widgetCardProps,
|
|
15577
|
+
features = [],
|
|
15578
|
+
...treeMapProps
|
|
15579
|
+
}) => {
|
|
15580
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
15581
|
+
const colors = [theme.colors.purple, theme.colors.blue, theme.colors.blueLight, theme.colors.turquoise, theme.colors.green, theme.colors.yellowLighter, theme.colors.yellow, theme.colors.pink, theme.colors.blueCool, theme.colors.cyanTeal];
|
|
15582
|
+
return (0,jsx_runtime_namespaceObject.jsx)(WithWidgetCard, {
|
|
15583
|
+
features: features,
|
|
15584
|
+
cardProps: {
|
|
15585
|
+
title,
|
|
15586
|
+
headerContent: (0,jsx_runtime_namespaceObject.jsx)(TreeMapChartHeader, {
|
|
15587
|
+
features: features
|
|
15588
|
+
}),
|
|
15589
|
+
...widgetCardProps
|
|
15590
|
+
},
|
|
15591
|
+
children: (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
15592
|
+
css: TreeMapChart_ref,
|
|
15593
|
+
children: (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
15594
|
+
css: TreeMapChart_ref2,
|
|
15595
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(treemap_namespaceObject.ResponsiveTreeMap, {
|
|
15596
|
+
borderWidth: 0,
|
|
15597
|
+
colors: colors,
|
|
15598
|
+
data: data,
|
|
15599
|
+
identity: "name",
|
|
15600
|
+
innerPadding: 4,
|
|
15601
|
+
label: node => `${node.id} (${node.formattedValue})`,
|
|
15602
|
+
labelSkipSize: 10,
|
|
15603
|
+
labelTextColor: theme.colors.white,
|
|
15604
|
+
parentLabelTextColor: theme.colors.white,
|
|
15605
|
+
leavesOnly: true,
|
|
15606
|
+
nodeOpacity: 1,
|
|
15607
|
+
theme: {
|
|
15608
|
+
labels: {
|
|
15609
|
+
text: {
|
|
15610
|
+
fontSize: 14,
|
|
15611
|
+
fontWeight: 600
|
|
15612
|
+
}
|
|
15613
|
+
}
|
|
15614
|
+
},
|
|
15615
|
+
tooltip: TreeMapChartTooltip,
|
|
15616
|
+
value: "value",
|
|
15617
|
+
...treeMapProps
|
|
15618
|
+
})
|
|
15619
|
+
})
|
|
15620
|
+
})
|
|
15621
|
+
});
|
|
15622
|
+
};
|
|
15623
|
+
const TreeMapChart = WithFullscreenMode(TreeMapChartComponent);
|
|
15624
|
+
;// ./src/components/Charts/TreeMapChart/index.ts
|
|
15625
|
+
|
|
14225
15626
|
;// ./src/components/Charts/common/index.ts
|
|
14226
15627
|
|
|
14227
15628
|
;// ./src/components/Charts/hooks/index.ts
|
|
@@ -14232,6 +15633,7 @@ const BarLineComplexChart = WithFullscreenMode(BarLineComplexChartComponent);
|
|
|
14232
15633
|
|
|
14233
15634
|
|
|
14234
15635
|
|
|
15636
|
+
|
|
14235
15637
|
;// ./src/components/Popover/hooks/index.ts
|
|
14236
15638
|
|
|
14237
15639
|
|