react-day-picker 10.0.0 → 10.0.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 CHANGED
@@ -6,7 +6,7 @@ You are reading the README for `react-day-picker`, the legacy DayPicker package
6
6
 
7
7
  ## Documentation
8
8
 
9
- See **[daypicker.dev](https://daypicker.dev)** for guides, examples, and API reference, or read [the v10 docs in the repository](https://github.com/gpbl/react-day-picker/blob/main/apps/website/versioned_docs/version-next/start.mdx).
9
+ See **[daypicker.dev](https://daypicker.dev)** for guides, examples, and API reference, or read [the v10 docs in the repository](https://github.com/gpbl/react-day-picker/blob/main/apps/website/docs/start.mdx).
10
10
 
11
11
  <picture>
12
12
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/gpbl/react-day-picker/main/apps/website/static/img/screenshot-dark.png" />
@@ -32,13 +32,13 @@ DayPicker is written in TypeScript and compiled to CommonJS and ESM. It relies o
32
32
  Install the legacy DayPicker package name:
33
33
 
34
34
  ```bash
35
- npm install react-day-picker@next
35
+ npm install react-day-picker
36
36
  ```
37
37
 
38
38
  For new projects, prefer the `@daypicker/react` package name:
39
39
 
40
40
  ```bash
41
- npm install @daypicker/react@next
41
+ npm install @daypicker/react
42
42
  ```
43
43
 
44
44
  <a href="https://www.npmjs.com/package/react-day-picker"><img src="https://img.shields.io/npm/v/react-day-picker" alt="npm version"/></a> <img src="https://img.shields.io/npm/dm/react-day-picker.svg" alt="npm downloads"/> <img src="https://img.shields.io/bundlephobia/minzip/react-day-picker" alt="Min gzipped size"/>
@@ -255,6 +255,17 @@ function DayPicker(initialProps) {
255
255
  style: { ...styles?.[UI_js_1.UI.Root], ...props.style },
256
256
  }), [classNames, props.className, props.style, styles]);
257
257
  const dataAttributes = (0, getDataAttributes_js_1.getDataAttributes)(props);
258
+ const getDropdownStyle = (dropdown) => {
259
+ const dropdownStyle = styles?.[UI_js_1.UI.Dropdown];
260
+ const specificDropdownStyle = styles?.[dropdown];
261
+ if (!dropdownStyle && !specificDropdownStyle) {
262
+ return undefined;
263
+ }
264
+ return {
265
+ ...dropdownStyle,
266
+ ...specificDropdownStyle,
267
+ };
268
+ };
258
269
  const rootElRef = (0, react_1.useRef)(null);
259
270
  (0, useAnimation_js_1.useAnimation)(rootElRef, Boolean(props.animate), {
260
271
  classNames,
@@ -291,14 +302,14 @@ function DayPicker(initialProps) {
291
302
  key: displayIndex, displayIndex: displayIndex, calendarMonth: calendarMonth },
292
303
  navLayout === "around" &&
293
304
  !props.hideNavigation &&
294
- displayIndex === 0 && (react_1.default.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI_js_1.UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : undefined },
295
- react_1.default.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }))),
305
+ displayIndex === 0 && (react_1.default.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI_js_1.UI.PreviousMonthButton], style: styles?.[UI_js_1.UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : undefined },
306
+ react_1.default.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], style: styles?.[UI_js_1.UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }))),
296
307
  react_1.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : undefined, className: classNames[UI_js_1.UI.MonthCaption], style: styles?.[UI_js_1.UI.MonthCaption], calendarMonth: calendarMonth, displayIndex: displayIndex }, captionLayout?.startsWith("dropdown") ? (react_1.default.createElement(components.DropdownNav, { className: classNames[UI_js_1.UI.Dropdowns], style: styles?.[UI_js_1.UI.Dropdowns] },
297
308
  (() => {
298
309
  const monthControl = captionLayout === "dropdown" ||
299
- captionLayout === "dropdown-months" ? (react_1.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI_js_1.UI.MonthsDropdown], "aria-label": labelMonthDropdown(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: (0, getMonthOptions_js_1.getMonthOptions)(calendarMonth.date, navStart, navEnd, formatters, dateLib), style: styles?.[UI_js_1.UI.Dropdown], value: dateLib.getMonth(calendarMonth.date) })) : (react_1.default.createElement("span", { key: "month" }, formatMonthDropdown(calendarMonth.date, dateLib)));
310
+ captionLayout === "dropdown-months" ? (react_1.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI_js_1.UI.MonthsDropdown], "aria-label": labelMonthDropdown(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: (0, getMonthOptions_js_1.getMonthOptions)(calendarMonth.date, navStart, navEnd, formatters, dateLib), style: getDropdownStyle(UI_js_1.UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) })) : (react_1.default.createElement("span", { key: "month" }, formatMonthDropdown(calendarMonth.date, dateLib)));
300
311
  const yearControl = captionLayout === "dropdown" ||
301
- captionLayout === "dropdown-years" ? (react_1.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI_js_1.UI.YearsDropdown], "aria-label": labelYearDropdown(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: (0, getYearOptions_js_1.getYearOptions)(navStart, navEnd, formatters, dateLib, Boolean(props.reverseYears)), style: styles?.[UI_js_1.UI.Dropdown], value: dateLib.getYear(calendarMonth.date) })) : (react_1.default.createElement("span", { key: "year" }, formatYearDropdown(calendarMonth.date, dateLib)));
312
+ captionLayout === "dropdown-years" ? (react_1.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI_js_1.UI.YearsDropdown], "aria-label": labelYearDropdown(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: (0, getYearOptions_js_1.getYearOptions)(navStart, navEnd, formatters, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI_js_1.UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) })) : (react_1.default.createElement("span", { key: "year" }, formatYearDropdown(calendarMonth.date, dateLib)));
302
313
  const controls = dateLib.getMonthYearOrder() === "year-first"
303
314
  ? [yearControl, monthControl]
304
315
  : [monthControl, yearControl];
@@ -315,11 +326,11 @@ function DayPicker(initialProps) {
315
326
  width: "1px",
316
327
  whiteSpace: "nowrap",
317
328
  wordWrap: "normal",
318
- } }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))) : (react_1.default.createElement(components.CaptionLabel, { className: classNames[UI_js_1.UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))),
329
+ } }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))) : (react_1.default.createElement(components.CaptionLabel, { className: classNames[UI_js_1.UI.CaptionLabel], style: styles?.[UI_js_1.UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))),
319
330
  navLayout === "around" &&
320
331
  !props.hideNavigation &&
321
- displayIndex === numberOfMonths - 1 && (react_1.default.createElement(components.NextMonthButton, { type: "button", className: classNames[UI_js_1.UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : undefined },
322
- react_1.default.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }))),
332
+ displayIndex === numberOfMonths - 1 && (react_1.default.createElement(components.NextMonthButton, { type: "button", className: classNames[UI_js_1.UI.NextMonthButton], style: styles?.[UI_js_1.UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : undefined },
333
+ react_1.default.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], style: styles?.[UI_js_1.UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }))),
323
334
  displayIndex === numberOfMonths - 1 &&
324
335
  navLayout === "after" &&
325
336
  !props.hideNavigation && (react_1.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : undefined, className: classNames[UI_js_1.UI.Nav], style: styles?.[UI_js_1.UI.Nav], "aria-label": labelNav(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth: previousMonth, nextMonth: nextMonth })),
@@ -7,6 +7,7 @@ import React from "react";
7
7
  */
8
8
  export declare function Chevron(props: {
9
9
  className?: string;
10
+ style?: React.CSSProperties;
10
11
  /**
11
12
  * The size of the chevron.
12
13
  *
@@ -12,8 +12,8 @@ const react_1 = __importDefault(require("react"));
12
12
  * @see https://daypicker.dev/guides/custom-components
13
13
  */
14
14
  function Chevron(props) {
15
- const { size = 24, orientation = "left", className } = props;
16
- return (react_1.default.createElement("svg", { className: className, width: size, height: size, viewBox: "0 0 24 24" },
15
+ const { size = 24, orientation = "left", className, style } = props;
16
+ return (react_1.default.createElement("svg", { className: className, style: style, width: size, height: size, viewBox: "0 0 24 24" },
17
17
  orientation === "up" && (react_1.default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" })),
18
18
  orientation === "down" && (react_1.default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" })),
19
19
  orientation === "left" && (react_1.default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" })),
@@ -15,12 +15,12 @@ const useDayPicker_js_1 = require("../useDayPicker.js");
15
15
  */
16
16
  function Dropdown(props) {
17
17
  const { options, className, ...selectProps } = props;
18
- const { classNames, components } = (0, useDayPicker_js_1.useDayPicker)();
18
+ const { classNames, components, styles } = (0, useDayPicker_js_1.useDayPicker)();
19
19
  const cssClassSelect = [classNames[UI_js_1.UI.Dropdown], className].join(" ");
20
20
  const selectedOption = options?.find(({ value }) => value === selectProps.value);
21
- return (react_1.default.createElement("span", { "data-disabled": selectProps.disabled, className: classNames[UI_js_1.UI.DropdownRoot] },
21
+ return (react_1.default.createElement("span", { "data-disabled": selectProps.disabled, className: classNames[UI_js_1.UI.DropdownRoot], style: styles?.[UI_js_1.UI.DropdownRoot] },
22
22
  react_1.default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled }) => (react_1.default.createElement(components.Option, { key: value, value: value, disabled: disabled }, label)))),
23
- react_1.default.createElement("span", { className: classNames[UI_js_1.UI.CaptionLabel], "aria-hidden": true },
23
+ react_1.default.createElement("span", { className: classNames[UI_js_1.UI.CaptionLabel], style: styles?.[UI_js_1.UI.CaptionLabel], "aria-hidden": true },
24
24
  selectedOption?.label,
25
- react_1.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI_js_1.UI.Chevron] }))));
25
+ react_1.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI_js_1.UI.Chevron], style: styles?.[UI_js_1.UI.Chevron] }))));
26
26
  }
@@ -45,7 +45,7 @@ const useDayPicker_js_1 = require("../useDayPicker.js");
45
45
  */
46
46
  function Nav(props) {
47
47
  const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;
48
- const { components, classNames, labels: { labelPrevious, labelNext }, } = (0, useDayPicker_js_1.useDayPicker)();
48
+ const { components, classNames, styles, labels: { labelPrevious, labelNext }, } = (0, useDayPicker_js_1.useDayPicker)();
49
49
  const handleNextClick = (0, react_1.useCallback)((e) => {
50
50
  if (nextMonth) {
51
51
  onNextClick?.(e);
@@ -57,8 +57,8 @@ function Nav(props) {
57
57
  }
58
58
  }, [previousMonth, onPreviousClick]);
59
59
  return (react_1.default.createElement("nav", { ...navProps },
60
- react_1.default.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI_js_1.UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick },
61
- react_1.default.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], orientation: "left" })),
62
- react_1.default.createElement(components.NextMonthButton, { type: "button", className: classNames[UI_js_1.UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick },
63
- react_1.default.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, orientation: "right", className: classNames[UI_js_1.UI.Chevron] }))));
60
+ react_1.default.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI_js_1.UI.PreviousMonthButton], style: styles?.[UI_js_1.UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick },
61
+ react_1.default.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], style: styles?.[UI_js_1.UI.Chevron], orientation: "left" })),
62
+ react_1.default.createElement(components.NextMonthButton, { type: "button", className: classNames[UI_js_1.UI.NextMonthButton], style: styles?.[UI_js_1.UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick },
63
+ react_1.default.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, orientation: "right", className: classNames[UI_js_1.UI.Chevron], style: styles?.[UI_js_1.UI.Chevron] }))));
64
64
  }
@@ -219,6 +219,17 @@ export function DayPicker(initialProps) {
219
219
  style: { ...styles?.[UI.Root], ...props.style },
220
220
  }), [classNames, props.className, props.style, styles]);
221
221
  const dataAttributes = getDataAttributes(props);
222
+ const getDropdownStyle = (dropdown) => {
223
+ const dropdownStyle = styles?.[UI.Dropdown];
224
+ const specificDropdownStyle = styles?.[dropdown];
225
+ if (!dropdownStyle && !specificDropdownStyle) {
226
+ return undefined;
227
+ }
228
+ return {
229
+ ...dropdownStyle,
230
+ ...specificDropdownStyle,
231
+ };
232
+ };
222
233
  const rootElRef = useRef(null);
223
234
  useAnimation(rootElRef, Boolean(props.animate), {
224
235
  classNames,
@@ -255,14 +266,14 @@ export function DayPicker(initialProps) {
255
266
  key: displayIndex, displayIndex: displayIndex, calendarMonth: calendarMonth },
256
267
  navLayout === "around" &&
257
268
  !props.hideNavigation &&
258
- displayIndex === 0 && (React.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : undefined },
259
- React.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }))),
269
+ displayIndex === 0 && (React.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : undefined },
270
+ React.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }))),
260
271
  React.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : undefined, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth: calendarMonth, displayIndex: displayIndex }, captionLayout?.startsWith("dropdown") ? (React.createElement(components.DropdownNav, { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] },
261
272
  (() => {
262
273
  const monthControl = captionLayout === "dropdown" ||
263
- captionLayout === "dropdown-months" ? (React.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters, dateLib), style: styles?.[UI.Dropdown], value: dateLib.getMonth(calendarMonth.date) })) : (React.createElement("span", { key: "month" }, formatMonthDropdown(calendarMonth.date, dateLib)));
274
+ captionLayout === "dropdown-months" ? (React.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) })) : (React.createElement("span", { key: "month" }, formatMonthDropdown(calendarMonth.date, dateLib)));
264
275
  const yearControl = captionLayout === "dropdown" ||
265
- captionLayout === "dropdown-years" ? (React.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters, dateLib, Boolean(props.reverseYears)), style: styles?.[UI.Dropdown], value: dateLib.getYear(calendarMonth.date) })) : (React.createElement("span", { key: "year" }, formatYearDropdown(calendarMonth.date, dateLib)));
276
+ captionLayout === "dropdown-years" ? (React.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) })) : (React.createElement("span", { key: "year" }, formatYearDropdown(calendarMonth.date, dateLib)));
266
277
  const controls = dateLib.getMonthYearOrder() === "year-first"
267
278
  ? [yearControl, monthControl]
268
279
  : [monthControl, yearControl];
@@ -279,11 +290,11 @@ export function DayPicker(initialProps) {
279
290
  width: "1px",
280
291
  whiteSpace: "nowrap",
281
292
  wordWrap: "normal",
282
- } }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))) : (React.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))),
293
+ } }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))) : (React.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption(calendarMonth.date, dateLib.options, dateLib)))),
283
294
  navLayout === "around" &&
284
295
  !props.hideNavigation &&
285
- displayIndex === numberOfMonths - 1 && (React.createElement(components.NextMonthButton, { type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : undefined },
286
- React.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, className: classNames[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }))),
296
+ displayIndex === numberOfMonths - 1 && (React.createElement(components.NextMonthButton, { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : undefined },
297
+ React.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }))),
287
298
  displayIndex === numberOfMonths - 1 &&
288
299
  navLayout === "after" &&
289
300
  !props.hideNavigation && (React.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : undefined, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth: previousMonth, nextMonth: nextMonth })),
@@ -7,6 +7,7 @@ import React from "react";
7
7
  */
8
8
  export declare function Chevron(props: {
9
9
  className?: string;
10
+ style?: React.CSSProperties;
10
11
  /**
11
12
  * The size of the chevron.
12
13
  *
@@ -6,8 +6,8 @@ import React from "react";
6
6
  * @see https://daypicker.dev/guides/custom-components
7
7
  */
8
8
  export function Chevron(props) {
9
- const { size = 24, orientation = "left", className } = props;
10
- return (React.createElement("svg", { className: className, width: size, height: size, viewBox: "0 0 24 24" },
9
+ const { size = 24, orientation = "left", className, style } = props;
10
+ return (React.createElement("svg", { className: className, style: style, width: size, height: size, viewBox: "0 0 24 24" },
11
11
  orientation === "up" && (React.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" })),
12
12
  orientation === "down" && (React.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" })),
13
13
  orientation === "left" && (React.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" })),
@@ -9,12 +9,12 @@ import { useDayPicker } from "../useDayPicker.js";
9
9
  */
10
10
  export function Dropdown(props) {
11
11
  const { options, className, ...selectProps } = props;
12
- const { classNames, components } = useDayPicker();
12
+ const { classNames, components, styles } = useDayPicker();
13
13
  const cssClassSelect = [classNames[UI.Dropdown], className].join(" ");
14
14
  const selectedOption = options?.find(({ value }) => value === selectProps.value);
15
- return (React.createElement("span", { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot] },
15
+ return (React.createElement("span", { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles?.[UI.DropdownRoot] },
16
16
  React.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled }) => (React.createElement(components.Option, { key: value, value: value, disabled: disabled }, label)))),
17
- React.createElement("span", { className: classNames[UI.CaptionLabel], "aria-hidden": true },
17
+ React.createElement("span", { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], "aria-hidden": true },
18
18
  selectedOption?.label,
19
- React.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron] }))));
19
+ React.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }))));
20
20
  }
@@ -9,7 +9,7 @@ import { useDayPicker } from "../useDayPicker.js";
9
9
  */
10
10
  export function Nav(props) {
11
11
  const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props;
12
- const { components, classNames, labels: { labelPrevious, labelNext }, } = useDayPicker();
12
+ const { components, classNames, styles, labels: { labelPrevious, labelNext }, } = useDayPicker();
13
13
  const handleNextClick = useCallback((e) => {
14
14
  if (nextMonth) {
15
15
  onNextClick?.(e);
@@ -21,8 +21,8 @@ export function Nav(props) {
21
21
  }
22
22
  }, [previousMonth, onPreviousClick]);
23
23
  return (React.createElement("nav", { ...navProps },
24
- React.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick },
25
- React.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI.Chevron], orientation: "left" })),
26
- React.createElement(components.NextMonthButton, { type: "button", className: classNames[UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick },
27
- React.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, orientation: "right", className: classNames[UI.Chevron] }))));
24
+ React.createElement(components.PreviousMonthButton, { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? undefined : -1, "aria-disabled": previousMonth ? undefined : true, "aria-label": labelPrevious(previousMonth), onClick: handlePreviousClick },
25
+ React.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: "left" })),
26
+ React.createElement(components.NextMonthButton, { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? undefined : -1, "aria-disabled": nextMonth ? undefined : true, "aria-label": labelNext(nextMonth), onClick: handleNextClick },
27
+ React.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, orientation: "right", className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }))));
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-day-picker",
3
- "version": "10.0.0",
3
+ "version": "10.0.1",
4
4
  "description": "Customizable Date Picker for React",
5
5
  "author": "Giampaolo Bellavite <io@gpbl.dev>",
6
6
  "homepage": "https://daypicker.dev",
@@ -168,7 +168,13 @@
168
168
  "date-fns": "^4.1.0"
169
169
  },
170
170
  "peerDependencies": {
171
- "react": ">=16.8.0"
171
+ "react": ">=16.8.0",
172
+ "@types/react": ">=16.8.0"
173
+ },
174
+ "peerDependenciesMeta": {
175
+ "@types/react": {
176
+ "optional": true
177
+ }
172
178
  },
173
179
  "funding": {
174
180
  "type": "individual",