@nanahoshi/mona-ui 0.24.4 → 0.24.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 (80) hide show
  1. package/README.md +3 -0
  2. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +95 -70
  3. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +196 -137
  4. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +136 -89
  5. package/fesm2022/nanahoshi-mona-ui-date-input.mjs +164 -3
  6. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +124 -140
  7. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +205 -202
  8. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +108 -56
  9. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +68 -59
  10. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -3
  11. package/fesm2022/nanahoshi-mona-ui-filter.mjs +1 -1
  12. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-DLOPRuFv.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-CD_ODHpU.mjs} +2 -2
  13. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-Dw5U9H0a.mjs → nanahoshi-mona-ui-grid-grid-list.component-0jN7I1jo.mjs} +4 -4
  14. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-D1kyAzD8.mjs → nanahoshi-mona-ui-grid-grid-row.component-BI_iE7pl.mjs} +3 -3
  15. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-ECK1_smx.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-Sa1aAtJ-.mjs} +4 -4
  16. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-D4lUDbfx.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BvUM9nPt.mjs} +8 -8
  17. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  18. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +2 -1
  19. package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +2 -2
  20. package/fesm2022/nanahoshi-mona-ui-internal.mjs +4 -2
  21. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +2 -1
  22. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +4 -1
  23. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +4 -1
  24. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +4 -1
  25. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +2 -1
  26. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +2 -1
  27. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +2 -1
  28. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +2 -1
  29. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +2 -1
  30. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +2 -1
  31. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +2 -1
  32. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +2 -1
  33. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +2 -1
  34. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +118 -66
  35. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +195 -122
  36. package/fesm2022/nanahoshi-mona-ui-pager.mjs +1 -1
  37. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +149 -167
  38. package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +182 -137
  39. package/i18n/catalogs/en-US.messages.json +2 -1
  40. package/locales/ar-sa/ar-sa.messages.json +2 -1
  41. package/locales/de-de/de-de.messages.json +2 -1
  42. package/locales/es-es/es-es.messages.json +2 -1
  43. package/locales/fr-fr/fr-fr.messages.json +2 -1
  44. package/locales/id-id/id-id.messages.json +2 -1
  45. package/locales/it-it/it-it.messages.json +2 -1
  46. package/locales/ja-jp/ja-jp.messages.json +2 -1
  47. package/locales/ko-kr/ko-kr.messages.json +2 -1
  48. package/locales/pt-br/pt-br.messages.json +2 -1
  49. package/locales/ru-ru/ru-ru.messages.json +2 -1
  50. package/locales/tr-tr/tr-tr.messages.json +2 -1
  51. package/locales/zh-cn/zh-cn.messages.json +2 -1
  52. package/locales/zh-tw/zh-tw.messages.json +2 -1
  53. package/package.json +2 -2
  54. package/types/nanahoshi-mona-ui-auto-complete.d.ts +34 -20
  55. package/types/nanahoshi-mona-ui-calendar.d.ts +30 -11
  56. package/types/nanahoshi-mona-ui-combo-box.d.ts +42 -23
  57. package/types/nanahoshi-mona-ui-date-input.d.ts +74 -3
  58. package/types/nanahoshi-mona-ui-date-picker.d.ts +61 -33
  59. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +79 -38
  60. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +29 -15
  61. package/types/nanahoshi-mona-ui-dropdowns.d.ts +30 -19
  62. package/types/nanahoshi-mona-ui-i18n.d.ts +1 -0
  63. package/types/nanahoshi-mona-ui-internal.d.ts +3 -1
  64. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +1 -0
  65. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +1 -0
  66. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +1 -0
  67. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +1 -0
  68. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +1 -0
  69. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +1 -0
  70. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +1 -0
  71. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +1 -0
  72. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +1 -0
  73. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +1 -0
  74. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +1 -0
  75. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +1 -0
  76. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +1 -0
  77. package/types/nanahoshi-mona-ui-multi-select.d.ts +45 -21
  78. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +57 -16
  79. package/types/nanahoshi-mona-ui-time-picker.d.ts +72 -42
  80. package/types/nanahoshi-mona-ui-time-selector.d.ts +78 -46
@@ -38,14 +38,13 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
38
38
  protected readonly activeDescendant: _angular_core.Signal<string | null>;
39
39
  protected readonly affixClass: _angular_core.Signal<string>;
40
40
  protected readonly baseClass: _angular_core.Signal<string>;
41
+ protected readonly clearButtonVisible: _angular_core.Signal<boolean>;
41
42
  protected readonly comboBoxValue: _angular_core.WritableSignal<string>;
42
43
  protected readonly comboBoxValue$: Subject<string | null>;
43
- protected readonly effectiveAriaLabel: _angular_core.Signal<string>;
44
44
  protected readonly expanded: _angular_core.Signal<boolean>;
45
45
  protected readonly footerTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
46
46
  protected readonly groupHeaderTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
47
47
  protected readonly headerTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
48
- protected readonly id: string;
49
48
  protected readonly inputClass: _angular_core.Signal<string>;
50
49
  protected readonly invalidState: _angular_core.Signal<boolean>;
51
50
  protected readonly itemTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
@@ -62,15 +61,16 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
62
61
  * @description Allows a custom value to be committed when it doesn't match any item in {@link data}.
63
62
  * @default false
64
63
  */
65
- readonly allowCustomValue: _angular_core.InputSignal<boolean>;
64
+ readonly allowCustomValue: _angular_core.InputSignalWithTransform<boolean, unknown>;
66
65
  /**
67
66
  * @description ID of an element that provides an extended description for the input.
68
67
  * @default ""
69
68
  */
70
69
  readonly ariaDescribedBy: _angular_core.InputSignal<string>;
71
70
  /**
72
- * @description Accessible name for the input. Describe what the combo box represents.
73
- * Falls back to {@link placeholder} when neither this nor {@link ariaLabelledBy} is set.
71
+ * @description Accessible name for the input. Describe what the combo box represents. Prefer a visible label,
72
+ * linked through {@link inputId} or {@link ariaLabelledBy}; without any of them, browsers fall back to the
73
+ * {@link placeholder}.
74
74
  * @default ""
75
75
  */
76
76
  readonly ariaLabel: _angular_core.InputSignal<string>;
@@ -96,23 +96,30 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
96
96
  * @description Renders the component with reduced visual emphasis and removes pointer interaction.
97
97
  * @default false
98
98
  */
99
- readonly disabled: _angular_core.ModelSignal<boolean>;
99
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
100
+ /**
101
+ * @description Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the
102
+ * combo box. A unique id is generated when it isn't set.
103
+ * @default generated
104
+ */
105
+ readonly inputId: _angular_core.InputSignal<string>;
100
106
  /**
101
107
  * @description Marks the combo box as invalid. When bound to a signal form field via `[formField]`,
102
108
  * this is written by the `FormField` directive.
103
109
  * @default false
104
110
  */
105
- readonly invalid: _angular_core.InputSignal<boolean>;
111
+ readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
106
112
  /**
107
113
  * @description A predicate function or the name of the field that determines whether an item is disabled.
108
114
  * @default undefined
109
115
  */
110
116
  readonly itemDisabled: _angular_core.InputSignal<DropdownFieldPredicateType<TData>>;
111
117
  /**
112
- * @description Displays a loading indicator and prevents interaction while an operation is in progress.
118
+ * @description Shows a loading indicator, in place of the clear button, and marks the field busy. It doesn't
119
+ * block interaction: the field stays usable while data loads.
113
120
  * @default false
114
121
  */
115
- readonly loading: _angular_core.InputSignal<boolean>;
122
+ readonly loading: _angular_core.InputSignalWithTransform<boolean, unknown>;
116
123
  /**
117
124
  * @description Emitted when the popup is about to open. This event is preventable.
118
125
  */
@@ -132,7 +139,8 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
132
139
  */
133
140
  readonly popupClass: _angular_core.InputSignal<string>;
134
141
  /**
135
- * @description Sets the height of the popup element.
142
+ * @description Maximum height of the popup, in pixels or as a CSS length. Shorter lists shrink to fit. When
143
+ * unset, the popup is at most 200 pixels tall.
136
144
  * @default null
137
145
  */
138
146
  readonly popupHeight: _angular_core.InputSignal<ListSizeInputType>;
@@ -145,12 +153,12 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
145
153
  * @description Prevents value changes while preserving the component's visual state.
146
154
  * @default false
147
155
  */
148
- readonly readonly: _angular_core.InputSignal<boolean>;
156
+ readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
149
157
  /**
150
158
  * @description Sets the required state of the combo box component.
151
159
  * @default false
152
160
  */
153
- readonly required: _angular_core.InputSignal<boolean>;
161
+ readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
154
162
  /**
155
163
  * @description Border-radius preset applied to the component.
156
164
  * @default "medium"
@@ -160,7 +168,7 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
160
168
  * @description Displays a button that resets the value to empty when an item is selected.
161
169
  * @default false
162
170
  */
163
- readonly showClearButton: _angular_core.InputSignal<boolean>;
171
+ readonly showClearButton: _angular_core.InputSignalWithTransform<boolean, unknown>;
164
172
  /**
165
173
  * @description Size preset controlling the component's dimensions.
166
174
  * @default "medium"
@@ -173,8 +181,8 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
173
181
  */
174
182
  readonly textField: _angular_core.InputSignal<DropdownFieldSelectorType<TData, string>>;
175
183
  /**
176
- * @description Emitted when the combo box is interacted with on blur, selection, clear, or committed input.
177
- * The `FormField` directive listens to this to mark the field as touched.
184
+ * @description Emitted when focus leaves the combo box. Moving between its input, clear button and popup doesn't
185
+ * count. The `FormField` directive listens to this to mark the field as touched.
178
186
  */
179
187
  readonly touch: _angular_core.OutputEmitterRef<void>;
180
188
  /**
@@ -182,7 +190,7 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
182
190
  * this is written by the `FormField` directive.
183
191
  * @default false
184
192
  */
185
- readonly touched: _angular_core.InputSignal<boolean>;
193
+ readonly touched: _angular_core.InputSignalWithTransform<boolean, unknown>;
186
194
  /**
187
195
  * @description Additional CSS classes merged onto the host element via `tailwind-merge`.
188
196
  * @default ""
@@ -197,8 +205,8 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
197
205
  */
198
206
  readonly value: _angular_core.ModelSignal<TValue | null>;
199
207
  /**
200
- * @description Emitted with the entered text when the user presses Enter on unmatched input.
201
- * Only emitted when {@link allowCustomValue} is true.
208
+ * @description Emitted with the entered text when the user presses Enter on text that matches no item, or leaves
209
+ * the field with it. Only emitted when {@link allowCustomValue} is true.
202
210
  */
203
211
  readonly valueAdd: _angular_core.OutputEmitterRef<string>;
204
212
  /**
@@ -219,10 +227,16 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
219
227
  *
220
228
  * @default false
221
229
  */
222
- readonly valuePrimitive: _angular_core.InputSignal<boolean>;
230
+ readonly valuePrimitive: _angular_core.InputSignalWithTransform<boolean, unknown>;
223
231
  constructor();
224
- focus(): void;
225
- protected onInputBlur(event: FocusEvent): void;
232
+ /**
233
+ * @description Moves focus to the inner input. The caret goes to the end of the text.
234
+ * @param options Passed to `HTMLElement.focus()`, for example `{ preventScroll: true }`.
235
+ */
236
+ focus(options?: FocusOptions): void;
237
+ protected onFocusOut(event: FocusEvent): void;
238
+ protected onHostPointerDown(event: PointerEvent): void;
239
+ protected onInput(text: string): void;
226
240
  protected onItemSelect(event: SelectionChangeEvent<TData>): void;
227
241
  protected onPopupPointerDown(event: PointerEvent): void;
228
242
  protected onValueClear(event: Event): void;
@@ -232,19 +246,24 @@ declare class ComboBoxComponent<TData = unknown, TValue = TData> implements Form
232
246
  private handleEnterKey;
233
247
  private initialize;
234
248
  private notifyFilterChange;
249
+ /**
250
+ * Settles typed text when focus leaves the combo box, so the field never shows text that isn't its value:
251
+ * an item whose text matches is selected, empty text clears the value, other text is offered through
252
+ * `valueAdd` when custom values are allowed, and otherwise the selected item's text comes back.
253
+ */
254
+ private resolveText;
235
255
  private selectItem;
236
256
  private setArrowNavigationSubscription;
237
257
  private setComboboxValueSubscription;
238
258
  private setEscapeKeySubscription;
239
259
  private setKeydownSubscription;
240
- private setNavigatedItemSubscription;
241
260
  private setPopupCloseSubscriptions;
242
261
  private setSpaceKeySubscription;
243
262
  private setSubscriptions;
244
263
  private synchronizeSelection;
245
264
  private updateValue;
246
265
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboBoxComponent<any, any>, never>;
247
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ComboBoxComponent<any, any>, "mona-combo-box", never, { "allowCustomValue": { "alias": "allowCustomValue"; "required": false; "isSignal": true; }; "ariaDescribedBy": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "itemDisabled": { "alias": "itemDisabled"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "popupClass": { "alias": "popupClass"; "required": false; "isSignal": true; }; "popupHeight": { "alias": "popupHeight"; "required": false; "isSignal": true; }; "popupWidth": { "alias": "popupWidth"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "textField": { "alias": "textField"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "valueField": { "alias": "valueField"; "required": false; "isSignal": true; }; "valuePrimitive": { "alias": "valuePrimitive"; "required": false; "isSignal": true; }; }, { "close": "close"; "closed": "closed"; "disabled": "disabledChange"; "open": "open"; "opened": "opened"; "touch": "touch"; "value": "valueChange"; "valueAdd": "valueAdd"; }, ["footerTemplate", "groupHeaderTemplate", "headerTemplate", "itemTemplate", "noDataTemplate", "prefixTemplate"], never, true, [{ directive: typeof i1.DropdownDataHandlerDirective; inputs: {}; outputs: {}; }, { directive: typeof i1.DropdownListPopupHandlerDirective; inputs: {}; outputs: {}; }]>;
266
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ComboBoxComponent<any, any>, "mona-combo-box", never, { "allowCustomValue": { "alias": "allowCustomValue"; "required": false; "isSignal": true; }; "ariaDescribedBy": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "itemDisabled": { "alias": "itemDisabled"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "popupClass": { "alias": "popupClass"; "required": false; "isSignal": true; }; "popupHeight": { "alias": "popupHeight"; "required": false; "isSignal": true; }; "popupWidth": { "alias": "popupWidth"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "textField": { "alias": "textField"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "valueField": { "alias": "valueField"; "required": false; "isSignal": true; }; "valuePrimitive": { "alias": "valuePrimitive"; "required": false; "isSignal": true; }; }, { "close": "close"; "closed": "closed"; "open": "open"; "opened": "opened"; "touch": "touch"; "value": "valueChange"; "valueAdd": "valueAdd"; }, ["footerTemplate", "groupHeaderTemplate", "headerTemplate", "itemTemplate", "noDataTemplate", "prefixTemplate"], never, true, [{ directive: typeof i1.DropdownDataHandlerDirective; inputs: {}; outputs: {}; }, { directive: typeof i1.DropdownListPopupHandlerDirective; inputs: {}; outputs: {}; }, { directive: typeof i1.DropdownLiveRegionDirective; inputs: {}; outputs: {}; }]>;
248
267
  }
249
268
 
250
269
  declare const COMBO_BOX_DEFAULT_MESSAGES: MonaComboBoxMessages;
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { PipeTransform } from '@angular/core';
2
+ import { PipeTransform, Signal, WritableSignal, ModelSignal } from '@angular/core';
3
3
  import { Predicate, ImmutableSet } from '@mirei/ts-collections';
4
4
  import { DateTime } from 'luxon';
5
5
  import * as class_variance_authority_types from 'class-variance-authority/types';
@@ -7,6 +7,7 @@ import { VariantInputs } from '@nanahoshi/mona-ui/internal';
7
7
  import { VariantProps } from 'class-variance-authority';
8
8
  import { Subject } from 'rxjs';
9
9
  import { PreventableEvent } from '@nanahoshi/mona-ui/common';
10
+ import { ValidationError } from '@angular/forms/signals';
10
11
 
11
12
  declare class DateInputPrefixTemplateDirective {
12
13
  static ɵfac: i0.ɵɵFactoryDeclaration<DateInputPrefixTemplateDirective, never>;
@@ -55,5 +56,75 @@ declare const generateHourSet: (hourFormat: HourFormat, meridiem: Meridiem, step
55
56
  declare const generateMinuteSet: (step?: number) => ImmutableSet<TimeUnit>;
56
57
  declare const generateSecondSet: (step?: number) => ImmutableSet<TimeUnit>;
57
58
 
58
- export { CalendarService, DateInputPrefixTemplateDirective, TimeLimiterPipe, TimeSelectorService, datePopupThemeVariants, generateHourSet, generateMinuteSet, generateSecondSet };
59
- export type { CalendarView, DateDisabledType, DatePopupVariantInput, DatePopupVariantProps, HourFormat, Meridiem, TimeUnit };
59
+ /**
60
+ * The clock a locale uses by default: "12" for en-US, ja-JP and ko-KR, "24" for de-DE, fr-FR and tr-TR. Locales that
61
+ * mark the hour cycle explicitly (`en-US-u-hc-h23`) are honoured.
62
+ */
63
+ declare function getLocaleHourFormat(localeId: string): HourFormat;
64
+
65
+ /** Which part of the typed value min, max and `disabledDates` apply to. */
66
+ type TypedDateUnit = "date" | "datetime" | "time";
67
+ interface TypedDateConstraints {
68
+ readonly disabledDates?: DateDisabledType;
69
+ readonly max?: Date | null;
70
+ readonly min?: Date | null;
71
+ readonly unit: TypedDateUnit;
72
+ }
73
+ /** The error a picker reports when the typed text isn't a date in the input format. */
74
+ interface TypedDateParseError extends ValidationError.WithoutFieldTree {
75
+ readonly kind: "parse";
76
+ }
77
+ /** The error a picker reports when the typed date is one of its `disabledDates`. */
78
+ interface DisabledDateError extends ValidationError.WithoutFieldTree {
79
+ readonly date: Date;
80
+ readonly kind: "disabledDate";
81
+ }
82
+ /**
83
+ * Parses text typed into a picker. The input format is tried first, then the same format with one-digit months, days,
84
+ * hours, minutes and seconds ("1/5/2025", "9:05"), then with a two-digit year ("1/5/25"). Two-digit years up to 60
85
+ * read as 20xx, later ones as 19xx.
86
+ * @returns The parsed date, or null when the text isn't a date in any of these forms.
87
+ */
88
+ declare function parseTypedDate(text: string, format: string, localeId: string): DateTime | null;
89
+ /** Whether a date is one of `disabledDates`, compared by day. */
90
+ declare function isDateDisabled(date: Date, disabledDates: DateDisabledType): boolean;
91
+ /**
92
+ * Checks a typed date against a picker's min, max and `disabledDates`, the same limits its popup applies.
93
+ * @returns The error to report, or null when the date is allowed. Range errors are Angular's `minDate` and `maxDate`
94
+ * errors, so they read like the signal-forms validators.
95
+ */
96
+ declare function checkTypedDate(date: Date, constraints: TypedDateConstraints): ValidationError.WithoutFieldTree | null;
97
+ /** The error reported for text that doesn't parse. */
98
+ declare function typedDateParseError(): TypedDateParseError;
99
+ interface TypedDateInputOptions {
100
+ /** The limits the typed date is checked against. */
101
+ readonly constraints: () => TypedDateConstraints;
102
+ /** The format the value is shown in and typed text is parsed with. */
103
+ readonly format: () => string;
104
+ readonly localeId: () => string;
105
+ /** Turns the parsed text into the value, such as putting a typed time on the current value's day. */
106
+ readonly resolve?: (parsed: DateTime, current: Date | null) => Date;
107
+ readonly value: ModelSignal<Date | null>;
108
+ }
109
+ interface TypedDateInput {
110
+ /**
111
+ * Writes the typed text to the value. Text that doesn't parse, or a date outside the limits, leaves the value as
112
+ * it was and is reported through {@link errors}, and to the form field the picker is bound to. Empty text clears
113
+ * the value.
114
+ */
115
+ commit(): void;
116
+ /** Takes text typed into the input. Clearing the input commits at once, so the clear button empties the value. */
117
+ edit(text: string): void;
118
+ /** Parse and limit errors of the last commit. They clear when the value changes. */
119
+ readonly errors: Signal<readonly ValidationError.WithoutFieldTree[]>;
120
+ /** The text in the input: the formatted value, or what the user is typing. */
121
+ readonly text: WritableSignal<string>;
122
+ }
123
+ /**
124
+ * The typed-input pipeline of the date, time and date-time pickers. Call it in an injection context: the errors are
125
+ * reported to the form field (signal forms, `ngModel` or a reactive form control) bound to the picker.
126
+ */
127
+ declare function createTypedDateInput(options: TypedDateInputOptions): TypedDateInput;
128
+
129
+ export { CalendarService, DateInputPrefixTemplateDirective, TimeLimiterPipe, TimeSelectorService, checkTypedDate, createTypedDateInput, datePopupThemeVariants, generateHourSet, generateMinuteSet, generateSecondSet, getLocaleHourFormat, isDateDisabled, parseTypedDate, typedDateParseError };
130
+ export type { CalendarView, DateDisabledType, DatePopupVariantInput, DatePopupVariantProps, DisabledDateError, HourFormat, Meridiem, TimeUnit, TypedDateConstraints, TypedDateInput, TypedDateInputOptions, TypedDateParseError, TypedDateUnit };
@@ -5,7 +5,7 @@ import { TemplateRef } from '@angular/core';
5
5
  import { FormValueControl } from '@angular/forms/signals';
6
6
  import { CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective, CalendarYearCellTemplateDirective, FirstDayOfWeek } from '@nanahoshi/mona-ui/calendar';
7
7
  import { PreventableEvent } from '@nanahoshi/mona-ui/common';
8
- import { DatePopupVariantInput, DateDisabledType } from '@nanahoshi/mona-ui/date-input';
8
+ import { DatePopupVariantInput, TypedDateInput, DateDisabledType } from '@nanahoshi/mona-ui/date-input';
9
9
  import * as i1 from '@nanahoshi/mona-ui/dropdowns';
10
10
  import { DropdownPopupInput } from '@nanahoshi/mona-ui/dropdowns';
11
11
  import { VariantInputs, AttributeConfig } from '@nanahoshi/mona-ui/internal';
@@ -27,7 +27,6 @@ type DatePickerVariantInput = Omit<DatePickerBaseVariantInput, "focused">;
27
27
  declare class DatePickerComponent implements FormValueControl<Date | null>, DropdownPopupInput, DatePickerVariantInput, DatePopupVariantInput {
28
28
  #private;
29
29
  protected readonly baseClass: _angular_core.Signal<string>;
30
- protected readonly currentDateString: _angular_core.WritableSignal<string>;
31
30
  protected readonly decadeCellTemplate: _angular_core.Signal<CalendarDecadeCellTemplateDirective | undefined>;
32
31
  protected readonly effectiveFormat: _angular_core.Signal<string>;
33
32
  protected readonly expanded: _angular_core.Signal<boolean>;
@@ -35,12 +34,29 @@ declare class DatePickerComponent implements FormValueControl<Date | null>, Drop
35
34
  protected readonly invalidState: _angular_core.Signal<boolean>;
36
35
  protected readonly messages: _angular_core.Signal<_nanahoshi_mona_ui_i18n.MonaDatePickerMessages>;
37
36
  protected readonly monthCellTemplate: _angular_core.Signal<CalendarMonthCellTemplateDirective | undefined>;
38
- protected readonly navigatedDate: _angular_core.WritableSignal<Date>;
39
37
  protected readonly pickerPopupClass: _angular_core.Signal<string>;
40
38
  protected readonly popupId: string;
41
39
  protected readonly popupTemplate: _angular_core.Signal<TemplateRef<unknown>>;
42
40
  protected readonly prefixTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
41
+ /** Set in the constructor, which runs after the `value` model it writes to exists. */
42
+ protected readonly typedInput: TypedDateInput;
43
43
  protected readonly yearCellTemplate: _angular_core.Signal<CalendarYearCellTemplateDirective | undefined>;
44
+ /**
45
+ * @description Id of an element that describes the input, such as a hint or an error message.
46
+ * @default ""
47
+ */
48
+ readonly ariaDescribedBy: _angular_core.InputSignal<string>;
49
+ /**
50
+ * @description Accessible name of the input. Prefer a visible label, linked through {@link inputId} or
51
+ * {@link ariaLabelledBy}; the placeholder is not a label.
52
+ * @default ""
53
+ */
54
+ readonly ariaLabel: _angular_core.InputSignal<string>;
55
+ /**
56
+ * @description Id of the element that labels the input.
57
+ * @default ""
58
+ */
59
+ readonly ariaLabelledBy: _angular_core.InputSignal<string>;
44
60
  /**
45
61
  * @description Emits when the popup is about to close. This event is preventable.
46
62
  */
@@ -51,11 +67,13 @@ declare class DatePickerComponent implements FormValueControl<Date | null>, Drop
51
67
  readonly closed: _angular_core.OutputEmitterRef<void>;
52
68
  /**
53
69
  * @description Sets the disabled state of the date picker.
70
+ * @default false
54
71
  */
55
- readonly disabled: _angular_core.InputSignal<boolean>;
72
+ readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
56
73
  /**
57
74
  * @description Sets the disabled dates of the date picker.
58
- * Accepts either an iterable of Date objects or a predicate function.
75
+ * Accepts either an iterable of Date objects or a predicate function. Typing a disabled date is reported as a
76
+ * `disabledDate` error instead of setting the value.
59
77
  */
60
78
  readonly disabledDates: _angular_core.InputSignal<DateDisabledType>;
61
79
  /**
@@ -65,21 +83,28 @@ declare class DatePickerComponent implements FormValueControl<Date | null>, Drop
65
83
  readonly firstDay: _angular_core.InputSignal<FirstDayOfWeek | null>;
66
84
  /**
67
85
  * @description Sets the date format of the date picker. If not specified, derives from the active locale.
86
+ * Typed text is also accepted with one-digit days and months and a two-digit year.
68
87
  * @default null
69
88
  */
70
89
  readonly format: _angular_core.InputSignal<string | null>;
90
+ /**
91
+ * @description Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the
92
+ * date picker. A unique id is generated when it isn't set.
93
+ * @default generated
94
+ */
95
+ readonly inputId: _angular_core.InputSignal<string>;
71
96
  /**
72
97
  * @description Marks the date picker as invalid. When bound to a signal form field via `[formField]`,
73
98
  * this is written by the `FormField` directive.
74
99
  * @default false
75
100
  */
76
- readonly invalid: _angular_core.InputSignal<boolean>;
101
+ readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
77
102
  /**
78
- * @description Sets the maximum date of the date picker.
103
+ * @description Sets the maximum date of the date picker. A later typed date is reported as a `maxDate` error.
79
104
  */
80
105
  readonly max: _angular_core.InputSignalWithTransform<Date | undefined, unknown>;
81
106
  /**
82
- * @description Sets the minimum date of the date picker.
107
+ * @description Sets the minimum date of the date picker. An earlier typed date is reported as a `minDate` error.
83
108
  */
84
109
  readonly min: _angular_core.InputSignalWithTransform<Date | undefined, unknown>;
85
110
  /**
@@ -100,44 +125,46 @@ declare class DatePickerComponent implements FormValueControl<Date | null>, Drop
100
125
  */
101
126
  readonly popupClass: _angular_core.InputSignal<string>;
102
127
  /**
103
- * @description Sets the height of the popup element.
104
- * @default 200
128
+ * @description Sets the height of the popup element. When empty, the popup fits the calendar.
129
+ * @default ""
105
130
  */
106
131
  readonly popupHeight: _angular_core.InputSignal<ListSizeInputType>;
107
132
  /**
108
- * @description Sets the width of the popup element.
109
- * @default null
133
+ * @description Sets the width of the popup element. When empty, the popup fits the calendar.
134
+ * @default ""
110
135
  */
111
136
  readonly popupWidth: _angular_core.InputSignal<ListSizeInputType>;
112
137
  /**
113
138
  * @description Sets the readonly state of the date picker.
139
+ * @default false
114
140
  */
115
- readonly readonly: _angular_core.InputSignal<boolean>;
141
+ readonly readonly: _angular_core.InputSignalWithTransform<boolean, unknown>;
116
142
  /**
117
143
  * @description When true, the input is readonly but the calendar button remains enabled.
118
144
  * @default false
119
145
  */
120
- readonly readonlyInput: _angular_core.InputSignal<boolean>;
146
+ readonly readonlyInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
121
147
  /**
122
148
  * @description Sets the required state of the date picker.
123
149
  * When bound to a signal form field via `[formField]`, this is written by the `FormField` directive.
124
150
  * @default false
125
151
  */
126
- readonly required: _angular_core.InputSignal<boolean>;
152
+ readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
127
153
  /**
128
154
  * @description Sets the border radius of the date picker.
129
155
  */
130
156
  readonly rounded: _angular_core.InputSignal<"full" | "large" | "medium" | "none" | "small" | null | undefined>;
131
157
  /**
132
- * @description Sets the visibility of the clear button.
158
+ * @description Sets the visibility of the clear button. Clearing empties the value at once.
159
+ * @default false
133
160
  */
134
- readonly showClearButton: _angular_core.InputSignal<boolean>;
161
+ readonly showClearButton: _angular_core.InputSignalWithTransform<boolean, unknown>;
135
162
  /**
136
163
  * @description Sets the size of the date picker.
137
164
  */
138
165
  readonly size: _angular_core.InputSignal<"large" | "medium" | "small" | null | undefined>;
139
166
  /**
140
- * @description Emitted when the date picker is interacted with via blur, selection, or clear.
167
+ * @description Emitted when focus leaves the date picker and its popup.
141
168
  * The `FormField` directive listens to this to mark the field as touched.
142
169
  */
143
170
  readonly touch: _angular_core.OutputEmitterRef<void>;
@@ -146,10 +173,11 @@ declare class DatePickerComponent implements FormValueControl<Date | null>, Drop
146
173
  * this is written by the `FormField` directive.
147
174
  * @default false
148
175
  */
149
- readonly touched: _angular_core.InputSignal<boolean>;
176
+ readonly touched: _angular_core.InputSignalWithTransform<boolean, unknown>;
150
177
  readonly userClass: _angular_core.InputSignal<string>;
151
178
  /**
152
- * @description Two-way bindable current date value.
179
+ * @description Two-way bindable current date value. Typed text is written on Enter and when the input loses
180
+ * focus; text that isn't a valid date keeps the previous value and marks the field invalid.
153
181
  * @default null
154
182
  */
155
183
  readonly value: _angular_core.ModelSignal<Date | null>;
@@ -157,25 +185,25 @@ declare class DatePickerComponent implements FormValueControl<Date | null>, Drop
157
185
  * @description Enables the display of week numbers in the calendar.
158
186
  * @default false
159
187
  */
160
- readonly weekNumber: _angular_core.InputSignal<boolean>;
188
+ readonly weekNumber: _angular_core.InputSignalWithTransform<boolean, unknown>;
161
189
  constructor();
162
- focus(): void;
190
+ /**
191
+ * Focuses the input and places the caret after the text. Read-only pickers take focus too.
192
+ * @param options Options passed to the native `focus()` call, such as `preventScroll`.
193
+ */
194
+ focus(options?: FocusOptions): void;
163
195
  protected onCalendarValueChange(date: Date | Date[] | null): void;
164
- protected onDateInputBlur(): void;
165
196
  protected onDateInputButtonClick(): void;
166
- protected onDateStringEdit(dateString: string): void;
197
+ protected onFocusIn(event: FocusEvent): void;
198
+ protected onFocusOut(event: FocusEvent): void;
199
+ protected onInputBlur(): void;
200
+ protected onKeydown(event: KeyboardEvent): void;
167
201
  private closePopup;
168
- private compareDatesEqual;
169
- private dateStringEquals;
170
- private handleKeydown;
171
- private isDateDisabledByInput;
172
202
  private openPopup;
173
- private setCurrentDate;
174
- private setKeyboardSubscriptions;
175
- private setPopupCloseSubscriptions;
176
- private setSubscriptions;
203
+ private setCalendarKeyboardSubscription;
204
+ private setPopupCloseSubscription;
177
205
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DatePickerComponent, never>;
178
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DatePickerComponent, "mona-date-picker", never, { "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "disabledDates": { "alias": "disabledDates"; "required": false; "isSignal": true; }; "firstDay": { "alias": "firstDay"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "popupClass": { "alias": "popupClass"; "required": false; "isSignal": true; }; "popupHeight": { "alias": "popupHeight"; "required": false; "isSignal": true; }; "popupWidth": { "alias": "popupWidth"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "readonlyInput": { "alias": "readonlyInput"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "weekNumber": { "alias": "weekNumber"; "required": false; "isSignal": true; }; }, { "close": "close"; "closed": "closed"; "open": "open"; "opened": "opened"; "touch": "touch"; "value": "valueChange"; }, ["decadeCellTemplate", "monthCellTemplate", "prefixTemplate", "yearCellTemplate"], never, true, [{ directive: typeof i1.DropdownPopupHandlerDirective; inputs: {}; outputs: {}; }]>;
206
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DatePickerComponent, "mona-date-picker", never, { "ariaDescribedBy": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "disabledDates": { "alias": "disabledDates"; "required": false; "isSignal": true; }; "firstDay": { "alias": "firstDay"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "popupClass": { "alias": "popupClass"; "required": false; "isSignal": true; }; "popupHeight": { "alias": "popupHeight"; "required": false; "isSignal": true; }; "popupWidth": { "alias": "popupWidth"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "readonlyInput": { "alias": "readonlyInput"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "showClearButton": { "alias": "showClearButton"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "weekNumber": { "alias": "weekNumber"; "required": false; "isSignal": true; }; }, { "close": "close"; "closed": "closed"; "open": "open"; "opened": "opened"; "touch": "touch"; "value": "valueChange"; }, ["decadeCellTemplate", "monthCellTemplate", "prefixTemplate", "yearCellTemplate"], never, true, [{ directive: typeof i1.DropdownPopupHandlerDirective; inputs: {}; outputs: {}; }]>;
179
207
  }
180
208
 
181
209
  declare const DATE_PICKER_DEFAULT_MESSAGES: MonaDatePickerMessages;