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.
Files changed (64) hide show
  1. package/README.md +10 -5
  2. package/dist/cjs/DayPicker.js +89 -88
  3. package/dist/cjs/classes/DateLib.d.ts +1 -0
  4. package/dist/cjs/components/CaptionLabel.d.ts +1 -0
  5. package/dist/cjs/components/Chevron.d.ts +1 -0
  6. package/dist/cjs/components/Day.d.ts +1 -0
  7. package/dist/cjs/components/DayButton.d.ts +1 -0
  8. package/dist/cjs/components/Dropdown.d.ts +1 -0
  9. package/dist/cjs/components/DropdownNav.d.ts +1 -0
  10. package/dist/cjs/components/Footer.d.ts +1 -0
  11. package/dist/cjs/components/Month.d.ts +1 -0
  12. package/dist/cjs/components/MonthCaption.d.ts +1 -0
  13. package/dist/cjs/components/MonthGrid.d.ts +1 -0
  14. package/dist/cjs/components/Months.d.ts +1 -0
  15. package/dist/cjs/components/Nav.d.ts +1 -0
  16. package/dist/cjs/components/NextMonthButton.d.ts +1 -0
  17. package/dist/cjs/components/Option.d.ts +1 -0
  18. package/dist/cjs/components/PreviousMonthButton.d.ts +1 -0
  19. package/dist/cjs/components/Root.d.ts +1 -0
  20. package/dist/cjs/components/Select.d.ts +1 -0
  21. package/dist/cjs/components/Week.d.ts +1 -0
  22. package/dist/cjs/components/WeekNumber.d.ts +1 -0
  23. package/dist/cjs/components/WeekNumberHeader.d.ts +1 -0
  24. package/dist/cjs/components/Weekday.d.ts +1 -0
  25. package/dist/cjs/components/Weekdays.d.ts +1 -0
  26. package/dist/cjs/components/Weeks.d.ts +1 -0
  27. package/dist/cjs/locale.d.ts +0 -1
  28. package/dist/cjs/locale.js +2 -4
  29. package/dist/cjs/types/props.d.ts +2 -1
  30. package/dist/cjs/types/selection.d.ts +7 -0
  31. package/dist/esm/DayPicker.js +89 -88
  32. package/dist/esm/classes/DateLib.d.ts +1 -0
  33. package/dist/esm/components/CaptionLabel.d.ts +1 -0
  34. package/dist/esm/components/Chevron.d.ts +1 -0
  35. package/dist/esm/components/Day.d.ts +1 -0
  36. package/dist/esm/components/DayButton.d.ts +1 -0
  37. package/dist/esm/components/Dropdown.d.ts +1 -0
  38. package/dist/esm/components/DropdownNav.d.ts +1 -0
  39. package/dist/esm/components/Footer.d.ts +1 -0
  40. package/dist/esm/components/Month.d.ts +1 -0
  41. package/dist/esm/components/MonthCaption.d.ts +1 -0
  42. package/dist/esm/components/MonthGrid.d.ts +1 -0
  43. package/dist/esm/components/Months.d.ts +1 -0
  44. package/dist/esm/components/Nav.d.ts +1 -0
  45. package/dist/esm/components/NextMonthButton.d.ts +1 -0
  46. package/dist/esm/components/Option.d.ts +1 -0
  47. package/dist/esm/components/PreviousMonthButton.d.ts +1 -0
  48. package/dist/esm/components/Root.d.ts +1 -0
  49. package/dist/esm/components/Select.d.ts +1 -0
  50. package/dist/esm/components/Week.d.ts +1 -0
  51. package/dist/esm/components/WeekNumber.d.ts +1 -0
  52. package/dist/esm/components/WeekNumberHeader.d.ts +1 -0
  53. package/dist/esm/components/Weekday.d.ts +1 -0
  54. package/dist/esm/components/Weekdays.d.ts +1 -0
  55. package/dist/esm/components/Weeks.d.ts +1 -0
  56. package/dist/esm/locale.d.ts +0 -1
  57. package/dist/esm/locale.js +0 -1
  58. package/dist/esm/types/props.d.ts +2 -1
  59. package/dist/esm/types/selection.d.ts +7 -0
  60. package/package.json +1 -1
  61. package/dist/cjs/locale/am-ET.d.ts +0 -7
  62. package/dist/cjs/locale/am-ET.js +0 -131
  63. package/dist/esm/locale/am-ET.d.ts +0 -7
  64. package/dist/esm/locale/am-ET.js +0 -128
@@ -1,131 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.amET = void 0;
4
- const DateLib_js_1 = require("../classes/DateLib.js");
5
- const en_US_js_1 = require("./en-US.js");
6
- /**
7
- * Minimal Amharic (Ethiopia) locale for date-fns v4.
8
- *
9
- * - Uses `Intl.DateTimeFormat('am-ET')` to localize month and weekday names.
10
- * - Reuses `en-US` implementations for `formatLong`, `formatDistance`,
11
- * `formatRelative`, and `match` to keep the footprint small.
12
- * - Ordinals are returned as plain numeric strings.
13
- */
14
- // Map date-fns widths to Intl widths
15
- function mapWidth(width) {
16
- switch (width) {
17
- case "narrow":
18
- return "narrow";
19
- case "short":
20
- case "abbreviated":
21
- return "short";
22
- default:
23
- return "long";
24
- }
25
- }
26
- function buildMonthNames(width) {
27
- const intlWidth = mapWidth(width);
28
- const fmt = new Intl.DateTimeFormat("am-ET", {
29
- month: intlWidth,
30
- timeZone: "UTC",
31
- });
32
- const names = [];
33
- for (let i = 0; i < 12; i++) {
34
- // Use a fixed UTC date to avoid locale-specific DST artifacts
35
- names.push(fmt.format(new Date(Date.UTC(2017, i, 1))));
36
- }
37
- return names;
38
- }
39
- function buildDayNames(width) {
40
- const intlWidth = mapWidth(width);
41
- const fmt = new Intl.DateTimeFormat("am-ET", {
42
- weekday: intlWidth,
43
- timeZone: "UTC",
44
- });
45
- const names = [];
46
- // 2017-01-01 was a Sunday; iterate 0..6
47
- const base = Date.UTC(2017, 0, 1);
48
- for (let i = 0; i < 7; i++) {
49
- names.push(fmt.format(new Date(base + i * 24 * 60 * 60 * 1000)));
50
- }
51
- return names;
52
- }
53
- function getDayPeriod(value, width) {
54
- if (value === "am" || value === "pm") {
55
- const sampleHour = value === "am" ? 1 : 13;
56
- const parts = new Intl.DateTimeFormat("am-ET", {
57
- hour: "numeric",
58
- hour12: true,
59
- timeZone: "UTC",
60
- })
61
- .formatToParts(new Date(Date.UTC(2017, 0, 1, sampleHour)))
62
- .find((p) => p.type === "dayPeriod");
63
- if (parts?.value)
64
- return parts.value;
65
- }
66
- // Fallback: delegate to en-US for anything else
67
- return en_US_js_1.enUS.localize.dayPeriod(value, { width: width });
68
- }
69
- const localize = {
70
- ...en_US_js_1.enUS.localize,
71
- // Ordinals in Amharic are commonly written as cardinals; keep simple numeric output
72
- ordinalNumber: (n) => String(n),
73
- month: (value, options) => {
74
- const names = buildMonthNames(options?.width);
75
- // value is 0..11 in date-fns v4
76
- return names[value];
77
- },
78
- day: (value, options) => {
79
- const names = buildDayNames(options?.width);
80
- // value is 0..6, where 0 = Sunday
81
- return names[value];
82
- },
83
- dayPeriod: (value, options) => getDayPeriod(value, options?.width),
84
- };
85
- const options = {
86
- weekStartsOn: 1,
87
- firstWeekContainsDate: 1,
88
- };
89
- /**
90
- * Amharic (Ethiopia) locale backed by Intl for core names plus DayPicker
91
- * labels.
92
- */
93
- exports.amET = {
94
- code: "am-ET",
95
- // Reuse en-US for distance/relative formatting and formatLong skeletons
96
- formatDistance: en_US_js_1.enUS.formatDistance,
97
- formatRelative: en_US_js_1.enUS.formatRelative,
98
- formatLong: en_US_js_1.enUS.formatLong,
99
- localize,
100
- match: en_US_js_1.enUS.match,
101
- options,
102
- labels: {
103
- labelDayButton: (date, modifiers, opts, dateLib) => {
104
- const lib = dateLib ?? new DateLib_js_1.DateLib(opts);
105
- let label = lib.format(date, "PPPP");
106
- if (modifiers.today)
107
- label = `ዛሬ፣ ${label}`;
108
- if (modifiers.selected)
109
- label = `${label}, ተመርጧል`;
110
- return label;
111
- },
112
- labelMonthDropdown: "ወርን ይምረጡ",
113
- labelNext: "ወደ ቀጣይ ወር ይሂዱ",
114
- labelPrevious: "ወደ ቀዳሚ ወር ይሂዱ",
115
- labelWeekNumber: (weekNumber) => `ሳምንት ${weekNumber}`,
116
- labelYearDropdown: "ዓመቱን ይምረጡ",
117
- labelGrid: (date, opts, dateLib) => (dateLib ?? new DateLib_js_1.DateLib(opts)).formatMonthYear(date),
118
- labelGridcell: (date, modifiers, opts, dateLib) => {
119
- const lib = dateLib ?? new DateLib_js_1.DateLib(opts);
120
- let label = lib.format(date, "PPPP");
121
- if (modifiers?.today) {
122
- label = `ዛሬ፣ ${label}`;
123
- }
124
- return label;
125
- },
126
- labelNav: "መምሪያ አሞሌ",
127
- labelWeekNumberHeader: "የሳምንት ቁጥር",
128
- labelWeekday: (date, opts, dateLib) => (dateLib ?? new DateLib_js_1.DateLib(opts)).format(date, "cccc"),
129
- },
130
- };
131
- exports.default = exports.amET;
@@ -1,7 +0,0 @@
1
- import type { DayPickerLocale } from "../classes/DateLib.js";
2
- /**
3
- * Amharic (Ethiopia) locale backed by Intl for core names plus DayPicker
4
- * labels.
5
- */
6
- export declare const amET: DayPickerLocale;
7
- export default amET;
@@ -1,128 +0,0 @@
1
- import { DateLib } from "../classes/DateLib.js";
2
- import { enUS } from "./en-US.js";
3
- /**
4
- * Minimal Amharic (Ethiopia) locale for date-fns v4.
5
- *
6
- * - Uses `Intl.DateTimeFormat('am-ET')` to localize month and weekday names.
7
- * - Reuses `en-US` implementations for `formatLong`, `formatDistance`,
8
- * `formatRelative`, and `match` to keep the footprint small.
9
- * - Ordinals are returned as plain numeric strings.
10
- */
11
- // Map date-fns widths to Intl widths
12
- function mapWidth(width) {
13
- switch (width) {
14
- case "narrow":
15
- return "narrow";
16
- case "short":
17
- case "abbreviated":
18
- return "short";
19
- default:
20
- return "long";
21
- }
22
- }
23
- function buildMonthNames(width) {
24
- const intlWidth = mapWidth(width);
25
- const fmt = new Intl.DateTimeFormat("am-ET", {
26
- month: intlWidth,
27
- timeZone: "UTC",
28
- });
29
- const names = [];
30
- for (let i = 0; i < 12; i++) {
31
- // Use a fixed UTC date to avoid locale-specific DST artifacts
32
- names.push(fmt.format(new Date(Date.UTC(2017, i, 1))));
33
- }
34
- return names;
35
- }
36
- function buildDayNames(width) {
37
- const intlWidth = mapWidth(width);
38
- const fmt = new Intl.DateTimeFormat("am-ET", {
39
- weekday: intlWidth,
40
- timeZone: "UTC",
41
- });
42
- const names = [];
43
- // 2017-01-01 was a Sunday; iterate 0..6
44
- const base = Date.UTC(2017, 0, 1);
45
- for (let i = 0; i < 7; i++) {
46
- names.push(fmt.format(new Date(base + i * 24 * 60 * 60 * 1000)));
47
- }
48
- return names;
49
- }
50
- function getDayPeriod(value, width) {
51
- if (value === "am" || value === "pm") {
52
- const sampleHour = value === "am" ? 1 : 13;
53
- const parts = new Intl.DateTimeFormat("am-ET", {
54
- hour: "numeric",
55
- hour12: true,
56
- timeZone: "UTC",
57
- })
58
- .formatToParts(new Date(Date.UTC(2017, 0, 1, sampleHour)))
59
- .find((p) => p.type === "dayPeriod");
60
- if (parts?.value)
61
- return parts.value;
62
- }
63
- // Fallback: delegate to en-US for anything else
64
- return enUS.localize.dayPeriod(value, { width: width });
65
- }
66
- const localize = {
67
- ...enUS.localize,
68
- // Ordinals in Amharic are commonly written as cardinals; keep simple numeric output
69
- ordinalNumber: (n) => String(n),
70
- month: (value, options) => {
71
- const names = buildMonthNames(options?.width);
72
- // value is 0..11 in date-fns v4
73
- return names[value];
74
- },
75
- day: (value, options) => {
76
- const names = buildDayNames(options?.width);
77
- // value is 0..6, where 0 = Sunday
78
- return names[value];
79
- },
80
- dayPeriod: (value, options) => getDayPeriod(value, options?.width),
81
- };
82
- const options = {
83
- weekStartsOn: 1,
84
- firstWeekContainsDate: 1,
85
- };
86
- /**
87
- * Amharic (Ethiopia) locale backed by Intl for core names plus DayPicker
88
- * labels.
89
- */
90
- export const amET = {
91
- code: "am-ET",
92
- // Reuse en-US for distance/relative formatting and formatLong skeletons
93
- formatDistance: enUS.formatDistance,
94
- formatRelative: enUS.formatRelative,
95
- formatLong: enUS.formatLong,
96
- localize,
97
- match: enUS.match,
98
- options,
99
- labels: {
100
- labelDayButton: (date, modifiers, opts, dateLib) => {
101
- const lib = dateLib ?? new DateLib(opts);
102
- let label = lib.format(date, "PPPP");
103
- if (modifiers.today)
104
- label = `ዛሬ፣ ${label}`;
105
- if (modifiers.selected)
106
- label = `${label}, ተመርጧል`;
107
- return label;
108
- },
109
- labelMonthDropdown: "ወርን ይምረጡ",
110
- labelNext: "ወደ ቀጣይ ወር ይሂዱ",
111
- labelPrevious: "ወደ ቀዳሚ ወር ይሂዱ",
112
- labelWeekNumber: (weekNumber) => `ሳምንት ${weekNumber}`,
113
- labelYearDropdown: "ዓመቱን ይምረጡ",
114
- labelGrid: (date, opts, dateLib) => (dateLib ?? new DateLib(opts)).formatMonthYear(date),
115
- labelGridcell: (date, modifiers, opts, dateLib) => {
116
- const lib = dateLib ?? new DateLib(opts);
117
- let label = lib.format(date, "PPPP");
118
- if (modifiers?.today) {
119
- label = `ዛሬ፣ ${label}`;
120
- }
121
- return label;
122
- },
123
- labelNav: "መምሪያ አሞሌ",
124
- labelWeekNumberHeader: "የሳምንት ቁጥር",
125
- labelWeekday: (date, opts, dateLib) => (dateLib ?? new DateLib(opts)).format(date, "cccc"),
126
- },
127
- };
128
- export default amET;