frontile 0.18.0 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/declarations/components/buttons/chip.d.ts +1 -1
  2. package/declarations/components/buttons/chip.d.ts.map +1 -1
  3. package/declarations/components/forms/autocomplete.d.ts +12 -12
  4. package/declarations/components/forms/date-input/clipboard.d.ts +34 -0
  5. package/declarations/components/forms/date-input/clipboard.d.ts.map +1 -0
  6. package/declarations/components/forms/date-input/date-input.d.ts +91 -0
  7. package/declarations/components/forms/date-input/date-input.d.ts.map +1 -0
  8. package/declarations/components/forms/date-input/segment-group.d.ts +130 -0
  9. package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -0
  10. package/declarations/components/forms/date-input/segments.d.ts +137 -0
  11. package/declarations/components/forms/date-input/segments.d.ts.map +1 -0
  12. package/declarations/components/forms/date-input/types.d.ts +134 -0
  13. package/declarations/components/forms/date-input/types.d.ts.map +1 -0
  14. package/declarations/components/forms/date-input.d.ts +6 -0
  15. package/declarations/components/forms/date-input.d.ts.map +1 -0
  16. package/declarations/components/forms/date-picker/date-picker.d.ts +248 -15
  17. package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -1
  18. package/declarations/components/forms/date-picker/end-content.d.ts +33 -3
  19. package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -1
  20. package/declarations/components/forms/date-picker/types.d.ts +30 -1
  21. package/declarations/components/forms/date-picker/types.d.ts.map +1 -1
  22. package/declarations/components/forms/field.d.ts +3 -0
  23. package/declarations/components/forms/field.d.ts.map +1 -1
  24. package/declarations/components/forms/index.d.ts +1 -0
  25. package/declarations/components/forms/index.d.ts.map +1 -1
  26. package/declarations/components/forms/input.d.ts +11 -11
  27. package/declarations/components/forms/native-select.d.ts +8 -8
  28. package/declarations/components/forms/select/select.d.ts +16 -16
  29. package/declarations/components/forms/textarea.d.ts +7 -7
  30. package/declarations/components/utilities/avatar.d.ts +35 -2
  31. package/declarations/components/utilities/avatar.d.ts.map +1 -1
  32. package/declarations/test-support.d.ts +30 -0
  33. package/declarations/test-support.d.ts.map +1 -1
  34. package/dist/components/buttons/chip.js.map +1 -1
  35. package/dist/components/forms/date-input/clipboard.js +162 -0
  36. package/dist/components/forms/date-input/clipboard.js.map +1 -0
  37. package/dist/components/forms/date-input/date-input.js +194 -0
  38. package/dist/components/forms/date-input/date-input.js.map +1 -0
  39. package/dist/components/forms/date-input/segment-group.js +271 -0
  40. package/dist/components/forms/date-input/segment-group.js.map +1 -0
  41. package/dist/components/forms/date-input/segments.js +379 -0
  42. package/dist/components/forms/date-input/segments.js.map +1 -0
  43. package/dist/components/forms/date-input/types.js +2 -0
  44. package/dist/components/forms/date-input/types.js.map +1 -0
  45. package/dist/components/forms/date-input.js +4 -0
  46. package/dist/components/forms/date-input.js.map +1 -0
  47. package/dist/components/forms/date-picker/date-picker.js +301 -14
  48. package/dist/components/forms/date-picker/date-picker.js.map +1 -1
  49. package/dist/components/forms/date-picker/end-content.js +17 -4
  50. package/dist/components/forms/date-picker/end-content.js.map +1 -1
  51. package/dist/components/forms/field.js +4 -1
  52. package/dist/components/forms/field.js.map +1 -1
  53. package/dist/components/forms/index.js +3 -0
  54. package/dist/components/forms/index.js.map +1 -1
  55. package/dist/components/utilities/avatar.js +30 -5
  56. package/dist/components/utilities/avatar.js.map +1 -1
  57. package/dist/forms.js +3 -0
  58. package/dist/forms.js.map +1 -1
  59. package/dist/index.js +3 -0
  60. package/dist/index.js.map +1 -1
  61. package/dist/test-support.js +480 -1
  62. package/dist/test-support.js.map +1 -1
  63. package/package.json +3 -3
@@ -2,10 +2,13 @@ import Component from '@glimmer/component';
2
2
  import { tracked, cached } from '@glimmer/tracking';
3
3
  import { modifier } from 'ember-modifier';
4
4
  import { hash, concat } from '@ember/helper';
5
+ import { on } from '@ember/modifier';
5
6
  import { useStyles } from '@frontile/theme';
6
7
  import { FormControl } from '../form-control.js';
7
8
  import { DatePickerTrigger } from './trigger.js';
8
9
  import { DatePickerEndContent } from './end-content.js';
10
+ import { SegmentGroup } from '../date-input/segment-group.js';
11
+ import { buildParts, fromDate, resolveSegmentFormat, carryOver, hasDateChanged, toDate } from '../date-input/segments.js';
9
12
  import { Popover } from '../../overlays/popover.js';
10
13
  import { Calendar } from '../../collections/calendar/calendar.js';
11
14
  import { ref } from '../../../utils/ref.js';
@@ -17,9 +20,12 @@ import { setComponentTemplate } from '@ember/component';
17
20
  import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
18
21
 
19
22
  /**
20
- * A date field: a button trigger showing the formatted value, and a calendar
21
- * in a popover. `@mode="range"` switches both the calendar and the value shape
22
- * to a `{ start, end }` range.
23
+ * A date field: segments the value can be typed into, a calendar button that
24
+ * opens a calendar in a popover, and -- under `@isEditable={{false}}` -- the
25
+ * older button trigger showing the formatted value instead. `@mode="range"`
26
+ * switches both the calendar and the value shape to a `{ start, end }` range,
27
+ * and -- when editable -- renders two groups of segments with a separator
28
+ * between them.
23
29
  */
24
30
  class DatePicker extends Component {
25
31
  triggerRef = ref();
@@ -43,12 +49,98 @@ class DatePicker extends Component {
43
49
  });
44
50
  }
45
51
  #isOpen = (initializeDeferredDecorator(this, "isOpen"), void 0);
52
+ static {
53
+ decorateFieldV2(this.prototype, "trackedParts", [tracked], function () {
54
+ return [];
55
+ });
56
+ }
57
+ #trackedParts = (initializeDeferredDecorator(this, "trackedParts"), void 0);
58
+ /**
59
+ * The segments, on the editable path. They are not a second source of truth
60
+ * for the value -- {@link internalValue} is -- but they cannot be derived
61
+ * from it either: mid-entry they hold digits that compose to no date at all,
62
+ * which no `Date` can represent. The calendar writes here through
63
+ * {@link commitValue}; typing writes there through {@link handlePartsChange}.
64
+ */
65
+ static {
66
+ decorateFieldV2(this.prototype, "trackedEndParts", [tracked], function () {
67
+ return [];
68
+ });
69
+ }
70
+ #trackedEndParts = (initializeDeferredDecorator(this, "trackedEndParts"), void 0);
71
+ /**
72
+ * The second group, in `@mode="range"` only. {@link trackedParts} is that
73
+ * mode's *start* group, so every path that writes one writes both.
74
+ */
75
+ /**
76
+ * An untracked mirror of {@link parts}. The sync modifiers below rebuild the
77
+ * segments from the current ones, and reading the tracked field inside a
78
+ * modifier would put it in that modifier's own tracking frame -- which the
79
+ * same modifier then writes to, re-running itself forever. `DateInput`
80
+ * carries the same pair for the same reason.
81
+ */
82
+ #currentParts = [];
83
+ /** The same mirror, for {@link trackedEndParts}. */
84
+ #currentEndParts = [];
46
85
  constructor(owner, args) {
47
86
  super(owner, args);
48
87
  const seed = args.defaultValue;
49
88
  if (seed !== undefined) {
50
89
  this.internalValue = this.parseIncoming(seed);
51
90
  }
91
+ this.writeParts(this.internalValue, () => buildParts(this.locale, this.segmentFormat));
92
+ }
93
+ get parts() {
94
+ return this.trackedParts;
95
+ }
96
+ get endParts() {
97
+ return this.trackedEndParts;
98
+ }
99
+ setParts(parts) {
100
+ this.#currentParts = parts;
101
+ this.trackedParts = parts;
102
+ }
103
+ setEndParts(parts) {
104
+ this.#currentEndParts = parts;
105
+ this.trackedEndParts = parts;
106
+ }
107
+ /**
108
+ * Writes a value across the segments, whichever mode is in play.
109
+ *
110
+ * `onto` supplies the list each group is written into -- the current
111
+ * segments when a value moved, a freshly built row when the locale or the
112
+ * format changed. It is a function because range mode needs two independent
113
+ * lists and must not hand the same array to both groups.
114
+ */
115
+ writeParts(value, onto) {
116
+ if (!this.isRangeMode) {
117
+ this.setParts(fromDate(onto('start'), value));
118
+ return;
119
+ }
120
+ const range = value;
121
+ this.setParts(fromDate(onto('start'), range?.start ?? null));
122
+ this.setEndParts(fromDate(onto('end'), range?.end ?? null));
123
+ }
124
+ /** Whether the value is typed rather than only picked. */
125
+ get isSegmented() {
126
+ return this.args.isEditable ?? true;
127
+ }
128
+ /**
129
+ * The format the segments are built from. The editable default is numeric;
130
+ * `{ dateStyle: 'medium' }` -- this component's own button default --
131
+ * renders "Jan" and has no numeric segment to type into, so a textual
132
+ * format falls back to the numeric default rather than rendering a field
133
+ * nobody can type in.
134
+ */
135
+ get segmentFormat() {
136
+ // Only the month is replaced; any other field the consumer named stands.
137
+ return resolveSegmentFormat(this.args.formatOptions, {
138
+ message: 'An editable <DatePicker> needs numeric segments; ' + 'a textual @formatOptions month falls back to a numeric one. ' + 'Pass @isEditable={{false}} for the formatted button trigger.',
139
+ id: 'frontile.date-picker.textual-format'
140
+ });
141
+ }
142
+ get placeholderValue() {
143
+ return this.args.placeholderValue ?? new Date();
52
144
  }
53
145
  get mode() {
54
146
  return this.args.mode ?? 'single';
@@ -82,8 +174,42 @@ class DatePicker extends Component {
82
174
  * before the form holds anything for it -- keeps whatever the user chose.
83
175
  */
84
176
  syncValue = modifier((_, [raw]) => {
85
- if (raw !== undefined) {
86
- this.internalValue = this.parseIncoming(raw);
177
+ if (raw === undefined) return;
178
+ const parsed = this.parseIncoming(raw);
179
+ this.internalValue = parsed;
180
+ // The segments are a second rendering of the same value, so an argument
181
+ // change has to reach them too; without this a `@value`-controlled picker
182
+ // shows empty segments. `#currentParts` rather than `this.parts` -- see
183
+ // the field's own comment.
184
+ //
185
+ // Unless the argument is merely the echo of our own `@onChange`: a
186
+ // controlled consumer writes back what we just reported, and rewriting the
187
+ // segments from it would destroy a partial entry. Backspacing one digit of
188
+ // the year un-commits it, so the field composes `null`, reports `null`, and
189
+ // is handed `null` straight back -- and `writeParts` would spend that on
190
+ // clearing every other segment, both groups in range mode. One keystroke
191
+ // would empty the field.
192
+ if (this.isSegmented && this.segmentsWouldChange(parsed)) {
193
+ this.writeParts(parsed, edge => edge === 'start' ? this.#currentParts : this.#currentEndParts);
194
+ }
195
+ });
196
+ /**
197
+ * Rebuilds the segment order when the locale or format changes, carrying the
198
+ * current value across so switching en-US to en-GB reorders the field
199
+ * without emptying it. Reads no tracked state, so it runs on an argument
200
+ * change and never on a keystroke.
201
+ */
202
+ syncSegmentFormat = modifier((_, [locale, format]) => {
203
+ if (!this.isSegmented) return;
204
+ // One `Intl.DateTimeFormat` for both edges: the arguments are identical,
205
+ // and the constructor is the expensive part. `carryOver` copies rather
206
+ // than mutates, so the two groups cannot share structure by accident.
207
+ const fresh = buildParts(locale, format);
208
+ // Segment by segment rather than through the composed value, so a
209
+ // half-typed entry survives the rebuild.
210
+ this.setParts(carryOver(fresh, this.#currentParts));
211
+ if (this.isRangeMode) {
212
+ this.setEndParts(carryOver(fresh, this.#currentEndParts));
87
213
  }
88
214
  });
89
215
  get formatted() {
@@ -121,7 +247,13 @@ class DatePicker extends Component {
121
247
  * calendar and on every day click.
122
248
  */
123
249
  blurTracker = new ControlBlurTracker({
124
- trigger: () => this.triggerRef.current,
250
+ // Resolved through whichever element the popover's `trigger` modifier sits
251
+ // on, because the tracker finds the portaled content by that element's
252
+ // `aria-controls`. On the segmented path there is no button trigger: the
253
+ // calendar button in the end content opens the popover instead, and
254
+ // pointing this at nothing would make a click into the open calendar read
255
+ // as a blur.
256
+ trigger: () => this.triggerRef.current ?? this.containerRef.current?.querySelector('[data-part="calendar-button"]'),
125
257
  container: () => this.containerRef.current,
126
258
  isOpen: () => this.isOpen,
127
259
  isDestroyed: () => this.isDestroyed || this.isDestroying,
@@ -155,12 +287,27 @@ class DatePicker extends Component {
155
287
  * away -- closing would just make them reopen it.
156
288
  */
157
289
  clear = () => {
158
- this.internalValue = null;
159
- this.args.onChange?.(null);
160
- this.notifyForm();
161
- this.triggerRef.current?.focus();
290
+ this.commitValue(null, {
291
+ writeParts: true
292
+ });
293
+ this.focusField();
162
294
  };
163
295
  /**
296
+ * Whatever the field's own focusable thing is: the button trigger, or --
297
+ * when segmented -- the segment the user was last in, falling back to the
298
+ * first one. A recorded segment that has left the DOM is not one focus can
299
+ * go back to.
300
+ */
301
+ focusTarget() {
302
+ if (!this.isSegmented) return this.triggerRef.current;
303
+ const last = this.lastFocusedSegment;
304
+ if (last && last.isConnected) return last;
305
+ return this.containerRef.current?.querySelector('[data-part="segment"]');
306
+ }
307
+ focusField() {
308
+ this.focusTarget()?.focus();
309
+ }
310
+ /**
164
311
  * Whether the selection is finished, and the popover should therefore close.
165
312
  * A range with only its anchor set is not: the user still owes a second
166
313
  * click, and closing would throw away the half they just made.
@@ -170,16 +317,144 @@ class DatePicker extends Component {
170
317
  if (this.mode !== 'range') return true;
171
318
  return value.end !== null;
172
319
  }
173
- handleChange = value => {
320
+ /**
321
+ * The one path a value change takes, whichever editor produced it.
322
+ *
323
+ * `writeParts` says whether the segments are that editor's output or its
324
+ * input. The calendar, the `:footer` block and the clear button are all
325
+ * *other* editors, and the segments have to be rewritten to show what they
326
+ * did. Typing is the segments themselves: rewriting them there would
327
+ * overwrite the buffer the user is still typing into, turning a half-typed
328
+ * year back into a padded one on every completed keystroke.
329
+ */
330
+ commitValue(value, {
331
+ writeParts
332
+ }) {
174
333
  // Internal state updates even when controlled, so the calendar's own
175
334
  // rendering stays responsive; the `value` getter ignores it in that case,
176
335
  // so the consumer still has the last word.
177
336
  this.internalValue = value;
337
+ if (writeParts && this.isSegmented) {
338
+ this.writeParts(value, edge => edge === 'start' ? this.#currentParts : this.#currentEndParts);
339
+ }
178
340
  this.args.onChange?.(value);
179
341
  this.notifyForm();
342
+ }
343
+ handleChange = value => {
344
+ this.commitValue(value, {
345
+ writeParts: true
346
+ });
180
347
  if (this.isComplete(value)) this.close();
181
348
  };
182
349
  /**
350
+ * Whether an incoming value differs from what the segments already compose.
351
+ *
352
+ * Compared edge by edge in range mode rather than by identity: the two are
353
+ * distinct objects on every report, so an object comparison would always
354
+ * say "changed" and defeat the guard entirely.
355
+ */
356
+ segmentsWouldChange(incoming) {
357
+ if (!this.isRangeMode) {
358
+ return hasDateChanged(toDate(this.#currentParts), incoming);
359
+ }
360
+ const composed = this.rangeFromParts();
361
+ const next = incoming;
362
+ return hasDateChanged(composed?.start ?? null, next?.start ?? null) || hasDateChanged(composed?.end ?? null, next?.end ?? null);
363
+ }
364
+ /**
365
+ * The segments changed. Only value *transitions* are reported: the four
366
+ * keystrokes that fill a month and a day compose no date at all, and report
367
+ * nothing. The popover is deliberately left alone -- typing never opened it,
368
+ * so completing a date by typing has nothing to close.
369
+ */
370
+ handlePartsChange = parts => {
371
+ const before = toDate(this.#currentParts);
372
+ this.setParts(parts);
373
+ const after = toDate(parts);
374
+ if (!hasDateChanged(before, after)) return;
375
+ this.commitValue(after, {
376
+ writeParts: false
377
+ });
378
+ };
379
+ /**
380
+ * The two range groups report separately, but a range is one value: each
381
+ * one recomposes the whole thing and reports only what moved.
382
+ */
383
+ handleStartParts = parts => {
384
+ const before = this.rangeFromParts();
385
+ this.setParts(parts);
386
+ this.reportRange(before);
387
+ };
388
+ handleEndParts = parts => {
389
+ const before = this.rangeFromParts();
390
+ this.setEndParts(parts);
391
+ this.reportRange(before);
392
+ };
393
+ /** Two dates pasted into the start group, which fill both. */
394
+ handleRangePaste = (start, end) => {
395
+ const before = this.rangeFromParts();
396
+ this.setParts(start);
397
+ this.setEndParts(end);
398
+ this.reportRange(before);
399
+ };
400
+ /**
401
+ * The range the two groups currently compose, or `null`.
402
+ *
403
+ * `DateRange.start` is a `Date`, not `Date | null`: a range is anchored at
404
+ * its start, and the half-open shape the calendar produces mid-selection is
405
+ * `{ start, end: null }` -- never the other way round. So segments that
406
+ * compose no start compose no range at all, however complete the end group
407
+ * is. That is what makes clearing the start report `null` rather than
408
+ * leaving a consumer holding a range the field no longer shows; the end's
409
+ * digits stay on screen, exactly as a half-typed single date's do.
410
+ */
411
+ rangeFromParts() {
412
+ const start = toDate(this.#currentParts);
413
+ if (!start) return null;
414
+ return {
415
+ start,
416
+ end: toDate(this.#currentEndParts)
417
+ };
418
+ }
419
+ /**
420
+ * Reports the range only if it moved, which is the single-mode contract
421
+ * applied to two ends: the keystrokes that fill a month and a day compose
422
+ * nothing and report nothing, and either end changing is a change.
423
+ */
424
+ reportRange(before) {
425
+ const after = this.rangeFromParts();
426
+ const moved = hasDateChanged(before?.start ?? null, after?.start ?? null) || hasDateChanged(before?.end ?? null, after?.end ?? null);
427
+ if (!moved) return;
428
+ this.commitValue(after, {
429
+ writeParts: false
430
+ });
431
+ }
432
+ /**
433
+ * The start and end groups' accessible names. Two `role="group"`s cannot
434
+ * share one id or one name, and `FormControl`'s label can only be
435
+ * associated with one element -- so each group names itself, deriving from
436
+ * `@label` so that the visible label is contained in both names.
437
+ */
438
+ get startLabel() {
439
+ return this.args.label ? `${this.args.label} start` : 'start date';
440
+ }
441
+ get endLabel() {
442
+ return this.args.label ? `${this.args.label} end` : 'end date';
443
+ }
444
+ /**
445
+ * The segment that last held focus, so that closing the calendar can hand
446
+ * focus back to where the user was. Recorded from the group's `focusin`
447
+ * rather than captured when the popover opens, because the calendar button
448
+ * is clicked *after* focus has already left the segment.
449
+ */
450
+ lastFocusedSegment = null;
451
+ handleSegmentFocusIn = event => {
452
+ const target = event.target;
453
+ if (target instanceof HTMLElement && target.getAttribute('data-part') === 'segment') {
454
+ this.lastFocusedSegment = target;
455
+ }
456
+ };
457
+ /**
183
458
  * Tells an enclosing `Form` the value moved.
184
459
  *
185
460
  * The hidden inputs are written programmatically, and a programmatic value
@@ -217,14 +492,16 @@ class DatePicker extends Component {
217
492
  */
218
493
  close = () => {
219
494
  this.isOpen = false;
220
- this.triggerRef.current?.focus();
495
+ this.focusField();
221
496
  };
222
497
  get classes() {
223
498
  const {
224
499
  datePicker
225
500
  } = useStyles();
226
501
  return datePicker({
227
- size: this.args.inputSize
502
+ size: this.args.inputSize,
503
+ isSegmented: this.isSegmented,
504
+ isRange: this.isSegmented && this.isRangeMode
228
505
  });
229
506
  }
230
507
  static {
@@ -234,6 +511,14 @@ class DatePicker extends Component {
234
511
  return this.mode === 'range';
235
512
  }
236
513
  /**
514
+ * The segmented field has no button trigger for a click to fall through to,
515
+ * and its calendar icon is a real button, so the cluster has to take pointer
516
+ * events. An explicit argument still wins.
517
+ */
518
+ get endContentPointerEvents() {
519
+ return this.args.endContentPointerEvents ?? (this.isSegmented ? 'auto' : 'none');
520
+ }
521
+ /**
237
522
  * The single-mode wire value, or `''` when there is nothing selected. Only
238
523
  * read from the single-mode branch of the template, so it does not repeat
239
524
  * that branch's mode check.
@@ -282,12 +567,14 @@ class DatePicker extends Component {
282
567
  decorateMethodV2(this.prototype, "footerBlockArg", [cached]);
283
568
  }
284
569
  static {
285
- setComponentTemplate(precompileTemplate("<div {{this.syncValue @value}} {{this.containerRef.setup}} class={{this.classes.base class=@classes.base}} data-component=\"date-picker\" data-part=\"base\" ...attributes>\n {{!-- A range's two names use dot notation, the convention Form documents\n for nested data -- so it arrives at a validator and at onSubmit as one\n { start, end } object rather than two loose keys. --}}\n {{#if @name}}\n {{#if this.isRangeMode}}\n <input type=\"hidden\" name={{concat @name \".start\"}} value={{this.wireRangeStart}} />\n <input type=\"hidden\" name={{concat @name \".end\"}} value={{this.wireRangeEnd}} />\n {{else}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n {{/if}}\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @isDisabled={{@isDisabled}} as |c|>\n <Popover @placement={{@placement}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} @strategy={{@strategy}} @didClose={{@didClose}} @isOpen={{this.isOpen}} @onOpenChange={{this.onOpenChange}} as |p|>\n <div {{p.anchor}} class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\">\n <DatePickerTrigger @id={{c.id}} @trigger={{p.trigger}} @placeholder={{@placeholder}} @formatted={{this.formatted}} @isEmpty={{this.isEmpty}} @isDisabled={{@isDisabled}} @isInvalid={{c.isInvalid}} @hasCustomContent={{has-block \"value\"}} @accessibleName={{this.accessibleName}} @triggerRef={{this.triggerRef.setup}} @classes={{this.classes}} @userClasses={{@classes}} @onFocusOut={{this.blurTracker.handleFocusOut}}>\n <:value>\n {{#if (has-block \"value\")}}\n {{yield this.valueBlockArg to=\"value\"}}\n {{/if}}\n </:value>\n </DatePickerTrigger>\n\n <DatePickerEndContent @classes={{this.classes}} @userClasses={{@classes}} @endContentPointerEvents={{@endContentPointerEvents}} @isClearable={{this.isClearable}} @onClear={{this.clear}} />\n </div>\n\n {{!-- preventAutoFocus: overlay's default focus grab runs later()\n after Calendar's autofocus already focused the day; turned off so\n Calendar's autofocus is the only thing moving focus into the grid. --}}\n <p.Content @size={{if @popoverSize @popoverSize \"auto\"}} @target={{@target}} @renderInPlace={{@renderInPlace}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @transitionDuration={{@transitionDuration}} @disableTransitions={{@disableTransitions}} @blockScroll={{false}} @preventAutoFocus={{true}} role=\"dialog\" aria-label={{@label}}>\n {{#if (has-block \"calendar\")}}\n {{yield this.calendarBlockArg to=\"calendar\"}}\n {{else}}\n <Calendar @mode={{this.mode}} @color={{@color}} @value={{this.value}} @onChange={{this.handleChange}} @locale={{@locale}} @weekStartsOn={{@weekStartsOn}} @minValue={{@minValue}} @maxValue={{@maxValue}} @isDateUnavailable={{@isDateUnavailable}} @visibleMonths={{@visibleMonths}} @captionLayout={{@captionLayout}} @fixedWeeks={{@fixedWeeks}} @showOutsideDays={{@showOutsideDays}} @isReadOnly={{@isReadOnly}} @isDisabled={{@isDisabled}} @labelledBy={{c.id}} @autofocus={{true}} @classes={{hash base=(this.classes.calendar class=@classes.calendar)}} data-part=\"calendar\" />\n {{/if}}\n\n {{#if (has-block \"footer\")}}\n <div data-part=\"footer\" class={{this.classes.footer class=@classes.footer}}>\n {{yield this.footerBlockArg to=\"footer\"}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n</div>", {
570
+ setComponentTemplate(precompileTemplate("<div {{this.syncSegmentFormat this.locale this.segmentFormat}} {{this.syncValue @value}} {{this.containerRef.setup}} class={{this.classes.base class=@classes.base}} data-component=\"date-picker\" data-part=\"base\" ...attributes>\n {{!-- A range's two names use dot notation, the convention Form documents\n for nested data -- so it arrives at a validator and at onSubmit as one\n { start, end } object rather than two loose keys. --}}\n {{#if @name}}\n {{#if this.isRangeMode}}\n <input type=\"hidden\" name={{concat @name \".start\"}} value={{this.wireRangeStart}} />\n <input type=\"hidden\" name={{concat @name \".end\"}} value={{this.wireRangeEnd}} />\n {{else}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n {{/if}}\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @isDisabled={{@isDisabled}} as |c|>\n <Popover @placement={{@placement}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} @strategy={{@strategy}} @didClose={{@didClose}} @isOpen={{this.isOpen}} @onOpenChange={{this.onOpenChange}} as |p|>\n <div {{p.anchor}} class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\" {{!-- The shell is on this element when segmented, so its invalid and\n disabled styling has to read from here. `role=\"group\"` inside\n cannot carry aria-invalid, which is why these are data\n attributes. --}} data-invalid={{if c.isInvalid \"true\" \"false\"}} data-disabled={{if @isDisabled \"true\" \"false\"}}>\n {{#if this.isSegmented}}\n {{!-- Blur tracking and focus recording ride on splattributes:\n the group renders `...attributes` on its `role=\"group\"` element,\n and both events bubble there from the segments. --}}\n {{#if this.isRangeMode}}\n {{!-- Two groups, so neither can take `c.id` or `@label`: ids\n must be unique and a name shared by both would leave a screen\n reader unable to tell the ends apart. Each derives its own\n from the field's. --}}\n <SegmentGroup @parts={{this.parts}} @onPartsChange={{this.handleStartParts}} @onRangePaste={{this.handleRangePaste}} @locale={{this.locale}} @placeholderValue={{this.placeholderValue}} @isDisabled={{@isDisabled}} @isReadOnly={{@isReadOnly}} @isInvalid={{c.isInvalid}} @id={{concat c.id \"-start\"}} @label={{this.startLabel}} @describedBy={{c.describedBy @description c.isInvalid}} @segmentLabels={{@segmentLabels}} @classes={{this.classes}} @userClasses={{@classes}} {{on \"focusin\" this.handleSegmentFocusIn}} {{on \"focusout\" this.blurTracker.handleFocusOut}} />\n <span data-part=\"separator\" aria-hidden=\"true\" class={{this.classes.separator class=@classes.separator}}>&ndash;</span>\n {{!-- No `@onRangePaste`: pasting \"20 Jan - 25 Jan\" into the end\n of a range and having it rewrite the start would be\n surprising. --}}\n <SegmentGroup @parts={{this.endParts}} @onPartsChange={{this.handleEndParts}} @locale={{this.locale}} @placeholderValue={{this.placeholderValue}} @isDisabled={{@isDisabled}} @isReadOnly={{@isReadOnly}} @isInvalid={{c.isInvalid}} @id={{concat c.id \"-end\"}} @label={{this.endLabel}} @describedBy={{c.describedBy @description c.isInvalid}} @segmentLabels={{@segmentLabels}} @classes={{this.classes}} @userClasses={{@classes}} {{on \"focusin\" this.handleSegmentFocusIn}} {{on \"focusout\" this.blurTracker.handleFocusOut}} />\n {{else}}\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}} {{on \"focusin\" this.handleSegmentFocusIn}} {{on \"focusout\" this.blurTracker.handleFocusOut}} />\n {{/if}}\n {{else}}\n <DatePickerTrigger @id={{c.id}} @trigger={{p.trigger}} @placeholder={{@placeholder}} @formatted={{this.formatted}} @isEmpty={{this.isEmpty}} @isDisabled={{@isDisabled}} @isInvalid={{c.isInvalid}} @hasCustomContent={{has-block \"value\"}} @accessibleName={{this.accessibleName}} @triggerRef={{this.triggerRef.setup}} @classes={{this.classes}} @userClasses={{@classes}} @onFocusOut={{this.blurTracker.handleFocusOut}}>\n <:value>\n {{#if (has-block \"value\")}}\n {{yield this.valueBlockArg to=\"value\"}}\n {{/if}}\n </:value>\n </DatePickerTrigger>\n {{/if}}\n\n <DatePickerEndContent @classes={{this.classes}} @userClasses={{@classes}} @endContentPointerEvents={{this.endContentPointerEvents}} @isClearable={{this.isClearable}} @onClear={{this.clear}} @isEditable={{this.isSegmented}} @trigger={{p.trigger}} @label={{@label}} @isDisabled={{@isDisabled}} />\n </div>\n\n {{!-- preventAutoFocus: overlay's default focus grab runs later()\n after Calendar's autofocus already focused the day; turned off so\n Calendar's autofocus is the only thing moving focus into the grid. --}}\n <p.Content @size={{if @popoverSize @popoverSize \"auto\"}} @target={{@target}} @renderInPlace={{@renderInPlace}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @transitionDuration={{@transitionDuration}} @disableTransitions={{@disableTransitions}} @blockScroll={{false}} @preventAutoFocus={{true}} {{!-- Overlay captures document.activeElement when the content\n mounts -- the calendar button, on the segmented path -- and\n refocuses it on teardown, after close() has already put focus back\n on the segment. `close()` is the one answer; this stops the\n overlay giving a second. --}} @preventFocusRestore={{this.isSegmented}} role=\"dialog\" aria-label={{@label}}>\n {{#if (has-block \"calendar\")}}\n {{yield this.calendarBlockArg to=\"calendar\"}}\n {{else}}\n <Calendar @mode={{this.mode}} @color={{@color}} @value={{this.value}} @onChange={{this.handleChange}} @locale={{@locale}} @weekStartsOn={{@weekStartsOn}} @minValue={{@minValue}} @maxValue={{@maxValue}} @isDateUnavailable={{@isDateUnavailable}} @visibleMonths={{@visibleMonths}} @captionLayout={{@captionLayout}} @fixedWeeks={{@fixedWeeks}} @showOutsideDays={{@showOutsideDays}} @isReadOnly={{@isReadOnly}} @isDisabled={{@isDisabled}} @labelledBy={{c.id}} @autofocus={{true}} @classes={{hash base=(this.classes.calendar class=@classes.calendar)}} data-part=\"calendar\" />\n {{/if}}\n\n {{#if (has-block \"footer\")}}\n <div data-part=\"footer\" class={{this.classes.footer class=@classes.footer}}>\n {{yield this.footerBlockArg to=\"footer\"}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n</div>", {
286
571
  strictMode: true,
287
572
  scope: () => ({
288
573
  concat,
289
574
  FormControl,
290
575
  Popover,
576
+ SegmentGroup,
577
+ on,
291
578
  DatePickerTrigger,
292
579
  DatePickerEndContent,
293
580
  Calendar,
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sources":["../../../../src/components/forms/date-picker/date-picker.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { modifier } from 'ember-modifier';\nimport { concat, hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport { FormControl } from '../form-control';\nimport { DatePickerTrigger } from './trigger';\nimport { DatePickerEndContent } from './end-content';\nimport { Popover } from '../../overlays/popover';\nimport { Calendar } from '../../collections/calendar/calendar';\nimport { ref } from '../../../utils/ref';\nimport { ControlBlurTracker } from '../../../-private/control-blur';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport {\n formatValue,\n isEmptyValue,\n parseDate,\n parseRange,\n toWire\n} from './value';\nimport type {\n CalendarMode,\n CalendarValue,\n DateRange\n} from '../../collections/calendar/types';\nimport type {\n DatePickerArgs,\n DatePickerValueBlockArg,\n DatePickerCalendarArgs,\n DatePickerFooterArg\n} from './types';\n\ninterface DatePickerSignature<M extends CalendarMode = 'single'> {\n Args: DatePickerArgs<M>;\n Blocks: {\n value: [DatePickerValueBlockArg<M>];\n calendar: [DatePickerCalendarArgs<M>];\n footer: [DatePickerFooterArg<M>];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * A date field: a button trigger showing the formatted value, and a calendar\n * in a popover. `@mode=\"range\"` switches both the calendar and the value shape\n * to a `{ start, end }` range.\n */\nclass DatePicker<M extends CalendarMode = 'single'> extends Component<\n DatePickerSignature<M>\n> {\n triggerRef = ref<HTMLButtonElement>();\n containerRef = ref<HTMLElement>();\n\n /**\n * The selection. Seeded from `@defaultValue`, updated by the user, and\n * synced from `@value` by {@link syncValue} whenever that argument changes.\n *\n * Everything renders from here rather than from `@value` directly -- see\n * {@link value} for why a read-through cannot work inside a `Form`.\n */\n @tracked internalValue: CalendarValue<M> | null = null;\n\n @tracked isOpen = false;\n\n constructor(owner: unknown, args: DatePickerArgs<M>) {\n super(owner as never, args as never);\n\n const seed = (args as { defaultValue?: unknown }).defaultValue;\n if (seed !== undefined) {\n this.internalValue = this.parseIncoming(seed);\n }\n }\n\n get mode(): M {\n return (this.args as { mode?: M }).mode ?? ('single' as M);\n }\n\n get locale(): string {\n return this.args.locale ?? navigator.language;\n }\n\n /**\n * The rendered value is always internal state, never a read-through to\n * `@value`; {@link syncValue} pushes `@value` into it whenever the argument\n * changes. This is the pattern `Select` uses, and reading through instead\n * deadlocks the component inside a `Form`: `Field` binds `@value` to the\n * form's data, the form's data comes from hidden inputs this component\n * renders, and those inputs would then render the very value they source.\n * Nothing could ever change it, so every pick after the first submit was\n * silently discarded.\n */\n get value(): CalendarValue<M> | null {\n return this.internalValue;\n }\n\n /** Normalizes whatever `@value` / `@defaultValue` was given to `Date`s. */\n private parseIncoming(raw: unknown): CalendarValue<M> | null {\n if (this.mode === 'range') {\n return parseRange(raw as never) as CalendarValue<M> | null;\n }\n return parseDate(raw as never) as CalendarValue<M> | null;\n }\n\n /**\n * Pushes `@value` into internal state when the argument changes. `undefined`\n * is ignored so that an uncontrolled picker -- and one bound by `Field`\n * before the form holds anything for it -- keeps whatever the user chose.\n */\n syncValue = modifier((_: HTMLDivElement, [raw]: [unknown]) => {\n if (raw !== undefined) {\n this.internalValue = this.parseIncoming(raw);\n }\n });\n\n get formatted(): string {\n return formatValue(this.value, this.locale, this.args.formatOptions);\n }\n\n get isEmpty(): boolean {\n return isEmptyValue(this.value);\n }\n\n @cached\n get valueBlockArg(): DatePickerValueBlockArg<M> {\n return {\n value: this.value,\n formatted: this.formatted,\n isEmpty: this.isEmpty\n };\n }\n\n /**\n * Names the trigger when a `:value` block owns its content. Falls back to\n * the formatted value alone rather than prefixing a hardcoded English\n * string when there is no `@label`. `undefined` (not `''`) when neither is\n * present, so the trigger omits `aria-label` entirely rather than setting\n * it to an empty string -- some assistive tech treats a present-but-empty\n * `aria-label` as overriding the visible text with nothing, leaving the\n * button unnamed.\n */\n get accessibleName(): string | undefined {\n const name = [this.args.label, this.formatted].filter(Boolean).join(', ');\n return name === '' ? undefined : name;\n }\n\n /**\n * Reports focus leaving the *whole* control -- the field and its portaled\n * popover -- rather than the trigger, which blurs on the way into the\n * calendar and on every day click.\n */\n blurTracker = new ControlBlurTracker({\n trigger: () => this.triggerRef.current,\n container: () => this.containerRef.current,\n isOpen: () => this.isOpen,\n isDestroyed: () => this.isDestroyed || this.isDestroying,\n onBlur: () => this.args.onBlur?.()\n });\n\n willDestroy(): void {\n super.willDestroy();\n // Nothing may resolve against a destroyed component.\n this.blurTracker.cancel();\n }\n\n /**\n * Whether the clear button takes the calendar icon's place. A disabled or\n * read-only field never shows it: the end-content cluster is not\n * pointer-transparent to it and it carries no disabled/read-only state of\n * its own, so it would otherwise be a live button that clears a field the\n * user may not change -- the same contract `Calendar` enforces for day\n * selection under `@isReadOnly`.\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 -- like `close()` -- focus must\n * be handed back to the trigger explicitly or it falls to `<body>`.\n *\n * Unlike `close()`, clearing deliberately leaves an open popover open: the\n * clear button lives outside the popover entirely, so there is no\n * dangling-focus reason to dismiss the calendar, and a user who just\n * cleared the field is a user who likely wants to pick a new date right\n * away -- closing would just make them reopen it.\n */\n clear = (): void => {\n this.internalValue = null;\n (this.args.onChange as ((v: null) => void) | undefined)?.(null);\n this.notifyForm();\n this.triggerRef.current?.focus();\n };\n\n /**\n * Whether the selection is finished, and the popover should therefore close.\n * A range with only its anchor set is not: the user still owes a second\n * click, and closing would throw away the half they just made.\n */\n private isComplete(value: CalendarValue<M> | null): boolean {\n if (!value) return false;\n if (this.mode !== 'range') return true;\n return (value as DateRange).end !== null;\n }\n\n handleChange = (value: CalendarValue<M>): void => {\n // Internal state updates even when controlled, so the calendar's own\n // rendering stays responsive; the `value` getter ignores it in that case,\n // so the consumer still has the last word.\n this.internalValue = value;\n (this.args.onChange as ((v: CalendarValue<M>) => void) | undefined)?.(\n value\n );\n this.notifyForm();\n\n if (this.isComplete(value)) this.close();\n };\n\n /**\n * Tells an enclosing `Form` the value moved.\n *\n * The hidden inputs are written programmatically, and a programmatic value\n * change fires no `input` event -- so without this the form never learns\n * anything happened. That is worse than stale data: as soon as `Form` holds\n * any data for this field, `Field` binds `@value` back to it -- so without\n * this the form's copy of the value silently diverges from the field's, and\n * a later `@data` change would sync the stale value back in. `Select`\n * dispatches the same event for the same reason.\n */\n private notifyForm(): void {\n triggerFormInputEvent(this.containerRef.current);\n }\n\n /**\n * Wired to the popover's `@onOpenChange`, which also fires for Escape and\n * an outside click -- not only the explicit paths that already call\n * `close()` below. Routing every close through `close()` matters because\n * `Overlay`'s own focus-restore captures `document.activeElement` at the\n * moment its content mounts, which by then is already the day `@autofocus`\n * moved focus onto (that modifier runs before the overlay's own), not the\n * trigger. Left to it, closing would try to restore focus onto a day\n * button that has just been removed from the DOM -- a no-op -- and focus\n * would fall to `<body>`.\n */\n onOpenChange = (isOpen: boolean): void => {\n if (isOpen) {\n this.isOpen = true;\n return;\n }\n this.close();\n };\n\n /**\n * Closing removes the focused day from the DOM, so focus must be handed back\n * explicitly or it falls to `<body>` and the keyboard user loses their place.\n */\n close = (): void => {\n this.isOpen = false;\n this.triggerRef.current?.focus();\n };\n\n @cached\n get classes() {\n const { datePicker } = useStyles();\n return datePicker({ size: this.args.inputSize });\n }\n\n get isRangeMode(): boolean {\n return this.mode === 'range';\n }\n\n /**\n * The single-mode wire value, or `''` when there is nothing selected. Only\n * read from the single-mode branch of the template, so it does not repeat\n * that branch's mode check.\n */\n get wireValue(): string {\n return toWire(this.value as Date | null);\n }\n\n get wireRangeStart(): string {\n return toWire((this.value as DateRange | null)?.start ?? null);\n }\n\n get wireRangeEnd(): string {\n return toWire((this.value as DateRange | null)?.end ?? null);\n }\n\n @cached\n get calendarBlockArg(): DatePickerCalendarArgs<M> {\n return {\n mode: this.mode,\n color: this.args.color,\n value: this.value,\n onChange: this.handleChange,\n locale: this.locale,\n weekStartsOn: this.args.weekStartsOn,\n minValue: this.args.minValue,\n maxValue: this.args.maxValue,\n isDateUnavailable: this.args.isDateUnavailable,\n visibleMonths: this.args.visibleMonths,\n captionLayout: this.args.captionLayout,\n labelledBy: this.args.id,\n autofocus: true\n };\n }\n\n @cached\n get footerBlockArg(): DatePickerFooterArg<M> {\n return {\n // Deliberately `handleChange`, not a bare assignment: a preset must be\n // indistinguishable from a click, so it fires `@onChange` and closes on\n // a complete value exactly the way picking a day does.\n setValue: this.handleChange,\n close: this.close,\n value: this.value,\n isOpen: this.isOpen\n };\n }\n\n <template>\n <div\n {{this.syncValue @value}}\n {{this.containerRef.setup}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"date-picker\"\n data-part=\"base\"\n ...attributes\n >\n {{! A range's two names use dot notation, the convention Form documents\n for nested data -- so it arrives at a validator and at onSubmit as one\n { start, end } object rather than two loose keys. }}\n {{#if @name}}\n {{#if this.isRangeMode}}\n <input\n type=\"hidden\"\n name={{concat @name \".start\"}}\n value={{this.wireRangeStart}}\n />\n <input\n type=\"hidden\"\n name={{concat @name \".end\"}}\n value={{this.wireRangeEnd}}\n />\n {{else}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n {{/if}}\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @isDisabled={{@isDisabled}}\n as |c|\n >\n <Popover\n @placement={{@placement}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n @didClose={{@didClose}}\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.onOpenChange}}\n as |p|\n >\n <div\n {{p.anchor}}\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n <DatePickerTrigger\n @id={{c.id}}\n @trigger={{p.trigger}}\n @placeholder={{@placeholder}}\n @formatted={{this.formatted}}\n @isEmpty={{this.isEmpty}}\n @isDisabled={{@isDisabled}}\n @isInvalid={{c.isInvalid}}\n @hasCustomContent={{has-block \"value\"}}\n @accessibleName={{this.accessibleName}}\n @triggerRef={{this.triggerRef.setup}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @onFocusOut={{this.blurTracker.handleFocusOut}}\n >\n <:value>\n {{#if (has-block \"value\")}}\n {{yield this.valueBlockArg to=\"value\"}}\n {{/if}}\n </:value>\n </DatePickerTrigger>\n\n <DatePickerEndContent\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @endContentPointerEvents={{@endContentPointerEvents}}\n @isClearable={{this.isClearable}}\n @onClear={{this.clear}}\n />\n </div>\n\n {{! preventAutoFocus: overlay's default focus grab runs later()\n after Calendar's autofocus already focused the day; turned off so\n Calendar's autofocus is the only thing moving focus into the grid. }}\n <p.Content\n @size={{if @popoverSize @popoverSize \"auto\"}}\n @target={{@target}}\n @renderInPlace={{@renderInPlace}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @transitionDuration={{@transitionDuration}}\n @disableTransitions={{@disableTransitions}}\n @blockScroll={{false}}\n @preventAutoFocus={{true}}\n role=\"dialog\"\n aria-label={{@label}}\n >\n {{#if (has-block \"calendar\")}}\n {{yield this.calendarBlockArg to=\"calendar\"}}\n {{else}}\n <Calendar\n @mode={{this.mode}}\n @color={{@color}}\n @value={{this.value}}\n @onChange={{this.handleChange}}\n @locale={{@locale}}\n @weekStartsOn={{@weekStartsOn}}\n @minValue={{@minValue}}\n @maxValue={{@maxValue}}\n @isDateUnavailable={{@isDateUnavailable}}\n @visibleMonths={{@visibleMonths}}\n @captionLayout={{@captionLayout}}\n @fixedWeeks={{@fixedWeeks}}\n @showOutsideDays={{@showOutsideDays}}\n @isReadOnly={{@isReadOnly}}\n @isDisabled={{@isDisabled}}\n @labelledBy={{c.id}}\n @autofocus={{true}}\n @classes={{hash\n base=(this.classes.calendar class=@classes.calendar)\n }}\n data-part=\"calendar\"\n />\n {{/if}}\n\n {{#if (has-block \"footer\")}}\n <div\n data-part=\"footer\"\n class={{this.classes.footer class=@classes.footer}}\n >\n {{yield this.footerBlockArg to=\"footer\"}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n </div>\n </template>\n}\n\nexport { DatePicker, type DatePickerSignature };\nexport default DatePicker;\n"],"names":["DatePicker","Component","triggerRef","ref","containerRef","g","prototype","tracked","i","constructor","owner","args","seed","defaultValue","undefined","internalValue","parseIncoming","mode","locale","navigator","language","value","raw","parseRange","parseDate","syncValue","modifier","_","formatted","formatValue","formatOptions","isEmpty","isEmptyValue","valueBlockArg","n","cached","accessibleName","name","label","filter","Boolean","join","blurTracker","ControlBlurTracker","trigger","current","container","isOpen","isDestroyed","isDestroying","onBlur","willDestroy","cancel","isClearable","isDisabled","isReadOnly","clear","onChange","notifyForm","focus","isComplete","end","handleChange","close","triggerFormInputEvent","onOpenChange","classes","datePicker","useStyles","size","inputSize","isRangeMode","wireValue","toWire","wireRangeStart","start","wireRangeEnd","calendarBlockArg","color","weekStartsOn","minValue","maxValue","isDateUnavailable","visibleMonths","captionLayout","labelledBy","id","autofocus","footerBlockArg","setValue","setComponentTemplate","precompileTemplate","strictMode","scope","concat","FormControl","Popover","DatePickerTrigger","DatePickerEndContent","Calendar","hash"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA;;;;AAIC;AACD,MAAMA,UAAA,SAAsDC,UACtC;EAEpBC,UAAA,GAAaC,KAAI;EACjBC,YA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MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,MAAA;QAAAC,WAAA;QAAAC,OAAA;QAAAC,iBAAA;QAAAC,oBAAA;QAAAC,QAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"date-picker.js","sources":["../../../../src/components/forms/date-picker/date-picker.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { modifier } from 'ember-modifier';\nimport { concat, hash } from '@ember/helper';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\nimport { FormControl } from '../form-control';\nimport { DatePickerTrigger } from './trigger';\nimport { DatePickerEndContent } from './end-content';\nimport { SegmentGroup } from '../date-input/segment-group';\nimport {\n buildParts,\n toDate,\n fromDate,\n carryOver,\n resolveSegmentFormat,\n hasDateChanged\n} from '../date-input/segments';\nimport { Popover } from '../../overlays/popover';\nimport { Calendar } from '../../collections/calendar/calendar';\nimport { ref } from '../../../utils/ref';\nimport { ControlBlurTracker } from '../../../-private/control-blur';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport {\n formatValue,\n isEmptyValue,\n parseDate,\n parseRange,\n toWire\n} from './value';\nimport type {\n CalendarMode,\n CalendarValue,\n DateRange\n} from '../../collections/calendar/types';\nimport type { Part } from '../date-input/types';\nimport type {\n DatePickerArgs,\n DatePickerValueBlockArg,\n DatePickerCalendarArgs,\n DatePickerFooterArg\n} from './types';\n\ninterface DatePickerSignature<M extends CalendarMode = 'single'> {\n Args: DatePickerArgs<M>;\n Blocks: {\n value: [DatePickerValueBlockArg<M>];\n calendar: [DatePickerCalendarArgs<M>];\n footer: [DatePickerFooterArg<M>];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * A date field: segments the value can be typed into, a calendar button that\n * opens a calendar in a popover, and -- under `@isEditable={{false}}` -- the\n * older button trigger showing the formatted value instead. `@mode=\"range\"`\n * switches both the calendar and the value shape to a `{ start, end }` range,\n * and -- when editable -- renders two groups of segments with a separator\n * between them.\n */\nclass DatePicker<M extends CalendarMode = 'single'> extends Component<\n DatePickerSignature<M>\n> {\n triggerRef = ref<HTMLButtonElement>();\n containerRef = ref<HTMLElement>();\n\n /**\n * The selection. Seeded from `@defaultValue`, updated by the user, and\n * synced from `@value` by {@link syncValue} whenever that argument changes.\n *\n * Everything renders from here rather than from `@value` directly -- see\n * {@link value} for why a read-through cannot work inside a `Form`.\n */\n @tracked internalValue: CalendarValue<M> | null = null;\n\n @tracked isOpen = false;\n\n /**\n * The segments, on the editable path. They are not a second source of truth\n * for the value -- {@link internalValue} is -- but they cannot be derived\n * from it either: mid-entry they hold digits that compose to no date at all,\n * which no `Date` can represent. The calendar writes here through\n * {@link commitValue}; typing writes there through {@link handlePartsChange}.\n */\n @tracked private trackedParts: Part[] = [];\n\n /**\n * The second group, in `@mode=\"range\"` only. {@link trackedParts} is that\n * mode's *start* group, so every path that writes one writes both.\n */\n @tracked private trackedEndParts: Part[] = [];\n\n /**\n * An untracked mirror of {@link parts}. The sync modifiers below rebuild the\n * segments from the current ones, and reading the tracked field inside a\n * modifier would put it in that modifier's own tracking frame -- which the\n * same modifier then writes to, re-running itself forever. `DateInput`\n * carries the same pair for the same reason.\n */\n #currentParts: Part[] = [];\n\n /** The same mirror, for {@link trackedEndParts}. */\n #currentEndParts: Part[] = [];\n\n constructor(owner: unknown, args: DatePickerArgs<M>) {\n super(owner as never, args as never);\n\n const seed = (args as { defaultValue?: unknown }).defaultValue;\n if (seed !== undefined) {\n this.internalValue = this.parseIncoming(seed);\n }\n\n this.writeParts(this.internalValue, () =>\n buildParts(this.locale, this.segmentFormat)\n );\n }\n\n get parts(): Part[] {\n return this.trackedParts;\n }\n\n get endParts(): Part[] {\n return this.trackedEndParts;\n }\n\n private setParts(parts: Part[]): void {\n this.#currentParts = parts;\n this.trackedParts = parts;\n }\n\n private setEndParts(parts: Part[]): void {\n this.#currentEndParts = parts;\n this.trackedEndParts = parts;\n }\n\n /**\n * Writes a value across the segments, whichever mode is in play.\n *\n * `onto` supplies the list each group is written into -- the current\n * segments when a value moved, a freshly built row when the locale or the\n * format changed. It is a function because range mode needs two independent\n * lists and must not hand the same array to both groups.\n */\n private writeParts(\n value: CalendarValue<M> | null,\n onto: (edge: 'start' | 'end') => Part[]\n ): void {\n if (!this.isRangeMode) {\n this.setParts(fromDate(onto('start'), value as Date | null));\n return;\n }\n\n const range = value as DateRange | null;\n this.setParts(fromDate(onto('start'), range?.start ?? null));\n this.setEndParts(fromDate(onto('end'), range?.end ?? null));\n }\n\n /** Whether the value is typed rather than only picked. */\n get isSegmented(): boolean {\n return this.args.isEditable ?? true;\n }\n\n /**\n * The format the segments are built from. The editable default is numeric;\n * `{ dateStyle: 'medium' }` -- this component's own button default --\n * renders \"Jan\" and has no numeric segment to type into, so a textual\n * format falls back to the numeric default rather than rendering a field\n * nobody can type in.\n */\n get segmentFormat(): Intl.DateTimeFormatOptions | undefined {\n // Only the month is replaced; any other field the consumer named stands.\n return resolveSegmentFormat(this.args.formatOptions, {\n message:\n 'An editable <DatePicker> needs numeric segments; ' +\n 'a textual @formatOptions month falls back to a numeric one. ' +\n 'Pass @isEditable={{false}} for the formatted button trigger.',\n id: 'frontile.date-picker.textual-format'\n });\n }\n\n get placeholderValue(): Date {\n return this.args.placeholderValue ?? new Date();\n }\n\n get mode(): M {\n return (this.args as { mode?: M }).mode ?? ('single' as M);\n }\n\n get locale(): string {\n return this.args.locale ?? navigator.language;\n }\n\n /**\n * The rendered value is always internal state, never a read-through to\n * `@value`; {@link syncValue} pushes `@value` into it whenever the argument\n * changes. This is the pattern `Select` uses, and reading through instead\n * deadlocks the component inside a `Form`: `Field` binds `@value` to the\n * form's data, the form's data comes from hidden inputs this component\n * renders, and those inputs would then render the very value they source.\n * Nothing could ever change it, so every pick after the first submit was\n * silently discarded.\n */\n get value(): CalendarValue<M> | null {\n return this.internalValue;\n }\n\n /** Normalizes whatever `@value` / `@defaultValue` was given to `Date`s. */\n private parseIncoming(raw: unknown): CalendarValue<M> | null {\n if (this.mode === 'range') {\n return parseRange(raw as never) as CalendarValue<M> | null;\n }\n return parseDate(raw as never) as CalendarValue<M> | null;\n }\n\n /**\n * Pushes `@value` into internal state when the argument changes. `undefined`\n * is ignored so that an uncontrolled picker -- and one bound by `Field`\n * before the form holds anything for it -- keeps whatever the user chose.\n */\n syncValue = modifier((_: HTMLDivElement, [raw]: [unknown]) => {\n if (raw === undefined) return;\n\n const parsed = this.parseIncoming(raw);\n this.internalValue = parsed;\n // The segments are a second rendering of the same value, so an argument\n // change has to reach them too; without this a `@value`-controlled picker\n // shows empty segments. `#currentParts` rather than `this.parts` -- see\n // the field's own comment.\n //\n // Unless the argument is merely the echo of our own `@onChange`: a\n // controlled consumer writes back what we just reported, and rewriting the\n // segments from it would destroy a partial entry. Backspacing one digit of\n // the year un-commits it, so the field composes `null`, reports `null`, and\n // is handed `null` straight back -- and `writeParts` would spend that on\n // clearing every other segment, both groups in range mode. One keystroke\n // would empty the field.\n if (this.isSegmented && this.segmentsWouldChange(parsed)) {\n this.writeParts(parsed, (edge) =>\n edge === 'start' ? this.#currentParts : this.#currentEndParts\n );\n }\n });\n\n /**\n * Rebuilds the segment order when the locale or format changes, carrying the\n * current value across so switching en-US to en-GB reorders the field\n * without emptying it. Reads no tracked state, so it runs on an argument\n * change and never on a keystroke.\n */\n syncSegmentFormat = modifier(\n (\n _: HTMLDivElement,\n [locale, format]: [string, Intl.DateTimeFormatOptions | undefined]\n ) => {\n if (!this.isSegmented) return;\n\n // One `Intl.DateTimeFormat` for both edges: the arguments are identical,\n // and the constructor is the expensive part. `carryOver` copies rather\n // than mutates, so the two groups cannot share structure by accident.\n const fresh = buildParts(locale, format);\n\n // Segment by segment rather than through the composed value, so a\n // half-typed entry survives the rebuild.\n this.setParts(carryOver(fresh, this.#currentParts));\n if (this.isRangeMode) {\n this.setEndParts(carryOver(fresh, this.#currentEndParts));\n }\n }\n );\n\n get formatted(): string {\n return formatValue(this.value, this.locale, this.args.formatOptions);\n }\n\n get isEmpty(): boolean {\n return isEmptyValue(this.value);\n }\n\n @cached\n get valueBlockArg(): DatePickerValueBlockArg<M> {\n return {\n value: this.value,\n formatted: this.formatted,\n isEmpty: this.isEmpty\n };\n }\n\n /**\n * Names the trigger when a `:value` block owns its content. Falls back to\n * the formatted value alone rather than prefixing a hardcoded English\n * string when there is no `@label`. `undefined` (not `''`) when neither is\n * present, so the trigger omits `aria-label` entirely rather than setting\n * it to an empty string -- some assistive tech treats a present-but-empty\n * `aria-label` as overriding the visible text with nothing, leaving the\n * button unnamed.\n */\n get accessibleName(): string | undefined {\n const name = [this.args.label, this.formatted].filter(Boolean).join(', ');\n return name === '' ? undefined : name;\n }\n\n /**\n * Reports focus leaving the *whole* control -- the field and its portaled\n * popover -- rather than the trigger, which blurs on the way into the\n * calendar and on every day click.\n */\n blurTracker = new ControlBlurTracker({\n // Resolved through whichever element the popover's `trigger` modifier sits\n // on, because the tracker finds the portaled content by that element's\n // `aria-controls`. On the segmented path there is no button trigger: the\n // calendar button in the end content opens the popover instead, and\n // pointing this at nothing would make a click into the open calendar read\n // as a blur.\n trigger: () =>\n this.triggerRef.current ??\n this.containerRef.current?.querySelector<HTMLElement>(\n '[data-part=\"calendar-button\"]'\n ),\n container: () => this.containerRef.current,\n isOpen: () => this.isOpen,\n isDestroyed: () => this.isDestroyed || this.isDestroying,\n onBlur: () => this.args.onBlur?.()\n });\n\n willDestroy(): void {\n super.willDestroy();\n // Nothing may resolve against a destroyed component.\n this.blurTracker.cancel();\n }\n\n /**\n * Whether the clear button takes the calendar icon's place. A disabled or\n * read-only field never shows it: the end-content cluster is not\n * pointer-transparent to it and it carries no disabled/read-only state of\n * its own, so it would otherwise be a live button that clears a field the\n * user may not change -- the same contract `Calendar` enforces for day\n * selection under `@isReadOnly`.\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 -- like `close()` -- focus must\n * be handed back to the trigger explicitly or it falls to `<body>`.\n *\n * Unlike `close()`, clearing deliberately leaves an open popover open: the\n * clear button lives outside the popover entirely, so there is no\n * dangling-focus reason to dismiss the calendar, and a user who just\n * cleared the field is a user who likely wants to pick a new date right\n * away -- closing would just make them reopen it.\n */\n clear = (): void => {\n this.commitValue(null, { writeParts: true });\n this.focusField();\n };\n\n /**\n * Whatever the field's own focusable thing is: the button trigger, or --\n * when segmented -- the segment the user was last in, falling back to the\n * first one. A recorded segment that has left the DOM is not one focus can\n * go back to.\n */\n private focusTarget(): HTMLElement | null | undefined {\n if (!this.isSegmented) return this.triggerRef.current;\n\n const last = this.lastFocusedSegment;\n if (last && last.isConnected) return last;\n\n return this.containerRef.current?.querySelector<HTMLElement>(\n '[data-part=\"segment\"]'\n );\n }\n\n private focusField(): void {\n this.focusTarget()?.focus();\n }\n\n /**\n * Whether the selection is finished, and the popover should therefore close.\n * A range with only its anchor set is not: the user still owes a second\n * click, and closing would throw away the half they just made.\n */\n private isComplete(value: CalendarValue<M> | null): boolean {\n if (!value) return false;\n if (this.mode !== 'range') return true;\n return (value as DateRange).end !== null;\n }\n\n /**\n * The one path a value change takes, whichever editor produced it.\n *\n * `writeParts` says whether the segments are that editor's output or its\n * input. The calendar, the `:footer` block and the clear button are all\n * *other* editors, and the segments have to be rewritten to show what they\n * did. Typing is the segments themselves: rewriting them there would\n * overwrite the buffer the user is still typing into, turning a half-typed\n * year back into a padded one on every completed keystroke.\n */\n private commitValue(\n value: CalendarValue<M> | null,\n { writeParts }: { writeParts: boolean }\n ): void {\n // Internal state updates even when controlled, so the calendar's own\n // rendering stays responsive; the `value` getter ignores it in that case,\n // so the consumer still has the last word.\n this.internalValue = value;\n\n if (writeParts && this.isSegmented) {\n this.writeParts(value, (edge) =>\n edge === 'start' ? this.#currentParts : this.#currentEndParts\n );\n }\n\n (\n this.args.onChange as ((v: CalendarValue<M> | null) => void) | undefined\n )?.(value);\n this.notifyForm();\n }\n\n handleChange = (value: CalendarValue<M>): void => {\n this.commitValue(value, { writeParts: true });\n\n if (this.isComplete(value)) this.close();\n };\n\n /**\n * Whether an incoming value differs from what the segments already compose.\n *\n * Compared edge by edge in range mode rather than by identity: the two are\n * distinct objects on every report, so an object comparison would always\n * say \"changed\" and defeat the guard entirely.\n */\n private segmentsWouldChange(incoming: CalendarValue<M> | null): boolean {\n if (!this.isRangeMode) {\n return hasDateChanged(\n toDate(this.#currentParts),\n incoming as Date | null\n );\n }\n\n const composed = this.rangeFromParts();\n const next = incoming as DateRange | null;\n\n return (\n hasDateChanged(composed?.start ?? null, next?.start ?? null) ||\n hasDateChanged(composed?.end ?? null, next?.end ?? null)\n );\n }\n\n /**\n * The segments changed. Only value *transitions* are reported: the four\n * keystrokes that fill a month and a day compose no date at all, and report\n * nothing. The popover is deliberately left alone -- typing never opened it,\n * so completing a date by typing has nothing to close.\n */\n handlePartsChange = (parts: Part[]): void => {\n const before = toDate(this.#currentParts);\n this.setParts(parts);\n const after = toDate(parts);\n\n if (!hasDateChanged(before, after)) return;\n\n this.commitValue(after as CalendarValue<M> | null, { writeParts: false });\n };\n\n /**\n * The two range groups report separately, but a range is one value: each\n * one recomposes the whole thing and reports only what moved.\n */\n handleStartParts = (parts: Part[]): void => {\n const before = this.rangeFromParts();\n this.setParts(parts);\n this.reportRange(before);\n };\n\n handleEndParts = (parts: Part[]): void => {\n const before = this.rangeFromParts();\n this.setEndParts(parts);\n this.reportRange(before);\n };\n\n /** Two dates pasted into the start group, which fill both. */\n handleRangePaste = (start: Part[], end: Part[]): void => {\n const before = this.rangeFromParts();\n this.setParts(start);\n this.setEndParts(end);\n this.reportRange(before);\n };\n\n /**\n * The range the two groups currently compose, or `null`.\n *\n * `DateRange.start` is a `Date`, not `Date | null`: a range is anchored at\n * its start, and the half-open shape the calendar produces mid-selection is\n * `{ start, end: null }` -- never the other way round. So segments that\n * compose no start compose no range at all, however complete the end group\n * is. That is what makes clearing the start report `null` rather than\n * leaving a consumer holding a range the field no longer shows; the end's\n * digits stay on screen, exactly as a half-typed single date's do.\n */\n private rangeFromParts(): DateRange | null {\n const start = toDate(this.#currentParts);\n if (!start) return null;\n\n return { start, end: toDate(this.#currentEndParts) };\n }\n\n /**\n * Reports the range only if it moved, which is the single-mode contract\n * applied to two ends: the keystrokes that fill a month and a day compose\n * nothing and report nothing, and either end changing is a change.\n */\n private reportRange(before: DateRange | null): void {\n const after = this.rangeFromParts();\n\n const moved =\n hasDateChanged(before?.start ?? null, after?.start ?? null) ||\n hasDateChanged(before?.end ?? null, after?.end ?? null);\n if (!moved) return;\n\n this.commitValue(after as CalendarValue<M> | null, { writeParts: false });\n }\n\n /**\n * The start and end groups' accessible names. Two `role=\"group\"`s cannot\n * share one id or one name, and `FormControl`'s label can only be\n * associated with one element -- so each group names itself, deriving from\n * `@label` so that the visible label is contained in both names.\n */\n get startLabel(): string {\n return this.args.label ? `${this.args.label} start` : 'start date';\n }\n\n get endLabel(): string {\n return this.args.label ? `${this.args.label} end` : 'end date';\n }\n\n /**\n * The segment that last held focus, so that closing the calendar can hand\n * focus back to where the user was. Recorded from the group's `focusin`\n * rather than captured when the popover opens, because the calendar button\n * is clicked *after* focus has already left the segment.\n */\n private lastFocusedSegment: HTMLElement | null = null;\n\n handleSegmentFocusIn = (event: FocusEvent): void => {\n const target = event.target;\n if (\n target instanceof HTMLElement &&\n target.getAttribute('data-part') === 'segment'\n ) {\n this.lastFocusedSegment = target;\n }\n };\n\n /**\n * Tells an enclosing `Form` the value moved.\n *\n * The hidden inputs are written programmatically, and a programmatic value\n * change fires no `input` event -- so without this the form never learns\n * anything happened. That is worse than stale data: as soon as `Form` holds\n * any data for this field, `Field` binds `@value` back to it -- so without\n * this the form's copy of the value silently diverges from the field's, and\n * a later `@data` change would sync the stale value back in. `Select`\n * dispatches the same event for the same reason.\n */\n private notifyForm(): void {\n triggerFormInputEvent(this.containerRef.current);\n }\n\n /**\n * Wired to the popover's `@onOpenChange`, which also fires for Escape and\n * an outside click -- not only the explicit paths that already call\n * `close()` below. Routing every close through `close()` matters because\n * `Overlay`'s own focus-restore captures `document.activeElement` at the\n * moment its content mounts, which by then is already the day `@autofocus`\n * moved focus onto (that modifier runs before the overlay's own), not the\n * trigger. Left to it, closing would try to restore focus onto a day\n * button that has just been removed from the DOM -- a no-op -- and focus\n * would fall to `<body>`.\n */\n onOpenChange = (isOpen: boolean): void => {\n if (isOpen) {\n this.isOpen = true;\n return;\n }\n this.close();\n };\n\n /**\n * Closing removes the focused day from the DOM, so focus must be handed back\n * explicitly or it falls to `<body>` and the keyboard user loses their place.\n */\n close = (): void => {\n this.isOpen = false;\n this.focusField();\n };\n\n @cached\n get classes() {\n const { datePicker } = useStyles();\n return datePicker({\n size: this.args.inputSize,\n isSegmented: this.isSegmented,\n isRange: this.isSegmented && this.isRangeMode\n });\n }\n\n get isRangeMode(): boolean {\n return this.mode === 'range';\n }\n\n /**\n * The segmented field has no button trigger for a click to fall through to,\n * and its calendar icon is a real button, so the cluster has to take pointer\n * events. An explicit argument still wins.\n */\n get endContentPointerEvents(): 'none' | 'auto' {\n return (\n this.args.endContentPointerEvents ?? (this.isSegmented ? 'auto' : 'none')\n );\n }\n\n /**\n * The single-mode wire value, or `''` when there is nothing selected. Only\n * read from the single-mode branch of the template, so it does not repeat\n * that branch's mode check.\n */\n get wireValue(): string {\n return toWire(this.value as Date | null);\n }\n\n get wireRangeStart(): string {\n return toWire((this.value as DateRange | null)?.start ?? null);\n }\n\n get wireRangeEnd(): string {\n return toWire((this.value as DateRange | null)?.end ?? null);\n }\n\n @cached\n get calendarBlockArg(): DatePickerCalendarArgs<M> {\n return {\n mode: this.mode,\n color: this.args.color,\n value: this.value,\n onChange: this.handleChange,\n locale: this.locale,\n weekStartsOn: this.args.weekStartsOn,\n minValue: this.args.minValue,\n maxValue: this.args.maxValue,\n isDateUnavailable: this.args.isDateUnavailable,\n visibleMonths: this.args.visibleMonths,\n captionLayout: this.args.captionLayout,\n labelledBy: this.args.id,\n autofocus: true\n };\n }\n\n @cached\n get footerBlockArg(): DatePickerFooterArg<M> {\n return {\n // Deliberately `handleChange`, not a bare assignment: a preset must be\n // indistinguishable from a click, so it fires `@onChange` and closes on\n // a complete value exactly the way picking a day does.\n setValue: this.handleChange,\n close: this.close,\n value: this.value,\n isOpen: this.isOpen\n };\n }\n\n <template>\n <div\n {{this.syncSegmentFormat this.locale this.segmentFormat}}\n {{this.syncValue @value}}\n {{this.containerRef.setup}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"date-picker\"\n data-part=\"base\"\n ...attributes\n >\n {{! A range's two names use dot notation, the convention Form documents\n for nested data -- so it arrives at a validator and at onSubmit as one\n { start, end } object rather than two loose keys. }}\n {{#if @name}}\n {{#if this.isRangeMode}}\n <input\n type=\"hidden\"\n name={{concat @name \".start\"}}\n value={{this.wireRangeStart}}\n />\n <input\n type=\"hidden\"\n name={{concat @name \".end\"}}\n value={{this.wireRangeEnd}}\n />\n {{else}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n {{/if}}\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @isDisabled={{@isDisabled}}\n as |c|\n >\n <Popover\n @placement={{@placement}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n @didClose={{@didClose}}\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.onOpenChange}}\n as |p|\n >\n <div\n {{p.anchor}}\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n {{! The shell is on this element when segmented, so its invalid and\n disabled styling has to read from here. `role=\"group\"` inside\n cannot carry aria-invalid, which is why these are data\n attributes. }}\n data-invalid={{if c.isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n >\n {{#if this.isSegmented}}\n {{! Blur tracking and focus recording ride on splattributes:\n the group renders `...attributes` on its `role=\"group\"` element,\n and both events bubble there from the segments. }}\n {{#if this.isRangeMode}}\n {{! Two groups, so neither can take `c.id` or `@label`: ids\n must be unique and a name shared by both would leave a screen\n reader unable to tell the ends apart. Each derives its own\n from the field's. }}\n <SegmentGroup\n @parts={{this.parts}}\n @onPartsChange={{this.handleStartParts}}\n @onRangePaste={{this.handleRangePaste}}\n @locale={{this.locale}}\n @placeholderValue={{this.placeholderValue}}\n @isDisabled={{@isDisabled}}\n @isReadOnly={{@isReadOnly}}\n @isInvalid={{c.isInvalid}}\n @id={{concat c.id \"-start\"}}\n @label={{this.startLabel}}\n @describedBy={{c.describedBy @description c.isInvalid}}\n @segmentLabels={{@segmentLabels}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n {{on \"focusin\" this.handleSegmentFocusIn}}\n {{on \"focusout\" this.blurTracker.handleFocusOut}}\n />\n <span\n data-part=\"separator\"\n aria-hidden=\"true\"\n class={{this.classes.separator class=@classes.separator}}\n >&ndash;</span>\n {{! No `@onRangePaste`: pasting \"20 Jan - 25 Jan\" into the end\n of a range and having it rewrite the start would be\n surprising. }}\n <SegmentGroup\n @parts={{this.endParts}}\n @onPartsChange={{this.handleEndParts}}\n @locale={{this.locale}}\n @placeholderValue={{this.placeholderValue}}\n @isDisabled={{@isDisabled}}\n @isReadOnly={{@isReadOnly}}\n @isInvalid={{c.isInvalid}}\n @id={{concat c.id \"-end\"}}\n @label={{this.endLabel}}\n @describedBy={{c.describedBy @description c.isInvalid}}\n @segmentLabels={{@segmentLabels}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n {{on \"focusin\" this.handleSegmentFocusIn}}\n {{on \"focusout\" this.blurTracker.handleFocusOut}}\n />\n {{else}}\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 {{on \"focusin\" this.handleSegmentFocusIn}}\n {{on \"focusout\" this.blurTracker.handleFocusOut}}\n />\n {{/if}}\n {{else}}\n <DatePickerTrigger\n @id={{c.id}}\n @trigger={{p.trigger}}\n @placeholder={{@placeholder}}\n @formatted={{this.formatted}}\n @isEmpty={{this.isEmpty}}\n @isDisabled={{@isDisabled}}\n @isInvalid={{c.isInvalid}}\n @hasCustomContent={{has-block \"value\"}}\n @accessibleName={{this.accessibleName}}\n @triggerRef={{this.triggerRef.setup}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @onFocusOut={{this.blurTracker.handleFocusOut}}\n >\n <:value>\n {{#if (has-block \"value\")}}\n {{yield this.valueBlockArg to=\"value\"}}\n {{/if}}\n </:value>\n </DatePickerTrigger>\n {{/if}}\n\n <DatePickerEndContent\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @endContentPointerEvents={{this.endContentPointerEvents}}\n @isClearable={{this.isClearable}}\n @onClear={{this.clear}}\n @isEditable={{this.isSegmented}}\n @trigger={{p.trigger}}\n @label={{@label}}\n @isDisabled={{@isDisabled}}\n />\n </div>\n\n {{! preventAutoFocus: overlay's default focus grab runs later()\n after Calendar's autofocus already focused the day; turned off so\n Calendar's autofocus is the only thing moving focus into the grid. }}\n <p.Content\n @size={{if @popoverSize @popoverSize \"auto\"}}\n @target={{@target}}\n @renderInPlace={{@renderInPlace}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @transitionDuration={{@transitionDuration}}\n @disableTransitions={{@disableTransitions}}\n @blockScroll={{false}}\n @preventAutoFocus={{true}}\n {{! Overlay captures document.activeElement when the content\n mounts -- the calendar button, on the segmented path -- and\n refocuses it on teardown, after close() has already put focus back\n on the segment. `close()` is the one answer; this stops the\n overlay giving a second. }}\n @preventFocusRestore={{this.isSegmented}}\n role=\"dialog\"\n aria-label={{@label}}\n >\n {{#if (has-block \"calendar\")}}\n {{yield this.calendarBlockArg to=\"calendar\"}}\n {{else}}\n <Calendar\n @mode={{this.mode}}\n @color={{@color}}\n @value={{this.value}}\n @onChange={{this.handleChange}}\n @locale={{@locale}}\n @weekStartsOn={{@weekStartsOn}}\n @minValue={{@minValue}}\n @maxValue={{@maxValue}}\n @isDateUnavailable={{@isDateUnavailable}}\n @visibleMonths={{@visibleMonths}}\n @captionLayout={{@captionLayout}}\n @fixedWeeks={{@fixedWeeks}}\n @showOutsideDays={{@showOutsideDays}}\n @isReadOnly={{@isReadOnly}}\n @isDisabled={{@isDisabled}}\n @labelledBy={{c.id}}\n @autofocus={{true}}\n @classes={{hash\n base=(this.classes.calendar class=@classes.calendar)\n }}\n data-part=\"calendar\"\n />\n {{/if}}\n\n {{#if (has-block \"footer\")}}\n <div\n data-part=\"footer\"\n class={{this.classes.footer class=@classes.footer}}\n >\n {{yield this.footerBlockArg to=\"footer\"}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n </div>\n </template>\n}\n\nexport { DatePicker, type DatePickerSignature };\nexport default DatePicker;\n"],"names":["DatePicker","Component","triggerRef","ref","containerRef","g","prototype","tracked","i","constructor","owner","args","seed","defaultValue","undefined","internalValue","parseIncoming","writeParts","buildParts","locale","segmentFormat","parts","trackedParts","endParts","trackedEndParts","setParts","setEndParts","value","onto","isRangeMode","fromDate","range","start","end","isSegmented","isEditable","resolveSegmentFormat","formatOptions","message","id","placeholderValue","Date","mode","navigator","language","raw","parseRange","parseDate","syncValue","modifier","_","parsed","segmentsWouldChange","edge","syncSegmentFormat","format","fresh","carryOver","formatted","formatValue","isEmpty","isEmptyValue","valueBlockArg","n","cached","accessibleName","name","label","filter","Boolean","join","blurTracker","ControlBlurTracker","trigger","current","querySelector","container","isOpen","isDestroyed","isDestroying","onBlur","willDestroy","cancel","isClearable","isDisabled","isReadOnly","clear","commitValue","focusField","focusTarget","last","lastFocusedSegment","isConnected","focus","isComplete","onChange","notifyForm","handleChange","close","incoming","hasDateChanged","toDate","composed","rangeFromParts","next","handlePartsChange","before","after","handleStartParts","reportRange","handleEndParts","handleRangePaste","moved","startLabel","endLabel","handleSegmentFocusIn","event","target","HTMLElement","getAttribute","triggerFormInputEvent","onOpenChange","classes","datePicker","useStyles","size","inputSize","isRange","endContentPointerEvents","wireValue","toWire","wireRangeStart","wireRangeEnd","calendarBlockArg","color","weekStartsOn","minValue","maxValue","isDateUnavailable","visibleMonths","captionLayout","labelledBy","autofocus","footerBlockArg","setValue","setComponentTemplate","precompileTemplate","strictMode","scope","concat","FormControl","Popover","SegmentGroup","on","DatePickerTrigger","DatePickerEndContent","Calendar","hash"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqDA;;;;;;;AAOC;AACD,MAAMA,UAAA,SAAsDC,UACtC;EAEpBC,UAAA,GAAaC,KAAI;EACjBC,YAAA,GAAeD,KAAI;AAEnB;;;;;;AAMC;AAND,EAAA;IAAAE,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAOCC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiD,IAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,cAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,eAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAEjDC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA;AAAA,E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