frontile 0.18.5 → 0.18.6

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 (46) hide show
  1. package/declarations/-private/reveal-within.d.ts +19 -0
  2. package/declarations/-private/reveal-within.d.ts.map +1 -0
  3. package/declarations/components/collections/calendar/year-grid.d.ts.map +1 -1
  4. package/declarations/components/forms/date-input/segment-group.d.ts +2 -1
  5. package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -1
  6. package/declarations/components/forms/date-input/segments.d.ts +3 -1
  7. package/declarations/components/forms/date-input/segments.d.ts.map +1 -1
  8. package/declarations/components/forms/date-picker/date-picker.d.ts +119 -1
  9. package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -1
  10. package/declarations/components/forms/date-picker/time-columns.d.ts +87 -0
  11. package/declarations/components/forms/date-picker/time-columns.d.ts.map +1 -0
  12. package/declarations/components/forms/date-picker/types.d.ts +28 -0
  13. package/declarations/components/forms/date-picker/types.d.ts.map +1 -1
  14. package/declarations/components/forms/select/native-mirror.d.ts +3 -2
  15. package/declarations/components/forms/select/native-mirror.d.ts.map +1 -1
  16. package/declarations/components/forms/select/select.d.ts +14 -2
  17. package/declarations/components/forms/select/select.d.ts.map +1 -1
  18. package/declarations/components/forms/select/types.d.ts +3 -2
  19. package/declarations/components/forms/select/types.d.ts.map +1 -1
  20. package/declarations/components/overlays/overlay.d.ts +17 -2
  21. package/declarations/components/overlays/overlay.d.ts.map +1 -1
  22. package/declarations/test-support.d.ts.map +1 -1
  23. package/dist/components/collections/calendar/year-grid.js +1 -30
  24. package/dist/components/collections/calendar/year-grid.js.map +1 -1
  25. package/dist/components/forms/date-input/segment-group.js +1 -1
  26. package/dist/components/forms/date-input/segment-group.js.map +1 -1
  27. package/dist/components/forms/date-input/segments.js +1 -1
  28. package/dist/components/forms/date-input/segments.js.map +1 -1
  29. package/dist/components/forms/date-input.js +1 -1
  30. package/dist/components/forms/date-picker/date-picker.js +57 -6
  31. package/dist/components/forms/date-picker/date-picker.js.map +1 -1
  32. package/dist/components/forms/date-picker/time-columns.js +238 -0
  33. package/dist/components/forms/date-picker/time-columns.js.map +1 -0
  34. package/dist/components/forms/index.js +1 -1
  35. package/dist/components/forms/select/native-mirror.js.map +1 -1
  36. package/dist/components/forms/select/select.js +22 -4
  37. package/dist/components/forms/select/select.js.map +1 -1
  38. package/dist/components/overlays/overlay.js +55 -7
  39. package/dist/components/overlays/overlay.js.map +1 -1
  40. package/dist/forms.js +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/reveal-within-BcqpOmSI.js +33 -0
  43. package/dist/reveal-within-BcqpOmSI.js.map +1 -0
  44. package/dist/test-support.js +3 -1
  45. package/dist/test-support.js.map +1 -1
  46. package/package.json +3 -3
@@ -7,8 +7,9 @@ import { useStyles } from '@frontile/theme';
7
7
  import { FormControl } from '../form-control.js';
8
8
  import { DatePickerTrigger } from './trigger.js';
9
9
  import { DatePickerEndContent } from './end-content.js';
10
- import { SegmentGroup } from '../date-input/segment-group.js';
11
- import { buildParts, fromDate, resolveSegmentFormat, carryOver, timeOf, hasDateChanged, toDate } from '../date-input/segments.js';
10
+ import { DEFAULT_SEGMENT_LABELS as DEFAULT_LABELS$1, SegmentGroup } from '../date-input/segment-group.js';
11
+ import { DatePickerTimeColumns } from './time-columns.js';
12
+ import { buildParts, fromDate, resolveSegmentFormat, carryOver, timeOf, hasDateChanged, toDate, isSegment, withValue, commitSegment, seedFrom } from '../date-input/segments.js';
12
13
  import { Popover } from '../../overlays/popover.js';
13
14
  import { Calendar } from '../../collections/calendar/calendar.js';
14
15
  import { ref } from '../../../utils/ref.js';
@@ -21,8 +22,10 @@ import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMe
21
22
 
22
23
  const DEFAULT_LABELS = {
23
24
  clear: 'Clear',
24
- chooseDate: label => label ? `Choose date, ${label}` : 'Choose date'
25
+ chooseDate: label => label ? `Choose date, ${label}` : 'Choose date',
26
+ time: 'Time'
25
27
  };
28
+ const TIME_TYPES = ['hour', 'minute', 'dayPeriod'];
26
29
  /**
27
30
  * A date field: segments the value can be typed into, a calendar button that
28
31
  * opens a calendar in a popover, and -- under `@isEditable={{false}}` -- the
@@ -159,6 +162,23 @@ class DatePicker extends Component {
159
162
  get hasTime() {
160
163
  return (this.args.granularity ?? 'day') !== 'day';
161
164
  }
165
+ /**
166
+ * Whether the popover lists the time beside the calendar. The columns edit
167
+ * the segments, so there have to be segments, and only one group of them:
168
+ * a range would need two sets of columns, and which end they edit would be
169
+ * one more thing to get across.
170
+ */
171
+ get showsTimeColumns() {
172
+ return this.hasTime && this.isSegmented && !this.isRangeMode && (this.args.showTimeColumns ?? true);
173
+ }
174
+ get minuteStep() {
175
+ const step = this.args.minuteStep ?? 5;
176
+ return Number.isInteger(step) && step >= 1 && step <= 60 ? step : 5;
177
+ }
178
+ get timeLabel() {
179
+ return this.args.labels?.time ?? DEFAULT_LABELS.time;
180
+ }
181
+ columnLabel = type => this.args.segmentLabels?.[type] ?? DEFAULT_LABELS$1[type];
162
182
  get mode() {
163
183
  return this.args.mode ?? 'single';
164
184
  }
@@ -380,7 +400,16 @@ class DatePicker extends Component {
380
400
  return;
381
401
  }
382
402
  if (!this.isRangeMode) {
383
- this.handleChange(withTimeOf(value, this.timeAt('start')));
403
+ const picked = withTimeOf(value, this.timeAt('start'));
404
+ // With the time columns beside it, a day is half the answer: the
405
+ // popover stays open for the time.
406
+ if (this.showsTimeColumns) {
407
+ this.commitValue(picked, {
408
+ writeParts: true
409
+ });
410
+ } else {
411
+ this.handleChange(picked);
412
+ }
384
413
  return;
385
414
  }
386
415
  const range = value;
@@ -441,6 +470,26 @@ class DatePicker extends Component {
441
470
  });
442
471
  };
443
472
  /**
473
+ * An option picked in the time columns. It is written into the segments,
474
+ * the one place the time lives, and reported the way typing is -- so a
475
+ * time picked before any day waits for one, exactly as a typed time does.
476
+ *
477
+ * The other time segments are filled in if they are empty, so that one
478
+ * pick is a time: minutes start on the hour (10 reads as 10:00), the hour
479
+ * and AM/PM at `@placeholderValue`'s, as ArrowUp on an empty segment does.
480
+ * A segment still being typed is committed as it reads.
481
+ */
482
+ handleTimeSelect = (type, value, commit) => {
483
+ const parts = this.#currentParts.map(part => {
484
+ if (!isSegment(part) || !TIME_TYPES.includes(part.type)) return part;
485
+ if (part.type === type) return withValue(part, value);
486
+ if (part.value !== null) return commitSegment(part);
487
+ return withValue(part, part.type === 'minute' ? 0 : seedFrom(part, this.placeholderValue));
488
+ });
489
+ this.handlePartsChange(parts);
490
+ if (commit) this.close();
491
+ };
492
+ /**
444
493
  * The two range groups report separately, but a range is one value: each
445
494
  * one recomposes the whole thing and reports only what moved.
446
495
  */
@@ -564,6 +613,7 @@ class DatePicker extends Component {
564
613
  } = useStyles();
565
614
  return datePicker({
566
615
  size: this.args.inputSize,
616
+ color: this.args.color,
567
617
  isSegmented: this.isSegmented,
568
618
  isRange: this.isSegmented && this.isRangeMode
569
619
  });
@@ -632,7 +682,7 @@ class DatePicker extends Component {
632
682
  decorateMethodV2(this.prototype, "footerBlockArg", [cached]);
633
683
  }
634
684
  static {
635
- setComponentTemplate(precompileTemplate("<div {{this.syncSegmentFormat this.locale this.segmentFormat this.timeOptions}} {{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}} @calendarButtonLabel={{this.calendarButtonLabel}} @clearLabel={{this.clearLabel}} @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.handleCalendarChange}} @locale={{@locale}} @weekStartsOn={{@weekStartsOn}} @minValue={{@minValue}} @maxValue={{@maxValue}} @isDateUnavailable={{@isDateUnavailable}} @visibleMonths={{@visibleMonths}} @captionLayout={{@captionLayout}} @labels={{@labels}} @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>", {
685
+ setComponentTemplate(precompileTemplate("<div {{this.syncSegmentFormat this.locale this.segmentFormat this.timeOptions}} {{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}} @calendarButtonLabel={{this.calendarButtonLabel}} @clearLabel={{this.clearLabel}} @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 <div data-part=\"panels\" class={{this.classes.panels class=@classes.panels}}>\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.handleCalendarChange}} @locale={{@locale}} @weekStartsOn={{@weekStartsOn}} @minValue={{@minValue}} @maxValue={{@maxValue}} @isDateUnavailable={{@isDateUnavailable}} @visibleMonths={{@visibleMonths}} @captionLayout={{@captionLayout}} @labels={{@labels}} @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 {{#if this.showsTimeColumns}}\n <DatePickerTimeColumns @parts={{this.parts}} @minuteStep={{this.minuteStep}} @placeholderValue={{this.placeholderValue}} @label={{this.timeLabel}} @columnLabel={{this.columnLabel}} @idPrefix={{concat c.id \"-time\"}} @isReadOnly={{@isReadOnly}} @onSelect={{this.handleTimeSelect}} @classes={{this.classes}} @userClasses={{@classes}} />\n {{/if}}\n </div>\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>", {
636
686
  strictMode: true,
637
687
  scope: () => ({
638
688
  concat,
@@ -643,7 +693,8 @@ class DatePicker extends Component {
643
693
  DatePickerTrigger,
644
694
  DatePickerEndContent,
645
695
  Calendar,
646
- hash
696
+ hash,
697
+ DatePickerTimeColumns
647
698
  })
648
699
  }), this);
649
700
  }
@@ -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 { 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 timeOf\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 withTimeOf,\n DEFAULT_TIME_FORMAT\n} from './value';\nimport type {\n CalendarMode,\n CalendarValue,\n DateRange\n} from '../../collections/calendar/types';\nimport type { Part, TimeOptions } from '../date-input/types';\nimport type {\n DatePickerArgs,\n DatePickerLabels,\n DatePickerValueBlockArg,\n DatePickerCalendarArgs,\n DatePickerFooterArg\n} from './types';\n\n/**\n * The picker's own texts. The calendar's are left to `Calendar`, which owns\n * their defaults: `@labels` is handed to it as it is.\n */\nconst DEFAULT_LABELS: Pick<DatePickerLabels, 'clear' | 'chooseDate'> = {\n clear: 'Clear',\n chooseDate: (label) => (label ? `Choose date, ${label}` : 'Choose date')\n};\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, this.timeOptions)\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 /** 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 get hasTime(): boolean {\n return (this.args.granularity ?? 'day') !== 'day';\n }\n\n get mode(): M {\n return (this.args as { mode?: M }).mode ?? ('single' as M);\n }\n\n get clearLabel(): string {\n return this.args.labels?.clear ?? DEFAULT_LABELS.clear;\n }\n\n get calendarButtonLabel(): string {\n return (this.args.labels?.chooseDate ?? DEFAULT_LABELS.chooseDate)(\n this.args.label\n );\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, time]: [\n string,\n Intl.DateTimeFormatOptions | undefined,\n TimeOptions\n ]\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, time);\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(\n this.value,\n this.locale,\n this.args.formatOptions ??\n (this.hasTime ? DEFAULT_TIME_FORMAT : undefined)\n );\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 * A day picked in the calendar. The calendar knows days only, so under an\n * `hour` or `minute` granularity the pick takes the time the field already\n * shows -- each end of a range its own -- or midnight when there is none.\n */\n handleCalendarChange = (value: CalendarValue<M>): void => {\n if (!this.hasTime || !value) {\n this.handleChange(value);\n return;\n }\n\n if (!this.isRangeMode) {\n this.handleChange(\n withTimeOf(value as Date, this.timeAt('start')) as never\n );\n return;\n }\n\n const range = value as DateRange;\n this.handleChange({\n start: withTimeOf(range.start, this.timeAt('start')),\n end: range.end ? withTimeOf(range.end, this.timeAt('end')) : null\n } as never);\n };\n\n /**\n * The time one end of the field holds: what its segments show -- typed in\n * even before any day was -- or, on the button trigger, which has no\n * segments, the current value's. Midnight when there is none.\n */\n private timeAt(edge: 'start' | 'end'): { hours: number; minutes: number } {\n const midnight = { hours: 0, minutes: 0 };\n\n if (this.isSegmented) {\n const parts =\n edge === 'start' ? this.#currentParts : this.#currentEndParts;\n return timeOf(parts) ?? midnight;\n }\n\n const value = this.value;\n const date = this.isRangeMode\n ? (value as DateRange | null)?.[edge]\n : (value as Date | null);\n return date\n ? { hours: date.getHours(), minutes: date.getMinutes() }\n : midnight;\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, this.args.granularity);\n }\n\n get wireRangeStart(): string {\n return toWire(\n (this.value as DateRange | null)?.start ?? null,\n this.args.granularity\n );\n }\n\n get wireRangeEnd(): string {\n return toWire(\n (this.value as DateRange | null)?.end ?? null,\n this.args.granularity\n );\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.handleCalendarChange,\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 labels: this.args.labels,\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 this.timeOptions}}\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 @calendarButtonLabel={{this.calendarButtonLabel}}\n @clearLabel={{this.clearLabel}}\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.handleCalendarChange}}\n @locale={{@locale}}\n @weekStartsOn={{@weekStartsOn}}\n @minValue={{@minValue}}\n @maxValue={{@maxValue}}\n @isDateUnavailable={{@isDateUnavailable}}\n @visibleMonths={{@visibleMonths}}\n @captionLayout={{@captionLayout}}\n @labels={{@labels}}\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":["DEFAULT_LABELS","clear","chooseDate","label","DatePicker","Component","triggerRef","ref","containerRef","g","prototype","tracked","i","constructor","owner","args","seed","defaultValue","undefined","internalValue","parseIncoming","writeParts","buildParts","locale","segmentFormat","timeOptions","parts","trackedParts","endParts","trackedEndParts","setParts","setEndParts","value","onto","isRangeMode","fromDate","range","start","end","isSegmented","isEditable","resolveSegmentFormat","formatOptions","message","id","placeholderValue","Date","granularity","hourCycle","n","cached","hasTime","mode","clearLabel","labels","calendarButtonLabel","navigator","language","raw","parseRange","parseDate","syncValue","modifier","_","parsed","segmentsWouldChange","edge","syncSegmentFormat","format","time","fresh","carryOver","formatted","formatValue","DEFAULT_TIME_FORMAT","isEmpty","isEmptyValue","valueBlockArg","accessibleName","name","filter","Boolean","join","blurTracker","ControlBlurTracker","trigger","current","querySelector","container","isOpen","isDestroyed","isDestroying","onBlur","willDestroy","cancel","isClearable","isDisabled","isReadOnly","commitValue","focusField","focusTarget","last","lastFocusedSegment","isConnected","focus","isComplete","onChange","notifyForm","handleChange","close","handleCalendarChange","withTimeOf","timeAt","midnight","hours","minutes","timeOf","date","getHours","getMinutes","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","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AD;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 {\n SegmentGroup,\n DEFAULT_SEGMENT_LABELS\n} from '../date-input/segment-group';\nimport { DatePickerTimeColumns } from './time-columns';\nimport {\n buildParts,\n toDate,\n fromDate,\n carryOver,\n resolveSegmentFormat,\n hasDateChanged,\n timeOf,\n isSegment,\n withValue,\n commitSegment,\n seedFrom\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 withTimeOf,\n DEFAULT_TIME_FORMAT\n} from './value';\nimport type {\n CalendarMode,\n CalendarValue,\n DateRange\n} from '../../collections/calendar/types';\nimport type { Part, SegmentType, TimeOptions } from '../date-input/types';\nimport type {\n DatePickerArgs,\n DatePickerLabels,\n DatePickerValueBlockArg,\n DatePickerCalendarArgs,\n DatePickerFooterArg\n} from './types';\n\n/**\n * The picker's own texts. The calendar's are left to `Calendar`, which owns\n * their defaults: `@labels` is handed to it as it is.\n */\nconst DEFAULT_LABELS: Pick<DatePickerLabels, 'clear' | 'chooseDate' | 'time'> =\n {\n clear: 'Clear',\n chooseDate: (label) => (label ? `Choose date, ${label}` : 'Choose date'),\n time: 'Time'\n };\n\nconst TIME_TYPES: SegmentType[] = ['hour', 'minute', 'dayPeriod'];\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, this.timeOptions)\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 /** 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 get hasTime(): boolean {\n return (this.args.granularity ?? 'day') !== 'day';\n }\n\n /**\n * Whether the popover lists the time beside the calendar. The columns edit\n * the segments, so there have to be segments, and only one group of them:\n * a range would need two sets of columns, and which end they edit would be\n * one more thing to get across.\n */\n get showsTimeColumns(): boolean {\n return (\n this.hasTime &&\n this.isSegmented &&\n !this.isRangeMode &&\n (this.args.showTimeColumns ?? true)\n );\n }\n\n get minuteStep(): number {\n const step = this.args.minuteStep ?? 5;\n return Number.isInteger(step) && step >= 1 && step <= 60 ? step : 5;\n }\n\n get timeLabel(): string {\n return this.args.labels?.time ?? DEFAULT_LABELS.time;\n }\n\n columnLabel = (type: SegmentType): string =>\n this.args.segmentLabels?.[type] ?? DEFAULT_SEGMENT_LABELS[type];\n\n get mode(): M {\n return (this.args as { mode?: M }).mode ?? ('single' as M);\n }\n\n get clearLabel(): string {\n return this.args.labels?.clear ?? DEFAULT_LABELS.clear;\n }\n\n get calendarButtonLabel(): string {\n return (this.args.labels?.chooseDate ?? DEFAULT_LABELS.chooseDate)(\n this.args.label\n );\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, time]: [\n string,\n Intl.DateTimeFormatOptions | undefined,\n TimeOptions\n ]\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, time);\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(\n this.value,\n this.locale,\n this.args.formatOptions ??\n (this.hasTime ? DEFAULT_TIME_FORMAT : undefined)\n );\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 * A day picked in the calendar. The calendar knows days only, so under an\n * `hour` or `minute` granularity the pick takes the time the field already\n * shows -- each end of a range its own -- or midnight when there is none.\n */\n handleCalendarChange = (value: CalendarValue<M>): void => {\n if (!this.hasTime || !value) {\n this.handleChange(value);\n return;\n }\n\n if (!this.isRangeMode) {\n const picked = withTimeOf(value as Date, this.timeAt('start')) as never;\n // With the time columns beside it, a day is half the answer: the\n // popover stays open for the time.\n if (this.showsTimeColumns) {\n this.commitValue(picked, { writeParts: true });\n } else {\n this.handleChange(picked);\n }\n return;\n }\n\n const range = value as DateRange;\n this.handleChange({\n start: withTimeOf(range.start, this.timeAt('start')),\n end: range.end ? withTimeOf(range.end, this.timeAt('end')) : null\n } as never);\n };\n\n /**\n * The time one end of the field holds: what its segments show -- typed in\n * even before any day was -- or, on the button trigger, which has no\n * segments, the current value's. Midnight when there is none.\n */\n private timeAt(edge: 'start' | 'end'): { hours: number; minutes: number } {\n const midnight = { hours: 0, minutes: 0 };\n\n if (this.isSegmented) {\n const parts =\n edge === 'start' ? this.#currentParts : this.#currentEndParts;\n return timeOf(parts) ?? midnight;\n }\n\n const value = this.value;\n const date = this.isRangeMode\n ? (value as DateRange | null)?.[edge]\n : (value as Date | null);\n return date\n ? { hours: date.getHours(), minutes: date.getMinutes() }\n : midnight;\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 * An option picked in the time columns. It is written into the segments,\n * the one place the time lives, and reported the way typing is -- so a\n * time picked before any day waits for one, exactly as a typed time does.\n *\n * The other time segments are filled in if they are empty, so that one\n * pick is a time: minutes start on the hour (10 reads as 10:00), the hour\n * and AM/PM at `@placeholderValue`'s, as ArrowUp on an empty segment does.\n * A segment still being typed is committed as it reads.\n */\n handleTimeSelect = (\n type: SegmentType,\n value: number,\n commit: boolean\n ): void => {\n const parts = this.#currentParts.map((part) => {\n if (!isSegment(part) || !TIME_TYPES.includes(part.type)) return part;\n if (part.type === type) return withValue(part, value);\n if (part.value !== null) return commitSegment(part);\n\n return withValue(\n part,\n part.type === 'minute' ? 0 : seedFrom(part, this.placeholderValue)\n );\n });\n\n this.handlePartsChange(parts);\n if (commit) this.close();\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 color: this.args.color,\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, this.args.granularity);\n }\n\n get wireRangeStart(): string {\n return toWire(\n (this.value as DateRange | null)?.start ?? null,\n this.args.granularity\n );\n }\n\n get wireRangeEnd(): string {\n return toWire(\n (this.value as DateRange | null)?.end ?? null,\n this.args.granularity\n );\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.handleCalendarChange,\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 labels: this.args.labels,\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 this.timeOptions}}\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 @calendarButtonLabel={{this.calendarButtonLabel}}\n @clearLabel={{this.clearLabel}}\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 <div\n data-part=\"panels\"\n class={{this.classes.panels class=@classes.panels}}\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.handleCalendarChange}}\n @locale={{@locale}}\n @weekStartsOn={{@weekStartsOn}}\n @minValue={{@minValue}}\n @maxValue={{@maxValue}}\n @isDateUnavailable={{@isDateUnavailable}}\n @visibleMonths={{@visibleMonths}}\n @captionLayout={{@captionLayout}}\n @labels={{@labels}}\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 {{#if this.showsTimeColumns}}\n <DatePickerTimeColumns\n @parts={{this.parts}}\n @minuteStep={{this.minuteStep}}\n @placeholderValue={{this.placeholderValue}}\n @label={{this.timeLabel}}\n @columnLabel={{this.columnLabel}}\n @idPrefix={{concat c.id \"-time\"}}\n @isReadOnly={{@isReadOnly}}\n @onSelect={{this.handleTimeSelect}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n />\n {{/if}}\n </div>\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":["DEFAULT_LABELS","clear","chooseDate","label","time","TIME_TYPES","DatePicker","Component","triggerRef","ref","containerRef","g","prototype","tracked","i","constructor","owner","args","seed","defaultValue","undefined","internalValue","parseIncoming","writeParts","buildParts","locale","segmentFormat","timeOptions","parts","trackedParts","endParts","trackedEndParts","setParts","setEndParts","value","onto","isRangeMode","fromDate","range","start","end","isSegmented","isEditable","resolveSegmentFormat","formatOptions","message","id","placeholderValue","Date","granularity","hourCycle","n","cached","hasTime","showsTimeColumns","showTimeColumns","minuteStep","step","Number","isInteger","timeLabel","labels","columnLabel","type","segmentLabels","DEFAULT_SEGMENT_LABELS","mode","clearLabel","calendarButtonLabel","navigator","language","raw","parseRange","parseDate","syncValue","modifier","_","parsed","segmentsWouldChange","edge","syncSegmentFormat","format","fresh","carryOver","formatted","formatValue","DEFAULT_TIME_FORMAT","isEmpty","isEmptyValue","valueBlockArg","accessibleName","name","filter","Boolean","join","blurTracker","ControlBlurTracker","trigger","current","querySelector","container","isOpen","isDestroyed","isDestroying","onBlur","willDestroy","cancel","isClearable","isDisabled","isReadOnly","commitValue","focusField","focusTarget","last","lastFocusedSegment","isConnected","focus","isComplete","onChange","notifyForm","handleChange","close","handleCalendarChange","picked","withTimeOf","timeAt","midnight","hours","minutes","timeOf","date","getHours","getMinutes","incoming","hasDateChanged","toDate","composed","rangeFromParts","next","handlePartsChange","before","after","handleTimeSelect","commit","map","part","isSegment","includes","withValue","commitSegment","seedFrom","handleStartParts","reportRange","handleEndParts","handleRangePaste","moved","startLabel","endLabel","handleSegmentFocusIn","event","target","HTMLElement","getAttribute","triggerFormInputEvent","onOpenChange","classes","datePicker","useStyles","size","inputSize","color","isRange","endContentPointerEvents","wireValue","toWire","wireRangeStart","wireRangeEnd","calendarBlockArg","weekStartsOn","minValue","maxValue","isDateUnavailable","visibleMonths","captionLayout","labelledBy","autofocus","footerBlockArg","setValue","setComponentTemplate","precompileTemplate","strictMode","scope","concat","FormControl","Popover","SegmentGroup","on","DatePickerTrigger","Dat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