react-day-picker 9.14.0 → 10.0.0-next.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/dist/cjs/DayPicker.js +84 -82
- package/dist/cjs/UI.d.ts +2 -239
- package/dist/cjs/UI.js +2 -2
- package/dist/cjs/classes/DateLib.d.ts +0 -21
- package/dist/cjs/classes/DateLib.js +3 -13
- package/dist/cjs/components/Chevron.js +1 -3
- package/dist/cjs/components/Dropdown.d.ts +0 -11
- package/dist/cjs/components/Dropdown.js +3 -1
- package/dist/cjs/components/NextMonthButton.js +1 -3
- package/dist/cjs/components/PreviousMonthButton.js +1 -3
- package/dist/cjs/components/custom-components.d.ts +0 -1
- package/dist/cjs/components/custom-components.js +0 -1
- package/dist/cjs/formatters/formatCaption.d.ts +0 -6
- package/dist/cjs/formatters/formatCaption.js +0 -7
- package/dist/cjs/formatters/formatWeekNumber.d.ts +1 -1
- package/dist/cjs/formatters/formatYearDropdown.d.ts +0 -6
- package/dist/cjs/formatters/formatYearDropdown.js +0 -7
- package/dist/cjs/helpers/getFormatters.d.ts +0 -2
- package/dist/cjs/helpers/getFormatters.js +0 -7
- package/dist/cjs/helpers/getInitialMonth.d.ts +1 -1
- package/dist/cjs/helpers/getNavMonth.d.ts +1 -1
- package/dist/cjs/helpers/getNavMonth.js +1 -21
- package/dist/cjs/hijri/index.js +2 -8
- package/dist/cjs/labels/labelDayButton.d.ts +0 -5
- package/dist/cjs/labels/labelDayButton.js +0 -6
- package/dist/cjs/labels/labelGrid.d.ts +0 -5
- package/dist/cjs/labels/labelGrid.js +0 -6
- package/dist/cjs/types/index.d.ts +0 -1
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/types/props.d.ts +3 -97
- package/dist/cjs/types/shared.d.ts +1 -45
- package/dist/cjs/useAnimation.js +1 -2
- package/dist/cjs/useCalendar.d.ts +1 -1
- package/dist/cjs/utils/dateMatchModifiers.d.ts +0 -5
- package/dist/cjs/utils/dateMatchModifiers.js +0 -6
- package/dist/cjs/utils/rangeIncludesDate.d.ts +1 -6
- package/dist/cjs/utils/rangeIncludesDate.js +0 -7
- package/dist/cjs/utils/rangeOverlaps.d.ts +1 -1
- package/dist/esm/DayPicker.js +84 -82
- package/dist/esm/UI.d.ts +2 -239
- package/dist/esm/UI.js +2 -2
- package/dist/esm/classes/DateLib.d.ts +0 -21
- package/dist/esm/classes/DateLib.js +2 -12
- package/dist/esm/components/Chevron.js +1 -3
- package/dist/esm/components/Dropdown.d.ts +0 -11
- package/dist/esm/components/Dropdown.js +3 -1
- package/dist/esm/components/NextMonthButton.js +1 -3
- package/dist/esm/components/PreviousMonthButton.js +1 -3
- package/dist/esm/components/custom-components.d.ts +0 -1
- package/dist/esm/components/custom-components.js +0 -1
- package/dist/esm/formatters/formatCaption.d.ts +0 -6
- package/dist/esm/formatters/formatCaption.js +0 -6
- package/dist/esm/formatters/formatWeekNumber.d.ts +1 -1
- package/dist/esm/formatters/formatYearDropdown.d.ts +0 -6
- package/dist/esm/formatters/formatYearDropdown.js +0 -6
- package/dist/esm/helpers/getFormatters.d.ts +0 -2
- package/dist/esm/helpers/getFormatters.js +0 -7
- package/dist/esm/helpers/getInitialMonth.d.ts +1 -1
- package/dist/esm/helpers/getNavMonth.d.ts +1 -1
- package/dist/esm/helpers/getNavMonth.js +1 -21
- package/dist/esm/hijri/index.js +2 -8
- package/dist/esm/labels/labelDayButton.d.ts +0 -5
- package/dist/esm/labels/labelDayButton.js +0 -5
- package/dist/esm/labels/labelGrid.d.ts +0 -5
- package/dist/esm/labels/labelGrid.js +0 -5
- package/dist/esm/types/index.d.ts +0 -1
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/types/props.d.ts +3 -97
- package/dist/esm/types/shared.d.ts +1 -45
- package/dist/esm/useAnimation.js +1 -2
- package/dist/esm/useCalendar.d.ts +1 -1
- package/dist/esm/utils/dateMatchModifiers.d.ts +0 -5
- package/dist/esm/utils/dateMatchModifiers.js +0 -5
- package/dist/esm/utils/rangeIncludesDate.d.ts +1 -6
- package/dist/esm/utils/rangeIncludesDate.js +0 -5
- package/dist/esm/utils/rangeOverlaps.d.ts +1 -1
- package/package.json +13 -25
- package/dist/cjs/components/Button.d.ts +0 -9
- package/dist/cjs/components/Button.js +0 -16
- package/dist/cjs/jalali.d.ts +0 -2
- package/dist/cjs/jalali.js +0 -18
- package/dist/cjs/types/deprecated.d.ts +0 -180
- package/dist/cjs/types/deprecated.js +0 -26
- package/dist/esm/components/Button.d.ts +0 -9
- package/dist/esm/components/Button.js +0 -10
- package/dist/esm/jalali.d.ts +0 -2
- package/dist/esm/jalali.js +0 -2
- package/dist/esm/types/deprecated.d.ts +0 -180
- package/dist/esm/types/deprecated.js +0 -23
- package/jalali.d.ts +0 -1
- package/jalali.js +0 -3
package/dist/cjs/DayPicker.js
CHANGED
|
@@ -164,8 +164,12 @@ function DayPicker(initialProps) {
|
|
|
164
164
|
props.labels,
|
|
165
165
|
props.classNames,
|
|
166
166
|
]);
|
|
167
|
-
if (!props.today) {
|
|
168
|
-
props = {
|
|
167
|
+
if (!props.today || props.navLayout === undefined) {
|
|
168
|
+
props = {
|
|
169
|
+
...props,
|
|
170
|
+
today: props.today ?? dateLib.today(),
|
|
171
|
+
navLayout: props.navLayout ?? "after",
|
|
172
|
+
};
|
|
169
173
|
}
|
|
170
174
|
const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles, } = props;
|
|
171
175
|
const { formatCaption, formatDay, formatMonthDropdown, formatWeekNumber, formatWeekNumberHeader, formatWeekdayName, formatYearDropdown, } = formatters;
|
|
@@ -280,85 +284,83 @@ function DayPicker(initialProps) {
|
|
|
280
284
|
};
|
|
281
285
|
return (react_1.default.createElement(useDayPicker_js_1.dayPickerContext.Provider, { value: contextValue },
|
|
282
286
|
react_1.default.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 },
|
|
283
|
-
react_1.default.createElement(components.Months, { className: classNames[UI_js_1.UI.Months], style: styles?.[UI_js_1.UI.Months] },
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
react_1.default.createElement(components.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
})))));
|
|
362
|
-
})),
|
|
287
|
+
react_1.default.createElement(components.Months, { className: classNames[UI_js_1.UI.Months], style: styles?.[UI_js_1.UI.Months] }, months.map((calendarMonth, displayIndex) => {
|
|
288
|
+
return (react_1.default.createElement(components.Month, { "data-animated-month": props.animate ? "true" : undefined, className: classNames[UI_js_1.UI.Month], style: styles?.[UI_js_1.UI.Month],
|
|
289
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: breaks animation
|
|
290
|
+
key: displayIndex, displayIndex: displayIndex, calendarMonth: calendarMonth },
|
|
291
|
+
navLayout === "around" &&
|
|
292
|
+
!props.hideNavigation &&
|
|
293
|
+
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 },
|
|
294
|
+
react_1.default.createElement(components.Chevron, { disabled: previousMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }))),
|
|
295
|
+
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] },
|
|
296
|
+
(() => {
|
|
297
|
+
const monthControl = captionLayout === "dropdown" ||
|
|
298
|
+
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), 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)));
|
|
299
|
+
const yearControl = captionLayout === "dropdown" ||
|
|
300
|
+
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), 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)));
|
|
301
|
+
const controls = dateLib.getMonthYearOrder() === "year-first"
|
|
302
|
+
? [yearControl, monthControl]
|
|
303
|
+
: [monthControl, yearControl];
|
|
304
|
+
return controls;
|
|
305
|
+
})(),
|
|
306
|
+
react_1.default.createElement("span", { role: "status", "aria-live": "polite", style: {
|
|
307
|
+
border: 0,
|
|
308
|
+
clip: "rect(0 0 0 0)",
|
|
309
|
+
height: "1px",
|
|
310
|
+
margin: "-1px",
|
|
311
|
+
overflow: "hidden",
|
|
312
|
+
padding: 0,
|
|
313
|
+
position: "absolute",
|
|
314
|
+
width: "1px",
|
|
315
|
+
whiteSpace: "nowrap",
|
|
316
|
+
wordWrap: "normal",
|
|
317
|
+
} }, 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)))),
|
|
318
|
+
navLayout === "around" &&
|
|
319
|
+
!props.hideNavigation &&
|
|
320
|
+
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 },
|
|
321
|
+
react_1.default.createElement(components.Chevron, { disabled: nextMonth ? undefined : true, className: classNames[UI_js_1.UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }))),
|
|
322
|
+
displayIndex === numberOfMonths - 1 &&
|
|
323
|
+
navLayout === "after" &&
|
|
324
|
+
!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 })),
|
|
325
|
+
react_1.default.createElement(components.MonthGrid, { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid(calendarMonth.date, dateLib.options, dateLib) ||
|
|
326
|
+
undefined, className: classNames[UI_js_1.UI.MonthGrid], style: styles?.[UI_js_1.UI.MonthGrid] },
|
|
327
|
+
!props.hideWeekdays && (react_1.default.createElement(components.Weekdays, { "data-animated-weekdays": props.animate ? "true" : undefined, className: classNames[UI_js_1.UI.Weekdays], style: styles?.[UI_js_1.UI.Weekdays] },
|
|
328
|
+
showWeekNumber && (react_1.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader(dateLib.options), className: classNames[UI_js_1.UI.WeekNumberHeader], style: styles?.[UI_js_1.UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader())),
|
|
329
|
+
weekdays.map((weekday) => (react_1.default.createElement(components.Weekday, { "aria-label": labelWeekday(weekday, dateLib.options, dateLib), className: classNames[UI_js_1.UI.Weekday], key: String(weekday), style: styles?.[UI_js_1.UI.Weekday], scope: "col" }, formatWeekdayName(weekday, dateLib.options, dateLib)))))),
|
|
330
|
+
react_1.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : undefined, className: classNames[UI_js_1.UI.Weeks], style: styles?.[UI_js_1.UI.Weeks] }, calendarMonth.weeks.map((week) => {
|
|
331
|
+
return (react_1.default.createElement(components.Week, { className: classNames[UI_js_1.UI.Week], key: week.weekNumber, style: styles?.[UI_js_1.UI.Week], week: week },
|
|
332
|
+
showWeekNumber && (react_1.default.createElement(components.WeekNumber, { week: week, style: styles?.[UI_js_1.UI.WeekNumber], "aria-label": labelWeekNumber(week.weekNumber, {
|
|
333
|
+
locale,
|
|
334
|
+
}), className: classNames[UI_js_1.UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber(week.weekNumber, dateLib))),
|
|
335
|
+
week.days.map((day) => {
|
|
336
|
+
const { date } = day;
|
|
337
|
+
const modifiers = getModifiers(day);
|
|
338
|
+
modifiers[UI_js_1.DayFlag.focused] =
|
|
339
|
+
!modifiers.hidden &&
|
|
340
|
+
Boolean(focused?.isEqualTo(day));
|
|
341
|
+
modifiers[UI_js_1.SelectionState.selected] =
|
|
342
|
+
isSelected?.(date) || modifiers.selected;
|
|
343
|
+
if ((0, typeguards_js_1.isDateRange)(selectedValue)) {
|
|
344
|
+
// add range modifiers
|
|
345
|
+
const { from, to } = selectedValue;
|
|
346
|
+
modifiers[UI_js_1.SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from));
|
|
347
|
+
modifiers[UI_js_1.SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to));
|
|
348
|
+
modifiers[UI_js_1.SelectionState.range_middle] =
|
|
349
|
+
(0, rangeIncludesDate_js_1.rangeIncludesDate)(selectedValue, date, true, dateLib);
|
|
350
|
+
}
|
|
351
|
+
const style = (0, getStyleForModifiers_js_1.getStyleForModifiers)(modifiers, styles, props.modifiersStyles);
|
|
352
|
+
const className = (0, getClassNamesForModifiers_js_1.getClassNamesForModifiers)(modifiers, classNames, props.modifiersClassNames);
|
|
353
|
+
const ariaLabel = !isInteractive && !modifiers.hidden
|
|
354
|
+
? labelGridcell(date, modifiers, dateLib.options, dateLib)
|
|
355
|
+
: undefined;
|
|
356
|
+
return (react_1.default.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_1.default.createElement(components.DayButton, { className: classNames[UI_js_1.UI.DayButton], style: styles?.[UI_js_1.UI.DayButton], type: "button", day: day, modifiers: modifiers, disabled: (!modifiers.focused &&
|
|
357
|
+
modifiers.disabled) ||
|
|
358
|
+
undefined, "aria-disabled": (modifiers.focused &&
|
|
359
|
+
modifiers.disabled) ||
|
|
360
|
+
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 &&
|
|
361
|
+
formatDay(day.date, dateLib.options, dateLib))));
|
|
362
|
+
})));
|
|
363
|
+
})))));
|
|
364
|
+
})),
|
|
363
365
|
props.footer && (react_1.default.createElement(components.Footer, { className: classNames[UI_js_1.UI.Footer], style: styles?.[UI_js_1.UI.Footer], role: "status", "aria-live": "polite" }, props.footer)))));
|
|
364
366
|
}
|
package/dist/cjs/UI.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CSSProperties } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* Enum representing the UI elements composing DayPicker. These elements are
|
|
4
3
|
* mapped to {@link CustomComponents}, {@link ClassNames}, and {@link Styles}.
|
|
@@ -80,8 +79,8 @@ export declare enum DayFlag {
|
|
|
80
79
|
today = "today"
|
|
81
80
|
}
|
|
82
81
|
/**
|
|
83
|
-
* Enum representing selection states that can be applied to the
|
|
84
|
-
*
|
|
82
|
+
* Enum representing selection states that can be applied to the {@link UI | UI.Day}
|
|
83
|
+
* element in selection mode.
|
|
85
84
|
*/
|
|
86
85
|
export declare enum SelectionState {
|
|
87
86
|
/** The day is at the end of a selected range. */
|
|
@@ -115,239 +114,3 @@ export declare enum Animation {
|
|
|
115
114
|
/** The exiting caption when it disappears before the entering month. */
|
|
116
115
|
caption_before_exit = "caption_before_exit"
|
|
117
116
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Deprecated UI elements and flags from previous versions of DayPicker.
|
|
120
|
-
*
|
|
121
|
-
* These elements are kept for backward compatibility and to assist in
|
|
122
|
-
* transitioning to the new {@link UI} elements.
|
|
123
|
-
*
|
|
124
|
-
* @deprecated
|
|
125
|
-
* @since 9.0.1
|
|
126
|
-
* @template T - The type of the deprecated UI element (e.g., CSS class or
|
|
127
|
-
* style).
|
|
128
|
-
* @see https://daypicker.dev/upgrading
|
|
129
|
-
* @see https://daypicker.dev/docs/styling
|
|
130
|
-
*/
|
|
131
|
-
export type DeprecatedUI<T extends CSSProperties | string> = {
|
|
132
|
-
/**
|
|
133
|
-
* This element was applied to the style of any button in DayPicker and it is
|
|
134
|
-
* replaced by {@link UI | UI.PreviousMonthButton} and
|
|
135
|
-
* {@link UI | UI.NextMonthButton}.
|
|
136
|
-
*
|
|
137
|
-
* @deprecated
|
|
138
|
-
*/
|
|
139
|
-
button: T;
|
|
140
|
-
/**
|
|
141
|
-
* This element was resetting the style of any button in DayPicker and it is
|
|
142
|
-
* replaced by {@link UI | UI.PreviousMonthButton} and
|
|
143
|
-
* {@link UI | UI.NextMonthButton}.
|
|
144
|
-
*
|
|
145
|
-
* @deprecated
|
|
146
|
-
*/
|
|
147
|
-
button_reset: T;
|
|
148
|
-
/**
|
|
149
|
-
* This element has been renamed to {@link UI | UI.MonthCaption}.
|
|
150
|
-
*
|
|
151
|
-
* @deprecated
|
|
152
|
-
*/
|
|
153
|
-
caption: T;
|
|
154
|
-
/**
|
|
155
|
-
* This element has been removed. Captions are styled via
|
|
156
|
-
* {@link UI | UI.MonthCaption}.
|
|
157
|
-
*
|
|
158
|
-
* @deprecated
|
|
159
|
-
*/
|
|
160
|
-
caption_between: T;
|
|
161
|
-
/**
|
|
162
|
-
* This element has been renamed to {@link UI | UI.Dropdowns}.
|
|
163
|
-
*
|
|
164
|
-
* @deprecated
|
|
165
|
-
*/
|
|
166
|
-
caption_dropdowns: T;
|
|
167
|
-
/**
|
|
168
|
-
* This element has been removed. Captions are styled via
|
|
169
|
-
* {@link UI | UI.MonthCaption}.
|
|
170
|
-
*
|
|
171
|
-
* @deprecated
|
|
172
|
-
*/
|
|
173
|
-
caption_end: T;
|
|
174
|
-
/**
|
|
175
|
-
* This element has been removed.
|
|
176
|
-
*
|
|
177
|
-
* @deprecated
|
|
178
|
-
*/
|
|
179
|
-
caption_start: T;
|
|
180
|
-
/**
|
|
181
|
-
* This element has been renamed to {@link UI | UI.Day}.
|
|
182
|
-
*
|
|
183
|
-
* @deprecated
|
|
184
|
-
*/
|
|
185
|
-
cell: T;
|
|
186
|
-
/**
|
|
187
|
-
* This element has been renamed to {@link DayFlag | DayFlag.disabled}.
|
|
188
|
-
*
|
|
189
|
-
* @deprecated
|
|
190
|
-
*/
|
|
191
|
-
day_disabled: T;
|
|
192
|
-
/**
|
|
193
|
-
* This element has been renamed to {@link DayFlag | DayFlag.hidden}.
|
|
194
|
-
*
|
|
195
|
-
* @deprecated
|
|
196
|
-
*/
|
|
197
|
-
day_hidden: T;
|
|
198
|
-
/**
|
|
199
|
-
* This element has been renamed to {@link DayFlag | DayFlag.outside}.
|
|
200
|
-
*
|
|
201
|
-
* @deprecated
|
|
202
|
-
*/
|
|
203
|
-
day_outside: T;
|
|
204
|
-
/**
|
|
205
|
-
* This element has been renamed to
|
|
206
|
-
* {@link SelectionState | SelectionState.range_end}.
|
|
207
|
-
*
|
|
208
|
-
* @deprecated
|
|
209
|
-
*/
|
|
210
|
-
day_range_end: T;
|
|
211
|
-
/**
|
|
212
|
-
* This element has been renamed to
|
|
213
|
-
* {@link SelectionState | SelectionState.range_middle}.
|
|
214
|
-
*
|
|
215
|
-
* @deprecated
|
|
216
|
-
*/
|
|
217
|
-
day_range_middle: T;
|
|
218
|
-
/**
|
|
219
|
-
* This element has been renamed to
|
|
220
|
-
* {@link SelectionState | SelectionState.range_start}.
|
|
221
|
-
*
|
|
222
|
-
* @deprecated
|
|
223
|
-
*/
|
|
224
|
-
day_range_start: T;
|
|
225
|
-
/**
|
|
226
|
-
* This element has been renamed to
|
|
227
|
-
* {@link SelectionState | SelectionState.selected}.
|
|
228
|
-
*
|
|
229
|
-
* @deprecated
|
|
230
|
-
*/
|
|
231
|
-
day_selected: T;
|
|
232
|
-
/**
|
|
233
|
-
* This element has been renamed to {@link DayFlag | DayFlag.today}.
|
|
234
|
-
*
|
|
235
|
-
* @deprecated
|
|
236
|
-
*/
|
|
237
|
-
day_today: T;
|
|
238
|
-
/**
|
|
239
|
-
* This element has been removed. The dropdown icon is now
|
|
240
|
-
* {@link UI | UI.Chevron} inside a {@link UI | UI.CaptionLabel}.
|
|
241
|
-
*
|
|
242
|
-
* @deprecated
|
|
243
|
-
*/
|
|
244
|
-
dropdown_icon: T;
|
|
245
|
-
/**
|
|
246
|
-
* This element has been renamed to {@link UI | UI.MonthsDropdown}.
|
|
247
|
-
*
|
|
248
|
-
* @deprecated
|
|
249
|
-
*/
|
|
250
|
-
dropdown_month: T;
|
|
251
|
-
/**
|
|
252
|
-
* This element has been renamed to {@link UI | UI.YearsDropdown}.
|
|
253
|
-
*
|
|
254
|
-
* @deprecated
|
|
255
|
-
*/
|
|
256
|
-
dropdown_year: T;
|
|
257
|
-
/**
|
|
258
|
-
* This element has been removed.
|
|
259
|
-
*
|
|
260
|
-
* @deprecated
|
|
261
|
-
*/
|
|
262
|
-
head: T;
|
|
263
|
-
/**
|
|
264
|
-
* This element has been renamed to {@link UI | UI.Weekday}.
|
|
265
|
-
*
|
|
266
|
-
* @deprecated
|
|
267
|
-
*/
|
|
268
|
-
head_cell: T;
|
|
269
|
-
/**
|
|
270
|
-
* This element has been renamed to {@link UI | UI.Weekdays}.
|
|
271
|
-
*
|
|
272
|
-
* @deprecated
|
|
273
|
-
*/
|
|
274
|
-
head_row: T;
|
|
275
|
-
/**
|
|
276
|
-
* This flag has been removed. Use `data-multiple-months` in your CSS
|
|
277
|
-
* selectors.
|
|
278
|
-
*
|
|
279
|
-
* @deprecated
|
|
280
|
-
*/
|
|
281
|
-
multiple_months: T;
|
|
282
|
-
/**
|
|
283
|
-
* This element has been removed. To style the navigation buttons, use
|
|
284
|
-
* {@link UI | UI.PreviousMonthButton} and {@link UI | UI.NextMonthButton}.
|
|
285
|
-
*
|
|
286
|
-
* @deprecated
|
|
287
|
-
*/
|
|
288
|
-
nav_button: T;
|
|
289
|
-
/**
|
|
290
|
-
* This element has been renamed to {@link UI | UI.NextMonthButton}.
|
|
291
|
-
*
|
|
292
|
-
* @deprecated
|
|
293
|
-
*/
|
|
294
|
-
nav_button_next: T;
|
|
295
|
-
/**
|
|
296
|
-
* This element has been renamed to {@link UI | UI.PreviousMonthButton}.
|
|
297
|
-
*
|
|
298
|
-
* @deprecated
|
|
299
|
-
*/
|
|
300
|
-
nav_button_previous: T;
|
|
301
|
-
/**
|
|
302
|
-
* This element has been removed. The dropdown icon is now
|
|
303
|
-
* {@link UI | UI.Chevron} inside a {@link UI | UI.NextMonthButton} or a
|
|
304
|
-
* {@link UI | UI.PreviousMonthButton}.
|
|
305
|
-
*
|
|
306
|
-
* @deprecated
|
|
307
|
-
*/
|
|
308
|
-
nav_icon: T;
|
|
309
|
-
/**
|
|
310
|
-
* This element has been renamed to {@link UI | UI.Week}.
|
|
311
|
-
*
|
|
312
|
-
* @deprecated
|
|
313
|
-
*/
|
|
314
|
-
row: T;
|
|
315
|
-
/**
|
|
316
|
-
* This element has been renamed to {@link UI | UI.MonthGrid}.
|
|
317
|
-
*
|
|
318
|
-
* @deprecated
|
|
319
|
-
*/
|
|
320
|
-
table: T;
|
|
321
|
-
/**
|
|
322
|
-
* This element has been renamed to {@link UI | UI.Weeks}.
|
|
323
|
-
*
|
|
324
|
-
* @deprecated
|
|
325
|
-
*/
|
|
326
|
-
tbody: T;
|
|
327
|
-
/**
|
|
328
|
-
* This element has been removed. The {@link UI | UI.Footer} is now a single
|
|
329
|
-
* element below the months.
|
|
330
|
-
*
|
|
331
|
-
* @deprecated
|
|
332
|
-
*/
|
|
333
|
-
tfoot: T;
|
|
334
|
-
/**
|
|
335
|
-
* This flag has been removed. There are no "visually hidden" elements in
|
|
336
|
-
* DayPicker 9.
|
|
337
|
-
*
|
|
338
|
-
* @deprecated
|
|
339
|
-
*/
|
|
340
|
-
vhidden: T;
|
|
341
|
-
/**
|
|
342
|
-
* This element has been renamed. Use {@link UI | UI.WeekNumber} instead.
|
|
343
|
-
*
|
|
344
|
-
* @deprecated
|
|
345
|
-
*/
|
|
346
|
-
weeknumber: T;
|
|
347
|
-
/**
|
|
348
|
-
* This flag has been removed. Use `data-week-numbers` in your CSS.
|
|
349
|
-
*
|
|
350
|
-
* @deprecated
|
|
351
|
-
*/
|
|
352
|
-
with_weeknumber: T;
|
|
353
|
-
};
|
package/dist/cjs/UI.js
CHANGED
|
@@ -84,8 +84,8 @@ var DayFlag;
|
|
|
84
84
|
DayFlag["today"] = "today";
|
|
85
85
|
})(DayFlag || (exports.DayFlag = DayFlag = {}));
|
|
86
86
|
/**
|
|
87
|
-
* Enum representing selection states that can be applied to the
|
|
88
|
-
*
|
|
87
|
+
* Enum representing selection states that can be applied to the {@link UI | UI.Day}
|
|
88
|
+
* element in selection mode.
|
|
89
89
|
*/
|
|
90
90
|
var SelectionState;
|
|
91
91
|
(function (SelectionState) {
|
|
@@ -20,16 +20,6 @@ export interface DayPickerLocale extends DateFnsLocale {
|
|
|
20
20
|
labels?: DayPickerLocaleLabels;
|
|
21
21
|
}
|
|
22
22
|
export type Locale = DayPickerLocale;
|
|
23
|
-
/**
|
|
24
|
-
* @ignore
|
|
25
|
-
* @deprecated Use {@link DateLibOptions} instead.
|
|
26
|
-
*/
|
|
27
|
-
export type FormatOptions = DateLibOptions;
|
|
28
|
-
/**
|
|
29
|
-
* @ignore
|
|
30
|
-
* @deprecated Use {@link DateLibOptions} instead.
|
|
31
|
-
*/
|
|
32
|
-
export type LabelOptions = DateLibOptions;
|
|
33
23
|
/** Indicates the preferred ordering of month and year for localized labels. */
|
|
34
24
|
export type MonthYearOrder = "month-first" | "year-first";
|
|
35
25
|
/**
|
|
@@ -116,12 +106,6 @@ export declare class DateLib {
|
|
|
116
106
|
*/
|
|
117
107
|
formatMonthYear(date: Date): string;
|
|
118
108
|
private static readonly yearFirstLocales;
|
|
119
|
-
/**
|
|
120
|
-
* Reference to the built-in Date constructor.
|
|
121
|
-
*
|
|
122
|
-
* @deprecated Use `newDate()` or `today()`.
|
|
123
|
-
*/
|
|
124
|
-
Date: typeof Date;
|
|
125
109
|
/**
|
|
126
110
|
* Creates a new `Date` object representing today's date.
|
|
127
111
|
*
|
|
@@ -400,8 +384,3 @@ export { enUS as defaultLocale } from "../locale/en-US.js";
|
|
|
400
384
|
* @since 9.2.0
|
|
401
385
|
*/
|
|
402
386
|
export declare const defaultDateLib: DateLib;
|
|
403
|
-
/**
|
|
404
|
-
* @ignore
|
|
405
|
-
* @deprecated Use `defaultDateLib`.
|
|
406
|
-
*/
|
|
407
|
-
export declare const dateLib: DateLib;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.defaultDateLib = exports.defaultLocale = exports.DateLib = void 0;
|
|
4
4
|
const tz_1 = require("@date-fns/tz");
|
|
5
5
|
const date_fns_1 = require("date-fns");
|
|
6
6
|
const endOfBroadcastWeek_js_1 = require("../helpers/endOfBroadcastWeek.js");
|
|
@@ -23,12 +23,6 @@ class DateLib {
|
|
|
23
23
|
* @param overrides Custom overrides for the date library functions.
|
|
24
24
|
*/
|
|
25
25
|
constructor(options, overrides) {
|
|
26
|
-
/**
|
|
27
|
-
* Reference to the built-in Date constructor.
|
|
28
|
-
*
|
|
29
|
-
* @deprecated Use `newDate()` or `today()`.
|
|
30
|
-
*/
|
|
31
|
-
this.Date = Date;
|
|
32
26
|
/**
|
|
33
27
|
* Creates a new `Date` object representing today's date.
|
|
34
28
|
*
|
|
@@ -42,7 +36,8 @@ class DateLib {
|
|
|
42
36
|
if (this.options.timeZone) {
|
|
43
37
|
return tz_1.TZDate.tz(this.options.timeZone);
|
|
44
38
|
}
|
|
45
|
-
|
|
39
|
+
const DateCtor = this.options.Date ?? Date;
|
|
40
|
+
return new DateCtor();
|
|
46
41
|
};
|
|
47
42
|
/**
|
|
48
43
|
* Creates a new `Date` object with the specified year, month, and day.
|
|
@@ -574,8 +569,3 @@ Object.defineProperty(exports, "defaultLocale", { enumerable: true, get: functio
|
|
|
574
569
|
* @since 9.2.0
|
|
575
570
|
*/
|
|
576
571
|
exports.defaultDateLib = new DateLib();
|
|
577
|
-
/**
|
|
578
|
-
* @ignore
|
|
579
|
-
* @deprecated Use `defaultDateLib`.
|
|
580
|
-
*/
|
|
581
|
-
exports.dateLib = exports.defaultDateLib;
|
|
@@ -13,9 +13,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
13
13
|
*/
|
|
14
14
|
function Chevron(props) {
|
|
15
15
|
const { size = 24, orientation = "left", className } = props;
|
|
16
|
-
return (
|
|
17
|
-
// biome-ignore lint/a11y/noSvgWithoutTitle: handled by the parent component
|
|
18
|
-
react_1.default.createElement("svg", { className: className, width: size, height: size, viewBox: "0 0 24 24" },
|
|
16
|
+
return (react_1.default.createElement("svg", { className: className, width: size, height: size, viewBox: "0 0 24 24" },
|
|
19
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" })),
|
|
20
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" })),
|
|
21
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" })),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { type SelectHTMLAttributes } from "react";
|
|
2
|
-
import type { ClassNames, CustomComponents } from "../types/index.js";
|
|
3
2
|
/** An option to use in the dropdown. Maps to the `<option>` HTML element. */
|
|
4
3
|
export type DropdownOption = {
|
|
5
4
|
/** The value of the option. */
|
|
@@ -16,16 +15,6 @@ export type DropdownOption = {
|
|
|
16
15
|
* @see https://daypicker.dev/guides/custom-components
|
|
17
16
|
*/
|
|
18
17
|
export declare function Dropdown(props: {
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated Use {@link useDayPicker} hook to get the list of internal
|
|
21
|
-
* components.
|
|
22
|
-
*/
|
|
23
|
-
components: CustomComponents;
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Use {@link useDayPicker} hook to get the list of internal
|
|
26
|
-
* class names.
|
|
27
|
-
*/
|
|
28
|
-
classNames: ClassNames;
|
|
29
18
|
/** The options to display in the dropdown. */
|
|
30
19
|
options?: DropdownOption[] | undefined;
|
|
31
20
|
} & Omit<SelectHTMLAttributes<HTMLSelectElement>, "children">): React.JSX.Element;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Dropdown = Dropdown;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const UI_js_1 = require("../UI.js");
|
|
9
|
+
const useDayPicker_js_1 = require("../useDayPicker.js");
|
|
9
10
|
/**
|
|
10
11
|
* Render a dropdown component for navigation in the calendar.
|
|
11
12
|
*
|
|
@@ -13,7 +14,8 @@ const UI_js_1 = require("../UI.js");
|
|
|
13
14
|
* @see https://daypicker.dev/guides/custom-components
|
|
14
15
|
*/
|
|
15
16
|
function Dropdown(props) {
|
|
16
|
-
const { options, className,
|
|
17
|
+
const { options, className, ...selectProps } = props;
|
|
18
|
+
const { classNames, components } = (0, useDayPicker_js_1.useDayPicker)();
|
|
17
19
|
const cssClassSelect = [classNames[UI_js_1.UI.Dropdown], className].join(" ");
|
|
18
20
|
const selectedOption = options?.find(({ value }) => value === selectProps.value);
|
|
19
21
|
return (react_1.default.createElement("span", { "data-disabled": selectProps.disabled, className: classNames[UI_js_1.UI.DropdownRoot] },
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.NextMonthButton = NextMonthButton;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const useDayPicker_js_1 = require("../useDayPicker.js");
|
|
9
8
|
/**
|
|
10
9
|
* Render the button to navigate to the next month in the calendar.
|
|
11
10
|
*
|
|
@@ -13,6 +12,5 @@ const useDayPicker_js_1 = require("../useDayPicker.js");
|
|
|
13
12
|
* @see https://daypicker.dev/guides/custom-components
|
|
14
13
|
*/
|
|
15
14
|
function NextMonthButton(props) {
|
|
16
|
-
|
|
17
|
-
return react_1.default.createElement(components.Button, { ...props });
|
|
15
|
+
return react_1.default.createElement("button", { ...props });
|
|
18
16
|
}
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PreviousMonthButton = PreviousMonthButton;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const useDayPicker_js_1 = require("../useDayPicker.js");
|
|
9
8
|
/**
|
|
10
9
|
* Render the button to navigate to the previous month in the calendar.
|
|
11
10
|
*
|
|
@@ -13,6 +12,5 @@ const useDayPicker_js_1 = require("../useDayPicker.js");
|
|
|
13
12
|
* @see https://daypicker.dev/guides/custom-components
|
|
14
13
|
*/
|
|
15
14
|
function PreviousMonthButton(props) {
|
|
16
|
-
|
|
17
|
-
return react_1.default.createElement(components.Button, { ...props });
|
|
15
|
+
return react_1.default.createElement("button", { ...props });
|
|
18
16
|
}
|