frontile 0.18.0-beta.1 → 0.18.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/declarations/-private/deprecated-args.d.ts +18 -0
  2. package/declarations/-private/notification.d.ts +4 -4
  3. package/declarations/-private/types.d.ts +10 -8
  4. package/declarations/components/buttons/button-group.d.ts +3 -1
  5. package/declarations/components/buttons/button.d.ts +12 -3
  6. package/declarations/components/buttons/chip.d.ts +15 -8
  7. package/declarations/components/buttons/close-button.d.ts +5 -2
  8. package/declarations/components/buttons/segmented-control/segmented-control.d.ts +9 -9
  9. package/declarations/components/buttons/toggle-button.d.ts +9 -1
  10. package/declarations/components/collections/calendar/calendar.d.ts +49 -49
  11. package/declarations/components/collections/calendar/utils.d.ts +1 -0
  12. package/declarations/components/collections/dropdown/dropdown.d.ts +13 -2
  13. package/declarations/components/collections/dropdown/menu-context.d.ts +3 -3
  14. package/declarations/components/collections/listbox/group.d.ts +7 -2
  15. package/declarations/components/collections/listbox/item.d.ts +27 -6
  16. package/declarations/components/collections/listbox/listbox.d.ts +31 -4
  17. package/declarations/components/collections/simple-table/body.d.ts +68 -68
  18. package/declarations/components/collections/simple-table/cell.d.ts +68 -68
  19. package/declarations/components/collections/simple-table/column.d.ts +68 -68
  20. package/declarations/components/collections/simple-table/footer.d.ts +68 -68
  21. package/declarations/components/collections/simple-table/header.d.ts +68 -68
  22. package/declarations/components/collections/simple-table/index.d.ts +68 -68
  23. package/declarations/components/collections/simple-table/row.d.ts +68 -68
  24. package/declarations/components/collections/table/column-visibility.d.ts +68 -68
  25. package/declarations/components/collections/table/sort-button.d.ts +68 -68
  26. package/declarations/components/collections/table/table.d.ts +68 -68
  27. package/declarations/components/disclosure/accordion/accordion.d.ts +23 -23
  28. package/declarations/components/forms/autocomplete.d.ts +24 -12
  29. package/declarations/components/forms/date-picker/date-picker.d.ts +268 -0
  30. package/declarations/components/forms/date-picker/end-content.d.ts +29 -0
  31. package/declarations/components/forms/date-picker/trigger.d.ts +40 -0
  32. package/declarations/components/forms/date-picker/types.d.ts +149 -0
  33. package/declarations/components/forms/date-picker/value.d.ts +43 -0
  34. package/declarations/components/forms/date-picker.d.ts +3 -0
  35. package/declarations/components/forms/field.d.ts +5 -0
  36. package/declarations/components/forms/form-control.d.ts +1 -1
  37. package/declarations/components/forms/form-feedback.d.ts +17 -2
  38. package/declarations/components/forms/icons.d.ts +4 -1
  39. package/declarations/components/forms/index.d.ts +2 -0
  40. package/declarations/components/forms/input.d.ts +10 -10
  41. package/declarations/components/forms/native-select.d.ts +7 -7
  42. package/declarations/components/forms/select/select.d.ts +30 -17
  43. package/declarations/components/forms/select/types.d.ts +42 -12
  44. package/declarations/components/forms/switch.d.ts +22 -18
  45. package/declarations/components/forms/textarea.d.ts +6 -6
  46. package/declarations/components/navigation/pagination/pagination.d.ts +18 -18
  47. package/declarations/components/navigation/tab-nav/tab-nav.d.ts +12 -12
  48. package/declarations/components/navigation/tabs/tabs.d.ts +12 -12
  49. package/declarations/components/notifications/index.d.ts +2 -2
  50. package/declarations/components/notifications/notification-card.d.ts +5 -5
  51. package/declarations/components/notifications/notifications-container.d.ts +2 -2
  52. package/declarations/components/overlays/drawer.d.ts +32 -32
  53. package/declarations/components/overlays/popover.d.ts +1 -1
  54. package/declarations/components/overlays/tooltip.d.ts +2 -2
  55. package/declarations/components/status/alert.d.ts +10 -10
  56. package/declarations/components/status/progress-bar.d.ts +5 -1
  57. package/declarations/components/utilities/kbd.d.ts +4 -4
  58. package/declarations/components/utilities/spinner.d.ts +14 -7
  59. package/declarations/index.d.ts +1 -1
  60. package/declarations/template-registry.d.ts +2 -1
  61. package/dist/components/buttons/button-group.js +26 -1
  62. package/dist/components/buttons/button-group.js.map +1 -1
  63. package/dist/components/buttons/button.js +21 -2
  64. package/dist/components/buttons/button.js.map +1 -1
  65. package/dist/components/buttons/chip.js +19 -2
  66. package/dist/components/buttons/chip.js.map +1 -1
  67. package/dist/components/buttons/close-button.js +17 -1
  68. package/dist/components/buttons/close-button.js.map +1 -1
  69. package/dist/components/buttons/segmented-control/segmented-control.js +1 -1
  70. package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
  71. package/dist/components/buttons/toggle-button.js +36 -2
  72. package/dist/components/buttons/toggle-button.js.map +1 -1
  73. package/dist/components/collections/calendar/calendar.js +36 -3
  74. package/dist/components/collections/calendar/calendar.js.map +1 -1
  75. package/dist/components/collections/calendar/utils.js +1 -1
  76. package/dist/components/collections/calendar/utils.js.map +1 -1
  77. package/dist/components/collections/command/footer.js +1 -1
  78. package/dist/components/collections/command/footer.js.map +1 -1
  79. package/dist/components/collections/command/list.js +1 -1
  80. package/dist/components/collections/command/list.js.map +1 -1
  81. package/dist/components/collections/dropdown/dropdown.js +45 -7
  82. package/dist/components/collections/dropdown/dropdown.js.map +1 -1
  83. package/dist/components/collections/dropdown/menu-context.js.map +1 -1
  84. package/dist/components/collections/listbox/group.js +1 -1
  85. package/dist/components/collections/listbox/group.js.map +1 -1
  86. package/dist/components/collections/listbox/item.js +47 -8
  87. package/dist/components/collections/listbox/item.js.map +1 -1
  88. package/dist/components/collections/listbox/listbox.js +53 -2
  89. package/dist/components/collections/listbox/listbox.js.map +1 -1
  90. package/dist/components/collections/table/column-visibility.js +1 -1
  91. package/dist/components/collections/table/column-visibility.js.map +1 -1
  92. package/dist/components/disclosure/accordion/accordion.js.map +1 -1
  93. package/dist/components/forms/autocomplete.js +47 -2
  94. package/dist/components/forms/autocomplete.js.map +1 -1
  95. package/dist/components/forms/date-picker/date-picker.js +301 -0
  96. package/dist/components/forms/date-picker/date-picker.js.map +1 -0
  97. package/dist/components/forms/date-picker/end-content.js +21 -0
  98. package/dist/components/forms/date-picker/end-content.js.map +1 -0
  99. package/dist/components/forms/date-picker/trigger.js +14 -0
  100. package/dist/components/forms/date-picker/trigger.js.map +1 -0
  101. package/dist/components/forms/date-picker/types.js +2 -0
  102. package/dist/components/forms/date-picker/types.js.map +1 -0
  103. package/dist/components/forms/date-picker/value.js +97 -0
  104. package/dist/components/forms/date-picker/value.js.map +1 -0
  105. package/dist/components/forms/date-picker.js +2 -0
  106. package/dist/components/forms/date-picker.js.map +1 -0
  107. package/dist/components/forms/field.js +3 -1
  108. package/dist/components/forms/field.js.map +1 -1
  109. package/dist/components/forms/form-control.js +1 -1
  110. package/dist/components/forms/form-control.js.map +1 -1
  111. package/dist/components/forms/form-feedback.js +25 -2
  112. package/dist/components/forms/form-feedback.js.map +1 -1
  113. package/dist/components/forms/icons.js +4 -1
  114. package/dist/components/forms/icons.js.map +1 -1
  115. package/dist/components/forms/index.js +2 -0
  116. package/dist/components/forms/index.js.map +1 -1
  117. package/dist/components/forms/input.js +1 -1
  118. package/dist/components/forms/input.js.map +1 -1
  119. package/dist/components/forms/select/end-content.js +1 -1
  120. package/dist/components/forms/select/end-content.js.map +1 -1
  121. package/dist/components/forms/select/select.js +61 -7
  122. package/dist/components/forms/select/select.js.map +1 -1
  123. package/dist/components/forms/select/selected-items.js +1 -1
  124. package/dist/components/forms/select/selected-items.js.map +1 -1
  125. package/dist/components/forms/switch.js +9 -1
  126. package/dist/components/forms/switch.js.map +1 -1
  127. package/dist/components/navigation/pagination/pagination.js +1 -1
  128. package/dist/components/navigation/pagination/pagination.js.map +1 -1
  129. package/dist/components/navigation/tab-nav/tab-nav.js +1 -1
  130. package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
  131. package/dist/components/navigation/tabs/tabs.js +1 -1
  132. package/dist/components/navigation/tabs/tabs.js.map +1 -1
  133. package/dist/components/notifications/index.js +2 -2
  134. package/dist/components/notifications/notification-card.js +1 -1
  135. package/dist/components/notifications/notifications-container.js +1 -1
  136. package/dist/components/notifications/notifications-container.js.map +1 -1
  137. package/dist/components/overlays/drawer.js +3 -3
  138. package/dist/components/overlays/drawer.js.map +1 -1
  139. package/dist/components/overlays/popover.js.map +1 -1
  140. package/dist/components/overlays/tooltip.js +1 -1
  141. package/dist/components/overlays/tooltip.js.map +1 -1
  142. package/dist/components/status/alert.js +19 -15
  143. package/dist/components/status/alert.js.map +1 -1
  144. package/dist/components/status/progress-bar.js +9 -1
  145. package/dist/components/status/progress-bar.js.map +1 -1
  146. package/dist/components/utilities/kbd.js +2 -2
  147. package/dist/components/utilities/kbd.js.map +1 -1
  148. package/dist/components/utilities/spinner.js +26 -7
  149. package/dist/components/utilities/spinner.js.map +1 -1
  150. package/dist/deprecated-args-BIUjLA8y.js +32 -0
  151. package/dist/deprecated-args-BIUjLA8y.js.map +1 -0
  152. package/dist/forms.js +2 -0
  153. package/dist/forms.js.map +1 -1
  154. package/dist/index.js +4 -2
  155. package/dist/index.js.map +1 -1
  156. package/dist/{manager-CDIZzrQ9.js → manager-B-PnYqDs.js} +28 -22
  157. package/dist/manager-B-PnYqDs.js.map +1 -0
  158. package/dist/{notification-card-BHTra4Zh.js → notification-card-CYmWQ35W.js} +25 -22
  159. package/dist/notification-card-CYmWQ35W.js.map +1 -0
  160. package/dist/notifications.js +2 -2
  161. package/dist/services/notifications.js +1 -1
  162. package/package.json +3 -3
  163. package/dist/manager-CDIZzrQ9.js.map +0 -1
  164. package/dist/notification-card-BHTra4Zh.js.map +0 -1
@@ -0,0 +1,301 @@
1
+ import Component from '@glimmer/component';
2
+ import { tracked, cached } from '@glimmer/tracking';
3
+ import { modifier } from 'ember-modifier';
4
+ import { hash, concat } from '@ember/helper';
5
+ import { useStyles } from '@frontile/theme';
6
+ import { FormControl } from '../form-control.js';
7
+ import { DatePickerTrigger } from './trigger.js';
8
+ import { DatePickerEndContent } from './end-content.js';
9
+ import { Popover } from '../../overlays/popover.js';
10
+ import { Calendar } from '../../collections/calendar/calendar.js';
11
+ import { ref } from '../../../utils/ref.js';
12
+ import { C as ControlBlurTracker } from '../../../control-blur-C8OnSQR5.js';
13
+ import { triggerFormInputEvent } from '../../../utils/forms-utils-index.js';
14
+ import { parseRange, parseDate, formatValue, isEmptyValue, toWire } from './value.js';
15
+ import { precompileTemplate } from '@ember/template-compilation';
16
+ import { setComponentTemplate } from '@ember/component';
17
+ import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
18
+
19
+ /**
20
+ * A date field: a button trigger showing the formatted value, and a calendar
21
+ * in a popover. `@mode="range"` switches both the calendar and the value shape
22
+ * to a `{ start, end }` range.
23
+ */
24
+ class DatePicker extends Component {
25
+ triggerRef = ref();
26
+ containerRef = ref();
27
+ /**
28
+ * The selection. Seeded from `@defaultValue`, updated by the user, and
29
+ * synced from `@value` by {@link syncValue} whenever that argument changes.
30
+ *
31
+ * Everything renders from here rather than from `@value` directly -- see
32
+ * {@link value} for why a read-through cannot work inside a `Form`.
33
+ */
34
+ static {
35
+ decorateFieldV2(this.prototype, "internalValue", [tracked], function () {
36
+ return null;
37
+ });
38
+ }
39
+ #internalValue = (initializeDeferredDecorator(this, "internalValue"), void 0);
40
+ static {
41
+ decorateFieldV2(this.prototype, "isOpen", [tracked], function () {
42
+ return false;
43
+ });
44
+ }
45
+ #isOpen = (initializeDeferredDecorator(this, "isOpen"), void 0);
46
+ constructor(owner, args) {
47
+ super(owner, args);
48
+ const seed = args.defaultValue;
49
+ if (seed !== undefined) {
50
+ this.internalValue = this.parseIncoming(seed);
51
+ }
52
+ }
53
+ get mode() {
54
+ return this.args.mode ?? 'single';
55
+ }
56
+ get locale() {
57
+ return this.args.locale ?? navigator.language;
58
+ }
59
+ /**
60
+ * The rendered value is always internal state, never a read-through to
61
+ * `@value`; {@link syncValue} pushes `@value` into it whenever the argument
62
+ * changes. This is the pattern `Select` uses, and reading through instead
63
+ * deadlocks the component inside a `Form`: `Field` binds `@value` to the
64
+ * form's data, the form's data comes from hidden inputs this component
65
+ * renders, and those inputs would then render the very value they source.
66
+ * Nothing could ever change it, so every pick after the first submit was
67
+ * silently discarded.
68
+ */
69
+ get value() {
70
+ return this.internalValue;
71
+ }
72
+ /** Normalizes whatever `@value` / `@defaultValue` was given to `Date`s. */
73
+ parseIncoming(raw) {
74
+ if (this.mode === 'range') {
75
+ return parseRange(raw);
76
+ }
77
+ return parseDate(raw);
78
+ }
79
+ /**
80
+ * Pushes `@value` into internal state when the argument changes. `undefined`
81
+ * is ignored so that an uncontrolled picker -- and one bound by `Field`
82
+ * before the form holds anything for it -- keeps whatever the user chose.
83
+ */
84
+ syncValue = modifier((_, [raw]) => {
85
+ if (raw !== undefined) {
86
+ this.internalValue = this.parseIncoming(raw);
87
+ }
88
+ });
89
+ get formatted() {
90
+ return formatValue(this.value, this.locale, this.args.formatOptions);
91
+ }
92
+ get isEmpty() {
93
+ return isEmptyValue(this.value);
94
+ }
95
+ get valueBlockArg() {
96
+ return {
97
+ value: this.value,
98
+ formatted: this.formatted,
99
+ isEmpty: this.isEmpty
100
+ };
101
+ }
102
+ /**
103
+ * Names the trigger when a `:value` block owns its content. Falls back to
104
+ * the formatted value alone rather than prefixing a hardcoded English
105
+ * string when there is no `@label`. `undefined` (not `''`) when neither is
106
+ * present, so the trigger omits `aria-label` entirely rather than setting
107
+ * it to an empty string -- some assistive tech treats a present-but-empty
108
+ * `aria-label` as overriding the visible text with nothing, leaving the
109
+ * button unnamed.
110
+ */
111
+ static {
112
+ decorateMethodV2(this.prototype, "valueBlockArg", [cached]);
113
+ }
114
+ get accessibleName() {
115
+ const name = [this.args.label, this.formatted].filter(Boolean).join(', ');
116
+ return name === '' ? undefined : name;
117
+ }
118
+ /**
119
+ * Reports focus leaving the *whole* control -- the field and its portaled
120
+ * popover -- rather than the trigger, which blurs on the way into the
121
+ * calendar and on every day click.
122
+ */
123
+ blurTracker = new ControlBlurTracker({
124
+ trigger: () => this.triggerRef.current,
125
+ container: () => this.containerRef.current,
126
+ isOpen: () => this.isOpen,
127
+ isDestroyed: () => this.isDestroyed || this.isDestroying,
128
+ onBlur: () => this.args.onBlur?.()
129
+ });
130
+ willDestroy() {
131
+ super.willDestroy();
132
+ // Nothing may resolve against a destroyed component.
133
+ this.blurTracker.cancel();
134
+ }
135
+ /**
136
+ * Whether the clear button takes the calendar icon's place. A disabled or
137
+ * read-only field never shows it: the end-content cluster is not
138
+ * pointer-transparent to it and it carries no disabled/read-only state of
139
+ * its own, so it would otherwise be a live button that clears a field the
140
+ * user may not change -- the same contract `Calendar` enforces for day
141
+ * selection under `@isReadOnly`.
142
+ */
143
+ get isClearable() {
144
+ return Boolean(this.args.isClearable) && !this.isEmpty && !this.args.isDisabled && !this.args.isReadOnly;
145
+ }
146
+ /**
147
+ * Clearing removes the clear button from the DOM (`isClearable` flips
148
+ * false the instant the value is gone), so -- like `close()` -- focus must
149
+ * be handed back to the trigger explicitly or it falls to `<body>`.
150
+ *
151
+ * Unlike `close()`, clearing deliberately leaves an open popover open: the
152
+ * clear button lives outside the popover entirely, so there is no
153
+ * dangling-focus reason to dismiss the calendar, and a user who just
154
+ * cleared the field is a user who likely wants to pick a new date right
155
+ * away -- closing would just make them reopen it.
156
+ */
157
+ clear = () => {
158
+ this.internalValue = null;
159
+ this.args.onChange?.(null);
160
+ this.notifyForm();
161
+ this.triggerRef.current?.focus();
162
+ };
163
+ /**
164
+ * Whether the selection is finished, and the popover should therefore close.
165
+ * A range with only its anchor set is not: the user still owes a second
166
+ * click, and closing would throw away the half they just made.
167
+ */
168
+ isComplete(value) {
169
+ if (!value) return false;
170
+ if (this.mode !== 'range') return true;
171
+ return value.end !== null;
172
+ }
173
+ handleChange = value => {
174
+ // Internal state updates even when controlled, so the calendar's own
175
+ // rendering stays responsive; the `value` getter ignores it in that case,
176
+ // so the consumer still has the last word.
177
+ this.internalValue = value;
178
+ this.args.onChange?.(value);
179
+ this.notifyForm();
180
+ if (this.isComplete(value)) this.close();
181
+ };
182
+ /**
183
+ * Tells an enclosing `Form` the value moved.
184
+ *
185
+ * The hidden inputs are written programmatically, and a programmatic value
186
+ * change fires no `input` event -- so without this the form never learns
187
+ * anything happened. That is worse than stale data: as soon as `Form` holds
188
+ * any data for this field, `Field` binds `@value` back to it -- so without
189
+ * this the form's copy of the value silently diverges from the field's, and
190
+ * a later `@data` change would sync the stale value back in. `Select`
191
+ * dispatches the same event for the same reason.
192
+ */
193
+ notifyForm() {
194
+ triggerFormInputEvent(this.containerRef.current);
195
+ }
196
+ /**
197
+ * Wired to the popover's `@onOpenChange`, which also fires for Escape and
198
+ * an outside click -- not only the explicit paths that already call
199
+ * `close()` below. Routing every close through `close()` matters because
200
+ * `Overlay`'s own focus-restore captures `document.activeElement` at the
201
+ * moment its content mounts, which by then is already the day `@autofocus`
202
+ * moved focus onto (that modifier runs before the overlay's own), not the
203
+ * trigger. Left to it, closing would try to restore focus onto a day
204
+ * button that has just been removed from the DOM -- a no-op -- and focus
205
+ * would fall to `<body>`.
206
+ */
207
+ onOpenChange = isOpen => {
208
+ if (isOpen) {
209
+ this.isOpen = true;
210
+ return;
211
+ }
212
+ this.close();
213
+ };
214
+ /**
215
+ * Closing removes the focused day from the DOM, so focus must be handed back
216
+ * explicitly or it falls to `<body>` and the keyboard user loses their place.
217
+ */
218
+ close = () => {
219
+ this.isOpen = false;
220
+ this.triggerRef.current?.focus();
221
+ };
222
+ get classes() {
223
+ const {
224
+ datePicker
225
+ } = useStyles();
226
+ return datePicker({
227
+ size: this.args.inputSize
228
+ });
229
+ }
230
+ static {
231
+ decorateMethodV2(this.prototype, "classes", [cached]);
232
+ }
233
+ get isRangeMode() {
234
+ return this.mode === 'range';
235
+ }
236
+ /**
237
+ * The single-mode wire value, or `''` when there is nothing selected. Only
238
+ * read from the single-mode branch of the template, so it does not repeat
239
+ * that branch's mode check.
240
+ */
241
+ get wireValue() {
242
+ return toWire(this.value);
243
+ }
244
+ get wireRangeStart() {
245
+ return toWire(this.value?.start ?? null);
246
+ }
247
+ get wireRangeEnd() {
248
+ return toWire(this.value?.end ?? null);
249
+ }
250
+ get calendarBlockArg() {
251
+ return {
252
+ mode: this.mode,
253
+ color: this.args.color,
254
+ value: this.value,
255
+ onChange: this.handleChange,
256
+ locale: this.locale,
257
+ weekStartsOn: this.args.weekStartsOn,
258
+ minValue: this.args.minValue,
259
+ maxValue: this.args.maxValue,
260
+ isDateUnavailable: this.args.isDateUnavailable,
261
+ visibleMonths: this.args.visibleMonths,
262
+ captionLayout: this.args.captionLayout,
263
+ labelledBy: this.args.id,
264
+ autofocus: true
265
+ };
266
+ }
267
+ static {
268
+ decorateMethodV2(this.prototype, "calendarBlockArg", [cached]);
269
+ }
270
+ get footerBlockArg() {
271
+ return {
272
+ // Deliberately `handleChange`, not a bare assignment: a preset must be
273
+ // indistinguishable from a click, so it fires `@onChange` and closes on
274
+ // a complete value exactly the way picking a day does.
275
+ setValue: this.handleChange,
276
+ close: this.close,
277
+ value: this.value,
278
+ isOpen: this.isOpen
279
+ };
280
+ }
281
+ static {
282
+ decorateMethodV2(this.prototype, "footerBlockArg", [cached]);
283
+ }
284
+ static {
285
+ setComponentTemplate(precompileTemplate("<div {{this.syncValue @value}} {{this.containerRef.setup}} class={{this.classes.base class=@classes.base}} data-component=\"date-picker\" data-part=\"base\" ...attributes>\n {{!-- A range's two names use dot notation, the convention Form documents\n for nested data -- so it arrives at a validator and at onSubmit as one\n { start, end } object rather than two loose keys. --}}\n {{#if @name}}\n {{#if this.isRangeMode}}\n <input type=\"hidden\" name={{concat @name \".start\"}} value={{this.wireRangeStart}} />\n <input type=\"hidden\" name={{concat @name \".end\"}} value={{this.wireRangeEnd}} />\n {{else}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n {{/if}}\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @isDisabled={{@isDisabled}} as |c|>\n <Popover @placement={{@placement}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} @strategy={{@strategy}} @didClose={{@didClose}} @isOpen={{this.isOpen}} @onOpenChange={{this.onOpenChange}} as |p|>\n <div {{p.anchor}} class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\">\n <DatePickerTrigger @id={{c.id}} @trigger={{p.trigger}} @placeholder={{@placeholder}} @formatted={{this.formatted}} @isEmpty={{this.isEmpty}} @isDisabled={{@isDisabled}} @isInvalid={{c.isInvalid}} @hasCustomContent={{has-block \"value\"}} @accessibleName={{this.accessibleName}} @triggerRef={{this.triggerRef.setup}} @classes={{this.classes}} @userClasses={{@classes}} @onFocusOut={{this.blurTracker.handleFocusOut}}>\n <:value>\n {{#if (has-block \"value\")}}\n {{yield this.valueBlockArg to=\"value\"}}\n {{/if}}\n </:value>\n </DatePickerTrigger>\n\n <DatePickerEndContent @classes={{this.classes}} @userClasses={{@classes}} @endContentPointerEvents={{@endContentPointerEvents}} @isClearable={{this.isClearable}} @onClear={{this.clear}} />\n </div>\n\n {{!-- preventAutoFocus: overlay's default focus grab runs later()\n after Calendar's autofocus already focused the day; turned off so\n Calendar's autofocus is the only thing moving focus into the grid. --}}\n <p.Content @size={{if @popoverSize @popoverSize \"auto\"}} @target={{@target}} @renderInPlace={{@renderInPlace}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @transitionDuration={{@transitionDuration}} @disableTransitions={{@disableTransitions}} @blockScroll={{false}} @preventAutoFocus={{true}} role=\"dialog\" aria-label={{@label}}>\n {{#if (has-block \"calendar\")}}\n {{yield this.calendarBlockArg to=\"calendar\"}}\n {{else}}\n <Calendar @mode={{this.mode}} @color={{@color}} @value={{this.value}} @onChange={{this.handleChange}} @locale={{@locale}} @weekStartsOn={{@weekStartsOn}} @minValue={{@minValue}} @maxValue={{@maxValue}} @isDateUnavailable={{@isDateUnavailable}} @visibleMonths={{@visibleMonths}} @captionLayout={{@captionLayout}} @fixedWeeks={{@fixedWeeks}} @showOutsideDays={{@showOutsideDays}} @isReadOnly={{@isReadOnly}} @isDisabled={{@isDisabled}} @labelledBy={{c.id}} @autofocus={{true}} @classes={{hash base=(this.classes.calendar class=@classes.calendar)}} data-part=\"calendar\" />\n {{/if}}\n\n {{#if (has-block \"footer\")}}\n <div data-part=\"footer\" class={{this.classes.footer class=@classes.footer}}>\n {{yield this.footerBlockArg to=\"footer\"}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n</div>", {
286
+ strictMode: true,
287
+ scope: () => ({
288
+ concat,
289
+ FormControl,
290
+ Popover,
291
+ DatePickerTrigger,
292
+ DatePickerEndContent,
293
+ Calendar,
294
+ hash
295
+ })
296
+ }), this);
297
+ }
298
+ }
299
+
300
+ export { DatePicker, DatePicker as default };
301
+ //# sourceMappingURL=date-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker.js","sources":["../../../../src/components/forms/date-picker/date-picker.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached, tracked } from '@glimmer/tracking';\nimport { modifier } from 'ember-modifier';\nimport { concat, hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport { FormControl } from '../form-control';\nimport { DatePickerTrigger } from './trigger';\nimport { DatePickerEndContent } from './end-content';\nimport { Popover } from '../../overlays/popover';\nimport { Calendar } from '../../collections/calendar/calendar';\nimport { ref } from '../../../utils/ref';\nimport { ControlBlurTracker } from '../../../-private/control-blur';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport {\n formatValue,\n isEmptyValue,\n parseDate,\n parseRange,\n toWire\n} from './value';\nimport type {\n CalendarMode,\n CalendarValue,\n DateRange\n} from '../../collections/calendar/types';\nimport type {\n DatePickerArgs,\n DatePickerValueBlockArg,\n DatePickerCalendarArgs,\n DatePickerFooterArg\n} from './types';\n\ninterface DatePickerSignature<M extends CalendarMode = 'single'> {\n Args: DatePickerArgs<M>;\n Blocks: {\n value: [DatePickerValueBlockArg<M>];\n calendar: [DatePickerCalendarArgs<M>];\n footer: [DatePickerFooterArg<M>];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * A date field: a button trigger showing the formatted value, and a calendar\n * in a popover. `@mode=\"range\"` switches both the calendar and the value shape\n * to a `{ start, end }` range.\n */\nclass DatePicker<M extends CalendarMode = 'single'> extends Component<\n DatePickerSignature<M>\n> {\n triggerRef = ref<HTMLButtonElement>();\n containerRef = ref<HTMLElement>();\n\n /**\n * The selection. Seeded from `@defaultValue`, updated by the user, and\n * synced from `@value` by {@link syncValue} whenever that argument changes.\n *\n * Everything renders from here rather than from `@value` directly -- see\n * {@link value} for why a read-through cannot work inside a `Form`.\n */\n @tracked internalValue: CalendarValue<M> | null = null;\n\n @tracked isOpen = false;\n\n constructor(owner: unknown, args: DatePickerArgs<M>) {\n super(owner as never, args as never);\n\n const seed = (args as { defaultValue?: unknown }).defaultValue;\n if (seed !== undefined) {\n this.internalValue = this.parseIncoming(seed);\n }\n }\n\n get mode(): M {\n return (this.args as { mode?: M }).mode ?? ('single' as M);\n }\n\n get locale(): string {\n return this.args.locale ?? navigator.language;\n }\n\n /**\n * The rendered value is always internal state, never a read-through to\n * `@value`; {@link syncValue} pushes `@value` into it whenever the argument\n * changes. This is the pattern `Select` uses, and reading through instead\n * deadlocks the component inside a `Form`: `Field` binds `@value` to the\n * form's data, the form's data comes from hidden inputs this component\n * renders, and those inputs would then render the very value they source.\n * Nothing could ever change it, so every pick after the first submit was\n * silently discarded.\n */\n get value(): CalendarValue<M> | null {\n return this.internalValue;\n }\n\n /** Normalizes whatever `@value` / `@defaultValue` was given to `Date`s. */\n private parseIncoming(raw: unknown): CalendarValue<M> | null {\n if (this.mode === 'range') {\n return parseRange(raw as never) as CalendarValue<M> | null;\n }\n return parseDate(raw as never) as CalendarValue<M> | null;\n }\n\n /**\n * Pushes `@value` into internal state when the argument changes. `undefined`\n * is ignored so that an uncontrolled picker -- and one bound by `Field`\n * before the form holds anything for it -- keeps whatever the user chose.\n */\n syncValue = modifier((_: HTMLDivElement, [raw]: [unknown]) => {\n if (raw !== undefined) {\n this.internalValue = this.parseIncoming(raw);\n }\n });\n\n get formatted(): string {\n return formatValue(this.value, this.locale, this.args.formatOptions);\n }\n\n get isEmpty(): boolean {\n return isEmptyValue(this.value);\n }\n\n @cached\n get valueBlockArg(): DatePickerValueBlockArg<M> {\n return {\n value: this.value,\n formatted: this.formatted,\n isEmpty: this.isEmpty\n };\n }\n\n /**\n * Names the trigger when a `:value` block owns its content. Falls back to\n * the formatted value alone rather than prefixing a hardcoded English\n * string when there is no `@label`. `undefined` (not `''`) when neither is\n * present, so the trigger omits `aria-label` entirely rather than setting\n * it to an empty string -- some assistive tech treats a present-but-empty\n * `aria-label` as overriding the visible text with nothing, leaving the\n * button unnamed.\n */\n get accessibleName(): string | undefined {\n const name = [this.args.label, this.formatted].filter(Boolean).join(', ');\n return name === '' ? undefined : name;\n }\n\n /**\n * Reports focus leaving the *whole* control -- the field and its portaled\n * popover -- rather than the trigger, which blurs on the way into the\n * calendar and on every day click.\n */\n blurTracker = new ControlBlurTracker({\n trigger: () => this.triggerRef.current,\n container: () => this.containerRef.current,\n isOpen: () => this.isOpen,\n isDestroyed: () => this.isDestroyed || this.isDestroying,\n onBlur: () => this.args.onBlur?.()\n });\n\n willDestroy(): void {\n super.willDestroy();\n // Nothing may resolve against a destroyed component.\n this.blurTracker.cancel();\n }\n\n /**\n * Whether the clear button takes the calendar icon's place. A disabled or\n * read-only field never shows it: the end-content cluster is not\n * pointer-transparent to it and it carries no disabled/read-only state of\n * its own, so it would otherwise be a live button that clears a field the\n * user may not change -- the same contract `Calendar` enforces for day\n * selection under `@isReadOnly`.\n */\n get isClearable(): boolean {\n return (\n Boolean(this.args.isClearable) &&\n !this.isEmpty &&\n !this.args.isDisabled &&\n !this.args.isReadOnly\n );\n }\n\n /**\n * Clearing removes the clear button from the DOM (`isClearable` flips\n * false the instant the value is gone), so -- like `close()` -- focus must\n * be handed back to the trigger explicitly or it falls to `<body>`.\n *\n * Unlike `close()`, clearing deliberately leaves an open popover open: the\n * clear button lives outside the popover entirely, so there is no\n * dangling-focus reason to dismiss the calendar, and a user who just\n * cleared the field is a user who likely wants to pick a new date right\n * away -- closing would just make them reopen it.\n */\n clear = (): void => {\n this.internalValue = null;\n (this.args.onChange as ((v: null) => void) | undefined)?.(null);\n this.notifyForm();\n this.triggerRef.current?.focus();\n };\n\n /**\n * Whether the selection is finished, and the popover should therefore close.\n * A range with only its anchor set is not: the user still owes a second\n * click, and closing would throw away the half they just made.\n */\n private isComplete(value: CalendarValue<M> | null): boolean {\n if (!value) return false;\n if (this.mode !== 'range') return true;\n return (value as DateRange).end !== null;\n }\n\n handleChange = (value: CalendarValue<M>): void => {\n // Internal state updates even when controlled, so the calendar's own\n // rendering stays responsive; the `value` getter ignores it in that case,\n // so the consumer still has the last word.\n this.internalValue = value;\n (this.args.onChange as ((v: CalendarValue<M>) => void) | undefined)?.(\n value\n );\n this.notifyForm();\n\n if (this.isComplete(value)) this.close();\n };\n\n /**\n * Tells an enclosing `Form` the value moved.\n *\n * The hidden inputs are written programmatically, and a programmatic value\n * change fires no `input` event -- so without this the form never learns\n * anything happened. That is worse than stale data: as soon as `Form` holds\n * any data for this field, `Field` binds `@value` back to it -- so without\n * this the form's copy of the value silently diverges from the field's, and\n * a later `@data` change would sync the stale value back in. `Select`\n * dispatches the same event for the same reason.\n */\n private notifyForm(): void {\n triggerFormInputEvent(this.containerRef.current);\n }\n\n /**\n * Wired to the popover's `@onOpenChange`, which also fires for Escape and\n * an outside click -- not only the explicit paths that already call\n * `close()` below. Routing every close through `close()` matters because\n * `Overlay`'s own focus-restore captures `document.activeElement` at the\n * moment its content mounts, which by then is already the day `@autofocus`\n * moved focus onto (that modifier runs before the overlay's own), not the\n * trigger. Left to it, closing would try to restore focus onto a day\n * button that has just been removed from the DOM -- a no-op -- and focus\n * would fall to `<body>`.\n */\n onOpenChange = (isOpen: boolean): void => {\n if (isOpen) {\n this.isOpen = true;\n return;\n }\n this.close();\n };\n\n /**\n * Closing removes the focused day from the DOM, so focus must be handed back\n * explicitly or it falls to `<body>` and the keyboard user loses their place.\n */\n close = (): void => {\n this.isOpen = false;\n this.triggerRef.current?.focus();\n };\n\n @cached\n get classes() {\n const { datePicker } = useStyles();\n return datePicker({ size: this.args.inputSize });\n }\n\n get isRangeMode(): boolean {\n return this.mode === 'range';\n }\n\n /**\n * The single-mode wire value, or `''` when there is nothing selected. Only\n * read from the single-mode branch of the template, so it does not repeat\n * that branch's mode check.\n */\n get wireValue(): string {\n return toWire(this.value as Date | null);\n }\n\n get wireRangeStart(): string {\n return toWire((this.value as DateRange | null)?.start ?? null);\n }\n\n get wireRangeEnd(): string {\n return toWire((this.value as DateRange | null)?.end ?? null);\n }\n\n @cached\n get calendarBlockArg(): DatePickerCalendarArgs<M> {\n return {\n mode: this.mode,\n color: this.args.color,\n value: this.value,\n onChange: this.handleChange,\n locale: this.locale,\n weekStartsOn: this.args.weekStartsOn,\n minValue: this.args.minValue,\n maxValue: this.args.maxValue,\n isDateUnavailable: this.args.isDateUnavailable,\n visibleMonths: this.args.visibleMonths,\n captionLayout: this.args.captionLayout,\n labelledBy: this.args.id,\n autofocus: true\n };\n }\n\n @cached\n get footerBlockArg(): DatePickerFooterArg<M> {\n return {\n // Deliberately `handleChange`, not a bare assignment: a preset must be\n // indistinguishable from a click, so it fires `@onChange` and closes on\n // a complete value exactly the way picking a day does.\n setValue: this.handleChange,\n close: this.close,\n value: this.value,\n isOpen: this.isOpen\n };\n }\n\n <template>\n <div\n {{this.syncValue @value}}\n {{this.containerRef.setup}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"date-picker\"\n data-part=\"base\"\n ...attributes\n >\n {{! A range's two names use dot notation, the convention Form documents\n for nested data -- so it arrives at a validator and at onSubmit as one\n { start, end } object rather than two loose keys. }}\n {{#if @name}}\n {{#if this.isRangeMode}}\n <input\n type=\"hidden\"\n name={{concat @name \".start\"}}\n value={{this.wireRangeStart}}\n />\n <input\n type=\"hidden\"\n name={{concat @name \".end\"}}\n value={{this.wireRangeEnd}}\n />\n {{else}}\n <input type=\"hidden\" name={{@name}} value={{this.wireValue}} />\n {{/if}}\n {{/if}}\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @isDisabled={{@isDisabled}}\n as |c|\n >\n <Popover\n @placement={{@placement}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n @didClose={{@didClose}}\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.onOpenChange}}\n as |p|\n >\n <div\n {{p.anchor}}\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n <DatePickerTrigger\n @id={{c.id}}\n @trigger={{p.trigger}}\n @placeholder={{@placeholder}}\n @formatted={{this.formatted}}\n @isEmpty={{this.isEmpty}}\n @isDisabled={{@isDisabled}}\n @isInvalid={{c.isInvalid}}\n @hasCustomContent={{has-block \"value\"}}\n @accessibleName={{this.accessibleName}}\n @triggerRef={{this.triggerRef.setup}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @onFocusOut={{this.blurTracker.handleFocusOut}}\n >\n <:value>\n {{#if (has-block \"value\")}}\n {{yield this.valueBlockArg to=\"value\"}}\n {{/if}}\n </:value>\n </DatePickerTrigger>\n\n <DatePickerEndContent\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @endContentPointerEvents={{@endContentPointerEvents}}\n @isClearable={{this.isClearable}}\n @onClear={{this.clear}}\n />\n </div>\n\n {{! preventAutoFocus: overlay's default focus grab runs later()\n after Calendar's autofocus already focused the day; turned off so\n Calendar's autofocus is the only thing moving focus into the grid. }}\n <p.Content\n @size={{if @popoverSize @popoverSize \"auto\"}}\n @target={{@target}}\n @renderInPlace={{@renderInPlace}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @transitionDuration={{@transitionDuration}}\n @disableTransitions={{@disableTransitions}}\n @blockScroll={{false}}\n @preventAutoFocus={{true}}\n role=\"dialog\"\n aria-label={{@label}}\n >\n {{#if (has-block \"calendar\")}}\n {{yield this.calendarBlockArg to=\"calendar\"}}\n {{else}}\n <Calendar\n @mode={{this.mode}}\n @color={{@color}}\n @value={{this.value}}\n @onChange={{this.handleChange}}\n @locale={{@locale}}\n @weekStartsOn={{@weekStartsOn}}\n @minValue={{@minValue}}\n @maxValue={{@maxValue}}\n @isDateUnavailable={{@isDateUnavailable}}\n @visibleMonths={{@visibleMonths}}\n @captionLayout={{@captionLayout}}\n @fixedWeeks={{@fixedWeeks}}\n @showOutsideDays={{@showOutsideDays}}\n @isReadOnly={{@isReadOnly}}\n @isDisabled={{@isDisabled}}\n @labelledBy={{c.id}}\n @autofocus={{true}}\n @classes={{hash\n base=(this.classes.calendar class=@classes.calendar)\n }}\n data-part=\"calendar\"\n />\n {{/if}}\n\n {{#if (has-block \"footer\")}}\n <div\n data-part=\"footer\"\n class={{this.classes.footer class=@classes.footer}}\n >\n {{yield this.footerBlockArg to=\"footer\"}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n </div>\n </template>\n}\n\nexport { DatePicker, type DatePickerSignature };\nexport default DatePicker;\n"],"names":["DatePicker","Component","triggerRef","ref","containerRef","g","prototype","tracked","i","constructor","owner","args","seed","defaultValue","undefined","internalValue","parseIncoming","mode","locale","navigator","language","value","raw","parseRange","parseDate","syncValue","modifier","_","formatted","formatValue","formatOptions","isEmpty","isEmptyValue","valueBlockArg","n","cached","accessibleName","name","label","filter","Boolean","join","blurTracker","ControlBlurTracker","trigger","current","container","isOpen","isDestroyed","isDestroying","onBlur","willDestroy","cancel","isClearable","isDisabled","isReadOnly","clear","onChange","notifyForm","focus","isComplete","end","handleChange","close","triggerFormInputEvent","onOpenChange","classes","datePicker","useStyles","size","inputSize","isRangeMode","wireValue","toWire","wireRangeStart","start","wireRangeEnd","calendarBlockArg","color","weekStartsOn","minValue","maxValue","isDateUnavailable","visibleMonths","captionLayout","labelledBy","id","autofocus","footerBlockArg","setValue","setComponentTemplate","precompileTemplate","strictMode","scope","concat","FormControl","Popover","DatePickerTrigger","DatePickerEndContent","Calendar","hash"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA;;;;AAIC;AACD,MAAMA,UAAA,SAAsDC,UACtC;EAEpBC,UAAA,GAAaC,KAAI;EACjBC,YAAA,GAAeD,KAAI;AAEnB;;;;;;AAMC;AAND,EAAA;IAAAE,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,eAAA,EAAA,CAOCC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiD,IAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,cAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,eAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAEjDC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA;AAElBC,EAAAA,WAAAA,CAAYC,KAAc,EAAEC,IAAuB,EAAE;AACnD,IAAA,KAAK,CAACD,KAAA,EAAgBC,IAAa,CAAA;AAEnC,IAAA,MAAMC,OAAQD,IAAA,CAAoCE,YAAY;IAC9D,IAAID,SAASE,SAAA,EAAW;MACtB,IAAI,CAACC,aAAa,GAAG,IAAI,CAACC,aAAa,CAACJ,IAAA,CAAA;AAC1C,IAAA;AACF,EAAA;EAEA,IAAIK,OAAU;AACZ,IAAA,OAAQ,IAAI,CAACN,IAAI,CAAkBM,IAAI,IAAK,QAAa;AAC3D,EAAA;EAEA,IAAIC,MAAAA,GAAiB;IACnB,OAAO,IAAI,CAACP,IAAI,CAACO,MAAM,IAAIC,UAAUC,QAAQ;AAC/C,EAAA;AAEA;;;;;;;;;AASC;EACD,IAAIC,KAAAA,GAAiC;IACnC,OAAO,IAAI,C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,EAAQ,IAAI,CAACA;KACf;AACF,EAAA;AAAA,EAAA;IAAAb,gBAAA,CAAA,IAAA,CAAA5B,SAAA,EAAA,gBAAA,EAAA,CAXC6B,MAAA,CAAA,CAAA;AAAA;AAaD,EAAA;IAAAuD,oBAAA,CAAAC,kBAAA,CAAA,0sHAAA,EA+IA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,MAAA;QAAAC,WAAA;QAAAC,OAAA;QAAAC,iBAAA;QAAAC,oBAAA;QAAAC,QAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -0,0 +1,21 @@
1
+ import { CloseButton } from '../../buttons/close-button.js';
2
+ import { IconCalendar } from '../icons.js';
3
+ import { precompileTemplate } from '@ember/template-compilation';
4
+ import { setComponentTemplate } from '@ember/component';
5
+ import templateOnly from '@ember/component/template-only';
6
+
7
+ /**
8
+ * The cluster at the end of the field: exactly one of the clear button or the
9
+ * calendar icon. Pointer events are off so a click anywhere in the field still
10
+ * reaches the trigger; the clear button opts back in.
11
+ */
12
+ const DatePickerEndContent = setComponentTemplate(precompileTemplate("<div data-part=\"end-content\" class={{@classes.endContent class=@userClasses.endContent endContentPointerEvents=(if @endContentPointerEvents @endContentPointerEvents \"none\")}} ...attributes>\n {{#if @isClearable}}\n <CloseButton @title=\"Clear\" @variant=\"soft\" @size=\"xs\" @class={{@classes.clearButton class=@userClasses.clearButton}} data-part=\"clear-button\" @onPress={{@onClear}} />\n {{else}}\n <IconCalendar data-part=\"icon\" class={{@classes.icon class=@userClasses.icon}} />\n {{/if}}\n</div>", {
13
+ strictMode: true,
14
+ scope: () => ({
15
+ CloseButton,
16
+ IconCalendar
17
+ })
18
+ }), templateOnly());
19
+
20
+ export { DatePickerEndContent };
21
+ //# sourceMappingURL=end-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"end-content.js","sources":["../../../../src/components/forms/date-picker/end-content.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport type { SlotsToClasses, DatePickerSlots } from '@frontile/theme';\nimport type { DatePickerClasses } from './types';\nimport { CloseButton } from '../../buttons/close-button';\nimport { IconCalendar } from '../icons';\n\ninterface DatePickerEndContentSignature {\n Args: {\n classes: DatePickerClasses;\n userClasses?: SlotsToClasses<DatePickerSlots>;\n isClearable: boolean;\n onClear: () => void;\n\n /**\n * Defaults to `none` so clicks fall through to the trigger; content that\n * needs its own events opts back in per element.\n *\n * The theme declares no default for this variant, so leaving it unset\n * yields neither class and the browser default (`auto`) wins -- which\n * makes the cluster sit over the right edge of the field and swallow\n * clicks on the calendar icon.\n */\n endContentPointerEvents?: 'none' | 'auto';\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The cluster at the end of the field: exactly one of the clear button or the\n * calendar icon. Pointer events are off so a click anywhere in the field still\n * reaches the trigger; the clear button opts back in.\n */\nconst DatePickerEndContent: TOC<DatePickerEndContentSignature> = <template>\n <div\n data-part=\"end-content\"\n class={{@classes.endContent\n class=@userClasses.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"none\"\n )\n }}\n ...attributes\n >\n {{#if @isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @class={{@classes.clearButton class=@userClasses.clearButton}}\n data-part=\"clear-button\"\n @onPress={{@onClear}}\n />\n {{else}}\n <IconCalendar\n data-part=\"icon\"\n class={{@classes.icon class=@userClasses.icon}}\n />\n {{/if}}\n </div>\n</template>;\n\nexport { DatePickerEndContent, type DatePickerEndContentSignature };\n"],"names":["DatePickerEndContent","setComponentTemplate","precompileTemplate","strictMode","scope","CloseButton","IconCalendar","templateOnly"],"mappings":";;;;;;AA2BA;;;;AAIC;AACD,MAAMA,oBAA0B,GAAAC,oBAAA,CAAiCC,kBAAA,CAAA,wgBAAA,EA2BjE;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,WAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
@@ -0,0 +1,14 @@
1
+ import { on } from '@ember/modifier';
2
+ import { precompileTemplate } from '@ember/template-compilation';
3
+ import { setComponentTemplate } from '@ember/component';
4
+ import templateOnly from '@ember/component/template-only';
5
+
6
+ const DatePickerTrigger = setComponentTemplate(precompileTemplate("<button type=\"button\" id={{@id}} {{@trigger}} {{@triggerRef}} disabled={{@isDisabled}} data-part=\"input\" data-invalid={{if @isInvalid \"true\" \"false\"}} data-disabled={{if @isDisabled \"true\" \"false\"}} aria-label={{if @hasCustomContent @accessibleName}} aria-haspopup=\"dialog\" class={{@classes.input class=@userClasses.input hasEndContent=true}} {{on \"focusout\" @onFocusOut}} ...attributes>\n {{#if @hasCustomContent}}\n {{yield to=\"value\"}}\n {{else if @isEmpty}}\n <span data-part=\"placeholder\" class={{@classes.placeholder class=@userClasses.placeholder}}>{{@placeholder}}</span>\n {{else}}\n {{@formatted}}\n {{/if}}\n</button>", {
7
+ strictMode: true,
8
+ scope: () => ({
9
+ on
10
+ })
11
+ }), templateOnly());
12
+
13
+ export { DatePickerTrigger, DatePickerTrigger as default };
14
+ //# sourceMappingURL=trigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.js","sources":["../../../../src/components/forms/date-picker/trigger.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport { on } from '@ember/modifier';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, DatePickerSlots } from '@frontile/theme';\nimport type { DatePickerClasses } from './types';\n\ninterface DatePickerTriggerSignature {\n Args: {\n /** Records the element, for focus restoration and blur tracking. */\n triggerRef: ModifierLike<{ Element: HTMLButtonElement }>;\n\n /** The popover's `trigger` modifier: what opens the calendar. */\n trigger: ModifierLike<{ Element: HTMLElement }>;\n\n id?: string;\n placeholder?: string;\n formatted: string;\n isEmpty: boolean;\n isDisabled?: boolean;\n isInvalid?: boolean;\n hasCustomContent: boolean;\n\n /**\n * Names the trigger when a `:value` block owns its content — that block\n * may render nothing readable at all, which would leave an unnamed\n * button. `undefined` when there is nothing to name it with, so\n * `aria-label` is omitted entirely rather than set to `\"\"`.\n */\n accessibleName: string | undefined;\n\n classes: DatePickerClasses;\n userClasses?: SlotsToClasses<DatePickerSlots>;\n onFocusOut: (event: FocusEvent) => void;\n };\n Blocks: { value: [] };\n Element: HTMLButtonElement;\n}\n\nconst DatePickerTrigger: TOC<DatePickerTriggerSignature> = <template>\n <button\n type=\"button\"\n id={{@id}}\n {{@trigger}}\n {{@triggerRef}}\n disabled={{@isDisabled}}\n data-part=\"input\"\n data-invalid={{if @isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n aria-label={{if @hasCustomContent @accessibleName}}\n aria-haspopup=\"dialog\"\n class={{@classes.input class=@userClasses.input hasEndContent=true}}\n {{on \"focusout\" @onFocusOut}}\n ...attributes\n >\n {{#if @hasCustomContent}}\n {{yield to=\"value\"}}\n {{else if @isEmpty}}\n <span\n data-part=\"placeholder\"\n class={{@classes.placeholder class=@userClasses.placeholder}}\n >{{@placeholder}}</span>\n {{else}}\n {{@formatted}}\n {{/if}}\n </button>\n</template>;\n\nexport { DatePickerTrigger, type DatePickerTriggerSignature };\nexport default DatePickerTrigger;\n"],"names":["DatePickerTrigger","setComponentTemplate","precompileTemplate","strictMode","scope","on","templateOnly"],"mappings":";;;;;AAsCA,MAAMA,iBAAuB,GAAAC,oBAAA,CAA8BC,kBAAA,CAAA,upBAAA,EA2B3D;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,97 @@
1
+ import { fromDayKey, toDayKey } from '../../collections/calendar/utils.js';
2
+
3
+ /**
4
+ * A date as accepted from a consumer: a `Date`, or the same `yyyy-MM-dd`
5
+ * string this component writes to its hidden inputs.
6
+ *
7
+ * Strings are accepted because `Field` feeds form data — which is always
8
+ * strings — straight back into `@value`. It also means a value hydrated from
9
+ * JSON or an API needs no adapter. Output is always a `Date`: strings are an
10
+ * accepted input, never an output mode.
11
+ */
12
+
13
+ const ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
14
+
15
+ /**
16
+ * Normalizes one end of a value to a `Date`, or `null` when there is nothing
17
+ * usable there.
18
+ *
19
+ * An `Invalid Date` is treated as absent rather than passed along: it would
20
+ * otherwise reach `Intl.DateTimeFormat` and render the literal text
21
+ * "Invalid Date" inside the trigger.
22
+ */
23
+ function parseDate(value) {
24
+ if (value === null || value === undefined || value === '') return null;
25
+ if (value instanceof Date) {
26
+ return Number.isNaN(value.getTime()) ? null : value;
27
+ }
28
+
29
+ // `fromDayKey` splits on `-` and would happily turn anything into a Date of
30
+ // NaN parts, so the shape is checked before it is trusted.
31
+ if (!ISO_DAY.test(value)) return null;
32
+ const parsed = fromDayKey(value);
33
+ return Number.isNaN(parsed.getTime()) ? null : parsed;
34
+ }
35
+
36
+ /**
37
+ * Normalizes a range. A `null` end is preserved rather than collapsed — that
38
+ * is a range mid-selection, with its anchor set and the second click pending,
39
+ * and the trigger must still show the anchor.
40
+ */
41
+ function parseRange(value) {
42
+ if (!value) return null;
43
+ const start = parseDate(value.start);
44
+ // Without a usable start there is no range at all: a `{ start: null }` would
45
+ // not satisfy `DateRange`, whose start is non-nullable.
46
+ if (!start) return null;
47
+ return {
48
+ start,
49
+ end: parseDate(value.end)
50
+ };
51
+ }
52
+
53
+ /** The value as it is submitted: `yyyy-MM-dd`, from local calendar fields. */
54
+ function toWire(date) {
55
+ if (!date || Number.isNaN(date.getTime())) return '';
56
+ return toDayKey(date);
57
+ }
58
+ const DEFAULT_FORMAT = {
59
+ dateStyle: 'medium'
60
+ };
61
+ function formatDate(date, locale, options) {
62
+ return new Intl.DateTimeFormat(locale, options ?? DEFAULT_FORMAT).format(date);
63
+ }
64
+ function isRange(value) {
65
+ return typeof value === 'object' && value !== null && 'start' in value && value.start instanceof Date;
66
+ }
67
+
68
+ /**
69
+ * The trigger's text for a value in either mode. An en dash (not a hyphen)
70
+ * joins a range, matching how date ranges are set in running text.
71
+ */
72
+ function formatValue(value, locale, options) {
73
+ if (!value) return '';
74
+ if (isRange(value)) {
75
+ const start = formatDate(value.start, locale, options);
76
+ // A half-open range renders as the anchor alone: "Jan 20, 2026 – " would
77
+ // read as an unfinished sentence while the user picks the second end.
78
+ if (!value.end) return start;
79
+ return `${start} – ${formatDate(value.end, locale, options)}`;
80
+ }
81
+ if (value instanceof Date) return formatDate(value, locale, options);
82
+ return '';
83
+ }
84
+
85
+ /**
86
+ * Whether the trigger should show its placeholder. An anchored range is *not*
87
+ * empty — its start is already chosen and must be visible.
88
+ */
89
+ function isEmptyValue(value) {
90
+ if (value === null || value === undefined) return true;
91
+ if (value instanceof Date) return Number.isNaN(value.getTime());
92
+ if (isRange(value)) return false;
93
+ return true;
94
+ }
95
+
96
+ export { formatValue, isEmptyValue, parseDate, parseRange, toWire };
97
+ //# sourceMappingURL=value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value.js","sources":["../../../../src/components/forms/date-picker/value.ts"],"sourcesContent":["import {\n formatter,\n toDayKey,\n fromDayKey\n} from '../../collections/calendar/utils';\nimport type {\n CalendarMode,\n CalendarValue,\n DateRange\n} from '../../collections/calendar/types';\n\n/**\n * A date as accepted from a consumer: a `Date`, or the same `yyyy-MM-dd`\n * string this component writes to its hidden inputs.\n *\n * Strings are accepted because `Field` feeds form data — which is always\n * strings — straight back into `@value`. It also means a value hydrated from\n * JSON or an API needs no adapter. Output is always a `Date`: strings are an\n * accepted input, never an output mode.\n */\ntype DatePickerInput = Date | string;\n\ninterface DatePickerRangeInput {\n start: DatePickerInput;\n end: DatePickerInput | null;\n}\n\nconst ISO_DAY = /^\\d{4}-\\d{2}-\\d{2}$/;\n\n/**\n * Normalizes one end of a value to a `Date`, or `null` when there is nothing\n * usable there.\n *\n * An `Invalid Date` is treated as absent rather than passed along: it would\n * otherwise reach `Intl.DateTimeFormat` and render the literal text\n * \"Invalid Date\" inside the trigger.\n */\nfunction parseDate(value: DatePickerInput | null | undefined): Date | null {\n if (value === null || value === undefined || value === '') return null;\n\n if (value instanceof Date) {\n return Number.isNaN(value.getTime()) ? null : value;\n }\n\n // `fromDayKey` splits on `-` and would happily turn anything into a Date of\n // NaN parts, so the shape is checked before it is trusted.\n if (!ISO_DAY.test(value)) return null;\n\n const parsed = fromDayKey(value);\n return Number.isNaN(parsed.getTime()) ? null : parsed;\n}\n\n/**\n * Normalizes a range. A `null` end is preserved rather than collapsed — that\n * is a range mid-selection, with its anchor set and the second click pending,\n * and the trigger must still show the anchor.\n */\nfunction parseRange(\n value: DatePickerRangeInput | null | undefined\n): DateRange | null {\n if (!value) return null;\n\n const start = parseDate(value.start);\n // Without a usable start there is no range at all: a `{ start: null }` would\n // not satisfy `DateRange`, whose start is non-nullable.\n if (!start) return null;\n\n return { start, end: parseDate(value.end) };\n}\n\n/** The value as it is submitted: `yyyy-MM-dd`, from local calendar fields. */\nfunction toWire(date: Date | null | undefined): string {\n if (!date || Number.isNaN(date.getTime())) return '';\n return toDayKey(date);\n}\n\nconst DEFAULT_FORMAT: Intl.DateTimeFormatOptions = { dateStyle: 'medium' };\n\nfunction formatDate(\n date: Date,\n locale: string,\n options?: Intl.DateTimeFormatOptions\n): string {\n return new Intl.DateTimeFormat(locale, options ?? DEFAULT_FORMAT).format(\n date\n );\n}\n\nfunction isRange(value: unknown): value is DateRange {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'start' in value &&\n (value as DateRange).start instanceof Date\n );\n}\n\n/**\n * The trigger's text for a value in either mode. An en dash (not a hyphen)\n * joins a range, matching how date ranges are set in running text.\n */\nfunction formatValue<M extends CalendarMode>(\n value: CalendarValue<M> | null | undefined,\n locale: string,\n options?: Intl.DateTimeFormatOptions\n): string {\n if (!value) return '';\n\n if (isRange(value)) {\n const start = formatDate(value.start, locale, options);\n // A half-open range renders as the anchor alone: \"Jan 20, 2026 – \" would\n // read as an unfinished sentence while the user picks the second end.\n if (!value.end) return start;\n return `${start} – ${formatDate(value.end, locale, options)}`;\n }\n\n if (value instanceof Date) return formatDate(value, locale, options);\n\n return '';\n}\n\n/**\n * Whether the trigger should show its placeholder. An anchored range is *not*\n * empty — its start is already chosen and must be visible.\n */\nfunction isEmptyValue(value: unknown): boolean {\n if (value === null || value === undefined) return true;\n if (value instanceof Date) return Number.isNaN(value.getTime());\n if (isRange(value)) return false;\n return true;\n}\n\nexport {\n parseDate,\n parseRange,\n toWire,\n formatValue,\n isEmptyValue,\n type DatePickerInput,\n type DatePickerRangeInput\n};\n"],"names":["ISO_DAY","parseDate","value","undefined","Date","Number","isNaN","getTime","test","parsed","fromDayKey","parseRange","start","end","toWire","date","toDayKey","DEFAULT_FORMAT","dateStyle","formatDate","locale","options","Intl","DateTimeFormat","format","isRange","formatValue","isEmptyValue"],"mappings":";;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,MAAMA,OAAO,GAAG,qBAAqB;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAACC,KAAyC,EAAe;AACzE,EAAA,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS,IAAID,KAAK,KAAK,EAAE,EAAE,OAAO,IAAI;EAEtE,IAAIA,KAAK,YAAYE,IAAI,EAAE;AACzB,IAAA,OAAOC,MAAM,CAACC,KAAK,CAACJ,KAAK,CAACK,OAAO,EAAE,CAAC,GAAG,IAAI,GAAGL,KAAK;AACrD,EAAA;;AAEA;AACA;EACA,IAAI,CAACF,OAAO,CAACQ,IAAI,CAACN,KAAK,CAAC,EA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EAC5B;AACR,EAAA,IAAI,CAACnB,KAAK,EAAE,OAAO,EAAE;AAErB,EAAA,IAAIuB,OAAO,CAACvB,KAAK,CAAC,EAAE;IAClB,MAAMU,KAAK,GAAGO,UAAU,CAACjB,KAAK,CAACU,KAAK,EAAEQ,MAAM,EAAEC,OAAO,CAAC;AACtD;AACA;AACA,IAAA,IAAI,CAACnB,KAAK,CAACW,GAAG,EAAE,OAAOD,KAAK;AAC5B,IAAA,OAAO,CAAA,EAAGA,KAAK,CAAA,GAAA,EAAMO,UAAU,CAACjB,KAAK,CAACW,GAAG,EAAEO,MAAM,EAAEC,OAAO,CAAC,CAAA,CAAE;AAC/D,EAAA;AAEA,EAAA,IAAInB,KAAK,YAAYE,IAAI,EAAE,OAAOe,UAAU,CAACjB,KAAK,EAAEkB,MAAM,EAAEC,OAAO,CAAC;AAEpE,EAAA,OAAO,EAAE;AACX;;AAEA;AACA;AACA;AACA;AACA,SAASM,YAAYA,CAACzB,KAAc,EAAW;EAC7C,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS,EAAE,OAAO,IAAI;AACtD,EAAA,IAAID,KAAK,YAAYE,IAAI,EAAE,OAAOC,MAAM,CAACC,KAAK,CAACJ,KAAK,CAACK,OAAO,EAAE,CAAC;AAC/D,EAAA,IAAIkB,OAAO,CAACvB,KAAK,CAAC,EAAE,OAAO,KAAK;AAChC,EAAA,OAAO,IAAI;AACb;;;;"}
@@ -0,0 +1,2 @@
1
+ export { DatePicker, DatePicker as default } from './date-picker/date-picker.js';
2
+ //# sourceMappingURL=date-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -4,6 +4,7 @@ import { get, action } from '@ember/object';
4
4
  import { debounce } from '@ember/runloop';
5
5
  import { Checkbox } from './checkbox.js';
6
6
  import { CheckboxGroup } from './checkbox-group.js';
7
+ import { DatePicker } from './date-picker/date-picker.js';
7
8
  import { Input } from './input.js';
8
9
  import { InputOtp } from './input-otp.js';
9
10
  import { Radio } from './radio.js';
@@ -83,7 +84,7 @@ class Field extends Component {
83
84
  decorateMethodV2(this.prototype, "handleBlur", [action]);
84
85
  }
85
86
  static {
86
- setComponentTemplate(precompileTemplate("{{!-- @glint-nocheck component generics (radio, radio-group, select) trigger: type instantiation is excessively deep and possibly infinite --}}\n{{yield (hash Checkbox=(component Checkbox name=@name errors=this.fieldErrors checked=this.fieldValue isDisabled=@disabled onChange=this.handleChange onBlur=this.handleBlur) CheckboxGroup=(component CheckboxGroup name=@name errors=this.fieldErrors isDisabled=@disabled) Input=(component Input name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange onInput=this.handleInput onBlur=this.handleBlur) InputOtp=(component InputOtp name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange onInput=this.handleInput onBlur=this.handleBlur) Radio=(component Radio name=@name errors=this.fieldErrors checkedValue=this.fieldValue isDisabled=@disabled onChange=this.handleChange onBlur=this.handleBlur) RadioGroup=(component RadioGroup name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange) SingleSelect=(component Select name=@name errors=this.fieldErrors selectedKey=this.fieldValue isDisabled=@disabled onBlur=this.handleBlur) MultiSelect=(component Select selectionMode=\"multiple\" name=@name errors=this.fieldErrors selectedKeys=this.fieldValue isDisabled=@disabled onBlur=this.handleBlur) Switch=(component Switch name=@name errors=this.fieldErrors isSelected=this.fieldValue isDisabled=@disabled onChange=this.handleChange onBlur=this.handleBlur) Textarea=(component Textarea name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange onInput=this.handleInput onBlur=this.handleBlur)) to=\"default\"}}", {
87
+ setComponentTemplate(precompileTemplate("{{!-- @glint-nocheck component generics (radio, radio-group, select) trigger: type instantiation is excessively deep and possibly infinite --}}\n{{yield (hash Checkbox=(component Checkbox name=@name errors=this.fieldErrors checked=this.fieldValue isDisabled=@disabled onChange=this.handleChange onBlur=this.handleBlur) CheckboxGroup=(component CheckboxGroup name=@name errors=this.fieldErrors isDisabled=@disabled) Input=(component Input name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange onInput=this.handleInput onBlur=this.handleBlur) InputOtp=(component InputOtp name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange onInput=this.handleInput onBlur=this.handleBlur) Radio=(component Radio name=@name errors=this.fieldErrors checkedValue=this.fieldValue isDisabled=@disabled onChange=this.handleChange onBlur=this.handleBlur) RadioGroup=(component RadioGroup name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange) SingleSelect=(component Select name=@name errors=this.fieldErrors selectedKey=this.fieldValue isDisabled=@disabled onBlur=this.handleBlur) MultiSelect=(component Select selectionMode=\"multiple\" name=@name errors=this.fieldErrors selectedKeys=this.fieldValue isDisabled=@disabled onBlur=this.handleBlur) DatePicker=(component DatePicker name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onBlur=this.handleBlur) DateRangePicker=(component DatePicker mode=\"range\" name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onBlur=this.handleBlur) Switch=(component Switch name=@name errors=this.fieldErrors isSelected=this.fieldValue isDisabled=@disabled onChange=this.handleChange onBlur=this.handleBlur) Textarea=(component Textarea name=@name errors=this.fieldErrors value=this.fieldValue isDisabled=@disabled onChange=this.handleChange onInput=this.handleInput onBlur=this.handleBlur)) to=\"default\"}}", {
87
88
  strictMode: true,
88
89
  scope: () => ({
89
90
  hash,
@@ -94,6 +95,7 @@ class Field extends Component {
94
95
  Radio,
95
96
  RadioGroup,
96
97
  Select,
98
+ DatePicker,
97
99
  Switch,
98
100
  Textarea
99
101
  })