@charcuterie/ui 3.0.0 → 3.2.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 (130) hide show
  1. package/README.md +10 -0
  2. package/dist/Badge/Badge.d.ts +33 -3
  3. package/dist/Badge/Badge.d.ts.map +1 -1
  4. package/dist/Badge/Badge.js +20 -2
  5. package/dist/Badge/Badge.js.map +1 -1
  6. package/dist/Board/Board.d.ts +119 -0
  7. package/dist/Board/Board.d.ts.map +1 -0
  8. package/dist/Board/Board.js +165 -0
  9. package/dist/Board/Board.js.map +1 -0
  10. package/dist/Board/BoardCard.d.ts +120 -0
  11. package/dist/Board/BoardCard.d.ts.map +1 -0
  12. package/dist/Board/BoardCard.js +77 -0
  13. package/dist/Board/BoardCard.js.map +1 -0
  14. package/dist/Board/BoardLaneList.d.ts +103 -0
  15. package/dist/Board/BoardLaneList.d.ts.map +1 -0
  16. package/dist/Board/BoardLaneList.js +69 -0
  17. package/dist/Board/BoardLaneList.js.map +1 -0
  18. package/dist/Board/boardMove.d.ts +116 -0
  19. package/dist/Board/boardMove.d.ts.map +1 -0
  20. package/dist/Board/boardMove.js +116 -0
  21. package/dist/Board/boardMove.js.map +1 -0
  22. package/dist/Board/useBoardDrag.d.ts +44 -0
  23. package/dist/Board/useBoardDrag.d.ts.map +1 -0
  24. package/dist/Board/useBoardDrag.js +237 -0
  25. package/dist/Board/useBoardDrag.js.map +1 -0
  26. package/dist/Checkbox/Checkbox.d.ts.map +1 -1
  27. package/dist/Checkbox/Checkbox.js +15 -4
  28. package/dist/Checkbox/Checkbox.js.map +1 -1
  29. package/dist/DataTable/DataTable.d.ts +159 -0
  30. package/dist/DataTable/DataTable.d.ts.map +1 -0
  31. package/dist/DataTable/DataTable.js +197 -0
  32. package/dist/DataTable/DataTable.js.map +1 -0
  33. package/dist/DatePicker/DateGrid.d.ts +79 -0
  34. package/dist/DatePicker/DateGrid.d.ts.map +1 -0
  35. package/dist/DatePicker/DateGrid.js +220 -0
  36. package/dist/DatePicker/DateGrid.js.map +1 -0
  37. package/dist/DatePicker/DatePicker.d.ts +138 -0
  38. package/dist/DatePicker/DatePicker.d.ts.map +1 -0
  39. package/dist/DatePicker/DatePicker.js +384 -0
  40. package/dist/DatePicker/DatePicker.js.map +1 -0
  41. package/dist/DatePicker/datePresets.d.ts +29 -0
  42. package/dist/DatePicker/datePresets.d.ts.map +1 -0
  43. package/dist/DatePicker/datePresets.js +28 -0
  44. package/dist/DatePicker/datePresets.js.map +1 -0
  45. package/dist/DatePicker/parseDateInput.d.ts +106 -0
  46. package/dist/DatePicker/parseDateInput.d.ts.map +1 -0
  47. package/dist/DatePicker/parseDateInput.js +419 -0
  48. package/dist/DatePicker/parseDateInput.js.map +1 -0
  49. package/dist/DatePicker/plainDate.d.ts +167 -0
  50. package/dist/DatePicker/plainDate.d.ts.map +1 -0
  51. package/dist/DatePicker/plainDate.js +272 -0
  52. package/dist/DatePicker/plainDate.js.map +1 -0
  53. package/dist/Dialog/Dialog.d.ts +12 -2
  54. package/dist/Dialog/Dialog.d.ts.map +1 -1
  55. package/dist/Dialog/Dialog.js +2 -2
  56. package/dist/Dialog/Dialog.js.map +1 -1
  57. package/dist/MarkdownEditor/MarkdownEditor.d.ts +147 -0
  58. package/dist/MarkdownEditor/MarkdownEditor.d.ts.map +1 -0
  59. package/dist/MarkdownEditor/MarkdownEditor.js +492 -0
  60. package/dist/MarkdownEditor/MarkdownEditor.js.map +1 -0
  61. package/dist/MarkdownEditor/markdownCommands.d.ts +202 -0
  62. package/dist/MarkdownEditor/markdownCommands.d.ts.map +1 -0
  63. package/dist/MarkdownEditor/markdownCommands.js +379 -0
  64. package/dist/MarkdownEditor/markdownCommands.js.map +1 -0
  65. package/dist/MarkdownEditor/markdownSpans.d.ts +92 -0
  66. package/dist/MarkdownEditor/markdownSpans.d.ts.map +1 -0
  67. package/dist/MarkdownEditor/markdownSpans.js +303 -0
  68. package/dist/MarkdownEditor/markdownSpans.js.map +1 -0
  69. package/dist/Modal/Modal.d.ts +6 -2
  70. package/dist/Modal/Modal.d.ts.map +1 -1
  71. package/dist/Modal/Modal.js +1 -1
  72. package/dist/Modal/Modal.js.map +1 -1
  73. package/dist/Overlay/OverlayPanel.d.ts +13 -2
  74. package/dist/Overlay/OverlayPanel.d.ts.map +1 -1
  75. package/dist/Overlay/OverlayPanel.js +5 -1
  76. package/dist/Overlay/OverlayPanel.js.map +1 -1
  77. package/dist/categoricalStyles.d.ts +53 -0
  78. package/dist/categoricalStyles.d.ts.map +1 -0
  79. package/dist/categoricalStyles.js +195 -0
  80. package/dist/categoricalStyles.js.map +1 -0
  81. package/dist/index.d.ts +22 -0
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +11 -0
  84. package/dist/index.js.map +1 -1
  85. package/package.json +2 -2
  86. package/src/Badge/Badge.mdx +46 -0
  87. package/src/Badge/Badge.stories.tsx +98 -4
  88. package/src/Badge/Badge.test.tsx +157 -2
  89. package/src/Badge/Badge.tsx +49 -3
  90. package/src/Board/Board.mdx +199 -0
  91. package/src/Board/Board.stories.tsx +707 -0
  92. package/src/Board/Board.test.tsx +310 -0
  93. package/src/Board/Board.tsx +333 -0
  94. package/src/Board/BoardCard.tsx +290 -0
  95. package/src/Board/BoardLaneList.tsx +275 -0
  96. package/src/Board/boardMove.test.ts +213 -0
  97. package/src/Board/boardMove.ts +225 -0
  98. package/src/Board/useBoardDrag.ts +413 -0
  99. package/src/Checkbox/Checkbox.tsx +34 -3
  100. package/src/DataTable/DataTable.mdx +123 -0
  101. package/src/DataTable/DataTable.stories.tsx +411 -0
  102. package/src/DataTable/DataTable.test.tsx +386 -0
  103. package/src/DataTable/DataTable.tsx +497 -0
  104. package/src/DatePicker/DateGrid.tsx +467 -0
  105. package/src/DatePicker/DatePicker.mdx +170 -0
  106. package/src/DatePicker/DatePicker.stories.tsx +268 -0
  107. package/src/DatePicker/DatePicker.test.tsx +455 -0
  108. package/src/DatePicker/DatePicker.tsx +852 -0
  109. package/src/DatePicker/datePresets.ts +34 -0
  110. package/src/DatePicker/parseDateInput.test.ts +187 -0
  111. package/src/DatePicker/parseDateInput.ts +629 -0
  112. package/src/DatePicker/plainDate.test.ts +375 -0
  113. package/src/DatePicker/plainDate.ts +465 -0
  114. package/src/Dialog/Dialog.stories.tsx +48 -0
  115. package/src/Dialog/Dialog.test.tsx +30 -0
  116. package/src/Dialog/Dialog.tsx +13 -1
  117. package/src/MarkdownEditor/MarkdownEditor.mdx +189 -0
  118. package/src/MarkdownEditor/MarkdownEditor.stories.tsx +267 -0
  119. package/src/MarkdownEditor/MarkdownEditor.test.tsx +627 -0
  120. package/src/MarkdownEditor/MarkdownEditor.tsx +862 -0
  121. package/src/MarkdownEditor/markdownCommands.test.ts +384 -0
  122. package/src/MarkdownEditor/markdownCommands.ts +566 -0
  123. package/src/MarkdownEditor/markdownSpans.test.ts +217 -0
  124. package/src/MarkdownEditor/markdownSpans.ts +458 -0
  125. package/src/Modal/Modal.tsx +7 -1
  126. package/src/Overlay/OverlayPanel.tsx +17 -1
  127. package/src/argTypes.storyHelpers.ts +39 -0
  128. package/src/categoricalStyles.ts +244 -0
  129. package/src/index.ts +89 -0
  130. package/src/sourceRules.test.ts +52 -1
@@ -0,0 +1,106 @@
1
+ /**
2
+ * What a human types into a date field, turned into a calendar date
3
+ * — or into a stated reason it was not one.
4
+ *
5
+ * ### The calendar grid is the easy half
6
+ *
7
+ * Seven columns and some modular arithmetic is a weekend. The half
8
+ * that decides whether a date field is pleasant or infuriating is
9
+ * what happens when somebody types. Every hand-rolled date field in
10
+ * this fleet either accepts nothing but the format it prints, or
11
+ * hands the string to `new Date(…)` — which accepts `"Tuesday"` as
12
+ * an `Invalid Date`, accepts `"2026-08-19"` as *UTC midnight* while
13
+ * accepting `"08/19/2026"` as *local* midnight, and turns `"5"` into
14
+ * the year 2001. That last one is a real, specified behaviour and it
15
+ * is why `Date.parse` appears nowhere in this file.
16
+ *
17
+ * ### The rule that governs all of it: never guess in silence
18
+ *
19
+ * Three mechanisms, and they are the whole design:
20
+ *
21
+ * 1. **The grammar is ordered and total.** Each rule below is
22
+ * anchored on the *whole* input. The first rule that matches
23
+ * wins, and if none does the result is `unparsed` with a reason
24
+ * — never a nearest-guess, never a partial read. `8/` is not
25
+ * the first of August.
26
+ * 2. **Ambiguity is a failure with a name, not a coin flip.** A
27
+ * month or weekday prefix that matches more than one name comes
28
+ * back as `unparsed` saying which ones: `ju` is not June, it is
29
+ * "June or July — type more of it". This is why the matcher
30
+ * tests uniqueness instead of taking the first hit, which is
31
+ * what every library that "just works" does and is exactly how
32
+ * a July task lands in June.
33
+ * 3. **Nothing commits without an echo.** `DatePicker` renders the
34
+ * resolved date in full underneath the input, in a live region,
35
+ * before and after commit. The one genuinely irreducible
36
+ * ambiguity in date entry — `3/4` — is resolved by the locale's
37
+ * own field order and then *shown*, so a wrong reading is
38
+ * visible rather than discovered in three weeks.
39
+ *
40
+ * ### The one place a reading is swapped, and why it is not a guess
41
+ *
42
+ * `19/8` in an en-US locale has no valid month-first reading — there
43
+ * is no nineteenth month. Rather than rejecting it, the swapped
44
+ * reading is taken, because it is the **only** valid one. When both
45
+ * readings are valid (`3/4`) the locale's order wins and nothing is
46
+ * swapped. So the rule is: *swap only when exactly one arrangement
47
+ * is a real date*, which is deduction rather than preference.
48
+ *
49
+ * ### Everything locale-dependent is read from `Intl`
50
+ *
51
+ * Field order, month names, weekday names. There is no English word
52
+ * list in this file except the relative keywords (`today`,
53
+ * `tomorrow`, `next week`), which are the one thing `Intl` does not
54
+ * publish. Those are the documented, explicitly-English part of the
55
+ * surface, and a consumer that needs others supplies `keywords`.
56
+ */
57
+ import type { PlainDate } from "./plainDate.ts";
58
+ export type DateInputResult = {
59
+ date: PlainDate;
60
+ kind: "date";
61
+ } | {
62
+ kind: "empty";
63
+ } | {
64
+ kind: "unparsed";
65
+ reason: string;
66
+ };
67
+ export type DateInputKeywords = {
68
+ /** `last`, as in `last friday`. */
69
+ last: readonly string[];
70
+ /** `next`, as in `next friday` and `next week`. */
71
+ next: readonly string[];
72
+ today: readonly string[];
73
+ tomorrow: readonly string[];
74
+ /** Unit suffixes for `+3d` and `in 2 weeks`, longest-first. */
75
+ units: {
76
+ day: readonly string[];
77
+ month: readonly string[];
78
+ week: readonly string[];
79
+ year: readonly string[];
80
+ };
81
+ yesterday: readonly string[];
82
+ };
83
+ /**
84
+ * English, and stated rather than assumed.
85
+ *
86
+ * `Intl` publishes month and weekday names for every locale a
87
+ * browser knows, so those are never written down. It publishes
88
+ * nothing for "tomorrow" — `Intl.RelativeTimeFormat` *renders* one
89
+ * but cannot parse one — so this table is the honest boundary of
90
+ * what the component understands out of the box, and it is a prop so
91
+ * a consumer is not stuck with it.
92
+ */
93
+ export declare const DEFAULT_DATE_INPUT_KEYWORDS: DateInputKeywords;
94
+ export type ParseDateInputOptions = {
95
+ keywords?: DateInputKeywords;
96
+ locale?: string;
97
+ /**
98
+ * The clock, injected. Every relative form resolves against this
99
+ * and nothing reads the system clock, which is what lets the whole
100
+ * grammar be tested with a fixed date instead of tests that pass
101
+ * on the day they were written.
102
+ */
103
+ today: PlainDate;
104
+ };
105
+ export declare const parseDateInput: (rawText: string, { keywords, locale, today, }: ParseDateInputOptions) => DateInputResult;
106
+ //# sourceMappingURL=parseDateInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseDateInput.d.ts","sourceRoot":"","sources":["../../src/DatePicker/parseDateInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAY/C,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAExC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,mCAAmC;IACnC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,mDAAmD;IACnD,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,+DAA+D;IAC/D,KAAK,EAAE;QACL,GAAG,EAAE,SAAS,MAAM,EAAE,CAAA;QACtB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;QACxB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;QACvB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;KACxB,CAAA;IACD,SAAS,EAAE,SAAS,MAAM,EAAE,CAAA;CAC7B,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,EAAE,iBAavC,CAAA;AAEH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,KAAK,EAAE,SAAS,CAAA;CACjB,CAAA;AA8MD,eAAO,MAAM,cAAc,GACzB,SAAS,MAAM,EACf,8BAIG,qBAAqB,KACvB,eAiSF,CAAA"}
@@ -0,0 +1,419 @@
1
+ /**
2
+ * What a human types into a date field, turned into a calendar date
3
+ * — or into a stated reason it was not one.
4
+ *
5
+ * ### The calendar grid is the easy half
6
+ *
7
+ * Seven columns and some modular arithmetic is a weekend. The half
8
+ * that decides whether a date field is pleasant or infuriating is
9
+ * what happens when somebody types. Every hand-rolled date field in
10
+ * this fleet either accepts nothing but the format it prints, or
11
+ * hands the string to `new Date(…)` — which accepts `"Tuesday"` as
12
+ * an `Invalid Date`, accepts `"2026-08-19"` as *UTC midnight* while
13
+ * accepting `"08/19/2026"` as *local* midnight, and turns `"5"` into
14
+ * the year 2001. That last one is a real, specified behaviour and it
15
+ * is why `Date.parse` appears nowhere in this file.
16
+ *
17
+ * ### The rule that governs all of it: never guess in silence
18
+ *
19
+ * Three mechanisms, and they are the whole design:
20
+ *
21
+ * 1. **The grammar is ordered and total.** Each rule below is
22
+ * anchored on the *whole* input. The first rule that matches
23
+ * wins, and if none does the result is `unparsed` with a reason
24
+ * — never a nearest-guess, never a partial read. `8/` is not
25
+ * the first of August.
26
+ * 2. **Ambiguity is a failure with a name, not a coin flip.** A
27
+ * month or weekday prefix that matches more than one name comes
28
+ * back as `unparsed` saying which ones: `ju` is not June, it is
29
+ * "June or July — type more of it". This is why the matcher
30
+ * tests uniqueness instead of taking the first hit, which is
31
+ * what every library that "just works" does and is exactly how
32
+ * a July task lands in June.
33
+ * 3. **Nothing commits without an echo.** `DatePicker` renders the
34
+ * resolved date in full underneath the input, in a live region,
35
+ * before and after commit. The one genuinely irreducible
36
+ * ambiguity in date entry — `3/4` — is resolved by the locale's
37
+ * own field order and then *shown*, so a wrong reading is
38
+ * visible rather than discovered in three weeks.
39
+ *
40
+ * ### The one place a reading is swapped, and why it is not a guess
41
+ *
42
+ * `19/8` in an en-US locale has no valid month-first reading — there
43
+ * is no nineteenth month. Rather than rejecting it, the swapped
44
+ * reading is taken, because it is the **only** valid one. When both
45
+ * readings are valid (`3/4`) the locale's order wins and nothing is
46
+ * swapped. So the rule is: *swap only when exactly one arrangement
47
+ * is a real date*, which is deduction rather than preference.
48
+ *
49
+ * ### Everything locale-dependent is read from `Intl`
50
+ *
51
+ * Field order, month names, weekday names. There is no English word
52
+ * list in this file except the relative keywords (`today`,
53
+ * `tomorrow`, `next week`), which are the one thing `Intl` does not
54
+ * publish. Those are the documented, explicitly-English part of the
55
+ * surface, and a consumer that needs others supplies `keywords`.
56
+ */
57
+ import { addDays, addMonths, getDaysInMonth, getIsValidPlainDate, getMonthNames, getWeekday, getWeekdayNames, parseIsoDate, } from "./plainDate.js";
58
+ /**
59
+ * English, and stated rather than assumed.
60
+ *
61
+ * `Intl` publishes month and weekday names for every locale a
62
+ * browser knows, so those are never written down. It publishes
63
+ * nothing for "tomorrow" — `Intl.RelativeTimeFormat` *renders* one
64
+ * but cannot parse one — so this table is the honest boundary of
65
+ * what the component understands out of the box, and it is a prop so
66
+ * a consumer is not stuck with it.
67
+ */
68
+ export const DEFAULT_DATE_INPUT_KEYWORDS = {
69
+ last: ["last", "previous", "prev"],
70
+ next: ["next"],
71
+ today: ["today", "tod", "tdy", "now"],
72
+ tomorrow: ["tomorrow", "tmrw", "tmr", "tom"],
73
+ units: {
74
+ day: ["days", "day", "d"],
75
+ month: ["months", "month", "mo", "m"],
76
+ week: ["weeks", "week", "w"],
77
+ year: ["years", "year", "y"],
78
+ },
79
+ yesterday: ["yesterday", "yest", "yda"],
80
+ };
81
+ /**
82
+ * Lowercase, unaccented, comma-free, single-spaced.
83
+ *
84
+ * The diacritic strip is what lets a French user type `fevrier` on a
85
+ * keyboard that is not theirs and still land in February — and it is
86
+ * applied to the `Intl` names too, so the comparison is symmetric.
87
+ */
88
+ const normalize = (text) => text
89
+ .normalize("NFD")
90
+ .replace(/[̀-ͯ]/g, "")
91
+ .toLowerCase()
92
+ .replace(/[,.]/g, " ")
93
+ .replace(/\s+/g, " ")
94
+ .trim();
95
+ /**
96
+ * The index of the one name this prefix can mean, or the list of
97
+ * names it could mean.
98
+ *
99
+ * Returning the candidates rather than `null` is what makes the
100
+ * error message useful, and the message is the entire reason
101
+ * ambiguity is handled here rather than by taking the first match.
102
+ */
103
+ const matchUniquePrefix = (names, text) => {
104
+ const exact = names.findIndex((name) => normalize(name) === text);
105
+ if (exact >= 0) {
106
+ return { index: exact };
107
+ }
108
+ const matches = names.flatMap((name, index) => normalize(name).startsWith(text)
109
+ ? [{ index, name }]
110
+ : []);
111
+ if (matches.length === 1 && matches[0]) {
112
+ return { index: matches[0].index };
113
+ }
114
+ return { candidates: matches.map((one) => one.name) };
115
+ };
116
+ /**
117
+ * Long names first, short names as the fallback, and the **long**
118
+ * list wins the error message.
119
+ *
120
+ * "s" is ambiguous in both lists, and reporting it as "Sun or Sat"
121
+ * tells a user to type more of a name they were not typing. The
122
+ * ambiguity is between Sunday and Saturday; that is what the message
123
+ * has to say.
124
+ */
125
+ const matchAcross = (longNames, shortNames, text) => {
126
+ const long = matchUniquePrefix(longNames, text);
127
+ if ("index" in long) {
128
+ return long;
129
+ }
130
+ const short = matchUniquePrefix(shortNames, text);
131
+ if ("index" in short) {
132
+ return short;
133
+ }
134
+ return long.candidates.length > 0 ? long : short;
135
+ };
136
+ /**
137
+ * Whether this locale writes the day or the month first, read from
138
+ * the platform instead of from a country list.
139
+ *
140
+ * `formatToParts` is the only way to ask. The alternative — a table
141
+ * of which countries are month-first — is a table that is wrong for
142
+ * somebody, and it would not follow a user who has set their
143
+ * browser to `en-GB` on a US machine, which is the case that matters
144
+ * because it is the one where the two disagree.
145
+ */
146
+ const getNumericFieldOrder = (locale) => new Intl.DateTimeFormat(locale, {
147
+ day: "numeric",
148
+ month: "numeric",
149
+ timeZone: "UTC",
150
+ year: "numeric",
151
+ })
152
+ .formatToParts(new Date(0))
153
+ .flatMap((part) => part.type === "day" ||
154
+ part.type === "month" ||
155
+ part.type === "year"
156
+ ? [part.type]
157
+ : []);
158
+ /**
159
+ * The two-digit-year window, and it is borrowed rather than
160
+ * invented: 00-68 is the twenty-first century and 69-99 the
161
+ * twentieth, which is POSIX `strptime`'s `%y` and the same window
162
+ * Java, Python and `strftime` all use. A component that picked its
163
+ * own boundary would disagree with the rest of the machine.
164
+ */
165
+ const resolveYear = (year) => {
166
+ if (year >= 100) {
167
+ return year;
168
+ }
169
+ return year <= 68 ? 2000 + year : 1900 + year;
170
+ };
171
+ const toResult = (date) => getIsValidPlainDate(date)
172
+ ? { date, kind: "date" }
173
+ : {
174
+ kind: "unparsed",
175
+ reason: `There is no ${date.day}/${date.month} in ${date.year}.`,
176
+ };
177
+ const UNPARSED = {
178
+ kind: "unparsed",
179
+ reason: "Not a date. Try 2026-08-19, 8/19, 19 aug, tomorrow, next fri, or +14d.",
180
+ };
181
+ const matchesKeyword = (words, text) => words.includes(text);
182
+ const getUnitDays = (keywords, unit) => {
183
+ if (matchesKeyword(keywords.units.day, unit)) {
184
+ return 1;
185
+ }
186
+ if (matchesKeyword(keywords.units.week, unit)) {
187
+ return 7;
188
+ }
189
+ if (matchesKeyword(keywords.units.month, unit)) {
190
+ return "month";
191
+ }
192
+ if (matchesKeyword(keywords.units.year, unit)) {
193
+ return "year";
194
+ }
195
+ return null;
196
+ };
197
+ const shiftBy = (today, amount, unit) => {
198
+ if (unit === "month") {
199
+ return addMonths(today, amount);
200
+ }
201
+ if (unit === "year") {
202
+ return addMonths(today, amount * 12);
203
+ }
204
+ return addDays(today, amount * unit);
205
+ };
206
+ /**
207
+ * `next fri` is the Friday **after** today, never today itself.
208
+ *
209
+ * The alternative — "the next Friday, or today if today is Friday" —
210
+ * makes "next friday" a no-op on Fridays, which is the one day
211
+ * somebody is most likely to type it. A bare `fri` means the same
212
+ * thing as `next fri`; `last fri` is the mirror.
213
+ */
214
+ const resolveWeekday = (today, weekdayIndex, direction) => {
215
+ const current = getWeekday(today);
216
+ const forward = ((weekdayIndex - current + 6) % 7) + 1;
217
+ return addDays(today, direction === 1
218
+ ? forward
219
+ : -(((current - weekdayIndex + 6) % 7) + 1));
220
+ };
221
+ export const parseDateInput = (rawText, { keywords = DEFAULT_DATE_INPUT_KEYWORDS, locale, today, }) => {
222
+ const text = normalize(rawText);
223
+ if (text === "") {
224
+ return { kind: "empty" };
225
+ }
226
+ // 1. ISO first, and before the numeric rule below, because
227
+ // `2026-08-19` also matches a `d-m-y` shape and would be read as
228
+ // the 2026th of August.
229
+ const isoDate = parseIsoDate(rawText.trim());
230
+ if (isoDate) {
231
+ return { date: isoDate, kind: "date" };
232
+ }
233
+ // 2. The relative keywords.
234
+ if (matchesKeyword(keywords.today, text)) {
235
+ return { date: today, kind: "date" };
236
+ }
237
+ if (matchesKeyword(keywords.tomorrow, text)) {
238
+ return { date: addDays(today, 1), kind: "date" };
239
+ }
240
+ if (matchesKeyword(keywords.yesterday, text)) {
241
+ return { date: addDays(today, -1), kind: "date" };
242
+ }
243
+ const words = text.split(" ");
244
+ // 3. `next week` / `last month` / `next year`.
245
+ if (words.length === 2 && words[0] && words[1]) {
246
+ const direction = matchesKeyword(keywords.next, words[0])
247
+ ? 1
248
+ : matchesKeyword(keywords.last, words[0])
249
+ ? -1
250
+ : 0;
251
+ if (direction !== 0) {
252
+ const unit = getUnitDays(keywords, words[1]);
253
+ if (unit !== null) {
254
+ return toResult(shiftBy(today, direction, unit));
255
+ }
256
+ }
257
+ }
258
+ // 4. Signed offsets — `+14d`, `-2w`, `+3` (days, the default unit).
259
+ // Docket counts staleness in days, so this is the form the owner
260
+ // types most and the reason a bare `+14` is allowed at all.
261
+ const signed = /^([+-])\s?(\d{1,4})\s?([a-z]*)$/.exec(text);
262
+ if (signed?.[1] && signed[2] !== undefined) {
263
+ const unit = signed[3] === ""
264
+ ? 1
265
+ : getUnitDays(keywords, signed[3] ?? "");
266
+ if (unit !== null) {
267
+ return toResult(shiftBy(today, Number(signed[2]) * (signed[1] === "-" ? -1 : 1), unit));
268
+ }
269
+ }
270
+ // 5. `in 3 days`, `in 2 weeks`.
271
+ const relative = /^in (\d{1,4}) ([a-z]+)$/.exec(text);
272
+ if (relative?.[1] && relative[2]) {
273
+ const unit = getUnitDays(keywords, relative[2]);
274
+ if (unit !== null) {
275
+ return toResult(shiftBy(today, Number(relative[1]), unit));
276
+ }
277
+ }
278
+ const longWeekdays = getWeekdayNames({
279
+ firstDayOfWeek: 0,
280
+ locale,
281
+ weekday: "long",
282
+ });
283
+ const shortWeekdays = getWeekdayNames({
284
+ firstDayOfWeek: 0,
285
+ locale,
286
+ weekday: "short",
287
+ });
288
+ // 6. `fri`, `next fri`, `last friday`.
289
+ if (words.length <= 2) {
290
+ const directionWord = words.length === 2 ? words[0] : undefined;
291
+ const nameWord = words.length === 2 ? words[1] : words[0];
292
+ const direction = directionWord === undefined
293
+ ? 1
294
+ : matchesKeyword(keywords.next, directionWord)
295
+ ? 1
296
+ : matchesKeyword(keywords.last, directionWord)
297
+ ? -1
298
+ : 0;
299
+ if (direction !== 0 &&
300
+ nameWord &&
301
+ /^[a-z]+$/.test(nameWord)) {
302
+ const matched = matchAcross(longWeekdays, shortWeekdays, nameWord);
303
+ if ("index" in matched) {
304
+ return {
305
+ date: resolveWeekday(today, matched.index, direction === 1 ? 1 : -1),
306
+ kind: "date",
307
+ };
308
+ }
309
+ if (matched.candidates.length > 1) {
310
+ return {
311
+ kind: "unparsed",
312
+ reason: `"${nameWord}" could be ${matched.candidates.join(" or ")} — type more of it.`,
313
+ };
314
+ }
315
+ }
316
+ }
317
+ const longMonths = getMonthNames({
318
+ locale,
319
+ month: "long",
320
+ });
321
+ const shortMonths = getMonthNames({
322
+ locale,
323
+ month: "short",
324
+ });
325
+ // 7. `aug 19`, `19 aug`, `august 19 2026`, `19 august 2026`.
326
+ const monthFirst = /^([a-z]+) (\d{1,2})(?: (\d{2,4}))?$/.exec(text);
327
+ const dayFirst = /^(\d{1,2}) ([a-z]+)(?: (\d{2,4}))?$/.exec(text);
328
+ const named = monthFirst
329
+ ? {
330
+ day: monthFirst[2],
331
+ name: monthFirst[1],
332
+ year: monthFirst[3],
333
+ }
334
+ : dayFirst
335
+ ? {
336
+ day: dayFirst[1],
337
+ name: dayFirst[2],
338
+ year: dayFirst[3],
339
+ }
340
+ : null;
341
+ if (named?.name && named.day) {
342
+ const matched = matchAcross(longMonths, shortMonths, named.name);
343
+ if ("index" in matched) {
344
+ return toResult({
345
+ day: Number(named.day),
346
+ month: matched.index + 1,
347
+ // A yearless input is **this** year, always. "The nearest
348
+ // occurrence" is the tempting alternative and it is rejected
349
+ // on purpose: it means the same keystrokes mean different
350
+ // years depending on the day you type them, which is not a
351
+ // rule anybody can hold in their head. The echo line shows
352
+ // the resolved year, so a December-for-January entry is
353
+ // visible rather than discovered later.
354
+ year: named.year === undefined
355
+ ? today.year
356
+ : resolveYear(Number(named.year)),
357
+ });
358
+ }
359
+ if (matched.candidates.length > 1) {
360
+ return {
361
+ kind: "unparsed",
362
+ reason: `"${named.name}" could be ${matched.candidates.join(" or ")} — type more of it.`,
363
+ };
364
+ }
365
+ return UNPARSED;
366
+ }
367
+ // 8. Numeric — `8/19`, `8/19/2026`, `19-8`, `2026/8/19`.
368
+ const numeric = /^(\d{1,4})[/\-. ](\d{1,2})(?:[/\-. ](\d{2,4}))?$/.exec(text);
369
+ if (numeric?.[1] && numeric[2]) {
370
+ const first = Number(numeric[1]);
371
+ const second = Number(numeric[2]);
372
+ const third = numeric[3] === undefined
373
+ ? undefined
374
+ : Number(numeric[3]);
375
+ // A four-digit leading field is a year, in any locale. Nobody
376
+ // means the 2026th of anything.
377
+ if (numeric[1].length === 4 && third !== undefined) {
378
+ return toResult({
379
+ day: third,
380
+ month: second,
381
+ year: first,
382
+ });
383
+ }
384
+ const order = getNumericFieldOrder(locale);
385
+ const isDayFirst = order.indexOf("day") < order.indexOf("month");
386
+ const year = third === undefined ? today.year : resolveYear(third);
387
+ const preferred = isDayFirst
388
+ ? { day: first, month: second, year }
389
+ : { day: second, month: first, year };
390
+ if (getIsValidPlainDate(preferred)) {
391
+ return { date: preferred, kind: "date" };
392
+ }
393
+ // The only-valid-reading swap. Not a preference — the preferred
394
+ // arrangement is not a date, and this one is.
395
+ const swapped = isDayFirst
396
+ ? { day: second, month: first, year }
397
+ : { day: first, month: second, year };
398
+ if (getIsValidPlainDate(swapped)) {
399
+ return { date: swapped, kind: "date" };
400
+ }
401
+ return toResult(preferred);
402
+ }
403
+ // 9. A bare day-of-month, for capture on a phone: `19` is the 19th
404
+ // of the month showing. Two digits at most, so `2026` is never
405
+ // silently a day.
406
+ const bareDay = /^(\d{1,2})$/.exec(text);
407
+ if (bareDay?.[1]) {
408
+ const day = Number(bareDay[1]);
409
+ if (day >= 1 &&
410
+ day <= getDaysInMonth(today.year, today.month)) {
411
+ return {
412
+ date: { day, month: today.month, year: today.year },
413
+ kind: "date",
414
+ };
415
+ }
416
+ }
417
+ return UNPARSED;
418
+ };
419
+ //# sourceMappingURL=parseDateInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseDateInput.js","sourceRoot":"","sources":["../../src/DatePicker/parseDateInput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAGH,OAAO,EACL,OAAO,EACP,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,eAAe,EACf,YAAY,GACb,MAAM,gBAAgB,CAAA;AAwBvB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACtC;IACE,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC;IAClC,IAAI,EAAE,CAAC,MAAM,CAAC;IACd,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;IACrC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC;IAC5C,KAAK,EAAE;QACL,GAAG,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC;QACzB,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC;QACrC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC;QAC5B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC;KAC7B;IACD,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC;CACxC,CAAA;AAcH;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CACjC,IAAI;KACD,SAAS,CAAC,KAAK,CAAC;KAChB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;KACrB,WAAW,EA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