@ssa-ui-kit/core 2.28.0 → 2.28.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Charts/BigNumberChart/components/TrendLine.d.ts +2 -1
- package/dist/components/DatePicker/styles.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/components/DatesListWrapper.d.ts +2 -0
- package/dist/components/DateRangePicker/components/YearsMonthsSwitch.d.ts +1 -0
- package/dist/components/DateRangePicker/components/index.d.ts +1 -1
- package/dist/components/DateRangePicker/constants.d.ts +10 -0
- package/dist/components/DateRangePicker/hooks/useDateRangePicker.d.ts +1 -1
- package/dist/components/DateRangePicker/styles.d.ts +4 -1
- package/dist/components/DateRangePicker/types.d.ts +4 -1
- package/dist/components/DateRangePicker/utils/format.d.ts +10 -0
- package/dist/components/DateRangePicker/utils/index.d.ts +1 -0
- package/dist/components/Filters/FilterBlockWrapper.d.ts +2 -0
- package/dist/components/Typeahead/styles.d.ts +2 -0
- package/dist/components/Wrapper/Wrapper.d.ts +2 -0
- package/dist/index.js +347 -117
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/DateRangePicker/components/MonthsSwitch.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1480,7 +1480,22 @@ const Wrapper = /*#__PURE__*/base_default()("div", true ? {
|
|
|
1480
1480
|
alignItems
|
|
1481
1481
|
}) => alignItems ? alignItems : 'center', ";width:100%;flex-direction:", ({
|
|
1482
1482
|
direction
|
|
1483
|
-
}) => direction ? direction : 'row', ";"
|
|
1483
|
+
}) => direction ? direction : 'row', ";", ({
|
|
1484
|
+
fade,
|
|
1485
|
+
fadeDelay = 0.3
|
|
1486
|
+
}) => fade && `
|
|
1487
|
+
opacity: 0;
|
|
1488
|
+
animation: fadeInOut ${fadeDelay}s ease-in-out forwards;
|
|
1489
|
+
|
|
1490
|
+
@keyframes fadeInOut {
|
|
1491
|
+
0% {
|
|
1492
|
+
opacity: 0;
|
|
1493
|
+
}
|
|
1494
|
+
100% {
|
|
1495
|
+
opacity: 1;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
`, ";" + ( true ? "" : 0));
|
|
1484
1499
|
/* harmony default export */ const Wrapper_Wrapper = (Wrapper);
|
|
1485
1500
|
;// ./src/components/Button/ButtonBase.tsx
|
|
1486
1501
|
|
|
@@ -10767,19 +10782,26 @@ const TrendLineTooltip = ({
|
|
|
10767
10782
|
|
|
10768
10783
|
const ActivePoint = ({
|
|
10769
10784
|
currentPoint,
|
|
10785
|
+
lastActivePoint,
|
|
10786
|
+
points,
|
|
10770
10787
|
...props
|
|
10771
|
-
}) =>
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10788
|
+
}) => {
|
|
10789
|
+
const activePoint = lastActivePoint ? points.find(({
|
|
10790
|
+
data
|
|
10791
|
+
}) => data.x === lastActivePoint.x && data.y === lastActivePoint.y) : currentPoint;
|
|
10792
|
+
return (0,jsx_runtime_namespaceObject.jsx)("g", {
|
|
10793
|
+
children: activePoint && (0,jsx_runtime_namespaceObject.jsx)(core_namespaceObject.DotsItem, {
|
|
10794
|
+
size: props.pointSize || 10,
|
|
10795
|
+
borderWidth: props.pointBorderWidth || 10,
|
|
10796
|
+
x: activePoint.x,
|
|
10797
|
+
y: activePoint.y,
|
|
10798
|
+
datum: activePoint.data,
|
|
10799
|
+
color: activePoint.color,
|
|
10800
|
+
borderColor: activePoint.borderColor,
|
|
10801
|
+
labelYOffset: props.pointLabelYOffset
|
|
10802
|
+
}, activePoint.id)
|
|
10803
|
+
});
|
|
10804
|
+
};
|
|
10783
10805
|
const TrendLine = ({
|
|
10784
10806
|
color,
|
|
10785
10807
|
tooltipValueFormat,
|
|
@@ -10891,9 +10913,6 @@ const BigNumberChartComponent = ({
|
|
|
10891
10913
|
if (!interactive) return;
|
|
10892
10914
|
setHoveredValueThrottled(data.data);
|
|
10893
10915
|
};
|
|
10894
|
-
const handleMouseLeave = () => {
|
|
10895
|
-
setHoveredValueThrottled(null);
|
|
10896
|
-
};
|
|
10897
10916
|
const value = hoveredValue ?? lastValue;
|
|
10898
10917
|
return (0,jsx_runtime_namespaceObject.jsx)(WithWidgetCard, {
|
|
10899
10918
|
features: features,
|
|
@@ -10924,7 +10943,7 @@ const BigNumberChartComponent = ({
|
|
|
10924
10943
|
data
|
|
10925
10944
|
}],
|
|
10926
10945
|
onMouseMove: handleMouseMove,
|
|
10927
|
-
|
|
10946
|
+
lastActivePoint: value
|
|
10928
10947
|
})
|
|
10929
10948
|
})
|
|
10930
10949
|
})]
|
|
@@ -14010,13 +14029,89 @@ const DatePicker = /*#__PURE__*/(0,external_react_namespaceObject.forwardRef)(Da
|
|
|
14010
14029
|
|
|
14011
14030
|
;// ./src/components/DateRangePicker/constants.ts
|
|
14012
14031
|
const constants_DEFAULT_MASK_FORMAT = 'mm/dd/yyyy';
|
|
14032
|
+
const DEFAULT_MONTH_MASK_FORMAT = 'mm/yyyy';
|
|
14033
|
+
const DEFAULT_YEAR_MASK_FORMAT = 'yyyy';
|
|
14013
14034
|
const constants_DEFAULT_MASK = '__/__/____';
|
|
14035
|
+
const DEFAULT_MONTH_MASK = '__/____';
|
|
14036
|
+
const DEFAULT_YEAR_MASK = '____';
|
|
14014
14037
|
const constants_MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
14015
14038
|
const constants_DATE_MIN = '01/01/1900';
|
|
14016
14039
|
const constants_DATE_MAX = '01/01/2150';
|
|
14040
|
+
const MONTH_DATE_MIN = '01/1900';
|
|
14041
|
+
const MONTH_DATE_MAX = '01/2150';
|
|
14042
|
+
const YEAR_DATE_MIN = '1900';
|
|
14043
|
+
const YEAR_DATE_MAX = '2150';
|
|
14017
14044
|
const constants_OUT_OF_RANGE = 'The date is out of the defined range';
|
|
14018
14045
|
const constants_INVALID_DATE = 'Invalid date';
|
|
14019
14046
|
const FULL_DATE_LENGTH = 10;
|
|
14047
|
+
const FULL_MONTH_DATE_LENGTH = 7;
|
|
14048
|
+
const FULL_YEAR_DATE_LENGTH = 4;
|
|
14049
|
+
;// ./src/components/DateRangePicker/utils/format.ts
|
|
14050
|
+
|
|
14051
|
+
const isMonthOnlyFormat = format => {
|
|
14052
|
+
if (!format) return false;
|
|
14053
|
+
const lowerFormat = format.toLowerCase();
|
|
14054
|
+
const hasMonth = lowerFormat.includes('mm');
|
|
14055
|
+
const hasYear = lowerFormat.includes('yyyy');
|
|
14056
|
+
const hasDay = lowerFormat.includes('dd');
|
|
14057
|
+
return hasMonth && hasYear && !hasDay;
|
|
14058
|
+
};
|
|
14059
|
+
const isYearOnlyFormat = format => {
|
|
14060
|
+
if (!format) return false;
|
|
14061
|
+
const lowerFormat = format.toLowerCase();
|
|
14062
|
+
const hasYear = lowerFormat.includes('yyyy');
|
|
14063
|
+
const hasMonth = lowerFormat.includes('mm');
|
|
14064
|
+
const hasDay = lowerFormat.includes('dd');
|
|
14065
|
+
return hasYear && !hasMonth && !hasDay;
|
|
14066
|
+
};
|
|
14067
|
+
const getExpectedDateLength = format => {
|
|
14068
|
+
if (!format) return FULL_DATE_LENGTH;
|
|
14069
|
+
if (isYearOnlyFormat(format)) {
|
|
14070
|
+
return FULL_YEAR_DATE_LENGTH;
|
|
14071
|
+
}
|
|
14072
|
+
if (isMonthOnlyFormat(format)) {
|
|
14073
|
+
return FULL_MONTH_DATE_LENGTH;
|
|
14074
|
+
}
|
|
14075
|
+
return FULL_DATE_LENGTH;
|
|
14076
|
+
};
|
|
14077
|
+
const getMaskForFormat = format => {
|
|
14078
|
+
if (isYearOnlyFormat(format)) {
|
|
14079
|
+
return DEFAULT_YEAR_MASK;
|
|
14080
|
+
}
|
|
14081
|
+
if (isMonthOnlyFormat(format)) {
|
|
14082
|
+
return DEFAULT_MONTH_MASK;
|
|
14083
|
+
}
|
|
14084
|
+
return constants_DEFAULT_MASK;
|
|
14085
|
+
};
|
|
14086
|
+
const getDefaultDateRange = format => {
|
|
14087
|
+
if (isYearOnlyFormat(format)) {
|
|
14088
|
+
return {
|
|
14089
|
+
defaultMin: YEAR_DATE_MIN,
|
|
14090
|
+
defaultMax: YEAR_DATE_MAX
|
|
14091
|
+
};
|
|
14092
|
+
}
|
|
14093
|
+
if (isMonthOnlyFormat(format)) {
|
|
14094
|
+
return {
|
|
14095
|
+
defaultMin: MONTH_DATE_MIN,
|
|
14096
|
+
defaultMax: MONTH_DATE_MAX
|
|
14097
|
+
};
|
|
14098
|
+
}
|
|
14099
|
+
return {
|
|
14100
|
+
defaultMin: constants_DATE_MIN,
|
|
14101
|
+
defaultMax: constants_DATE_MAX
|
|
14102
|
+
};
|
|
14103
|
+
};
|
|
14104
|
+
const getFormatForRangePickerType = rangePickerType => {
|
|
14105
|
+
switch (rangePickerType) {
|
|
14106
|
+
case 'years':
|
|
14107
|
+
return DEFAULT_YEAR_MASK_FORMAT;
|
|
14108
|
+
case 'months':
|
|
14109
|
+
return DEFAULT_MONTH_MASK_FORMAT;
|
|
14110
|
+
case 'days':
|
|
14111
|
+
default:
|
|
14112
|
+
return constants_DEFAULT_MASK_FORMAT;
|
|
14113
|
+
}
|
|
14114
|
+
};
|
|
14020
14115
|
;// ./src/components/DateRangePicker/components/DatesListWrapper.tsx
|
|
14021
14116
|
|
|
14022
14117
|
|
|
@@ -14089,8 +14184,9 @@ const styles_YearsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
|
14089
14184
|
}) => isCalendarYear || isCalendarFirstDateSelected || isCalendarSecondDateSelected ? `linear-gradient(247.37deg, ${theme.colors.blueLighter} 14.71%, ${theme.colors.blue} 85.29%)` : 'none', ";background:", ({
|
|
14090
14185
|
theme,
|
|
14091
14186
|
isHighlighted,
|
|
14092
|
-
isCalendarYear
|
|
14093
|
-
|
|
14187
|
+
isCalendarYear,
|
|
14188
|
+
isCalendarSecondDateSelected
|
|
14189
|
+
}) => isHighlighted && !isCalendarYear && !isCalendarSecondDateSelected && theme.colors.blueRoyal16, ";&:hover{background:", ({
|
|
14094
14190
|
theme
|
|
14095
14191
|
}) => theme.colors.greyLighter, ";color:", ({
|
|
14096
14192
|
theme
|
|
@@ -14111,24 +14207,21 @@ const styles_MonthsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
|
14111
14207
|
isCalendarSecondDateSelected
|
|
14112
14208
|
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? '6px' : 0, ";font-size:14px;font-weight:500;cursor:pointer;color:", ({
|
|
14113
14209
|
theme,
|
|
14114
|
-
isCalendarMonth,
|
|
14115
14210
|
isCalendarFirstDateSelected,
|
|
14116
14211
|
isCalendarSecondDateSelected
|
|
14117
|
-
}) => (
|
|
14212
|
+
}) => (isCalendarFirstDateSelected || isCalendarSecondDateSelected) && theme.colors.white, ";user-select:none;background:", ({
|
|
14118
14213
|
theme,
|
|
14119
|
-
isCalendarMonth,
|
|
14120
14214
|
isCalendarFirstDateSelected,
|
|
14121
14215
|
isCalendarSecondDateSelected
|
|
14122
|
-
}) =>
|
|
14216
|
+
}) => 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:", ({
|
|
14123
14217
|
theme
|
|
14124
14218
|
}) => theme.colors.greyDarker, ";background:", ({
|
|
14125
14219
|
theme
|
|
14126
14220
|
}) => theme.colors.grey, ";}&[aria-disabled='false']{background:", ({
|
|
14127
14221
|
theme,
|
|
14128
14222
|
isHighlighted,
|
|
14129
|
-
isCalendarMonth,
|
|
14130
14223
|
isCalendarSecondDateSelected
|
|
14131
|
-
}) => isHighlighted && !
|
|
14224
|
+
}) => isHighlighted && !isCalendarSecondDateSelected && theme.colors.blueRoyal16, ";&:hover{background:", ({
|
|
14132
14225
|
theme
|
|
14133
14226
|
}) => theme.colors.greyLighter, ";color:", ({
|
|
14134
14227
|
theme
|
|
@@ -14483,9 +14576,12 @@ const MonthsView_MonthsView = () => {
|
|
|
14483
14576
|
dateMaxDT,
|
|
14484
14577
|
lastFocusedElement,
|
|
14485
14578
|
currentCalendarViewDT,
|
|
14579
|
+
rangePickerType,
|
|
14486
14580
|
setCalendarType,
|
|
14487
14581
|
setCalendarViewDateTime,
|
|
14488
|
-
onMonthChange
|
|
14582
|
+
onMonthChange,
|
|
14583
|
+
setDateTime,
|
|
14584
|
+
setIsOpen
|
|
14489
14585
|
} = useDateRangePickerContext();
|
|
14490
14586
|
const {
|
|
14491
14587
|
handleDateHover,
|
|
@@ -14503,20 +14599,34 @@ const MonthsView_MonthsView = () => {
|
|
|
14503
14599
|
}
|
|
14504
14600
|
const selectedMonth = target.innerHTML;
|
|
14505
14601
|
const monthNumber = constants_MONTHS.findIndex(month => month === selectedMonth);
|
|
14506
|
-
|
|
14507
|
-
|
|
14508
|
-
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14602
|
+
if (rangePickerType === 'days') {
|
|
14603
|
+
const newDate = currentCalendarViewDT?.set({
|
|
14604
|
+
month: monthNumber + 1
|
|
14605
|
+
});
|
|
14606
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
14607
|
+
if (newDate) {
|
|
14608
|
+
onMonthChange?.(newDate.toJSDate());
|
|
14609
|
+
}
|
|
14610
|
+
setCalendarType('days');
|
|
14611
|
+
} else {
|
|
14612
|
+
const newMonth = currentCalendarViewDT?.set({
|
|
14613
|
+
month: monthNumber + 1
|
|
14614
|
+
});
|
|
14615
|
+
const newDate = newMonth?.set({
|
|
14616
|
+
day: lastFocusedElement === 'from' ? 1 : newMonth.daysInMonth
|
|
14617
|
+
});
|
|
14618
|
+
const newDateTuple = lastFocusedElement === 'from' ? [newDate, dateTime[1]] : [dateTime[0], newDate];
|
|
14619
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, dateTime[1] ? calendarViewDateTime?.[1] : newDate] : [dateTime[0] ? calendarViewDateTime?.[0] : newDate, newDate]);
|
|
14620
|
+
setDateTime(newDateTuple);
|
|
14621
|
+
if (newDateTuple[0] && newDateTuple[1]) {
|
|
14622
|
+
setIsOpen(false);
|
|
14623
|
+
}
|
|
14512
14624
|
}
|
|
14513
|
-
setCalendarType('days');
|
|
14514
14625
|
};
|
|
14515
14626
|
return (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
|
|
14516
14627
|
css: components_MonthsView_ref,
|
|
14517
14628
|
onClick: handleMonthSelect,
|
|
14518
14629
|
children: constants_MONTHS.map((month, index) => {
|
|
14519
|
-
const isCalendarMonth = currentCalendarViewDT ? currentCalendarViewDT.month === index + 1 : false;
|
|
14520
14630
|
const currentMonthDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
14521
14631
|
year: currentCalendarViewDT?.year,
|
|
14522
14632
|
month: index + 1,
|
|
@@ -14532,7 +14642,6 @@ const MonthsView_MonthsView = () => {
|
|
|
14532
14642
|
isCalendarSecondDateSelected
|
|
14533
14643
|
});
|
|
14534
14644
|
return (0,jsx_runtime_namespaceObject.jsx)(styles_MonthsViewCell, {
|
|
14535
|
-
isCalendarMonth: isCalendarMonth,
|
|
14536
14645
|
"aria-disabled": isAriaDisabled,
|
|
14537
14646
|
"aria-label": `${month}, ${currentCalendarViewDT?.year}`,
|
|
14538
14647
|
isCalendarFirstDateSelected: isCalendarFirstDateSelected,
|
|
@@ -14562,6 +14671,7 @@ var components_YearsView_ref = true ? {
|
|
|
14562
14671
|
} : 0;
|
|
14563
14672
|
const YearsView_YearsView = () => {
|
|
14564
14673
|
const {
|
|
14674
|
+
rangePickerType,
|
|
14565
14675
|
dateTime,
|
|
14566
14676
|
calendarViewDateTime,
|
|
14567
14677
|
currentCalendarViewDT,
|
|
@@ -14571,7 +14681,9 @@ const YearsView_YearsView = () => {
|
|
|
14571
14681
|
lastFocusedElement,
|
|
14572
14682
|
setCalendarType,
|
|
14573
14683
|
setCalendarViewDateTime,
|
|
14574
|
-
onYearChange
|
|
14684
|
+
onYearChange,
|
|
14685
|
+
setDateTime,
|
|
14686
|
+
setIsOpen
|
|
14575
14687
|
} = useDateRangePickerContext();
|
|
14576
14688
|
const wrapper = (0,external_react_namespaceObject.useRef)(null);
|
|
14577
14689
|
const yearsList = dates_getYearsList({
|
|
@@ -14596,13 +14708,32 @@ const YearsView_YearsView = () => {
|
|
|
14596
14708
|
target
|
|
14597
14709
|
} = event;
|
|
14598
14710
|
const selectedYear = Number(target.innerHTML);
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14711
|
+
if (rangePickerType !== 'years') {
|
|
14712
|
+
const newDate = currentCalendarViewDT.set({
|
|
14713
|
+
year: selectedYear
|
|
14714
|
+
});
|
|
14715
|
+
setCalendarType('months');
|
|
14716
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
14717
|
+
if (newDate) {
|
|
14718
|
+
onYearChange?.(newDate.toJSDate());
|
|
14719
|
+
}
|
|
14720
|
+
} else {
|
|
14721
|
+
const newYear = currentCalendarViewDT?.set({
|
|
14722
|
+
year: selectedYear
|
|
14723
|
+
});
|
|
14724
|
+
const newDate = newYear?.set(lastFocusedElement === 'from' ? {
|
|
14725
|
+
day: 1,
|
|
14726
|
+
month: 1
|
|
14727
|
+
} : {
|
|
14728
|
+
day: 31,
|
|
14729
|
+
month: 12
|
|
14730
|
+
});
|
|
14731
|
+
const newDateTuple = lastFocusedElement === 'from' ? [newDate, dateTime[1]] : [dateTime[0], newDate];
|
|
14732
|
+
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, dateTime[1] ? calendarViewDateTime?.[1] : newDate] : [dateTime[0] ? calendarViewDateTime?.[0] : newDate, newDate]);
|
|
14733
|
+
setDateTime(newDateTuple);
|
|
14734
|
+
if (newDateTuple[0] && newDateTuple[1]) {
|
|
14735
|
+
setIsOpen(false);
|
|
14736
|
+
}
|
|
14606
14737
|
}
|
|
14607
14738
|
};
|
|
14608
14739
|
return (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
|
|
@@ -14640,20 +14771,21 @@ const YearsView_YearsView = () => {
|
|
|
14640
14771
|
})
|
|
14641
14772
|
});
|
|
14642
14773
|
};
|
|
14643
|
-
;// ./src/components/DateRangePicker/components/
|
|
14774
|
+
;// ./src/components/DateRangePicker/components/YearsMonthsSwitch.tsx
|
|
14644
14775
|
|
|
14645
|
-
function
|
|
14776
|
+
function YearsMonthsSwitch_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)."; }
|
|
14646
14777
|
|
|
14647
14778
|
|
|
14648
14779
|
|
|
14649
14780
|
|
|
14650
14781
|
|
|
14651
|
-
var
|
|
14782
|
+
var YearsMonthsSwitch_ref = true ? {
|
|
14652
14783
|
name: "9cmux7",
|
|
14653
14784
|
styles: "width:72px;gap:24px"
|
|
14654
14785
|
} : 0;
|
|
14655
|
-
const
|
|
14786
|
+
const YearsMonthsSwitch = () => {
|
|
14656
14787
|
const {
|
|
14788
|
+
rangePickerType = 'days',
|
|
14657
14789
|
calendarType,
|
|
14658
14790
|
calendarViewDateTime,
|
|
14659
14791
|
dateMinDT,
|
|
@@ -14670,40 +14802,44 @@ const MonthsSwitch = () => {
|
|
|
14670
14802
|
});
|
|
14671
14803
|
const isMinMonthReached = calendarViewDateTime ? currentCalendarViewDT?.month === dateMinDT.month && currentCalendarViewDT.year === dateMinDT.year : false;
|
|
14672
14804
|
const isMaxMonthReached = calendarViewDateTime ? currentCalendarViewDT?.month === dateMaxDT.month && currentCalendarViewDT.year === dateMaxDT.year : false;
|
|
14673
|
-
const
|
|
14674
|
-
const newDate = currentCalendarViewDT?.minus({
|
|
14805
|
+
const handlePrevious = () => {
|
|
14806
|
+
const newDate = currentCalendarViewDT?.minus(isDayCalendarType ? {
|
|
14675
14807
|
month: 1
|
|
14808
|
+
} : {
|
|
14809
|
+
year: 1
|
|
14676
14810
|
});
|
|
14677
14811
|
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
14678
14812
|
if (newDate) {
|
|
14679
14813
|
onMonthChange?.(newDate.toJSDate());
|
|
14680
14814
|
}
|
|
14681
14815
|
};
|
|
14682
|
-
const
|
|
14683
|
-
const newDate = currentCalendarViewDT?.plus({
|
|
14816
|
+
const handleNext = () => {
|
|
14817
|
+
const newDate = currentCalendarViewDT?.plus(isDayCalendarType ? {
|
|
14684
14818
|
month: 1
|
|
14819
|
+
} : {
|
|
14820
|
+
year: 1
|
|
14685
14821
|
});
|
|
14686
14822
|
setCalendarViewDateTime(lastFocusedElement === 'from' ? [newDate, calendarViewDateTime[1]] : [calendarViewDateTime[0], newDate]);
|
|
14687
14823
|
if (newDate) {
|
|
14688
14824
|
onMonthChange?.(newDate.toJSDate());
|
|
14689
14825
|
}
|
|
14690
14826
|
};
|
|
14691
|
-
if (
|
|
14827
|
+
if (rangePickerType === 'days' && calendarType !== 'days' || rangePickerType === 'months' && calendarType !== 'months' || rangePickerType === 'years') {
|
|
14692
14828
|
return null;
|
|
14693
14829
|
}
|
|
14694
14830
|
return (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
|
|
14695
|
-
css:
|
|
14831
|
+
css: YearsMonthsSwitch_ref,
|
|
14696
14832
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
14697
14833
|
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
14698
14834
|
name: "carrot-left",
|
|
14699
14835
|
size: 14,
|
|
14700
|
-
tooltip:
|
|
14836
|
+
tooltip: `Previous ${rangePickerType === 'days' ? 'month' : 'year'}`,
|
|
14701
14837
|
color: isMinMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
14702
14838
|
}),
|
|
14703
14839
|
variant: 'tertiary',
|
|
14704
|
-
"aria-label":
|
|
14705
|
-
"data-testid": "previous-month",
|
|
14706
|
-
onClick:
|
|
14840
|
+
"aria-label": `Previous ${rangePickerType === 'days' ? 'month' : 'year'}`,
|
|
14841
|
+
"data-testid": "previous-year-month",
|
|
14842
|
+
onClick: handlePrevious,
|
|
14707
14843
|
isDisabled: isMinMonthReached,
|
|
14708
14844
|
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
14709
14845
|
padding: 4,
|
|
@@ -14717,14 +14853,14 @@ const MonthsSwitch = () => {
|
|
|
14717
14853
|
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
14718
14854
|
name: "carrot-right",
|
|
14719
14855
|
size: 14,
|
|
14720
|
-
tooltip:
|
|
14856
|
+
tooltip: `Next ${rangePickerType === 'days' ? 'month' : 'year'}`,
|
|
14721
14857
|
color: isMaxMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
14722
14858
|
}),
|
|
14723
14859
|
variant: 'tertiary',
|
|
14724
|
-
onClick:
|
|
14860
|
+
onClick: handleNext,
|
|
14725
14861
|
isDisabled: isMaxMonthReached,
|
|
14726
|
-
"aria-label":
|
|
14727
|
-
"data-testid": "next-month",
|
|
14862
|
+
"aria-label": `Next ${rangePickerType === 'days' ? 'month' : 'year'}`,
|
|
14863
|
+
"data-testid": "next-year-month",
|
|
14728
14864
|
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
14729
14865
|
padding: 4,
|
|
14730
14866
|
height: 32,
|
|
@@ -14752,28 +14888,29 @@ var Header_ref2 = true ? {
|
|
|
14752
14888
|
} : 0;
|
|
14753
14889
|
const Header_Header = () => {
|
|
14754
14890
|
const {
|
|
14891
|
+
rangePickerType,
|
|
14755
14892
|
calendarType,
|
|
14756
14893
|
currentCalendarViewDT,
|
|
14757
14894
|
setCalendarType
|
|
14758
14895
|
} = useDateRangePickerContext();
|
|
14759
14896
|
const handleCalendarTypeChange = () => {
|
|
14760
|
-
setCalendarType(calendarType === 'days' ? 'years' : 'days');
|
|
14897
|
+
setCalendarType(calendarType === 'days' || calendarType === 'months' ? 'years' : rangePickerType ?? 'days');
|
|
14761
14898
|
};
|
|
14762
14899
|
return (0,jsx_runtime_namespaceObject.jsxs)(PopoverHeading, {
|
|
14763
14900
|
css: components_Header_ref,
|
|
14764
14901
|
as: 'div',
|
|
14765
14902
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
14766
|
-
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
14767
|
-
name: calendarType === 'days' ? 'carrot-down' : 'carrot-up',
|
|
14903
|
+
endIcon: rangePickerType !== 'years' ? (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
14904
|
+
name: calendarType === 'days' || calendarType === 'months' ? 'carrot-down' : 'carrot-up',
|
|
14768
14905
|
size: 14,
|
|
14769
14906
|
tooltip: ""
|
|
14770
|
-
}),
|
|
14907
|
+
}) : null,
|
|
14771
14908
|
variant: "tertiary",
|
|
14772
14909
|
onClick: handleCalendarTypeChange,
|
|
14773
14910
|
"data-testid": "calendar-type-change-button",
|
|
14774
14911
|
css: Header_ref2,
|
|
14775
|
-
children: currentCalendarViewDT.toFormat('LLLL yyyy')
|
|
14776
|
-
}), (0,jsx_runtime_namespaceObject.jsx)(
|
|
14912
|
+
children: currentCalendarViewDT.toFormat(rangePickerType === 'days' ? 'LLLL yyyy' : 'yyyy')
|
|
14913
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(YearsMonthsSwitch, {})]
|
|
14777
14914
|
});
|
|
14778
14915
|
};
|
|
14779
14916
|
;// ./src/components/DateRangePicker/components/Calendar.tsx
|
|
@@ -15254,7 +15391,6 @@ const Content_DatePickerContent = () => {
|
|
|
15254
15391
|
;// ./src/components/DateRangePicker/hooks/useDatePickerMask.tsx
|
|
15255
15392
|
|
|
15256
15393
|
|
|
15257
|
-
|
|
15258
15394
|
const useDatePickerMask_useDatePickerMask = ({
|
|
15259
15395
|
maskOptions,
|
|
15260
15396
|
formatIndexes,
|
|
@@ -15262,7 +15398,7 @@ const useDatePickerMask_useDatePickerMask = ({
|
|
|
15262
15398
|
dateMaxParts
|
|
15263
15399
|
}) => {
|
|
15264
15400
|
const {
|
|
15265
|
-
mask
|
|
15401
|
+
mask,
|
|
15266
15402
|
replacement = {
|
|
15267
15403
|
_: /\d/
|
|
15268
15404
|
},
|
|
@@ -15277,7 +15413,8 @@ const useDatePickerMask_useDatePickerMask = ({
|
|
|
15277
15413
|
selectionEnd,
|
|
15278
15414
|
value: currentValue
|
|
15279
15415
|
}) => {
|
|
15280
|
-
|
|
15416
|
+
const isDateMask = typeof mask === 'string' && /^[_/]+$/.test(mask);
|
|
15417
|
+
if (isDateMask) {
|
|
15281
15418
|
const newValue = currentValue.slice(0, selectionStart) + data + currentValue.slice(selectionEnd);
|
|
15282
15419
|
const updatedValue = (0,mask_namespaceObject.format)(newValue, {
|
|
15283
15420
|
mask,
|
|
@@ -15305,22 +15442,32 @@ const useDatePickerMask_useDatePickerMask = ({
|
|
|
15305
15442
|
|
|
15306
15443
|
|
|
15307
15444
|
|
|
15445
|
+
|
|
15308
15446
|
const useDateRangePicker = ({
|
|
15309
|
-
dateMin
|
|
15310
|
-
dateMax
|
|
15447
|
+
dateMin,
|
|
15448
|
+
dateMax,
|
|
15311
15449
|
name: _name,
|
|
15312
|
-
format
|
|
15450
|
+
format: propFormat,
|
|
15313
15451
|
maskOptions,
|
|
15314
15452
|
isOpenState = false,
|
|
15315
15453
|
defaultValue,
|
|
15454
|
+
rangePickerType = 'days',
|
|
15316
15455
|
onOpen,
|
|
15317
15456
|
onClose,
|
|
15318
15457
|
onError,
|
|
15319
15458
|
onChange,
|
|
15320
15459
|
...rest
|
|
15321
15460
|
}) => {
|
|
15461
|
+
const format = propFormat || getFormatForRangePickerType(rangePickerType);
|
|
15462
|
+
const {
|
|
15463
|
+
defaultMin,
|
|
15464
|
+
defaultMax
|
|
15465
|
+
} = getDefaultDateRange(format);
|
|
15466
|
+
const finalDateMin = dateMin || defaultMin;
|
|
15467
|
+
const finalDateMax = dateMax || defaultMax;
|
|
15322
15468
|
const inputFromRef = (0,external_react_namespaceObject.useRef)(null);
|
|
15323
15469
|
const inputToRef = (0,external_react_namespaceObject.useRef)(null);
|
|
15470
|
+
const previousRangePickerType = (0,external_react_namespaceObject.useRef)(rangePickerType);
|
|
15324
15471
|
const [isOpen, setIsOpen] = (0,external_react_namespaceObject.useState)(isOpenState);
|
|
15325
15472
|
const [status, setStatus] = (0,external_react_namespaceObject.useState)(rest.status);
|
|
15326
15473
|
const previousOpenState = (0,external_react_namespaceObject.useRef)(isOpenState);
|
|
@@ -15358,16 +15505,21 @@ const useDateRangePicker = ({
|
|
|
15358
15505
|
month: splittedFormat.findIndex(item => item === 'mm'),
|
|
15359
15506
|
year: splittedFormat.findIndex(item => item === 'yyyy')
|
|
15360
15507
|
});
|
|
15361
|
-
const [calendarType, setCalendarType] = (0,external_react_namespaceObject.useState)(
|
|
15508
|
+
const [calendarType, setCalendarType] = (0,external_react_namespaceObject.useState)(rangePickerType);
|
|
15362
15509
|
const [calendarViewDateTime, setCalendarViewDateTime] = (0,external_react_namespaceObject.useState)([undefined, undefined]);
|
|
15363
15510
|
const currentCalendarViewDT = calendarViewDateTime[currentIndex] || external_luxon_namespaceObject.DateTime.now().set({
|
|
15364
15511
|
day: 1
|
|
15365
15512
|
});
|
|
15366
15513
|
const luxonFormat = format.replace('mm', 'MM');
|
|
15367
|
-
const
|
|
15368
|
-
const
|
|
15514
|
+
const expectedDateLength = getExpectedDateLength(format);
|
|
15515
|
+
const dateMinParts = finalDateMin.split('/').map(Number);
|
|
15516
|
+
const dateMaxParts = finalDateMax.split('/').map(Number);
|
|
15517
|
+
const defaultMask = getMaskForFormat(format);
|
|
15369
15518
|
const maskInputRef = useDatePickerMask_useDatePickerMask({
|
|
15370
|
-
maskOptions
|
|
15519
|
+
maskOptions: {
|
|
15520
|
+
mask: defaultMask,
|
|
15521
|
+
...maskOptions
|
|
15522
|
+
},
|
|
15371
15523
|
dateMaxParts,
|
|
15372
15524
|
dateMinParts,
|
|
15373
15525
|
formatIndexes
|
|
@@ -15375,12 +15527,12 @@ const useDateRangePicker = ({
|
|
|
15375
15527
|
const dateMaxDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
15376
15528
|
year: dateMaxParts[formatIndexes['year']],
|
|
15377
15529
|
month: dateMaxParts[formatIndexes['month']],
|
|
15378
|
-
day: dateMaxParts[formatIndexes['day']]
|
|
15530
|
+
day: formatIndexes['day'] !== -1 ? dateMaxParts[formatIndexes['day']] : 1
|
|
15379
15531
|
});
|
|
15380
15532
|
const dateMinDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
15381
15533
|
year: dateMinParts[formatIndexes['year']],
|
|
15382
15534
|
month: dateMinParts[formatIndexes['month']],
|
|
15383
|
-
day: dateMinParts[formatIndexes['day']]
|
|
15535
|
+
day: formatIndexes['day'] !== -1 ? dateMinParts[formatIndexes['day']] : 1
|
|
15384
15536
|
});
|
|
15385
15537
|
const safeOnChange = newDateTime => {
|
|
15386
15538
|
const _newDateTime = newDateTime ? newDateTime.startOf('day') : undefined;
|
|
@@ -15416,7 +15568,7 @@ const useDateRangePicker = ({
|
|
|
15416
15568
|
const processValue = (newValue, elementName) => {
|
|
15417
15569
|
const currentElementType = elementName || lastFocusedElement;
|
|
15418
15570
|
const currentName = currentElementType === 'from' ? nameFrom : nameTo;
|
|
15419
|
-
const newDateTime = typeof newValue === 'string' && newValue.length ===
|
|
15571
|
+
const newDateTime = typeof newValue === 'string' && newValue.length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(newValue, luxonFormat) : undefined;
|
|
15420
15572
|
const newDateTimeIfInvalid = [currentElementType === 'from' ? undefined : dateTime?.[0], currentElementType === 'to' ? undefined : dateTime?.[1]];
|
|
15421
15573
|
const newDateTimeIfValid = [currentElementType === 'from' ? newDateTime : dateTime?.[0], currentElementType === 'to' ? newDateTime : dateTime?.[1]];
|
|
15422
15574
|
if (!newDateTime?.isValid) {
|
|
@@ -15461,14 +15613,14 @@ const useDateRangePicker = ({
|
|
|
15461
15613
|
const processInputValue = (inputValue, elementName) => {
|
|
15462
15614
|
const currentElementType = elementName || lastFocusedElement;
|
|
15463
15615
|
const currentName = currentElementType === 'from' ? nameFrom : nameTo;
|
|
15464
|
-
if (typeof inputValue === 'string' && inputValue.length && inputValue.length <
|
|
15616
|
+
if (typeof inputValue === 'string' && inputValue.length && inputValue.length < expectedDateLength) {
|
|
15465
15617
|
setIsOpen(false);
|
|
15466
15618
|
setTimeout(() => {
|
|
15467
15619
|
maskInputRef.current.focus();
|
|
15468
15620
|
}, 10);
|
|
15469
15621
|
}
|
|
15470
15622
|
let newDateTime;
|
|
15471
|
-
if (typeof inputValue === 'string' && inputValue.length ===
|
|
15623
|
+
if (typeof inputValue === 'string' && inputValue.length === expectedDateLength) {
|
|
15472
15624
|
newDateTime = external_luxon_namespaceObject.DateTime.fromFormat(inputValue, luxonFormat);
|
|
15473
15625
|
setValue(currentName, inputValue);
|
|
15474
15626
|
processValue(inputValue, elementName);
|
|
@@ -15502,16 +15654,19 @@ const useDateRangePicker = ({
|
|
|
15502
15654
|
setCalendarViewDateTime(currentElementType === 'from' ? [newCalendarViewDateTime, calendarViewDateTime[1]] : [calendarViewDateTime[0], newCalendarViewDateTime]);
|
|
15503
15655
|
}
|
|
15504
15656
|
};
|
|
15657
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
15658
|
+
setCalendarType(rangePickerType);
|
|
15659
|
+
}, [rangePickerType]);
|
|
15505
15660
|
(0,external_react_namespaceObject.useEffect)(() => {
|
|
15506
15661
|
processInputValue(lastFocusedElement === 'from' ? inputValueFrom : inputValueTo);
|
|
15507
15662
|
}, [lastFocusedElement]);
|
|
15508
15663
|
(0,external_react_namespaceObject.useEffect)(() => {
|
|
15509
|
-
if (inputValueFrom && inputValueFrom.length ===
|
|
15664
|
+
if (inputValueFrom && inputValueFrom.length === expectedDateLength) {
|
|
15510
15665
|
processInputValue(lastFocusedElement === 'from' ? inputValueFrom : inputValueTo);
|
|
15511
15666
|
}
|
|
15512
15667
|
}, [inputValueFrom]);
|
|
15513
15668
|
(0,external_react_namespaceObject.useEffect)(() => {
|
|
15514
|
-
if (inputValueTo && inputValueTo.length ===
|
|
15669
|
+
if (inputValueTo && inputValueTo.length === expectedDateLength) {
|
|
15515
15670
|
processInputValue(lastFocusedElement === 'from' ? inputValueFrom : inputValueTo);
|
|
15516
15671
|
}
|
|
15517
15672
|
}, [inputValueTo]);
|
|
@@ -15527,18 +15682,31 @@ const useDateRangePicker = ({
|
|
|
15527
15682
|
}, [dateTime, lastFocusedElement, currentName]);
|
|
15528
15683
|
(0,external_react_namespaceObject.useEffect)(() => {
|
|
15529
15684
|
if (dateTime[0] && dateTime[1] && dateTime[0] > dateTime[1]) {
|
|
15530
|
-
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15536
|
-
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15685
|
+
if (lastFocusedElement === 'from') {
|
|
15686
|
+
resetField(nameTo);
|
|
15687
|
+
setDateTime([dateTime[0], undefined]);
|
|
15688
|
+
setLastChangedDate([dateTime[0].toJSDate(), undefined]);
|
|
15689
|
+
setValue(nameTo, undefined);
|
|
15690
|
+
setLastFocusedElement('to');
|
|
15691
|
+
setTimeout(() => {
|
|
15692
|
+
setFocus(nameTo, {
|
|
15693
|
+
shouldSelect: true
|
|
15694
|
+
});
|
|
15695
|
+
}, 50);
|
|
15696
|
+
setIsOpen(true);
|
|
15697
|
+
} else {
|
|
15698
|
+
resetField(nameFrom);
|
|
15699
|
+
setDateTime([undefined, dateTime[1]]);
|
|
15700
|
+
setLastChangedDate([undefined, dateTime[1].toJSDate()]);
|
|
15701
|
+
setValue(nameFrom, undefined);
|
|
15702
|
+
setLastFocusedElement('from');
|
|
15703
|
+
setTimeout(() => {
|
|
15704
|
+
setFocus(nameFrom, {
|
|
15705
|
+
shouldSelect: true
|
|
15706
|
+
});
|
|
15707
|
+
}, 50);
|
|
15708
|
+
setIsOpen(true);
|
|
15709
|
+
}
|
|
15542
15710
|
}
|
|
15543
15711
|
}, [dateTime]);
|
|
15544
15712
|
(0,external_react_namespaceObject.useEffect)(() => {
|
|
@@ -15547,7 +15715,7 @@ const useDateRangePicker = ({
|
|
|
15547
15715
|
onOpen?.();
|
|
15548
15716
|
} else {
|
|
15549
15717
|
onClose?.();
|
|
15550
|
-
setCalendarType(
|
|
15718
|
+
setCalendarType(rangePickerType);
|
|
15551
15719
|
setCalendarViewDateTime([dateTime[0], dateTime[1]]);
|
|
15552
15720
|
}
|
|
15553
15721
|
previousOpenState.current = isOpen;
|
|
@@ -15561,10 +15729,24 @@ const useDateRangePicker = ({
|
|
|
15561
15729
|
year: splittedFormat.findIndex(item => item === 'yyyy')
|
|
15562
15730
|
});
|
|
15563
15731
|
}, [format]);
|
|
15732
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
15733
|
+
if (previousRangePickerType.current !== rangePickerType) {
|
|
15734
|
+
if (dateTime[0] || dateTime[1]) {
|
|
15735
|
+
const newLuxonFormat = format.replace('mm', 'MM');
|
|
15736
|
+
if (dateTime[0]) {
|
|
15737
|
+
setValue(nameFrom, dateTime[0].toFormat(newLuxonFormat));
|
|
15738
|
+
}
|
|
15739
|
+
if (dateTime[1]) {
|
|
15740
|
+
setValue(nameTo, dateTime[1].toFormat(newLuxonFormat));
|
|
15741
|
+
}
|
|
15742
|
+
}
|
|
15743
|
+
previousRangePickerType.current = rangePickerType;
|
|
15744
|
+
}
|
|
15745
|
+
}, [rangePickerType, format, dateTime, nameFrom, nameTo, setValue]);
|
|
15564
15746
|
(0,external_react_namespaceObject.useEffect)(() => {
|
|
15565
15747
|
if (Array.isArray(rest.value)) {
|
|
15566
|
-
const newDateTimeFrom = typeof rest.value[0] === 'string' && rest.value[0].length ===
|
|
15567
|
-
const newDateTimeTo = typeof rest.value[1] === 'string' && rest.value[1].length ===
|
|
15748
|
+
const newDateTimeFrom = typeof rest.value[0] === 'string' && rest.value[0].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(rest.value[0], luxonFormat) : undefined;
|
|
15749
|
+
const newDateTimeTo = typeof rest.value[1] === 'string' && rest.value[1].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(rest.value[1], luxonFormat) : undefined;
|
|
15568
15750
|
const newDateTime = [newDateTimeFrom?.isValid ? newDateTimeFrom : undefined, newDateTimeTo?.isValid ? newDateTimeTo : undefined];
|
|
15569
15751
|
setDateTime(newDateTime);
|
|
15570
15752
|
setLastChangedDate([newDateTime[0]?.toJSDate(), newDateTime[1]?.toJSDate()]);
|
|
@@ -15690,19 +15872,24 @@ const DateRangePickerProvider = ({
|
|
|
15690
15872
|
|
|
15691
15873
|
|
|
15692
15874
|
const DateRangePicker = ({
|
|
15693
|
-
format
|
|
15875
|
+
format,
|
|
15694
15876
|
openCalendarMode = 'icon',
|
|
15695
15877
|
showCalendarIcon = true,
|
|
15696
15878
|
showStatusArea = true,
|
|
15879
|
+
rangePickerType = 'days',
|
|
15697
15880
|
...rest
|
|
15698
|
-
}) =>
|
|
15699
|
-
format
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15881
|
+
}) => {
|
|
15882
|
+
const actualFormat = format || getFormatForRangePickerType(rangePickerType);
|
|
15883
|
+
return (0,jsx_runtime_namespaceObject.jsx)(DateRangePickerProvider, {
|
|
15884
|
+
format: actualFormat,
|
|
15885
|
+
openCalendarMode: openCalendarMode,
|
|
15886
|
+
showCalendarIcon: showCalendarIcon,
|
|
15887
|
+
showStatusArea: showStatusArea,
|
|
15888
|
+
rangePickerType: rangePickerType,
|
|
15889
|
+
...rest,
|
|
15890
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(Content_DatePickerContent, {})
|
|
15891
|
+
});
|
|
15892
|
+
};
|
|
15706
15893
|
;// ./src/components/DateRangePicker/index.ts
|
|
15707
15894
|
|
|
15708
15895
|
;// ./src/components/Drawer/DrawerProvider.tsx
|
|
@@ -20347,17 +20534,49 @@ const SelectWidget = props => {
|
|
|
20347
20534
|
onChange,
|
|
20348
20535
|
onBlur,
|
|
20349
20536
|
onFocus,
|
|
20537
|
+
value,
|
|
20350
20538
|
onChangeOverride,
|
|
20351
|
-
|
|
20539
|
+
multiple
|
|
20352
20540
|
} = props;
|
|
20353
20541
|
const {
|
|
20354
20542
|
enumOptions = [],
|
|
20355
20543
|
enumDisabled = []
|
|
20356
20544
|
} = options;
|
|
20357
|
-
const
|
|
20545
|
+
const isMultiple = !!multiple || Array.isArray(value);
|
|
20546
|
+
const items = Array.isArray(enumOptions) ? enumOptions : [];
|
|
20358
20547
|
const handleChange = onChangeOverride ? onChangeOverride : value => {
|
|
20359
20548
|
onChange(value);
|
|
20360
20549
|
};
|
|
20550
|
+
const getSelectedItems = () => {
|
|
20551
|
+
if (isMultiple) {
|
|
20552
|
+
if (Array.isArray(value)) return value;
|
|
20553
|
+
if (value !== undefined) return [value];
|
|
20554
|
+
return [];
|
|
20555
|
+
}
|
|
20556
|
+
if (value === undefined || value === null) return [];
|
|
20557
|
+
const index = (0,external_rjsf_utils_namespaceObject.enumOptionsIndexForValue)(value, enumOptions);
|
|
20558
|
+
return index !== undefined ? [value] : [];
|
|
20559
|
+
};
|
|
20560
|
+
const selectedItems = getSelectedItems();
|
|
20561
|
+
const handleFormChange = newValue => {
|
|
20562
|
+
if (isMultiple) {
|
|
20563
|
+
const arrayValue = Array.isArray(newValue) ? newValue : [newValue];
|
|
20564
|
+
handleChange(arrayValue);
|
|
20565
|
+
} else {
|
|
20566
|
+
const singleValue = Array.isArray(newValue) ? newValue[0] : newValue;
|
|
20567
|
+
handleChange(singleValue);
|
|
20568
|
+
}
|
|
20569
|
+
};
|
|
20570
|
+
const handleTypeaheadChange = (changedValue, isAdded) => {
|
|
20571
|
+
if (isMultiple) {
|
|
20572
|
+
const currentSelected = Array.isArray(selectedItems) ? selectedItems : [];
|
|
20573
|
+
const newSelected = isAdded ? [...currentSelected, changedValue] : currentSelected.filter(item => item !== changedValue);
|
|
20574
|
+
handleFormChange(newSelected);
|
|
20575
|
+
} else {
|
|
20576
|
+
const newValue = isAdded ? changedValue : undefined;
|
|
20577
|
+
handleFormChange(newValue);
|
|
20578
|
+
}
|
|
20579
|
+
};
|
|
20361
20580
|
const handleBlur = ({
|
|
20362
20581
|
target
|
|
20363
20582
|
}) => onBlur(id, target && target.value);
|
|
@@ -20366,11 +20585,21 @@ const SelectWidget = props => {
|
|
|
20366
20585
|
}) => onFocus(id, target && target.value);
|
|
20367
20586
|
const onEmptyChange = isEmpty => {
|
|
20368
20587
|
if (isEmpty) {
|
|
20369
|
-
handleChange();
|
|
20588
|
+
handleChange(isMultiple ? [] : undefined);
|
|
20589
|
+
}
|
|
20590
|
+
};
|
|
20591
|
+
const onClearAll = () => {
|
|
20592
|
+
handleChange(isMultiple ? [] : undefined);
|
|
20593
|
+
};
|
|
20594
|
+
const onRemoveSelectedClick = removedValue => {
|
|
20595
|
+
if (isMultiple) {
|
|
20596
|
+
const currentSelected = Array.isArray(selectedItems) ? selectedItems : [];
|
|
20597
|
+
const newSelected = currentSelected.filter(item => item !== removedValue);
|
|
20598
|
+
handleChange(newSelected);
|
|
20599
|
+
} else {
|
|
20600
|
+
handleChange(undefined);
|
|
20370
20601
|
}
|
|
20371
20602
|
};
|
|
20372
|
-
const items = Array.isArray(enumOptions) ? enumOptions : [];
|
|
20373
|
-
const selectedItems = selectedIndex ? [items[Number(selectedIndex)].value] : [];
|
|
20374
20603
|
return (0,jsx_runtime_namespaceObject.jsx)("div", {
|
|
20375
20604
|
id: id,
|
|
20376
20605
|
onBlur: handleBlur,
|
|
@@ -20379,12 +20608,13 @@ const SelectWidget = props => {
|
|
|
20379
20608
|
width: "100%",
|
|
20380
20609
|
selectedItems: selectedItems,
|
|
20381
20610
|
isDisabled: disabled,
|
|
20382
|
-
name: name
|
|
20383
|
-
|
|
20384
|
-
,
|
|
20611
|
+
name: name,
|
|
20612
|
+
isMultiple: isMultiple,
|
|
20385
20613
|
placeholder: placeholder || undefined,
|
|
20386
|
-
onChange:
|
|
20614
|
+
onChange: handleTypeaheadChange,
|
|
20387
20615
|
onEmptyChange: onEmptyChange,
|
|
20616
|
+
onClearAll: onClearAll,
|
|
20617
|
+
onRemoveSelectedClick: onRemoveSelectedClick,
|
|
20388
20618
|
renderOption: ({
|
|
20389
20619
|
label,
|
|
20390
20620
|
input
|