react-day-picker 8.8.2 → 8.9.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 +3 -3
- package/dist/index.d.ts +125 -55
- package/dist/index.esm.js +1481 -101
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1505 -142
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +10 -1
- package/dist/index.min.js.map +1 -1
- package/dist/style.css +8 -7
- package/dist/style.css.map +1 -1
- package/dist/style.module.css +8 -7
- package/package.json +27 -27
- package/src/DayPicker.tsx +0 -2
- package/src/components/Button/Button.test.tsx +0 -2
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Caption/Caption.test.tsx +0 -2
- package/src/components/Caption/Caption.tsx +0 -2
- package/src/components/CaptionDropdowns/CaptionDropdowns.test.tsx +0 -2
- package/src/components/CaptionDropdowns/CaptionDropdowns.tsx +0 -2
- package/src/components/CaptionLabel/CaptionLabel.test.tsx +0 -2
- package/src/components/CaptionLabel/CaptionLabel.tsx +0 -2
- package/src/components/CaptionNavigation/CaptionNavigation.test.tsx +0 -2
- package/src/components/CaptionNavigation/CaptionNavigation.tsx +3 -3
- package/src/components/Day/Day.test.tsx +0 -2
- package/src/components/Day/Day.tsx +1 -1
- package/src/components/DayContent/DayContent.test.tsx +0 -2
- package/src/components/DayContent/DayContent.tsx +0 -2
- package/src/components/Dropdown/Dropdown.test.tsx +0 -2
- package/src/components/Dropdown/Dropdown.tsx +10 -5
- package/src/components/Footer/Footer.test.tsx +0 -2
- package/src/components/Footer/Footer.tsx +0 -2
- package/src/components/Head/Head.test.tsx +0 -2
- package/src/components/Head/Head.tsx +0 -2
- package/src/components/HeadRow/HeadRow.test.tsx +0 -2
- package/src/components/HeadRow/HeadRow.tsx +0 -2
- package/src/components/IconDropdown/IconDropdown.test.tsx +0 -2
- package/src/components/IconDropdown/IconDropdown.tsx +0 -2
- package/src/components/IconLeft/IconLeft.test.tsx +0 -2
- package/src/components/IconLeft/IconLeft.tsx +0 -2
- package/src/components/IconRight/IconRight.test.tsx +0 -2
- package/src/components/IconRight/IconRight.tsx +0 -2
- package/src/components/Month/Month.test.tsx +0 -2
- package/src/components/Month/Month.tsx +0 -2
- package/src/components/Months/Months.test.tsx +27 -0
- package/src/components/Months/Months.tsx +19 -0
- package/src/components/Months/index.ts +1 -0
- package/src/components/MonthsDropdown/MonthsDropdown.test.tsx +0 -2
- package/src/components/MonthsDropdown/MonthsDropdown.tsx +2 -2
- package/src/components/Navigation/Navigation.test.tsx +0 -2
- package/src/components/Navigation/Navigation.tsx +3 -3
- package/src/components/Root/Root.test.tsx +58 -15
- package/src/components/Root/Root.tsx +9 -6
- package/src/components/Row/Row.test.tsx +0 -2
- package/src/components/Row/Row.tsx +0 -2
- package/src/components/Table/Table.test.tsx +0 -2
- package/src/components/Table/Table.tsx +0 -2
- package/src/components/WeekNumber/WeekNumber.test.tsx +1 -3
- package/src/components/WeekNumber/WeekNumber.tsx +2 -2
- package/src/components/YearsDropdown/YearsDropdown.test.tsx +0 -2
- package/src/components/YearsDropdown/YearsDropdown.tsx +2 -2
- package/src/contexts/DayPicker/DayPickerContext.tsx +1 -1
- package/src/contexts/Focus/FocusContext.tsx +4 -2
- package/src/contexts/Modifiers/ModifiersContext.tsx +2 -4
- package/src/contexts/Navigation/NavigationContext.tsx +1 -1
- package/src/contexts/RootProvider.tsx +2 -4
- package/src/contexts/SelectMultiple/SelectMultipleContext.test.ts +6 -4
- package/src/contexts/SelectMultiple/SelectMultipleContext.tsx +1 -1
- package/src/contexts/SelectRange/SelectRangeContext.test.ts +3 -1
- package/src/contexts/SelectRange/SelectRangeContext.tsx +3 -5
- package/src/contexts/SelectSingle/SelectSingleContext.test.ts +3 -3
- package/src/contexts/SelectSingle/SelectSingleContext.tsx +3 -3
- package/src/hooks/useControlledValue/useControlledValue.ts +2 -2
- package/src/hooks/useDayRender/useDayRender.tsx +2 -2
- package/src/hooks/useDayRender/utils/getDayStyle.ts +4 -2
- package/src/hooks/useId/useId.ts +5 -7
- package/src/hooks/useId/useIsomorphicLayoutEffect.ts +31 -0
- package/src/hooks/useInput/useInput.ts +13 -8
- package/src/index.ts +1 -0
- package/src/style.css +8 -7
- package/src/types/DayPickerBase.ts +84 -10
- package/src/types/EventHandlers.ts +18 -10
- package/src/types/Formatters.ts +3 -3
- package/src/types/Modifiers.ts +4 -2
- package/src/types/Styles.ts +5 -5
- package/tsconfig.json +5 -3
package/README.md
CHANGED
|
@@ -45,14 +45,14 @@ yarn add react-day-picker date-fns # using yarn
|
|
|
45
45
|
## Example
|
|
46
46
|
|
|
47
47
|
```tsx
|
|
48
|
-
import
|
|
49
|
-
|
|
48
|
+
import { useState } from 'react';
|
|
50
49
|
import { format } from 'date-fns';
|
|
50
|
+
|
|
51
51
|
import { DayPicker } from 'react-day-picker';
|
|
52
52
|
import 'react-day-picker/dist/style.css';
|
|
53
53
|
|
|
54
54
|
export default function Example() {
|
|
55
|
-
const [selected, setSelected] =
|
|
55
|
+
const [selected, setSelected] = useState<Date>();
|
|
56
56
|
|
|
57
57
|
let footer = <p>Please pick a day.</p>;
|
|
58
58
|
if (selected) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Locale as Locale$1 } from 'date-fns';
|
|
2
|
-
import
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { CSSProperties, ReactNode, SelectHTMLAttributes, ChangeEventHandler, PropsWithChildren, MouseEvent, FocusEvent, KeyboardEvent, PointerEvent, TouchEvent, InputHTMLAttributes, HTMLProps, RefObject } from 'react';
|
|
3
4
|
|
|
4
5
|
/** Represent the props of the {@link Caption} component. */
|
|
5
6
|
interface CaptionProps {
|
|
@@ -171,7 +172,7 @@ type InternalModifiers = Record<InternalModifier, Matcher[]>;
|
|
|
171
172
|
* */
|
|
172
173
|
type ActiveModifiers = Record<Modifier, true> & Partial<Record<InternalModifier, true>>;
|
|
173
174
|
/** The style to apply to each day element matching a modifier. */
|
|
174
|
-
type ModifiersStyles = Record<Modifier,
|
|
175
|
+
type ModifiersStyles = Record<Modifier, CSSProperties> & Partial<Record<InternalModifier, CSSProperties>>;
|
|
175
176
|
/** The classnames to assign to each day element matching a modifier. */
|
|
176
177
|
type ModifiersClassNames = Record<Modifier, string> & Partial<Record<InternalModifier, string>>;
|
|
177
178
|
/** The custom modifiers passed to the {@link DayPickerBase.modifiers}. */
|
|
@@ -199,14 +200,14 @@ interface DropdownProps {
|
|
|
199
200
|
/** The name attribute of the element. */
|
|
200
201
|
name?: string;
|
|
201
202
|
/** The caption displayed to replace the hidden select. */
|
|
202
|
-
caption?:
|
|
203
|
-
children?:
|
|
203
|
+
caption?: ReactNode;
|
|
204
|
+
children?: SelectHTMLAttributes<HTMLSelectElement>['children'];
|
|
204
205
|
className?: string;
|
|
205
206
|
['aria-label']?: string;
|
|
206
|
-
style?:
|
|
207
|
+
style?: CSSProperties;
|
|
207
208
|
/** The selected value. */
|
|
208
209
|
value?: string | number;
|
|
209
|
-
onChange?:
|
|
210
|
+
onChange?: ChangeEventHandler<HTMLSelectElement>;
|
|
210
211
|
}
|
|
211
212
|
/**
|
|
212
213
|
* Render a styled select component – displaying a caption and a custom
|
|
@@ -221,6 +222,13 @@ interface FooterProps {
|
|
|
221
222
|
/** Render the Footer component (empty as default).*/
|
|
222
223
|
declare function Footer(props: FooterProps): JSX.Element;
|
|
223
224
|
|
|
225
|
+
/** The props for the {@link Months} component. */
|
|
226
|
+
type MonthsProps = PropsWithChildren;
|
|
227
|
+
/**
|
|
228
|
+
* Render the wrapper for the mont grids.
|
|
229
|
+
*/
|
|
230
|
+
declare function Months(props: MonthsProps): JSX.Element;
|
|
231
|
+
|
|
224
232
|
/**
|
|
225
233
|
* The props for the {@link Row} component.
|
|
226
234
|
*/
|
|
@@ -251,15 +259,15 @@ interface WeekNumberProps {
|
|
|
251
259
|
declare function WeekNumber(props: WeekNumberProps): JSX.Element;
|
|
252
260
|
|
|
253
261
|
/** The event handler when a day is clicked. */
|
|
254
|
-
type DayClickEventHandler = (day: Date, activeModifiers: ActiveModifiers, e:
|
|
262
|
+
type DayClickEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: MouseEvent) => void;
|
|
255
263
|
/** The event handler when a day is focused. */
|
|
256
|
-
type DayFocusEventHandler = (day: Date, activeModifiers: ActiveModifiers, e:
|
|
264
|
+
type DayFocusEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: FocusEvent | KeyboardEvent) => void;
|
|
257
265
|
/** The event handler when a day gets a keyboard event. */
|
|
258
|
-
type DayKeyboardEventHandler = (day: Date, activeModifiers: ActiveModifiers, e:
|
|
266
|
+
type DayKeyboardEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: KeyboardEvent) => void;
|
|
259
267
|
/** The event handler when a day gets a mouse event. */
|
|
260
|
-
type DayMouseEventHandler = (day: Date, activeModifiers: ActiveModifiers, e:
|
|
268
|
+
type DayMouseEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: MouseEvent) => void;
|
|
261
269
|
/** The event handler when a day gets a pointer event. */
|
|
262
|
-
type DayPointerEventHandler = (day: Date, activeModifiers: ActiveModifiers, e:
|
|
270
|
+
type DayPointerEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: PointerEvent) => void;
|
|
263
271
|
/** The event handler when a month is changed in the calendar. */
|
|
264
272
|
type MonthChangeEventHandler = (month: Date) => void;
|
|
265
273
|
/** The event handler when selecting multiple days. */
|
|
@@ -271,7 +279,7 @@ selectedDay: Date,
|
|
|
271
279
|
/** The day that was clicked */
|
|
272
280
|
activeModifiers: ActiveModifiers,
|
|
273
281
|
/** The mouse event that triggered this event. */
|
|
274
|
-
e:
|
|
282
|
+
e: MouseEvent) => void;
|
|
275
283
|
/** The event handler when selecting a range of days. */
|
|
276
284
|
type SelectRangeEventHandler = (
|
|
277
285
|
/** The current range of the selected days. */
|
|
@@ -279,7 +287,7 @@ range: DateRange | undefined,
|
|
|
279
287
|
/** The day that was selected (or clicked) triggering the event. */
|
|
280
288
|
selectedDay: Date,
|
|
281
289
|
/** The modifiers of the selected day. */
|
|
282
|
-
activeModifiers: ActiveModifiers, e:
|
|
290
|
+
activeModifiers: ActiveModifiers, e: MouseEvent) => void;
|
|
283
291
|
/** The event handler when selecting a single day. */
|
|
284
292
|
type SelectSingleEventHandler = (
|
|
285
293
|
/** The selected day, `undefined` when `required={false}` (default) and the day is clicked again. */
|
|
@@ -287,7 +295,7 @@ day: Date | undefined,
|
|
|
287
295
|
/** The day that was selected (or clicked) triggering the event. */
|
|
288
296
|
selectedDay: Date,
|
|
289
297
|
/** The modifiers of the selected day. */
|
|
290
|
-
activeModifiers: ActiveModifiers, e:
|
|
298
|
+
activeModifiers: ActiveModifiers, e: MouseEvent) => void;
|
|
291
299
|
/**The event handler when the week number is clicked. */
|
|
292
300
|
type WeekNumberClickEventHandler = (
|
|
293
301
|
/** The week number that has been clicked. */
|
|
@@ -295,14 +303,14 @@ weekNumber: number,
|
|
|
295
303
|
/** The dates in the clicked week. */
|
|
296
304
|
dates: Date[],
|
|
297
305
|
/** The mouse event that triggered this event. */
|
|
298
|
-
e:
|
|
306
|
+
e: MouseEvent) => void;
|
|
299
307
|
/** The event handler when a day gets a touch event. */
|
|
300
|
-
type DayTouchEventHandler = (day: Date, activeModifiers: ActiveModifiers, e:
|
|
308
|
+
type DayTouchEventHandler = (day: Date, activeModifiers: ActiveModifiers, e: TouchEvent) => void;
|
|
301
309
|
|
|
302
310
|
/** Represents a function to format a date. */
|
|
303
311
|
type DateFormatter = (date: Date, options?: {
|
|
304
312
|
locale?: Locale;
|
|
305
|
-
}) =>
|
|
313
|
+
}) => ReactNode;
|
|
306
314
|
/** Represent a map of formatters used to render localized content. */
|
|
307
315
|
type Formatters = {
|
|
308
316
|
/** Format the month in the caption when `captionLayout` is `buttons`. */
|
|
@@ -321,7 +329,7 @@ type Formatters = {
|
|
|
321
329
|
/** Represent a function to format the week number. */
|
|
322
330
|
type WeekNumberFormatter = (weekNumber: number, options?: {
|
|
323
331
|
locale?: Locale;
|
|
324
|
-
}) =>
|
|
332
|
+
}) => ReactNode;
|
|
325
333
|
|
|
326
334
|
/** Map of functions to translate ARIA labels for the relative elements. */
|
|
327
335
|
type Labels = {
|
|
@@ -352,7 +360,7 @@ type WeekNumberLabel = (n: number, options?: {
|
|
|
352
360
|
}) => string;
|
|
353
361
|
|
|
354
362
|
/** The style (either via class names or via in-line styles) of an element. */
|
|
355
|
-
type StyledElement<T = string |
|
|
363
|
+
type StyledElement<T = string | CSSProperties> = {
|
|
356
364
|
/** The root element. */
|
|
357
365
|
readonly root: T;
|
|
358
366
|
/** The root element when `numberOfMonths > 1`. */
|
|
@@ -445,12 +453,12 @@ type ClassNames = Partial<StyledElement<string>>;
|
|
|
445
453
|
* modifiers, such as `today` or `hidden`, should be styled using the
|
|
446
454
|
* `modifiersStyles` prop.
|
|
447
455
|
*/
|
|
448
|
-
type Styles = Partial<Omit<StyledElement<
|
|
456
|
+
type Styles = Partial<Omit<StyledElement<CSSProperties>, InternalModifiersElement>>;
|
|
449
457
|
/** Props of a component that can be styled via classNames or inline-styles. */
|
|
450
458
|
type StyledComponent = {
|
|
451
459
|
className?: string;
|
|
452
|
-
style?:
|
|
453
|
-
children?:
|
|
460
|
+
style?: CSSProperties;
|
|
461
|
+
children?: ReactNode;
|
|
454
462
|
};
|
|
455
463
|
|
|
456
464
|
/**
|
|
@@ -486,7 +494,7 @@ interface DayPickerBase {
|
|
|
486
494
|
/**
|
|
487
495
|
* Style to apply to the container element.
|
|
488
496
|
*/
|
|
489
|
-
style?:
|
|
497
|
+
style?: CSSProperties;
|
|
490
498
|
/**
|
|
491
499
|
* Change the inline styles of the HTML elements.
|
|
492
500
|
*/
|
|
@@ -643,7 +651,7 @@ interface DayPickerBase {
|
|
|
643
651
|
/**
|
|
644
652
|
* Content to add to the table footer element.
|
|
645
653
|
*/
|
|
646
|
-
footer?:
|
|
654
|
+
footer?: ReactNode;
|
|
647
655
|
/**
|
|
648
656
|
* When a selection mode is set, DayPicker will focus the first selected day
|
|
649
657
|
* (if set) or the today's date (if not disabled).
|
|
@@ -685,33 +693,98 @@ interface DayPickerBase {
|
|
|
685
693
|
* ARIA labels attributes.
|
|
686
694
|
*/
|
|
687
695
|
labels?: Partial<Labels>;
|
|
696
|
+
/**
|
|
697
|
+
* A map of formatters. Use the formatters to override the default formatting
|
|
698
|
+
* functions.
|
|
699
|
+
*/
|
|
700
|
+
formatters?: Partial<Formatters>;
|
|
688
701
|
/**
|
|
689
702
|
* The text direction of the calendar. Use `ltr` for left-to-right (default)
|
|
690
703
|
* or `rtl` for right-to-left.
|
|
691
704
|
*/
|
|
692
|
-
dir?:
|
|
705
|
+
dir?: HTMLDivElement['dir'];
|
|
693
706
|
/**
|
|
694
|
-
* A
|
|
695
|
-
*
|
|
707
|
+
* A cryptographic nonce ("number used once") which can be used by Content
|
|
708
|
+
* Security Policy for the inline `style` attributes.
|
|
709
|
+
**/
|
|
710
|
+
nonce?: HTMLDivElement['nonce'];
|
|
711
|
+
/**
|
|
712
|
+
* Add a `title` attribute to the container element.
|
|
713
|
+
**/
|
|
714
|
+
title?: HTMLDivElement['title'];
|
|
715
|
+
/**
|
|
716
|
+
* Add the language tag to the container element.
|
|
717
|
+
**/
|
|
718
|
+
lang?: HTMLDivElement['lang'];
|
|
719
|
+
/**
|
|
720
|
+
* Event callback fired when the next month button is clicked.
|
|
721
|
+
*/
|
|
722
|
+
onNextClick?: MonthChangeEventHandler;
|
|
723
|
+
/**
|
|
724
|
+
* Event callback fired when the previous month button is clicked.
|
|
725
|
+
*/
|
|
726
|
+
onPrevClick?: MonthChangeEventHandler;
|
|
727
|
+
/**
|
|
728
|
+
* Event callback fired when the week number is clicked. Requires
|
|
729
|
+
* `showWeekNumbers` set.
|
|
730
|
+
*/
|
|
731
|
+
onWeekNumberClick?: WeekNumberClickEventHandler;
|
|
732
|
+
/**
|
|
733
|
+
* Event callback fired when the user clicks on a day.
|
|
696
734
|
*/
|
|
697
|
-
formatters?: Partial<Formatters>;
|
|
698
735
|
onDayClick?: DayClickEventHandler;
|
|
736
|
+
/**
|
|
737
|
+
* Event callback fired when the user focuses on a day.
|
|
738
|
+
*/
|
|
699
739
|
onDayFocus?: DayFocusEventHandler;
|
|
740
|
+
/**
|
|
741
|
+
* Event callback fired when the user blurs from a day.
|
|
742
|
+
*/
|
|
700
743
|
onDayBlur?: DayFocusEventHandler;
|
|
744
|
+
/**
|
|
745
|
+
* Event callback fired when the user hovers on a day.
|
|
746
|
+
*/
|
|
701
747
|
onDayMouseEnter?: DayMouseEventHandler;
|
|
748
|
+
/**
|
|
749
|
+
* Event callback fired when the user hovers away from a day.
|
|
750
|
+
*/
|
|
702
751
|
onDayMouseLeave?: DayMouseEventHandler;
|
|
752
|
+
/**
|
|
753
|
+
* Event callback fired when the user presses a key on a day.
|
|
754
|
+
*/
|
|
703
755
|
onDayKeyDown?: DayKeyboardEventHandler;
|
|
756
|
+
/**
|
|
757
|
+
* Event callback fired when the user presses a key on a day.
|
|
758
|
+
*/
|
|
704
759
|
onDayKeyUp?: DayKeyboardEventHandler;
|
|
760
|
+
/**
|
|
761
|
+
* Event callback fired when the user presses a key on a day.
|
|
762
|
+
*/
|
|
705
763
|
onDayKeyPress?: DayKeyboardEventHandler;
|
|
764
|
+
/**
|
|
765
|
+
* Event callback fired when the pointer enters a day.
|
|
766
|
+
*/
|
|
706
767
|
onDayPointerEnter?: DayPointerEventHandler;
|
|
768
|
+
/**
|
|
769
|
+
* Event callback fired when the pointer leaves a day.
|
|
770
|
+
*/
|
|
707
771
|
onDayPointerLeave?: DayPointerEventHandler;
|
|
772
|
+
/**
|
|
773
|
+
* Event callback when a day touch event is canceled.
|
|
774
|
+
*/
|
|
708
775
|
onDayTouchCancel?: DayTouchEventHandler;
|
|
776
|
+
/**
|
|
777
|
+
* Event callback when a day touch event ends.
|
|
778
|
+
*/
|
|
709
779
|
onDayTouchEnd?: DayTouchEventHandler;
|
|
780
|
+
/**
|
|
781
|
+
* Event callback when a day touch event moves.
|
|
782
|
+
*/
|
|
710
783
|
onDayTouchMove?: DayTouchEventHandler;
|
|
784
|
+
/**
|
|
785
|
+
* Event callback when a day touch event starts.
|
|
786
|
+
*/
|
|
711
787
|
onDayTouchStart?: DayTouchEventHandler;
|
|
712
|
-
onNextClick?: MonthChangeEventHandler;
|
|
713
|
-
onPrevClick?: MonthChangeEventHandler;
|
|
714
|
-
onWeekNumberClick?: WeekNumberClickEventHandler;
|
|
715
788
|
}
|
|
716
789
|
/**
|
|
717
790
|
* Map of the components that can be changed using the `components` prop.
|
|
@@ -731,7 +804,7 @@ interface CustomComponents {
|
|
|
731
804
|
* Each `Day` in DayPicker should render one of the following, according to
|
|
732
805
|
* the return value of {@link useDayRender}.
|
|
733
806
|
*
|
|
734
|
-
* - an empty `
|
|
807
|
+
* - an empty `Fragment`, to render if `isHidden` is true
|
|
735
808
|
* - a `button` element, when the day is interactive, e.g. is selectable
|
|
736
809
|
* - a `div` or a `span` element, when the day is not interactive
|
|
737
810
|
*
|
|
@@ -753,6 +826,8 @@ interface CustomComponents {
|
|
|
753
826
|
IconRight?: (props: StyledComponent) => JSX.Element | null;
|
|
754
827
|
/** The arrow left icon (used for the Navigation buttons). */
|
|
755
828
|
IconLeft?: (props: StyledComponent) => JSX.Element | null;
|
|
829
|
+
/** The component wrapping the month grids. */
|
|
830
|
+
Months?: (props: MonthsProps) => JSX.Element | null;
|
|
756
831
|
/** The component for the table rows. */
|
|
757
832
|
Row?: (props: RowProps) => JSX.Element | null;
|
|
758
833
|
/** The component for the week number in the table rows. */
|
|
@@ -823,7 +898,7 @@ interface DayPickerContextValue extends DayPickerBase {
|
|
|
823
898
|
*
|
|
824
899
|
* Access to this context from the {@link useDayPicker} hook.
|
|
825
900
|
*/
|
|
826
|
-
declare const DayPickerContext:
|
|
901
|
+
declare const DayPickerContext: react.Context<DayPickerContextValue | undefined>;
|
|
827
902
|
/** The props for the {@link DayPickerProvider}. */
|
|
828
903
|
interface DayPickerProviderProps {
|
|
829
904
|
/** The initial props from the DayPicker component. */
|
|
@@ -951,7 +1026,7 @@ declare function DayPicker(props: DayPickerDefaultProps | DayPickerSingleProps |
|
|
|
951
1026
|
/** The props for the {@link Button} component. */
|
|
952
1027
|
type ButtonProps = JSX.IntrinsicElements['button'];
|
|
953
1028
|
/** Render a button HTML element applying the reset class name. */
|
|
954
|
-
declare const Button:
|
|
1029
|
+
declare const Button: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
955
1030
|
|
|
956
1031
|
/**
|
|
957
1032
|
* Render a caption with the dropdowns to navigate between months and years.
|
|
@@ -987,7 +1062,7 @@ declare function IconRight(props: StyledComponent): JSX.Element;
|
|
|
987
1062
|
declare function IconLeft(props: StyledComponent): JSX.Element;
|
|
988
1063
|
|
|
989
1064
|
/** The props to attach to the input field when using {@link useInput}. */
|
|
990
|
-
type
|
|
1065
|
+
type InputProps = Pick<InputHTMLAttributes<HTMLInputElement>, 'onBlur' | 'onChange' | 'onFocus' | 'value' | 'placeholder'>;
|
|
991
1066
|
/** The props to attach to the DayPicker component when using {@link useInput}. */
|
|
992
1067
|
type InputDayPickerProps = Pick<DayPickerSingleProps, 'fromDate' | 'toDate' | 'locale' | 'month' | 'onDayClick' | 'onMonthChange' | 'selected' | 'today'>;
|
|
993
1068
|
interface UseInputOptions extends Pick<DayPickerBase, 'locale' | 'fromDate' | 'toDate' | 'fromMonth' | 'toMonth' | 'fromYear' | 'toYear' | 'today'> {
|
|
@@ -1008,7 +1083,7 @@ interface UseInputValue {
|
|
|
1008
1083
|
/** The props to pass to a DayPicker component. */
|
|
1009
1084
|
dayPickerProps: InputDayPickerProps;
|
|
1010
1085
|
/** The props to pass to an input field. */
|
|
1011
|
-
inputProps:
|
|
1086
|
+
inputProps: InputProps;
|
|
1012
1087
|
/** A function to reset to the initial state. */
|
|
1013
1088
|
reset: () => void;
|
|
1014
1089
|
/** A function to set the selected day. */
|
|
@@ -1047,7 +1122,7 @@ day: Date,
|
|
|
1047
1122
|
/** The month where the date is displayed (if not the same as `date`, it means it is an "outside" day). */
|
|
1048
1123
|
displayMonth: Date,
|
|
1049
1124
|
/** A ref to the button element that will be target of focus when rendered (if required). */
|
|
1050
|
-
buttonRef:
|
|
1125
|
+
buttonRef: RefObject<HTMLButtonElement>): DayRender;
|
|
1051
1126
|
|
|
1052
1127
|
/**
|
|
1053
1128
|
* Return the active modifiers for the specified day.
|
|
@@ -1094,11 +1169,10 @@ type FocusContextValue = {
|
|
|
1094
1169
|
*
|
|
1095
1170
|
* Access this context from the {@link useFocusContext} hook.
|
|
1096
1171
|
*/
|
|
1097
|
-
declare const FocusContext:
|
|
1172
|
+
declare const FocusContext: react.Context<FocusContextValue | undefined>;
|
|
1173
|
+
type FocusProviderProps = PropsWithChildren;
|
|
1098
1174
|
/** The provider for the {@link FocusContext}. */
|
|
1099
|
-
declare function FocusProvider(props:
|
|
1100
|
-
children: ReactNode;
|
|
1101
|
-
}): JSX.Element;
|
|
1175
|
+
declare function FocusProvider(props: FocusProviderProps): JSX.Element;
|
|
1102
1176
|
/**
|
|
1103
1177
|
* Hook to access the {@link FocusContextValue}. Use this hook to handle the
|
|
1104
1178
|
* focus state of the elements.
|
|
@@ -1128,7 +1202,7 @@ interface NavigationContextValue {
|
|
|
1128
1202
|
* The Navigation context shares details and methods to navigate the months in DayPicker.
|
|
1129
1203
|
* Access this context from the {@link useNavigation} hook.
|
|
1130
1204
|
*/
|
|
1131
|
-
declare const NavigationContext:
|
|
1205
|
+
declare const NavigationContext: react.Context<NavigationContextValue | undefined>;
|
|
1132
1206
|
/** Provides the values for the {@link NavigationContext}. */
|
|
1133
1207
|
declare function NavigationProvider(props: {
|
|
1134
1208
|
children?: ReactNode;
|
|
@@ -1142,9 +1216,7 @@ declare function NavigationProvider(props: {
|
|
|
1142
1216
|
declare function useNavigation(): NavigationContextValue;
|
|
1143
1217
|
|
|
1144
1218
|
/** The props of {@link RootProvider}. */
|
|
1145
|
-
type RootContext = DayPickerBase
|
|
1146
|
-
children: React$1.ReactNode;
|
|
1147
|
-
};
|
|
1219
|
+
type RootContext = PropsWithChildren<DayPickerBase>;
|
|
1148
1220
|
/** Provide the value for all the context providers. */
|
|
1149
1221
|
declare function RootProvider(props: RootContext): JSX.Element;
|
|
1150
1222
|
|
|
@@ -1165,7 +1237,7 @@ interface SelectMultipleContextValue {
|
|
|
1165
1237
|
*
|
|
1166
1238
|
* Access this context from the {@link useSelectMultiple} hook.
|
|
1167
1239
|
*/
|
|
1168
|
-
declare const SelectMultipleContext:
|
|
1240
|
+
declare const SelectMultipleContext: react.Context<SelectMultipleContextValue | undefined>;
|
|
1169
1241
|
type SelectMultipleProviderProps = {
|
|
1170
1242
|
initialProps: DayPickerBase;
|
|
1171
1243
|
children: ReactNode;
|
|
@@ -1201,17 +1273,15 @@ interface SelectRangeContextValue {
|
|
|
1201
1273
|
*
|
|
1202
1274
|
* Access this context from the {@link useSelectRange} hook.
|
|
1203
1275
|
*/
|
|
1204
|
-
declare const SelectRangeContext:
|
|
1276
|
+
declare const SelectRangeContext: react.Context<SelectRangeContextValue | undefined>;
|
|
1205
1277
|
type SelectRangeProviderProps = {
|
|
1206
1278
|
initialProps: DayPickerBase;
|
|
1207
|
-
|
|
1208
|
-
};
|
|
1279
|
+
} & PropsWithChildren;
|
|
1209
1280
|
/** Provides the values for the {@link SelectRangeProvider}. */
|
|
1210
1281
|
declare function SelectRangeProvider(props: SelectRangeProviderProps): JSX.Element;
|
|
1211
1282
|
type SelectRangeProviderInternalProps = {
|
|
1212
1283
|
initialProps: DayPickerRangeProps;
|
|
1213
|
-
|
|
1214
|
-
};
|
|
1284
|
+
} & PropsWithChildren;
|
|
1215
1285
|
declare function SelectRangeProviderInternal({ initialProps, children }: SelectRangeProviderInternalProps): JSX.Element;
|
|
1216
1286
|
/**
|
|
1217
1287
|
* Hook to access the {@link SelectRangeContextValue}.
|
|
@@ -1233,16 +1303,16 @@ interface SelectSingleContextValue {
|
|
|
1233
1303
|
*
|
|
1234
1304
|
* Access this context from the {@link useSelectSingle} hook.
|
|
1235
1305
|
*/
|
|
1236
|
-
declare const SelectSingleContext:
|
|
1306
|
+
declare const SelectSingleContext: react.Context<SelectSingleContextValue | undefined>;
|
|
1237
1307
|
type SelectSingleProviderProps = {
|
|
1238
1308
|
initialProps: DayPickerBase;
|
|
1239
|
-
children:
|
|
1309
|
+
children: ReactNode;
|
|
1240
1310
|
};
|
|
1241
1311
|
/** Provides the values for the {@link SelectSingleProvider}. */
|
|
1242
1312
|
declare function SelectSingleProvider(props: SelectSingleProviderProps): JSX.Element;
|
|
1243
1313
|
type SelectSingleProviderInternal = {
|
|
1244
1314
|
initialProps: DayPickerSingleProps;
|
|
1245
|
-
children:
|
|
1315
|
+
children: ReactNode;
|
|
1246
1316
|
};
|
|
1247
1317
|
declare function SelectSingleProviderInternal({ initialProps, children }: SelectSingleProviderInternal): JSX.Element;
|
|
1248
1318
|
/**
|
|
@@ -1279,4 +1349,4 @@ declare function isMatch(day: Date, matchers: Matcher[]): boolean;
|
|
|
1279
1349
|
*/
|
|
1280
1350
|
declare function addToRange(day: Date, range?: DateRange): DateRange | undefined;
|
|
1281
1351
|
|
|
1282
|
-
export { ActiveModifiers, Button, ButtonProps, Caption, CaptionDropdowns, CaptionLabel, CaptionLabelProps, CaptionLayout, CaptionNavigation, CaptionProps, ClassNames, CustomComponents, CustomModifiers, DateAfter, DateBefore, DateFormatter, DateInterval, DateRange, Day, DayClickEventHandler, DayContent, DayContentProps, DayFocusEventHandler, DayKeyboardEventHandler, DayLabel, DayModifiers, DayMouseEventHandler, DayOfWeek, DayPicker, DayPickerBase, DayPickerContext, DayPickerContextValue, DayPickerDefaultProps, DayPickerMultipleProps, DayPickerProps, DayPickerProvider, DayPickerProviderProps, DayPickerRangeProps, DayPickerSingleProps, DayPointerEventHandler, DayProps, DayRender, DaySelectionMode, DayTouchEventHandler, Dropdown, DropdownProps, FocusContext, FocusContextValue, FocusProvider, Footer, FooterProps, Formatters, Head, HeadRow, IconDropdown, IconLeft, IconRight, InputDayPickerProps,
|
|
1352
|
+
export { ActiveModifiers, Button, ButtonProps, Caption, CaptionDropdowns, CaptionLabel, CaptionLabelProps, CaptionLayout, CaptionNavigation, CaptionProps, ClassNames, CustomComponents, CustomModifiers, DateAfter, DateBefore, DateFormatter, DateInterval, DateRange, Day, DayClickEventHandler, DayContent, DayContentProps, DayFocusEventHandler, DayKeyboardEventHandler, DayLabel, DayModifiers, DayMouseEventHandler, DayOfWeek, DayPicker, DayPickerBase, DayPickerContext, DayPickerContextValue, DayPickerDefaultProps, DayPickerMultipleProps, DayPickerProps, DayPickerProvider, DayPickerProviderProps, DayPickerRangeProps, DayPickerSingleProps, DayPointerEventHandler, DayProps, DayRender, DaySelectionMode, DayTouchEventHandler, Dropdown, DropdownProps, FocusContext, FocusContextValue, FocusProvider, FocusProviderProps, Footer, FooterProps, Formatters, Head, HeadRow, IconDropdown, IconLeft, IconRight, InputDayPickerProps, InputProps, InternalModifier, InternalModifiers, InternalModifiersElement, Labels, Matcher, Modifier, Modifiers, ModifiersClassNames, ModifiersStyles, MonthChangeEventHandler, Months, MonthsProps, NavButtonLabel, NavigationContext, NavigationContextValue, NavigationProvider, RootContext, RootProvider, Row, RowProps, SelectMultipleContext, SelectMultipleContextValue, SelectMultipleEventHandler, SelectMultipleModifiers, SelectMultipleProvider, SelectMultipleProviderInternal, SelectMultipleProviderProps, SelectRangeContext, SelectRangeContextValue, SelectRangeEventHandler, SelectRangeModifiers, SelectRangeProvider, SelectRangeProviderInternal, SelectSingleContext, SelectSingleContextValue, SelectSingleEventHandler, SelectSingleProvider, SelectSingleProviderInternal, StyledComponent, StyledElement, Styles, UseInputOptions, UseInputValue, WeekNumber, WeekNumberClickEventHandler, WeekNumberFormatter, WeekNumberLabel, WeekNumberProps, WeekdayLabel, addToRange, isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDayOfWeekType, isDayPickerDefault, isDayPickerMultiple, isDayPickerRange, isDayPickerSingle, isMatch, useActiveModifiers, useDayPicker, useDayRender, useFocusContext, useInput, useNavigation, useSelectMultiple, useSelectRange, useSelectSingle };
|