react-day-picker 8.2.0 → 8.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -19
- package/dist/index.d.ts +1176 -40
- package/dist/index.esm.d.ts +1176 -0
- package/dist/index.esm.js +1473 -1496
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1195 -1214
- package/dist/index.js.map +1 -1
- package/dist/react-day-picker.min.js +1 -1
- package/dist/style.css +9 -11
- package/dist/style.module.css +14 -16
- package/dist/style.module.css.d.ts +34 -34
- package/package.json +2 -2
- package/src/components/Caption/Caption.tsx +8 -8
- package/src/components/CaptionDropdowns/CaptionDropdowns.tsx +6 -4
- package/src/components/CaptionNavigation/CaptionNavigation.tsx +6 -8
- package/src/components/Dropdown/Dropdown.tsx +5 -5
- package/src/components/Head/Head.tsx +6 -4
- package/src/components/HeadRow/HeadRow.tsx +2 -1
- package/src/components/HeadRow/utils/getWeekdays.test.ts +10 -0
- package/src/components/HeadRow/utils/getWeekdays.ts +9 -3
- package/src/components/Month/Month.test.tsx +11 -0
- package/src/components/Month/Month.tsx +12 -6
- package/src/components/MonthsDropdown/MonthsDropdown.tsx +3 -6
- package/src/components/Navigation/Navigation.tsx +5 -15
- package/src/components/Row/Row.tsx +8 -8
- package/src/components/Table/Table.tsx +10 -12
- package/src/components/Table/utils/daysToMonthWeeks.ts +15 -3
- package/src/components/Table/utils/getMonthWeeks.test.ts +33 -1
- package/src/components/Table/utils/getMonthWeeks.ts +2 -3
- package/src/components/YearsDropdown/YearsDropdown.tsx +3 -6
- package/src/contexts/DayPicker/{useDayPicker.test.ts → DayPickerContext.test.ts} +13 -29
- package/src/contexts/DayPicker/DayPickerContext.tsx +41 -53
- package/src/contexts/DayPicker/defaultContextValues.ts +85 -0
- package/src/contexts/DayPicker/index.ts +0 -1
- package/src/contexts/Focus/{useFocusContext.test.ts → FocusContext.test.ts} +0 -0
- package/src/contexts/Focus/FocusContext.tsx +19 -6
- package/src/contexts/Focus/index.ts +0 -1
- package/src/contexts/Focus/utils/getInitialFocusTarget.test.tsx +37 -8
- package/src/contexts/Focus/utils/getInitialFocusTarget.tsx +0 -1
- package/src/contexts/Focus/utils/getNextFocus.test.tsx +75 -50
- package/src/contexts/Focus/utils/getNextFocus.tsx +54 -19
- package/src/contexts/Modifiers/{useModifiers.test.ts → ModifiersContext.test.ts} +0 -0
- package/src/contexts/Modifiers/ModifiersContext.tsx +16 -1
- package/src/contexts/Modifiers/index.ts +1 -1
- package/src/contexts/Modifiers/utils/getInternalModifiers.test.ts +3 -2
- package/src/contexts/Navigation/{useNavigation.test.ts → NavigationContext.test.ts} +1 -2
- package/src/contexts/Navigation/NavigationContext.tsx +15 -1
- package/src/contexts/Navigation/index.ts +0 -1
- package/src/contexts/SelectMultiple/{useSelectMultiple.test.ts → SelectMultipleContext.test.ts} +4 -2
- package/src/contexts/SelectMultiple/SelectMultipleContext.tsx +16 -1
- package/src/contexts/SelectMultiple/index.ts +0 -1
- package/src/contexts/SelectRange/{useSelectRange.test.ts → SelectRangeContext.test.ts} +4 -21
- package/src/contexts/SelectRange/SelectRangeContext.tsx +51 -36
- package/src/contexts/SelectRange/index.ts +0 -1
- package/src/contexts/SelectSingle/{useSelectSingle.test.ts → SelectSingleContext.test.ts} +1 -1
- package/src/contexts/SelectSingle/SelectSingleContext.tsx +16 -1
- package/src/contexts/SelectSingle/index.ts +0 -1
- package/src/hooks/useDayRender/useDayRender.tsx +5 -4
- package/src/style.css +9 -11
- package/src/types/DayPickerBase.ts +33 -6
- package/src/types/EventHandlers.ts +9 -11
- package/src/types/Matchers.ts +1 -1
- package/dist/DayPicker.d.ts +0 -93
- package/dist/components/Button/Button.d.ts +0 -7
- package/dist/components/Button/index.d.ts +0 -1
- package/dist/components/Caption/Caption.d.ts +0 -19
- package/dist/components/Caption/index.d.ts +0 -1
- package/dist/components/CaptionDropdowns/CaptionDropdowns.d.ts +0 -5
- package/dist/components/CaptionDropdowns/index.d.ts +0 -1
- package/dist/components/CaptionLabel/CaptionLabel.d.ts +0 -9
- package/dist/components/CaptionLabel/index.d.ts +0 -1
- package/dist/components/CaptionNavigation/CaptionNavigation.d.ts +0 -5
- package/dist/components/CaptionNavigation/index.d.ts +0 -1
- package/dist/components/Day/Day.d.ts +0 -12
- package/dist/components/Day/index.d.ts +0 -1
- package/dist/components/DayContent/DayContent.d.ts +0 -12
- package/dist/components/DayContent/index.d.ts +0 -1
- package/dist/components/Dropdown/Dropdown.d.ts +0 -20
- package/dist/components/Dropdown/index.d.ts +0 -1
- package/dist/components/Footer/Footer.d.ts +0 -2
- package/dist/components/Footer/index.d.ts +0 -1
- package/dist/components/Head/Head.d.ts +0 -2
- package/dist/components/Head/index.d.ts +0 -1
- package/dist/components/Head/utils/getWeekdays.d.ts +0 -8
- package/dist/components/Head/utils/index.d.ts +0 -1
- package/dist/components/HeadRow/HeadRow.d.ts +0 -4
- package/dist/components/HeadRow/index.d.ts +0 -1
- package/dist/components/HeadRow/utils/getWeekdays.d.ts +0 -8
- package/dist/components/HeadRow/utils/index.d.ts +0 -1
- package/dist/components/IconDropdown/IconDropdown.d.ts +0 -5
- package/dist/components/IconDropdown/index.d.ts +0 -1
- package/dist/components/IconLeft/IconLeft.d.ts +0 -5
- package/dist/components/IconLeft/index.d.ts +0 -1
- package/dist/components/IconRight/IconRight.d.ts +0 -5
- package/dist/components/IconRight/index.d.ts +0 -1
- package/dist/components/Month/Month.d.ts +0 -7
- package/dist/components/Month/index.d.ts +0 -1
- package/dist/components/MonthsDropdown/MonthsDropdown.d.ts +0 -9
- package/dist/components/MonthsDropdown/index.d.ts +0 -1
- package/dist/components/Navigation/Navigation.d.ts +0 -20
- package/dist/components/Navigation/index.d.ts +0 -1
- package/dist/components/Root/Root.d.ts +0 -2
- package/dist/components/Root/index.d.ts +0 -1
- package/dist/components/Row/Row.d.ts +0 -13
- package/dist/components/Row/index.d.ts +0 -1
- package/dist/components/Table/Table.d.ts +0 -9
- package/dist/components/Table/index.d.ts +0 -1
- package/dist/components/Table/utils/daysToMonthWeeks.d.ts +0 -8
- package/dist/components/Table/utils/getMonthWeeks.d.ts +0 -21
- package/dist/components/WeekNumber/WeekNumber.d.ts +0 -14
- package/dist/components/WeekNumber/index.d.ts +0 -1
- package/dist/components/YearsDropdown/YearsDropdown.d.ts +0 -15
- package/dist/components/YearsDropdown/index.d.ts +0 -1
- package/dist/contexts/DayPicker/DayPickerContext.d.ts +0 -50
- package/dist/contexts/DayPicker/defaultClassNames.d.ts +0 -5
- package/dist/contexts/DayPicker/defaultContextValue.d.ts +0 -6
- package/dist/contexts/DayPicker/formatters/formatCaption.d.ts +0 -7
- package/dist/contexts/DayPicker/formatters/formatDay.d.ts +0 -7
- package/dist/contexts/DayPicker/formatters/formatMonthCaption.d.ts +0 -7
- package/dist/contexts/DayPicker/formatters/formatWeekNumber.d.ts +0 -4
- package/dist/contexts/DayPicker/formatters/formatWeekdayName.d.ts +0 -7
- package/dist/contexts/DayPicker/formatters/formatYearCaption.d.ts +0 -6
- package/dist/contexts/DayPicker/formatters/index.d.ts +0 -6
- package/dist/contexts/DayPicker/index.d.ts +0 -2
- package/dist/contexts/DayPicker/labels/index.d.ts +0 -7
- package/dist/contexts/DayPicker/labels/labelDay.d.ts +0 -5
- package/dist/contexts/DayPicker/labels/labelMonthDropdown.d.ts +0 -4
- package/dist/contexts/DayPicker/labels/labelNext.d.ts +0 -5
- package/dist/contexts/DayPicker/labels/labelPrevious.d.ts +0 -5
- package/dist/contexts/DayPicker/labels/labelWeekNumber.d.ts +0 -5
- package/dist/contexts/DayPicker/labels/labelWeekday.d.ts +0 -5
- package/dist/contexts/DayPicker/labels/labelYearDropdown.d.ts +0 -4
- package/dist/contexts/DayPicker/useDayPicker.d.ts +0 -8
- package/dist/contexts/DayPicker/utils/index.d.ts +0 -1
- package/dist/contexts/DayPicker/utils/parseFromToProps.d.ts +0 -6
- package/dist/contexts/Focus/FocusContext.d.ts +0 -36
- package/dist/contexts/Focus/index.d.ts +0 -2
- package/dist/contexts/Focus/useFocusContext.d.ts +0 -8
- package/dist/contexts/Focus/utils/getInitialFocusTarget.d.ts +0 -3
- package/dist/contexts/Focus/utils/getNextFocus.d.ts +0 -9
- package/dist/contexts/Modifiers/ModifiersContext.d.ts +0 -9
- package/dist/contexts/Modifiers/index.d.ts +0 -2
- package/dist/contexts/Modifiers/useModifiers.d.ts +0 -9
- package/dist/contexts/Modifiers/utils/getActiveModifiers.d.ts +0 -7
- package/dist/contexts/Modifiers/utils/getCustomModifiers.d.ts +0 -3
- package/dist/contexts/Modifiers/utils/getInternalModifiers.d.ts +0 -6
- package/dist/contexts/Modifiers/utils/isDateInRange.d.ts +0 -3
- package/dist/contexts/Modifiers/utils/isMatch.d.ts +0 -19
- package/dist/contexts/Modifiers/utils/matcherToArray.d.ts +0 -3
- package/dist/contexts/Navigation/NavigationContext.d.ts +0 -27
- package/dist/contexts/Navigation/index.d.ts +0 -2
- package/dist/contexts/Navigation/useNavigation.d.ts +0 -8
- package/dist/contexts/Navigation/useNavigationState.d.ts +0 -7
- package/dist/contexts/Navigation/utils/getDisplayMonths.d.ts +0 -8
- package/dist/contexts/Navigation/utils/getInitialMonth.d.ts +0 -3
- package/dist/contexts/Navigation/utils/getNextMonth.d.ts +0 -18
- package/dist/contexts/Navigation/utils/getPreviousMonth.d.ts +0 -19
- package/dist/contexts/RootProvider.d.ts +0 -8
- package/dist/contexts/SelectMultiple/SelectMultipleContext.d.ts +0 -35
- package/dist/contexts/SelectMultiple/index.d.ts +0 -2
- package/dist/contexts/SelectMultiple/useSelectMultiple.d.ts +0 -7
- package/dist/contexts/SelectRange/SelectRangeContext.d.ts +0 -36
- package/dist/contexts/SelectRange/index.d.ts +0 -2
- package/dist/contexts/SelectRange/useSelectRange.d.ts +0 -7
- package/dist/contexts/SelectRange/utils/addToRange.d.ts +0 -8
- package/dist/contexts/SelectSingle/SelectSingleContext.d.ts +0 -30
- package/dist/contexts/SelectSingle/index.d.ts +0 -2
- package/dist/contexts/SelectSingle/useSelectSingle.d.ts +0 -7
- package/dist/hooks/useActiveModifiers/index.d.ts +0 -1
- package/dist/hooks/useActiveModifiers/useActiveModifiers.d.ts +0 -15
- package/dist/hooks/useControlledValue/index.d.ts +0 -1
- package/dist/hooks/useControlledValue/useControlledValue.d.ts +0 -12
- package/dist/hooks/useDayEventHandlers/index.d.ts +0 -1
- package/dist/hooks/useDayEventHandlers/useDayEventHandlers.d.ts +0 -26
- package/dist/hooks/useDayRender/index.d.ts +0 -1
- package/dist/hooks/useDayRender/useDayRender.d.ts +0 -32
- package/dist/hooks/useDayRender/utils/getDayClassNames.d.ts +0 -10
- package/dist/hooks/useDayRender/utils/getDayStyle.d.ts +0 -5
- package/dist/hooks/useId/index.d.ts +0 -1
- package/dist/hooks/useId/useId.d.ts +0 -19
- package/dist/hooks/useInput/index.d.ts +0 -1
- package/dist/hooks/useInput/useInput.d.ts +0 -28
- package/dist/hooks/useInput/utils/isValidDate.d.ts +0 -2
- package/dist/hooks/useSelectedDays/index.d.ts +0 -1
- package/dist/hooks/useSelectedDays/useSelectedDays.d.ts +0 -10
- package/dist/types/DayPickerBase.d.ts +0 -255
- package/dist/types/DayPickerDefault.d.ts +0 -8
- package/dist/types/DayPickerMultiple.d.ts +0 -18
- package/dist/types/DayPickerRange.d.ts +0 -19
- package/dist/types/DayPickerSingle.d.ts +0 -16
- package/dist/types/EventHandlers.d.ts +0 -51
- package/dist/types/Formatters.d.ts +0 -24
- package/dist/types/Labels.d.ts +0 -28
- package/dist/types/Matchers.d.ts +0 -84
- package/dist/types/Modifiers.d.ts +0 -49
- package/dist/types/Styles.d.ts +0 -102
- package/src/contexts/DayPicker/defaultContextValue.ts +0 -37
- package/src/contexts/DayPicker/useDayPicker.ts +0 -17
- package/src/contexts/Focus/useFocusContext.ts +0 -17
- package/src/contexts/Modifiers/useModifiers.ts +0 -20
- package/src/contexts/Navigation/useNavigation.ts +0 -17
- package/src/contexts/SelectMultiple/useSelectMultiple.ts +0 -21
- package/src/contexts/SelectRange/useSelectRange.ts +0 -19
- package/src/contexts/SelectSingle/useSelectSingle.ts +0 -21
package/src/contexts/SelectMultiple/{useSelectMultiple.test.ts → SelectMultipleContext.test.ts}
RENAMED
|
@@ -8,8 +8,10 @@ import { isMatch } from 'contexts/Modifiers/utils/isMatch';
|
|
|
8
8
|
import { DayPickerMultipleProps } from 'types/DayPickerMultiple';
|
|
9
9
|
import { ActiveModifiers } from 'types/Modifiers';
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
SelectMultipleContextValue,
|
|
13
|
+
useSelectMultiple
|
|
14
|
+
} from './SelectMultipleContext';
|
|
13
15
|
|
|
14
16
|
const today = new Date(2021, 11, 8);
|
|
15
17
|
freezeBeforeAll(today);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, ReactNode } from 'react';
|
|
1
|
+
import React, { createContext, ReactNode, useContext } from 'react';
|
|
2
2
|
|
|
3
3
|
import isSameDay from 'date-fns/isSameDay';
|
|
4
4
|
|
|
@@ -133,3 +133,18 @@ export function SelectMultipleProviderInternal({
|
|
|
133
133
|
</SelectMultipleContext.Provider>
|
|
134
134
|
);
|
|
135
135
|
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Hook to access the {@link SelectMultipleContextValue}.
|
|
139
|
+
*
|
|
140
|
+
* This hook is meant to be used inside internal or custom components.
|
|
141
|
+
*/
|
|
142
|
+
export function useSelectMultiple(): SelectMultipleContextValue {
|
|
143
|
+
const context = useContext(SelectMultipleContext);
|
|
144
|
+
if (!context) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
'useSelectMultiple must be used within a SelectMultipleProvider'
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
return context;
|
|
150
|
+
}
|
|
@@ -14,8 +14,7 @@ import { DayPickerBase } from 'types/DayPickerBase';
|
|
|
14
14
|
import { DayPickerRangeProps } from 'types/DayPickerRange';
|
|
15
15
|
import { ActiveModifiers } from 'types/Modifiers';
|
|
16
16
|
|
|
17
|
-
import { SelectRangeContextValue } from './SelectRangeContext';
|
|
18
|
-
import { useSelectRange } from './useSelectRange';
|
|
17
|
+
import { SelectRangeContextValue, useSelectRange } from './SelectRangeContext';
|
|
19
18
|
|
|
20
19
|
const today = new Date(2021, 11, 8);
|
|
21
20
|
freezeBeforeAll(today);
|
|
@@ -148,11 +147,13 @@ describe('when a complete range of days is selected', () => {
|
|
|
148
147
|
});
|
|
149
148
|
|
|
150
149
|
describe('when the max number of the selected days is reached', () => {
|
|
150
|
+
const from = today;
|
|
151
|
+
const to = addDays(today, 6);
|
|
151
152
|
const selected = { from, to };
|
|
152
153
|
const dayPickerProps: DayPickerRangeProps = {
|
|
153
154
|
...initialProps,
|
|
154
155
|
selected,
|
|
155
|
-
max:
|
|
156
|
+
max: 7
|
|
156
157
|
};
|
|
157
158
|
beforeAll(() => {
|
|
158
159
|
setup(dayPickerProps);
|
|
@@ -183,9 +184,6 @@ describe('when the max number of the selected days is reached', () => {
|
|
|
183
184
|
stubEvent
|
|
184
185
|
);
|
|
185
186
|
});
|
|
186
|
-
test('should not call onSelect', () => {
|
|
187
|
-
expect(dayPickerProps.onSelect).not.toHaveBeenCalled();
|
|
188
|
-
});
|
|
189
187
|
});
|
|
190
188
|
});
|
|
191
189
|
|
|
@@ -264,19 +262,4 @@ describe('when the minimum number of days are selected', () => {
|
|
|
264
262
|
);
|
|
265
263
|
});
|
|
266
264
|
});
|
|
267
|
-
|
|
268
|
-
describe('when "onDayClick" is called with a day before "to"', () => {
|
|
269
|
-
const day = subDays(to, 1);
|
|
270
|
-
const activeModifiers: ActiveModifiers = { selected: true };
|
|
271
|
-
|
|
272
|
-
beforeAll(() => {
|
|
273
|
-
result.current.onDayClick?.(day, activeModifiers, stubEvent);
|
|
274
|
-
});
|
|
275
|
-
afterAll(() => {
|
|
276
|
-
jest.resetAllMocks();
|
|
277
|
-
});
|
|
278
|
-
test('should not call "onSelect"', () => {
|
|
279
|
-
expect(dayPickerProps.onSelect).not.toHaveBeenCalled();
|
|
280
|
-
});
|
|
281
|
-
});
|
|
282
265
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { createContext, ReactNode } from 'react';
|
|
1
|
+
import React, { createContext, ReactNode, useContext } from 'react';
|
|
2
2
|
|
|
3
|
+
import addDays from 'date-fns/addDays';
|
|
3
4
|
import differenceInCalendarDays from 'date-fns/differenceInCalendarDays';
|
|
4
|
-
import
|
|
5
|
-
import isBefore from 'date-fns/isBefore';
|
|
5
|
+
import subDays from 'date-fns/subDays';
|
|
6
6
|
|
|
7
7
|
import { DayPickerBase } from 'types/DayPickerBase';
|
|
8
8
|
import { DayPickerRangeProps, isDayPickerRange } from 'types/DayPickerRange';
|
|
@@ -90,20 +90,8 @@ export function SelectRangeProviderInternal({
|
|
|
90
90
|
|
|
91
91
|
const onDayClick: DayClickEventHandler = (day, activeModifiers, e) => {
|
|
92
92
|
initialProps.onDayClick?.(day, activeModifiers, e);
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
(min || max) &&
|
|
96
|
-
selected &&
|
|
97
|
-
range?.to &&
|
|
98
|
-
range.from &&
|
|
99
|
-
range.from !== range.to
|
|
100
|
-
) {
|
|
101
|
-
const diff = Math.abs(differenceInCalendarDays(range?.to, range?.from));
|
|
102
|
-
if ((min && diff < min) || (max && diff >= max)) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
initialProps.onSelect?.(range, day, activeModifiers, e);
|
|
93
|
+
const newRange = addToRange(day, selected);
|
|
94
|
+
initialProps.onSelect?.(newRange, day, activeModifiers, e);
|
|
107
95
|
};
|
|
108
96
|
|
|
109
97
|
const modifiers: SelectRangeModifiers = {
|
|
@@ -128,26 +116,40 @@ export function SelectRangeProviderInternal({
|
|
|
128
116
|
}
|
|
129
117
|
}
|
|
130
118
|
|
|
131
|
-
if (min
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
119
|
+
if (min) {
|
|
120
|
+
if (selectedFrom && !selectedTo) {
|
|
121
|
+
modifiers.disabled.push({
|
|
122
|
+
after: subDays(selectedFrom, min - 1),
|
|
123
|
+
before: addDays(selectedFrom, min - 1)
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
if (selectedFrom && selectedTo) {
|
|
127
|
+
modifiers.disabled.push({
|
|
128
|
+
after: selectedFrom,
|
|
129
|
+
before: addDays(selectedFrom, min - 1)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
140
132
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
133
|
+
if (max) {
|
|
134
|
+
if (selectedFrom && !selectedTo) {
|
|
135
|
+
modifiers.disabled.push({
|
|
136
|
+
before: addDays(selectedFrom, -max + 1)
|
|
137
|
+
});
|
|
138
|
+
modifiers.disabled.push({
|
|
139
|
+
after: addDays(selectedFrom, max - 1)
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (selectedFrom && selectedTo) {
|
|
143
|
+
const selectedCount =
|
|
144
|
+
differenceInCalendarDays(selectedTo, selectedFrom) + 1;
|
|
145
|
+
const offset = max - selectedCount;
|
|
146
|
+
modifiers.disabled.push({
|
|
147
|
+
before: subDays(selectedFrom, offset)
|
|
148
|
+
});
|
|
149
|
+
modifiers.disabled.push({
|
|
150
|
+
after: addDays(selectedTo, offset)
|
|
151
|
+
});
|
|
152
|
+
}
|
|
151
153
|
}
|
|
152
154
|
|
|
153
155
|
return (
|
|
@@ -156,3 +158,16 @@ export function SelectRangeProviderInternal({
|
|
|
156
158
|
</SelectRangeContext.Provider>
|
|
157
159
|
);
|
|
158
160
|
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Hook to access the {@link SelectRangeContextValue}.
|
|
164
|
+
*
|
|
165
|
+
* This hook is meant to be used inside internal or custom components.
|
|
166
|
+
*/
|
|
167
|
+
export function useSelectRange(): SelectRangeContextValue {
|
|
168
|
+
const context = useContext(SelectRangeContext);
|
|
169
|
+
if (!context) {
|
|
170
|
+
throw new Error('useSelectRange must be used within a SelectRangeProvider');
|
|
171
|
+
}
|
|
172
|
+
return context;
|
|
173
|
+
}
|
|
@@ -7,7 +7,7 @@ import { DayPickerBase } from 'types/DayPickerBase';
|
|
|
7
7
|
import { DayPickerSingleProps } from 'types/DayPickerSingle';
|
|
8
8
|
import { ActiveModifiers } from 'types/Modifiers';
|
|
9
9
|
|
|
10
|
-
import { useSelectSingle } from './
|
|
10
|
+
import { useSelectSingle } from './SelectSingleContext';
|
|
11
11
|
|
|
12
12
|
const today = new Date(2021, 11, 8);
|
|
13
13
|
freezeBeforeAll(today);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext } from 'react';
|
|
1
|
+
import React, { createContext, useContext } from 'react';
|
|
2
2
|
|
|
3
3
|
import { DayPickerBase } from 'types/DayPickerBase';
|
|
4
4
|
import { DayPickerSingleProps, isDayPickerSingle } from 'types/DayPickerSingle';
|
|
@@ -78,3 +78,18 @@ export function SelectSingleProviderInternal({
|
|
|
78
78
|
</SelectSingleContext.Provider>
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Hook to access the {@link SelectSingleContextValue}.
|
|
84
|
+
*
|
|
85
|
+
* This hook is meant to be used inside internal or custom components.
|
|
86
|
+
*/
|
|
87
|
+
export function useSelectSingle(): SelectSingleContextValue {
|
|
88
|
+
const context = useContext(SelectSingleContext);
|
|
89
|
+
if (!context) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
'useSelectSingle must be used within a SelectSingleProvider'
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return context;
|
|
95
|
+
}
|
|
@@ -3,7 +3,6 @@ import React, { useEffect } from 'react';
|
|
|
3
3
|
import isSameDay from 'date-fns/isSameDay';
|
|
4
4
|
|
|
5
5
|
import { ButtonProps } from 'components/Button';
|
|
6
|
-
import { DayContent } from 'components/DayContent';
|
|
7
6
|
import { useDayPicker } from 'contexts/DayPicker';
|
|
8
7
|
import { useFocusContext } from 'contexts/Focus';
|
|
9
8
|
import { useActiveModifiers } from 'hooks/useActiveModifiers';
|
|
@@ -48,7 +47,10 @@ export function useDayRender(
|
|
|
48
47
|
/** A ref to the button element that will be target of focus when rendered (if required). */
|
|
49
48
|
buttonRef: React.RefObject<HTMLButtonElement>
|
|
50
49
|
): DayRender {
|
|
51
|
-
const
|
|
50
|
+
const {
|
|
51
|
+
components: { DayContent },
|
|
52
|
+
...dayPicker
|
|
53
|
+
} = useDayPicker();
|
|
52
54
|
const focusContext = useFocusContext();
|
|
53
55
|
const activeModifiers = useActiveModifiers(day, displayMonth);
|
|
54
56
|
const eventHandlers = useDayEventHandlers(day, activeModifiers);
|
|
@@ -83,9 +85,8 @@ export function useDayRender(
|
|
|
83
85
|
activeModifiers.hidden
|
|
84
86
|
);
|
|
85
87
|
|
|
86
|
-
const DayContentComponent = dayPicker.components?.DayContent ?? DayContent;
|
|
87
88
|
const children = (
|
|
88
|
-
<
|
|
89
|
+
<DayContent
|
|
89
90
|
date={day}
|
|
90
91
|
displayMonth={displayMonth}
|
|
91
92
|
activeModifiers={activeModifiers}
|
package/src/style.css
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
border: 2px solid transparent;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
.rdp-button[disabled] {
|
|
57
|
+
.rdp-button[disabled]:not(.rdp-day_selected) {
|
|
58
58
|
opacity: 0.25;
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -62,14 +62,13 @@
|
|
|
62
62
|
cursor: pointer;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
.rdp-button:focus-visible:not([disabled])
|
|
66
|
-
.rdp-button:active:not([disabled]) {
|
|
65
|
+
.rdp-button:focus-visible:not([disabled]) {
|
|
67
66
|
color: inherit;
|
|
68
67
|
background-color: var(--rdp-background-color);
|
|
69
68
|
border: var(--rdp-outline);
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
.rdp-button:hover:not([disabled]) {
|
|
71
|
+
.rdp-button:hover:not([disabled]):not(.rdp-day_selected) {
|
|
73
72
|
background-color: var(--rdp-background-color);
|
|
74
73
|
}
|
|
75
74
|
|
|
@@ -198,8 +197,7 @@
|
|
|
198
197
|
color: unset;
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
.rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label
|
|
202
|
-
.rdp-dropdown:active:not([disabled]) + .rdp-caption_label {
|
|
200
|
+
.rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label {
|
|
203
201
|
background-color: var(--rdp-background-color);
|
|
204
202
|
border: var(--rdp-outline);
|
|
205
203
|
border-radius: 6px;
|
|
@@ -268,15 +266,15 @@
|
|
|
268
266
|
font-weight: bold;
|
|
269
267
|
}
|
|
270
268
|
|
|
271
|
-
.rdp-day_selected
|
|
272
|
-
.rdp-day_selected:focus
|
|
273
|
-
.rdp-day_selected:
|
|
274
|
-
.rdp-day_selected:hover:not([disabled]) {
|
|
269
|
+
.rdp-day_selected,
|
|
270
|
+
.rdp-day_selected:focus-visible,
|
|
271
|
+
.rdp-day_selected:hover {
|
|
275
272
|
color: white;
|
|
273
|
+
opacity: 1;
|
|
276
274
|
background-color: var(--rdp-accent-color);
|
|
277
275
|
}
|
|
278
276
|
|
|
279
|
-
.rdp-day_selected:focus
|
|
277
|
+
.rdp-day_selected:focus-visible {
|
|
280
278
|
/* Since the background is the same use again the outline */
|
|
281
279
|
outline: var(--rdp-outline);
|
|
282
280
|
outline-offset: 2px;
|
|
@@ -68,6 +68,11 @@ export interface DayPickerBase {
|
|
|
68
68
|
*/
|
|
69
69
|
modifiersStyles?: ModifiersStyles;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* An unique id to replace the random generated id, used by DayPicker for accessibility.
|
|
73
|
+
*/
|
|
74
|
+
id?: string;
|
|
75
|
+
|
|
71
76
|
/**
|
|
72
77
|
* The initial month to show in the calendar. Default is the current month.
|
|
73
78
|
*
|
|
@@ -135,6 +140,7 @@ export interface DayPickerBase {
|
|
|
135
140
|
*
|
|
136
141
|
* **Note:** the `dropdown` layout is available only when `fromDate`,
|
|
137
142
|
* `fromMonth` or`fromYear` and `toDate`, `toMonth` or `toYear` are set.
|
|
143
|
+
*
|
|
138
144
|
*/
|
|
139
145
|
captionLayout?: CaptionLayout;
|
|
140
146
|
/**
|
|
@@ -152,9 +158,30 @@ export interface DayPickerBase {
|
|
|
152
158
|
*/
|
|
153
159
|
showOutsideDays?: boolean;
|
|
154
160
|
/**
|
|
155
|
-
* Show the week numbers column.
|
|
161
|
+
* Show the week numbers column. Weeks are numbered according to the local
|
|
162
|
+
* week index. To use ISO week numbering, use the {@link ISOWeek} prop.
|
|
163
|
+
*
|
|
164
|
+
* @defaultValue false
|
|
156
165
|
*/
|
|
157
166
|
showWeekNumber?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* The index of the first day of the week (0 - Sunday). Overrides the locale's one.
|
|
169
|
+
*/
|
|
170
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
171
|
+
/**
|
|
172
|
+
* The day of January, which is always in the first week of the year. See also
|
|
173
|
+
* https://date-fns.org/docs/getWeek and
|
|
174
|
+
* https://en.wikipedia.org/wiki/Week#Numbering
|
|
175
|
+
*/
|
|
176
|
+
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
177
|
+
/**
|
|
178
|
+
* Use ISO week dates instead of the locale setting. See also
|
|
179
|
+
* https://en.wikipedia.org/wiki/ISO_week_date.
|
|
180
|
+
*
|
|
181
|
+
* Setting this prop will ignore {@link weekStartsOn} and {@link firstWeekContainsDate}.
|
|
182
|
+
*/
|
|
183
|
+
ISOWeek?: boolean;
|
|
184
|
+
|
|
158
185
|
/**
|
|
159
186
|
* Map of components used to create the layout. Look at the [components source](https://github.com/gpbl/react-day-picker/tree/master/packages/react-day-picker/src/components) to understand how internal components are built.
|
|
160
187
|
*/
|
|
@@ -216,11 +243,6 @@ export interface DayPickerBase {
|
|
|
216
243
|
*/
|
|
217
244
|
formatters?: Partial<Formatters>;
|
|
218
245
|
|
|
219
|
-
/**
|
|
220
|
-
* The index of the first day of the week (0 - Sunday). Overrides the locale's one.
|
|
221
|
-
*/
|
|
222
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
223
|
-
|
|
224
246
|
onDayClick?: DayClickEventHandler;
|
|
225
247
|
onDayFocus?: DayFocusEventHandler;
|
|
226
248
|
onDayBlur?: DayFocusEventHandler;
|
|
@@ -283,3 +305,8 @@ export interface CustomComponents {
|
|
|
283
305
|
/** The component for the week number in the table rows. */
|
|
284
306
|
WeekNumber?: (props: WeekNumberProps) => JSX.Element | null;
|
|
285
307
|
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* All the components in use by DayPicker that can be customized via the {@link components} prop.
|
|
311
|
+
*/
|
|
312
|
+
export type Components = Required<CustomComponents>;
|
|
@@ -57,17 +57,15 @@ export type SelectRangeEventHandler = (
|
|
|
57
57
|
) => void;
|
|
58
58
|
|
|
59
59
|
/** The event handler when selecting a single day. */
|
|
60
|
-
export
|
|
61
|
-
(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
): void;
|
|
70
|
-
}
|
|
60
|
+
export type SelectSingleEventHandler = (
|
|
61
|
+
/** The selected day, `undefined` when `required={false}` (default) and the day is clicked again. */
|
|
62
|
+
day: Date | undefined,
|
|
63
|
+
/** The day that was selected (or clicked) triggering the event. */
|
|
64
|
+
selectedDay: Date,
|
|
65
|
+
/** The modifiers of the selected day. */
|
|
66
|
+
activeModifiers: ActiveModifiers,
|
|
67
|
+
e: React.MouseEvent
|
|
68
|
+
) => void;
|
|
71
69
|
|
|
72
70
|
/**The event handler when the week number is clicked. */
|
|
73
71
|
export type WeekNumberClickEventHandler = (
|
package/src/types/Matchers.ts
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
*
|
|
43
43
|
* // will match when the function return true
|
|
44
44
|
* const functionMatcher: Matcher = (day: Date) => {
|
|
45
|
-
* return
|
|
45
|
+
* return day.getMonth() === 2 // match when month is March
|
|
46
46
|
* };
|
|
47
47
|
* ```
|
|
48
48
|
*
|
package/dist/DayPicker.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { DayPickerDefaultProps } from './types/DayPickerDefault';
|
|
2
|
-
import { DayPickerMultipleProps } from './types/DayPickerMultiple';
|
|
3
|
-
import { DayPickerRangeProps } from './types/DayPickerRange';
|
|
4
|
-
import { DayPickerSingleProps } from './types/DayPickerSingle';
|
|
5
|
-
export declare type DayPickerProps = DayPickerDefaultProps | DayPickerSingleProps | DayPickerMultipleProps | DayPickerRangeProps;
|
|
6
|
-
/**
|
|
7
|
-
* DayPicker render a date picker component to let users pick dates from a
|
|
8
|
-
* calendar. See http://react-day-picker.js.org for updated documentation and
|
|
9
|
-
* examples.
|
|
10
|
-
*
|
|
11
|
-
* ### Customization
|
|
12
|
-
*
|
|
13
|
-
* DayPicker offers different customization props. For example,
|
|
14
|
-
*
|
|
15
|
-
* - show multiple months using `numberOfMonths`
|
|
16
|
-
* - display a dropdown to navigate the months via `captionLayout`
|
|
17
|
-
* - display the week numbers with `showWeekNumbers`
|
|
18
|
-
* - disable or hide days with `disabled` or `hidden`
|
|
19
|
-
*
|
|
20
|
-
* ### Controlling the months
|
|
21
|
-
*
|
|
22
|
-
* Change the initially displayed month using the `defaultMonth` prop. The
|
|
23
|
-
* displayed months are controlled by DayPicker and stored in its internal
|
|
24
|
-
* state. To control the months yourself, use `month` instead of `defaultMonth`
|
|
25
|
-
* and use the `onMonthChange` event to set it.
|
|
26
|
-
*
|
|
27
|
-
* To limit the months the user can navigate to, use
|
|
28
|
-
* `fromDate`/`fromMonth`/`fromYear` or `toDate`/`toMonth`/`toYear`.
|
|
29
|
-
*
|
|
30
|
-
* ### Selection modes
|
|
31
|
-
*
|
|
32
|
-
* DayPicker supports different selection mode that can be toggled using the
|
|
33
|
-
* `mode` prop:
|
|
34
|
-
*
|
|
35
|
-
* - `mode="single"`: only one day can be selected. Use `required` to make the
|
|
36
|
-
* selection required. Use the `onSelect` event handler to get the selected
|
|
37
|
-
* days.
|
|
38
|
-
* - `mode="multiple"`: users can select one or more days. Limit the amount of
|
|
39
|
-
* days that can be selected with the `min` or the `max` props.
|
|
40
|
-
* - `mode="range"`: users can select a range of days. Limit the amount of days
|
|
41
|
-
* in the range with the `min` or the `max` props.
|
|
42
|
-
* - `mode="default"` (default): the built-in selections are disabled. Implement
|
|
43
|
-
* your own selection mode with `onDayClick`.
|
|
44
|
-
*
|
|
45
|
-
* The selection modes should cover the most common use cases. In case you
|
|
46
|
-
* need a more refined way of selecting days, use `mode="default"`. Use the
|
|
47
|
-
* `selected` props and add the day event handlers to add/remove days from the
|
|
48
|
-
* selection.
|
|
49
|
-
*
|
|
50
|
-
* ### Modifiers
|
|
51
|
-
*
|
|
52
|
-
* A _modifier_ represents different styles or states for the days displayed in
|
|
53
|
-
* the calendar (like "selected" or "disabled"). Define custom modifiers using
|
|
54
|
-
* the `modifiers` prop.
|
|
55
|
-
*
|
|
56
|
-
* ### Formatters and custom component
|
|
57
|
-
*
|
|
58
|
-
* You can customize how the content is displayed in the date picker by using
|
|
59
|
-
* either the formatters or replacing the internal components.
|
|
60
|
-
*
|
|
61
|
-
* For the most common cases you want to use the `formatters` prop to change how
|
|
62
|
-
* the content is formatted in the calendar. Use the `components` prop to
|
|
63
|
-
* replace the internal components, like the navigation icons.
|
|
64
|
-
*
|
|
65
|
-
* ### Styling
|
|
66
|
-
*
|
|
67
|
-
* DayPicker comes with a default, basic style in `react-day-picker/style` – use
|
|
68
|
-
* it as template for your own style.
|
|
69
|
-
*
|
|
70
|
-
* If you are using CSS modules, pass the imported styles object the
|
|
71
|
-
* `classNames` props.
|
|
72
|
-
*
|
|
73
|
-
* You can also style the elements via inline-styles using the `styles` prop.
|
|
74
|
-
*
|
|
75
|
-
* ### Form fields
|
|
76
|
-
*
|
|
77
|
-
* If you need to bind the date picker to a form field, you can use the
|
|
78
|
-
* `useInput` hooks for a basic behavior. See the `useInput` source as an
|
|
79
|
-
* example to bind the date picker with form fields.
|
|
80
|
-
*
|
|
81
|
-
* ### Localization
|
|
82
|
-
*
|
|
83
|
-
* To localize DayPicker, import the locale from `date-fns` package and use the
|
|
84
|
-
* `locale` prop.
|
|
85
|
-
*
|
|
86
|
-
* For example, to use Spanish locale:
|
|
87
|
-
*
|
|
88
|
-
* ```
|
|
89
|
-
* import es from 'date-fns/locale/es';
|
|
90
|
-
* <DayPicker locale={es} />
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
export declare function DayPicker(props: DayPickerDefaultProps | DayPickerSingleProps | DayPickerMultipleProps | DayPickerRangeProps): JSX.Element;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/** The props for the {@link Button} component. */
|
|
3
|
-
export declare type ButtonProps = React.HTMLProps<HTMLButtonElement>;
|
|
4
|
-
/**
|
|
5
|
-
* Render a button HTML element applying the reset class name.
|
|
6
|
-
*/
|
|
7
|
-
export declare const Button: React.ForwardRefExoticComponent<Pick<ButtonProps, "multiple" | "default" | "className" | "style" | "disabled" | "hidden" | "selected" | "dir" | "onSelect" | "required" | "min" | "max" | "start" | "color" | "content" | "size" | "wrap" | "open" | "cite" | "data" | "form" | "label" | "slot" | "span" | "summary" | "title" | "pattern" | "children" | "value" | "id" | "aria-label" | "onChange" | "name" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "maxLength" | "media" | "mediaGroup" | "method" | "minLength" | "muted" | "nonce" | "noValidate" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Button';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** Represent the props of the {@link Caption} component. */
|
|
2
|
-
export interface CaptionProps {
|
|
3
|
-
/** The ID for the heading element. Must be the same as the labelled-by in Table. */
|
|
4
|
-
id?: string;
|
|
5
|
-
/** The month where the caption is displayed. */
|
|
6
|
-
displayMonth: Date;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* The layout of the caption:
|
|
10
|
-
*
|
|
11
|
-
* - `dropdown`: display dropdowns for choosing the month and the year.
|
|
12
|
-
* - `buttons`: display previous month / next month buttons.
|
|
13
|
-
*/
|
|
14
|
-
export declare type CaptionLayout = 'dropdown' | 'buttons';
|
|
15
|
-
/**
|
|
16
|
-
* Render the caption of a month. The caption has a different layout when
|
|
17
|
-
* setting the {@link DayPickerBase.captionLayout} prop.
|
|
18
|
-
*/
|
|
19
|
-
export declare function Caption(props: CaptionProps): JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Caption';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './CaptionDropdowns';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** The props for the {@link CaptionLabel} component. */
|
|
2
|
-
export interface CaptionLabelProps {
|
|
3
|
-
/** The ID for the heading element. Must be the same as the labelled-by in Table. */
|
|
4
|
-
id?: string;
|
|
5
|
-
/** The month where the caption is displayed. */
|
|
6
|
-
displayMonth: Date;
|
|
7
|
-
}
|
|
8
|
-
/** Render the caption for the displayed month. This component is used when `captionLayout="buttons"`. */
|
|
9
|
-
export declare function CaptionLabel(props: CaptionLabelProps): JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './CaptionLabel';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './CaptionNavigation';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** Represent the props used by the {@link Day} component. */
|
|
2
|
-
export interface DayProps {
|
|
3
|
-
/** The month where the date is displayed. */
|
|
4
|
-
displayMonth: Date;
|
|
5
|
-
/** The date to render. */
|
|
6
|
-
date: Date;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* The content of a day cell – as a button or span element according to its
|
|
10
|
-
* modifiers.
|
|
11
|
-
*/
|
|
12
|
-
export declare function Day(props: DayProps): JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Day';
|