@elliemae/ds-controlled-form 2.0.0-next.1 → 2.0.0-next.6
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/cjs/controlled-checkbox/config/useValidateProps.js +3 -5
- package/cjs/controlled-checkbox/styles.js +2 -2
- package/cjs/controlled-checkbox/utils/styleHelpers.js +2 -20
- package/cjs/controlled-date-range-picker/config/useRangePickerLogic.js +1 -0
- package/cjs/controlled-date-range-picker/parts/ControlledDateRangeCalendar.js +1 -0
- package/cjs/controlled-date-range-picker/parts/ControlledDateRangeFromDate.js +1 -0
- package/cjs/controlled-date-range-picker/parts/ControlledDateRangeToDate.js +1 -0
- package/cjs/controlled-date-time-picker/config/useControlledDateTimePicker.js +7 -5
- package/cjs/controlled-date-time-picker/config/useGetDestructuredValues.js +6 -6
- package/cjs/controlled-date-time-picker/config/useValidateProps.js +10 -41
- package/cjs/controlled-date-time-picker/parts/DateInputs/DDInput.js +1 -1
- package/cjs/controlled-date-time-picker/parts/DateInputs/MMInput.js +1 -1
- package/cjs/controlled-date-time-picker/parts/DateInputs/YYYYInput.js +1 -1
- package/cjs/controlled-date-time-picker/parts/DateInputs/useDateInputs.js +3 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarHead.js +2 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Day.js +6 -6
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.js +2 -6
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +1 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +1 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/HoursList.js +4 -4
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +5 -5
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +4 -4
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.js +3 -62
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
- package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +1 -0
- package/cjs/controlled-date-time-picker/parts/Styleds.js +2 -7
- package/cjs/controlled-date-time-picker/parts/TimeInputs/HHInput.js +1 -1
- package/cjs/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.js +2 -1
- package/cjs/controlled-date-time-picker/parts/TimeInputs/MinutesInput.js +1 -1
- package/cjs/controlled-date-time-picker/parts/TimeInputs/useTimeInputs.js +4 -4
- package/cjs/controlled-date-time-picker/utils/dateHelpers.js +5 -5
- package/cjs/controlled-date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +1 -1
- package/cjs/controlled-date-time-picker/utils/stringHelpers.js +5 -4
- package/cjs/controlled-toggle/ControlledToggle.js +2 -1
- package/cjs/controlled-toggle/styles.js +5 -7
- package/esm/controlled-checkbox/config/useValidateProps.js +3 -5
- package/esm/controlled-checkbox/styles.js +2 -2
- package/esm/controlled-checkbox/utils/styleHelpers.js +2 -20
- package/esm/controlled-date-range-picker/config/useRangePickerLogic.js +1 -0
- package/esm/controlled-date-range-picker/parts/ControlledDateRangeCalendar.js +1 -0
- package/esm/controlled-date-range-picker/parts/ControlledDateRangeFromDate.js +1 -0
- package/esm/controlled-date-range-picker/parts/ControlledDateRangeToDate.js +1 -0
- package/esm/controlled-date-time-picker/config/useControlledDateTimePicker.js +7 -5
- package/esm/controlled-date-time-picker/config/useGetDestructuredValues.js +6 -6
- package/esm/controlled-date-time-picker/config/useValidateProps.js +10 -41
- package/esm/controlled-date-time-picker/parts/DateInputs/DDInput.js +1 -1
- package/esm/controlled-date-time-picker/parts/DateInputs/MMInput.js +1 -1
- package/esm/controlled-date-time-picker/parts/DateInputs/YYYYInput.js +1 -1
- package/esm/controlled-date-time-picker/parts/DateInputs/useDateInputs.js +3 -3
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarHead.js +2 -2
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Day.js +6 -6
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.js +2 -6
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +1 -2
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +1 -2
- package/esm/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/HoursList.js +4 -4
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +5 -5
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +4 -4
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.js +3 -62
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
- package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +1 -0
- package/esm/controlled-date-time-picker/parts/Styleds.js +2 -7
- package/esm/controlled-date-time-picker/parts/TimeInputs/HHInput.js +1 -1
- package/esm/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.js +2 -1
- package/esm/controlled-date-time-picker/parts/TimeInputs/MinutesInput.js +1 -1
- package/esm/controlled-date-time-picker/parts/TimeInputs/useTimeInputs.js +4 -4
- package/esm/controlled-date-time-picker/utils/dateHelpers.js +5 -5
- package/esm/controlled-date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +1 -1
- package/esm/controlled-date-time-picker/utils/stringHelpers.js +5 -4
- package/esm/controlled-toggle/ControlledToggle.js +2 -1
- package/esm/controlled-toggle/styles.js +5 -7
- package/package.json +4 -4
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
|
@@ -25,8 +25,8 @@ const useGetDestructuredDateValues = ({
|
|
|
25
25
|
const yearNum = convertToPositiveNumberIfPossible(year);
|
|
26
26
|
const announcedMonth = monthNum !== -1 ? monthNames[monthNum - 1] : 'empty month';
|
|
27
27
|
const announcedDay = dayNum !== -1 ? announcableCardinalDays[dayNum] : 'empty day';
|
|
28
|
-
const announcedYear = yearNum !== -1 ? fillStringWithPlaceHolders(
|
|
29
|
-
const announcedDateValues =
|
|
28
|
+
const announcedYear = yearNum !== -1 ? fillStringWithPlaceHolders("".concat(yearNum), 4, '0') : 'empty year';
|
|
29
|
+
const announcedDateValues = "".concat(announcedMonth, ", ").concat(announcedDay, ", ").concat(announcedYear);
|
|
30
30
|
return useMemo(() => ({
|
|
31
31
|
month,
|
|
32
32
|
day,
|
|
@@ -59,12 +59,12 @@ const useGetDestructuredTimeValues = ({
|
|
|
59
59
|
const hoursNum = convertToPositiveNumberIfPossible(hours);
|
|
60
60
|
const minutesNum = convertToPositiveNumberIfPossible(minutes); // 01 -> 1 ~ 09 -> 9 || 1_ -> 1 ~ 9_ -> 9 || empty...
|
|
61
61
|
|
|
62
|
-
const announcedHours = hoursNum !== -1 ?
|
|
62
|
+
const announcedHours = hoursNum !== -1 ? "".concat(hoursNum) : 'empty hours'; // 01 -> 1 ~ 09 -> 9 || 1_ -> 1 ~ 9_ -> 9 || empty...
|
|
63
63
|
|
|
64
|
-
const announcedMinutes = minutesNum !== -1 ?
|
|
64
|
+
const announcedMinutes = minutesNum !== -1 ? "".concat(minutesNum) : 'empty minutes';
|
|
65
65
|
const announcedMeridiem = // eslint-disable-next-line no-nested-ternary
|
|
66
|
-
meridiem === 'PM' ?
|
|
67
|
-
const announcedTimeValues =
|
|
66
|
+
meridiem === 'PM' ? "post meridiem" : meridiem === 'AM' ? 'ante meridiem' : 'empty meriediem';
|
|
67
|
+
const announcedTimeValues = "".concat(announcedHours, ", ").concat(announcedMinutes, ", ").concat(announcedMeridiem);
|
|
68
68
|
return useMemo(() => ({
|
|
69
69
|
hours,
|
|
70
70
|
minutes,
|
|
@@ -3,72 +3,41 @@ import { deconstructValuesFromDateString, isValidDateString, dateTimeToDate, isV
|
|
|
3
3
|
import { convertToPositiveNumberIfPossible } from '../utils/numberHelpers.js';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable max-len */
|
|
6
|
-
const PREPEND =
|
|
7
|
-
Invalid configuration detected::
|
|
8
|
-
|
|
9
|
-
`;
|
|
6
|
+
const PREPEND = "ControlledDateTimePicker:\n Invalid configuration detected::\n \n ";
|
|
10
7
|
const NOT_A_DEFECT = ''; // '\n\n\t\tThis is not a defect, please check\n\n\t\thttps://qa.dimsum.rd.elliemae.io/?path=/story/components-desktop-components-d-controlledform-date-time-picker--basic\n\n\t\tfor instructions on how to use the component correctly\n\n';
|
|
11
8
|
|
|
12
|
-
const INLINE_RECEIVED_PREPEND =
|
|
13
|
-
|
|
14
|
-
Received:`;
|
|
9
|
+
const INLINE_RECEIVED_PREPEND = "\n\n Received:";
|
|
15
10
|
|
|
16
11
|
const throwInvalidDateTimeError = invalidValue => {
|
|
17
|
-
throw new Error(
|
|
12
|
+
throw new Error("".concat(PREPEND, "the \"dateTime\" you are providing is not respecting the format it must respect.").concat(INLINE_RECEIVED_PREPEND).concat(invalidValue, "(").concat(typeof invalidValue, ")").concat(NOT_A_DEFECT));
|
|
18
13
|
};
|
|
19
14
|
|
|
20
15
|
const throwInvalidDaterror = invalidValue => {
|
|
21
|
-
throw new Error(
|
|
16
|
+
throw new Error("".concat(PREPEND, "the \"date\" you are providing is not respecting the format it must respect.").concat(INLINE_RECEIVED_PREPEND).concat(invalidValue, "(").concat(typeof invalidValue, ")").concat(NOT_A_DEFECT));
|
|
22
17
|
};
|
|
23
18
|
|
|
24
19
|
const throwInvalidTimerror = invalidValue => {
|
|
25
|
-
throw new Error(
|
|
20
|
+
throw new Error("".concat(PREPEND, "the \"time\" you are providing is not respecting the format it must respect.").concat(INLINE_RECEIVED_PREPEND).concat(invalidValue, "(").concat(typeof invalidValue, ")").concat(NOT_A_DEFECT));
|
|
26
21
|
};
|
|
27
22
|
|
|
28
23
|
const throwUncontrolledDateError = (date, onDateChange) => {
|
|
29
|
-
throw new Error(
|
|
30
|
-
the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
|
|
31
|
-
|
|
32
|
-
Received:
|
|
33
|
-
${date}(${typeof date})
|
|
34
|
-
${onDateChange}(${typeof onDateChange})
|
|
35
|
-
${NOT_A_DEFECT}`);
|
|
24
|
+
throw new Error("".concat(PREPEND, "you are trying to use a date selector while providing a non-string \"date\" or providing a non-function to \"onDateChange\"\n the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations\n\n Received:\n ").concat(date, "(").concat(typeof date, ")\n ").concat(onDateChange, "(").concat(typeof onDateChange, ")\n ").concat(NOT_A_DEFECT));
|
|
36
25
|
};
|
|
37
26
|
|
|
38
27
|
const throwUncontrolledTimeError = (time, onTimeChange) => {
|
|
39
|
-
throw new Error(
|
|
40
|
-
the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
|
|
41
|
-
|
|
42
|
-
Received:
|
|
43
|
-
${time}(${typeof time})
|
|
44
|
-
${onTimeChange}(${typeof onTimeChange})
|
|
45
|
-
${NOT_A_DEFECT}`);
|
|
28
|
+
throw new Error("".concat(PREPEND, "you are trying to use a time selector while providing a non-string \"time\" or providing a non-function to \"onTimeChange\"\n the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations\n\n Received:\n ").concat(time, "(").concat(typeof time, ")\n ").concat(onTimeChange, "(").concat(typeof onTimeChange, ")\n ").concat(NOT_A_DEFECT));
|
|
46
29
|
};
|
|
47
30
|
|
|
48
31
|
const throwUncontrolledDateTimeError = (dateTime, onDateTimeChange) => {
|
|
49
|
-
throw new Error(
|
|
50
|
-
the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
|
|
51
|
-
|
|
52
|
-
Received:
|
|
53
|
-
${dateTime}(${typeof dateTime})
|
|
54
|
-
${onDateTimeChange}(${typeof onDateTimeChange})
|
|
55
|
-
${NOT_A_DEFECT}`);
|
|
32
|
+
throw new Error("".concat(PREPEND, "you are trying to use a date-time selector while providing a non-string \"dateTime\" or providing a non-function to \"onDateTimeChange\"\n the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations\n\n Received:\n ").concat(dateTime, "(").concat(typeof dateTime, ")\n ").concat(onDateTimeChange, "(").concat(typeof onDateTimeChange, ")\n ").concat(NOT_A_DEFECT));
|
|
56
33
|
};
|
|
57
34
|
|
|
58
35
|
const throwInvalidEmptyPickerStartingMonthError = emptyPickerStartingMonth => {
|
|
59
|
-
throw new Error(
|
|
60
|
-
|
|
61
|
-
Received:
|
|
62
|
-
${emptyPickerStartingMonth}(${typeof emptyPickerStartingMonth})
|
|
63
|
-
${NOT_A_DEFECT}`);
|
|
36
|
+
throw new Error("".concat(PREPEND, "the provided emptyPickerStartingMonth props is invalid. please provide a string with the format mm/__/yyyy, (mm 01~12, yyyy 0001~9999) \n\n Received:\n ").concat(emptyPickerStartingMonth, "(").concat(typeof emptyPickerStartingMonth, ")\n ").concat(NOT_A_DEFECT));
|
|
64
37
|
};
|
|
65
38
|
|
|
66
39
|
const throwInvalidOnCalendarOpenFocusedDayError = onCalendarOpenFocusedDay => {
|
|
67
|
-
throw new Error(
|
|
68
|
-
|
|
69
|
-
Received:
|
|
70
|
-
${onCalendarOpenFocusedDay}(${typeof onCalendarOpenFocusedDay})
|
|
71
|
-
${NOT_A_DEFECT}`);
|
|
40
|
+
throw new Error("".concat(PREPEND, "the provided onCalendarOpenFocusedDay props is invalid. please provide a string with the format mm/dd/yyyy, (mm 01~12, dd 01~31, yyyy 0001~9999) \n\n Received:\n ").concat(onCalendarOpenFocusedDay, "(").concat(typeof onCalendarOpenFocusedDay, ")\n ").concat(NOT_A_DEFECT));
|
|
72
41
|
};
|
|
73
42
|
|
|
74
43
|
const useValidateProps = props => {
|
|
@@ -39,7 +39,7 @@ const DDInput = /*#__PURE__*/React.memo(({
|
|
|
39
39
|
value: value,
|
|
40
40
|
ref: contextRef,
|
|
41
41
|
placeholder: placeholder,
|
|
42
|
-
"aria-label":
|
|
42
|
+
"aria-label": "day input field, ".concat(ariaCurrentValueForInputs),
|
|
43
43
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY
|
|
44
44
|
});
|
|
45
45
|
});
|
|
@@ -41,7 +41,7 @@ const MMInput = /*#__PURE__*/React.memo(({
|
|
|
41
41
|
value: value,
|
|
42
42
|
ref: contextRef,
|
|
43
43
|
placeholder: placeholder,
|
|
44
|
-
"aria-label":
|
|
44
|
+
"aria-label": "month input field, ".concat(ariaCurrentValueForInputs),
|
|
45
45
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH
|
|
46
46
|
});
|
|
47
47
|
});
|
|
@@ -39,7 +39,7 @@ const YYYYInput = /*#__PURE__*/React.memo(({
|
|
|
39
39
|
value: value,
|
|
40
40
|
ref: contextRef,
|
|
41
41
|
placeholder: placeholder,
|
|
42
|
-
"aria-label":
|
|
42
|
+
"aria-label": "year input field, ".concat(ariaCurrentValueForInputs),
|
|
43
43
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR
|
|
44
44
|
});
|
|
45
45
|
});
|
|
@@ -92,7 +92,7 @@ const useDateInputs = () => {
|
|
|
92
92
|
const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
|
|
93
93
|
let newMonth;
|
|
94
94
|
if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
|
|
95
|
-
newMonth = prependStringWithPlaceHolders(
|
|
95
|
+
newMonth = prependStringWithPlaceHolders("".concat(newMonth), 2);
|
|
96
96
|
handleChangeMonth(newMonth, e);
|
|
97
97
|
}
|
|
98
98
|
}, [onHomeKeyDown, onEndKeyDown, month, handleChangeMonth]);
|
|
@@ -151,7 +151,7 @@ const useDateInputs = () => {
|
|
|
151
151
|
const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
|
|
152
152
|
let newDay;
|
|
153
153
|
if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
|
|
154
|
-
newDay = prependStringWithPlaceHolders(
|
|
154
|
+
newDay = prependStringWithPlaceHolders("".concat(newDay), 2);
|
|
155
155
|
handleChangeDay(newDay, e);
|
|
156
156
|
}
|
|
157
157
|
}, [onHomeKeyDown, onEndKeyDown, handleChangeDay, day]);
|
|
@@ -216,7 +216,7 @@ const useDateInputs = () => {
|
|
|
216
216
|
const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
|
|
217
217
|
let newYear;
|
|
218
218
|
if (key === 'ArrowUp') newYear = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYear = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
|
|
219
|
-
newYear = prependStringWithPlaceHolders(
|
|
219
|
+
newYear = prependStringWithPlaceHolders("".concat(newYear), 4);
|
|
220
220
|
handleChangeYear(newYear, e);
|
|
221
221
|
}
|
|
222
222
|
}, [onHomeKeyDown, onEndKeyDown, handleChangeYear, year]);
|
|
@@ -15,7 +15,7 @@ const CalendarDaysList = /*#__PURE__*/React.memo(({
|
|
|
15
15
|
children: [/*#__PURE__*/_jsx(Day, {
|
|
16
16
|
metaDay: invisibleFirstDay,
|
|
17
17
|
isInvisible: true
|
|
18
|
-
},
|
|
18
|
+
}, "ds-calendar-".concat(invisibleFirstDay.day.toString())), daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx(StyledWeekDaysListWrapper, {
|
|
19
19
|
role: "row",
|
|
20
20
|
"aria-rowindex": i + 1,
|
|
21
21
|
cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
|
|
@@ -24,13 +24,13 @@ const CalendarDaysList = /*#__PURE__*/React.memo(({
|
|
|
24
24
|
px: "2px",
|
|
25
25
|
justifyContent: "space-between",
|
|
26
26
|
alignItems: "center"
|
|
27
|
-
},
|
|
27
|
+
}, "ds-calendar-week-".concat(week[0].day.toString(), "-").concat(week[6].day.toString()), week.map((metaDay, z) => /*#__PURE__*/_jsx(Day, {
|
|
28
28
|
metaDay: metaDay,
|
|
29
29
|
colIndex: z + 1
|
|
30
|
-
},
|
|
30
|
+
}, "ds-calendar-".concat(metaDay.day.toString()))))), /*#__PURE__*/_jsx(Day, {
|
|
31
31
|
metaDay: invisibleLastDay,
|
|
32
32
|
isInvisible: true
|
|
33
|
-
},
|
|
33
|
+
}, "ds-calendar-".concat(invisibleLastDay.day.toString()))]
|
|
34
34
|
}));
|
|
35
35
|
|
|
36
36
|
export { CalendarDaysList };
|
|
@@ -17,8 +17,8 @@ const useGetFormattedCurrentDate = () => {
|
|
|
17
17
|
currentMonth,
|
|
18
18
|
currentYear
|
|
19
19
|
} = useContext(CalendarContext);
|
|
20
|
-
const monthString = currentMonth >= 0 && currentMonth <= 11 ?
|
|
21
|
-
return useMemo(() =>
|
|
20
|
+
const monthString = currentMonth >= 0 && currentMonth <= 11 ? "".concat(getMonthNameByMonthNumber(currentMonth), " ") : '';
|
|
21
|
+
return useMemo(() => "".concat(monthString).concat(currentYear), [monthString, currentYear]);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const CalendarHead = () => {
|
|
@@ -18,7 +18,7 @@ const CalendarIconTrigger = () => {
|
|
|
18
18
|
ariaCurrentValueForInputs
|
|
19
19
|
} = useContext(CalendarContext);
|
|
20
20
|
return useMemo(() => /*#__PURE__*/_jsx(StyledIconTriggerButton, {
|
|
21
|
-
"aria-label":
|
|
21
|
+
"aria-label": "date picker context menu trigger, ".concat(ariaCurrentValueForInputs),
|
|
22
22
|
buttonType: "icon",
|
|
23
23
|
size: BUTTON_SIZES.M,
|
|
24
24
|
variant: BUTTON_VARIANT.DEFAULT,
|
|
@@ -79,9 +79,9 @@ const Day = ({
|
|
|
79
79
|
day: dayNumber,
|
|
80
80
|
year
|
|
81
81
|
} = getDateValuesFromDate(day);
|
|
82
|
-
onMonthChange(
|
|
83
|
-
onDayChange(
|
|
84
|
-
onYearChange(
|
|
82
|
+
onMonthChange("".concat(month + 1), e, metaInfo);
|
|
83
|
+
onDayChange("".concat(dayNumber), e, metaInfo);
|
|
84
|
+
onYearChange("".concat(year), e, metaInfo);
|
|
85
85
|
handleChangeComposedDateString(newDateString, metaInfo);
|
|
86
86
|
setLatestInteractionRegion('calendar-days');
|
|
87
87
|
if (!isWithTimeWheelToo && !preventCloseOnSelection) closeCalendar();
|
|
@@ -90,7 +90,7 @@ const Day = ({
|
|
|
90
90
|
const handleOnDayFocus = useCallback(() => {
|
|
91
91
|
setLatestInteractionRegion('calendar-days');
|
|
92
92
|
}, [setLatestInteractionRegion]);
|
|
93
|
-
const dayClassModifiers = useMemo(() =>
|
|
93
|
+
const dayClassModifiers = useMemo(() => "dayWrapper ".concat(isSelected ? 'selectedDay ' : '').concat(isDisabled ? 'disabledDay ' : '').concat(isOutOfRange ? 'outOfRangeDay ' : '').concat(isFocused ? 'focusedDay ' : '').concat(isStartRangeDay ? 'startRangeDay ' : '').concat(isDayInRange ? 'inRangeDay ' : '').concat(isEndRangeDay ? 'endRangeDay ' : '').concat(isCurrMonthDay ? '' : 'notCurrentMonth'), [isSelected, isDisabled, isOutOfRange, isFocused, isStartRangeDay, isDayInRange, isEndRangeDay, isCurrMonthDay]);
|
|
94
94
|
let dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.DAY;
|
|
95
95
|
if (isSelected) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.SELECTED_DAY;
|
|
96
96
|
if (isFocused) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.FOCUSED_DAY;
|
|
@@ -103,7 +103,7 @@ const Day = ({
|
|
|
103
103
|
'aria-colindex': colIndex
|
|
104
104
|
}), {}, {
|
|
105
105
|
children: /*#__PURE__*/_jsx(StyledDayBtn, {
|
|
106
|
-
"aria-label":
|
|
106
|
+
"aria-label": "".concat(getAriaDayFromDateString(dayAsString), ", ").concat(weekDays[metaDay.day.getDay()]),
|
|
107
107
|
"aria-disabled": isOutOfRange || isDisabled,
|
|
108
108
|
"aria-hidden": !!isInvisible,
|
|
109
109
|
buttonType: "raw",
|
|
@@ -118,7 +118,7 @@ const Day = ({
|
|
|
118
118
|
tabIndex: isSelected ? 0 : -1,
|
|
119
119
|
"data-isfocused": isFocused,
|
|
120
120
|
"data-testid": dataTestid
|
|
121
|
-
}, void 0,
|
|
121
|
+
}, void 0, "".concat(day.getDate()))
|
|
122
122
|
}));
|
|
123
123
|
};
|
|
124
124
|
|
|
@@ -3,11 +3,7 @@ import { Grid } from '@elliemae/ds-grid';
|
|
|
3
3
|
import { DSButtonV2 } from '@elliemae/ds-button';
|
|
4
4
|
|
|
5
5
|
/* eslint-disable max-lines */
|
|
6
|
-
const focusBorder =
|
|
7
|
-
border-style: solid;
|
|
8
|
-
border-width: 2px;
|
|
9
|
-
border-radius: 50%;
|
|
10
|
-
`;
|
|
6
|
+
const focusBorder = "\n border-style: solid;\n border-width: 2px;\n border-radius: 50%;\n";
|
|
11
7
|
const StyledIconTriggerButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
12
8
|
componentId: "sc-18gg4kd-0"
|
|
13
9
|
})(["color:", ";width:26px;height:26px;"], ({
|
|
@@ -68,7 +64,7 @@ const StyledWeekDaysListWrapper = /*#__PURE__*/styled(Grid).withConfig({
|
|
|
68
64
|
}) => theme.fontSizes.label[400], ({
|
|
69
65
|
isHeader,
|
|
70
66
|
theme
|
|
71
|
-
}) => isHeader ?
|
|
67
|
+
}) => isHeader ? "background: ".concat(theme.colors.neutral['050']) : '', ({
|
|
72
68
|
isHeader
|
|
73
69
|
}) => isHeader ? 'text-transform: capitalize' : '', ({
|
|
74
70
|
theme
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useContext, useState, useMemo, useCallback } from 'react';
|
|
2
3
|
import { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';
|
|
3
4
|
import { useKeyboardHandlers } from './useKeyboardHandlers.js';
|
|
@@ -5,8 +6,6 @@ import { useFocusLogic } from './useFocusLogic.js';
|
|
|
5
6
|
import { usePopperTriggerLogic } from './usePopperTriggerLogic.js';
|
|
6
7
|
import { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';
|
|
7
8
|
|
|
8
|
-
/* eslint-disable complexity */
|
|
9
|
-
|
|
10
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
10
|
function sliceIntoChunks(arr, chunkSize) {
|
|
12
11
|
const res = [];
|
package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useEffect, useState, useMemo, createRef, useCallback } from 'react';
|
|
2
3
|
import { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';
|
|
3
4
|
import { getFiveBySevenCurrentMonthDaysMatrix, sumValuesToDate, getDateStringFromDay, sumFromDateValues } from '../../../utils/dateHelpers.js';
|
|
4
5
|
|
|
5
|
-
/* eslint-disable complexity */
|
|
6
6
|
const useCurrentDisplayedMonthYearLogic = () => {
|
|
7
7
|
const {
|
|
8
8
|
month: monthFromDateString,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useState, useMemo, useCallback, useLayoutEffect } from 'react';
|
|
2
3
|
import { compareTwoDatesDayEquality } from '../../../utils/dateHelpers.js';
|
|
3
4
|
import { useGetStartingFocusedDay } from '../../../utils/hooks/useGetStartingFocusedDay.js';
|
|
4
5
|
|
|
5
|
-
/* eslint-disable complexity */
|
|
6
|
-
|
|
7
6
|
// eslint-disable-next-line max-params
|
|
8
7
|
const loopWhileWaiting = (cb, shortcircuit = () => false, timePerTry = 100, maxTries = 5) => {
|
|
9
8
|
let ab = maxTries;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useState, useCallback, useMemo } from 'react';
|
|
2
3
|
import { usePopper } from 'react-popper';
|
|
3
4
|
import { useOnClickOutside } from '../../../utils/hooks/useOnClickOutside.js';
|
|
4
5
|
|
|
5
|
-
/* eslint-disable complexity */
|
|
6
6
|
const usePopperTriggerLogic = ({
|
|
7
7
|
focusedDay,
|
|
8
8
|
resetFocusedDayToStartDate,
|
|
@@ -18,7 +18,7 @@ const CalendarWithTimeWheelIconTrigger = () => {
|
|
|
18
18
|
ariaCurrentValueForInputs
|
|
19
19
|
} = useContext(CalendarWithTimeWheelContext);
|
|
20
20
|
return useMemo(() => /*#__PURE__*/_jsx(StyledIconTriggerButton, {
|
|
21
|
-
"aria-label":
|
|
21
|
+
"aria-label": "date time picker context menu trigger, ".concat(ariaCurrentValueForInputs),
|
|
22
22
|
buttonType: "icon",
|
|
23
23
|
size: BUTTON_SIZES.M,
|
|
24
24
|
variant: BUTTON_VARIANT.DEFAULT,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
2
|
import { useContext, useState, useCallback, useMemo } from 'react';
|
|
2
3
|
import { usePopper } from 'react-popper';
|
|
3
4
|
import { CONTROLLED_DATE_TIME_PICKER_TYPES } from '../../../ControlledDateTimePickerTypes.js';
|
|
@@ -6,7 +7,6 @@ import { useOnClickOutside } from '../../../utils/hooks/useOnClickOutside.js';
|
|
|
6
7
|
import { CalendarContext } from '../Calendar/CalendarContext.js';
|
|
7
8
|
import { TimeWheelContext } from '../TimeWheel/TimeWheelContext.js';
|
|
8
9
|
|
|
9
|
-
/* eslint-disable max-statements */
|
|
10
10
|
const useConfigCalendarWithTimeWheelCTX = () => {
|
|
11
11
|
const {
|
|
12
12
|
pickerButtonRef,
|
|
@@ -42,9 +42,9 @@ const HoursList = () => {
|
|
|
42
42
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_HOUR,
|
|
43
43
|
tabIndex: -1
|
|
44
44
|
}, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})))), visibleHours.map(hourString => {
|
|
45
|
-
const key =
|
|
45
|
+
const key = "timewheel-hour-".concat(hourString);
|
|
46
46
|
if (!hourString) return /*#__PURE__*/_jsx(StyledWheelListItem, {}, key);
|
|
47
|
-
const currHourTimeString =
|
|
47
|
+
const currHourTimeString = "".concat(hourString, ":").concat(minutes || '00', " ").concat(meridiem || 'AM');
|
|
48
48
|
const isEmptyCurrValueCurrentListItem = !hours && convertToPositiveNumberIfPossible(hourString) === currHourNum;
|
|
49
49
|
const isCurrentListItem = isEmptyCurrValueCurrentListItem || hours === hourString;
|
|
50
50
|
const isDisabled = getIsDisabledTime(currHourTimeString);
|
|
@@ -60,7 +60,7 @@ const HoursList = () => {
|
|
|
60
60
|
autoFocus: autoFocusHourTimeWheel && isCurrentListItem,
|
|
61
61
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL[isCurrentListItem ? 'CURRENT_HOUR' : 'HOUR'],
|
|
62
62
|
selected: hours.length === 2 && convertToPositiveNumberIfPossible(hourString) === currHourNum,
|
|
63
|
-
"aria-label":
|
|
63
|
+
"aria-label": "".concat(hourString, " hours"),
|
|
64
64
|
"aria-disabled": isDisabled,
|
|
65
65
|
isDisabled: isDisabled,
|
|
66
66
|
buttonType: "raw",
|
|
@@ -71,7 +71,7 @@ const HoursList = () => {
|
|
|
71
71
|
"aria-valuemax": "12",
|
|
72
72
|
"aria-valuemin": "1",
|
|
73
73
|
"aria-valuenow": currHourNum,
|
|
74
|
-
"aria-valuetext":
|
|
74
|
+
"aria-valuetext": "".concat(hourString, " hours")
|
|
75
75
|
}, btnProps), {}, {
|
|
76
76
|
children: hourString
|
|
77
77
|
})));
|
|
@@ -22,9 +22,9 @@ const MeridiemList = () => {
|
|
|
22
22
|
} = useContext(TimeWheelContext);
|
|
23
23
|
const isAmCurrent = !meridiem || meridiem === 'AM';
|
|
24
24
|
const isPmCurrent = meridiem === 'PM';
|
|
25
|
-
const hourMinuteString =
|
|
26
|
-
const amTimeString =
|
|
27
|
-
const pmTimeString =
|
|
25
|
+
const hourMinuteString = "".concat(hours || '01', ":").concat(minutes || '00');
|
|
26
|
+
const amTimeString = "".concat(hourMinuteString, " AM");
|
|
27
|
+
const pmTimeString = "".concat(hourMinuteString, " PM");
|
|
28
28
|
const isDisabledAm = getIsDisabledTime(amTimeString);
|
|
29
29
|
const isDisabledPm = getIsDisabledTime(pmTimeString);
|
|
30
30
|
return /*#__PURE__*/_jsx(StyledWheelList, {}, void 0, /*#__PURE__*/_jsx(StyledWheelListItem, {}, void 0, /*#__PURE__*/_jsx(StyledWheelChangeTimeBtn, {
|
|
@@ -44,7 +44,7 @@ const MeridiemList = () => {
|
|
|
44
44
|
isCurrentListItem: isAmCurrent,
|
|
45
45
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL[isAmCurrent ? 'CURRENT_MERIDIEM' : 'MERIDIEM'],
|
|
46
46
|
selected: meridiem === 'AM',
|
|
47
|
-
"aria-label":
|
|
47
|
+
"aria-label": "AM ".concat(isAmCurrent ? 'selected' : ''),
|
|
48
48
|
"aria-disabled": isDisabledAm,
|
|
49
49
|
isDisabled: isDisabledAm,
|
|
50
50
|
buttonType: "raw",
|
|
@@ -63,7 +63,7 @@ const MeridiemList = () => {
|
|
|
63
63
|
}, void 0, /*#__PURE__*/_jsx(StyledTimeBtn, {
|
|
64
64
|
isCurrentListItem: isPmCurrent,
|
|
65
65
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL[isPmCurrent ? 'CURRENT_MERIDIEM' : 'MERIDIEM'],
|
|
66
|
-
"aria-label":
|
|
66
|
+
"aria-label": "PM ".concat(isPmCurrent ? 'selected' : ''),
|
|
67
67
|
"aria-disabled": isDisabledPm,
|
|
68
68
|
isDisabled: isDisabledPm,
|
|
69
69
|
buttonType: "raw",
|
|
@@ -41,9 +41,9 @@ const MinutesList = () => {
|
|
|
41
41
|
tabIndex: -1,
|
|
42
42
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_MINUTE
|
|
43
43
|
}, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})))), visibleMinutes.map(minutesString => {
|
|
44
|
-
const key =
|
|
44
|
+
const key = "timewheel-minutes-".concat(minutesString);
|
|
45
45
|
if (!minutesString) return /*#__PURE__*/_jsx(StyledWheelListItem, {}, key);
|
|
46
|
-
const currMinutesTimeString =
|
|
46
|
+
const currMinutesTimeString = "".concat(hours || '01', ":").concat(minutesString, " ").concat(meridiem || 'AM');
|
|
47
47
|
const isEmptyCurrValueCurrentListItem = !minutes && convertToPositiveNumberIfPossible(minutesString) === currMinuteNum;
|
|
48
48
|
const isCurrentListItem = isEmptyCurrValueCurrentListItem || minutes === minutesString;
|
|
49
49
|
const isDisabled = getIsDisabledTime(currMinutesTimeString);
|
|
@@ -59,7 +59,7 @@ const MinutesList = () => {
|
|
|
59
59
|
isCurrentListItem: isCurrentListItem,
|
|
60
60
|
"data-testid": ControlledDateTimePickerDatatestid.TIMEWHEEL[isCurrentListItem ? 'CURRENT_MINUTE' : 'MINUTE'],
|
|
61
61
|
selected: minutes.length === 2 && convertToPositiveNumberIfPossible(minutesString) === currMinuteNum,
|
|
62
|
-
"aria-label":
|
|
62
|
+
"aria-label": "".concat(minutesString, " minutes"),
|
|
63
63
|
"aria-disabled": isDisabled,
|
|
64
64
|
isDisabled: isDisabled,
|
|
65
65
|
buttonType: "raw",
|
|
@@ -70,7 +70,7 @@ const MinutesList = () => {
|
|
|
70
70
|
"aria-valuemax": "59",
|
|
71
71
|
"aria-valuemin": "0",
|
|
72
72
|
"aria-valuenow": currMinuteNum,
|
|
73
|
-
"aria-valuetext":
|
|
73
|
+
"aria-valuetext": "".concat(minutesString, " minutes")
|
|
74
74
|
}, btnProps), {}, {
|
|
75
75
|
children: minutesString
|
|
76
76
|
})));
|
|
@@ -39,7 +39,7 @@ const SecondsList = () => {
|
|
|
39
39
|
innerRef: prevSecondsBtnRef,
|
|
40
40
|
tabIndex: -1
|
|
41
41
|
}, void 0, _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx(ChevronSmallUp, {})))), visibleSeconds.map(secondsString => {
|
|
42
|
-
const key =
|
|
42
|
+
const key = "timewheel-seconds-".concat(secondsString);
|
|
43
43
|
if (!secondsString) return /*#__PURE__*/_jsx(StyledWheelListItem, {}, key);
|
|
44
44
|
const isEmptyCurrValueCurrentListItem = !seconds && convertToPositiveNumberIfPossible(secondsString) === currSecondNum;
|
|
45
45
|
const isCurrentListItem = isEmptyCurrValueCurrentListItem || seconds === secondsString;
|
|
@@ -51,7 +51,7 @@ const SecondsList = () => {
|
|
|
51
51
|
return /*#__PURE__*/_jsx(StyledWheelListItem, {
|
|
52
52
|
isCurrentListItem: isCurrentListItem
|
|
53
53
|
}, key, /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({
|
|
54
|
-
"aria-label":
|
|
54
|
+
"aria-label": "set ".concat(secondsString, " seconds"),
|
|
55
55
|
buttonType: "raw",
|
|
56
56
|
size: "l",
|
|
57
57
|
variant: BUTTON_VARIANT.DEFAULT,
|
|
@@ -20,9 +20,7 @@ const StyledTimePickerContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
20
20
|
})(["display:grid;position:relative;grid-template-columns:192px;grid-template-rows:36px 30px auto;grid-template-areas:'TimePickerHead' 'TimePickerWheelsLegend' 'VerticalWheelWrapper';", ""], ({
|
|
21
21
|
showShadow,
|
|
22
22
|
isControllerOnly
|
|
23
|
-
}) => showShadow && !isControllerOnly ?
|
|
24
|
-
box-shadow: 0 6px 20px 0 rgb(0 0 0 / 24%), 0 8px 17px 0 rgb(0 0 0 / 19%);
|
|
25
|
-
` : '');
|
|
23
|
+
}) => showShadow && !isControllerOnly ? "\n box-shadow: 0 6px 20px 0 rgb(0 0 0 / 24%), 0 8px 17px 0 rgb(0 0 0 / 19%);\n " : '');
|
|
26
24
|
const StyledTimePickerHead = /*#__PURE__*/styled(Grid).withConfig({
|
|
27
25
|
componentId: "sc-1nsw31l-3"
|
|
28
26
|
})(["width:100%;grid-area:TimePickerHead;justify-content:center;align-items:center;background:", ";"], ({
|
|
@@ -68,69 +66,12 @@ const StyledTimeBtn = /*#__PURE__*/styled(DSButtonV2).withConfig({
|
|
|
68
66
|
theme,
|
|
69
67
|
isDisabled,
|
|
70
68
|
selected
|
|
71
|
-
}) => isDisabled ?
|
|
72
|
-
color: ${selected ? theme.colors.neutral['000'] : theme.colors.neutral[500]};
|
|
73
|
-
cursor: not-allowed;
|
|
74
|
-
background-color:${selected ? theme.colors.danger[900] : theme.colors.neutral['000']};
|
|
75
|
-
font-weight: ${selected ? theme.fontWeights.semibold : ''};
|
|
76
|
-
|
|
77
|
-
&:before {
|
|
78
|
-
cursor: not-allowed;
|
|
79
|
-
position: absolute;
|
|
80
|
-
content: '';
|
|
81
|
-
top: 47%;
|
|
82
|
-
left: 0;
|
|
83
|
-
width: 100%;
|
|
84
|
-
height: 1px;
|
|
85
|
-
background-color: ${selected ? theme.colors.neutral['000'] : theme.colors.neutral[500]};
|
|
86
|
-
transform: rotate(45deg);
|
|
87
|
-
pointer-events: none;
|
|
88
|
-
}
|
|
89
|
-
&:hover {
|
|
90
|
-
color:${selected ? theme.colors.neutral['000'] : theme.colors.neutral[500]};
|
|
91
|
-
background-color:${selected ? theme.colors.danger[900] : theme.colors.neutral['000']};
|
|
92
|
-
}
|
|
93
|
-
` : `
|
|
94
|
-
${selected ? `
|
|
95
|
-
color: ${theme.colors.neutral['000']};
|
|
96
|
-
background-color:${theme.colors.brand[700]};
|
|
97
|
-
font-weight: ${theme.fontWeights.semibold};
|
|
98
|
-
&:hover {
|
|
99
|
-
color:${theme.colors.neutral['000']};
|
|
100
|
-
background-color:${theme.colors.brand[700]};
|
|
101
|
-
}
|
|
102
|
-
` : `
|
|
103
|
-
color: ${theme.colors.neutral[800]};
|
|
104
|
-
background-color:${theme.colors.neutral['000']};
|
|
105
|
-
`}
|
|
106
|
-
`, ({
|
|
69
|
+
}) => isDisabled ? "\n color: ".concat(selected ? theme.colors.neutral['000'] : theme.colors.neutral[500], ";\n cursor: not-allowed;\n background-color:").concat(selected ? theme.colors.danger[900] : theme.colors.neutral['000'], ";\n font-weight: ").concat(selected ? theme.fontWeights.semibold : '', ";\n\n &:before {\n cursor: not-allowed;\n position: absolute;\n content: '';\n top: 47%;\n left: 0;\n width: 100%;\n height: 1px;\n background-color: ").concat(selected ? theme.colors.neutral['000'] : theme.colors.neutral[500], ";\n transform: rotate(45deg);\n pointer-events: none;\n }\n &:hover {\n color:").concat(selected ? theme.colors.neutral['000'] : theme.colors.neutral[500], ";\n background-color:").concat(selected ? theme.colors.danger[900] : theme.colors.neutral['000'], ";\n }\n ") : "\n ".concat(selected ? "\n color: ".concat(theme.colors.neutral['000'], ";\n background-color:").concat(theme.colors.brand[700], ";\n font-weight: ").concat(theme.fontWeights.semibold, ";\n &:hover {\n color:").concat(theme.colors.neutral['000'], ";\n background-color:").concat(theme.colors.brand[700], ";\n }\n ") : "\n color: ".concat(theme.colors.neutral[800], ";\n background-color:").concat(theme.colors.neutral['000'], ";\n "), "\n "), ({
|
|
107
70
|
theme,
|
|
108
71
|
isCurrentListItem,
|
|
109
72
|
selected,
|
|
110
73
|
isDisabled
|
|
111
|
-
}) => isCurrentListItem && !selected ?
|
|
112
|
-
color: ${isDisabled ? theme.colors.danger[900] : theme.colors.brand[700]};
|
|
113
|
-
&:after {
|
|
114
|
-
position: absolute;
|
|
115
|
-
content: '';
|
|
116
|
-
border-radius: 50%;
|
|
117
|
-
top: -2px;
|
|
118
|
-
left: -2px;
|
|
119
|
-
width: calc(100% + 4px);
|
|
120
|
-
height: calc(100% + 4px);
|
|
121
|
-
border: 2px solid ${isDisabled ? theme.colors.danger[900] : theme.colors.brand[700]};
|
|
122
|
-
pointer-events: none;
|
|
123
|
-
}
|
|
124
|
-
${isDisabled ? `
|
|
125
|
-
color: ${theme.colors.danger[900]};
|
|
126
|
-
&:hover {
|
|
127
|
-
color:${theme.colors.danger[900]};
|
|
128
|
-
}
|
|
129
|
-
&:before{
|
|
130
|
-
background-color: ${theme.colors.danger[900]};
|
|
131
|
-
}
|
|
132
|
-
` : ''}
|
|
133
|
-
` : '');
|
|
74
|
+
}) => isCurrentListItem && !selected ? "\n color: ".concat(isDisabled ? theme.colors.danger[900] : theme.colors.brand[700], ";\n &:after {\n position: absolute;\n content: '';\n border-radius: 50%;\n top: -2px;\n left: -2px;\n width: calc(100% + 4px);\n height: calc(100% + 4px);\n border: 2px solid ").concat(isDisabled ? theme.colors.danger[900] : theme.colors.brand[700], ";\n pointer-events: none;\n }\n ").concat(isDisabled ? "\n color: ".concat(theme.colors.danger[900], ";\n &:hover {\n color:").concat(theme.colors.danger[900], ";\n } \n &:before{\n background-color: ").concat(theme.colors.danger[900], ";\n }\n ") : '', "\n ") : '');
|
|
134
75
|
const StyledWheelListItem = /*#__PURE__*/styled.div.withConfig({
|
|
135
76
|
componentId: "sc-1nsw31l-7"
|
|
136
77
|
})(["margin:auto;width:36px;height:36px;display:flex;align-items:center;justify-content:center;position:relative;"]);
|
|
@@ -22,7 +22,7 @@ const TimeWheelContent = /*#__PURE__*/React.memo(({
|
|
|
22
22
|
showShadow: showShadow,
|
|
23
23
|
isControllerOnly: isControllerOnly,
|
|
24
24
|
"data-testid": ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.TIMEWHEEL
|
|
25
|
-
}, void 0, /*#__PURE__*/_jsx(StyledTimePickerHead, {}, void 0,
|
|
25
|
+
}, void 0, /*#__PURE__*/_jsx(StyledTimePickerHead, {}, void 0, "".concat(hours || '__', ":").concat(minutes || '__', " ").concat(meridiem || '__')), _StyledTimePickerWhee || (_StyledTimePickerWhee = /*#__PURE__*/_jsx(StyledTimePickerWheelsLegend, {}, void 0, /*#__PURE__*/_jsx("div", {}, void 0, "H"), /*#__PURE__*/_jsx("div", {}, void 0, "M"), /*#__PURE__*/_jsx("div", {}, void 0, "A"))), _StyledTimePickerWhee2 || (_StyledTimePickerWhee2 = /*#__PURE__*/_jsx(StyledTimePickerWheelWrapper, {}, void 0, /*#__PURE__*/_jsx(HoursList, {}), /*#__PURE__*/_jsx(MinutesList, {}), /*#__PURE__*/_jsx(MeridiemList, {}))), _TimeWheelFooter || (_TimeWheelFooter = /*#__PURE__*/_jsx(TimeWheelFooter, {})));
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
export { TimeWheelContent };
|
|
@@ -17,7 +17,7 @@ const TimeWheelIconTrigger = () => {
|
|
|
17
17
|
ariaCurrentValueForInputs
|
|
18
18
|
} = useContext(TimeWheelContext);
|
|
19
19
|
return useMemo(() => /*#__PURE__*/_jsx(DSButtonV2, {
|
|
20
|
-
"aria-label":
|
|
20
|
+
"aria-label": "time picker context menu trigger, ".concat(ariaCurrentValueForInputs),
|
|
21
21
|
buttonType: "icon",
|
|
22
22
|
size: BUTTON_SIZES.M,
|
|
23
23
|
innerRef: handleSetTriggerRef,
|
package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js
CHANGED
|
@@ -11,7 +11,7 @@ const hoursStartPositionOffset = 1; // if array start from 01, this is 1, if sta
|
|
|
11
11
|
|
|
12
12
|
const getTotalMinuteListWithStep = (step = 1) => {
|
|
13
13
|
const length = Math.ceil(60 / step);
|
|
14
|
-
return new Array(length).fill('_').map((_v, i) => prependStringWithPlaceHolders(
|
|
14
|
+
return new Array(length).fill('_').map((_v, i) => prependStringWithPlaceHolders("".concat(i * step), 2));
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const useCurrentDisplayedWheelsLogic = ({
|
|
@@ -90,7 +90,7 @@ const useCurrentDisplayedWheelsLogic = ({
|
|
|
90
90
|
}, [handleChangeHours]);
|
|
91
91
|
const handleChangeCurrHour = useCallback((offset, e) => {
|
|
92
92
|
const newH = currHourNum + offset;
|
|
93
|
-
if (newH > 0 && newH <= 12) handleChangeHours(prependStringWithPlaceHolders(
|
|
93
|
+
if (newH > 0 && newH <= 12) handleChangeHours(prependStringWithPlaceHolders("".concat(newH), 2), e);
|
|
94
94
|
}, [currHourNum, handleChangeHours]);
|
|
95
95
|
const handlePrevHour = useCallback(e => {
|
|
96
96
|
handleChangeCurrHour(-1, e);
|
|
@@ -103,7 +103,7 @@ const useCurrentDisplayedWheelsLogic = ({
|
|
|
103
103
|
}, [handleChangeMinutes]);
|
|
104
104
|
const handleChangeCurrMinute = useCallback((offset, e) => {
|
|
105
105
|
const newM = currMinuteNum + offset;
|
|
106
|
-
if (newM >= 0 && newM <= 59) handleChangeMinutes(prependStringWithPlaceHolders(
|
|
106
|
+
if (newM >= 0 && newM <= 59) handleChangeMinutes(prependStringWithPlaceHolders("".concat(newM), 2), e);
|
|
107
107
|
}, [currMinuteNum, handleChangeMinutes]);
|
|
108
108
|
const handlePrevMinute = useCallback(e => {
|
|
109
109
|
handleChangeCurrMinute(-minutesInterval, e);
|