react-day-picker 8.2.0 → 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.
- package/README.md +57 -19
- package/dist/style.module.css +5 -5
- package/dist/style.module.css.d.ts +34 -34
- package/dist/types/Matchers.d.ts +1 -1
- package/package.json +1 -1
- package/src/types/Matchers.ts +1 -1
- package/dist/components/Head/utils/getWeekdays.d.ts +0 -8
- package/dist/components/Head/utils/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
# React DayPicker
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
##
|
|
45
|
+
## Example
|
|
22
46
|
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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>
|
package/dist/style.module.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.
|
|
1
|
+
.root {
|
|
2
2
|
--rdp-cell-size: 40px;
|
|
3
3
|
--rdp-accent-color: #0000ff;
|
|
4
4
|
--rdp-background-color: #e7edff;
|
|
@@ -283,22 +283,22 @@
|
|
|
283
283
|
z-index: 1;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
.
|
|
286
|
+
.root:not([dir='rtl']) .day_range_start:not(.day_range_end) {
|
|
287
287
|
border-top-right-radius: 0;
|
|
288
288
|
border-bottom-right-radius: 0;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
.
|
|
291
|
+
.root:not([dir='rtl']) .day_range_end:not(.day_range_start) {
|
|
292
292
|
border-top-left-radius: 0;
|
|
293
293
|
border-bottom-left-radius: 0;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
.
|
|
296
|
+
.root[dir='rtl'] .day_range_start:not(.day_range_end) {
|
|
297
297
|
border-top-left-radius: 0;
|
|
298
298
|
border-bottom-left-radius: 0;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
.
|
|
301
|
+
.root[dir='rtl'] .day_range_end:not(.day_range_start) {
|
|
302
302
|
border-top-right-radius: 0;
|
|
303
303
|
border-bottom-right-radius: 0;
|
|
304
304
|
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
declare const styles: {
|
|
2
2
|
readonly rdp: string;
|
|
3
|
-
readonly 'vhidden': string;
|
|
4
|
-
readonly 'button_reset': string;
|
|
5
|
-
readonly 'button': string;
|
|
6
|
-
readonly 'months': string;
|
|
7
|
-
readonly 'month': string;
|
|
8
|
-
readonly 'table': string;
|
|
9
|
-
readonly 'with_weeknumber': string;
|
|
10
|
-
readonly 'caption': string;
|
|
11
|
-
readonly 'multiple_months': string;
|
|
12
|
-
readonly 'caption_dropdowns': string;
|
|
13
|
-
readonly 'caption_label': string;
|
|
14
|
-
readonly 'nav': string;
|
|
15
|
-
readonly 'caption_start': string;
|
|
16
|
-
readonly 'caption_end': string;
|
|
17
|
-
readonly 'nav_button': string;
|
|
18
|
-
readonly 'dropdown_year': string;
|
|
19
|
-
readonly 'dropdown_month': string;
|
|
20
|
-
readonly 'dropdown': string;
|
|
21
|
-
readonly 'dropdown_icon': string;
|
|
22
|
-
readonly 'head': string;
|
|
23
|
-
readonly 'head_row': string;
|
|
24
|
-
readonly 'row': string;
|
|
25
|
-
readonly 'head_cell': string;
|
|
26
|
-
readonly 'tbody': string;
|
|
27
|
-
readonly 'tfoot': string;
|
|
28
|
-
readonly 'cell': string;
|
|
29
|
-
readonly 'weeknumber': string;
|
|
30
|
-
readonly 'day': string;
|
|
31
|
-
readonly 'day_today': string;
|
|
32
|
-
readonly 'day_outside': string;
|
|
33
|
-
readonly 'day_selected': string;
|
|
34
|
-
readonly 'day_range_start': string;
|
|
35
|
-
readonly 'day_range_end': string;
|
|
36
|
-
readonly 'day_range_middle': string;
|
|
3
|
+
readonly 'rdp-vhidden': string;
|
|
4
|
+
readonly 'rdp-button_reset': string;
|
|
5
|
+
readonly 'rdp-button': string;
|
|
6
|
+
readonly 'rdp-months': string;
|
|
7
|
+
readonly 'rdp-month': string;
|
|
8
|
+
readonly 'rdp-table': string;
|
|
9
|
+
readonly 'rdp-with_weeknumber': string;
|
|
10
|
+
readonly 'rdp-caption': string;
|
|
11
|
+
readonly 'rdp-multiple_months': string;
|
|
12
|
+
readonly 'rdp-caption_dropdowns': string;
|
|
13
|
+
readonly 'rdp-caption_label': string;
|
|
14
|
+
readonly 'rdp-nav': string;
|
|
15
|
+
readonly 'rdp-caption_start': string;
|
|
16
|
+
readonly 'rdp-caption_end': string;
|
|
17
|
+
readonly 'rdp-nav_button': string;
|
|
18
|
+
readonly 'rdp-dropdown_year': string;
|
|
19
|
+
readonly 'rdp-dropdown_month': string;
|
|
20
|
+
readonly 'rdp-dropdown': string;
|
|
21
|
+
readonly 'rdp-dropdown_icon': string;
|
|
22
|
+
readonly 'rdp-head': string;
|
|
23
|
+
readonly 'rdp-head_row': string;
|
|
24
|
+
readonly 'rdp-row': string;
|
|
25
|
+
readonly 'rdp-head_cell': string;
|
|
26
|
+
readonly 'rdp-tbody': string;
|
|
27
|
+
readonly 'rdp-tfoot': string;
|
|
28
|
+
readonly 'rdp-cell': string;
|
|
29
|
+
readonly 'rdp-weeknumber': string;
|
|
30
|
+
readonly 'rdp-day': string;
|
|
31
|
+
readonly 'rdp-day_today': string;
|
|
32
|
+
readonly 'rdp-day_outside': string;
|
|
33
|
+
readonly 'rdp-day_selected': string;
|
|
34
|
+
readonly 'rdp-day_range_start': string;
|
|
35
|
+
readonly 'rdp-day_range_end': string;
|
|
36
|
+
readonly 'rdp-day_range_middle': string;
|
|
37
37
|
};
|
|
38
38
|
export = styles;
|
package/dist/types/Matchers.d.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/package.json
CHANGED
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
|
*
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Locale } from 'date-fns';
|
|
2
|
-
/**
|
|
3
|
-
* Generate a series of 7 days, starting from the week, to use for formatting
|
|
4
|
-
* the weekday names (Monday, Tuesday, etc.).
|
|
5
|
-
*/
|
|
6
|
-
export declare function getWeekdays(locale?: Locale,
|
|
7
|
-
/** The index of the first day of the week (0 - Sunday) */
|
|
8
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6): Date[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './getWeekdays';
|