react-day-picker 9.13.2 → 10.0.0-next.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.
Files changed (180) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/DayPicker.js +85 -83
  3. package/dist/cjs/UI.d.ts +0 -230
  4. package/dist/cjs/classes/DateLib.d.ts +0 -21
  5. package/dist/cjs/classes/DateLib.js +3 -13
  6. package/dist/cjs/components/Dropdown.d.ts +0 -11
  7. package/dist/cjs/components/Dropdown.js +3 -1
  8. package/dist/cjs/components/NextMonthButton.js +1 -3
  9. package/dist/cjs/components/PreviousMonthButton.js +1 -3
  10. package/dist/cjs/components/custom-components.d.ts +0 -1
  11. package/dist/cjs/components/custom-components.js +0 -1
  12. package/dist/cjs/formatters/formatCaption.d.ts +0 -6
  13. package/dist/cjs/formatters/formatCaption.js +0 -7
  14. package/dist/cjs/formatters/formatYearDropdown.d.ts +0 -6
  15. package/dist/cjs/formatters/formatYearDropdown.js +0 -7
  16. package/dist/cjs/helpers/getFormatters.d.ts +0 -2
  17. package/dist/cjs/helpers/getFormatters.js +0 -7
  18. package/dist/cjs/helpers/getInitialMonth.d.ts +1 -1
  19. package/dist/cjs/helpers/getNavMonth.d.ts +1 -1
  20. package/dist/cjs/helpers/getNavMonth.js +1 -21
  21. package/dist/cjs/hijri/index.d.ts +28 -0
  22. package/dist/cjs/hijri/index.js +92 -0
  23. package/dist/cjs/hijri/lib/addMonths.d.ts +1 -0
  24. package/dist/cjs/hijri/lib/addMonths.js +9 -0
  25. package/dist/cjs/hijri/lib/addYears.d.ts +1 -0
  26. package/dist/cjs/hijri/lib/addYears.js +9 -0
  27. package/dist/cjs/hijri/lib/differenceInCalendarMonths.d.ts +1 -0
  28. package/dist/cjs/hijri/lib/differenceInCalendarMonths.js +10 -0
  29. package/dist/cjs/hijri/lib/eachMonthOfInterval.d.ts +2 -0
  30. package/dist/cjs/hijri/lib/eachMonthOfInterval.js +29 -0
  31. package/dist/cjs/hijri/lib/eachYearOfInterval.d.ts +2 -0
  32. package/dist/cjs/hijri/lib/eachYearOfInterval.js +19 -0
  33. package/dist/cjs/hijri/lib/endOfMonth.d.ts +1 -0
  34. package/dist/cjs/hijri/lib/endOfMonth.js +14 -0
  35. package/dist/cjs/hijri/lib/endOfYear.d.ts +1 -0
  36. package/dist/cjs/hijri/lib/endOfYear.js +14 -0
  37. package/dist/cjs/hijri/lib/fallbackLocaleData.d.ts +5 -0
  38. package/dist/cjs/hijri/lib/fallbackLocaleData.js +111 -0
  39. package/dist/cjs/hijri/lib/format.d.ts +3 -0
  40. package/dist/cjs/hijri/lib/format.js +149 -0
  41. package/dist/cjs/hijri/lib/getMonth.d.ts +1 -0
  42. package/dist/cjs/hijri/lib/getMonth.js +7 -0
  43. package/dist/cjs/hijri/lib/getYear.d.ts +1 -0
  44. package/dist/cjs/hijri/lib/getYear.js +7 -0
  45. package/dist/cjs/hijri/lib/index.d.ts +17 -0
  46. package/dist/cjs/hijri/lib/index.js +33 -0
  47. package/dist/cjs/hijri/lib/isSameMonth.d.ts +1 -0
  48. package/dist/cjs/hijri/lib/isSameMonth.js +10 -0
  49. package/dist/cjs/hijri/lib/isSameYear.d.ts +1 -0
  50. package/dist/cjs/hijri/lib/isSameYear.js +9 -0
  51. package/dist/cjs/hijri/lib/newDate.d.ts +1 -0
  52. package/dist/cjs/hijri/lib/newDate.js +7 -0
  53. package/dist/cjs/hijri/lib/setMonth.d.ts +1 -0
  54. package/dist/cjs/hijri/lib/setMonth.js +27 -0
  55. package/dist/cjs/hijri/lib/setYear.d.ts +1 -0
  56. package/dist/cjs/hijri/lib/setYear.js +15 -0
  57. package/dist/cjs/hijri/lib/startOfMonth.d.ts +1 -0
  58. package/dist/cjs/hijri/lib/startOfMonth.js +12 -0
  59. package/dist/cjs/hijri/lib/startOfYear.d.ts +1 -0
  60. package/dist/cjs/hijri/lib/startOfYear.js +12 -0
  61. package/dist/cjs/hijri/utils/conversion.d.ts +5 -0
  62. package/dist/cjs/hijri/utils/conversion.js +40 -0
  63. package/dist/cjs/hijri/utils/daysInMonth.d.ts +1 -0
  64. package/dist/cjs/hijri/utils/daysInMonth.js +24 -0
  65. package/dist/cjs/hijri/utils/range.d.ts +21 -0
  66. package/dist/cjs/hijri/utils/range.js +104 -0
  67. package/dist/cjs/hijri/utils/types.d.ts +5 -0
  68. package/dist/cjs/hijri/utils/types.js +2 -0
  69. package/dist/cjs/labels/labelDayButton.d.ts +0 -5
  70. package/dist/cjs/labels/labelDayButton.js +0 -6
  71. package/dist/cjs/labels/labelGrid.d.ts +0 -5
  72. package/dist/cjs/labels/labelGrid.js +0 -6
  73. package/dist/cjs/selection/useRange.js +22 -4
  74. package/dist/cjs/types/index.d.ts +0 -1
  75. package/dist/cjs/types/index.js +0 -1
  76. package/dist/cjs/types/props.d.ts +30 -100
  77. package/dist/cjs/types/shared.d.ts +1 -45
  78. package/dist/cjs/useCalendar.d.ts +1 -1
  79. package/dist/cjs/utils/dateMatchModifiers.d.ts +0 -5
  80. package/dist/cjs/utils/dateMatchModifiers.js +0 -6
  81. package/dist/cjs/utils/rangeIncludesDate.d.ts +0 -5
  82. package/dist/cjs/utils/rangeIncludesDate.js +0 -7
  83. package/dist/esm/DayPicker.js +85 -83
  84. package/dist/esm/UI.d.ts +0 -230
  85. package/dist/esm/classes/DateLib.d.ts +0 -21
  86. package/dist/esm/classes/DateLib.js +2 -12
  87. package/dist/esm/components/Dropdown.d.ts +0 -11
  88. package/dist/esm/components/Dropdown.js +3 -1
  89. package/dist/esm/components/NextMonthButton.js +1 -3
  90. package/dist/esm/components/PreviousMonthButton.js +1 -3
  91. package/dist/esm/components/custom-components.d.ts +0 -1
  92. package/dist/esm/components/custom-components.js +0 -1
  93. package/dist/esm/formatters/formatCaption.d.ts +0 -6
  94. package/dist/esm/formatters/formatCaption.js +0 -6
  95. package/dist/esm/formatters/formatYearDropdown.d.ts +0 -6
  96. package/dist/esm/formatters/formatYearDropdown.js +0 -6
  97. package/dist/esm/helpers/getFormatters.d.ts +0 -2
  98. package/dist/esm/helpers/getFormatters.js +0 -7
  99. package/dist/esm/helpers/getInitialMonth.d.ts +1 -1
  100. package/dist/esm/helpers/getNavMonth.d.ts +1 -1
  101. package/dist/esm/helpers/getNavMonth.js +1 -21
  102. package/dist/esm/hijri/index.d.ts +28 -0
  103. package/dist/esm/hijri/index.js +49 -0
  104. package/dist/esm/hijri/lib/addMonths.d.ts +1 -0
  105. package/dist/esm/hijri/lib/addMonths.js +6 -0
  106. package/dist/esm/hijri/lib/addYears.d.ts +1 -0
  107. package/dist/esm/hijri/lib/addYears.js +6 -0
  108. package/dist/esm/hijri/lib/differenceInCalendarMonths.d.ts +1 -0
  109. package/dist/esm/hijri/lib/differenceInCalendarMonths.js +7 -0
  110. package/dist/esm/hijri/lib/eachMonthOfInterval.d.ts +2 -0
  111. package/dist/esm/hijri/lib/eachMonthOfInterval.js +26 -0
  112. package/dist/esm/hijri/lib/eachYearOfInterval.d.ts +2 -0
  113. package/dist/esm/hijri/lib/eachYearOfInterval.js +16 -0
  114. package/dist/esm/hijri/lib/endOfMonth.d.ts +1 -0
  115. package/dist/esm/hijri/lib/endOfMonth.js +11 -0
  116. package/dist/esm/hijri/lib/endOfYear.d.ts +1 -0
  117. package/dist/esm/hijri/lib/endOfYear.js +11 -0
  118. package/dist/esm/hijri/lib/fallbackLocaleData.d.ts +5 -0
  119. package/dist/esm/hijri/lib/fallbackLocaleData.js +105 -0
  120. package/dist/esm/hijri/lib/format.d.ts +3 -0
  121. package/dist/esm/hijri/lib/format.js +146 -0
  122. package/dist/esm/hijri/lib/getMonth.d.ts +1 -0
  123. package/dist/esm/hijri/lib/getMonth.js +4 -0
  124. package/dist/esm/hijri/lib/getYear.d.ts +1 -0
  125. package/dist/esm/hijri/lib/getYear.js +4 -0
  126. package/dist/esm/hijri/lib/index.d.ts +17 -0
  127. package/dist/esm/hijri/lib/index.js +17 -0
  128. package/dist/esm/hijri/lib/isSameMonth.d.ts +1 -0
  129. package/dist/esm/hijri/lib/isSameMonth.js +7 -0
  130. package/dist/esm/hijri/lib/isSameYear.d.ts +1 -0
  131. package/dist/esm/hijri/lib/isSameYear.js +6 -0
  132. package/dist/esm/hijri/lib/newDate.d.ts +1 -0
  133. package/dist/esm/hijri/lib/newDate.js +4 -0
  134. package/dist/esm/hijri/lib/setMonth.d.ts +1 -0
  135. package/dist/esm/hijri/lib/setMonth.js +24 -0
  136. package/dist/esm/hijri/lib/setYear.d.ts +1 -0
  137. package/dist/esm/hijri/lib/setYear.js +12 -0
  138. package/dist/esm/hijri/lib/startOfMonth.d.ts +1 -0
  139. package/dist/esm/hijri/lib/startOfMonth.js +9 -0
  140. package/dist/esm/hijri/lib/startOfYear.d.ts +1 -0
  141. package/dist/esm/hijri/lib/startOfYear.js +9 -0
  142. package/dist/esm/hijri/utils/conversion.d.ts +5 -0
  143. package/dist/esm/hijri/utils/conversion.js +36 -0
  144. package/dist/esm/hijri/utils/daysInMonth.d.ts +1 -0
  145. package/dist/esm/hijri/utils/daysInMonth.js +21 -0
  146. package/dist/esm/hijri/utils/range.d.ts +21 -0
  147. package/dist/esm/hijri/utils/range.js +96 -0
  148. package/dist/esm/hijri/utils/types.d.ts +5 -0
  149. package/dist/esm/hijri/utils/types.js +1 -0
  150. package/dist/esm/labels/labelDayButton.d.ts +0 -5
  151. package/dist/esm/labels/labelDayButton.js +0 -5
  152. package/dist/esm/labels/labelGrid.d.ts +0 -5
  153. package/dist/esm/labels/labelGrid.js +0 -5
  154. package/dist/esm/selection/useRange.js +22 -4
  155. package/dist/esm/types/index.d.ts +0 -1
  156. package/dist/esm/types/index.js +0 -1
  157. package/dist/esm/types/props.d.ts +30 -100
  158. package/dist/esm/types/shared.d.ts +1 -45
  159. package/dist/esm/useCalendar.d.ts +1 -1
  160. package/dist/esm/utils/dateMatchModifiers.d.ts +0 -5
  161. package/dist/esm/utils/dateMatchModifiers.js +0 -5
  162. package/dist/esm/utils/rangeIncludesDate.d.ts +0 -5
  163. package/dist/esm/utils/rangeIncludesDate.js +0 -5
  164. package/hijri.d.ts +1 -0
  165. package/hijri.js +2 -0
  166. package/package.json +24 -23
  167. package/dist/cjs/components/Button.d.ts +0 -9
  168. package/dist/cjs/components/Button.js +0 -16
  169. package/dist/cjs/jalali.d.ts +0 -2
  170. package/dist/cjs/jalali.js +0 -18
  171. package/dist/cjs/types/deprecated.d.ts +0 -180
  172. package/dist/cjs/types/deprecated.js +0 -26
  173. package/dist/esm/components/Button.d.ts +0 -9
  174. package/dist/esm/components/Button.js +0 -10
  175. package/dist/esm/jalali.d.ts +0 -2
  176. package/dist/esm/jalali.js +0 -2
  177. package/dist/esm/types/deprecated.d.ts +0 -180
  178. package/dist/esm/types/deprecated.js +0 -23
  179. package/jalali.d.ts +0 -1
  180. package/jalali.js +0 -3
@@ -0,0 +1,5 @@
1
+ export type HijriDate = {
2
+ year: number;
3
+ monthIndex: number;
4
+ day: number;
5
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -16,8 +16,3 @@ import type { Modifiers } from "../types/index.js";
16
16
  * @see https://daypicker.dev/docs/translation#aria-labels
17
17
  */
18
18
  export declare function labelDayButton(date: Date, modifiers: Modifiers, options?: DateLibOptions, dateLib?: DateLib): string;
19
- /**
20
- * @ignore
21
- * @deprecated Use `labelDayButton` instead.
22
- */
23
- export declare const labelDay: typeof labelDayButton;
@@ -22,8 +22,3 @@ export function labelDayButton(date, modifiers, options, dateLib) {
22
22
  label = `${label}, selected`;
23
23
  return label;
24
24
  }
25
- /**
26
- * @ignore
27
- * @deprecated Use `labelDayButton` instead.
28
- */
29
- export const labelDay = labelDayButton;
@@ -12,8 +12,3 @@ import { DateLib, type DateLibOptions } from "../classes/DateLib.js";
12
12
  * @see https://daypicker.dev/docs/translation#aria-labels
13
13
  */
14
14
  export declare function labelGrid(date: Date, options?: DateLibOptions, dateLib?: DateLib): string;
15
- /**
16
- * @ignore
17
- * @deprecated Use {@link labelGrid} instead.
18
- */
19
- export declare const labelCaption: typeof labelGrid;
@@ -15,8 +15,3 @@ export function labelGrid(date, options, dateLib) {
15
15
  const lib = dateLib ?? new DateLib(options);
16
16
  return lib.formatMonthYear(date);
17
17
  }
18
- /**
19
- * @ignore
20
- * @deprecated Use {@link labelGrid} instead.
21
- */
22
- export const labelCaption = labelGrid;
@@ -11,15 +11,33 @@ import { rangeIncludesDate } from "../utils/rangeIncludesDate.js";
11
11
  * range, and a function to check if a date is within the range.
12
12
  */
13
13
  export function useRange(props, dateLib) {
14
- const { disabled, excludeDisabled, selected: initiallySelected, required, onSelect, } = props;
14
+ const { disabled, excludeDisabled, resetOnSelect, selected: initiallySelected, required, onSelect, } = props;
15
15
  const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : undefined);
16
16
  const selected = !onSelect ? internallySelected : initiallySelected;
17
17
  const isSelected = (date) => selected && rangeIncludesDate(selected, date, false, dateLib);
18
18
  const select = (triggerDate, modifiers, e) => {
19
19
  const { min, max } = props;
20
- const newRange = triggerDate
21
- ? addToRange(triggerDate, selected, min, max, required, dateLib)
22
- : undefined;
20
+ let newRange;
21
+ if (triggerDate) {
22
+ const selectedFrom = selected?.from;
23
+ const selectedTo = selected?.to;
24
+ const hasFullRange = !!selectedFrom && !!selectedTo;
25
+ const isClickingSingleDayRange = !!selectedFrom &&
26
+ !!selectedTo &&
27
+ dateLib.isSameDay(selectedFrom, selectedTo) &&
28
+ dateLib.isSameDay(triggerDate, selectedFrom);
29
+ if (resetOnSelect && (hasFullRange || !selected?.from)) {
30
+ if (!required && isClickingSingleDayRange) {
31
+ newRange = undefined;
32
+ }
33
+ else {
34
+ newRange = { from: triggerDate, to: undefined };
35
+ }
36
+ }
37
+ else {
38
+ newRange = addToRange(triggerDate, selected, min, max, required, dateLib);
39
+ }
40
+ }
23
41
  if (excludeDisabled && disabled && newRange?.from && newRange.to) {
24
42
  if (rangeContainsModifiers({ from: newRange.from, to: newRange.to }, disabled, dateLib)) {
25
43
  // if a disabled days is found, the range is reset
@@ -1,4 +1,3 @@
1
- export * from "./deprecated.js";
2
1
  export * from "./props.js";
3
2
  export * from "./selection.js";
4
3
  export * from "./shared.js";
@@ -1,4 +1,3 @@
1
- export * from "./deprecated.js";
2
1
  export * from "./props.js";
3
2
  export * from "./selection.js";
4
3
  export * from "./shared.js";
@@ -1,6 +1,5 @@
1
1
  import type React from "react";
2
2
  import type { DateLib, DayPickerLocale } from "../classes/DateLib.js";
3
- import type { DeprecatedUI } from "../UI.js";
4
3
  import type { ClassNames, CustomComponents, DateRange, DayEventHandler, Formatters, Labels, Matcher, Mode, Modifiers, ModifiersClassNames, ModifiersStyles, MonthChangeEventHandler, Numerals, Styles } from "./shared.js";
5
4
  /**
6
5
  * The props for the `<DayPicker />` component.
@@ -42,7 +41,7 @@ export interface PropsBase {
42
41
  *
43
42
  * @see https://daypicker.dev/docs/styling
44
43
  */
45
- classNames?: Partial<ClassNames> & Partial<DeprecatedUI<string>>;
44
+ classNames?: Partial<ClassNames>;
46
45
  /**
47
46
  * Change the class name for the day matching the `modifiers`.
48
47
  *
@@ -56,7 +55,7 @@ export interface PropsBase {
56
55
  *
57
56
  * @see https://daypicker.dev/docs/styling
58
57
  */
59
- styles?: Partial<Styles> & Partial<DeprecatedUI<React.CSSProperties>>;
58
+ styles?: Partial<Styles>;
60
59
  /**
61
60
  * Change the class name for the day matching the {@link modifiers}.
62
61
  *
@@ -98,26 +97,6 @@ export interface PropsBase {
98
97
  * @see https://daypicker.dev/docs/navigation#start-and-end-dates
99
98
  */
100
99
  startMonth?: Date | undefined;
101
- /**
102
- * @private
103
- * @deprecated This prop has been removed. Use `hidden={{ before: date }}`
104
- * instead.
105
- * @see https://daypicker.dev/docs/navigation#start-and-end-dates
106
- */
107
- fromDate?: Date | undefined;
108
- /**
109
- * @private
110
- * @deprecated This prop has been renamed to `startMonth`.
111
- * @see https://daypicker.dev/docs/navigation#start-and-end-dates
112
- */
113
- fromMonth?: Date | undefined;
114
- /**
115
- * @private
116
- * @deprecated Use `startMonth` instead. E.g. `startMonth={new Date(year,
117
- * 0)}`.
118
- * @see https://daypicker.dev/docs/navigation#start-and-end-dates
119
- */
120
- fromYear?: number | undefined;
121
100
  /**
122
101
  * The latest month to end the month navigation.
123
102
  *
@@ -125,25 +104,6 @@ export interface PropsBase {
125
104
  * @see https://daypicker.dev/docs/navigation#start-and-end-dates
126
105
  */
127
106
  endMonth?: Date;
128
- /**
129
- * @private
130
- * @deprecated This prop has been removed. Use `hidden={{ after: date }}`
131
- * instead.
132
- * @see https://daypicker.dev/docs/navigation#start-and-end-dates
133
- */
134
- toDate?: Date;
135
- /**
136
- * @private
137
- * @deprecated This prop has been renamed to `endMonth`.
138
- * @see https://daypicker.dev/docs/navigation#start-and-end-dates
139
- */
140
- toMonth?: Date;
141
- /**
142
- * @private
143
- * @deprecated Use `endMonth` instead. E.g. `endMonth={new Date(year, 0)}`.
144
- * @see https://daypicker.dev/docs/navigation#start-and-end-dates
145
- */
146
- toYear?: number;
147
107
  /**
148
108
  * Paginate the month navigation displaying the `numberOfMonths` at a time.
149
109
  *
@@ -203,8 +163,7 @@ export interface PropsBase {
203
163
  * - `after`: Displays the buttons after the caption. This ensures the tab order
204
164
  * matches the visual order.
205
165
  *
206
- * If not set, the buttons default to being displayed after the caption, but
207
- * the tab order may not align with the visual order.
166
+ * Default value is `after`.
208
167
  *
209
168
  * @since 9.7.0
210
169
  * @see https://daypicker.dev/docs/customization#navigation-layouts
@@ -311,11 +270,6 @@ export interface PropsBase {
311
270
  * @see https://daypicker.dev/guides/accessibility#autofocus
312
271
  */
313
272
  autoFocus?: boolean;
314
- /**
315
- * @private
316
- * @deprecated This prop will be removed. Use {@link autoFocus} instead.
317
- */
318
- initialFocus?: boolean;
319
273
  /**
320
274
  * Apply the `disabled` modifier to the matching days. Disabled days cannot be
321
275
  * selected when in a selection mode is set.
@@ -399,7 +353,12 @@ export interface PropsBase {
399
353
  nonce?: HTMLDivElement["nonce"];
400
354
  /** Add a `title` attribute to the container element. */
401
355
  title?: HTMLDivElement["title"];
402
- /** Add the language tag to the container element. */
356
+ /**
357
+ * Add the language tag to the container element.
358
+ *
359
+ * When omitted, DayPicker uses the active locale code (`locale.code`).
360
+ * Set this prop to override the language tag.
361
+ */
403
362
  lang?: HTMLDivElement["lang"];
404
363
  /**
405
364
  * The locale object used to localize dates. Pass a locale from
@@ -479,14 +438,6 @@ export interface PropsBase {
479
438
  * @see https://daypicker.dev/docs/navigation
480
439
  */
481
440
  onPrevClick?: MonthChangeEventHandler;
482
- /**
483
- * Event handler when a week number is clicked.
484
- *
485
- * @private
486
- * @deprecated Use a custom `WeekNumber` component instead.
487
- * @see https://daypicker.dev/docs/customization#showweeknumber
488
- */
489
- onWeekNumberClick?: any;
490
441
  /** Event handler when a day is clicked. */
491
442
  onDayClick?: DayEventHandler<React.MouseEvent>;
492
443
  /** Event handler when a day is focused. */
@@ -507,46 +458,6 @@ export interface PropsBase {
507
458
  * @experimental
508
459
  */
509
460
  dateLib?: Partial<typeof DateLib.prototype> | undefined;
510
- /**
511
- * @private
512
- * @deprecated Use a custom `DayButton` component instead.
513
- */
514
- onDayKeyUp?: DayEventHandler<React.KeyboardEvent>;
515
- /**
516
- * @private
517
- * @deprecated Use a custom `DayButton` component instead.
518
- */
519
- onDayKeyPress?: DayEventHandler<React.KeyboardEvent>;
520
- /**
521
- * @private
522
- * @deprecated Use a custom `DayButton` component instead.
523
- */
524
- onDayPointerEnter?: DayEventHandler<React.PointerEvent>;
525
- /**
526
- * @private
527
- * @deprecated Use a custom `DayButton` component instead.
528
- */
529
- onDayPointerLeave?: DayEventHandler<React.PointerEvent>;
530
- /**
531
- * @private
532
- * @deprecated Use a custom `DayButton` component instead.
533
- */
534
- onDayTouchCancel?: DayEventHandler<React.TouchEvent>;
535
- /**
536
- * @private
537
- * @deprecated Use a custom `DayButton` component instead.
538
- */
539
- onDayTouchEnd?: DayEventHandler<React.TouchEvent>;
540
- /**
541
- * @private
542
- * @deprecated Use a custom `DayButton` component instead.
543
- */
544
- onDayTouchMove?: DayEventHandler<React.TouchEvent>;
545
- /**
546
- * @private
547
- * @deprecated Use a custom `DayButton` component instead.
548
- */
549
- onDayTouchStart?: DayEventHandler<React.TouchEvent>;
550
461
  }
551
462
  /**
552
463
  * Shared handler type for `onSelect` callback when a selection mode is set.
@@ -654,9 +565,18 @@ export interface PropsRangeRequired {
654
565
  /**
655
566
  * When `true`, the range will reset when including a disabled day.
656
567
  *
657
- * @since V9.0.2
568
+ * @since 9.0.2
658
569
  */
659
570
  excludeDisabled?: boolean | undefined;
571
+ /**
572
+ * When `true`, clicking a day starts a new range if there is no current start
573
+ * date or if a range is already complete. In those cases, the clicked day
574
+ * becomes the start of the new range.
575
+ *
576
+ * @since 9.14
577
+ * @see https://daypicker.dev/selections/range-mode#reset-selection
578
+ */
579
+ resetOnSelect?: boolean | undefined;
660
580
  /** The selected range. */
661
581
  selected: DateRange | undefined;
662
582
  /** Event handler when a range is selected. */
@@ -685,10 +605,20 @@ export interface PropsRange {
685
605
  /**
686
606
  * When `true`, the range will reset when including a disabled day.
687
607
  *
688
- * @since V9.0.2
608
+ * @since 9.0.2
689
609
  * @see https://daypicker.dev/docs/selection-modes#exclude-disabled
690
610
  */
691
611
  excludeDisabled?: boolean | undefined;
612
+ /**
613
+ * When `true`, clicking a day starts a new range if there is no current start
614
+ * date or if a range is already complete. In those cases, the clicked day
615
+ * becomes the start of the new range. When `required` is `false`, clicking
616
+ * the same day of a single-day range clears the selection.
617
+ *
618
+ * @since 9.14
619
+ * @see https://daypicker.dev/selections/range-mode#reset-selection
620
+ */
621
+ resetOnSelect?: boolean | undefined;
692
622
  /** The selected range. */
693
623
  selected?: DateRange | undefined;
694
624
  /** Event handler when the selection changes. */
@@ -1,6 +1,6 @@
1
1
  import type { CSSProperties } from "react";
2
2
  import type * as components from "../components/custom-components.js";
3
- import type { formatCaption, formatDay, formatMonthCaption, formatMonthDropdown, formatWeekdayName, formatWeekNumber, formatWeekNumberHeader, formatYearCaption, formatYearDropdown } from "../formatters/index.js";
3
+ import type { formatCaption, formatDay, formatMonthDropdown, formatWeekdayName, formatWeekNumber, formatWeekNumberHeader, formatYearDropdown } from "../formatters/index.js";
4
4
  import type { labelDayButton, labelGrid, labelGridcell, labelMonthDropdown, labelNav, labelNext, labelPrevious, labelWeekday, labelWeekNumber, labelWeekNumberHeader, labelYearDropdown } from "../labels/index.js";
5
5
  import type { Animation, DayFlag, SelectionState, UI } from "../UI.js";
6
6
  /**
@@ -19,13 +19,6 @@ export type Mode = "single" | "multiple" | "range";
19
19
  * @see https://daypicker.dev/guides/custom-components
20
20
  */
21
21
  export type CustomComponents = {
22
- /**
23
- * Render any button element in DayPicker.
24
- *
25
- * @deprecated Use {@link CustomComponents.NextMonthButton} or
26
- * {@link CustomComponents.PreviousMonthButton} instead.
27
- */
28
- Button: typeof components.Button;
29
22
  /** Render the chevron icon used in the navigation buttons and dropdowns. */
30
23
  Chevron: typeof components.Chevron;
31
24
  /** Render the caption label of the month grid. */
@@ -85,13 +78,6 @@ export type Formatters = {
85
78
  formatDay: typeof formatDay;
86
79
  /** Format the label in the month dropdown. */
87
80
  formatMonthDropdown: typeof formatMonthDropdown;
88
- /**
89
- * @ignore
90
- * @deprecated Use {@link Formatters.formatCaption} instead.
91
- *
92
- * **Note:** This formatter will be removed in version 10.0.0.
93
- */
94
- formatMonthCaption: typeof formatMonthCaption;
95
81
  /** Format the week number. */
96
82
  formatWeekNumber: typeof formatWeekNumber;
97
83
  /** Format the header of the week number column. */
@@ -100,11 +86,6 @@ export type Formatters = {
100
86
  formatWeekdayName: typeof formatWeekdayName;
101
87
  /** Format the label in the year dropdown. */
102
88
  formatYearDropdown: typeof formatYearDropdown;
103
- /**
104
- * @ignore
105
- * @deprecated Use {@link Formatters.formatYearDropdown} instead.
106
- */
107
- formatYearCaption: typeof formatYearCaption;
108
89
  };
109
90
  /** A map of functions to translate ARIA labels for various elements. */
110
91
  export type Labels = {
@@ -124,11 +105,6 @@ export type Labels = {
124
105
  labelPrevious: typeof labelPrevious;
125
106
  /** The label for the day button. */
126
107
  labelDayButton: typeof labelDayButton;
127
- /**
128
- * @ignore
129
- * @deprecated Use {@link labelDayButton} instead.
130
- */
131
- labelDay: typeof labelDayButton;
132
108
  /** The label for the weekday. */
133
109
  labelWeekday: typeof labelWeekday;
134
110
  /** The label for the week number. */
@@ -285,26 +261,6 @@ export type ModifiersStyles = Record<string, CSSProperties>;
285
261
  * };
286
262
  */
287
263
  export type ModifiersClassNames = Record<string, string>;
288
- /**
289
- * The props that have been deprecated since version 9.0.0.
290
- *
291
- * @private
292
- * @since 9.0.0
293
- * @see https://daypicker.dev/upgrading
294
- */
295
- export type V9DeprecatedProps =
296
- /** Use `hidden` prop instead. */
297
- "fromDate"
298
- /** Use `hidden` prop instead. */
299
- | "toDate"
300
- /** Use `startMonth` instead. */
301
- | "fromMonth"
302
- /** Use `endMonth` instead. */
303
- | "toMonth"
304
- /** Use `startMonth` instead. */
305
- | "fromYear"
306
- /** Use `endMonth` instead. */
307
- | "toYear";
308
264
  /** The direction to move the focus relative to the current focused date. */
309
265
  export type MoveFocusDir = "after" | "before";
310
266
  /** The temporal unit to move the focus by. */
@@ -52,4 +52,4 @@ export interface Calendar {
52
52
  * @returns The calendar object containing displayed days, weeks, months, and
53
53
  * navigation methods.
54
54
  */
55
- export declare function useCalendar(props: Pick<DayPickerProps, "captionLayout" | "endMonth" | "startMonth" | "today" | "fixedWeeks" | "ISOWeek" | "numberOfMonths" | "pagedNavigation" | "reverseMonths" | "disableNavigation" | "onMonthChange" | "month" | "defaultMonth" | "timeZone" | "broadcastCalendar" | "fromMonth" | "fromYear" | "toMonth" | "toYear">, dateLib: DateLib): Calendar;
55
+ export declare function useCalendar(props: Pick<DayPickerProps, "captionLayout" | "endMonth" | "startMonth" | "today" | "fixedWeeks" | "ISOWeek" | "numberOfMonths" | "pagedNavigation" | "reverseMonths" | "disableNavigation" | "onMonthChange" | "month" | "defaultMonth" | "timeZone" | "broadcastCalendar">, dateLib: DateLib): Calendar;
@@ -10,8 +10,3 @@ import type { Matcher } from "../types/index.js";
10
10
  * @group Utilities
11
11
  */
12
12
  export declare function dateMatchModifiers(date: Date, matchers: Matcher | Matcher[], dateLib?: DateLib): boolean;
13
- /**
14
- * @private
15
- * @deprecated Use {@link dateMatchModifiers} instead.
16
- */
17
- export declare const isMatch: typeof dateMatchModifiers;
@@ -57,8 +57,3 @@ export function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) {
57
57
  return false;
58
58
  });
59
59
  }
60
- /**
61
- * @private
62
- * @deprecated Use {@link dateMatchModifiers} instead.
63
- */
64
- export const isMatch = dateMatchModifiers;
@@ -11,8 +11,3 @@ import type { DateRange } from "../types/index.js";
11
11
  * @group Utilities
12
12
  */
13
13
  export declare function rangeIncludesDate(range: DateRange, date: Date, excludeEnds?: boolean, dateLib?: import("../classes/DateLib.js").DateLib): boolean;
14
- /**
15
- * @private
16
- * @deprecated Use {@link rangeIncludesDate} instead.
17
- */
18
- export declare const isDateInRange: (range: DateRange, date: Date) => boolean;
@@ -30,8 +30,3 @@ export function rangeIncludesDate(range, date, excludeEnds = false, dateLib = de
30
30
  }
31
31
  return false;
32
32
  }
33
- /**
34
- * @private
35
- * @deprecated Use {@link rangeIncludesDate} instead.
36
- */
37
- export const isDateInRange = (range, date) => rangeIncludesDate(range, date, false, defaultDateLib);
package/hijri.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./dist/cjs/hijri/index.d.ts";
package/hijri.js ADDED
@@ -0,0 +1,2 @@
1
+ const hijri = require("./dist/cjs/hijri/index.js");
2
+ module.exports = hijri;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-day-picker",
3
- "version": "9.13.2",
3
+ "version": "10.0.0-next.0",
4
4
  "description": "Customizable Date Picker for React",
5
5
  "author": "Giampaolo Bellavite <io@gpbl.dev>",
6
6
  "homepage": "https://daypicker.dev",
@@ -35,16 +35,6 @@
35
35
  "default": "./dist/cjs/index.js"
36
36
  }
37
37
  },
38
- "./jalali": {
39
- "import": {
40
- "types": "./dist/esm/jalali.d.ts",
41
- "default": "./dist/esm/jalali.js"
42
- },
43
- "require": {
44
- "types": "./dist/cjs/jalali.d.ts",
45
- "default": "./dist/cjs/jalali.js"
46
- }
47
- },
48
38
  "./persian": {
49
39
  "import": {
50
40
  "types": "./dist/esm/persian.d.ts",
@@ -85,6 +75,16 @@
85
75
  "default": "./dist/cjs/ethiopic/index.js"
86
76
  }
87
77
  },
78
+ "./hijri": {
79
+ "import": {
80
+ "types": "./dist/esm/hijri/index.d.ts",
81
+ "default": "./dist/esm/hijri/index.js"
82
+ },
83
+ "require": {
84
+ "types": "./dist/cjs/hijri/index.d.ts",
85
+ "default": "./dist/cjs/hijri/index.js"
86
+ }
87
+ },
88
88
  "./style": {
89
89
  "sass": "./src/style.css"
90
90
  },
@@ -220,44 +220,45 @@
220
220
  "src/style.module.css",
221
221
  "src/style.css.d.ts",
222
222
  "src/style.module.css.d.ts",
223
- "jalali.js",
224
- "jalali.d.ts",
225
223
  "persian.js",
226
224
  "persian.d.ts",
227
225
  "buddhist.js",
228
226
  "buddhist.d.ts",
229
227
  "hebrew.js",
230
228
  "hebrew.d.ts",
229
+ "hijri.js",
230
+ "hijri.d.ts",
231
231
  "locale.js",
232
232
  "locale.d.ts"
233
233
  ],
234
234
  "dependencies": {
235
235
  "@date-fns/tz": "^1.4.1",
236
+ "@tabby_ai/hijri-converter": "1.0.5",
236
237
  "date-fns": "^4.1.0",
237
- "date-fns-jalali": "^4.1.0-0"
238
+ "date-fns-jalali": "4.1.0-0"
238
239
  },
239
240
  "devDependencies": {
240
- "@biomejs/biome": "2.3.8",
241
+ "@biomejs/biome": "2.3.14",
241
242
  "@jest/types": "^30.2.0",
242
243
  "@radix-ui/react-select": "^2.2.6",
243
- "@swc/core": "^1.15.3",
244
+ "@swc/core": "^1.15.11",
244
245
  "@swc/jest": "^0.2.39",
245
246
  "@testing-library/dom": "^10.4.1",
246
247
  "@testing-library/jest-dom": "^6.9.1",
247
- "@testing-library/react": "^16.3.0",
248
+ "@testing-library/react": "^16.3.2",
248
249
  "@testing-library/user-event": "^14.6.1",
249
250
  "@types/jest": "^30.0.0",
250
- "@types/node": "^24.10.1",
251
- "@types/react": "^19.2.7",
251
+ "@types/node": "^25.2.3",
252
+ "@types/react": "^19.2.13",
252
253
  "@types/react-dom": "^19.2.3",
253
254
  "jest": "^30.2.0",
254
255
  "jest-environment-jsdom": "^30.2.0",
255
256
  "jest-transform-css": "^6.0.3",
256
257
  "mockdate": "^3.0.5",
257
- "prettier": "^3.7.1",
258
- "prettier-plugin-jsdoc": "^1.7.0",
259
- "react": "^19.2.1",
260
- "react-dom": "^19.2.1",
258
+ "prettier": "^3.8.1",
259
+ "prettier-plugin-jsdoc": "^1.8.0",
260
+ "react": "^19.2.4",
261
+ "react-dom": "^19.2.4",
261
262
  "ts-node": "^10.9.2",
262
263
  "tslib": "^2.8.1",
263
264
  "typescript": "^5.9.3",
@@ -1,9 +0,0 @@
1
- import React, { type ButtonHTMLAttributes } from "react";
2
- /**
3
- * Render the button elements in the calendar.
4
- *
5
- * @private
6
- * @deprecated Use `PreviousMonthButton` or `@link NextMonthButton` instead.
7
- */
8
- export declare function Button(props: ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
9
- export type ButtonProps = Parameters<typeof Button>[0];
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Button = Button;
7
- const react_1 = __importDefault(require("react"));
8
- /**
9
- * Render the button elements in the calendar.
10
- *
11
- * @private
12
- * @deprecated Use `PreviousMonthButton` or `@link NextMonthButton` instead.
13
- */
14
- function Button(props) {
15
- return react_1.default.createElement("button", { ...props });
16
- }
@@ -1,2 +0,0 @@
1
- /** @deprecated Import from `react-day-picker/persian` instead. */
2
- export * from "./persian.js";
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /** @deprecated Import from `react-day-picker/persian` instead. */
18
- __exportStar(require("./persian.js"), exports);