@nanahoshi/mona-ui 0.38.0 → 0.39.0

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 (26) hide show
  1. package/docs/api/date-picker.md +2 -0
  2. package/docs/api/date-range-picker.md +2 -0
  3. package/docs/api/datetime-picker.md +2 -0
  4. package/docs/api/dropdowns.md +1 -1
  5. package/docs/api/time-picker.md +2 -0
  6. package/docs/date-picker.md +5 -1
  7. package/docs/date-range-picker.md +5 -1
  8. package/docs/datetime-picker.md +5 -1
  9. package/docs/time-picker.md +5 -1
  10. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2 -2
  11. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +36 -2
  12. package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +37 -3
  13. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +52 -5
  14. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +39 -10
  15. package/fesm2022/nanahoshi-mona-ui-filter.mjs +2 -0
  16. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-S2iCn8TV.mjs → nanahoshi-mona-ui-grid-grid-list.component-BoSXXLKQ.mjs} +2 -2
  17. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-BUJvgihp.mjs → nanahoshi-mona-ui-grid-grid-row.component-Df2gfS0X.mjs} +3 -1
  18. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-Wndy-_Bt.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-xjrcCXXF.mjs} +2 -2
  19. package/fesm2022/nanahoshi-mona-ui-grid.mjs +6 -4
  20. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +39 -4
  21. package/package.json +1 -1
  22. package/types/nanahoshi-mona-ui-date-picker.d.ts +25 -1
  23. package/types/nanahoshi-mona-ui-date-range-picker.d.ts +26 -1
  24. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +34 -1
  25. package/types/nanahoshi-mona-ui-dropdowns.d.ts +25 -6
  26. package/types/nanahoshi-mona-ui-time-picker.d.ts +29 -2
@@ -5,7 +5,7 @@ import { CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective
5
5
  import { PreventableEvent } from "@nanahoshi/mona-ui/common";
6
6
  import { DateDisabledType, DatePopupVariantInput } from "@nanahoshi/mona-ui/date-input";
7
7
  import * as i1 from "@nanahoshi/mona-ui/dropdowns";
8
- import { DropdownPopupInput } from "@nanahoshi/mona-ui/dropdowns";
8
+ import { AdaptiveMode, DropdownPopupInput } from "@nanahoshi/mona-ui/dropdowns";
9
9
  import { AttributeConfig, VariantInputs } from "@nanahoshi/mona-ui/internal";
10
10
  import { ListSizeInputType } from "@nanahoshi/mona-ui/internal/list";
11
11
  import { PopupCloseEvent } from "@nanahoshi/mona-ui/popup";
@@ -117,10 +117,13 @@ export declare class DateRangePickerComponent implements FormValueControl<DateRa
117
117
  protected readonly pickerPopupClass: import("@angular/core").Signal<string>;
118
118
  protected readonly popupId: string;
119
119
  protected readonly popupTemplate: import("@angular/core").Signal<TemplateRef<unknown>>;
120
+ /** A quick range: as tall as a row of the calendar, and 44 pixels tall in a bottom sheet, for touch. */
120
121
  protected readonly presetClass: import("@angular/core").Signal<string>;
121
122
  protected readonly presetItems: import("@angular/core").Signal<readonly DateRangePresetItem[]>;
122
123
  protected readonly presetListClass: string;
123
124
  protected readonly separatorClass: string;
125
+ /** Whether the popup is open as a bottom sheet, which the popup fills. */
126
+ protected readonly sheet: import("@angular/core").Signal<boolean>;
124
127
  protected readonly sizerClass: import("@angular/core").Signal<string>;
125
128
  protected readonly startInputId: string;
126
129
  protected readonly startInvalid: import("@angular/core").Signal<boolean>;
@@ -128,6 +131,18 @@ export declare class DateRangePickerComponent implements FormValueControl<DateRa
128
131
  /** Set in the constructor, which runs after the `value` model it writes to exists. */
129
132
  protected readonly typedInput: TypedDateRangeInput;
130
133
  protected readonly yearCellTemplate: import("@angular/core").Signal<CalendarYearCellTemplateDirective | undefined>;
134
+ /**
135
+ * @description Opens the popup as a sheet along the bottom of the screen on a small screen (narrower than 640
136
+ * pixels) with `"auto"`, so it's easy to reach with a thumb. With `"none"`, it always opens under the field.
137
+ * @default "none"
138
+ */
139
+ readonly adaptiveMode: import("@angular/core").InputSignal<AdaptiveMode>;
140
+ /**
141
+ * @description Title of the bottom sheet the popup opens as with `adaptiveMode="auto"`. When empty, the sheet
142
+ * shows the field's name.
143
+ * @default ""
144
+ */
145
+ readonly adaptiveTitle: import("@angular/core").InputSignal<string>;
131
146
  /**
132
147
  * @description Id of an element that describes the range, such as a hint or an error message. It describes both
133
148
  * inputs.
@@ -310,6 +325,16 @@ export declare class DateRangePickerComponent implements FormValueControl<DateRa
310
325
  private setPopupCloseSubscription;
311
326
  static ɵfac: i0.ɵɵFactoryDeclaration<DateRangePickerComponent, never>;
312
327
  static ɵcmp: i0.ɵɵComponentDeclaration<DateRangePickerComponent, "mona-date-range-picker", never, {
328
+ "adaptiveMode": {
329
+ "alias": "adaptiveMode";
330
+ "required": false;
331
+ "isSignal": true;
332
+ };
333
+ "adaptiveTitle": {
334
+ "alias": "adaptiveTitle";
335
+ "required": false;
336
+ "isSignal": true;
337
+ };
313
338
  "ariaDescribedBy": {
314
339
  "alias": "aria-describedby";
315
340
  "required": false;
@@ -5,7 +5,7 @@ import { CalendarDecadeCellTemplateDirective, CalendarMonthCellTemplateDirective
5
5
  import { PreventableEvent } from "@nanahoshi/mona-ui/common";
6
6
  import { DateDisabledType, HourFormat, TypedDateInput } from "@nanahoshi/mona-ui/date-input";
7
7
  import * as i1 from "@nanahoshi/mona-ui/dropdowns";
8
- import { DropdownPopupInput } from "@nanahoshi/mona-ui/dropdowns";
8
+ import { AdaptiveMode, DropdownPopupInput } from "@nanahoshi/mona-ui/dropdowns";
9
9
  import { AttributeConfig, VariantInputs } from "@nanahoshi/mona-ui/internal";
10
10
  import { ListSizeInputType } from "@nanahoshi/mona-ui/internal/list";
11
11
  import { PopupCloseEvent } from "@nanahoshi/mona-ui/popup";
@@ -34,17 +34,39 @@ export declare class DateTimePickerComponent implements FormValueControl<Date |
34
34
  protected readonly messages: import("@angular/core").Signal<import("@nanahoshi/mona-ui/i18n").MonaDateTimePickerMessages>;
35
35
  protected readonly monthCellTemplate: import("@angular/core").Signal<CalendarMonthCellTemplateDirective | undefined>;
36
36
  protected readonly navigatedDate: import("@angular/core").WritableSignal<Date>;
37
+ /**
38
+ * In a bottom sheet, the panel keeps the height the date view opened with: the sheet doesn't shrink on the time tab
39
+ * and move the tabs from under the finger, and the time selector, which sizes its lists from its own height, gets
40
+ * one. `null` under the field, where the popup has a fixed height.
41
+ */
42
+ protected readonly panelHeight: import("@angular/core").WritableSignal<number | null>;
37
43
  protected readonly panelId: string;
38
44
  protected readonly pickerPopupClass: import("@angular/core").Signal<string>;
39
45
  protected readonly popupId: string;
40
46
  protected readonly popupTemplate: import("@angular/core").Signal<TemplateRef<unknown>>;
41
47
  protected readonly prefixTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
48
+ /** Whether the popup is open as a bottom sheet, which the popup fills. */
49
+ protected readonly sheet: import("@angular/core").Signal<boolean>;
42
50
  protected readonly timePickerMax: import("@angular/core").Signal<Date | null>;
43
51
  protected readonly timePickerMin: import("@angular/core").Signal<Date | null>;
52
+ /** The time selector's size: large in a bottom sheet, for touch. */
53
+ protected readonly timeSelectorSize: import("@angular/core").Signal<"large" | "medium" | "small" | null | undefined>;
44
54
  protected readonly timeTabId: string;
45
55
  /** Set in the constructor, which runs after the `value` model it writes to exists. */
46
56
  protected readonly typedInput: TypedDateInput;
47
57
  protected readonly yearCellTemplate: import("@angular/core").Signal<CalendarYearCellTemplateDirective | undefined>;
58
+ /**
59
+ * @description Opens the popup as a sheet along the bottom of the screen on a small screen (narrower than 640
60
+ * pixels) with `"auto"`, so it's easy to reach with a thumb. With `"none"`, it always opens under the field.
61
+ * @default "none"
62
+ */
63
+ readonly adaptiveMode: import("@angular/core").InputSignal<AdaptiveMode>;
64
+ /**
65
+ * @description Title of the bottom sheet the popup opens as with `adaptiveMode="auto"`. When empty, the sheet
66
+ * shows the field's name.
67
+ * @default ""
68
+ */
69
+ readonly adaptiveTitle: import("@angular/core").InputSignal<string>;
48
70
  /**
49
71
  * @description Id of an element that describes the input, such as a hint or an error message.
50
72
  * @default ""
@@ -241,11 +263,22 @@ export declare class DateTimePickerComponent implements FormValueControl<Date |
241
263
  private openPopup;
242
264
  private setPopupCloseSubscription;
243
265
  private setPopupKeyboardSubscription;
266
+ private setPopupOpenSubscription;
244
267
  /** Where the popup starts without a value: now, moved into the min and max range so Set can't leave it. */
245
268
  private startDate;
246
269
  private updateDateIfNotInRange;
247
270
  static ɵfac: i0.ɵɵFactoryDeclaration<DateTimePickerComponent, never>;
248
271
  static ɵcmp: i0.ɵɵComponentDeclaration<DateTimePickerComponent, "mona-datetime-picker", never, {
272
+ "adaptiveMode": {
273
+ "alias": "adaptiveMode";
274
+ "required": false;
275
+ "isSignal": true;
276
+ };
277
+ "adaptiveTitle": {
278
+ "alias": "adaptiveTitle";
279
+ "required": false;
280
+ "isSignal": true;
281
+ };
249
282
  "ariaDescribedBy": {
250
283
  "alias": "aria-describedby";
251
284
  "required": false;
@@ -1,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { InjectionToken, InputSignal, OutputEmitterRef, Signal, TemplateRef } from "@angular/core";
2
+ import { ElementRef, InjectionToken, InputSignal, OutputEmitterRef, Signal, TemplateRef } from "@angular/core";
3
3
  import { Predicate, Selector } from "@mirei/ts-collections";
4
4
  import { GroupableOptions, ListItem, ListSizeInputType } from "@nanahoshi/mona-ui/internal/list";
5
5
  import { PopupCloseEvent, PopupRef, PopupSettings } from "@nanahoshi/mona-ui/popup";
@@ -58,17 +58,23 @@ export interface DropdownSheetData {
58
58
  * The bottom sheet a dropdown's popup opens as on a small screen (`adaptiveMode="auto"`): a header with the field's
59
59
  * name and a close button, over the dropdown's own popup.
60
60
  *
61
- * Focus stays on the field, or in the popup's filter box, as it does in the popup under the field. So the sheet isn't a
62
- * dialog, and its close button is for pointers; the keyboard closes it with Escape or Tab.
61
+ * Focus is where the popup under the field keeps it: on the field or in the filter box for a list or a tree, and in
62
+ * the popup, a dialog, for a date or time picker. So the sheet's close button is for pointers; the keyboard closes the
63
+ * sheet with Escape, or Tab for a list or a tree.
63
64
  * @hidden Exported for Mona UI's other entry points; applications don't need it.
64
65
  */
65
66
  export declare class DropdownSheetComponent {
66
67
  #private;
68
+ protected readonly content: Signal<ElementRef<HTMLElement>>;
67
69
  protected readonly data: DropdownSheetData;
68
70
  protected readonly messages: Signal<import("@nanahoshi/mona-ui/i18n").MonaDropdownsMessages>;
69
71
  protected readonly sheetClass: string;
70
72
  protected closeSheet(): void;
71
- /** Keeps focus on the field (or in the filter box) when the sheet is pressed. */
73
+ /**
74
+ * Keeps focus where it is when the sheet's own parts are pressed: its handle, its title or its close button. The
75
+ * dropdown's popup handles presses on itself, as it does under the field: a list keeps focus on the field, and a
76
+ * calendar takes it.
77
+ */
72
78
  protected onPointerDown(event: PointerEvent): void;
73
79
  static ɵfac: i0.ɵɵFactoryDeclaration<DropdownSheetComponent, never>;
74
80
  static ɵcmp: i0.ɵɵComponentDeclaration<DropdownSheetComponent, "mona-dropdown-sheet", never, {}, {}, never, never, true, never>;
@@ -279,13 +285,15 @@ export declare class DropdownPopupHandlerDirective {
279
285
  private followVisualViewport;
280
286
  private getMaxHeight;
281
287
  private getMinWidth;
288
+ /** An element's name as assistive technology reads it: `aria-labelledby` first, then `aria-label`, then `<label>`s. */
289
+ private nameOf;
282
290
  private openPopup;
283
291
  /** Whether the popup opens as a bottom sheet: with `adaptiveMode="auto"`, on a small screen. */
284
292
  private opensAsSheet;
285
293
  private setPopupCloseSubscriptions;
286
294
  /**
287
- * The bottom sheet's title: the host's `adaptiveTitle`, or else its accessible name (`aria-labelledby` first, as
288
- * assistive technology reads it, then `aria-label`).
295
+ * The bottom sheet's title: the host's `adaptiveTitle`, or else the field's name. A date or time picker names its
296
+ * input rather than itself, so the input's name is read when the host has none.
289
297
  */
290
298
  private sheetTitle;
291
299
  private togglePopup;
@@ -451,6 +459,17 @@ export declare const dropdownSheetThemeVariants: (props?: import("class-variance
451
459
  * @hidden Exported for Mona UI's other entry points; applications don't need it.
452
460
  */
453
461
  export declare const dropdownSheetSurfaceClasses = "\n h-full max-h-none flex-1 rounded-none border-0 shadow-none text-base\n [&_[role=option]]:min-h-11 [&_mona-tree-node>div]:py-2.5\n";
462
+ /**
463
+ * A date or time picker's popup inside the bottom sheet: it fills the sheet, which draws the border, corners and
464
+ * shadow, and scrolls when it's taller, as several months can be.
465
+ *
466
+ * The calendar spans the sheet's width, and its days grow to 44 pixels, to be easy to tap, as far as eight columns
467
+ * (with week numbers) still fit the screen. It keeps the height of a six-week month (its padding, header and gap,
468
+ * then seven rows of days with the weekday names), so the sheet's top edge, and the buttons on it, stay put as the
469
+ * months change.
470
+ * @hidden Exported for Mona UI's other entry points; applications don't need it.
471
+ */
472
+ export declare const dropdownSheetPickerClasses = "\n h-full max-h-none min-h-0 w-full max-w-none flex-1 rounded-none border-0 shadow-none\n [--mona-calendar-cell-size:min(2.75rem,calc((100dvw_-_3rem)/8))]\n [&_mona-calendar]:w-full [&_mona-calendar]:shrink-0\n [&_mona-calendar]:min-h-[calc(4.5rem_+_7_*_var(--mona-calendar-cell-size))]\n";
454
473
  /**
455
474
  * Reads a dropdown field from an item: a property of it when the field is a name, or what the field returns when it
456
475
  * is an accessor. Without a field, the item itself.
@@ -3,11 +3,12 @@ import { Signal, TemplateRef } from "@angular/core";
3
3
  import { FormValueControl } from "@angular/forms/signals";
4
4
  import { PreventableEvent } from "@nanahoshi/mona-ui/common";
5
5
  import { HourFormat, TypedDateInput } from "@nanahoshi/mona-ui/date-input";
6
+ import * as i1 from "@nanahoshi/mona-ui/dropdowns";
7
+ import { AdaptiveMode, DropdownPopupInput } from "@nanahoshi/mona-ui/dropdowns";
6
8
  import { AttributeConfig, VariantInputs } from "@nanahoshi/mona-ui/internal";
7
9
  import { ListSizeInputType } from "@nanahoshi/mona-ui/internal/list";
8
10
  import { PopupCloseEvent } from "@nanahoshi/mona-ui/popup";
9
11
  import { VariantProps } from "class-variance-authority";
10
- import * as i1 from "@nanahoshi/mona-ui/dropdowns";
11
12
  import { MonaTimePickerMessages } from "@nanahoshi/mona-ui/i18n";
12
13
  declare const timePickerBaseThemeVariants: (props?: ({
13
14
  focused?: boolean | null | undefined;
@@ -18,7 +19,7 @@ type TimePickerBaseVariantProps = VariantProps<typeof timePickerBaseThemeVariant
18
19
  type TimePickerBaseVariantInput = VariantInputs<TimePickerBaseVariantProps>;
19
20
  export type TimePickerVariantProps = TimePickerBaseVariantProps;
20
21
  type TimePickerVariantInput = Omit<TimePickerBaseVariantInput, "focused">;
21
- export declare class TimePickerComponent implements FormValueControl<Date | null>, TimePickerVariantInput {
22
+ export declare class TimePickerComponent implements FormValueControl<Date | null>, DropdownPopupInput, TimePickerVariantInput {
22
23
  #private;
23
24
  protected readonly baseClass: Signal<string>;
24
25
  protected readonly describedBy: Signal<string | null>;
@@ -32,9 +33,25 @@ export declare class TimePickerComponent implements FormValueControl<Date | null
32
33
  protected readonly messages: Signal<import("@nanahoshi/mona-ui/i18n").MonaTimePickerMessages>;
33
34
  protected readonly pickerPopupClass: Signal<string>;
34
35
  protected readonly popupId: string;
36
+ /** Whether the popup is open as a bottom sheet, which the popup fills. */
37
+ protected readonly sheet: Signal<boolean>;
35
38
  protected readonly timePopupTemplateRef: Signal<TemplateRef<unknown>>;
39
+ /** The time selector's size: large in a bottom sheet, for touch. */
40
+ protected readonly timeSelectorSize: Signal<"large" | "medium" | "small" | null | undefined>;
36
41
  /** Set in the constructor, which runs after the `value` model it writes to exists. */
37
42
  protected readonly typedInput: TypedDateInput;
43
+ /**
44
+ * @description Opens the popup as a sheet along the bottom of the screen on a small screen (narrower than 640
45
+ * pixels) with `"auto"`, so it's easy to reach with a thumb. With `"none"`, it always opens under the field.
46
+ * @default "none"
47
+ */
48
+ readonly adaptiveMode: import("@angular/core").InputSignal<AdaptiveMode>;
49
+ /**
50
+ * @description Title of the bottom sheet the popup opens as with `adaptiveMode="auto"`. When empty, the sheet
51
+ * shows the field's name.
52
+ * @default ""
53
+ */
54
+ readonly adaptiveTitle: import("@angular/core").InputSignal<string>;
38
55
  /**
39
56
  * @description Id of an element that describes the input, such as a hint or an error message.
40
57
  * @default ""
@@ -212,6 +229,16 @@ export declare class TimePickerComponent implements FormValueControl<Date | null
212
229
  private setPopupCloseSubscription;
213
230
  static ɵfac: i0.ɵɵFactoryDeclaration<TimePickerComponent, never>;
214
231
  static ɵcmp: i0.ɵɵComponentDeclaration<TimePickerComponent, "mona-time-picker", never, {
232
+ "adaptiveMode": {
233
+ "alias": "adaptiveMode";
234
+ "required": false;
235
+ "isSignal": true;
236
+ };
237
+ "adaptiveTitle": {
238
+ "alias": "adaptiveTitle";
239
+ "required": false;
240
+ "isSignal": true;
241
+ };
215
242
  "ariaDescribedBy": {
216
243
  "alias": "aria-describedby";
217
244
  "required": false;