frontile 0.18.0 → 0.18.2

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 (155) hide show
  1. package/declarations/-private/get-config.d.ts.map +1 -1
  2. package/declarations/-private/timer.d.ts +3 -3
  3. package/declarations/-private/timer.d.ts.map +1 -1
  4. package/declarations/components/buttons/chip.d.ts +1 -1
  5. package/declarations/components/buttons/chip.d.ts.map +1 -1
  6. package/declarations/components/buttons/close-button.d.ts +2 -2
  7. package/declarations/components/buttons/close-button.d.ts.map +1 -1
  8. package/declarations/components/collections/listbox/item.d.ts +2 -2
  9. package/declarations/components/collections/listbox/item.d.ts.map +1 -1
  10. package/declarations/components/collections/simple-table/column.d.ts +6 -0
  11. package/declarations/components/collections/simple-table/column.d.ts.map +1 -1
  12. package/declarations/components/collections/simple-table/footer.d.ts +2 -1
  13. package/declarations/components/collections/simple-table/footer.d.ts.map +1 -1
  14. package/declarations/components/collections/simple-table/header.d.ts +2 -1
  15. package/declarations/components/collections/simple-table/header.d.ts.map +1 -1
  16. package/declarations/components/collections/simple-table/index.d.ts +1 -1
  17. package/declarations/components/collections/simple-table/index.d.ts.map +1 -1
  18. package/declarations/components/collections/table/checkbox.d.ts +1 -1
  19. package/declarations/components/collections/table/checkbox.d.ts.map +1 -1
  20. package/declarations/components/collections/table/column-visibility.d.ts +2 -2
  21. package/declarations/components/collections/table/column-visibility.d.ts.map +1 -1
  22. package/declarations/components/collections/table/table.d.ts +9 -7
  23. package/declarations/components/collections/table/table.d.ts.map +1 -1
  24. package/declarations/components/forms/autocomplete.d.ts +12 -12
  25. package/declarations/components/forms/checkbox.d.ts +2 -2
  26. package/declarations/components/forms/checkbox.d.ts.map +1 -1
  27. package/declarations/components/forms/date-input/clipboard.d.ts +34 -0
  28. package/declarations/components/forms/date-input/clipboard.d.ts.map +1 -0
  29. package/declarations/components/forms/date-input/date-input.d.ts +93 -0
  30. package/declarations/components/forms/date-input/date-input.d.ts.map +1 -0
  31. package/declarations/components/forms/date-input/segment-group.d.ts +132 -0
  32. package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -0
  33. package/declarations/components/forms/date-input/segments.d.ts +163 -0
  34. package/declarations/components/forms/date-input/segments.d.ts.map +1 -0
  35. package/declarations/components/forms/date-input/types.d.ts +175 -0
  36. package/declarations/components/forms/date-input/types.d.ts.map +1 -0
  37. package/declarations/components/forms/date-input.d.ts +6 -0
  38. package/declarations/components/forms/date-input.d.ts.map +1 -0
  39. package/declarations/components/forms/date-picker/date-picker.d.ts +263 -15
  40. package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -1
  41. package/declarations/components/forms/date-picker/end-content.d.ts +33 -3
  42. package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -1
  43. package/declarations/components/forms/date-picker/types.d.ts +45 -2
  44. package/declarations/components/forms/date-picker/types.d.ts.map +1 -1
  45. package/declarations/components/forms/date-picker/value.d.ts +21 -5
  46. package/declarations/components/forms/date-picker/value.d.ts.map +1 -1
  47. package/declarations/components/forms/field.d.ts +7 -5
  48. package/declarations/components/forms/field.d.ts.map +1 -1
  49. package/declarations/components/forms/form.d.ts +5 -5
  50. package/declarations/components/forms/form.d.ts.map +1 -1
  51. package/declarations/components/forms/index.d.ts +1 -0
  52. package/declarations/components/forms/index.d.ts.map +1 -1
  53. package/declarations/components/forms/input-otp.d.ts +5 -5
  54. package/declarations/components/forms/input-otp.d.ts.map +1 -1
  55. package/declarations/components/forms/input.d.ts +15 -15
  56. package/declarations/components/forms/input.d.ts.map +1 -1
  57. package/declarations/components/forms/native-select.d.ts +10 -10
  58. package/declarations/components/forms/native-select.d.ts.map +1 -1
  59. package/declarations/components/forms/radio.d.ts +2 -2
  60. package/declarations/components/forms/radio.d.ts.map +1 -1
  61. package/declarations/components/forms/select/select.d.ts +16 -16
  62. package/declarations/components/forms/textarea.d.ts +10 -10
  63. package/declarations/components/forms/textarea.d.ts.map +1 -1
  64. package/declarations/components/navigation/pagination/pagination.d.ts +32 -1
  65. package/declarations/components/navigation/pagination/pagination.d.ts.map +1 -1
  66. package/declarations/components/overlays/overlay.d.ts +4 -4
  67. package/declarations/components/overlays/overlay.d.ts.map +1 -1
  68. package/declarations/components/utilities/avatar.d.ts +35 -2
  69. package/declarations/components/utilities/avatar.d.ts.map +1 -1
  70. package/declarations/components/utilities/collapsible.d.ts +16 -0
  71. package/declarations/components/utilities/collapsible.d.ts.map +1 -1
  72. package/declarations/test-support.d.ts +30 -0
  73. package/declarations/test-support.d.ts.map +1 -1
  74. package/declarations/utils/forms-utils-index.d.ts +1 -1
  75. package/declarations/utils/forms-utils-index.d.ts.map +1 -1
  76. package/declarations/utils/nested-data.d.ts +17 -0
  77. package/declarations/utils/nested-data.d.ts.map +1 -1
  78. package/dist/components/buttons/chip.js.map +1 -1
  79. package/dist/components/buttons/close-button.js +5 -12
  80. package/dist/components/buttons/close-button.js.map +1 -1
  81. package/dist/components/collections/listbox/item.js +4 -11
  82. package/dist/components/collections/listbox/item.js.map +1 -1
  83. package/dist/components/collections/simple-table/column.js +2 -2
  84. package/dist/components/collections/simple-table/column.js.map +1 -1
  85. package/dist/components/collections/simple-table/footer.js +1 -1
  86. package/dist/components/collections/simple-table/footer.js.map +1 -1
  87. package/dist/components/collections/simple-table/header.js +1 -1
  88. package/dist/components/collections/simple-table/header.js.map +1 -1
  89. package/dist/components/collections/simple-table/index.js +1 -1
  90. package/dist/components/collections/simple-table/index.js.map +1 -1
  91. package/dist/components/collections/table/checkbox.js +2 -7
  92. package/dist/components/collections/table/checkbox.js.map +1 -1
  93. package/dist/components/collections/table/column-visibility.js +2 -7
  94. package/dist/components/collections/table/column-visibility.js.map +1 -1
  95. package/dist/components/forms/checkbox.js +4 -12
  96. package/dist/components/forms/checkbox.js.map +1 -1
  97. package/dist/components/forms/date-input/clipboard.js +231 -0
  98. package/dist/components/forms/date-input/clipboard.js.map +1 -0
  99. package/dist/components/forms/date-input/date-input.js +204 -0
  100. package/dist/components/forms/date-input/date-input.js.map +1 -0
  101. package/dist/components/forms/date-input/segment-group.js +292 -0
  102. package/dist/components/forms/date-input/segment-group.js.map +1 -0
  103. package/dist/components/forms/date-input/segments.js +562 -0
  104. package/dist/components/forms/date-input/segments.js.map +1 -0
  105. package/dist/components/forms/date-input/types.js +2 -0
  106. package/dist/components/forms/date-input/types.js.map +1 -0
  107. package/dist/components/forms/date-input.js +4 -0
  108. package/dist/components/forms/date-input.js.map +1 -0
  109. package/dist/components/forms/date-picker/date-picker.js +361 -20
  110. package/dist/components/forms/date-picker/date-picker.js.map +1 -1
  111. package/dist/components/forms/date-picker/end-content.js +17 -4
  112. package/dist/components/forms/date-picker/end-content.js.map +1 -1
  113. package/dist/components/forms/date-picker/value.js +44 -6
  114. package/dist/components/forms/date-picker/value.js.map +1 -1
  115. package/dist/components/forms/field.js +12 -20
  116. package/dist/components/forms/field.js.map +1 -1
  117. package/dist/components/forms/form.js +11 -27
  118. package/dist/components/forms/form.js.map +1 -1
  119. package/dist/components/forms/index.js +5 -2
  120. package/dist/components/forms/index.js.map +1 -1
  121. package/dist/components/forms/input-otp.js +10 -26
  122. package/dist/components/forms/input-otp.js.map +1 -1
  123. package/dist/components/forms/input.js +9 -22
  124. package/dist/components/forms/input.js.map +1 -1
  125. package/dist/components/forms/native-select.js +5 -12
  126. package/dist/components/forms/native-select.js.map +1 -1
  127. package/dist/components/forms/radio.js +4 -12
  128. package/dist/components/forms/radio.js.map +1 -1
  129. package/dist/components/forms/textarea.js +6 -17
  130. package/dist/components/forms/textarea.js.map +1 -1
  131. package/dist/components/navigation/pagination/pagination.js +18 -2
  132. package/dist/components/navigation/pagination/pagination.js.map +1 -1
  133. package/dist/components/notifications/index.js +1 -1
  134. package/dist/components/overlays/overlay.js +8 -21
  135. package/dist/components/overlays/overlay.js.map +1 -1
  136. package/dist/components/utilities/avatar.js +26 -5
  137. package/dist/components/utilities/avatar.js.map +1 -1
  138. package/dist/components/utilities/collapsible.js +47 -3
  139. package/dist/components/utilities/collapsible.js.map +1 -1
  140. package/dist/forms.js +5 -2
  141. package/dist/forms.js.map +1 -1
  142. package/dist/index.js +6 -3
  143. package/dist/index.js.map +1 -1
  144. package/dist/{manager-jDaRVZ5o.js → manager-Dge4r8Vn.js} +9 -19
  145. package/dist/manager-Dge4r8Vn.js.map +1 -0
  146. package/dist/notifications.js +1 -1
  147. package/dist/services/notifications.js +1 -1
  148. package/dist/test-support.js +903 -389
  149. package/dist/test-support.js.map +1 -1
  150. package/dist/utils/forms-utils-index.js +1 -1
  151. package/dist/utils/forms-utils-index.js.map +1 -1
  152. package/dist/utils/nested-data.js +28 -1
  153. package/dist/utils/nested-data.js.map +1 -1
  154. package/package.json +10 -10
  155. package/dist/manager-jDaRVZ5o.js.map +0 -1
@@ -0,0 +1,231 @@
1
+ import { isSegment, displaySegment, resolveTwoDigitYear, withValue, findSegment, hourOnCycle } from './segments.js';
2
+
3
+ const ISO_DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
4
+ const ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/;
5
+
6
+ /** The digits destined for each segment, keyed by type. */
7
+
8
+ /**
9
+ * Writes digit strings onto the segments they name.
10
+ *
11
+ * Digits stay *strings* all the way in, because a year's leading zeros carry
12
+ * meaning: `0045` is the year 45, while `45` runs through the sliding window.
13
+ * Passing numbers here would erase that distinction and make a pasted `0045`
14
+ * resolve differently from a typed one.
15
+ *
16
+ * A segment no key names is left untouched, which is what lets a partial paste
17
+ * fill what it can. Out of bounds refuses the *whole* paste rather than
18
+ * clamping: clamping would turn a paste of `99/99/2026` into a plausible
19
+ * looking date the user never meant. The day is the exception by design -- its
20
+ * bound is 31 and the real length of the month is applied later, by `toDate`,
21
+ * so a pasted 31st of February shortens to the 28th exactly as a typed one
22
+ * does.
23
+ */
24
+ function fill(parts, digits) {
25
+ let filled = 0;
26
+ const next = [];
27
+ for (const part of parts) {
28
+ if (!isSegment(part)) {
29
+ next.push(part);
30
+ continue;
31
+ }
32
+ const raw = digits[part.type];
33
+ if (raw === undefined) {
34
+ next.push(part);
35
+ continue;
36
+ }
37
+ const value = part.type === 'year' ? resolveTwoDigitYear(raw) : Number(raw);
38
+ if (Number.isNaN(value) || value < part.min || value > part.max) {
39
+ return null;
40
+ }
41
+ filled++;
42
+ // A paste is a finished answer for every segment it fills.
43
+ next.push(withValue(part, value));
44
+ }
45
+
46
+ // Nothing landed anywhere -- treat that as a refusal rather than quietly
47
+ // handing back an untouched field.
48
+ return filled === 0 ? null : next;
49
+ }
50
+
51
+ /**
52
+ * The time segments' digits for a 0-23 hour and a minute, as this field's
53
+ * hour cycle counts them. Segments the field does not have get nothing.
54
+ */
55
+ function clockDigits(parts, hours, minutes) {
56
+ const hour = findSegment(parts, 'hour');
57
+ if (!hour) return {};
58
+ return {
59
+ hour: String(hourOnCycle(hours, hour.hourCycle ?? 'h23')),
60
+ minute: String(minutes),
61
+ dayPeriod: hours < 12 ? '0' : '1'
62
+ };
63
+ }
64
+
65
+ /**
66
+ * Which of a textual segment's labels the text names -- AM or PM -- as its
67
+ * value, or `undefined`. Besides the locale's own labels, a Latin `am`/`pm`
68
+ * (dotted or not) is understood, which is how most pasted times spell it.
69
+ */
70
+ function dayPeriodIn(text, segment) {
71
+ const lower = text.toLocaleLowerCase();
72
+ const index = (segment.labels ?? []).findIndex(label => label !== '' && lower.includes(label.toLocaleLowerCase()));
73
+ if (index !== -1) return String(index);
74
+ const latin = /(?:^|[^a-z])([ap])\.?\s*m\.?(?![a-z])/i.exec(text);
75
+ if (latin) return latin[1]?.toLowerCase() === 'a' ? '0' : '1';
76
+ return undefined;
77
+ }
78
+
79
+ /**
80
+ * Settles AM/PM for a positional paste. The text's own AM/PM wins; failing
81
+ * that, an hour past the 12-hour clock's end is read as a 24-hour one, so
82
+ * `21:30` pasted into an en-US field lands as 9:30 PM rather than refused.
83
+ */
84
+ function withDayPeriod(text, parts, digits) {
85
+ const dayPeriod = findSegment(parts, 'dayPeriod');
86
+ const hour = findSegment(parts, 'hour');
87
+ if (!dayPeriod) return digits;
88
+ const named = dayPeriodIn(text, dayPeriod);
89
+ if (named !== undefined) return {
90
+ ...digits,
91
+ dayPeriod: named
92
+ };
93
+ const typed = digits.hour === undefined ? NaN : Number(digits.hour);
94
+ if (hour && typed > hour.max && typed <= 23) {
95
+ return {
96
+ ...digits,
97
+ hour: String(hourOnCycle(typed, hour.hourCycle ?? 'h12')),
98
+ dayPeriod: '1'
99
+ };
100
+ }
101
+ return digits;
102
+ }
103
+
104
+ /** Maps digit groups onto the segments in their rendered order. */
105
+ function byPosition(segments, groups) {
106
+ if (groups.length === 0 || groups.length > segments.length) return null;
107
+ const digits = {};
108
+ groups.forEach((group, i) => {
109
+ const segment = segments[i];
110
+ if (segment) digits[segment.type] = group;
111
+ });
112
+ return digits;
113
+ }
114
+
115
+ /**
116
+ * Reads pasted text into the segments, trying each strategy in turn and
117
+ * stopping at the first that works.
118
+ *
119
+ * Every strategy lands in `fill`, so all three share one bounds policy. There
120
+ * is deliberately no `new Date(text)` fallback: it parses differently in every
121
+ * engine, and a date field that silently guesses wrong is worse than one that
122
+ * declines.
123
+ */
124
+ function parsePasted(text, parts) {
125
+ const trimmed = text.trim();
126
+ if (trimmed === '') return null;
127
+
128
+ // 1. ISO, which is unambiguous and so outranks the locale's own order. A
129
+ // day alone fills the date and leaves any time as it was.
130
+ const isoTime = ISO_DATE_TIME.exec(trimmed);
131
+ if (isoTime) {
132
+ const [, year, month, day, hours, minutes] = isoTime;
133
+ if (Number(hours) > 23 || Number(minutes) > 59) return null;
134
+ return fill(parts, {
135
+ year,
136
+ month,
137
+ day,
138
+ ...clockDigits(parts, Number(hours), Number(minutes))
139
+ });
140
+ }
141
+ const iso = ISO_DAY.exec(trimmed);
142
+ if (iso) {
143
+ const [, year, month, day] = iso;
144
+ return fill(parts, {
145
+ year,
146
+ month,
147
+ day
148
+ });
149
+ }
150
+
151
+ // Positional reading maps digits, so only the numeric segments take part;
152
+ // AM/PM is read from the text's words afterwards.
153
+ const segments = parts.filter(isSegment).filter(s => !s.labels);
154
+
155
+ // 2. A bare digit run, split by each segment's width. Checked before the
156
+ // separated form, because an unseparated run also splits into a single
157
+ // "group" and would otherwise be read as one enormous month.
158
+ if (/^\d+$/.test(trimmed)) {
159
+ const widths = [];
160
+ let at = 0;
161
+ for (const segment of segments) {
162
+ if (at >= trimmed.length) break;
163
+ widths.push(trimmed.slice(at, at + segment.width));
164
+ at += segment.width;
165
+ }
166
+
167
+ // It has to end on a segment boundary, otherwise there is no telling
168
+ // where the last number was meant to stop.
169
+ if (at !== trimmed.length) return null;
170
+ const digits = byPosition(segments, widths);
171
+ return digits ? fill(parts, withDayPeriod(trimmed, parts, digits)) : null;
172
+ }
173
+
174
+ // 3. Separated numbers, mapped positionally onto the locale's order. Fewer
175
+ // groups than segments is a partial date and fills a prefix of them.
176
+ const groups = trimmed.split(/\D+/).filter(Boolean);
177
+ const digits = byPosition(segments, groups);
178
+ if (digits) return fill(parts, withDayPeriod(trimmed, parts, digits));
179
+ return null;
180
+ }
181
+
182
+ /**
183
+ * The field as it reads on screen, literals included. Copying the display
184
+ * rather than an ISO string means the text round-trips through `parsePasted`
185
+ * and still reads naturally when pasted into a document.
186
+ *
187
+ * Delegates each segment to `displaySegment`, the same function the group
188
+ * renders from, so a mid-entry year (buffer `26`, uncommitted) copies as
189
+ * `26` rather than being padded to `0026` -- padding would claim digits the
190
+ * user never typed and would contradict what is on screen.
191
+ */
192
+ function formatForClipboard(parts) {
193
+ return parts.map(part => isSegment(part) ? displaySegment(part) : part.text).join('');
194
+ }
195
+
196
+ /**
197
+ * What separates the two halves of a pasted range.
198
+ *
199
+ * An en or em dash needs no surrounding space, because neither ever appears
200
+ * inside a date. A plain hyphen does: it is the ISO separator, so splitting on
201
+ * an unspaced one would tear `2026-01-20` into pieces. The same reasoning
202
+ * applies to the words -- `\s+` on both sides keeps "to" from matching inside
203
+ * "total".
204
+ */
205
+ const RANGE_SEPARATOR = /\s*[\u2013\u2014]\s*|\s+(?:-|to|until|through)\s+/i;
206
+
207
+ /**
208
+ * Splits pasted text into the two dates of a range, or returns `null` when it
209
+ * does not read as two.
210
+ *
211
+ * Only the shape is decided here; neither half is parsed. The caller runs each
212
+ * through {@link parsePasted} and keeps the result only when both halves are
213
+ * dates -- so text that merely contains a dash falls through to the ordinary
214
+ * single-date handling rather than being consumed.
215
+ */
216
+ function splitRange(text) {
217
+ const trimmed = text.trim();
218
+ const match = RANGE_SEPARATOR.exec(trimmed);
219
+ if (!match) return null;
220
+ const start = trimmed.slice(0, match.index).trim();
221
+ const end = trimmed.slice(match.index + match[0].length).trim();
222
+ if (start === '' || end === '') return null;
223
+
224
+ // Three halves is not a range, and guessing which two were meant would be
225
+ // exactly the silent wrong guess this module declines to make elsewhere.
226
+ if (RANGE_SEPARATOR.test(end)) return null;
227
+ return [start, end];
228
+ }
229
+
230
+ export { formatForClipboard, parsePasted, splitRange };
231
+ //# sourceMappingURL=clipboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboard.js","sources":["../../../../src/components/forms/date-input/clipboard.ts"],"sourcesContent":["import {\n isSegment,\n resolveTwoDigitYear,\n displaySegment,\n withValue,\n findSegment,\n hourOnCycle\n} from './segments';\nimport type { Part, Segment, SegmentType } from './types';\n\nconst ISO_DAY = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst ISO_DATE_TIME =\n /^(\\d{4})-(\\d{2})-(\\d{2})[T ](\\d{2}):(\\d{2})(?::\\d{2}(?:\\.\\d+)?)?$/;\n\n/** The digits destined for each segment, keyed by type. */\ntype Digits = Partial<Record<SegmentType, string>>;\n\n/**\n * Writes digit strings onto the segments they name.\n *\n * Digits stay *strings* all the way in, because a year's leading zeros carry\n * meaning: `0045` is the year 45, while `45` runs through the sliding window.\n * Passing numbers here would erase that distinction and make a pasted `0045`\n * resolve differently from a typed one.\n *\n * A segment no key names is left untouched, which is what lets a partial paste\n * fill what it can. Out of bounds refuses the *whole* paste rather than\n * clamping: clamping would turn a paste of `99/99/2026` into a plausible\n * looking date the user never meant. The day is the exception by design -- its\n * bound is 31 and the real length of the month is applied later, by `toDate`,\n * so a pasted 31st of February shortens to the 28th exactly as a typed one\n * does.\n */\nfunction fill(parts: Part[], digits: Digits): Part[] | null {\n let filled = 0;\n\n const next: Part[] = [];\n for (const part of parts) {\n if (!isSegment(part)) {\n next.push(part);\n continue;\n }\n\n const raw = digits[part.type];\n if (raw === undefined) {\n next.push(part);\n continue;\n }\n\n const value = part.type === 'year' ? resolveTwoDigitYear(raw) : Number(raw);\n if (Number.isNaN(value) || value < part.min || value > part.max) {\n return null;\n }\n\n filled++;\n // A paste is a finished answer for every segment it fills.\n next.push(withValue(part, value));\n }\n\n // Nothing landed anywhere -- treat that as a refusal rather than quietly\n // handing back an untouched field.\n return filled === 0 ? null : next;\n}\n\n/**\n * The time segments' digits for a 0-23 hour and a minute, as this field's\n * hour cycle counts them. Segments the field does not have get nothing.\n */\nfunction clockDigits(parts: Part[], hours: number, minutes: number): Digits {\n const hour = findSegment(parts, 'hour');\n if (!hour) return {};\n\n return {\n hour: String(hourOnCycle(hours, hour.hourCycle ?? 'h23')),\n minute: String(minutes),\n dayPeriod: hours < 12 ? '0' : '1'\n };\n}\n\n/**\n * Which of a textual segment's labels the text names -- AM or PM -- as its\n * value, or `undefined`. Besides the locale's own labels, a Latin `am`/`pm`\n * (dotted or not) is understood, which is how most pasted times spell it.\n */\nfunction dayPeriodIn(text: string, segment: Segment): string | undefined {\n const lower = text.toLocaleLowerCase();\n const index = (segment.labels ?? []).findIndex(\n (label) => label !== '' && lower.includes(label.toLocaleLowerCase())\n );\n if (index !== -1) return String(index);\n\n const latin = /(?:^|[^a-z])([ap])\\.?\\s*m\\.?(?![a-z])/i.exec(text);\n if (latin) return latin[1]?.toLowerCase() === 'a' ? '0' : '1';\n\n return undefined;\n}\n\n/**\n * Settles AM/PM for a positional paste. The text's own AM/PM wins; failing\n * that, an hour past the 12-hour clock's end is read as a 24-hour one, so\n * `21:30` pasted into an en-US field lands as 9:30 PM rather than refused.\n */\nfunction withDayPeriod(text: string, parts: Part[], digits: Digits): Digits {\n const dayPeriod = findSegment(parts, 'dayPeriod');\n const hour = findSegment(parts, 'hour');\n if (!dayPeriod) return digits;\n\n const named = dayPeriodIn(text, dayPeriod);\n if (named !== undefined) return { ...digits, dayPeriod: named };\n\n const typed = digits.hour === undefined ? NaN : Number(digits.hour);\n if (hour && typed > hour.max && typed <= 23) {\n return {\n ...digits,\n hour: String(hourOnCycle(typed, hour.hourCycle ?? 'h12')),\n dayPeriod: '1'\n };\n }\n\n return digits;\n}\n\n/** Maps digit groups onto the segments in their rendered order. */\nfunction byPosition(segments: Segment[], groups: string[]): Digits | null {\n if (groups.length === 0 || groups.length > segments.length) return null;\n\n const digits: Digits = {};\n groups.forEach((group, i) => {\n const segment = segments[i];\n if (segment) digits[segment.type] = group;\n });\n return digits;\n}\n\n/**\n * Reads pasted text into the segments, trying each strategy in turn and\n * stopping at the first that works.\n *\n * Every strategy lands in `fill`, so all three share one bounds policy. There\n * is deliberately no `new Date(text)` fallback: it parses differently in every\n * engine, and a date field that silently guesses wrong is worse than one that\n * declines.\n */\nfunction parsePasted(text: string, parts: Part[]): Part[] | null {\n const trimmed = text.trim();\n if (trimmed === '') return null;\n\n // 1. ISO, which is unambiguous and so outranks the locale's own order. A\n // day alone fills the date and leaves any time as it was.\n const isoTime = ISO_DATE_TIME.exec(trimmed);\n if (isoTime) {\n const [, year, month, day, hours, minutes] = isoTime;\n if (Number(hours) > 23 || Number(minutes) > 59) return null;\n return fill(parts, {\n year,\n month,\n day,\n ...clockDigits(parts, Number(hours), Number(minutes))\n });\n }\n\n const iso = ISO_DAY.exec(trimmed);\n if (iso) {\n const [, year, month, day] = iso;\n return fill(parts, { year, month, day });\n }\n\n // Positional reading maps digits, so only the numeric segments take part;\n // AM/PM is read from the text's words afterwards.\n const segments = parts.filter(isSegment).filter((s) => !s.labels);\n\n // 2. A bare digit run, split by each segment's width. Checked before the\n // separated form, because an unseparated run also splits into a single\n // \"group\" and would otherwise be read as one enormous month.\n if (/^\\d+$/.test(trimmed)) {\n const widths: string[] = [];\n let at = 0;\n for (const segment of segments) {\n if (at >= trimmed.length) break;\n widths.push(trimmed.slice(at, at + segment.width));\n at += segment.width;\n }\n\n // It has to end on a segment boundary, otherwise there is no telling\n // where the last number was meant to stop.\n if (at !== trimmed.length) return null;\n\n const digits = byPosition(segments, widths);\n return digits ? fill(parts, withDayPeriod(trimmed, parts, digits)) : null;\n }\n\n // 3. Separated numbers, mapped positionally onto the locale's order. Fewer\n // groups than segments is a partial date and fills a prefix of them.\n const groups = trimmed.split(/\\D+/).filter(Boolean);\n const digits = byPosition(segments, groups);\n if (digits) return fill(parts, withDayPeriod(trimmed, parts, digits));\n\n return null;\n}\n\n/**\n * The field as it reads on screen, literals included. Copying the display\n * rather than an ISO string means the text round-trips through `parsePasted`\n * and still reads naturally when pasted into a document.\n *\n * Delegates each segment to `displaySegment`, the same function the group\n * renders from, so a mid-entry year (buffer `26`, uncommitted) copies as\n * `26` rather than being padded to `0026` -- padding would claim digits the\n * user never typed and would contradict what is on screen.\n */\nfunction formatForClipboard(parts: Part[]): string {\n return parts\n .map((part) => (isSegment(part) ? displaySegment(part) : part.text))\n .join('');\n}\n\n/**\n * What separates the two halves of a pasted range.\n *\n * An en or em dash needs no surrounding space, because neither ever appears\n * inside a date. A plain hyphen does: it is the ISO separator, so splitting on\n * an unspaced one would tear `2026-01-20` into pieces. The same reasoning\n * applies to the words -- `\\s+` on both sides keeps \"to\" from matching inside\n * \"total\".\n */\nconst RANGE_SEPARATOR = /\\s*[\\u2013\\u2014]\\s*|\\s+(?:-|to|until|through)\\s+/i;\n\n/**\n * Splits pasted text into the two dates of a range, or returns `null` when it\n * does not read as two.\n *\n * Only the shape is decided here; neither half is parsed. The caller runs each\n * through {@link parsePasted} and keeps the result only when both halves are\n * dates -- so text that merely contains a dash falls through to the ordinary\n * single-date handling rather than being consumed.\n */\nfunction splitRange(text: string): [string, string] | null {\n const trimmed = text.trim();\n const match = RANGE_SEPARATOR.exec(trimmed);\n if (!match) return null;\n\n const start = trimmed.slice(0, match.index).trim();\n const end = trimmed.slice(match.index + match[0].length).trim();\n if (start === '' || end === '') return null;\n\n // Three halves is not a range, and guessing which two were meant would be\n // exactly the silent wrong guess this module declines to make elsewhere.\n if (RANGE_SEPARATOR.test(end)) return null;\n\n return [start, end];\n}\n\nexport { parsePasted, formatForClipboard, splitRange };\n"],"names":["ISO_DAY","ISO_DATE_TIME","fill","parts","digits","filled","next","part","isSegment","push","raw","type","undefined","value","resolveTwoDigitYear","Number","isNaN","min","max","withValue","clockDigits","hours","minutes","hour","findSegment","String","hourOnCycle","hourCycle","minute","dayPeriod","dayPeriodIn","text","segment","lower","toLocaleLowerCase","index","labels","findIndex","label","includes","latin","exec","toLowerCase","withDayPeriod","named","typed","NaN","byPosition","segments","groups","length","forEach","group","i","parsePasted","trimmed","trim","isoTime","year","month","day","iso","filter","s","test","widths","at","slice","width","split","Boolean","formatForClipboard","map","displaySegment","join","RANGE_SEPARATOR","splitRange","match","start","end"],"mappings":";;AAUA,MAAMA,OAAO,GAAG,2BAA2B;AAC3C,MAAMC,aAAa,GACjB,mEAAmE;;AAErE;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAACC,KAAa,EAAEC,MAAc,EAAiB;EAC1D,IAAIC,MAAM,GAAG,CAAC;EAEd,MAAMC,IAAY,GAAG,EAAE;AACvB,EAAA,KAAK,MAAMC,IAAI,IAAIJ,KAAK,EAAE;AACxB,IAAA,IAAI,CAACK,SAAS,CAACD,IAAI,CAAC,EAAE;AACpBD,MAAAA,IAAI,CAACG,IAAI,CAACF,IAAI,CAAC;AACf,MAAA;AACF,IAAA;AAEA,IAAA,MAAMG,GAAG,GAAGN,MAAM,CAACG,IAAI,CAACI,IAAI,CAAC;IA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,KAAK,GAAG0C,KAAK,CAAC,CAAC,CAAC,CAAC3B,MAAM,CAAC,CAACM,IAAI,EAAE;EAC/D,IAAIsB,KAAK,KAAK,EAAE,IAAIC,GAAG,KAAK,EAAE,EAAE,OAAO,IAAI;;AAE3C;AACA;EACA,IAAIJ,eAAe,CAACX,IAAI,CAACe,GAAG,CAAC,EAAE,OAAO,IAAI;AAE1C,EAAA,OAAO,CAACD,KAAK,EAAEC,GAAG,CAAC;AACrB;;"}
@@ -0,0 +1,204 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked, cached } from '@glimmer/tracking';
3
+ import { on } from '@ember/modifier';
4
+ import { modifier } from 'ember-modifier';
5
+ import { useStyles } from '@frontile/theme';
6
+ import { FormControl } from '../form-control.js';
7
+ import { CloseButton } from '../../buttons/close-button.js';
8
+ import { SegmentGroup } from './segment-group.js';
9
+ import { fromDate, buildParts, resolveSegmentFormat, toDate, isSegment, hasDateChanged, carryOver } from './segments.js';
10
+ import { parseDate, toWire } from '../date-picker/value.js';
11
+ import { ref } from '../../../utils/ref.js';
12
+ import { triggerFormInputEvent } from '../../../utils/forms-utils-index.js';
13
+ import { precompileTemplate } from '@ember/template-compilation';
14
+ import { setComponentTemplate } from '@ember/component';
15
+ import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
16
+
17
+ /**
18
+ * A date typed into segments rather than picked from a grid. `DatePicker`
19
+ * renders the same segments and adds a calendar.
20
+ */
21
+ class DateInput extends Component {
22
+ containerRef = ref();
23
+ /**
24
+ * The segments are the state, not the value: mid-entry they hold digits that
25
+ * compose to no date at all, which no `Date` can represent.
26
+ */
27
+ static {
28
+ decorateFieldV2(this.prototype, "trackedParts", [tracked], function () {
29
+ return [];
30
+ });
31
+ }
32
+ #trackedParts = (initializeDeferredDecorator(this, "trackedParts"), void 0);
33
+ /**
34
+ * An untracked mirror of {@link parts}. The sync modifiers below need to
35
+ * read the current segments in order to rebuild them, and reading the
36
+ * tracked field inside a modifier would put it in that modifier's own
37
+ * tracking frame -- which the same modifier then writes to, re-running
38
+ * itself forever.
39
+ */
40
+ #currentParts = [];
41
+ constructor(owner, args) {
42
+ super(owner, args);
43
+ const seed = args.defaultValue;
44
+ this.setParts(fromDate(buildParts(this.locale, this.formatOptions, this.timeOptions), seed === undefined ? null : parseDate(seed)));
45
+ }
46
+ get parts() {
47
+ return this.trackedParts;
48
+ }
49
+ setParts(parts) {
50
+ this.#currentParts = parts;
51
+ this.trackedParts = parts;
52
+ }
53
+ get locale() {
54
+ return this.args.locale ?? navigator.language;
55
+ }
56
+ get formatOptions() {
57
+ // A textual month has no numeric segment to type into, so it falls back
58
+ // to a numeric one. `dateStyle: 'medium'` is the common way to hit this --
59
+ // it is DatePicker's button-trigger default. Only the month is replaced:
60
+ // the rest of the format is the consumer's and stands.
61
+ return resolveSegmentFormat(this.args.formatOptions, {
62
+ message: '<DateInput> needs numeric segments; ' + 'a textual @formatOptions month falls back to a numeric one.',
63
+ id: 'frontile.date-input.textual-format'
64
+ });
65
+ }
66
+ /** The time segments the field adds to the date, if any. */
67
+ get timeOptions() {
68
+ return {
69
+ granularity: this.args.granularity,
70
+ hourCycle: this.args.hourCycle
71
+ };
72
+ }
73
+ /**
74
+ * The composed value, or null while any segment is empty.
75
+ *
76
+ * Cached because `wireValue`, `isOutOfRange` and the template all read it
77
+ * independently, and each `toDate` walks the parts three times over.
78
+ */
79
+ static {
80
+ decorateMethodV2(this.prototype, "timeOptions", [cached]);
81
+ }
82
+ get value() {
83
+ return toDate(this.parts);
84
+ }
85
+ static {
86
+ decorateMethodV2(this.prototype, "value", [cached]);
87
+ }
88
+ get wireValue() {
89
+ return toWire(this.value, this.args.granularity);
90
+ }
91
+ get isEmpty() {
92
+ return this.parts.every(p => !isSegment(p) || p.value === null);
93
+ }
94
+ get placeholderValue() {
95
+ return this.args.placeholderValue ?? new Date();
96
+ }
97
+ /**
98
+ * Whether the composed value is outside the allowed range. Never blocks a
99
+ * keystroke -- typing toward 2020 passes through 2, 20 and 202 on the way,
100
+ * and a field that refused those could not be typed into at all.
101
+ */
102
+ get isOutOfRange() {
103
+ const value = this.value;
104
+ if (!value) return false;
105
+ if (this.args.minValue && value < this.args.minValue) return true;
106
+ if (this.args.maxValue && value > this.args.maxValue) return true;
107
+ return this.args.isDateUnavailable?.(value) ?? false;
108
+ }
109
+ get isInvalid() {
110
+ return Boolean(this.args.isInvalid) || this.isOutOfRange;
111
+ }
112
+ /**
113
+ * Pushes `@value` into the segments when the argument changes. `undefined`
114
+ * is ignored, so a field bound by `Field` before the form holds anything for
115
+ * it keeps what the user typed -- the rule `DatePicker` documents.
116
+ */
117
+ syncValue = modifier((_, [raw]) => {
118
+ if (raw === undefined) return;
119
+ const parsed = parseDate(raw);
120
+ // Ignore the echo of our own `@onChange`. A controlled consumer writes
121
+ // back the value this field just reported, and rewriting the segments
122
+ // from it would destroy a partial entry: backspacing one digit of the
123
+ // year un-commits it, so the field composes `null`, reports `null`, and
124
+ // is handed `null` straight back -- which `fromDate` would spend on
125
+ // clearing every other segment too. One keystroke would empty the field.
126
+ if (!hasDateChanged(toDate(this.#currentParts), parsed)) return;
127
+ this.setParts(fromDate(this.#currentParts, parsed));
128
+ });
129
+ /**
130
+ * Rebuilds the segment order when the locale or format changes, carrying
131
+ * each segment's own state across so switching en-US to en-GB reorders the
132
+ * field without emptying it -- half-typed digits included, which is why
133
+ * this goes segment by segment rather than through the composed value.
134
+ */
135
+ syncLocale = modifier((_, [locale, format, time]) => {
136
+ this.setParts(carryOver(buildParts(locale, format, time), this.#currentParts));
137
+ });
138
+ handlePartsChange = parts => {
139
+ const before = toDate(this.#currentParts);
140
+ this.setParts(parts);
141
+ const after = toDate(parts);
142
+ // Only value transitions are reported. The four keystrokes that fill a
143
+ // month and a day compose no date at all, and report nothing.
144
+ if (hasDateChanged(before, after)) {
145
+ this.args.onChange?.(after);
146
+ triggerFormInputEvent(this.containerRef.current);
147
+ }
148
+ };
149
+ /**
150
+ * `@onBlur` means "the user left the field", not "the user left a segment",
151
+ * so a move between segments is filtered out by asking whether focus landed
152
+ * inside the container. `DatePicker` needs `ControlBlurTracker` for this
153
+ * because its focus can legitimately be in a popover outside its own DOM;
154
+ * this field has no popover, so containment is the whole question.
155
+ */
156
+ handleFocusOut = event => {
157
+ const container = this.containerRef.current;
158
+ const next = event.relatedTarget;
159
+ if (container && next instanceof Node && container.contains(next)) return;
160
+ this.args.onBlur?.();
161
+ };
162
+ /**
163
+ * A disabled or read-only field never offers it: it carries no disabled
164
+ * state of its own and would be a live button clearing a field the user may
165
+ * not change.
166
+ */
167
+ get isClearable() {
168
+ return Boolean(this.args.isClearable) && !this.isEmpty && !this.args.isDisabled && !this.args.isReadOnly;
169
+ }
170
+ /**
171
+ * Clearing removes the clear button from the DOM (`isClearable` flips
172
+ * false the instant the value is gone), so focus must be handed somewhere
173
+ * explicitly or it falls to `<body>` and a keyboard user loses their place.
174
+ */
175
+ clear = () => {
176
+ this.handlePartsChange(fromDate(this.#currentParts, null));
177
+ this.containerRef.current?.querySelector('[data-part="segment"]')?.focus();
178
+ };
179
+ get classes() {
180
+ const {
181
+ dateInput
182
+ } = useStyles();
183
+ return dateInput({
184
+ size: this.args.inputSize
185
+ });
186
+ }
187
+ static {
188
+ decorateMethodV2(this.prototype, "classes", [cached]);
189
+ }
190
+ static {
191
+ setComponentTemplate(precompileTemplate("<div {{this.syncLocale this.locale this.formatOptions this.timeOptions}} {{this.syncValue @value}} {{this.containerRef.setup}} {{on \"focusout\" this.handleFocusOut}} class={{this.classes.base class=@classes.base}} data-component=\"date-input\" data-part=\"base\" ...attributes>\n {{#if @name}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{this.isInvalid}} @isDisabled={{@isDisabled}} as |c|>\n <div class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\" {{!-- The field shell lives here, not on the segment row, so the clear\n button sits inside the border. `role=\"group\"` supports neither\n aria-invalid nor aria-disabled, so the shell styles off these. --}} data-invalid={{if c.isInvalid \"true\" \"false\"}} data-disabled={{if @isDisabled \"true\" \"false\"}}>\n <SegmentGroup @parts={{this.parts}} @onPartsChange={{this.handlePartsChange}} @locale={{this.locale}} @placeholderValue={{this.placeholderValue}} @isDisabled={{@isDisabled}} @isReadOnly={{@isReadOnly}} @isInvalid={{c.isInvalid}} @id={{c.id}} @label={{@label}} @describedBy={{c.describedBy @description c.isInvalid}} @segmentLabels={{@segmentLabels}} @classes={{this.classes}} @userClasses={{@classes}} />\n {{#if this.isClearable}}\n <div data-part=\"end-content\" class={{this.classes.endContent class=@classes.endContent}}>\n <CloseButton @title=\"Clear\" @variant=\"soft\" @size=\"xs\" @class={{this.classes.clearButton class=@classes.clearButton}} data-part=\"clear-button\" @onPress={{this.clear}} />\n </div>\n {{/if}}\n </div>\n </FormControl>\n</div>", {
192
+ strictMode: true,
193
+ scope: () => ({
194
+ on,
195
+ FormControl,
196
+ SegmentGroup,
197
+ CloseButton
198
+ })
199
+ }), this);
200
+ }
201
+ }
202
+
203
+ export { DateInput, DateInput as default };
204
+ //# sourceMappingURL=date-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-input.js","sources":["../../../../src/components/forms/date-input/date-input.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { useStyles } from '@frontile/theme';\nimport { FormControl } from '../form-control';\nimport { CloseButton } from '../../buttons/close-button';\nimport { SegmentGroup } from './segment-group';\nimport {\n buildParts,\n toDate,\n fromDate,\n isSegment,\n carryOver,\n resolveSegmentFormat,\n hasDateChanged\n} from './segments';\nimport { parseDate, toWire } from '../date-picker/value';\nimport { ref } from '../../../utils/ref';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport type {\n Part,\n DateInputArgs,\n DateInputClasses,\n TimeOptions\n} from './types';\n\ninterface DateInputSignature {\n Args: DateInputArgs;\n Element: HTMLDivElement;\n}\n\n/**\n * A date typed into segments rather than picked from a grid. `DatePicker`\n * renders the same segments and adds a calendar.\n */\nclass DateInput extends Component<DateInputSignature> {\n containerRef = ref<HTMLElement>();\n\n /**\n * The segments are the state, not the value: mid-entry they hold digits that\n * compose to no date at all, which no `Date` can represent.\n */\n @tracked private trackedParts: Part[] = [];\n\n /**\n * An untracked mirror of {@link parts}. The sync modifiers below need to\n * read the current segments in order to rebuild them, and reading the\n * tracked field inside a modifier would put it in that modifier's own\n * tracking frame -- which the same modifier then writes to, re-running\n * itself forever.\n */\n #currentParts: Part[] = [];\n\n constructor(owner: unknown, args: DateInputArgs) {\n super(owner as never, args);\n\n const seed = args.defaultValue;\n this.setParts(\n fromDate(\n buildParts(this.locale, this.formatOptions, this.timeOptions),\n seed === undefined ? null : parseDate(seed)\n )\n );\n }\n\n get parts(): Part[] {\n return this.trackedParts;\n }\n\n private setParts(parts: Part[]): void {\n this.#currentParts = parts;\n this.trackedParts = parts;\n }\n\n get locale(): string {\n return this.args.locale ?? navigator.language;\n }\n\n get formatOptions(): Intl.DateTimeFormatOptions | undefined {\n // A textual month has no numeric segment to type into, so it falls back\n // to a numeric one. `dateStyle: 'medium'` is the common way to hit this --\n // it is DatePicker's button-trigger default. Only the month is replaced:\n // the rest of the format is the consumer's and stands.\n return resolveSegmentFormat(this.args.formatOptions, {\n message:\n '<DateInput> needs numeric segments; ' +\n 'a textual @formatOptions month falls back to a numeric one.',\n id: 'frontile.date-input.textual-format'\n });\n }\n\n /** The time segments the field adds to the date, if any. */\n @cached\n get timeOptions(): TimeOptions {\n return {\n granularity: this.args.granularity,\n hourCycle: this.args.hourCycle\n };\n }\n\n /**\n * The composed value, or null while any segment is empty.\n *\n * Cached because `wireValue`, `isOutOfRange` and the template all read it\n * independently, and each `toDate` walks the parts three times over.\n */\n @cached\n get value(): Date | null {\n return toDate(this.parts);\n }\n\n get wireValue(): string {\n return toWire(this.value, this.args.granularity);\n }\n\n get isEmpty(): boolean {\n return this.parts.every((p) => !isSegment(p) || p.value === null);\n }\n\n get placeholderValue(): Date {\n return this.args.placeholderValue ?? new Date();\n }\n\n /**\n * Whether the composed value is outside the allowed range. Never blocks a\n * keystroke -- typing toward 2020 passes through 2, 20 and 202 on the way,\n * and a field that refused those could not be typed into at all.\n */\n get isOutOfRange(): boolean {\n const value = this.value;\n if (!value) return false;\n\n if (this.args.minValue && value < this.args.minValue) return true;\n if (this.args.maxValue && value > this.args.maxValue) return true;\n return this.args.isDateUnavailable?.(value) ?? false;\n }\n\n get isInvalid(): boolean {\n return Boolean(this.args.isInvalid) || this.isOutOfRange;\n }\n\n /**\n * Pushes `@value` into the segments when the argument changes. `undefined`\n * is ignored, so a field bound by `Field` before the form holds anything for\n * it keeps what the user typed -- the rule `DatePicker` documents.\n */\n syncValue = modifier(\n (_: HTMLElement, [raw]: [Date | string | null | undefined]) => {\n if (raw === undefined) return;\n\n const parsed = parseDate(raw);\n\n // Ignore the echo of our own `@onChange`. A controlled consumer writes\n // back the value this field just reported, and rewriting the segments\n // from it would destroy a partial entry: backspacing one digit of the\n // year un-commits it, so the field composes `null`, reports `null`, and\n // is handed `null` straight back -- which `fromDate` would spend on\n // clearing every other segment too. One keystroke would empty the field.\n if (!hasDateChanged(toDate(this.#currentParts), parsed)) return;\n\n this.setParts(fromDate(this.#currentParts, parsed));\n }\n );\n\n /**\n * Rebuilds the segment order when the locale or format changes, carrying\n * each segment's own state across so switching en-US to en-GB reorders the\n * field without emptying it -- half-typed digits included, which is why\n * this goes segment by segment rather than through the composed value.\n */\n syncLocale = modifier(\n (\n _: HTMLElement,\n [locale, format, time]: [\n string,\n Intl.DateTimeFormatOptions | undefined,\n TimeOptions\n ]\n ) => {\n this.setParts(\n carryOver(buildParts(locale, format, time), this.#currentParts)\n );\n }\n );\n\n handlePartsChange = (parts: Part[]): void => {\n const before = toDate(this.#currentParts);\n this.setParts(parts);\n const after = toDate(parts);\n\n // Only value transitions are reported. The four keystrokes that fill a\n // month and a day compose no date at all, and report nothing.\n if (hasDateChanged(before, after)) {\n this.args.onChange?.(after);\n triggerFormInputEvent(this.containerRef.current);\n }\n };\n\n /**\n * `@onBlur` means \"the user left the field\", not \"the user left a segment\",\n * so a move between segments is filtered out by asking whether focus landed\n * inside the container. `DatePicker` needs `ControlBlurTracker` for this\n * because its focus can legitimately be in a popover outside its own DOM;\n * this field has no popover, so containment is the whole question.\n */\n handleFocusOut = (event: FocusEvent): void => {\n const container = this.containerRef.current;\n const next = event.relatedTarget;\n\n if (container && next instanceof Node && container.contains(next)) return;\n\n this.args.onBlur?.();\n };\n\n /**\n * A disabled or read-only field never offers it: it carries no disabled\n * state of its own and would be a live button clearing a field the user may\n * not change.\n */\n get isClearable(): boolean {\n return (\n Boolean(this.args.isClearable) &&\n !this.isEmpty &&\n !this.args.isDisabled &&\n !this.args.isReadOnly\n );\n }\n\n /**\n * Clearing removes the clear button from the DOM (`isClearable` flips\n * false the instant the value is gone), so focus must be handed somewhere\n * explicitly or it falls to `<body>` and a keyboard user loses their place.\n */\n clear = (): void => {\n this.handlePartsChange(fromDate(this.#currentParts, null));\n this.containerRef.current\n ?.querySelector<HTMLElement>('[data-part=\"segment\"]')\n ?.focus();\n };\n\n @cached\n get classes(): DateInputClasses {\n const { dateInput } = useStyles();\n return dateInput({ size: this.args.inputSize });\n }\n\n <template>\n <div\n {{this.syncLocale this.locale this.formatOptions this.timeOptions}}\n {{this.syncValue @value}}\n {{this.containerRef.setup}}\n {{on \"focusout\" this.handleFocusOut}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"date-input\"\n data-part=\"base\"\n ...attributes\n >\n {{#if @name}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{this.isInvalid}}\n @isDisabled={{@isDisabled}}\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n {{! The field shell lives here, not on the segment row, so the clear\n button sits inside the border. `role=\"group\"` supports neither\n aria-invalid nor aria-disabled, so the shell styles off these. }}\n data-invalid={{if c.isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n >\n <SegmentGroup\n @parts={{this.parts}}\n @onPartsChange={{this.handlePartsChange}}\n @locale={{this.locale}}\n @placeholderValue={{this.placeholderValue}}\n @isDisabled={{@isDisabled}}\n @isReadOnly={{@isReadOnly}}\n @isInvalid={{c.isInvalid}}\n @id={{c.id}}\n @label={{@label}}\n @describedBy={{c.describedBy @description c.isInvalid}}\n @segmentLabels={{@segmentLabels}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n />\n {{#if this.isClearable}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent class=@classes.endContent}}\n >\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @class={{this.classes.clearButton class=@classes.clearButton}}\n data-part=\"clear-button\"\n @onPress={{this.clear}}\n />\n </div>\n {{/if}}\n </div>\n </FormControl>\n </div>\n </template>\n}\n\nexport { DateInput, type DateInputSignature };\nexport default DateInput;\n"],"names":["DateInput","Component","containerRef","ref","g","prototype","tracked","i","constructor","owner","args","seed","defaultValue","setParts","fromDate","buildParts","locale","formatOptions","timeOptions","undefined","parseDate","parts","trackedParts","navigator","language","resolveSegmentFormat","message","id","granularity","hourCycle","n","cached","value","toDate","wireValue","toWire","isEmpty","every","p","isSegment","placeholderValue","Date","isOutOfRange","minValue","maxValue","isDateUnavailable","isInvalid","Boolean","syncValue","modifier","_","raw","parsed","hasDateChanged","syncLocale","format","time","carryOver","handlePartsChange","before","after","onChange","triggerFormInputEvent","current","handleFocusOut","event","container","next","relatedTarget","Node","contains","onBlur","isClearable","isDisabled","isReadOnly","clear","querySelector","focus","classes","dateInput","useStyles","size","inputSize","setComponentTemplate","precompileTemplate","strictMode","scope","on","FormControl","SegmentGroup","CloseButton"],"mappings":";;;;;;;;;;;;;;;;AAgCA;;;;AAIA,MAAMA,kBAAkBC,SAAA,CAAU;EAChCC,YAAA,GAAeC,KAAI;AAEnB;;;AAGC;AAHD,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAICC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAuC,EAAE;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,aAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,cAAA,CAAA,EAAA,MAAA;AAE1C;;;;;;AAMC;EACD,aAAa,GAAW,EAAE;AAE1BC,EAAAA,WAAAA,CAAYC,KAAc,EAAEC,IAAmB,EAAE;AAC/C,IAAA,KAAK,CAACD,KAAA,EAAgBC,IAAA,CAAA;AAEtB,IAAA,MAAMC,IAAA,GAAOD,KAAKE,YAAY;AAC9B,IAAA,IAAI,CAACC,QAAQ,CACXC,QAAA,CACEC,WAAW,IAAI,CAACC,MAAM,EAAE,IAAI,CAACC,aAAa,EAAE,IAAI,CAACC,WAAW,GAC5DP,IAAA,KAASQ,SAAA,GAAY,OAAOC,SAAA,CAAUT,IAAA,CAAA,CAAA,CAAA;AAG5C,EAAA;EAEA,IAAIU,QAAgB;IAClB,OAAO,IAAI,CAACC,YAAY;AAC1B,EAAA;EAEQT,QAAAA,CAASQ,KAAa,EAAQ;AACpC,IAAA,IAAI,CAAC,aAAa,GAAGA,KAAA;IACrB,IAAI,CAACC,YAAY,GAAGD,KAAA;AACtB,EAAA;EAEA,IAAIL,MAAAA,GAAiB;IACnB,OAAO,IAAI,CAACN,IAAI,CAACM,MAAM,IAAIO,UAAUC,QAAQ;AAC/C,EAAA;EAEA,IAAIP,aAAAA,GAAwD;AAC1D;AACA;AACA;AACA;AACA,IAAA,OAAOQ,qBAAq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