baseui 10.12.1 → 11.0.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/README.md +3 -3
- package/accordion/accordion.js +60 -13
- package/accordion/accordion.js.flow +49 -12
- package/accordion/index.d.ts +0 -3
- package/accordion/panel.js +7 -6
- package/accordion/panel.js.flow +20 -20
- package/accordion/stateless-accordion.js +2 -4
- package/accordion/stateless-accordion.js.flow +0 -2
- package/accordion/types.js.flow +0 -5
- package/button/constants.js +1 -2
- package/button/constants.js.flow +0 -1
- package/button/index.d.ts +0 -1
- package/button/styled-components.js +2 -29
- package/button/styled-components.js.flow +2 -30
- package/checkbox/checkbox.js +6 -30
- package/checkbox/checkbox.js.flow +7 -38
- package/checkbox/constants.js +2 -1
- package/checkbox/constants.js.flow +2 -1
- package/checkbox/index.d.ts +4 -6
- package/checkbox/index.js +0 -6
- package/checkbox/index.js.flow +0 -1
- package/checkbox/styled-components.js +52 -149
- package/checkbox/styled-components.js.flow +59 -165
- package/checkbox/types.js.flow +0 -5
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +1 -1
- package/data-table/column-datetime.js +1 -1
- package/data-table/column-datetime.js.flow +3 -1
- package/data-table/column.js +6 -2
- package/data-table/column.js.flow +9 -7
- package/data-table/data-table.js +10 -2
- package/data-table/data-table.js.flow +4 -1
- package/data-table/header-cell.js +3 -0
- package/data-table/header-cell.js.flow +1 -1
- package/data-table/index.d.ts +7 -8
- package/data-table/stateful-data-table.js +2 -1
- package/data-table/stateful-data-table.js.flow +1 -0
- package/data-table/types.js.flow +8 -0
- package/datepicker/calendar.js +28 -15
- package/datepicker/calendar.js.flow +31 -14
- package/datepicker/constants.js +12 -2
- package/datepicker/constants.js.flow +10 -0
- package/datepicker/datepicker.js +117 -86
- package/datepicker/datepicker.js.flow +123 -66
- package/datepicker/day.js +85 -34
- package/datepicker/day.js.flow +118 -54
- package/datepicker/locale.js.flow +0 -1
- package/datepicker/month.js +3 -1
- package/datepicker/month.js.flow +2 -0
- package/datepicker/stateful-calendar.js +6 -1
- package/datepicker/stateful-calendar.js.flow +8 -1
- package/datepicker/stateful-container.js +23 -2
- package/datepicker/stateful-container.js.flow +17 -3
- package/datepicker/stateful-datepicker.js +6 -1
- package/datepicker/stateful-datepicker.js.flow +7 -1
- package/datepicker/styled-components.js +23 -1
- package/datepicker/styled-components.js.flow +12 -2
- package/datepicker/types.js.flow +46 -43
- package/datepicker/utils/date-helpers.js +30 -0
- package/datepicker/utils/date-helpers.js.flow +12 -0
- package/datepicker/week.js +3 -1
- package/datepicker/week.js.flow +2 -0
- package/es/accordion/accordion.js +52 -12
- package/es/accordion/panel.js +7 -5
- package/es/accordion/stateless-accordion.js +2 -4
- package/es/button/constants.js +1 -2
- package/es/button/styled-components.js +2 -29
- package/es/checkbox/checkbox.js +7 -32
- package/es/checkbox/constants.js +2 -1
- package/es/checkbox/index.js +1 -1
- package/es/checkbox/styled-components.js +51 -146
- package/es/data-table/column-categorical.js +1 -1
- package/es/data-table/column-datetime.js +1 -1
- package/es/data-table/column.js +6 -2
- package/es/data-table/data-table.js +6 -2
- package/es/data-table/header-cell.js +3 -0
- package/es/data-table/stateful-data-table.js +2 -1
- package/es/datepicker/calendar.js +28 -15
- package/es/datepicker/constants.js +8 -0
- package/es/datepicker/datepicker.js +106 -79
- package/es/datepicker/day.js +77 -34
- package/es/datepicker/month.js +3 -1
- package/es/datepicker/stateful-calendar.js +6 -1
- package/es/datepicker/stateful-container.js +22 -2
- package/es/datepicker/stateful-datepicker.js +6 -1
- package/es/datepicker/styled-components.js +8 -2
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/date-helpers.js +16 -0
- package/es/datepicker/week.js +3 -1
- package/es/file-uploader/file-uploader.js +4 -4
- package/es/form-control/styled-components.js +0 -1
- package/es/header-navigation/styled-components.js +3 -3
- package/es/helpers/overrides.js +1 -2
- package/es/input/styled-components.js +4 -4
- package/es/layer/layer.js +4 -4
- package/es/list/list-item.js +5 -1
- package/es/list/menu-adapter.js +4 -0
- package/es/locale/index.js +0 -7
- package/es/menu/stateful-container.js +0 -1
- package/es/menu/styled-components.js +1 -1
- package/es/modal/index.js +1 -1
- package/es/modal/modal.js +19 -65
- package/es/modal/styled-components.js +12 -48
- package/es/phone-input/default-props.js +1 -1
- package/es/phone-input/index.js +0 -4
- package/es/phone-input/phone-input-lite.js +55 -31
- package/es/radio/radio.js +1 -7
- package/es/radio/radiogroup.js +3 -28
- package/es/radio/styled-components.js +4 -5
- package/es/rating/styled-components.js +3 -3
- package/es/select/index.js +1 -2
- package/es/select/select-component.js +20 -20
- package/es/select/styled-components.js +21 -17
- package/es/snackbar/snackbar-context.js +1 -1
- package/es/snackbar/styled-components.js +2 -2
- package/es/spinner/index.js +3 -9
- package/es/spinner/styled-components.js +2 -32
- package/es/table/filter.js +3 -3
- package/es/tag/styled-components.js +1 -1
- package/es/themes/dark-theme/color-component-tokens.js +0 -38
- package/es/themes/dark-theme/color-tokens.js +0 -2
- package/es/themes/dark-theme/create-dark-theme.js +0 -2
- package/es/themes/dark-theme/dark-theme.js +0 -2
- package/es/themes/light-theme/color-component-tokens.js +0 -38
- package/es/themes/light-theme/color-tokens.js +0 -2
- package/es/themes/light-theme/create-light-theme.js +0 -2
- package/es/themes/light-theme/light-theme.js +0 -2
- package/es/timepicker/timepicker.js +1 -8
- package/es/typography/index.js +1 -31
- package/esm/accordion/accordion.js +60 -13
- package/esm/accordion/panel.js +7 -6
- package/esm/accordion/stateless-accordion.js +2 -4
- package/esm/button/constants.js +1 -2
- package/esm/button/styled-components.js +2 -29
- package/esm/checkbox/checkbox.js +7 -30
- package/esm/checkbox/constants.js +2 -1
- package/esm/checkbox/index.js +1 -1
- package/esm/checkbox/styled-components.js +52 -147
- package/esm/data-table/column-categorical.js +1 -1
- package/esm/data-table/column-datetime.js +1 -1
- package/esm/data-table/column.js +6 -2
- package/esm/data-table/data-table.js +10 -2
- package/esm/data-table/header-cell.js +3 -0
- package/esm/data-table/stateful-data-table.js +2 -1
- package/esm/datepicker/calendar.js +28 -15
- package/esm/datepicker/constants.js +8 -0
- package/esm/datepicker/datepicker.js +116 -86
- package/esm/datepicker/day.js +84 -34
- package/esm/datepicker/month.js +3 -1
- package/esm/datepicker/stateful-calendar.js +6 -1
- package/esm/datepicker/stateful-container.js +23 -2
- package/esm/datepicker/stateful-datepicker.js +6 -1
- package/esm/datepicker/styled-components.js +24 -2
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/date-helpers.js +30 -0
- package/esm/datepicker/week.js +3 -1
- package/esm/file-uploader/file-uploader.js +4 -4
- package/esm/form-control/styled-components.js +0 -1
- package/esm/header-navigation/styled-components.js +3 -3
- package/esm/helpers/overrides.js +1 -2
- package/esm/input/styled-components.js +4 -4
- package/esm/layer/layer.js +4 -4
- package/esm/list/list-item.js +5 -1
- package/esm/list/menu-adapter.js +4 -0
- package/esm/locale/index.js +0 -7
- package/esm/menu/stateful-container.js +0 -1
- package/esm/menu/styled-components.js +1 -1
- package/esm/modal/index.js +1 -1
- package/esm/modal/modal.js +28 -71
- package/esm/modal/styled-components.js +6 -38
- package/esm/phone-input/default-props.js +1 -1
- package/esm/phone-input/index.js +0 -4
- package/esm/phone-input/phone-input-lite.js +60 -37
- package/esm/radio/radio.js +1 -7
- package/esm/radio/radiogroup.js +3 -28
- package/esm/radio/styled-components.js +4 -5
- package/esm/rating/styled-components.js +3 -3
- package/esm/select/index.js +1 -2
- package/esm/select/select-component.js +20 -20
- package/esm/select/styled-components.js +21 -14
- package/esm/snackbar/snackbar-context.js +1 -1
- package/esm/snackbar/styled-components.js +2 -2
- package/esm/spinner/index.js +3 -9
- package/esm/spinner/styled-components.js +2 -40
- package/esm/table/filter.js +3 -3
- package/esm/tag/styled-components.js +1 -1
- package/esm/themes/dark-theme/color-component-tokens.js +0 -38
- package/esm/themes/dark-theme/color-tokens.js +0 -2
- package/esm/themes/dark-theme/create-dark-theme.js +1 -2
- package/esm/themes/dark-theme/dark-theme.js +1 -2
- package/esm/themes/light-theme/color-component-tokens.js +0 -38
- package/esm/themes/light-theme/color-tokens.js +0 -2
- package/esm/themes/light-theme/create-light-theme.js +1 -2
- package/esm/themes/light-theme/light-theme.js +1 -2
- package/esm/timepicker/timepicker.js +1 -8
- package/esm/typography/index.js +1 -35
- package/file-uploader/file-uploader.js +3 -3
- package/file-uploader/file-uploader.js.flow +4 -4
- package/form-control/index.d.ts +9 -0
- package/form-control/styled-components.js +0 -1
- package/form-control/styled-components.js.flow +0 -1
- package/header-navigation/styled-components.js +3 -3
- package/header-navigation/styled-components.js.flow +3 -3
- package/helpers/overrides.js +1 -2
- package/helpers/overrides.js.flow +1 -1
- package/input/index.d.ts +5 -9
- package/input/styled-components.js +4 -4
- package/input/styled-components.js.flow +4 -4
- package/layer/layer.js +4 -4
- package/layer/layer.js.flow +4 -3
- package/list/list-item.js +5 -1
- package/list/list-item.js.flow +4 -0
- package/list/menu-adapter.js +4 -0
- package/list/menu-adapter.js.flow +4 -0
- package/list/types.js.flow +4 -0
- package/locale/index.js +0 -7
- package/locale/index.js.flow +0 -7
- package/locale.ts +0 -1
- package/menu/index.d.ts +1 -3
- package/menu/stateful-container.js +0 -1
- package/menu/stateful-container.js.flow +0 -1
- package/menu/styled-components.js +1 -1
- package/menu/styled-components.js.flow +1 -1
- package/modal/index.d.ts +4 -6
- package/modal/index.js +0 -6
- package/modal/index.js.flow +0 -1
- package/modal/modal.js +27 -70
- package/modal/modal.js.flow +17 -83
- package/modal/styled-components.js +7 -40
- package/modal/styled-components.js.flow +12 -44
- package/modal/types.js.flow +1 -10
- package/package.json +3 -2
- package/phone-input/default-props.js +1 -1
- package/phone-input/default-props.js.flow +1 -1
- package/phone-input/index.d.ts +0 -1
- package/phone-input/index.js +0 -36
- package/phone-input/index.js.flow +0 -4
- package/phone-input/phone-input-lite.js +63 -38
- package/phone-input/phone-input-lite.js.flow +66 -44
- package/radio/index.d.ts +4 -9
- package/radio/radio.js +1 -7
- package/radio/radio.js.flow +1 -8
- package/radio/radiogroup.js +3 -28
- package/radio/radiogroup.js.flow +2 -26
- package/radio/styled-components.js +4 -5
- package/radio/styled-components.js.flow +3 -4
- package/radio/types.js.flow +4 -15
- package/rating/styled-components.js +3 -3
- package/rating/styled-components.js.flow +3 -3
- package/select/index.d.ts +0 -2
- package/select/index.js +0 -6
- package/select/index.js.flow +0 -2
- package/select/select-component.js +23 -24
- package/select/select-component.js.flow +25 -14
- package/select/styled-components.js +23 -17
- package/select/styled-components.js.flow +17 -12
- package/snackbar/snackbar-context.js +1 -1
- package/snackbar/snackbar-context.js.flow +1 -1
- package/snackbar/styled-components.js +1 -1
- package/snackbar/styled-components.js.flow +11 -11
- package/spinner/index.d.ts +5 -18
- package/spinner/index.js +2 -68
- package/spinner/index.js.flow +2 -27
- package/spinner/styled-components.js +9 -45
- package/spinner/styled-components.js.flow +2 -34
- package/spinner/types.js.flow +1 -19
- package/styles/types.js.flow +0 -2
- package/table/filter.js +3 -3
- package/table/filter.js.flow +3 -3
- package/tag/styled-components.js +1 -1
- package/tag/styled-components.js.flow +1 -1
- package/tag/types.js.flow +1 -1
- package/theme.ts +0 -81
- package/themes/dark-theme/color-component-tokens.js +0 -38
- package/themes/dark-theme/color-component-tokens.js.flow +0 -42
- package/themes/dark-theme/color-tokens.js +0 -2
- package/themes/dark-theme/color-tokens.js.flow +0 -2
- package/themes/dark-theme/create-dark-theme.js +1 -3
- package/themes/dark-theme/create-dark-theme.js.flow +0 -2
- package/themes/dark-theme/dark-theme.js +1 -3
- package/themes/dark-theme/dark-theme.js.flow +0 -2
- package/themes/light-theme/color-component-tokens.js +0 -38
- package/themes/light-theme/color-component-tokens.js.flow +0 -43
- package/themes/light-theme/color-tokens.js +0 -2
- package/themes/light-theme/color-tokens.js.flow +0 -2
- package/themes/light-theme/create-light-theme.js +1 -3
- package/themes/light-theme/create-light-theme.js.flow +0 -2
- package/themes/light-theme/light-theme.js +1 -3
- package/themes/light-theme/light-theme.js.flow +0 -2
- package/themes/types.js.flow +0 -68
- package/timepicker/timepicker.js +1 -8
- package/timepicker/timepicker.js.flow +4 -10
- package/typography/index.d.ts +0 -23
- package/typography/index.js +2 -57
- package/typography/index.js.flow +0 -31
- package/es/spinner/spinner.js +0 -68
- package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
- package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
- package/esm/spinner/spinner.js +0 -125
- package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
- package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
- package/spinner/spinner.js +0 -136
- package/spinner/spinner.js.flow +0 -75
- package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
- package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
|
@@ -19,23 +19,26 @@ import {
|
|
|
19
19
|
StyledStartDate,
|
|
20
20
|
StyledEndDate,
|
|
21
21
|
} from './styled-components.js';
|
|
22
|
-
import type { DatepickerPropsT } from './types.js';
|
|
22
|
+
import type { DatepickerPropsT, InputRoleT } from './types.js';
|
|
23
23
|
import DateHelpers from './utils/date-helpers.js';
|
|
24
24
|
import dateFnsAdapter from './utils/date-fns-adapter.js';
|
|
25
25
|
import type { LocaleT } from '../locale/types.js';
|
|
26
|
+
import { INPUT_ROLE, RANGED_CALENDAR_BEHAVIOR } from './constants.js';
|
|
26
27
|
|
|
27
28
|
export const DEFAULT_DATE_FORMAT = 'yyyy/MM/dd';
|
|
28
29
|
|
|
29
|
-
const INPUT_DELIMITER = '
|
|
30
|
+
const INPUT_DELIMITER = '–';
|
|
30
31
|
|
|
31
|
-
const combineSeparatedInputs = (newInputValue, prevCombinedInputValue = '',
|
|
32
|
+
const combineSeparatedInputs = (newInputValue, prevCombinedInputValue = '', inputRole) => {
|
|
32
33
|
let inputValue = newInputValue;
|
|
33
|
-
const [prevStartDate = '', prevEndDate = ''] = prevCombinedInputValue.split(
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const [prevStartDate = '', prevEndDate = ''] = prevCombinedInputValue.split(
|
|
35
|
+
` ${INPUT_DELIMITER} `
|
|
36
|
+
);
|
|
37
|
+
if (inputRole === INPUT_ROLE.startDate && prevEndDate) {
|
|
38
|
+
inputValue = `${inputValue} ${INPUT_DELIMITER} ${prevEndDate}`;
|
|
36
39
|
}
|
|
37
|
-
if (
|
|
38
|
-
inputValue = `${prevStartDate}
|
|
40
|
+
if (inputRole === INPUT_ROLE.endDate) {
|
|
41
|
+
inputValue = `${prevStartDate} ${INPUT_DELIMITER} ${inputValue}`;
|
|
39
42
|
}
|
|
40
43
|
return inputValue;
|
|
41
44
|
};
|
|
@@ -43,6 +46,7 @@ const combineSeparatedInputs = (newInputValue, prevCombinedInputValue = '', sepa
|
|
|
43
46
|
type StateT = {|
|
|
44
47
|
calendarFocused: boolean,
|
|
45
48
|
isOpen: boolean,
|
|
49
|
+
selectedInput: ?InputRoleT,
|
|
46
50
|
isPseudoFocused: boolean,
|
|
47
51
|
lastActiveElm: ?HTMLElement,
|
|
48
52
|
inputValue?: string,
|
|
@@ -62,32 +66,71 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
62
66
|
|
|
63
67
|
constructor(props: DatepickerPropsT<T>) {
|
|
64
68
|
super(props);
|
|
65
|
-
//$FlowFixMe
|
|
69
|
+
//$FlowFixMe[incompatible-call]
|
|
66
70
|
this.dateHelpers = new DateHelpers(props.adapter);
|
|
67
71
|
this.state = {
|
|
68
72
|
calendarFocused: false,
|
|
69
73
|
isOpen: false,
|
|
74
|
+
selectedInput: null,
|
|
70
75
|
isPseudoFocused: false,
|
|
71
76
|
lastActiveElm: null,
|
|
72
77
|
inputValue: this.formatDisplayValue(props.value) || '',
|
|
73
78
|
};
|
|
74
79
|
}
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
handleChange: (?T | $ReadOnlyArray<?T>) => void = (date) => {
|
|
82
|
+
const onChange = this.props.onChange;
|
|
83
|
+
const onRangeChange = this.props.onRangeChange;
|
|
84
|
+
|
|
85
|
+
if (Array.isArray(date)) {
|
|
86
|
+
if (onChange && date.every(Boolean)) {
|
|
87
|
+
// flowlint-next-line unclear-type:off
|
|
88
|
+
onChange({ date: ((date: any): Array<T>) });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (onRangeChange) {
|
|
92
|
+
onRangeChange({ date: [...date] });
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
if (onChange) {
|
|
96
|
+
onChange({ date });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (onRangeChange) {
|
|
100
|
+
onRangeChange({ date });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
onCalendarSelect: ({ +date: ?T | Array<?T> }) => void = (data) => {
|
|
77
106
|
let isOpen = false;
|
|
78
107
|
let isPseudoFocused = false;
|
|
79
108
|
let calendarFocused = false;
|
|
80
109
|
let nextDate = data.date;
|
|
81
110
|
|
|
82
111
|
if (Array.isArray(nextDate) && this.props.range) {
|
|
83
|
-
if (nextDate
|
|
112
|
+
if (!nextDate[0] || !nextDate[1]) {
|
|
84
113
|
isOpen = true;
|
|
85
114
|
isPseudoFocused = true;
|
|
86
115
|
calendarFocused = null;
|
|
87
|
-
} else if (nextDate
|
|
116
|
+
} else if (nextDate[0] && nextDate[1]) {
|
|
88
117
|
const [start, end] = nextDate;
|
|
89
118
|
if (this.dateHelpers.isAfter(start, end)) {
|
|
90
|
-
|
|
119
|
+
if (this.hasLockedBehavior()) {
|
|
120
|
+
nextDate = this.props.value;
|
|
121
|
+
isOpen = true;
|
|
122
|
+
} else {
|
|
123
|
+
nextDate = [start, start];
|
|
124
|
+
}
|
|
125
|
+
} else if (
|
|
126
|
+
this.dateHelpers.dateRangeIncludesDates(
|
|
127
|
+
// $FlowFixMe Cannot call `this.dateHelpers.dateRangeIncludesDates` with `nextDate` bound to the first parameter because read-only array type [1] is incompatible with array type [2]
|
|
128
|
+
nextDate,
|
|
129
|
+
this.props.excludeDates
|
|
130
|
+
)
|
|
131
|
+
) {
|
|
132
|
+
nextDate = this.props.value;
|
|
133
|
+
isOpen = true;
|
|
91
134
|
}
|
|
92
135
|
|
|
93
136
|
if (this.state.lastActiveElm) {
|
|
@@ -131,28 +174,37 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
131
174
|
inputValue: this.formatDisplayValue(nextDate),
|
|
132
175
|
});
|
|
133
176
|
|
|
134
|
-
this.
|
|
177
|
+
this.handleChange(nextDate);
|
|
135
178
|
};
|
|
136
179
|
|
|
137
|
-
|
|
138
|
-
|
|
180
|
+
getNullDatePlaceholder(formatString: string) {
|
|
181
|
+
return (this.getMask() || formatString).split(INPUT_DELIMITER)[0].replace(/[0-9]|[a-z]/g, ' ');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
formatDate(date: ?T | $ReadOnlyArray<?T>, formatString: string) {
|
|
185
|
+
const format = (date: T) => {
|
|
139
186
|
if (formatString === DEFAULT_DATE_FORMAT) {
|
|
140
187
|
return this.dateHelpers.format(date, 'slashDate', this.props.locale);
|
|
141
188
|
}
|
|
142
189
|
return this.dateHelpers.formatDate(date, formatString, this.props.locale);
|
|
143
190
|
};
|
|
191
|
+
|
|
144
192
|
if (!date) {
|
|
145
193
|
return '';
|
|
146
194
|
} else if (Array.isArray(date) && !date[0] && !date[1]) {
|
|
147
195
|
return '';
|
|
196
|
+
} else if (Array.isArray(date) && !date[0] && date[1]) {
|
|
197
|
+
const endDate = format(date[1]);
|
|
198
|
+
const startDate = this.getNullDatePlaceholder(formatString);
|
|
199
|
+
return [startDate, endDate].join(` ${INPUT_DELIMITER} `);
|
|
148
200
|
} else if (Array.isArray(date)) {
|
|
149
|
-
return date.map((day) => format(day)).join(INPUT_DELIMITER);
|
|
201
|
+
return date.map((day) => (day ? format(day) : '')).join(` ${INPUT_DELIMITER} `);
|
|
150
202
|
} else {
|
|
151
203
|
return format(date);
|
|
152
204
|
}
|
|
153
205
|
}
|
|
154
206
|
|
|
155
|
-
formatDisplayValue: (?T |
|
|
207
|
+
formatDisplayValue: (?T | $ReadOnlyArray<?T>) => string = (date) => {
|
|
156
208
|
const { displayValueAtRangeIndex, formatDisplayValue, range } = this.props;
|
|
157
209
|
const formatString = this.normalizeDashes(this.props.formatString);
|
|
158
210
|
|
|
@@ -181,12 +233,13 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
181
233
|
return this.formatDate(date, formatString);
|
|
182
234
|
};
|
|
183
235
|
|
|
184
|
-
open = () => {
|
|
236
|
+
open = (inputRole?: InputRoleT) => {
|
|
185
237
|
this.setState(
|
|
186
238
|
{
|
|
187
239
|
isOpen: true,
|
|
188
240
|
isPseudoFocused: true,
|
|
189
241
|
calendarFocused: false,
|
|
242
|
+
selectedInput: inputRole,
|
|
190
243
|
},
|
|
191
244
|
this.props.onOpen
|
|
192
245
|
);
|
|
@@ -197,6 +250,7 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
197
250
|
this.setState(
|
|
198
251
|
{
|
|
199
252
|
isOpen: false,
|
|
253
|
+
selectedInput: null,
|
|
200
254
|
isPseudoFocused,
|
|
201
255
|
calendarFocused: false,
|
|
202
256
|
},
|
|
@@ -229,19 +283,16 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
229
283
|
}
|
|
230
284
|
|
|
231
285
|
if (range && !separateRangeInputs) {
|
|
232
|
-
return
|
|
286
|
+
return `9999/99/99 ${INPUT_DELIMITER} 9999/99/99`;
|
|
233
287
|
}
|
|
234
288
|
|
|
235
289
|
return '9999/99/99';
|
|
236
290
|
};
|
|
237
291
|
|
|
238
|
-
handleInputChange = (
|
|
239
|
-
event: SyntheticInputEvent<HTMLInputElement>,
|
|
240
|
-
separatedInput?: 'startDate' | 'endDate'
|
|
241
|
-
) => {
|
|
292
|
+
handleInputChange = (event: SyntheticInputEvent<HTMLInputElement>, inputRole?: InputRoleT) => {
|
|
242
293
|
const inputValue =
|
|
243
294
|
this.props.range && this.props.separateRangeInputs
|
|
244
|
-
? combineSeparatedInputs(event.currentTarget.value, this.state.inputValue,
|
|
295
|
+
? combineSeparatedInputs(event.currentTarget.value, this.state.inputValue, inputRole)
|
|
245
296
|
: event.currentTarget.value;
|
|
246
297
|
|
|
247
298
|
const mask = this.getMask();
|
|
@@ -251,12 +302,10 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
251
302
|
(typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ')) ||
|
|
252
303
|
inputValue.length === 0
|
|
253
304
|
) {
|
|
254
|
-
if (this.props.
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
this.props.onChange({ date: null });
|
|
259
|
-
}
|
|
305
|
+
if (this.props.range) {
|
|
306
|
+
this.handleChange([]);
|
|
307
|
+
} else {
|
|
308
|
+
this.handleChange(null);
|
|
260
309
|
}
|
|
261
310
|
}
|
|
262
311
|
|
|
@@ -270,7 +319,7 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
270
319
|
};
|
|
271
320
|
|
|
272
321
|
if (this.props.range && typeof this.props.displayValueAtRangeIndex !== 'number') {
|
|
273
|
-
const [left, right] = this.normalizeDashes(inputValue).split(INPUT_DELIMITER);
|
|
322
|
+
const [left, right] = this.normalizeDashes(inputValue).split(` ${INPUT_DELIMITER} `);
|
|
274
323
|
|
|
275
324
|
let startDate = this.dateHelpers.date(left);
|
|
276
325
|
let endDate = this.dateHelpers.date(right);
|
|
@@ -280,18 +329,15 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
280
329
|
endDate = parseDateString(right);
|
|
281
330
|
}
|
|
282
331
|
|
|
283
|
-
const
|
|
284
|
-
if (onChange) {
|
|
285
|
-
const datesValid = this.dateHelpers.isValid(startDate) && this.dateHelpers.isValid(endDate);
|
|
332
|
+
const datesValid = this.dateHelpers.isValid(startDate) && this.dateHelpers.isValid(endDate);
|
|
286
333
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
334
|
+
// added equal case so that times within the same day can be expressed
|
|
335
|
+
const rangeValid =
|
|
336
|
+
this.dateHelpers.isAfter(endDate, startDate) ||
|
|
337
|
+
this.dateHelpers.isEqual(startDate, endDate);
|
|
291
338
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
339
|
+
if (datesValid && rangeValid) {
|
|
340
|
+
this.handleChange([startDate, endDate]);
|
|
295
341
|
}
|
|
296
342
|
} else {
|
|
297
343
|
const dateString = this.normalizeDashes(inputValue);
|
|
@@ -306,41 +352,41 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
306
352
|
date = parseDateString(dateString);
|
|
307
353
|
}
|
|
308
354
|
|
|
309
|
-
const { displayValueAtRangeIndex,
|
|
310
|
-
if (date && this.dateHelpers.isValid(date)
|
|
355
|
+
const { displayValueAtRangeIndex, range, value } = this.props;
|
|
356
|
+
if (date && this.dateHelpers.isValid(date)) {
|
|
311
357
|
if (range && Array.isArray(value) && typeof displayValueAtRangeIndex === 'number') {
|
|
312
358
|
let [left, right] = value;
|
|
313
359
|
if (displayValueAtRangeIndex === 0) {
|
|
314
360
|
left = date;
|
|
315
361
|
if (!right) {
|
|
316
|
-
|
|
362
|
+
this.handleChange([left]);
|
|
317
363
|
} else {
|
|
318
364
|
if (this.dateHelpers.isAfter(right, left) || this.dateHelpers.isEqual(left, right)) {
|
|
319
|
-
|
|
365
|
+
this.handleChange([left, right]);
|
|
320
366
|
} else {
|
|
321
367
|
// Is resetting back to previous value appropriate? Invalid range is not
|
|
322
368
|
// communicated to the user, but if it was not reset the text value would
|
|
323
369
|
// show one value and date value another. This seems a bit better but clearly
|
|
324
370
|
// has a downside.
|
|
325
|
-
|
|
371
|
+
this.handleChange([...value]);
|
|
326
372
|
}
|
|
327
373
|
}
|
|
328
374
|
} else if (displayValueAtRangeIndex === 1) {
|
|
329
375
|
right = date;
|
|
330
376
|
if (!left) {
|
|
331
377
|
// If start value is not defined, set start/end to the same day.
|
|
332
|
-
|
|
378
|
+
this.handleChange([right, right]);
|
|
333
379
|
} else {
|
|
334
380
|
if (this.dateHelpers.isAfter(right, left) || this.dateHelpers.isEqual(left, right)) {
|
|
335
|
-
|
|
381
|
+
this.handleChange([left, right]);
|
|
336
382
|
} else {
|
|
337
383
|
// See comment above about resetting dates on invalid range
|
|
338
|
-
|
|
384
|
+
this.handleChange([...value]);
|
|
339
385
|
}
|
|
340
386
|
}
|
|
341
387
|
}
|
|
342
388
|
} else {
|
|
343
|
-
|
|
389
|
+
this.handleChange(date);
|
|
344
390
|
}
|
|
345
391
|
}
|
|
346
392
|
}
|
|
@@ -370,7 +416,15 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
370
416
|
|
|
371
417
|
normalizeDashes = (inputValue: string) => {
|
|
372
418
|
// replacing both hyphens and em-dashes with en-dashes
|
|
373
|
-
return inputValue.replace(/-/g,
|
|
419
|
+
return inputValue.replace(/-/g, INPUT_DELIMITER).replace(/—/g, INPUT_DELIMITER);
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
hasLockedBehavior = () => {
|
|
423
|
+
return (
|
|
424
|
+
this.props.rangedCalendarBehavior === RANGED_CALENDAR_BEHAVIOR.locked &&
|
|
425
|
+
this.props.range &&
|
|
426
|
+
this.props.separateRangeInputs
|
|
427
|
+
);
|
|
374
428
|
};
|
|
375
429
|
|
|
376
430
|
componentDidUpdate(prevProps: DatepickerPropsT<T>) {
|
|
@@ -381,7 +435,7 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
381
435
|
}
|
|
382
436
|
}
|
|
383
437
|
|
|
384
|
-
renderInputComponent(locale: LocaleT,
|
|
438
|
+
renderInputComponent(locale: LocaleT, inputRole?: InputRoleT) {
|
|
385
439
|
const { overrides = {} } = this.props;
|
|
386
440
|
|
|
387
441
|
const [InputComponent, inputProps] = getOverrides(overrides.Input, MaskedInput);
|
|
@@ -390,20 +444,20 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
390
444
|
this.props.placeholder || this.props.placeholder === ''
|
|
391
445
|
? this.props.placeholder
|
|
392
446
|
: this.props.range && !this.props.separateRangeInputs
|
|
393
|
-
?
|
|
447
|
+
? `YYYY/MM/DD ${INPUT_DELIMITER} YYYY/MM/DD`
|
|
394
448
|
: 'YYYY/MM/DD';
|
|
395
449
|
|
|
396
|
-
const [startDate = '', endDate = ''] = (this.state.inputValue || '').split(
|
|
450
|
+
const [startDate = '', endDate = ''] = (this.state.inputValue || '').split(
|
|
451
|
+
` ${INPUT_DELIMITER} `
|
|
452
|
+
);
|
|
397
453
|
|
|
398
454
|
const value =
|
|
399
|
-
|
|
455
|
+
inputRole === INPUT_ROLE.startDate
|
|
400
456
|
? startDate
|
|
401
|
-
:
|
|
457
|
+
: inputRole === INPUT_ROLE.endDate
|
|
402
458
|
? endDate
|
|
403
459
|
: this.state.inputValue;
|
|
404
460
|
|
|
405
|
-
const onChange = (event) => this.handleInputChange(event, separatedInput);
|
|
406
|
-
|
|
407
461
|
return (
|
|
408
462
|
<InputComponent
|
|
409
463
|
aria-disabled={this.props.disabled}
|
|
@@ -419,10 +473,10 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
419
473
|
disabled={this.props.disabled}
|
|
420
474
|
size={this.props.size}
|
|
421
475
|
value={value}
|
|
422
|
-
onFocus={this.open}
|
|
476
|
+
onFocus={() => this.open(inputRole)}
|
|
423
477
|
onBlur={this.handleInputBlur}
|
|
424
478
|
onKeyDown={this.handleKeyDown}
|
|
425
|
-
onChange={
|
|
479
|
+
onChange={(event) => this.handleInputChange(event, inputRole)}
|
|
426
480
|
placeholder={placeholder}
|
|
427
481
|
mask={this.getMask()}
|
|
428
482
|
required={this.props.required}
|
|
@@ -462,7 +516,9 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
462
516
|
trapTabbing={true}
|
|
463
517
|
value={this.props.value}
|
|
464
518
|
{...this.props}
|
|
465
|
-
onChange={this.
|
|
519
|
+
onChange={this.onCalendarSelect}
|
|
520
|
+
selectedInput={this.state.selectedInput}
|
|
521
|
+
hasLockedBehavior={this.hasLockedBehavior()}
|
|
466
522
|
/>
|
|
467
523
|
}
|
|
468
524
|
{...popoverProps}
|
|
@@ -476,11 +532,11 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
476
532
|
<>
|
|
477
533
|
<StartDate {...startDateProps}>
|
|
478
534
|
<InputLabel {...inputLabelProps}>{startDateLabel}</InputLabel>
|
|
479
|
-
{this.renderInputComponent(locale,
|
|
535
|
+
{this.renderInputComponent(locale, INPUT_ROLE.startDate)}
|
|
480
536
|
</StartDate>
|
|
481
537
|
<EndDate {...endDateProps}>
|
|
482
538
|
<InputLabel {...inputLabelProps}>{endDateLabel}</InputLabel>
|
|
483
|
-
{this.renderInputComponent(locale,
|
|
539
|
+
{this.renderInputComponent(locale, INPUT_ROLE.endDate)}
|
|
484
540
|
</EndDate>
|
|
485
541
|
</>
|
|
486
542
|
) : (
|
|
@@ -524,7 +580,8 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
524
580
|
>
|
|
525
581
|
{
|
|
526
582
|
// No date selected
|
|
527
|
-
!this.props.value ||
|
|
583
|
+
!this.props.value ||
|
|
584
|
+
(Array.isArray(this.props.value) && !this.props.value[0] && !this.props.value[1])
|
|
528
585
|
? ''
|
|
529
586
|
: // Date selected in a non-range picker
|
|
530
587
|
!Array.isArray(this.props.value)
|
|
@@ -532,7 +589,7 @@ export default class Datepicker<T = Date> extends React.Component<DatepickerProp
|
|
|
532
589
|
date: this.state.inputValue || '',
|
|
533
590
|
})
|
|
534
591
|
: // Start and end dates are selected in a range picker
|
|
535
|
-
this.props.value
|
|
592
|
+
this.props.value[0] && this.props.value[1]
|
|
536
593
|
? getInterpolatedString(locale.datepicker.selectedDateRange, {
|
|
537
594
|
startDate: this.formatDisplayValue(this.props.value[0]),
|
|
538
595
|
endDate: this.formatDisplayValue(
|
package/datepicker/day.js
CHANGED
|
@@ -21,6 +21,8 @@ var _index = require("../locale/index.js");
|
|
|
21
21
|
|
|
22
22
|
var _focusVisible = require("../utils/focusVisible.js");
|
|
23
23
|
|
|
24
|
+
var _constants = require("./constants.js");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
28
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
@@ -96,22 +98,49 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
96
98
|
var _this$props = _this.props,
|
|
97
99
|
range = _this$props.range,
|
|
98
100
|
value = _this$props.value;
|
|
99
|
-
var
|
|
101
|
+
var nextDate;
|
|
102
|
+
|
|
103
|
+
if (Array.isArray(value) && range && _this.props.hasLockedBehavior) {
|
|
104
|
+
var currentDate = _this.props.value;
|
|
105
|
+
var nextStartDate = null;
|
|
106
|
+
var nextEndDate = null;
|
|
107
|
+
|
|
108
|
+
if (_this.props.selectedInput === _constants.INPUT_ROLE.startDate) {
|
|
109
|
+
nextStartDate = selectedDate;
|
|
110
|
+
nextEndDate = Array.isArray(currentDate) && currentDate[1] ? currentDate[1] : null;
|
|
111
|
+
} else if (_this.props.selectedInput === _constants.INPUT_ROLE.endDate) {
|
|
112
|
+
nextStartDate = Array.isArray(currentDate) && currentDate[0] ? currentDate[0] : null;
|
|
113
|
+
nextEndDate = selectedDate;
|
|
114
|
+
}
|
|
100
115
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
nextDate = [nextStartDate];
|
|
117
|
+
|
|
118
|
+
if (nextEndDate) {
|
|
119
|
+
nextDate.push(nextEndDate);
|
|
120
|
+
}
|
|
121
|
+
} else if (Array.isArray(value) && range && !_this.props.hasLockedBehavior) {
|
|
122
|
+
var _value = _slicedToArray(value, 2),
|
|
123
|
+
start = _value[0],
|
|
124
|
+
end = _value[1]; // Starting a new range
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
if (!start && !end || start && end) {
|
|
128
|
+
nextDate = [selectedDate, null]; // EndDate needs a StartDate, SelectedDate comes before EndDate
|
|
129
|
+
} else if (!start && end && _this.dateHelpers.isAfter(end, selectedDate)) {
|
|
130
|
+
nextDate = [selectedDate, end]; // EndDate needs a StartDate, but SelectedDate comes after EndDate
|
|
131
|
+
} else if (!start && end && _this.dateHelpers.isAfter(selectedDate, end)) {
|
|
132
|
+
nextDate = [end, selectedDate]; // StartDate needs an EndDate, SelectedDate comes after StartDate
|
|
133
|
+
} else if (start && !end && _this.dateHelpers.isAfter(selectedDate, start)) {
|
|
134
|
+
nextDate = [start, selectedDate];
|
|
106
135
|
} else {
|
|
107
|
-
|
|
136
|
+
nextDate = [selectedDate, start];
|
|
108
137
|
}
|
|
109
138
|
} else {
|
|
110
|
-
|
|
139
|
+
nextDate = selectedDate;
|
|
111
140
|
}
|
|
112
141
|
|
|
113
142
|
_this.props.onSelect({
|
|
114
|
-
date:
|
|
143
|
+
date: nextDate
|
|
115
144
|
});
|
|
116
145
|
});
|
|
117
146
|
|
|
@@ -298,13 +327,18 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
298
327
|
var date = this.getDateProp();
|
|
299
328
|
var value = this.props.value;
|
|
300
329
|
|
|
301
|
-
if (Array.isArray(value)
|
|
302
|
-
|
|
303
|
-
|
|
330
|
+
if (Array.isArray(value)) {
|
|
331
|
+
var _value2 = _slicedToArray(value, 2),
|
|
332
|
+
start = _value2[0],
|
|
333
|
+
end = _value2[1];
|
|
304
334
|
|
|
335
|
+
if (!start && !end) {
|
|
336
|
+
return false;
|
|
337
|
+
}
|
|
305
338
|
|
|
306
|
-
|
|
307
|
-
|
|
339
|
+
if (start && end) {
|
|
340
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(end));
|
|
341
|
+
}
|
|
308
342
|
}
|
|
309
343
|
} // calculated for range case only
|
|
310
344
|
|
|
@@ -316,16 +350,29 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
316
350
|
value = _this$props4.value,
|
|
317
351
|
highlightedDate = _this$props4.highlightedDate;
|
|
318
352
|
|
|
319
|
-
if (Array.isArray(value)
|
|
320
|
-
|
|
321
|
-
|
|
353
|
+
if (Array.isArray(value)) {
|
|
354
|
+
var _value3 = _slicedToArray(value, 2),
|
|
355
|
+
start = _value3[0],
|
|
356
|
+
end = _value3[1];
|
|
322
357
|
|
|
358
|
+
if (!start && !end) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
323
361
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
362
|
+
if (highlightedDate && start && !end) {
|
|
363
|
+
if (this.dateHelpers.isAfter(highlightedDate, start)) {
|
|
364
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(start), this.clampToDayStart(highlightedDate));
|
|
365
|
+
} else {
|
|
366
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(start));
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (highlightedDate && !start && end) {
|
|
371
|
+
if (this.dateHelpers.isAfter(highlightedDate, end)) {
|
|
372
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(end), this.clampToDayStart(highlightedDate));
|
|
373
|
+
} else {
|
|
374
|
+
return this.dateHelpers.isDayInRange(this.clampToDayStart(date), this.clampToDayStart(highlightedDate), this.clampToDayStart(end));
|
|
375
|
+
}
|
|
329
376
|
}
|
|
330
377
|
}
|
|
331
378
|
}
|
|
@@ -337,21 +384,22 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
337
384
|
value = _this$props5.value,
|
|
338
385
|
highlightedDate = _this$props5.highlightedDate,
|
|
339
386
|
range = _this$props5.range,
|
|
340
|
-
highlighted = _this$props5.highlighted
|
|
387
|
+
highlighted = _this$props5.highlighted,
|
|
388
|
+
peekNextMonth = _this$props5.peekNextMonth;
|
|
341
389
|
var $isHighlighted = highlighted;
|
|
342
390
|
var $selected = this.isSelected();
|
|
343
|
-
var $hasRangeHighlighted = !!(Array.isArray(value) && range && value
|
|
344
|
-
var $outsideMonth = !
|
|
345
|
-
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !
|
|
391
|
+
var $hasRangeHighlighted = !!(Array.isArray(value) && range && highlightedDate && (value[0] && !value[1] && !this.dateHelpers.isSameDay(value[0], highlightedDate) || !value[0] && value[1] && !this.dateHelpers.isSameDay(value[1], highlightedDate)));
|
|
392
|
+
var $outsideMonth = !peekNextMonth && this.isOutsideMonth();
|
|
393
|
+
var $outsideMonthWithinRange = !!(Array.isArray(value) && range && $outsideMonth && !peekNextMonth && this.isOutsideOfMonthButWithinRange());
|
|
346
394
|
return {
|
|
347
395
|
$date: date,
|
|
348
396
|
$density: this.props.density,
|
|
349
397
|
$disabled: this.props.disabled,
|
|
350
|
-
$endDate: Array.isArray(value) &&
|
|
398
|
+
$endDate: Array.isArray(value) && !!(value[0] && value[1]) && range && $selected && this.dateHelpers.isSameDay(date, value[1]) || false,
|
|
351
399
|
$hasDateLabel: !!this.props.dateLabel,
|
|
352
400
|
$hasRangeHighlighted: $hasRangeHighlighted,
|
|
353
|
-
$hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]),
|
|
354
|
-
$hasRangeSelected: Array.isArray(value) ? value
|
|
401
|
+
$hasRangeOnRight: Array.isArray(value) && $hasRangeHighlighted && highlightedDate && (value[0] && this.dateHelpers.isAfter(highlightedDate, value[0]) || value[1] && this.dateHelpers.isAfter(highlightedDate, value[1])),
|
|
402
|
+
$hasRangeSelected: Array.isArray(value) ? !!(value[0] && value[1]) : false,
|
|
355
403
|
$highlightedDate: highlightedDate,
|
|
356
404
|
$isHighlighted: $isHighlighted,
|
|
357
405
|
$isHovered: this.state.isHovered,
|
|
@@ -361,12 +409,15 @@ var Day = /*#__PURE__*/function (_React$Component) {
|
|
|
361
409
|
$month: this.getMonthProp(),
|
|
362
410
|
$outsideMonth: $outsideMonth,
|
|
363
411
|
$outsideMonthWithinRange: $outsideMonthWithinRange,
|
|
364
|
-
$peekNextMonth:
|
|
365
|
-
$pseudoHighlighted:
|
|
366
|
-
$pseudoSelected:
|
|
367
|
-
$range:
|
|
412
|
+
$peekNextMonth: peekNextMonth,
|
|
413
|
+
$pseudoHighlighted: range && !$isHighlighted && !$selected ? this.isPseudoHighlighted() : false,
|
|
414
|
+
$pseudoSelected: range && !$selected ? this.isPseudoSelected() : false,
|
|
415
|
+
$range: range,
|
|
368
416
|
$selected: $selected,
|
|
369
|
-
$startDate: Array.isArray(
|
|
417
|
+
$startDate: Array.isArray(value) && value[0] && value[1] && range && $selected ? this.dateHelpers.isSameDay(date, value[0]) : false,
|
|
418
|
+
$hasLockedBehavior: this.props.hasLockedBehavior,
|
|
419
|
+
$selectedInput: this.props.selectedInput,
|
|
420
|
+
$value: this.props.value
|
|
370
421
|
};
|
|
371
422
|
}
|
|
372
423
|
}, {
|