react-day-picker 10.0.0-next.5 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/dist/cjs/DayPicker.js +89 -88
- package/dist/cjs/classes/DateLib.d.ts +1 -0
- package/dist/cjs/components/CaptionLabel.d.ts +1 -0
- package/dist/cjs/components/Chevron.d.ts +1 -0
- package/dist/cjs/components/Day.d.ts +1 -0
- package/dist/cjs/components/DayButton.d.ts +1 -0
- package/dist/cjs/components/Dropdown.d.ts +1 -0
- package/dist/cjs/components/DropdownNav.d.ts +1 -0
- package/dist/cjs/components/Footer.d.ts +1 -0
- package/dist/cjs/components/Month.d.ts +1 -0
- package/dist/cjs/components/MonthCaption.d.ts +1 -0
- package/dist/cjs/components/MonthGrid.d.ts +1 -0
- package/dist/cjs/components/Months.d.ts +1 -0
- package/dist/cjs/components/Nav.d.ts +1 -0
- package/dist/cjs/components/NextMonthButton.d.ts +1 -0
- package/dist/cjs/components/Option.d.ts +1 -0
- package/dist/cjs/components/PreviousMonthButton.d.ts +1 -0
- package/dist/cjs/components/Root.d.ts +1 -0
- package/dist/cjs/components/Select.d.ts +1 -0
- package/dist/cjs/components/Week.d.ts +1 -0
- package/dist/cjs/components/WeekNumber.d.ts +1 -0
- package/dist/cjs/components/WeekNumberHeader.d.ts +1 -0
- package/dist/cjs/components/Weekday.d.ts +1 -0
- package/dist/cjs/components/Weekdays.d.ts +1 -0
- package/dist/cjs/components/Weeks.d.ts +1 -0
- package/dist/cjs/locale.d.ts +0 -1
- package/dist/cjs/locale.js +2 -4
- package/dist/cjs/types/props.d.ts +2 -1
- package/dist/cjs/types/selection.d.ts +7 -0
- package/dist/esm/DayPicker.js +89 -88
- package/dist/esm/classes/DateLib.d.ts +1 -0
- package/dist/esm/components/CaptionLabel.d.ts +1 -0
- package/dist/esm/components/Chevron.d.ts +1 -0
- package/dist/esm/components/Day.d.ts +1 -0
- package/dist/esm/components/DayButton.d.ts +1 -0
- package/dist/esm/components/Dropdown.d.ts +1 -0
- package/dist/esm/components/DropdownNav.d.ts +1 -0
- package/dist/esm/components/Footer.d.ts +1 -0
- package/dist/esm/components/Month.d.ts +1 -0
- package/dist/esm/components/MonthCaption.d.ts +1 -0
- package/dist/esm/components/MonthGrid.d.ts +1 -0
- package/dist/esm/components/Months.d.ts +1 -0
- package/dist/esm/components/Nav.d.ts +1 -0
- package/dist/esm/components/NextMonthButton.d.ts +1 -0
- package/dist/esm/components/Option.d.ts +1 -0
- package/dist/esm/components/PreviousMonthButton.d.ts +1 -0
- package/dist/esm/components/Root.d.ts +1 -0
- package/dist/esm/components/Select.d.ts +1 -0
- package/dist/esm/components/Week.d.ts +1 -0
- package/dist/esm/components/WeekNumber.d.ts +1 -0
- package/dist/esm/components/WeekNumberHeader.d.ts +1 -0
- package/dist/esm/components/Weekday.d.ts +1 -0
- package/dist/esm/components/Weekdays.d.ts +1 -0
- package/dist/esm/components/Weeks.d.ts +1 -0
- package/dist/esm/locale.d.ts +0 -1
- package/dist/esm/locale.js +0 -1
- package/dist/esm/types/props.d.ts +2 -1
- package/dist/esm/types/selection.d.ts +7 -0
- package/package.json +1 -1
- package/dist/cjs/locale/am-ET.d.ts +0 -7
- package/dist/cjs/locale/am-ET.js +0 -131
- package/dist/esm/locale/am-ET.d.ts +0 -7
- package/dist/esm/locale/am-ET.js +0 -128
package/dist/esm/DayPicker.js
CHANGED
|
@@ -128,12 +128,8 @@ export function DayPicker(initialProps) {
|
|
|
128
128
|
props.labels,
|
|
129
129
|
props.classNames,
|
|
130
130
|
]);
|
|
131
|
-
if (!props.today
|
|
132
|
-
props = {
|
|
133
|
-
...props,
|
|
134
|
-
today: props.today ?? dateLib.today(),
|
|
135
|
-
navLayout: props.navLayout ?? "after",
|
|
136
|
-
};
|
|
131
|
+
if (!props.today) {
|
|
132
|
+
props = { ...props, today: dateLib.today() };
|
|
137
133
|
}
|
|
138
134
|
const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles, } = props;
|
|
139
135
|
const { formatCaption, formatDay, formatMonthDropdown, formatWeekNumber, formatWeekNumberHeader, formatWeekdayName, formatYearDropdown, } = formatters;
|
|
@@ -206,15 +202,15 @@ export function DayPicker(initialProps) {
|
|
|
206
202
|
const handleDayMouseLeave = useCallback((day, modifiers) => (e) => {
|
|
207
203
|
onDayMouseLeave?.(day.date, modifiers, e);
|
|
208
204
|
}, [onDayMouseLeave]);
|
|
209
|
-
const handleMonthChange = useCallback((date) => (e) => {
|
|
205
|
+
const handleMonthChange = useCallback((date, monthOffset) => (e) => {
|
|
210
206
|
const selectedMonth = Number(e.target.value);
|
|
211
207
|
const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth);
|
|
212
|
-
goToMonth(month);
|
|
208
|
+
goToMonth(dateLib.addMonths(month, -monthOffset));
|
|
213
209
|
}, [dateLib, goToMonth]);
|
|
214
|
-
const handleYearChange = useCallback((date) => (e) => {
|
|
210
|
+
const handleYearChange = useCallback((date, monthOffset) => (e) => {
|
|
215
211
|
const selectedYear = Number(e.target.value);
|
|
216
212
|
const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear);
|
|
217
|
-
goToMonth(month);
|
|
213
|
+
goToMonth(dateLib.addMonths(month, -monthOffset));
|
|
218
214
|
}, [dateLib, goToMonth]);
|
|
219
215
|
const { className, style } = useMemo(() => ({
|
|
220
216
|
className: [classNames[UI.Root], props.className]
|
|
@@ -248,83 +244,88 @@ export function DayPicker(initialProps) {
|
|
|
248
244
|
};
|
|
249
245
|
return (React.createElement(dayPickerContext.Provider, { value: contextValue },
|
|
250
246
|
React.createElement(components.Root, { rootRef: props.animate ? rootElRef : undefined, className: className, style: style, dir: props.dir, id: props.id, lang: props.lang ?? locale.code, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes },
|
|
251
|
-
React.createElement(components.Months, { className: classNames[UI.Months], style: styles?.[UI.Months] },
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
navLayout === "
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
undefined, className: classNames[UI.
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
React.createElement(components.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
modifiers[SelectionState.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
modifiers.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
247
|
+
React.createElement(components.Months, { className: classNames[UI.Months], style: styles?.[UI.Months] },
|
|
248
|
+
!props.hideNavigation && !navLayout && (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 })),
|
|
249
|
+
months.map((calendarMonth, displayIndex) => {
|
|
250
|
+
const monthOffset = props.reverseMonths
|
|
251
|
+
? months.length - 1 - displayIndex
|
|
252
|
+
: displayIndex;
|
|
253
|
+
return (React.createElement(components.Month, { "data-animated-month": props.animate ? "true" : undefined, className: classNames[UI.Month], style: styles?.[UI.Month],
|
|
254
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
|
|
255
|
+
key: displayIndex, displayIndex: displayIndex, calendarMonth: calendarMonth },
|
|
256
|
+
navLayout === "around" &&
|
|
257
|
+
!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" }))),
|
|
260
|
+
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
|
+
(() => {
|
|
262
|
+
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)));
|
|
264
|
+
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)));
|
|
266
|
+
const controls = dateLib.getMonthYearOrder() === "year-first"
|
|
267
|
+
? [yearControl, monthControl]
|
|
268
|
+
: [monthControl, yearControl];
|
|
269
|
+
return controls;
|
|
270
|
+
})(),
|
|
271
|
+
React.createElement("span", { role: "status", "aria-live": "polite", style: {
|
|
272
|
+
border: 0,
|
|
273
|
+
clip: "rect(0 0 0 0)",
|
|
274
|
+
height: "1px",
|
|
275
|
+
margin: "-1px",
|
|
276
|
+
overflow: "hidden",
|
|
277
|
+
padding: 0,
|
|
278
|
+
position: "absolute",
|
|
279
|
+
width: "1px",
|
|
280
|
+
whiteSpace: "nowrap",
|
|
281
|
+
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)))),
|
|
283
|
+
navLayout === "around" &&
|
|
284
|
+
!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" }))),
|
|
287
|
+
displayIndex === numberOfMonths - 1 &&
|
|
288
|
+
navLayout === "after" &&
|
|
289
|
+
!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 })),
|
|
290
|
+
React.createElement(components.MonthGrid, { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid(calendarMonth.date, dateLib.options, dateLib) ||
|
|
291
|
+
undefined, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] },
|
|
292
|
+
!props.hideWeekdays && (React.createElement(components.Weekdays, { "data-animated-weekdays": props.animate ? "true" : undefined, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] },
|
|
293
|
+
showWeekNumber && (React.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader())),
|
|
294
|
+
weekdays.map((weekday) => (React.createElement(components.Weekday, { "aria-label": labelWeekday(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName(weekday, dateLib.options, dateLib)))))),
|
|
295
|
+
React.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : undefined, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => {
|
|
296
|
+
return (React.createElement(components.Week, { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week: week },
|
|
297
|
+
showWeekNumber && (React.createElement(components.WeekNumber, { week: week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber(week.weekNumber, {
|
|
298
|
+
locale,
|
|
299
|
+
}), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber(week.weekNumber, dateLib))),
|
|
300
|
+
week.days.map((day) => {
|
|
301
|
+
const { date } = day;
|
|
302
|
+
const modifiers = getModifiers(day);
|
|
303
|
+
modifiers[DayFlag.focused] =
|
|
304
|
+
!modifiers.hidden &&
|
|
305
|
+
Boolean(focused?.isEqualTo(day));
|
|
306
|
+
modifiers[SelectionState.selected] =
|
|
307
|
+
isSelected?.(date) || modifiers.selected;
|
|
308
|
+
if (isDateRange(selectedValue)) {
|
|
309
|
+
// add range modifiers
|
|
310
|
+
const { from, to } = selectedValue;
|
|
311
|
+
modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
|
|
312
|
+
modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
|
|
313
|
+
modifiers[SelectionState.range_middle] =
|
|
314
|
+
rangeIncludesDate(selectedValue, date, true, dateLib);
|
|
315
|
+
}
|
|
316
|
+
const style = getStyleForModifiers(modifiers, styles, props.modifiersStyles);
|
|
317
|
+
const className = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames);
|
|
318
|
+
const ariaLabel = !isInteractive && !modifiers.hidden
|
|
319
|
+
? labelGridcell(date, modifiers, dateLib.options, dateLib)
|
|
320
|
+
: undefined;
|
|
321
|
+
return (React.createElement(components.Day, { key: `${day.isoDate}_${day.displayMonthId}`, day: day, modifiers: modifiers, className: className.join(" "), style: style, role: "gridcell", "aria-selected": modifiers.selected || undefined, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : undefined, "data-selected": modifiers.selected || undefined, "data-disabled": modifiers.disabled || undefined, "data-hidden": modifiers.hidden || undefined, "data-outside": day.outside || undefined, "data-focused": modifiers.focused || undefined, "data-today": modifiers.today || undefined }, !modifiers.hidden && isInteractive ? (React.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day: day, modifiers: modifiers, disabled: (!modifiers.focused &&
|
|
322
|
+
modifiers.disabled) ||
|
|
323
|
+
undefined, "aria-disabled": (modifiers.focused &&
|
|
324
|
+
modifiers.disabled) ||
|
|
325
|
+
undefined, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay(date, dateLib.options, dateLib))) : (!modifiers.hidden &&
|
|
326
|
+
formatDay(day.date, dateLib.options, dateLib))));
|
|
327
|
+
})));
|
|
328
|
+
})))));
|
|
329
|
+
})),
|
|
329
330
|
props.footer && (React.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer)))));
|
|
330
331
|
}
|
|
@@ -19,6 +19,7 @@ export interface DayPickerLocale extends DateFnsLocale {
|
|
|
19
19
|
/** Localized DayPicker-specific labels. */
|
|
20
20
|
labels?: DayPickerLocaleLabels;
|
|
21
21
|
}
|
|
22
|
+
/** Alias for the locale shape accepted by DayPicker APIs. */
|
|
22
23
|
export type Locale = DayPickerLocale;
|
|
23
24
|
/** Indicates the preferred ordering of month and year for localized labels. */
|
|
24
25
|
export type MonthYearOrder = "month-first" | "year-first";
|
|
@@ -6,4 +6,5 @@ import React, { type HTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function CaptionLabel(props: HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link CaptionLabel} component. */
|
|
9
10
|
export type CaptionLabelProps = Parameters<typeof CaptionLabel>[0];
|
|
@@ -18,4 +18,5 @@ export declare function Chevron(props: {
|
|
|
18
18
|
/** The orientation of the chevron. */
|
|
19
19
|
orientation?: "up" | "down" | "left" | "right";
|
|
20
20
|
}): React.JSX.Element;
|
|
21
|
+
/** Props accepted by the {@link Chevron} component. */
|
|
21
22
|
export type ChevronProps = Parameters<typeof Chevron>[0];
|
|
@@ -17,4 +17,5 @@ export declare function Day(props: {
|
|
|
17
17
|
/** The modifiers to apply to the day. */
|
|
18
18
|
modifiers: Modifiers;
|
|
19
19
|
} & HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
20
|
+
/** Props accepted by the {@link Day} component. */
|
|
20
21
|
export type DayProps = Parameters<typeof Day>[0];
|
|
@@ -13,4 +13,5 @@ export declare function DayButton(props: {
|
|
|
13
13
|
/** The modifiers to apply to the day. */
|
|
14
14
|
modifiers: Modifiers;
|
|
15
15
|
} & ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
16
|
+
/** Props accepted by the {@link DayButton} component. */
|
|
16
17
|
export type DayButtonProps = Parameters<typeof DayButton>[0];
|
|
@@ -18,4 +18,5 @@ export declare function Dropdown(props: {
|
|
|
18
18
|
/** The options to display in the dropdown. */
|
|
19
19
|
options?: DropdownOption[] | undefined;
|
|
20
20
|
} & Omit<SelectHTMLAttributes<HTMLSelectElement>, "children">): React.JSX.Element;
|
|
21
|
+
/** Props accepted by the {@link Dropdown} component. */
|
|
21
22
|
export type DropdownProps = Parameters<typeof Dropdown>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type HTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function DropdownNav(props: HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link DropdownNav} component. */
|
|
9
10
|
export type DropdownNavProps = Parameters<typeof DropdownNav>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type HTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function Footer(props: HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link Footer} component. */
|
|
9
10
|
export type FooterProps = Parameters<typeof Footer>[0];
|
|
@@ -13,4 +13,5 @@ export declare function Month(props: {
|
|
|
13
13
|
/** The index of the month being displayed. */
|
|
14
14
|
displayIndex: number;
|
|
15
15
|
} & HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
16
|
+
/** Props accepted by the {@link Month} component. */
|
|
16
17
|
export type MonthProps = Parameters<typeof Month>[0];
|
|
@@ -12,4 +12,5 @@ export declare function MonthCaption(props: {
|
|
|
12
12
|
/** The index of the month being displayed. */
|
|
13
13
|
displayIndex: number;
|
|
14
14
|
} & HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
15
|
+
/** Props accepted by the {@link MonthCaption} component. */
|
|
15
16
|
export type MonthCaptionProps = Parameters<typeof MonthCaption>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type TableHTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function MonthGrid(props: TableHTMLAttributes<HTMLTableElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link MonthGrid} component. */
|
|
9
10
|
export type MonthGridProps = Parameters<typeof MonthGrid>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type HTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function Months(props: HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link Months} component. */
|
|
9
10
|
export type MonthsProps = Parameters<typeof Months>[0];
|
|
@@ -15,4 +15,5 @@ export declare function Nav(props: {
|
|
|
15
15
|
/** The date of the next month, if available. */
|
|
16
16
|
nextMonth?: Date | undefined;
|
|
17
17
|
} & HTMLAttributes<HTMLElement>): React.JSX.Element;
|
|
18
|
+
/** Props accepted by the {@link Nav} component. */
|
|
18
19
|
export type NavProps = Parameters<typeof Nav>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type ButtonHTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function NextMonthButton(props: ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link NextMonthButton} component. */
|
|
9
10
|
export type NextMonthButtonProps = Parameters<typeof NextMonthButton>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type OptionHTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function Option(props: OptionHTMLAttributes<HTMLOptionElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link Option} component. */
|
|
9
10
|
export type OptionProps = Parameters<typeof Option>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type ButtonHTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function PreviousMonthButton(props: ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link PreviousMonthButton} component. */
|
|
9
10
|
export type PreviousMonthButtonProps = Parameters<typeof PreviousMonthButton>[0];
|
|
@@ -9,4 +9,5 @@ export declare function Root(props: {
|
|
|
9
9
|
/** Ref for the root element, used when `animate` is `true`. */
|
|
10
10
|
rootRef?: Ref<HTMLDivElement>;
|
|
11
11
|
} & HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
12
|
+
/** Props accepted by the {@link Root} component. */
|
|
12
13
|
export type RootProps = Parameters<typeof Root>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type SelectHTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function Select(props: SelectHTMLAttributes<HTMLSelectElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link Select} component. */
|
|
9
10
|
export type SelectProps = Parameters<typeof Select>[0];
|
|
@@ -10,4 +10,5 @@ export declare function WeekNumber(props: {
|
|
|
10
10
|
/** The week to display. */
|
|
11
11
|
week: CalendarWeek;
|
|
12
12
|
} & ThHTMLAttributes<HTMLTableCellElement>): React.JSX.Element;
|
|
13
|
+
/** Props accepted by the {@link WeekNumber} component. */
|
|
13
14
|
export type WeekNumberProps = Parameters<typeof WeekNumber>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type ThHTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function WeekNumberHeader(props: ThHTMLAttributes<HTMLTableCellElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link WeekNumberHeader} component. */
|
|
9
10
|
export type WeekNumberHeaderProps = Parameters<typeof WeekNumberHeader>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type ThHTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function Weekday(props: ThHTMLAttributes<HTMLTableCellElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link Weekday} component. */
|
|
9
10
|
export type WeekdayProps = Parameters<typeof Weekday>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type HTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function Weekdays(props: HTMLAttributes<HTMLTableRowElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link Weekdays} component. */
|
|
9
10
|
export type WeekdaysProps = Parameters<typeof Weekdays>[0];
|
|
@@ -6,4 +6,5 @@ import React, { type HTMLAttributes } from "react";
|
|
|
6
6
|
* @see https://daypicker.dev/guides/custom-components
|
|
7
7
|
*/
|
|
8
8
|
export declare function Weeks(props: HTMLAttributes<HTMLTableSectionElement>): React.JSX.Element;
|
|
9
|
+
/** Props accepted by the {@link Weeks} component. */
|
|
9
10
|
export type WeeksProps = Parameters<typeof Weeks>[0];
|
package/dist/esm/locale.d.ts
CHANGED
|
@@ -11,7 +11,6 @@ export type { DayPickerLocale, DayPickerLocaleLabels, } from "./classes/DateLib.
|
|
|
11
11
|
* @since V9.12.0
|
|
12
12
|
*/
|
|
13
13
|
export { af } from "./locale/af.js";
|
|
14
|
-
export { amET } from "./locale/am-ET.js";
|
|
15
14
|
export { ar } from "./locale/ar.js";
|
|
16
15
|
export { arDZ } from "./locale/ar-DZ.js";
|
|
17
16
|
export { arEG } from "./locale/ar-EG.js";
|
package/dist/esm/locale.js
CHANGED
|
@@ -163,7 +163,8 @@ export interface PropsBase {
|
|
|
163
163
|
* - `after`: Displays the buttons after the caption. This ensures the tab order
|
|
164
164
|
* matches the visual order.
|
|
165
165
|
*
|
|
166
|
-
*
|
|
166
|
+
* If not set, DayPicker preserves its legacy layout, but the tab order may
|
|
167
|
+
* not align with the visual order when using `captionLayout="dropdown"`.
|
|
167
168
|
*
|
|
168
169
|
* @since 9.7.0
|
|
169
170
|
* @see https://daypicker.dev/docs/customization#navigation-layouts
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DayPickerProps } from "./props.js";
|
|
2
2
|
import type { DateRange, Mode, Modifiers } from "./shared.js";
|
|
3
|
+
/** Selection state and helpers for the active selection mode. */
|
|
3
4
|
export type Selection<T extends DayPickerProps> = {
|
|
4
5
|
/** The selected date(s). */
|
|
5
6
|
selected: SelectedValue<T> | undefined;
|
|
@@ -8,12 +9,15 @@ export type Selection<T extends DayPickerProps> = {
|
|
|
8
9
|
/** Whether the given date is selected. */
|
|
9
10
|
isSelected: (date: Date) => boolean;
|
|
10
11
|
};
|
|
12
|
+
/** Selected value for single selection mode, respecting required selections. */
|
|
11
13
|
export type SelectedSingle<T extends {
|
|
12
14
|
required?: boolean;
|
|
13
15
|
}> = T["required"] extends true ? Date : Date | undefined;
|
|
16
|
+
/** Selected value for multiple selection mode, respecting required selections. */
|
|
14
17
|
export type SelectedMulti<T extends {
|
|
15
18
|
required?: boolean;
|
|
16
19
|
}> = T["required"] extends true ? Date[] : Date[] | undefined;
|
|
20
|
+
/** Selected value for range selection mode, respecting required selections. */
|
|
17
21
|
export type SelectedRange<T extends {
|
|
18
22
|
required?: boolean;
|
|
19
23
|
}> = T["required"] extends true ? DateRange : DateRange | undefined;
|
|
@@ -46,12 +50,15 @@ export type SelectedValue<T> = T extends {
|
|
|
46
50
|
mode: "range";
|
|
47
51
|
required?: boolean;
|
|
48
52
|
} ? SelectedRange<T> : undefined;
|
|
53
|
+
/** Selection handler for single selection mode. */
|
|
49
54
|
export type SelectHandlerSingle<T extends {
|
|
50
55
|
required?: boolean | undefined;
|
|
51
56
|
}> = (triggerDate: Date, modifiers: Modifiers, e: React.MouseEvent | React.KeyboardEvent) => T["required"] extends true ? Date : Date | undefined;
|
|
57
|
+
/** Selection handler for multiple selection mode. */
|
|
52
58
|
export type SelectHandlerMulti<T extends {
|
|
53
59
|
required?: boolean | undefined;
|
|
54
60
|
}> = (triggerDate: Date, modifiers: Modifiers, e: React.MouseEvent | React.KeyboardEvent) => T["required"] extends true ? Date[] : Date[] | undefined;
|
|
61
|
+
/** Selection handler for range selection mode. */
|
|
55
62
|
export type SelectHandlerRange<T extends {
|
|
56
63
|
required?: boolean | undefined;
|
|
57
64
|
}> = (triggerDate: Date, modifiers: Modifiers, e: React.MouseEvent | React.KeyboardEvent) => T["required"] extends true ? DateRange : DateRange | undefined;
|
package/package.json
CHANGED