react-day-picker 8.8.2 → 8.9.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 +3 -3
- package/dist/index.d.ts +152 -71
- 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 +2 -1
- package/src/contexts/DayPicker/formatters/formatDay.ts +1 -2
- package/src/contexts/DayPicker/formatters/formatMonthCaption.ts +1 -2
- package/src/contexts/DayPicker/formatters/formatWeekdayName.ts +1 -2
- package/src/contexts/DayPicker/formatters/formatYearCaption.ts +4 -2
- 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 +4 -5
- package/src/contexts/SelectMultiple/SelectMultipleContext.test.ts +6 -4
- package/src/contexts/SelectMultiple/SelectMultipleContext.tsx +6 -5
- package/src/contexts/SelectRange/SelectRangeContext.test.ts +3 -1
- package/src/contexts/SelectRange/SelectRangeContext.tsx +8 -7
- package/src/contexts/SelectSingle/SelectSingleContext.test.ts +3 -3
- package/src/contexts/SelectSingle/SelectSingleContext.tsx +8 -7
- 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 +85 -11
- package/src/types/EventHandlers.ts +18 -10
- package/src/types/Formatters.ts +11 -5
- package/src/types/Labels.ts +16 -5
- package/src/types/Modifiers.ts +4 -2
- package/src/types/Styles.ts +5 -5
- package/tsconfig.json +5 -3
package/dist/style.css
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
.rdp {
|
|
2
|
-
--rdp-cell-size: 40px;
|
|
3
|
-
--rdp-caption-font-size: 18px;
|
|
4
|
-
--rdp-accent-color: #0000ff;
|
|
5
|
-
--rdp-background-color: #e7edff;
|
|
6
|
-
--rdp-accent-color-dark: #3003e1;
|
|
7
|
-
--rdp-background-color-dark: #180270;
|
|
2
|
+
--rdp-cell-size: 40px; /* Size of the day cells. */
|
|
3
|
+
--rdp-caption-font-size: 18px; /* Font size for the caption labels. */
|
|
4
|
+
--rdp-accent-color: #0000ff; /* Accent color for the background of selected days. */
|
|
5
|
+
--rdp-background-color: #e7edff; /* Background color for the hovered/focused elements. */
|
|
6
|
+
--rdp-accent-color-dark: #3003e1; /* Accent color for the background of selected days (to use in dark-mode). */
|
|
7
|
+
--rdp-background-color-dark: #180270; /* Background color for the hovered/focused elements (to use in dark-mode). */
|
|
8
8
|
--rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */
|
|
9
9
|
--rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */
|
|
10
|
+
--rdp-selected-color: #fff; /* Color of selected day text */
|
|
10
11
|
|
|
11
12
|
margin: 1em;
|
|
12
13
|
}
|
|
@@ -270,7 +271,7 @@
|
|
|
270
271
|
.rdp-day_selected,
|
|
271
272
|
.rdp-day_selected:focus-visible,
|
|
272
273
|
.rdp-day_selected:hover {
|
|
273
|
-
color:
|
|
274
|
+
color: var(--rdp-selected-color);
|
|
274
275
|
opacity: 1;
|
|
275
276
|
background-color: var(--rdp-accent-color);
|
|
276
277
|
}
|
package/dist/style.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["style.css"],"names":[],"mappings":"AAAA;EACE,qBAAqB;
|
|
1
|
+
{"version":3,"sources":["style.css"],"names":[],"mappings":"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","file":"style.css","sourcesContent":[".rdp {\n --rdp-cell-size: 40px; /* Size of the day cells. */\n --rdp-caption-font-size: 18px; /* Font size for the caption labels. */\n --rdp-accent-color: #0000ff; /* Accent color for the background of selected days. */\n --rdp-background-color: #e7edff; /* Background color for the hovered/focused elements. */\n --rdp-accent-color-dark: #3003e1; /* Accent color for the background of selected days (to use in dark-mode). */\n --rdp-background-color-dark: #180270; /* Background color for the hovered/focused elements (to use in dark-mode). */\n --rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */\n --rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */\n --rdp-selected-color: #fff; /* Color of selected day text */\n\n margin: 1em;\n}\n\n/* Hide elements for devices that are not screen readers */\n.rdp-vhidden {\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n background: transparent;\n border: 0;\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n position: absolute !important;\n top: 0;\n width: 1px !important;\n height: 1px !important;\n padding: 0 !important;\n overflow: hidden !important;\n clip: rect(1px, 1px, 1px, 1px) !important;\n border: 0 !important;\n}\n\n/* Buttons */\n.rdp-button_reset {\n appearance: none;\n position: relative;\n margin: 0;\n padding: 0;\n cursor: default;\n color: inherit;\n background: none;\n font: inherit;\n\n -moz-appearance: none;\n -webkit-appearance: none;\n}\n\n.rdp-button_reset:focus-visible {\n /* Make sure to reset outline only when :focus-visible is supported */\n outline: none;\n}\n\n.rdp-button {\n border: 2px solid transparent;\n}\n\n.rdp-button[disabled]:not(.rdp-day_selected) {\n opacity: 0.25;\n}\n\n.rdp-button:not([disabled]) {\n cursor: pointer;\n}\n\n.rdp-button:focus-visible:not([disabled]) {\n color: inherit;\n background-color: var(--rdp-background-color);\n border: var(--rdp-outline);\n}\n\n.rdp-button:hover:not([disabled]):not(.rdp-day_selected) {\n background-color: var(--rdp-background-color);\n}\n\n.rdp-months {\n display: flex;\n}\n\n.rdp-month {\n margin: 0 1em;\n}\n\n.rdp-month:first-child {\n margin-left: 0;\n}\n\n.rdp-month:last-child {\n margin-right: 0;\n}\n\n.rdp-table {\n margin: 0;\n max-width: calc(var(--rdp-cell-size) * 7);\n border-collapse: collapse;\n}\n\n.rdp-with_weeknumber .rdp-table {\n max-width: calc(var(--rdp-cell-size) * 8);\n border-collapse: collapse;\n}\n\n.rdp-caption {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0;\n text-align: left;\n}\n\n.rdp-multiple_months .rdp-caption {\n position: relative;\n display: block;\n text-align: center;\n}\n\n.rdp-caption_dropdowns {\n position: relative;\n display: inline-flex;\n}\n\n.rdp-caption_label {\n position: relative;\n z-index: 1;\n display: inline-flex;\n align-items: center;\n margin: 0;\n padding: 0 0.25em;\n white-space: nowrap;\n color: currentColor;\n border: 0;\n border: 2px solid transparent;\n font-family: inherit;\n font-size: var(--rdp-caption-font-size);\n font-weight: bold;\n}\n\n.rdp-nav {\n white-space: nowrap;\n}\n\n.rdp-multiple_months .rdp-caption_start .rdp-nav {\n position: absolute;\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n}\n\n.rdp-multiple_months .rdp-caption_end .rdp-nav {\n position: absolute;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n}\n\n.rdp-nav_button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--rdp-cell-size);\n height: var(--rdp-cell-size);\n padding: 0.25em;\n border-radius: 100%;\n}\n\n/* ---------- */\n/* Dropdowns */\n/* ---------- */\n\n.rdp-dropdown_year,\n.rdp-dropdown_month {\n position: relative;\n display: inline-flex;\n align-items: center;\n}\n\n.rdp-dropdown {\n appearance: none;\n position: absolute;\n z-index: 2;\n top: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n margin: 0;\n padding: 0;\n cursor: inherit;\n opacity: 0;\n border: none;\n background-color: transparent;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n}\n\n.rdp-dropdown[disabled] {\n opacity: unset;\n color: unset;\n}\n\n.rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label {\n background-color: var(--rdp-background-color);\n border: var(--rdp-outline);\n border-radius: 6px;\n}\n\n.rdp-dropdown_icon {\n margin: 0 0 0 5px;\n}\n\n.rdp-head {\n border: 0;\n}\n\n.rdp-head_row,\n.rdp-row {\n height: 100%;\n}\n\n.rdp-head_cell {\n vertical-align: middle;\n font-size: 0.75em;\n font-weight: 700;\n text-align: center;\n height: 100%;\n height: var(--rdp-cell-size);\n padding: 0;\n text-transform: uppercase;\n}\n\n.rdp-tbody {\n border: 0;\n}\n\n.rdp-tfoot {\n margin: 0.5em;\n}\n\n.rdp-cell {\n width: var(--rdp-cell-size);\n height: 100%;\n height: var(--rdp-cell-size);\n padding: 0;\n text-align: center;\n}\n\n.rdp-weeknumber {\n font-size: 0.75em;\n}\n\n.rdp-weeknumber,\n.rdp-day {\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: var(--rdp-cell-size);\n max-width: var(--rdp-cell-size);\n height: var(--rdp-cell-size);\n margin: 0;\n border: 2px solid transparent;\n border-radius: 100%;\n}\n\n.rdp-day_today:not(.rdp-day_outside) {\n font-weight: bold;\n}\n\n.rdp-day_selected,\n.rdp-day_selected:focus-visible,\n.rdp-day_selected:hover {\n color: var(--rdp-selected-color);\n opacity: 1;\n background-color: var(--rdp-accent-color);\n}\n\n.rdp-day_outside {\n opacity: 0.5;\n}\n\n.rdp-day_selected:focus-visible {\n /* Since the background is the same use again the outline */\n outline: var(--rdp-outline);\n outline-offset: 2px;\n z-index: 1;\n}\n\n.rdp:not([dir='rtl']) .rdp-day_range_start:not(.rdp-day_range_end) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.rdp:not([dir='rtl']) .rdp-day_range_end:not(.rdp-day_range_start) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.rdp[dir='rtl'] .rdp-day_range_start:not(.rdp-day_range_end) {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n\n.rdp[dir='rtl'] .rdp-day_range_end:not(.rdp-day_range_start) {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.rdp-day_range_end.rdp-day_range_start {\n border-radius: 100%;\n}\n\n.rdp-day_range_middle {\n border-radius: 0;\n}\n"]}
|
package/dist/style.module.css
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
--rdp-cell-size: 40px;
|
|
3
|
-
--rdp-caption-font-size: 18px;
|
|
4
|
-
--rdp-accent-color: #0000ff;
|
|
5
|
-
--rdp-background-color: #e7edff;
|
|
6
|
-
--rdp-accent-color-dark: #3003e1;
|
|
7
|
-
--rdp-background-color-dark: #180270;
|
|
2
|
+
--rdp-cell-size: 40px; /* Size of the day cells. */
|
|
3
|
+
--rdp-caption-font-size: 18px; /* Font size for the caption labels. */
|
|
4
|
+
--rdp-accent-color: #0000ff; /* Accent color for the background of selected days. */
|
|
5
|
+
--rdp-background-color: #e7edff; /* Background color for the hovered/focused elements. */
|
|
6
|
+
--rdp-accent-color-dark: #3003e1; /* Accent color for the background of selected days (to use in dark-mode). */
|
|
7
|
+
--rdp-background-color-dark: #180270; /* Background color for the hovered/focused elements (to use in dark-mode). */
|
|
8
8
|
--rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */
|
|
9
9
|
--rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */
|
|
10
|
+
--rdp-selected-color: #fff; /* Color of selected day text */
|
|
10
11
|
|
|
11
12
|
margin: 1em;
|
|
12
13
|
}
|
|
@@ -270,7 +271,7 @@
|
|
|
270
271
|
.day_selected,
|
|
271
272
|
.day_selected:focus-visible,
|
|
272
273
|
.day_selected:hover {
|
|
273
|
-
color:
|
|
274
|
+
color: var(--rdp-selected-color);
|
|
274
275
|
opacity: 1;
|
|
275
276
|
background-color: var(--rdp-accent-color);
|
|
276
277
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-day-picker",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.1",
|
|
4
4
|
"description": "Customizable Date Picker for React",
|
|
5
5
|
"author": "Giampaolo Bellavite <io@gpbl.dev>",
|
|
6
6
|
"homepage": "http://react-day-picker.js.org",
|
|
@@ -33,50 +33,50 @@
|
|
|
33
33
|
"tsconfig.json"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@jest/types": "^29.
|
|
36
|
+
"@jest/types": "^29.6.3",
|
|
37
37
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
38
|
-
"@rollup/plugin-node-resolve": "^15.
|
|
38
|
+
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
39
39
|
"@rollup/plugin-terser": "^0.4.1",
|
|
40
|
-
"@rollup/plugin-typescript": "^11.1.
|
|
41
|
-
"@testing-library/dom": "^9.3.
|
|
42
|
-
"@testing-library/jest-dom": "^5.
|
|
40
|
+
"@rollup/plugin-typescript": "^11.1.3",
|
|
41
|
+
"@testing-library/dom": "^9.3.3",
|
|
42
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
43
43
|
"@testing-library/react": "^14.0.0",
|
|
44
|
-
"@testing-library/user-event": "^14.
|
|
45
|
-
"@types/jest": "^29.5.
|
|
46
|
-
"@types/node": "^
|
|
47
|
-
"@types/react
|
|
48
|
-
"@types/react": "^18.
|
|
49
|
-
"@types/testing-library__jest-dom": "^5.14.
|
|
44
|
+
"@testing-library/user-event": "^14.5.1",
|
|
45
|
+
"@types/jest": "^29.5.5",
|
|
46
|
+
"@types/node": "^20.6.5",
|
|
47
|
+
"@types/react": "^18.2.22",
|
|
48
|
+
"@types/react-dom": "^18.2.13",
|
|
49
|
+
"@types/testing-library__jest-dom": "^5.14.9",
|
|
50
50
|
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
|
51
|
-
"@typescript-eslint/parser": "^5.
|
|
52
|
-
"date-fns": "^2.
|
|
51
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
52
|
+
"date-fns": "^2.30.0",
|
|
53
|
+
"eslint": "^8.50.0",
|
|
53
54
|
"eslint-config-prettier": "^9.0.0",
|
|
54
|
-
"eslint-import-resolver-typescript": "^3.
|
|
55
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
55
56
|
"eslint-plugin-import": "^2.27.5",
|
|
56
|
-
"eslint-plugin-jest": "^27.
|
|
57
|
+
"eslint-plugin-jest": "^27.4.0",
|
|
57
58
|
"eslint-plugin-prettier": "^4.2.1",
|
|
58
59
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
59
|
-
"eslint-plugin-testing-library": "^5.
|
|
60
|
-
"
|
|
61
|
-
"jest-environment-jsdom": "^29.
|
|
62
|
-
"jest": "^29.5.0",
|
|
60
|
+
"eslint-plugin-testing-library": "^5.11.1",
|
|
61
|
+
"jest": "^29.7.0",
|
|
62
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
63
63
|
"mockdate": "^3.0.5",
|
|
64
|
+
"postcss": "^8.4.30",
|
|
64
65
|
"postcss-d-ts": "^1.2.0",
|
|
65
66
|
"postcss-typescript-d-ts": "^1.0.0",
|
|
66
|
-
"postcss": "^8.4.23",
|
|
67
67
|
"prettier": "^2.8.8",
|
|
68
|
+
"react": "^18.2.0",
|
|
68
69
|
"react-classnaming": "^0.16.4",
|
|
69
70
|
"react-dom": "^18.2.0",
|
|
70
|
-
"react": "^18.2.0",
|
|
71
71
|
"rimraf": "^5.0.1",
|
|
72
|
-
"rollup
|
|
72
|
+
"rollup": "^3.29.3",
|
|
73
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
73
74
|
"rollup-plugin-dts": "^5.3.0",
|
|
74
75
|
"rollup-plugin-postcss": "^4.0.2",
|
|
75
|
-
"
|
|
76
|
-
"ts-jest": "^29.1.0",
|
|
76
|
+
"ts-jest": "^29.1.1",
|
|
77
77
|
"ts-node": "^10.9.1",
|
|
78
|
-
"tsc-alias": "^1.8.
|
|
79
|
-
"tslib": "^2.
|
|
78
|
+
"tsc-alias": "^1.8.8",
|
|
79
|
+
"tslib": "^2.6.2",
|
|
80
80
|
"typescript": "~4.9.5"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
package/src/DayPicker.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
2
|
|
|
3
3
|
import { isSameMonth } from 'date-fns';
|
|
4
4
|
|
|
@@ -25,12 +25,12 @@ export function CaptionNavigation(props: CaptionProps): JSX.Element {
|
|
|
25
25
|
const hideNext = numberOfMonths > 1 && (isFirst || !isLast);
|
|
26
26
|
const hidePrevious = numberOfMonths > 1 && (isLast || !isFirst);
|
|
27
27
|
|
|
28
|
-
const handlePreviousClick:
|
|
28
|
+
const handlePreviousClick: MouseEventHandler = () => {
|
|
29
29
|
if (!previousMonth) return;
|
|
30
30
|
goToMonth(previousMonth);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const handleNextClick:
|
|
33
|
+
const handleNextClick: MouseEventHandler = () => {
|
|
34
34
|
if (!nextMonth) return;
|
|
35
35
|
goToMonth(nextMonth);
|
|
36
36
|
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
ChangeEventHandler,
|
|
3
|
+
CSSProperties,
|
|
4
|
+
ReactNode,
|
|
5
|
+
SelectHTMLAttributes
|
|
6
|
+
} from 'react';
|
|
2
7
|
|
|
3
8
|
import { IconDropdown } from 'components/IconDropdown';
|
|
4
9
|
import { useDayPicker } from 'contexts/DayPicker';
|
|
@@ -8,14 +13,14 @@ export interface DropdownProps {
|
|
|
8
13
|
/** The name attribute of the element. */
|
|
9
14
|
name?: string;
|
|
10
15
|
/** The caption displayed to replace the hidden select. */
|
|
11
|
-
caption?:
|
|
12
|
-
children?:
|
|
16
|
+
caption?: ReactNode;
|
|
17
|
+
children?: SelectHTMLAttributes<HTMLSelectElement>['children'];
|
|
13
18
|
className?: string;
|
|
14
19
|
['aria-label']?: string;
|
|
15
|
-
style?:
|
|
20
|
+
style?: CSSProperties;
|
|
16
21
|
/** The selected value. */
|
|
17
22
|
value?: string | number;
|
|
18
|
-
onChange?:
|
|
23
|
+
onChange?: ChangeEventHandler<HTMLSelectElement>;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { customRender } from 'test/render';
|
|
2
|
+
|
|
3
|
+
import { Months } from './Months';
|
|
4
|
+
|
|
5
|
+
let root: HTMLElement;
|
|
6
|
+
|
|
7
|
+
test('should use the default class name', () => {
|
|
8
|
+
const view = customRender(<Months>foo</Months>, {});
|
|
9
|
+
root = view.container.firstChild as HTMLElement;
|
|
10
|
+
expect(root).toHaveClass('rdp-months');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('should use a custom class name', () => {
|
|
14
|
+
const view = customRender(<Months>foo</Months>, {
|
|
15
|
+
classNames: { months: 'foo' }
|
|
16
|
+
});
|
|
17
|
+
root = view.container.firstChild as HTMLElement;
|
|
18
|
+
expect(root).toHaveClass('foo');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('should use a custom style', () => {
|
|
22
|
+
const view = customRender(<Months>foo</Months>, {
|
|
23
|
+
styles: { months: { color: 'red' } }
|
|
24
|
+
});
|
|
25
|
+
root = view.container.firstChild as HTMLElement;
|
|
26
|
+
expect(root).toHaveStyle({ color: 'red' });
|
|
27
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useDayPicker } from 'contexts/DayPicker';
|
|
4
|
+
|
|
5
|
+
/** The props for the {@link Months} component. */
|
|
6
|
+
export type MonthsProps = { children: ReactNode };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Render the wrapper for the month grids.
|
|
10
|
+
*/
|
|
11
|
+
export function Months(props: MonthsProps): JSX.Element {
|
|
12
|
+
const { classNames, styles } = useDayPicker();
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={classNames.months} style={styles.months}>
|
|
16
|
+
{props.children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Months';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
2
|
|
|
3
3
|
import { isSameYear, setMonth, startOfMonth } from 'date-fns';
|
|
4
4
|
|
|
@@ -46,7 +46,7 @@ export function MonthsDropdown(props: MonthsDropdownProps): JSX.Element {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const handleChange:
|
|
49
|
+
const handleChange: ChangeEventHandler<HTMLSelectElement> = (e) => {
|
|
50
50
|
const selectedMonth = Number(e.target.value);
|
|
51
51
|
const newMonth = setMonth(startOfMonth(props.displayMonth), selectedMonth);
|
|
52
52
|
props.onChange(newMonth);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
2
|
|
|
3
3
|
import { IconLeft } from 'components/IconLeft';
|
|
4
4
|
import { IconRight } from 'components/IconRight';
|
|
@@ -19,9 +19,9 @@ export interface NavigationProps {
|
|
|
19
19
|
/** Hide the next button. */
|
|
20
20
|
hideNext: boolean;
|
|
21
21
|
/** Event handler when the next button is clicked. */
|
|
22
|
-
onNextClick:
|
|
22
|
+
onNextClick: MouseEventHandler<HTMLButtonElement>;
|
|
23
23
|
/** Event handler when the previous button is clicked. */
|
|
24
|
-
onPreviousClick:
|
|
24
|
+
onPreviousClick: MouseEventHandler<HTMLButtonElement>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/** A component rendering the navigation buttons or the drop-downs. */
|