react-day-picker 8.1.3 → 8.2.1

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.
Files changed (54) hide show
  1. package/README.md +57 -19
  2. package/dist/components/Button/Button.d.ts +1 -1
  3. package/dist/components/DayContent/DayContent.d.ts +1 -3
  4. package/dist/components/Dropdown/Dropdown.d.ts +4 -0
  5. package/dist/components/Head/Head.d.ts +1 -3
  6. package/dist/components/HeadRow/HeadRow.d.ts +4 -0
  7. package/dist/components/HeadRow/index.d.ts +1 -0
  8. package/dist/components/{Head → HeadRow}/utils/getWeekdays.d.ts +0 -0
  9. package/dist/components/{Head → HeadRow}/utils/index.d.ts +0 -0
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.esm.js +34 -26
  12. package/dist/index.esm.js.map +1 -1
  13. package/dist/index.js +34 -25
  14. package/dist/index.js.map +1 -1
  15. package/dist/react-day-picker.min.js +1 -1
  16. package/dist/style.css +14 -7
  17. package/dist/style.module.css +19 -12
  18. package/dist/style.module.css.d.ts +34 -34
  19. package/dist/types/DayPickerBase.d.ts +2 -0
  20. package/dist/types/Matchers.d.ts +1 -1
  21. package/package.json +1 -1
  22. package/src/components/Day/Day.test.tsx +2 -1
  23. package/src/components/Day/Day.tsx +1 -1
  24. package/src/components/DayContent/DayContent.test.tsx +1 -13
  25. package/src/components/DayContent/DayContent.tsx +2 -14
  26. package/src/components/Dropdown/Dropdown.test.tsx +1 -0
  27. package/src/components/Dropdown/Dropdown.tsx +5 -0
  28. package/src/components/Head/Head.test.tsx +13 -63
  29. package/src/components/Head/Head.tsx +5 -41
  30. package/src/components/HeadRow/HeadRow.test.tsx +109 -0
  31. package/src/components/HeadRow/HeadRow.tsx +49 -0
  32. package/src/components/HeadRow/index.ts +1 -0
  33. package/src/components/{Head → HeadRow}/utils/getWeekdays.test.ts +0 -0
  34. package/src/components/{Head → HeadRow}/utils/getWeekdays.ts +0 -0
  35. package/src/components/{Head → HeadRow}/utils/index.ts +0 -0
  36. package/src/components/MonthsDropdown/MonthsDropdown.test.tsx +11 -1
  37. package/src/components/MonthsDropdown/MonthsDropdown.tsx +1 -0
  38. package/src/components/MonthsDropdown/__snapshots__/MonthsDropdown.test.tsx.snap +48 -0
  39. package/src/components/Navigation/Navigation.test.tsx +6 -0
  40. package/src/components/Navigation/Navigation.tsx +2 -0
  41. package/src/components/Table/Table.test.tsx +2 -2
  42. package/src/components/Table/__snapshots__/Table.test.tsx.snap +122 -586
  43. package/src/components/WeekNumber/WeekNumber.test.tsx +9 -2
  44. package/src/components/WeekNumber/WeekNumber.tsx +1 -0
  45. package/src/components/WeekNumber/__snapshots__/WeekNumber.test.tsx.snap +10 -1
  46. package/src/components/YearsDropdown/YearsDropdown.test.tsx +11 -1
  47. package/src/components/YearsDropdown/YearsDropdown.tsx +1 -0
  48. package/src/components/YearsDropdown/__snapshots__/YearsDropdown.test.tsx.snap +43 -0
  49. package/src/hooks/useDayRender/useDayRender.tsx +6 -2
  50. package/src/hooks/useInput/useInput.ts +2 -2
  51. package/src/index.ts +1 -0
  52. package/src/style.css +14 -7
  53. package/src/types/DayPickerBase.ts +2 -0
  54. package/src/types/Matchers.ts +1 -1
package/README.md CHANGED
@@ -1,11 +1,35 @@
1
- # React DayPicker v8
1
+ # React DayPicker
2
2
 
3
- DayPicker is a date picker component for [React](https://reactjs.org).
3
+ [React DayPicker](http://react-day-picker.js.org) is a date picker component for [React](https://reactjs.org). Renders a calendar where the user can browse months to select days. DayPicker is customizable, works great with input fields and can be styled to match any design.
4
4
 
5
- ```bash
6
- $ npm install react-day-picker date-fns # using npm
7
- $ pnpm install react-day-picker date-fns # using pnpm
8
- $ yarn add react-day-picker date-fns # using yarn
5
+ ➡️ **[react-day-picker.js.org](http://react-day-picker.js.org)** for guides, examples and API reference.
6
+
7
+ <a href="http://react-day-picker.js.org">
8
+ <picture>
9
+ <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/120693/188241991-19d0e8a1-230a-48c8-8477-3c90d4e36197.png"/>
10
+ <source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/120693/188238076-311ec6d1-503d-4c21-8ffe-d89faa60e40f.png"/>
11
+ <img alt="Shows a screenshot of the React DayPicker component in a browser’s window." width="900" />
12
+ </picture>
13
+ </a>
14
+
15
+ ## Main features
16
+
17
+ - ☀️ Select days, ranges or whatever
18
+ - 🧘‍♀️ using [date-fns](http://date-fns.org) as date library
19
+ - 🌎 Localizable into any language
20
+ - ➡️ Keyboard navigation
21
+ - ♿️ [WAI-ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) support
22
+ - 🤖 Written in TypeScript
23
+ - 🎨 Easy to style and customize
24
+ - 🗓 Support multiple calendars
25
+ - 📄 Easy to integrate input fields
26
+
27
+ ## Installation
28
+
29
+ ```shell
30
+ npm install react-day-picker date-fns # using npm
31
+ pnpm install react-day-picker date-fns # using pnpm
32
+ yarn add react-day-picker date-fns # using yarn
9
33
  ```
10
34
 
11
35
  <a href="https://www.npmjs.com/package/react-day-picker">
@@ -18,20 +42,34 @@ $ yarn add react-day-picker date-fns # using yarn
18
42
  <img src="https://img.shields.io/github/sponsors/gpbl?style=flat-square" alt="sponsors"/>
19
43
  </a>
20
44
 
21
- ## Main features
45
+ ## Example
22
46
 
23
- - ☀️ Select days, ranges or whatever
24
- - 🌎 Localizable into any language
25
- - ➡️ Keyboard navigation
26
- - ♿️ [WAI-ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) support
27
- - 🤖 Native TypeScript support
28
- - 🧘‍♀️ using [date-fns](http://date-fns.org) as date library
29
- - 🗓 Create multiple calendars
30
- - 🎨 Easy to style and customize
31
- - 📄 Native integration with input elements
47
+ ```tsx
48
+ import React from 'react';
32
49
 
33
- ## Documentation
50
+ import { format } from 'date-fns';
51
+ import { DayPicker } from 'react-day-picker';
52
+ import 'react-day-picker/dist/style.css';
53
+
54
+ export default function Example() {
55
+ const [selected, setSelected] = React.useState<Date>();
34
56
 
35
- - See ➡️ **[react-day-picker.js.org](http://react-day-picker.js.org)** for guides, examples and API reference.
57
+ let footer = <p>Please pick a day.</p>;
58
+ if (selected) {
59
+ footer = <p>You picked {format(selected, 'PP')}.</p>;
60
+ }
61
+ return (
62
+ <DayPicker
63
+ mode="single"
64
+ selected={selected}
65
+ onSelect={setSelected}
66
+ footer={footer}
67
+ />
68
+ );
69
+ }
70
+ ```
71
+
72
+ ## Documentation
36
73
 
37
- <small>Looking for v7 docs? Go to <a href="https://react-day-picker-v7.netlify.app" target="_blank">react-day-picker-v7.netlify.app</a>.</small>
74
+ See **[react-day-picker.js.org](http://react-day-picker.js.org)** for guides, examples and API reference of the latest version.
75
+ <small>Docs for version 7 are at <a href="https://react-day-picker-v7.netlify.app" target="_blank">react-day-picker-v7.netlify.app</a>.</small>
@@ -4,4 +4,4 @@ export declare type ButtonProps = React.HTMLProps<HTMLButtonElement>;
4
4
  /**
5
5
  * Render a button HTML element applying the reset class name.
6
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" | "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" | "name" | "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>>;
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>>;
@@ -8,7 +8,5 @@ export interface DayContentProps {
8
8
  /** The active modifiers for the given date. */
9
9
  activeModifiers: ActiveModifiers;
10
10
  }
11
- /**
12
- * Render the content of the day cell.
13
- */
11
+ /** Render the content of the day cell. */
14
12
  export declare function DayContent(props: DayContentProps): JSX.Element;
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
2
  /** The props for the {@link Dropdown} component. */
3
3
  export interface DropdownProps {
4
+ /** The name attribute of the element. */
5
+ name?: string;
6
+ /** The caption displayed to replace the hidden select. */
4
7
  caption?: React.ReactNode;
5
8
  children?: React.SelectHTMLAttributes<HTMLSelectElement>['children'];
6
9
  className?: string;
7
10
  ['aria-label']?: string;
8
11
  style?: React.CSSProperties;
12
+ /** The selected value. */
9
13
  value?: string | number;
10
14
  onChange?: React.ChangeEventHandler<HTMLSelectElement>;
11
15
  }
@@ -1,4 +1,2 @@
1
- /**
2
- * Render the Head component - i.e. the table head with the weekday names.
3
- */
1
+ /** Render the table head. */
4
2
  export declare function Head(): JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Render the HeadRow component - i.e. the table head row with the weekday names.
3
+ */
4
+ export declare function HeadRow(): JSX.Element;
@@ -0,0 +1 @@
1
+ export * from './HeadRow';
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './components/DayContent';
9
9
  export * from './components/Dropdown';
10
10
  export * from './components/Footer';
11
11
  export * from './components/Head';
12
+ export * from './components/HeadRow';
12
13
  export * from './components/IconDropdown';
13
14
  export * from './components/IconRight';
14
15
  export * from './components/IconLeft';
package/dist/index.esm.js CHANGED
@@ -422,7 +422,7 @@ function Dropdown(props) {
422
422
  var IconDropdownComponent = (_b = (_a = dayPicker.components) === null || _a === void 0 ? void 0 : _a.IconDropdown) !== null && _b !== void 0 ? _b : IconDropdown;
423
423
  return (React__default.createElement("div", { className: className, style: style },
424
424
  React__default.createElement("span", { className: dayPicker.classNames.vhidden }, props['aria-label']),
425
- React__default.createElement("select", { "aria-label": props['aria-label'], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value: value, onChange: onChange }, children),
425
+ React__default.createElement("select", { name: props.name, "aria-label": props['aria-label'], className: dayPicker.classNames.dropdown, style: dayPicker.styles.dropdown, value: value, onChange: onChange }, children),
426
426
  React__default.createElement("div", { className: dayPicker.classNames.caption_label, style: dayPicker.styles.caption_label, "aria-hidden": "true" },
427
427
  caption,
428
428
  React__default.createElement(IconDropdownComponent, { className: dayPicker.classNames.dropdown_icon, style: dayPicker.styles.dropdown_icon }))));
@@ -458,7 +458,7 @@ function MonthsDropdown(props) {
458
458
  props.onChange(newMonth);
459
459
  };
460
460
  var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
461
- return (React__default.createElement(DropdownComponent, { "aria-label": labelMonthDropdown(), className: classNames.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption(props.displayMonth, { locale: locale }) }, dropdownMonths.map(function (m) { return (React__default.createElement("option", { key: m.getMonth(), value: m.getMonth() }, formatMonthCaption(m, { locale: locale }))); })));
461
+ return (React__default.createElement(DropdownComponent, { name: "months", "aria-label": labelMonthDropdown(), className: classNames.dropdown_month, style: styles.dropdown_month, onChange: handleChange, value: props.displayMonth.getMonth(), caption: formatMonthCaption(props.displayMonth, { locale: locale }) }, dropdownMonths.map(function (m) { return (React__default.createElement("option", { key: m.getMonth(), value: m.getMonth() }, formatMonthCaption(m, { locale: locale }))); })));
462
462
  }
463
463
 
464
464
  /**
@@ -485,7 +485,7 @@ function YearsDropdown(props) {
485
485
  props.onChange(newMonth);
486
486
  };
487
487
  var DropdownComponent = (_a = components === null || components === void 0 ? void 0 : components.Dropdown) !== null && _a !== void 0 ? _a : Dropdown;
488
- return (React__default.createElement(DropdownComponent, { "aria-label": labelYearDropdown(), className: classNames.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption(displayMonth, { locale: locale }) }, years.map(function (year) { return (React__default.createElement("option", { key: year.getFullYear(), value: year.getFullYear() }, formatYearCaption(year, { locale: locale }))); })));
488
+ return (React__default.createElement(DropdownComponent, { name: "years", "aria-label": labelYearDropdown(), className: classNames.dropdown_year, style: styles.dropdown_year, onChange: handleChange, value: displayMonth.getFullYear(), caption: formatYearCaption(displayMonth, { locale: locale }) }, years.map(function (year) { return (React__default.createElement("option", { key: year.getFullYear(), value: year.getFullYear() }, formatYearCaption(year, { locale: locale }))); })));
489
489
  }
490
490
 
491
491
  /**
@@ -737,8 +737,8 @@ function Navigation(props) {
737
737
  var IconRightComponent = (_a = components === null || components === void 0 ? void 0 : components.IconRight) !== null && _a !== void 0 ? _a : IconRight;
738
738
  var IconLeftComponent = (_b = components === null || components === void 0 ? void 0 : components.IconLeft) !== null && _b !== void 0 ? _b : IconLeft;
739
739
  return (React__default.createElement("div", { className: classNames.nav, style: styles.nav },
740
- !props.hidePrevious && (React__default.createElement(Button, { "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick }, dir === 'rtl' ? (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })))),
741
- !props.hideNext && (React__default.createElement(Button, { "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick }, dir === 'rtl' ? (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon }))))));
740
+ !props.hidePrevious && (React__default.createElement(Button, { name: "previous-month", "aria-label": previousLabel, className: previousClassName, style: styles.nav_button_previous, disabled: !props.previousMonth, onClick: props.onPreviousClick }, dir === 'rtl' ? (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })))),
741
+ !props.hideNext && (React__default.createElement(Button, { name: "next-month", "aria-label": nextLabel, className: nextClassName, style: styles.nav_button_next, disabled: !props.nextMonth, onClick: props.onNextClick }, dir === 'rtl' ? (React__default.createElement(IconLeftComponent, { className: classNames.nav_icon, style: styles.nav_icon })) : (React__default.createElement(IconRightComponent, { className: classNames.nav_icon, style: styles.nav_icon }))))));
742
742
  }
743
743
 
744
744
  /**
@@ -824,27 +824,31 @@ weekStartsOn) {
824
824
  }
825
825
 
826
826
  /**
827
- * Render the Head component - i.e. the table head with the weekday names.
827
+ * Render the HeadRow component - i.e. the table head row with the weekday names.
828
828
  */
829
- function Head() {
829
+ function HeadRow() {
830
830
  var _a = useDayPicker(), classNames = _a.classNames, styles = _a.styles, showWeekNumber = _a.showWeekNumber, locale = _a.locale, weekStartsOn = _a.weekStartsOn, formatWeekdayName = _a.formatters.formatWeekdayName, labelWeekday = _a.labels.labelWeekday;
831
831
  var weekdays = getWeekdays(locale, weekStartsOn);
832
+ return (React__default.createElement("tr", { style: styles.head_row, className: classNames.head_row },
833
+ showWeekNumber && (React__default.createElement("th", { scope: "col", style: styles.head_cell, className: classNames.head_cell })),
834
+ weekdays.map(function (weekday, i) { return (React__default.createElement("th", { key: i, scope: "col", className: classNames.head_cell, style: styles.head_cell },
835
+ React__default.createElement("span", { "aria-hidden": true }, formatWeekdayName(weekday, { locale: locale })),
836
+ React__default.createElement("span", { className: classNames.vhidden }, labelWeekday(weekday, { locale: locale })))); })));
837
+ }
838
+
839
+ /** Render the table head. */
840
+ function Head() {
841
+ var _a;
842
+ var _b = useDayPicker(), classNames = _b.classNames, styles = _b.styles, components = _b.components;
843
+ var HeadRowComponent = (_a = components === null || components === void 0 ? void 0 : components.HeadRow) !== null && _a !== void 0 ? _a : HeadRow;
832
844
  return (React__default.createElement("thead", { style: styles.head, className: classNames.head },
833
- React__default.createElement("tr", { style: styles.head_row, className: classNames.head_row },
834
- showWeekNumber && (React__default.createElement("th", { scope: "col", style: styles.head_cell, className: classNames.head_cell })),
835
- weekdays.map(function (weekday, i) { return (React__default.createElement("th", { key: i, scope: "col", className: classNames.head_cell, style: styles.head_cell },
836
- React__default.createElement("span", { "aria-hidden": true }, formatWeekdayName(weekday, { locale: locale })),
837
- React__default.createElement("span", { className: classNames.vhidden }, labelWeekday(weekday, { locale: locale })))); }))));
845
+ React__default.createElement(HeadRowComponent, null)));
838
846
  }
839
847
 
840
- /**
841
- * Render the content of the day cell.
842
- */
848
+ /** Render the content of the day cell. */
843
849
  function DayContent(props) {
844
- var _a = useDayPicker(), locale = _a.locale, classNames = _a.classNames, styles = _a.styles, labelDay = _a.labels.labelDay, formatDay = _a.formatters.formatDay;
845
- return (React__default.createElement(React__default.Fragment, null,
846
- React__default.createElement("span", { "aria-hidden": "true" }, formatDay(props.date, { locale: locale })),
847
- React__default.createElement("span", { className: classNames.vhidden, style: styles.vhidden }, labelDay(props.date, props.activeModifiers, { locale: locale }))));
850
+ var _a = useDayPicker(), locale = _a.locale, formatDay = _a.formatters.formatDay;
851
+ return React__default.createElement(React__default.Fragment, null, formatDay(props.date, { locale: locale }));
848
852
  }
849
853
 
850
854
  /**
@@ -1728,6 +1732,9 @@ buttonRef) {
1728
1732
  ]);
1729
1733
  var className = getDayClassNames(dayPicker, activeModifiers).join(' ');
1730
1734
  var style = getDayStyle(dayPicker, activeModifiers);
1735
+ var ariaLabel = dayPicker.labels.labelDay(day, activeModifiers, {
1736
+ locale: dayPicker.locale
1737
+ });
1731
1738
  var isHidden = Boolean((activeModifiers.outside && !dayPicker.showOutsideDays) ||
1732
1739
  activeModifiers.hidden);
1733
1740
  var DayContentComponent = (_c = (_b = dayPicker.components) === null || _b === void 0 ? void 0 : _b.DayContent) !== null && _c !== void 0 ? _c : DayContent;
@@ -1735,10 +1742,11 @@ buttonRef) {
1735
1742
  var divProps = {
1736
1743
  style: style,
1737
1744
  className: className,
1738
- children: children
1745
+ children: children,
1746
+ 'aria-label': ariaLabel
1739
1747
  };
1740
1748
  var isFocusTarget = Boolean(focusContext.focusTarget && isSameDay(focusContext.focusTarget, day));
1741
- var buttonProps = __assign(__assign(__assign({}, divProps), (_a = { disabled: activeModifiers.disabled }, _a['aria-pressed'] = activeModifiers.selected, _a.tabIndex = isFocusTarget ? 0 : -1, _a)), eventHandlers);
1749
+ var buttonProps = __assign(__assign(__assign({}, divProps), (_a = { disabled: activeModifiers.disabled }, _a['aria-pressed'] = activeModifiers.selected, _a['aria-label'] = ariaLabel, _a.tabIndex = isFocusTarget ? 0 : -1, _a)), eventHandlers);
1742
1750
  var dayRender = {
1743
1751
  isButton: isButton,
1744
1752
  isHidden: isHidden,
@@ -1763,7 +1771,7 @@ function Day(props) {
1763
1771
  if (!dayRender.isButton) {
1764
1772
  return React__default.createElement("div", __assign({}, dayRender.divProps));
1765
1773
  }
1766
- return React__default.createElement(Button, __assign({ ref: buttonRef }, dayRender.buttonProps));
1774
+ return React__default.createElement(Button, __assign({ name: "day", ref: buttonRef }, dayRender.buttonProps));
1767
1775
  }
1768
1776
 
1769
1777
  /**
@@ -1781,7 +1789,7 @@ function WeekNumber(props) {
1781
1789
  var handleClick = function (e) {
1782
1790
  onWeekNumberClick(weekNumber, dates, e);
1783
1791
  };
1784
- return (React__default.createElement(Button, { "aria-label": label, className: classNames.weeknumber, style: styles.weeknumber, onClick: handleClick }, content));
1792
+ return (React__default.createElement(Button, { name: "week-number", "aria-label": label, className: classNames.weeknumber, style: styles.weeknumber, onClick: handleClick }, content));
1785
1793
  }
1786
1794
 
1787
1795
  /** Render a row in the calendar, with the days and the week number. */
@@ -2200,8 +2208,8 @@ function useInput(options) {
2200
2208
  onMonthChange: handleMonthChange,
2201
2209
  selected: selectedDay,
2202
2210
  locale: locale,
2203
- fromDate: options === null || options === void 0 ? void 0 : options.fromDate,
2204
- toDate: options === null || options === void 0 ? void 0 : options.toDate,
2211
+ fromDate: fromDate,
2212
+ toDate: toDate,
2205
2213
  today: today
2206
2214
  };
2207
2215
  var inputProps = {
@@ -2219,5 +2227,5 @@ function isDayPickerDefault(props) {
2219
2227
  return props.mode === undefined || props.mode === 'default';
2220
2228
  }
2221
2229
 
2222
- export { Button, Caption, CaptionDropdowns, CaptionLabel, CaptionNavigation, Day, DayContent, DayPicker, DayPickerContext, DayPickerProvider, Dropdown, FocusContext, FocusProvider, Footer, Head, IconDropdown, IconLeft, IconRight, InternalModifier, NavigationContext, NavigationProvider, RootProvider, Row, SelectMultipleContext, SelectMultipleProvider, SelectMultipleProviderInternal, SelectRangeContext, SelectRangeProvider, SelectRangeProviderInternal, SelectSingleContext, SelectSingleProvider, SelectSingleProviderInternal, WeekNumber, addToRange, isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDayOfWeekType, isDayPickerDefault, isDayPickerMultiple, isDayPickerRange, isDayPickerSingle, isMatch, useActiveModifiers, useDayPicker, useDayRender, useFocusContext, useInput, useNavigation, useSelectMultiple, useSelectRange, useSelectSingle };
2230
+ export { Button, Caption, CaptionDropdowns, CaptionLabel, CaptionNavigation, Day, DayContent, DayPicker, DayPickerContext, DayPickerProvider, Dropdown, FocusContext, FocusProvider, Footer, Head, HeadRow, IconDropdown, IconLeft, IconRight, InternalModifier, NavigationContext, NavigationProvider, RootProvider, Row, SelectMultipleContext, SelectMultipleProvider, SelectMultipleProviderInternal, SelectRangeContext, SelectRangeProvider, SelectRangeProviderInternal, SelectSingleContext, SelectSingleProvider, SelectSingleProviderInternal, WeekNumber, addToRange, isDateAfterType, isDateBeforeType, isDateInterval, isDateRange, isDayOfWeekType, isDayPickerDefault, isDayPickerMultiple, isDayPickerRange, isDayPickerSingle, isMatch, useActiveModifiers, useDayPicker, useDayRender, useFocusContext, useInput, useNavigation, useSelectMultiple, useSelectRange, useSelectSingle };
2223
2231
  //# sourceMappingURL=index.esm.js.map