@nanahoshi/mona-ui 0.37.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 (103) hide show
  1. package/docs/api/common.md +1 -1
  2. package/docs/api/date-picker.md +2 -0
  3. package/docs/api/date-range-picker.md +2 -0
  4. package/docs/api/datetime-picker.md +2 -0
  5. package/docs/api/dropdown-list.md +2 -0
  6. package/docs/api/dropdown-tree.md +81 -0
  7. package/docs/api/dropdowns.md +34 -8
  8. package/docs/api/i18n.md +33 -4
  9. package/docs/api/list.md +1 -1
  10. package/docs/api/locales.md +14 -14
  11. package/docs/api/multi-select-tree.md +75 -0
  12. package/docs/api/multi-select.md +3 -1
  13. package/docs/api/popup.md +1 -1
  14. package/docs/api/time-picker.md +2 -0
  15. package/docs/api/tree-view.md +2 -2
  16. package/docs/auto-complete.md +2 -0
  17. package/docs/combo-box.md +2 -0
  18. package/docs/date-picker.md +5 -1
  19. package/docs/date-range-picker.md +5 -1
  20. package/docs/datetime-picker.md +5 -1
  21. package/docs/dropdown-list.md +52 -0
  22. package/docs/dropdown-tree.md +427 -0
  23. package/docs/multi-select-tree.md +353 -0
  24. package/docs/multi-select.md +6 -0
  25. package/docs/time-picker.md +5 -1
  26. package/dropdown-tree/package.json +4 -0
  27. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +2 -2
  28. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +36 -2
  29. package/fesm2022/nanahoshi-mona-ui-date-range-picker.mjs +37 -3
  30. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +52 -5
  31. package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +40 -5
  32. package/fesm2022/nanahoshi-mona-ui-dropdown-tree.mjs +1061 -0
  33. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +730 -60
  34. package/fesm2022/nanahoshi-mona-ui-editor.mjs +8 -2
  35. package/fesm2022/nanahoshi-mona-ui-filter.mjs +4 -0
  36. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-S2iCn8TV.mjs → nanahoshi-mona-ui-grid-grid-list.component-BoSXXLKQ.mjs} +2 -2
  37. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-BUJvgihp.mjs → nanahoshi-mona-ui-grid-grid-row.component-Df2gfS0X.mjs} +3 -1
  38. 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
  39. package/fesm2022/nanahoshi-mona-ui-grid.mjs +8 -4
  40. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +13 -0
  41. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +80 -37
  42. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +7 -0
  43. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +7 -0
  44. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +7 -0
  45. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +7 -0
  46. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +7 -0
  47. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +7 -0
  48. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +7 -0
  49. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +7 -0
  50. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +17 -0
  51. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +7 -0
  52. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +17 -0
  53. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +7 -0
  54. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +7 -0
  55. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +7 -0
  56. package/fesm2022/nanahoshi-mona-ui-multi-select-tree.mjs +1179 -0
  57. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +42 -7
  58. package/fesm2022/nanahoshi-mona-ui-pager.mjs +3 -1
  59. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +39 -4
  60. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +2 -1
  61. package/i18n/catalogs/en-US.messages.json +9 -0
  62. package/llms.txt +6 -2
  63. package/locales/ar-sa/ar-sa.messages.json +9 -0
  64. package/locales/de-de/de-de.messages.json +9 -0
  65. package/locales/es-es/es-es.messages.json +9 -0
  66. package/locales/fr-fr/fr-fr.messages.json +9 -0
  67. package/locales/id-id/id-id.messages.json +9 -0
  68. package/locales/it-it/it-it.messages.json +9 -0
  69. package/locales/ja-jp/ja-jp.messages.json +9 -0
  70. package/locales/ko-kr/ko-kr.messages.json +9 -0
  71. package/locales/pl-pl/pl-pl.messages.json +9 -0
  72. package/locales/pt-br/pt-br.messages.json +9 -0
  73. package/locales/ru-ru/ru-ru.messages.json +9 -0
  74. package/locales/tr-tr/tr-tr.messages.json +9 -0
  75. package/locales/zh-cn/zh-cn.messages.json +9 -0
  76. package/locales/zh-tw/zh-tw.messages.json +9 -0
  77. package/multi-select-tree/package.json +4 -0
  78. package/package.json +9 -1
  79. package/types/nanahoshi-mona-ui-date-picker.d.ts +25 -1
  80. package/types/nanahoshi-mona-ui-date-range-picker.d.ts +26 -1
  81. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +34 -1
  82. package/types/nanahoshi-mona-ui-dropdown-list.d.ts +33 -5
  83. package/types/nanahoshi-mona-ui-dropdown-tree.d.ts +414 -0
  84. package/types/nanahoshi-mona-ui-dropdowns.d.ts +218 -9
  85. package/types/nanahoshi-mona-ui-i18n.d.ts +12 -0
  86. package/types/nanahoshi-mona-ui-internal-tree.d.ts +36 -0
  87. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +9 -0
  88. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +9 -0
  89. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +9 -0
  90. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +9 -0
  91. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +9 -0
  92. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +9 -0
  93. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +9 -0
  94. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +9 -0
  95. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +9 -0
  96. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +9 -0
  97. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +9 -0
  98. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +9 -0
  99. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +9 -0
  100. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +9 -0
  101. package/types/nanahoshi-mona-ui-multi-select-tree.d.ts +456 -0
  102. package/types/nanahoshi-mona-ui-multi-select.d.ts +43 -7
  103. package/types/nanahoshi-mona-ui-time-picker.d.ts +29 -2
@@ -0,0 +1,427 @@
1
+ # Dropdown Tree
2
+
3
+ > A closed control that opens a tree for choosing one item from a hierarchy.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/dropdown-tree`
6
+
7
+ **Selector:** `mona-dropdown-tree`
8
+
9
+ `DropdownTreeComponent` is a combobox that shows one selected item and opens a tree, for choosing an item from a hierarchy such as categories, folders or an organization. The popup opens on the selected item, with its parents opened to show it.
10
+
11
+ ## Overview
12
+
13
+ Dropdown Tree renders a single-value combobox whose popup is a tree. The field shows the selected item's text (or a placeholder), and the popup opens on click, `Enter`, `Space`, `ArrowDown` or `Alt+ArrowDown`. Choosing an item, by click or with `Enter`, selects it and closes the popup, whichever level it's on.
14
+
15
+ The data is a tree in one of two shapes, as in the [tree view](tree-view.md):
16
+
17
+ - **Hierarchical** (the default): each item holds its children, named by `children`. `children` can also be a function that returns an observable, which loads a node's children the first time it opens.
18
+ - **Flat**: one list, with `mode="flat"`, where `idField` and `parentIdField` link each item to its parent.
19
+
20
+ **Use Dropdown Tree when:**
21
+
22
+ - The options form a hierarchy, and a parent can be chosen as well as a leaf.
23
+ - The hierarchy is too deep or too long for grouped options in a [dropdown list](dropdown-list.md).
24
+
25
+ **Use `MultiSelectTree` instead when:**
26
+
27
+ - More than one item can be chosen at once.
28
+
29
+ **Use `TreeView` instead when:**
30
+
31
+ - The tree is part of the page, not a field in a form.
32
+
33
+ ## Import & Quick Start
34
+
35
+ ```typescript
36
+ import { DropdownTreeComponent } from "@nanahoshi/mona-ui/dropdown-tree";
37
+ ```
38
+
39
+ ```typescript
40
+ protected readonly categories = [
41
+ {
42
+ id: "clothing",
43
+ name: "Clothing",
44
+ items: [
45
+ { id: "shirts", name: "Shirts" },
46
+ { id: "trousers", name: "Trousers" }
47
+ ]
48
+ },
49
+ { id: "footwear", name: "Footwear", items: [{ id: "boots", name: "Boots" }] }
50
+ ];
51
+
52
+ protected readonly category = signal<string | null>(null);
53
+ ```
54
+
55
+ ```html
56
+ <mona-form-field label="Category">
57
+ <mona-dropdown-tree
58
+ children="items"
59
+ textField="name"
60
+ valueField="id"
61
+ [data]="categories"
62
+ [valuePrimitive]="true"
63
+ [(value)]="category" />
64
+ </mona-form-field>
65
+ ```
66
+
67
+ `textField`, `valueField` and `children` each take a property name or an accessor function. `valueField` identifies each item: it matches a value set from code to its node, and with `valuePrimitive` it's what the value holds instead of the whole item.
68
+
69
+ ## Anatomy
70
+
71
+ Each template below is an `ng-template` placed inside `<mona-dropdown-tree>`.
72
+
73
+ | Directive | Selector | Template context | Replaces |
74
+ |--------------------------------------|-----------------------------------------------|----------------------------------------------------|-------------------------------------------------|
75
+ | `DropdownItemTemplateDirective` | `ng-template[monaDropDownTreeItemTemplate]` | `{ $implicit: TData }` (the node's item) | Each node's text in the popup |
76
+ | `DropdownTreeValueTemplateDirective` | `ng-template[monaDropDownTreeValueTemplate]` | `{ $implicit: TData \| null }` (the selected item) | The selected item's text in the field |
77
+ | `DropdownHeaderTemplateDirective` | `ng-template[monaDropDownTreeHeaderTemplate]` | None | No default; renders above the tree |
78
+ | `DropdownFooterTemplateDirective` | `ng-template[monaDropDownTreeFooterTemplate]` | None | No default; renders below the tree |
79
+ | `DropdownNoDataTemplateDirective` | `ng-template[monaDropDownTreeNoDataTemplate]` | None | "No data", or "No matching items" when filtered |
80
+ | `DropdownPrefixTemplateDirective` | `ng-template[monaDropdownPrefixTemplate]` | None | No default; renders before the value |
81
+
82
+ The generic selectors of the other dropdowns, such as `monaDropDownItemTemplate`, work too. The item, header, footer and "no data" directives come from `@nanahoshi/mona-ui/dropdowns`, and the value template from `@nanahoshi/mona-ui/dropdown-tree`.
83
+
84
+ ## Examples
85
+
86
+ ### Choosing a category
87
+
88
+ The value is the category's id. `monaDropDownFilterable` puts a filter box in the popup: matching items show with their parents, which open to show them, and the first match becomes the active node, so `Enter` picks it. The form field names the dropdown tree, and its hint describes it. With `adaptiveMode="auto"`, the popup opens as a bottom sheet on a phone.
89
+
90
+ `categories-example.component.ts`
91
+
92
+ ```typescript
93
+ import { Component, signal } from "@angular/core";
94
+ import { DropdownTreeComponent } from "@nanahoshi/mona-ui/dropdown-tree";
95
+ import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
96
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
97
+
98
+ interface Category {
99
+ readonly id: string;
100
+ readonly items?: readonly Category[];
101
+ readonly name: string;
102
+ }
103
+
104
+ @Component({
105
+ selector: "app-dropdown-tree-categories-example",
106
+ imports: [DropdownFilterableDirective, DropdownTreeComponent, FormFieldComponent],
107
+ templateUrl: "./categories-example.component.html"
108
+ })
109
+ export class DropdownTreeCategoriesExampleComponent {
110
+ protected readonly categories: readonly Category[] = [
111
+ {
112
+ id: "clothing",
113
+ name: "Clothing",
114
+ items: [
115
+ {
116
+ id: "tops",
117
+ name: "Tops",
118
+ items: [
119
+ { id: "shirts", name: "Shirts" },
120
+ { id: "t-shirts", name: "T-shirts" },
121
+ { id: "sweaters", name: "Sweaters" }
122
+ ]
123
+ },
124
+ { id: "trousers", name: "Trousers" },
125
+ { id: "jackets", name: "Jackets" }
126
+ ]
127
+ },
128
+ {
129
+ id: "footwear",
130
+ name: "Footwear",
131
+ items: [
132
+ { id: "boots", name: "Boots" },
133
+ { id: "sandals", name: "Sandals" },
134
+ { id: "sneakers", name: "Sneakers" }
135
+ ]
136
+ },
137
+ {
138
+ id: "accessories",
139
+ name: "Accessories",
140
+ items: [
141
+ { id: "bags", name: "Bags" },
142
+ { id: "belts", name: "Belts" },
143
+ { id: "hats", name: "Hats" }
144
+ ]
145
+ }
146
+ ];
147
+ protected readonly category = signal<string | null>("t-shirts");
148
+ }
149
+ ```
150
+
151
+ `categories-example.component.html`
152
+
153
+ ```html
154
+ <div class="flex max-w-sm flex-col gap-2">
155
+ <mona-form-field label="Category" hint="Pick the most specific one.">
156
+ <mona-dropdown-tree
157
+ adaptiveMode="auto"
158
+ children="items"
159
+ class="w-full"
160
+ monaDropDownFilterable
161
+ placeholder="Choose a category"
162
+ textField="name"
163
+ valueField="id"
164
+ [data]="categories"
165
+ [showClearButton]="true"
166
+ [valuePrimitive]="true"
167
+ [(value)]="category" />
168
+ </mona-form-field>
169
+ <span class="text-sm">Category id: {{ category() ?? "none" }}</span>
170
+ </div>
171
+ ```
172
+
173
+ ### Loading children as nodes open
174
+
175
+ `children` returns an observable of a folder's subfolders, which loads them the first time the folder opens, and `hasChildren` tells which folders have any before they load. A load that takes a moment is announced. The value is the whole folder item.
176
+
177
+ `lazy-loading-example.component.ts`
178
+
179
+ ```typescript
180
+ import { Component, signal } from "@angular/core";
181
+ import { DropdownTreeComponent } from "@nanahoshi/mona-ui/dropdown-tree";
182
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
183
+ import { delay, type Observable, of } from "rxjs";
184
+
185
+ interface Folder {
186
+ readonly hasFolders: boolean;
187
+ readonly name: string;
188
+ readonly path: string;
189
+ }
190
+
191
+ /** A stand-in for a file server: each folder's subfolders arrive after a short wait. */
192
+ const SUBFOLDERS: Readonly<Record<string, readonly string[]>> = {
193
+ "/": ["Documents", "Photos", "Projects"],
194
+ "/Documents": ["Invoices", "Letters"],
195
+ "/Photos": ["2025", "2026"],
196
+ "/Projects": ["Mona UI", "Website"],
197
+ "/Projects/Mona UI": ["Docs", "Source"]
198
+ };
199
+
200
+ function folder(parent: string, name: string): Folder {
201
+ const path = parent === "/" ? `/${name}` : `${parent}/${name}`;
202
+ return { hasFolders: path in SUBFOLDERS, name, path };
203
+ }
204
+
205
+ @Component({
206
+ selector: "app-dropdown-tree-lazy-loading-example",
207
+ imports: [DropdownTreeComponent, FormFieldComponent],
208
+ templateUrl: "./lazy-loading-example.component.html"
209
+ })
210
+ export class DropdownTreeLazyLoadingExampleComponent {
211
+ protected readonly destination = signal<Folder | null>(null);
212
+ protected readonly roots: readonly Folder[] = SUBFOLDERS["/"].map(name => folder("/", name));
213
+
214
+ protected readonly hasFolders = (item: Folder): boolean => item.hasFolders;
215
+ protected readonly loadFolders = (item: Folder): Observable<Folder[]> =>
216
+ of((SUBFOLDERS[item.path] ?? []).map(name => folder(item.path, name))).pipe(delay(600));
217
+ }
218
+ ```
219
+
220
+ `lazy-loading-example.component.html`
221
+
222
+ ```html
223
+ <div class="flex max-w-sm flex-col gap-2">
224
+ <mona-form-field label="Save to">
225
+ <mona-dropdown-tree
226
+ class="w-full"
227
+ placeholder="Choose a folder"
228
+ textField="name"
229
+ valueField="path"
230
+ [children]="loadFolders"
231
+ [data]="roots"
232
+ [hasChildren]="hasFolders"
233
+ [(value)]="destination" />
234
+ </mona-form-field>
235
+ <span class="text-sm">Path: {{ destination()?.path ?? "none" }}</span>
236
+ </div>
237
+ ```
238
+
239
+ ### Flat data, disabled items and templates
240
+
241
+ With `mode="flat"`, the teams are one list linked by `parentId`. `itemDisabled` names a field that disables an item: an archived team can't be chosen, and neither can its children. The item template adds a note to archived teams, and the value template shows the selected team in the field.
242
+
243
+ `flat-data-example.component.ts`
244
+
245
+ ```typescript
246
+ import { Component, signal } from "@angular/core";
247
+ import { DropdownTreeComponent, DropdownTreeValueTemplateDirective } from "@nanahoshi/mona-ui/dropdown-tree";
248
+ import { DropdownItemTemplateDirective } from "@nanahoshi/mona-ui/dropdowns";
249
+ import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
250
+
251
+ interface Team {
252
+ readonly archived: boolean;
253
+ readonly id: number;
254
+ readonly name: string;
255
+ readonly parentId: number | null;
256
+ }
257
+
258
+ @Component({
259
+ selector: "app-dropdown-tree-flat-data-example",
260
+ imports: [
261
+ DropdownItemTemplateDirective,
262
+ DropdownTreeComponent,
263
+ DropdownTreeValueTemplateDirective,
264
+ FormFieldComponent
265
+ ],
266
+ templateUrl: "./flat-data-example.component.html"
267
+ })
268
+ export class DropdownTreeFlatDataExampleComponent {
269
+ protected readonly team = signal<number | null>(null);
270
+ protected readonly teams: readonly Team[] = [
271
+ { archived: false, id: 1, name: "Engineering", parentId: null },
272
+ { archived: false, id: 2, name: "Platform", parentId: 1 },
273
+ { archived: false, id: 3, name: "Mobile", parentId: 1 },
274
+ { archived: true, id: 4, name: "Desktop", parentId: 1 },
275
+ { archived: false, id: 5, name: "Design", parentId: null },
276
+ { archived: false, id: 6, name: "Research", parentId: 5 },
277
+ { archived: false, id: 7, name: "Brand", parentId: 5 },
278
+ { archived: false, id: 8, name: "Support", parentId: null }
279
+ ];
280
+ }
281
+ ```
282
+
283
+ `flat-data-example.component.html`
284
+
285
+ ```html
286
+ <mona-form-field class="max-w-sm" label="Team" hint="Archived teams can't take new members.">
287
+ <mona-dropdown-tree
288
+ class="w-full"
289
+ idField="id"
290
+ itemDisabled="archived"
291
+ mode="flat"
292
+ parentIdField="parentId"
293
+ placeholder="Choose a team"
294
+ textField="name"
295
+ valueField="id"
296
+ [data]="teams"
297
+ [valuePrimitive]="true"
298
+ [(value)]="team">
299
+ <ng-template monaDropDownTreeItemTemplate let-team>
300
+ <span class="flex flex-wrap items-baseline gap-x-2">
301
+ {{ team.name }}
302
+ @if (team.archived) {
303
+ <span class="text-xs text-muted-foreground">(archived)</span>
304
+ }
305
+ </span>
306
+ </ng-template>
307
+ <ng-template monaDropDownTreeValueTemplate let-team>
308
+ <span class="truncate">{{ team ? team.name + " team" : "Choose a team" }}</span>
309
+ </ng-template>
310
+ </mona-dropdown-tree>
311
+ </mona-form-field>
312
+ ```
313
+
314
+ ## Appearance & Styling
315
+
316
+ The dropdown tree has the sizes, corner roundings and states of the [dropdown list](dropdown-list.md): `size` is `small`, `medium` (default) or `large`, and `rounded` is `none`, `small`, `medium` (default), `large` or `full`.
317
+
318
+ | Input | What it does |
319
+ |-------------------|----------------------------------------------------------------------------------------------|
320
+ | `popupHeight` | The popup's maximum height; 200 pixels when unset. Shorter trees shrink to fit. |
321
+ | `popupWidth` | The popup's width; the field's width when unset. |
322
+ | `popupClass` | Classes added to the popup. |
323
+ | `showClearButton` | A button in the field that clears the value. |
324
+ | `adaptiveMode` | `"auto"` opens the popup as a bottom sheet on a small screen. See [On a phone](#on-a-phone). |
325
+
326
+ ## Behavior
327
+
328
+ ### Opening on the selected item
329
+
330
+ The popup opens with the selected item as its active node, and the item's parents open to show it. With nothing selected, the first node is active. As the filter changes, its first match becomes the active node. Closing the popup clears the filter.
331
+
332
+ ### Clicking or pressing Enter selects and closes
333
+
334
+ A click on a node, or `Enter` or `Space` on the active node, selects it and closes the popup, even when it's already selected. The arrow on a node opens and closes it without selecting it. `Escape`, `Tab` and a click outside close the popup and leave the value as it was.
335
+
336
+ ### Values set from code
337
+
338
+ A value set from code selects the node it matches through `valueField`. When the node isn't loaded yet (its parent hasn't opened), the field still shows the value's text for an object value; a primitive value shows only once its node loads, so give lazily loaded trees object values.
339
+
340
+ ### On a phone
341
+
342
+ With `adaptiveMode="auto"`, on a screen narrower than 640 pixels, the popup opens as a sheet along the bottom of the screen, over a dimmed page. The sheet has the field's name, or `adaptiveTitle`, and a close button. Its nodes are 44 pixels tall, to be easy to tap. Focus stays where it is, as with the popup under the field: on the field, or in the filter box. While an on-screen keyboard is open, the sheet sits above it.
343
+
344
+ ### `open` and `close` are cancelable
345
+
346
+ `open` and `close` emit a `PreventableEvent`; calling `preventDefault()` keeps the popup as it is. `opened` and `closed` follow once it has opened or closed.
347
+
348
+ ## Forms Integration
349
+
350
+ The dropdown tree implements `FormValueControl<TValue | null>`, so `[formField]` binds it to a signal form field, which then sets `disabled`, `readonly`, `required`, `invalid` and `touched`. It's touched when focus leaves it and its popup. It also works with `[(ngModel)]` and reactive forms.
351
+
352
+ ## Accessibility
353
+
354
+ ### Keyboard
355
+
356
+ | Key | When | Action |
357
+ |-----------------------------------------------------------|--------|---------------------------------------------------------------------------------|
358
+ | `Enter`, `Space`, `ArrowDown`, `ArrowUp`, `Alt+ArrowDown` | Closed | Opens the popup |
359
+ | `ArrowDown` / `ArrowUp` | Open | Moves to the next or previous visible node |
360
+ | `ArrowRight` | Open | Opens a closed node, or moves to its first child (`ArrowLeft` in right-to-left) |
361
+ | `ArrowLeft` | Open | Closes an open node, or moves to its parent (`ArrowRight` in right-to-left) |
362
+ | `Home` / `End` | Open | Moves to the first or last visible node |
363
+ | `*` | Open | Opens the active node's siblings |
364
+ | Letters and digits | Open | Moves to the next node whose text starts with them |
365
+ | `Enter` / `Space` | Open | Selects the active node and closes the popup |
366
+ | `Escape`, `Alt+ArrowUp` | Open | Closes the popup without changing the value |
367
+ | `Tab` | Open | Closes the popup and moves focus on |
368
+
369
+ In the filter box, `ArrowDown`, `ArrowUp` and `Enter` work as above, and the other keys edit the text.
370
+
371
+ ### Focus
372
+
373
+ Focus stays on the field while the popup is open, as for the other dropdowns; the active node is shown with a focus ring and announced through `aria-activedescendant`. With a filter box, focus moves into it when the popup opens, and returns to the field when the popup closes.
374
+
375
+ ### ARIA
376
+
377
+ - The field has `role="combobox"`, `aria-haspopup="tree"`, `aria-expanded`, and `aria-controls` pointing at the tree. It's named by `aria-label`, `aria-labelledby`, a form field's label or, failing those, the placeholder.
378
+ - The popup's tree has `role="tree"` and the field's name. Its nodes are `treeitem`s with `aria-level`, `aria-setsize`, `aria-posinset`, `aria-expanded` on nodes with children, and `aria-selected` on the selected node. A disabled node has `aria-disabled`, and a node whose children are loading has `aria-busy`.
379
+ - The filter box is a combobox too, named "Filter" and the field's name. How many items match is announced as the filter changes.
380
+ - `loading` sets `aria-busy` on the field.
381
+
382
+ ## API
383
+
384
+ Everything below is imported from `@nanahoshi/mona-ui/dropdown-tree`, unless a table names another entry point. Each name links to its reference page, with every input, output, property and method.
385
+
386
+ | Name | Kind | Description |
387
+ | --- | --- | --- |
388
+ | [`DropdownTreeComponent`](api/dropdown-tree.md#dropdowntreecomponent) | Component | |
389
+ | [`DropdownTreeValueTemplateDirective`](api/dropdown-tree.md#dropdowntreevaluetemplatedirective) | Directive | Renders the selected item in the field. |
390
+
391
+ From `@nanahoshi/mona-ui/dropdowns`:
392
+
393
+ | Name | Kind |
394
+ | --- | --- |
395
+ | [`DropdownFilterableDirective`](api/dropdowns.md#dropdownfilterabledirective) | Directive |
396
+ | [`DropdownGroupableDirective`](api/dropdowns.md#dropdowngroupabledirective) | Directive |
397
+ | [`DropdownVirtualScrollDirective`](api/dropdowns.md#dropdownvirtualscrolldirective) | Directive |
398
+ | [`DropdownDataHandlerDirective`](api/dropdowns.md#dropdowndatahandlerdirective) | Directive |
399
+ | [`DropdownFooterTemplateDirective`](api/dropdowns.md#dropdownfootertemplatedirective) | Directive |
400
+ | [`DropdownGroupHeaderTemplateDirective`](api/dropdowns.md#dropdowngroupheadertemplatedirective) | Directive |
401
+ | [`DropdownHeaderTemplateDirective`](api/dropdowns.md#dropdownheadertemplatedirective) | Directive |
402
+ | [`DropdownItemTemplateDirective`](api/dropdowns.md#dropdownitemtemplatedirective) | Directive |
403
+ | [`DropdownListPopupHandlerDirective`](api/dropdowns.md#dropdownlistpopuphandlerdirective) | Directive |
404
+ | [`DropdownNoDataTemplateDirective`](api/dropdowns.md#dropdownnodatatemplatedirective) | Directive |
405
+ | [`DropdownPrefixTemplateDirective`](api/dropdowns.md#dropdownprefixtemplatedirective) | Directive |
406
+ | [`DropdownSuffixTemplateDirective`](api/dropdowns.md#dropdownsuffixtemplatedirective) | Directive |
407
+ | [`DropdownListService`](api/dropdowns.md#dropdownlistservice) | Service |
408
+
409
+ ### Types
410
+
411
+ | Type | Kind |
412
+ | --- | --- |
413
+ | [`DROPDOWN_TREE_DEFAULT_MESSAGES`](api/dropdown-tree.md#dropdown-tree-default-messages) | Constant |
414
+
415
+ From `@nanahoshi/mona-ui/dropdowns`:
416
+
417
+ | Type | Kind | Description |
418
+ | --- | --- | --- |
419
+ | [`DropdownDataInputToken`](api/dropdowns.md#dropdowndatainputtoken) | Constant | **Deprecated.** Use `DROPDOWN_DATA_INPUT_TOKEN`. |
420
+ | [`DROPDOWNS_DEFAULT_MESSAGES`](api/dropdowns.md#dropdowns-default-messages) | Constant | |
421
+ | [`DropdownDataInput`](api/dropdowns.md#dropdowndatainput) | Interface | |
422
+ | [`DropdownSheetData`](api/dropdowns.md#dropdownsheetdata) | Interface | What a dropdown passes to the bottom sheet its popup opens as. |
423
+ | [`AdaptiveMode`](api/dropdowns.md#adaptivemode) | Type alias | How a dropdown's popup adapts to a small screen: `"auto"` opens it as a sheet along the bottom of the screen when the screen is narrower than 640 pixels, and `"none"` always opens it under the field. |
424
+ | [`DropdownFieldPredicateType`](api/dropdowns.md#dropdownfieldpredicatetype) | Type alias | |
425
+ | [`DropdownFieldSelectorType`](api/dropdowns.md#dropdownfieldselectortype) | Type alias | |
426
+
427
+ **Related types:** [`ChildrenSelector`](api/tree-view.md#childrenselector), [`DataStructure`](api/tree-view.md#datastructure), [`FilterableOptions`](api/common.md#filterableoptions), [`FilterChangeEvent`](api/common.md#filterchangeevent), [`GroupableOptions`](api/grid.md#groupableoptions), [`ListItem`](api/list.md#listitem), [`ListSizeInputType`](api/list.md#listsizeinputtype), [`ListSizeType`](api/list.md#listsizetype), [`MonaDropdownsMessages`](api/i18n.md#monadropdownsmessages), [`MonaDropdownTreeMessages`](api/i18n.md#monadropdowntreemessages), [`PopupCloseEvent`](api/popup.md#popupcloseevent), [`PreventableEvent`](api/common.md#preventableevent), [`VirtualScrollOptions`](api/common.md#virtualscrolloptions)