@nanahoshi/mona-ui 0.25.0 → 0.26.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.
- package/README.md +2 -0
- package/command/package.json +4 -0
- package/docs/auto-complete.md +733 -0
- package/docs/avatar.md +220 -0
- package/docs/breadcrumb.md +320 -0
- package/docs/button-group.md +392 -0
- package/docs/button.md +256 -0
- package/docs/calendar.md +515 -0
- package/docs/card.md +292 -0
- package/docs/chart.md +4058 -0
- package/docs/checkbox.md +374 -0
- package/docs/chip.md +339 -0
- package/docs/circular-progress-bar.md +287 -0
- package/docs/collapsible.md +308 -0
- package/docs/color-gradient.md +336 -0
- package/docs/color-palette.md +317 -0
- package/docs/color-picker.md +387 -0
- package/docs/combo-box.md +764 -0
- package/docs/command.md +582 -0
- package/docs/contextmenu.md +530 -0
- package/docs/date-picker.md +251 -0
- package/docs/datetime-picker.md +284 -0
- package/docs/decimal-textbox.md +260 -0
- package/docs/dialog.md +822 -0
- package/docs/dropdown-button.md +507 -0
- package/docs/dropdown-list.md +779 -0
- package/docs/editor.md +374 -0
- package/docs/expansion-panel.md +348 -0
- package/docs/fieldset.md +217 -0
- package/docs/forms.md +162 -0
- package/docs/grid.md +2053 -0
- package/docs/input.md +197 -0
- package/docs/installation.md +54 -0
- package/docs/introduction.md +46 -0
- package/docs/label.md +340 -0
- package/docs/list-box.md +637 -0
- package/docs/list-view.md +584 -0
- package/docs/menubar.md +559 -0
- package/docs/multi-select.md +765 -0
- package/docs/notification.md +460 -0
- package/docs/numeric-textbox.md +301 -0
- package/docs/otp-input.md +539 -0
- package/docs/pager.md +513 -0
- package/docs/placeholder.md +176 -0
- package/docs/popover.md +423 -0
- package/docs/popup-menu.md +658 -0
- package/docs/popup.md +617 -0
- package/docs/progress-bar.md +368 -0
- package/docs/radio-button.md +451 -0
- package/docs/range-slider.md +367 -0
- package/docs/rating.md +518 -0
- package/docs/scroll-view.md +375 -0
- package/docs/segmented.md +434 -0
- package/docs/sheet.md +348 -0
- package/docs/sidebar.md +1126 -0
- package/docs/skeleton.md +181 -0
- package/docs/slider.md +423 -0
- package/docs/spinner.md +370 -0
- package/docs/split-button.md +522 -0
- package/docs/splitter.md +342 -0
- package/docs/stepper.md +539 -0
- package/docs/switch.md +340 -0
- package/docs/tabs.md +542 -0
- package/docs/textarea.md +196 -0
- package/docs/textbox.md +332 -0
- package/docs/theming.md +403 -0
- package/docs/time-picker.md +254 -0
- package/docs/tooltip-directive.md +340 -0
- package/docs/tooltip.md +321 -0
- package/docs/tree-view.md +1018 -0
- package/docs/window.md +663 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-button.mjs +14 -2
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +108 -22
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +7 -3
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +8 -3
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +10 -7
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +53 -21
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
- package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
- package/i18n/catalogs/en-US.messages.json +10 -0
- package/internal/popup-menu/package.json +4 -0
- package/llms.txt +123 -0
- package/locales/ar-sa/ar-sa.messages.json +10 -0
- package/locales/de-de/de-de.messages.json +10 -0
- package/locales/es-es/es-es.messages.json +10 -0
- package/locales/fr-fr/fr-fr.messages.json +10 -0
- package/locales/id-id/id-id.messages.json +10 -0
- package/locales/it-it/it-it.messages.json +10 -0
- package/locales/ja-jp/ja-jp.messages.json +10 -0
- package/locales/ko-kr/ko-kr.messages.json +10 -0
- package/locales/pt-br/pt-br.messages.json +10 -0
- package/locales/ru-ru/ru-ru.messages.json +10 -0
- package/locales/tr-tr/tr-tr.messages.json +10 -0
- package/locales/zh-cn/zh-cn.messages.json +10 -0
- package/locales/zh-tw/zh-tw.messages.json +10 -0
- package/package.json +9 -1
- package/styles.css +12 -2
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
- package/types/nanahoshi-mona-ui-button.d.ts +12 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-command.d.ts +253 -0
- package/types/nanahoshi-mona-ui-common.d.ts +17 -1
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
- package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
- package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
- package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
- package/types/nanahoshi-mona-ui-label.d.ts +1 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
- package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
- package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
- package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
- package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
- package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
- package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
- package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
- package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
- package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
- package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
- package/types/nanahoshi-mona-ui-window.d.ts +66 -1
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
# Dropdown List
|
|
2
|
+
|
|
3
|
+
> A closed control that opens a list for choosing exactly one option.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/dropdown-list`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-dropdown-list`
|
|
8
|
+
|
|
9
|
+
`DropdownListComponent` is a combobox that displays a single selected value and expands a listbox popup for the consumer to choose exactly one option from a fixed collection.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Dropdown List renders a single-value combobox: the host element shows the current selection (or a placeholder) and opens a listbox popup on click, `Enter`, `Space`, or `Alt+ArrowDown`. The value area is not an editable text input — typing only happens inside the popup's filter box, and only once filtering is explicitly enabled.
|
|
14
|
+
|
|
15
|
+
Filtering, grouping, and virtual scrolling are opt-in through companion attribute directives applied to the same `<mona-dropdown-list>` host element, the same pattern used by List View:
|
|
16
|
+
|
|
17
|
+
- `monaDropDownFilterable` — renders a filter input inside the popup and narrows visible options by text.
|
|
18
|
+
- `monaDropDownGroupable` — groups options under a header row.
|
|
19
|
+
- `monaDropDownVirtualScroll` — renders only the options currently in view.
|
|
20
|
+
|
|
21
|
+
**Use Dropdown List when:**
|
|
22
|
+
|
|
23
|
+
- The consumer picks exactly one value from a known, bounded set of options.
|
|
24
|
+
- Free-text entry into the value area itself is not needed.
|
|
25
|
+
|
|
26
|
+
**Use `ComboBox` instead when:**
|
|
27
|
+
|
|
28
|
+
- The consumer should be able to type directly into the value area, not just into a popup filter box.
|
|
29
|
+
|
|
30
|
+
**Use `MultiSelect` instead when:**
|
|
31
|
+
|
|
32
|
+
- More than one value can be selected at once.
|
|
33
|
+
|
|
34
|
+
**Use `AutoComplete` instead when:**
|
|
35
|
+
|
|
36
|
+
- The consumer enters free text with suggestions, and the value does not need to match a list item.
|
|
37
|
+
|
|
38
|
+
## Import & Quick Start
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { DropdownListComponent } from "@nanahoshi/mona-ui/dropdown-list";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
protected readonly countries = [
|
|
46
|
+
{ id: 1, name: "United States" },
|
|
47
|
+
{ id: 2, name: "Canada" },
|
|
48
|
+
{ id: 3, name: "Mexico" }
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
protected readonly selectedCountry = signal<{ id: number; name: string } | null>(null);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
|
|
56
|
+
<mona-dropdown-list
|
|
57
|
+
[data]="countries"
|
|
58
|
+
textField="name"
|
|
59
|
+
valueField="id"
|
|
60
|
+
placeholder="Select a country"
|
|
61
|
+
[(value)]="selectedCountry">
|
|
62
|
+
</mona-dropdown-list>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`textField` and `valueField` each accept a property name or an accessor function; when either is omitted, the data item itself is used as the display text or the value, respectively. `valueField` also identifies each item for selection matching and, when `valuePrimitive` is enabled, is what gets read from and written into `value` instead of the full item — see [Primitive value binding](#primitive-value-binding). Without any behavior directive applied, the popup renders the full `data` collection with no filter box — see [Examples](#examples) for filtering, grouping, and virtual scrolling.
|
|
66
|
+
|
|
67
|
+
## Anatomy
|
|
68
|
+
|
|
69
|
+
Each structural directive below is an `ng-template` placed as projected content inside `<mona-dropdown-list>...</mona-dropdown-list>`.
|
|
70
|
+
|
|
71
|
+
| Directive | Selector | Template context | Replaces |
|
|
72
|
+
|----------------------------------------|------------------------------------------------|--------------------------------------------------------------------|-----------------------------------------------------------------------------------|
|
|
73
|
+
| `DropdownItemTemplateDirective` | `ng-template[monaDropDownItemTemplate]` | `{ $implicit: TData }` (the option's data item) | Each option's default text rendering inside the popup |
|
|
74
|
+
| `DropDownListValueTemplateDirective` | `ng-template[monaDropDownListValueTemplate]` | `{ $implicit: TData \| null }` (the selected data item, or `null`) | The default selected-value text rendered in the host element |
|
|
75
|
+
| `DropdownGroupHeaderTemplateDirective` | `ng-template[monaDropDownGroupHeaderTemplate]` | `{ $implicit: group }` | The default group header row, when grouping is enabled |
|
|
76
|
+
| `DropdownHeaderTemplateDirective` | `ng-template[monaDropDownHeaderTemplate]` | None | No default — renders above the option list inside the popup |
|
|
77
|
+
| `DropdownFooterTemplateDirective` | `ng-template[monaDropDownFooterTemplate]` | None | No default — renders below the option list inside the popup |
|
|
78
|
+
| `DropdownNoDataTemplateDirective` | `ng-template[monaDropDownNoDataTemplate]` | None | The popup's default empty-state content |
|
|
79
|
+
| `DropdownPrefixTemplateDirective` | `ng-template[monaDropdownPrefixTemplate]` | None | No default — projected content rendered before the value area on the host element |
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
|
|
83
|
+
<mona-dropdown-list [data]="countries" textField="name" valueField="id">
|
|
84
|
+
<ng-template monaDropDownItemTemplate let-dataItem>
|
|
85
|
+
<span>{{ dataItem.name }}</span>
|
|
86
|
+
</ng-template>
|
|
87
|
+
<ng-template monaDropDownListValueTemplate let-dataItem>
|
|
88
|
+
@if (dataItem) {
|
|
89
|
+
<span>{{ dataItem.name }}</span>
|
|
90
|
+
} @else {
|
|
91
|
+
<span>No country selected</span>
|
|
92
|
+
}
|
|
93
|
+
</ng-template>
|
|
94
|
+
</mona-dropdown-list>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
### Primitive value binding
|
|
100
|
+
|
|
101
|
+
By default `value` holds the complete selected data item. Set `valuePrimitive` to `true` to have `value` hold the value resolved through `valueField` instead — useful for storing just an id rather than the whole object. Setting `value` to a matching field value (for example, restoring it from a signal forms field) also selects the corresponding item.
|
|
102
|
+
|
|
103
|
+
`primitive-example.component.ts`
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { Component, signal } from "@angular/core";
|
|
107
|
+
import { DropdownListComponent } from "@nanahoshi/mona-ui/dropdown-list";
|
|
108
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
109
|
+
|
|
110
|
+
@Component({
|
|
111
|
+
selector: "app-dropdown-list-primitive-example",
|
|
112
|
+
imports: [DropdownListComponent, LabelDirective],
|
|
113
|
+
templateUrl: "./primitive-example.component.html"
|
|
114
|
+
})
|
|
115
|
+
export class DropdownListPrimitiveExampleComponent {
|
|
116
|
+
protected readonly priorities = [
|
|
117
|
+
{ id: 1, label: "Low" },
|
|
118
|
+
{ id: 2, label: "Normal" },
|
|
119
|
+
{ id: 3, label: "High" },
|
|
120
|
+
{ id: 4, label: "Urgent" }
|
|
121
|
+
];
|
|
122
|
+
protected readonly priorityId = signal<number | null>(2);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`primitive-example.component.html`
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
130
|
+
<label id="dropdown-list-primitive-label" monaLabel [for]="priorityList">Priority</label>
|
|
131
|
+
<mona-dropdown-list
|
|
132
|
+
#priorityList
|
|
133
|
+
aria-labelledby="dropdown-list-primitive-label"
|
|
134
|
+
textField="label"
|
|
135
|
+
valueField="id"
|
|
136
|
+
[data]="priorities"
|
|
137
|
+
[valuePrimitive]="true"
|
|
138
|
+
[(value)]="priorityId" />
|
|
139
|
+
<span aria-live="polite" class="text-sm">Value: {{ priorityId() ?? "null" }}</span>
|
|
140
|
+
</div>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The value becomes the matching `id` once an item is selected, and `null` again once cleared. `valueField` should resolve to a stable, unique scalar; without it, the item itself is used as the value, which naturally supports primitive data such as `["One", "Two", "Three"]`.
|
|
144
|
+
|
|
145
|
+
### Custom templates
|
|
146
|
+
|
|
147
|
+
`monaDropDownListValueTemplate` controls how the selected value renders in the host element, independently of how options render inside the popup through `monaDropDownItemTemplate`. Its item is `null` while nothing is selected. `monaDropdownPrefixTemplate` renders content before the value area, such as an icon.
|
|
148
|
+
|
|
149
|
+
`templates-example.component.ts`
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { Component, signal } from "@angular/core";
|
|
153
|
+
import { LucideCircleDot } from "@lucide/angular";
|
|
154
|
+
import { DropdownListComponent, DropdownListValueTemplateDirective } from "@nanahoshi/mona-ui/dropdown-list";
|
|
155
|
+
import { DropdownItemTemplateDirective, DropdownPrefixTemplateDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
156
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
157
|
+
|
|
158
|
+
interface Status {
|
|
159
|
+
description: string;
|
|
160
|
+
id: number;
|
|
161
|
+
name: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@Component({
|
|
165
|
+
selector: "app-dropdown-list-templates-example",
|
|
166
|
+
imports: [
|
|
167
|
+
DropdownItemTemplateDirective,
|
|
168
|
+
DropdownListComponent,
|
|
169
|
+
DropdownListValueTemplateDirective,
|
|
170
|
+
DropdownPrefixTemplateDirective,
|
|
171
|
+
LabelDirective,
|
|
172
|
+
LucideCircleDot
|
|
173
|
+
],
|
|
174
|
+
templateUrl: "./templates-example.component.html"
|
|
175
|
+
})
|
|
176
|
+
export class DropdownListTemplatesExampleComponent {
|
|
177
|
+
protected readonly status = signal<Status | null>(null);
|
|
178
|
+
protected readonly statuses: Status[] = [
|
|
179
|
+
{ id: 1, name: "Open", description: "Waiting for work" },
|
|
180
|
+
{ id: 2, name: "In progress", description: "Someone is on it" },
|
|
181
|
+
{ id: 3, name: "Blocked", description: "Needs input" },
|
|
182
|
+
{ id: 4, name: "Done", description: "Finished" }
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`templates-example.component.html`
|
|
188
|
+
|
|
189
|
+
```html
|
|
190
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
191
|
+
<label id="dropdown-list-templates-label" monaLabel [for]="statusList">Status</label>
|
|
192
|
+
<mona-dropdown-list
|
|
193
|
+
#statusList
|
|
194
|
+
aria-labelledby="dropdown-list-templates-label"
|
|
195
|
+
textField="name"
|
|
196
|
+
valueField="id"
|
|
197
|
+
[data]="statuses"
|
|
198
|
+
[(value)]="status">
|
|
199
|
+
<ng-template monaDropdownPrefixTemplate>
|
|
200
|
+
<svg lucideCircleDot aria-hidden="true" class="ms-2" [size]="16"></svg>
|
|
201
|
+
</ng-template>
|
|
202
|
+
<ng-template let-item monaDropDownItemTemplate>
|
|
203
|
+
<span class="flex-1">{{ item.name }}</span>
|
|
204
|
+
<span class="text-muted-foreground text-xs">{{ item.description }}</span>
|
|
205
|
+
</ng-template>
|
|
206
|
+
<ng-template let-item monaDropDownListValueTemplate>
|
|
207
|
+
{{ item ? item.name : "No status" }}
|
|
208
|
+
</ng-template>
|
|
209
|
+
</mona-dropdown-list>
|
|
210
|
+
</div>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Filtering and grouping
|
|
214
|
+
|
|
215
|
+
`monaDropDownFilterable` renders a filter input inside the popup that narrows the visible options by text. `monaDropDownGroupable` groups options under a header row, driven by `groupBy`. If `groupBy` is omitted while grouping is enabled, every option falls into a single, unlabeled group.
|
|
216
|
+
|
|
217
|
+
`filtering-example.component.ts`
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import { Component, signal } from "@angular/core";
|
|
221
|
+
import { DropdownListComponent } from "@nanahoshi/mona-ui/dropdown-list";
|
|
222
|
+
import { DropdownFilterableDirective, DropdownGroupableDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
223
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
224
|
+
|
|
225
|
+
interface TimeZone {
|
|
226
|
+
name: string;
|
|
227
|
+
region: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@Component({
|
|
231
|
+
selector: "app-dropdown-list-filtering-example",
|
|
232
|
+
imports: [DropdownFilterableDirective, DropdownGroupableDirective, DropdownListComponent, LabelDirective],
|
|
233
|
+
templateUrl: "./filtering-example.component.html"
|
|
234
|
+
})
|
|
235
|
+
export class DropdownListFilteringExampleComponent {
|
|
236
|
+
protected readonly timeZone = signal<TimeZone | null>(null);
|
|
237
|
+
protected readonly timeZones: TimeZone[] = [
|
|
238
|
+
{ name: "Berlin", region: "Europe" },
|
|
239
|
+
{ name: "Lisbon", region: "Europe" },
|
|
240
|
+
{ name: "London", region: "Europe" },
|
|
241
|
+
{ name: "Chicago", region: "Americas" },
|
|
242
|
+
{ name: "New York", region: "Americas" },
|
|
243
|
+
{ name: "São Paulo", region: "Americas" },
|
|
244
|
+
{ name: "Seoul", region: "Asia" },
|
|
245
|
+
{ name: "Singapore", region: "Asia" },
|
|
246
|
+
{ name: "Tokyo", region: "Asia" }
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`filtering-example.component.html`
|
|
252
|
+
|
|
253
|
+
```html
|
|
254
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
255
|
+
<label id="dropdown-list-filtering-label" monaLabel [for]="timeZoneList">Time zone</label>
|
|
256
|
+
<mona-dropdown-list
|
|
257
|
+
#timeZoneList
|
|
258
|
+
aria-labelledby="dropdown-list-filtering-label"
|
|
259
|
+
filterPlaceholder="Search time zones"
|
|
260
|
+
groupBy="region"
|
|
261
|
+
monaDropDownGroupable
|
|
262
|
+
placeholder="Select a time zone"
|
|
263
|
+
textField="name"
|
|
264
|
+
[data]="timeZones"
|
|
265
|
+
[monaDropDownFilterable]="{ operator: 'startsWith' }"
|
|
266
|
+
[(value)]="timeZone" />
|
|
267
|
+
</div>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Signal Forms integration
|
|
271
|
+
|
|
272
|
+
Binding `[formField]` synchronizes `value`, `disabled`, `readonly`, `required`, `invalid`, and `touched` with a signal forms field automatically — see [Forms Integration](#forms-integration).
|
|
273
|
+
|
|
274
|
+
`forms-example.component.ts`
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
import { Component, signal } from "@angular/core";
|
|
278
|
+
import { form, FormField, required } from "@angular/forms/signals";
|
|
279
|
+
import { DropdownListComponent } from "@nanahoshi/mona-ui/dropdown-list";
|
|
280
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
281
|
+
|
|
282
|
+
interface OrderModel {
|
|
283
|
+
shippingId: number | null;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
@Component({
|
|
287
|
+
selector: "app-dropdown-list-forms-example",
|
|
288
|
+
imports: [DropdownListComponent, FormField, LabelDirective],
|
|
289
|
+
templateUrl: "./forms-example.component.html"
|
|
290
|
+
})
|
|
291
|
+
export class DropdownListFormsExampleComponent {
|
|
292
|
+
readonly #model = signal<OrderModel>({ shippingId: null });
|
|
293
|
+
protected readonly methods = [
|
|
294
|
+
{ id: 1, name: "Standard (5–7 days)" },
|
|
295
|
+
{ id: 2, name: "Express (2 days)" },
|
|
296
|
+
{ id: 3, name: "Overnight" }
|
|
297
|
+
];
|
|
298
|
+
protected readonly order = form(this.#model, path => {
|
|
299
|
+
required(path.shippingId);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
`forms-example.component.html`
|
|
305
|
+
|
|
306
|
+
```html
|
|
307
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
308
|
+
<label id="dropdown-list-forms-label" monaLabel [for]="shippingList">Shipping method</label>
|
|
309
|
+
<mona-dropdown-list
|
|
310
|
+
#shippingList
|
|
311
|
+
aria-describedby="dropdown-list-forms-hint"
|
|
312
|
+
aria-labelledby="dropdown-list-forms-label"
|
|
313
|
+
placeholder="Select a method"
|
|
314
|
+
textField="name"
|
|
315
|
+
valueField="id"
|
|
316
|
+
[data]="methods"
|
|
317
|
+
[formField]="order.shippingId"
|
|
318
|
+
[valuePrimitive]="true" />
|
|
319
|
+
<p id="dropdown-list-forms-hint" class="text-sm">Required.</p>
|
|
320
|
+
@if (order.shippingId().touched() && order.shippingId().invalid()) {
|
|
321
|
+
<p class="text-error text-sm" role="alert">Choose a shipping method.</p>
|
|
322
|
+
}
|
|
323
|
+
</div>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Disabled, readonly, loading, and required states
|
|
327
|
+
|
|
328
|
+
`disabled` renders the control with reduced visual emphasis and removes pointer interaction. `readonly` prevents value changes while preserving the visual state. `loading` shows a loading indicator in place of the clear button and marks the field busy. It doesn't block interaction: the field stays usable while data loads. `required` marks the field for form validation and affects the invalid state once the control is touched.
|
|
329
|
+
|
|
330
|
+
```html
|
|
331
|
+
|
|
332
|
+
<mona-dropdown-list
|
|
333
|
+
[data]="countries"
|
|
334
|
+
textField="name"
|
|
335
|
+
valueField="id"
|
|
336
|
+
[disabled]="isDisabled()"
|
|
337
|
+
[readonly]="isReadonly()"
|
|
338
|
+
[loading]="isLoading()"
|
|
339
|
+
[required]="true"
|
|
340
|
+
[showClearButton]="true">
|
|
341
|
+
</mona-dropdown-list>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Virtual scrolling
|
|
345
|
+
|
|
346
|
+
`monaDropDownVirtualScroll` renders only the options currently in view, for large collections. `height` on the options object is the fixed row height, in pixels, used to measure the viewport; every option must render at that height for scrolling to stay accurate.
|
|
347
|
+
|
|
348
|
+
```html
|
|
349
|
+
|
|
350
|
+
<mona-dropdown-list
|
|
351
|
+
[data]="countries"
|
|
352
|
+
textField="name"
|
|
353
|
+
valueField="id"
|
|
354
|
+
monaDropDownVirtualScroll
|
|
355
|
+
[monaDropDownVirtualScroll]="{ height: 32 }">
|
|
356
|
+
</mona-dropdown-list>
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## Behavior
|
|
360
|
+
|
|
361
|
+
### Staged navigation while the popup is open
|
|
362
|
+
|
|
363
|
+
While the popup is open, arrow-key and typeahead navigation only stage a highlighted option; the staged option is not written to `value` until the consumer commits it with `Enter` or by closing the popup. When the popup is closed, arrow-key and typeahead navigation commit the value immediately.
|
|
364
|
+
|
|
365
|
+
### `open` and `close` are cancelable
|
|
366
|
+
|
|
367
|
+
`open` and `close` emit event objects with `preventDefault()` and `isDefaultPrevented()`. Calling `preventDefault()` in an `open` handler stops the popup from opening; calling it in a `close` handler stops the popup from closing. `close`'s event object also exposes `via`, describing what triggered the close attempt (for example `"escape"` or `"outsideClick"`).
|
|
368
|
+
|
|
369
|
+
### Click-to-toggle
|
|
370
|
+
|
|
371
|
+
Clicking anywhere on the host element, outside the clear button, toggles the popup — in addition to the keyboard interactions documented under [Keyboard](#keyboard).
|
|
372
|
+
|
|
373
|
+
### Filtering, grouping, and virtual scrolling compose
|
|
374
|
+
|
|
375
|
+
These three directives are independent — applying more than one to the same `mona-dropdown-list` combines their behavior.
|
|
376
|
+
|
|
377
|
+
### `DropdownFieldSelectorType`, `DropdownFieldPredicateType`, and `ListSizeInputType` are not exported
|
|
378
|
+
|
|
379
|
+
`textField`, `valueField`, `itemDisabled`, `popupHeight`, and `popupWidth` are typed with these generic aliases internally, but none of the three types are re-exported from `@nanahoshi/mona-ui`. Inline values (as in the examples above) still type-check structurally; only a standalone typed variable would require an import.
|
|
380
|
+
`TODO(owner-review): confirm whether these types should be added to the public barrel export.`
|
|
381
|
+
|
|
382
|
+
## Forms Integration
|
|
383
|
+
|
|
384
|
+
`DropdownListComponent` implements the signal forms `FormValueControl<TValue | null>` interface (`TValue` defaults to `TData`, or the `valueField` type when `valuePrimitive` is `true`) and synchronizes with a field bound through `[formField]` (see [Signal Forms integration](#signal-forms-integration)). It has no `ControlValueAccessor`, but `[(ngModel)]`, `[formControl]` and `formControlName` work too, because Angular binds a control's `value` and `touch` directly when it has no accessor. Prefer `[formField]`, which also hands it `disabled`, `readonly`, `required` and validation state.
|
|
385
|
+
|
|
386
|
+
## Accessibility
|
|
387
|
+
|
|
388
|
+
### Keyboard
|
|
389
|
+
|
|
390
|
+
| Key | Action |
|
|
391
|
+
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
392
|
+
| `ArrowDown` / `ArrowUp` | Navigate to the next or previous option. Commits the value immediately when the popup is closed; only highlights the option when the popup is open — see [Staged navigation while the popup is open](#staged-navigation-while-the-popup-is-open). |
|
|
393
|
+
| `Alt+ArrowDown` | Open the popup. |
|
|
394
|
+
| `Alt+ArrowUp` | Close the popup. |
|
|
395
|
+
| `Home` | Move to the first option. |
|
|
396
|
+
| `End` | Move to the last option. |
|
|
397
|
+
| `Enter` | Open the popup when closed. When open, commits the highlighted option and closes the popup. |
|
|
398
|
+
| `Space` | Toggle the popup open or closed. |
|
|
399
|
+
| `Escape` / `Tab` | Close the popup without committing a highlighted-but-uncommitted option. |
|
|
400
|
+
| Character keys | Typeahead: cycles through options whose text matches the typed characters. |
|
|
401
|
+
|
|
402
|
+
### Focus
|
|
403
|
+
|
|
404
|
+
The host element is the only Tab stop; DOM focus does not move into the popup's option list. Arrow-key, `Home`/`End`, and typeahead navigation move an internal highlighted-option pointer that is reflected through `aria-activedescendant` on the host element instead.
|
|
405
|
+
|
|
406
|
+
### ARIA
|
|
407
|
+
|
|
408
|
+
| Attribute | When present | Value |
|
|
409
|
+
|-------------------------|--------------------------------------------------------------------------------------------------|---------------------------------------------------|
|
|
410
|
+
| `role` | Always | `"combobox"` |
|
|
411
|
+
| `aria-haspopup` | Always | `"listbox"` |
|
|
412
|
+
| `aria-expanded` | Always | Reflects the popup's open state |
|
|
413
|
+
| `aria-activedescendant` | While an option is highlighted | The highlighted option's element id |
|
|
414
|
+
| `aria-controls` | Always | The popup listbox's element id |
|
|
415
|
+
| `aria-label` | The `aria-label` input is set, or as a fallback to `placeholder` when `aria-labelledby` is unset | The `aria-label` value, or the `placeholder` value |
|
|
416
|
+
| `aria-labelledby` | The `aria-labelledby` input is set | The `aria-labelledby` value |
|
|
417
|
+
| `aria-describedby` | The `aria-describedby` input is set | The `aria-describedby` value |
|
|
418
|
+
| `aria-disabled` | `disabled` is `true` | `"true"` |
|
|
419
|
+
| `aria-readonly` | `readonly` is `true` | `"true"` |
|
|
420
|
+
| `aria-required` | `required` is `true` | `"true"` |
|
|
421
|
+
| `aria-invalid` | `invalid` is `true`, or `required` is `true` and the control is `touched` with no value selected | `"true"` |
|
|
422
|
+
| `aria-busy` | `loading` is `true` | `"true"` |
|
|
423
|
+
|
|
424
|
+
Name the dropdown list with `aria-labelledby` pointing at a visible label's `id`, or with `aria-label`. The `placeholder` only supplies a fallback name, and it disappears from view once a value is selected. A label can't name it in any other way: the host is a `role="combobox"` element, not a native input, so wrapping it in `<mona-label>` doesn't name it, and a string `for` has nothing to point at. `[for]` bound to its template reference makes a click on the label focus it, but doesn't name it. That's why the examples use both:
|
|
425
|
+
|
|
426
|
+
```html
|
|
427
|
+
<label id="shipping-label" monaLabel [for]="shippingList">Shipping method</label>
|
|
428
|
+
<mona-dropdown-list #shippingList aria-labelledby="shipping-label" [data]="methods"></mona-dropdown-list>
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
The control also renders a visually hidden live region that announces the highlighted or selected option's text and position to screen reader users as the consumer navigates the popup.
|
|
432
|
+
|
|
433
|
+
## API
|
|
434
|
+
|
|
435
|
+
Everything below is imported from `@nanahoshi/mona-ui/dropdown-list`, `@nanahoshi/mona-ui/dropdowns`, as noted.
|
|
436
|
+
|
|
437
|
+
### `DropdownListComponent`
|
|
438
|
+
|
|
439
|
+
**Selector:** `mona-dropdown-list`
|
|
440
|
+
**Type parameters:** `TData = unknown`, `TValue = TData`
|
|
441
|
+
**Implements:** `FormValueControl<TValue \| null>`
|
|
442
|
+
|
|
443
|
+
#### Inputs
|
|
444
|
+
|
|
445
|
+
| Name | Type | Default | Description |
|
|
446
|
+
| --- | --- | --- | --- |
|
|
447
|
+
| `aria-describedby` | `string` | `""` | ID of an element that describes the dropdown list, such as help text or an error message. |
|
|
448
|
+
| `aria-label` | `string` | `""` | Accessible name for the host element. Describe what the component represents. When empty, falls back to the placeholder text. |
|
|
449
|
+
| `aria-labelledby` | `string` | `""` | ID of an external element that provides the accessible name for the host element. |
|
|
450
|
+
| `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
451
|
+
| `data` | `Iterable<TData>` | `[]` | Collection of items to render. |
|
|
452
|
+
| `disabled` | `boolean` | `false` | Renders the component with reduced visual emphasis and removes pointer interaction. |
|
|
453
|
+
| `invalid` | `boolean` | `false` | Marks the field as invalid. Set automatically by the `FormField` directive when bound via `[formField]`. |
|
|
454
|
+
| `itemDisabled` | `DropdownFieldPredicateType<TData>` | `undefined` | Predicate or field name used to determine whether an individual item is disabled. |
|
|
455
|
+
| `loading` | `boolean` | `false` | Shows a loading indicator, in place of the clear button, and marks the field busy. It doesn't block interaction: the field stays usable while data loads. |
|
|
456
|
+
| `placeholder` | `string` | `""` | Placeholder text shown when no value is selected or entered. |
|
|
457
|
+
| `popupClass` | `string` | `""` | Additional CSS classes applied to the popup element. |
|
|
458
|
+
| `popupHeight` | `ListSizeInputType` | `null` | Maximum height of the popup, in pixels or as a CSS length. Shorter lists shrink to fit. When unset, the popup is at most 200 pixels tall. |
|
|
459
|
+
| `popupWidth` | `ListSizeInputType` | `null` | Width of the popup element. |
|
|
460
|
+
| `readonly` | `boolean` | `false` | Prevents value changes while preserving the component's visual state. |
|
|
461
|
+
| `required` | `boolean` | `false` | Marks the field as required for form validation. |
|
|
462
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the component. |
|
|
463
|
+
| `showClearButton` | `boolean` | `false` | Shows a clear button that resets the selected value when clicked. |
|
|
464
|
+
| `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the component's dimensions. |
|
|
465
|
+
| `textField` | `DropdownFieldSelectorType<TData, string>` | `undefined` | Property name or accessor used to derive the display text from a data item. If omitted, the item itself is used as the display text. |
|
|
466
|
+
| `touched` | `boolean` | `false` | Marks the control as touched. Set automatically by the `FormField` directive when bound via `[formField]`. |
|
|
467
|
+
| `value` (two-way) | `TValue \| null` | `null` | Currently selected value, two-way bindable and compatible with Signal Forms via `[formField]`. Object mode returns the selected data item; primitive mode (see `valuePrimitive`) returns the value resolved through `valueField`. `null` represents no selection. |
|
|
468
|
+
| `valueField` | `DropdownFieldSelectorType<TData, unknown>` | `undefined` | Property name or accessor used to derive the value from a data item. It is used for stable item identity, matching externally supplied values, and primitive value projection when `valuePrimitive` is enabled. When omitted, the item itself is used as the value. Should resolve to a stable, unique scalar. |
|
|
469
|
+
| `valuePrimitive` | `boolean` | `false` | Determines whether the bound value contains complete data items or values extracted through `valueField`. When `false`, selecting an item writes the complete data item. When `true`, selecting an item writes the value resolved through `valueField`. |
|
|
470
|
+
|
|
471
|
+
#### Outputs
|
|
472
|
+
|
|
473
|
+
| Name | Type | Description |
|
|
474
|
+
| --- | --- | --- |
|
|
475
|
+
| `close` | `PopupCloseEvent<unknown>` | Emitted when the popup is about to close. This event is preventable. |
|
|
476
|
+
| `closed` | `void` | Emitted after the popup closes. |
|
|
477
|
+
| `open` | `PreventableEvent<Event>` | Emitted when the popup is about to open. This event is preventable. |
|
|
478
|
+
| `opened` | `void` | Emitted after the popup opens. |
|
|
479
|
+
| `touch` | `void` | Emitted when focus leaves the dropdown list. Moving between it, its clear button and its popup doesn't count. The `FormField` directive listens to this to mark the field as touched. |
|
|
480
|
+
| `valueChange` | `TValue \| null` | Emitted when `value` changes. |
|
|
481
|
+
|
|
482
|
+
#### Methods
|
|
483
|
+
|
|
484
|
+
| Signature | Description |
|
|
485
|
+
| --- | --- |
|
|
486
|
+
| `focus(options?: FocusOptions): void` | Moves focus to the dropdown list. |
|
|
487
|
+
|
|
488
|
+
### `DropdownFilterableDirective`
|
|
489
|
+
|
|
490
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
491
|
+
|
|
492
|
+
**Selector:** `mona-auto-complete[monaDropDownFilterable], mona-dropdown-list[monaDropDownFilterable], mona-combo-box[monaDropDownFilterable], mona-multi-select[monaDropDownFilterable]`
|
|
493
|
+
|
|
494
|
+
#### Inputs
|
|
495
|
+
|
|
496
|
+
| Name | Type | Default | Description |
|
|
497
|
+
| --- | --- | --- | --- |
|
|
498
|
+
| `filter` | `string` | `""` | Current filter text used to narrow the visible options. |
|
|
499
|
+
| `filterPlaceholder` | `string` | `""` | Placeholder text in the popup's filter row. Auto Complete has no filter row, since its own input is the filter, so it ignores this. |
|
|
500
|
+
| `monaDropDownFilterable` | `Partial<FilterableOptions> \| ""` | `""` | Filter operator, case sensitivity, and debounce delay. An empty string enables filtering with default settings (`operator: "contains"`, `caseSensitive: false`, `debounce: 0`); pass an object to override any field. |
|
|
501
|
+
|
|
502
|
+
#### Outputs
|
|
503
|
+
|
|
504
|
+
| Name | Type | Description |
|
|
505
|
+
| --- | --- | --- |
|
|
506
|
+
| `filterChange` | `FilterChangeEvent` | Emitted when the filter value changes. Cancelable. |
|
|
507
|
+
|
|
508
|
+
### `DropdownGroupableDirective`
|
|
509
|
+
|
|
510
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
511
|
+
|
|
512
|
+
**Selector:** `mona-auto-complete[monaDropDownGroupable], mona-combo-box[monaDropDownGroupable], mona-dropdown-list[monaDropDownGroupable], mona-multi-select[monaDropDownGroupable]`
|
|
513
|
+
**Type parameters:** `TData`
|
|
514
|
+
|
|
515
|
+
#### Inputs
|
|
516
|
+
|
|
517
|
+
| Name | Type | Default | Description |
|
|
518
|
+
| --- | --- | --- | --- |
|
|
519
|
+
| `groupBy` | `string \| Selector<TData, unknown> \| null \| undefined` | `""` | Property name, or accessor, used to derive an option's group. |
|
|
520
|
+
| `monaDropDownGroupable` | `GroupableOptions<TData, unknown> \| ""` | `""` | Group header order, and optional per-group item ordering. An empty string enables grouping with default settings (`headerOrder: "asc"`); pass an object to override any field. |
|
|
521
|
+
|
|
522
|
+
### `DropdownVirtualScrollDirective`
|
|
523
|
+
|
|
524
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
525
|
+
|
|
526
|
+
**Selector:** `mona-auto-complete[monaDropDownVirtualScroll], mona-dropdown-list[monaDropDownVirtualScroll], mona-combo-box[monaDropDownVirtualScroll], mona-multi-select[monaDropDownVirtualScroll]`
|
|
527
|
+
|
|
528
|
+
#### Inputs
|
|
529
|
+
|
|
530
|
+
| Name | Type | Default | Description |
|
|
531
|
+
| --- | --- | --- | --- |
|
|
532
|
+
| `monaDropDownVirtualScroll` | `Partial<VirtualScrollOptions> \| ""` | `""` | Whether virtual scrolling is enabled and the pixel height of a single option row. An empty string enables virtual scrolling with default settings (`height: 28`); pass an object to override either field. |
|
|
533
|
+
|
|
534
|
+
### `DropdownDataHandlerDirective`
|
|
535
|
+
|
|
536
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
537
|
+
|
|
538
|
+
**Selector:** `[monaDropdownDataHandler]`
|
|
539
|
+
|
|
540
|
+
### `DropdownFooterTemplateDirective`
|
|
541
|
+
|
|
542
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
543
|
+
|
|
544
|
+
**Selector:** `ng-template[monaDropDownFooterTemplate], ng-template[monaAutoCompleteFooterTemplate], ng-template[monaDropDownListFooterTemplate], ng-template[monaDropDownTreeFooterTemplate], ng-template[monaComboBoxFooterTemplate], ng-template[monaMultiSelectFooterTemplate]`
|
|
545
|
+
|
|
546
|
+
### `DropdownGroupHeaderTemplateDirective`
|
|
547
|
+
|
|
548
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
549
|
+
|
|
550
|
+
**Selector:** `ng-template[monaDropDownGroupHeaderTemplate], ng-template[monaAutoCompleteGroupHeaderTemplate], ng-template[monaDropDownListGroupHeaderTemplate], ng-template[monaComboBoxGroupHeaderTemplate], ng-template[monaMultiSelectGroupHeaderTemplate]`
|
|
551
|
+
|
|
552
|
+
### `DropdownHeaderTemplateDirective`
|
|
553
|
+
|
|
554
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
555
|
+
|
|
556
|
+
**Selector:** `ng-template[monaDropDownHeaderTemplate], ng-template[monaAutoCompleteHeaderTemplate], ng-template[monaDropDownListHeaderTemplate], ng-template[monaDropDownTreeHeaderTemplate], ng-template[monaComboBoxHeaderTemplate], ng-template[monaMultiSelectHeaderTemplate]`
|
|
557
|
+
|
|
558
|
+
### `DropdownItemTemplateDirective`
|
|
559
|
+
|
|
560
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
561
|
+
|
|
562
|
+
**Selector:** `ng-template[monaDropDownItemTemplate], ng-template[monaAutoCompleteItemTemplate], ng-template[monaDropDownListItemTemplate], ng-template[monaComboBoxItemTemplate], ng-template[monaMultiSelectItemTemplate]`
|
|
563
|
+
|
|
564
|
+
### `DropdownListPopupHandlerDirective`
|
|
565
|
+
|
|
566
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
567
|
+
|
|
568
|
+
**Selector:** `[monaDropdownListPopupHandler]`
|
|
569
|
+
|
|
570
|
+
### `DropdownListValueTemplateDirective`
|
|
571
|
+
|
|
572
|
+
**Selector:** `ng-template[monaDropDownListValueTemplate]`
|
|
573
|
+
|
|
574
|
+
### `DropdownLiveRegionDirective`
|
|
575
|
+
|
|
576
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
577
|
+
|
|
578
|
+
Announces how many results a dropdown shows after its list is filtered, or after its items change, while the
|
|
579
|
+
popup is open ("3 results available", "No results found").
|
|
580
|
+
|
|
581
|
+
The announcement goes through the CDK `LiveAnnouncer`, whose live region lives at the end of the document, so it
|
|
582
|
+
never becomes part of the combobox's content. The highlighted option isn't announced here:
|
|
583
|
+
`aria-activedescendant` already does that.
|
|
584
|
+
|
|
585
|
+
**Selector:** `[monaDropdownLiveRegion]`
|
|
586
|
+
|
|
587
|
+
### `DropdownNoDataTemplateDirective`
|
|
588
|
+
|
|
589
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
590
|
+
|
|
591
|
+
**Selector:** `ng-template[monaDropDownNoDataTemplate], ng-template[monaAutoCompleteNoDataTemplate], ng-template[monaDropDownListNoDataTemplate], ng-template[monaDropDownTreeNoDataTemplate], ng-template[monaComboBoxNoDataTemplate], ng-template[monaMultiSelectNoDataTemplate]`
|
|
592
|
+
|
|
593
|
+
### `DropdownPopupHandlerDirective`
|
|
594
|
+
|
|
595
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
596
|
+
|
|
597
|
+
**Selector:** `[monaDropdownPopupHandler]`
|
|
598
|
+
|
|
599
|
+
### `DropdownPrefixTemplateDirective`
|
|
600
|
+
|
|
601
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
602
|
+
|
|
603
|
+
**Selector:** `ng-template[monaDropdownPrefixTemplate]`
|
|
604
|
+
|
|
605
|
+
### `DropdownSuffixTemplateDirective`
|
|
606
|
+
|
|
607
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
608
|
+
|
|
609
|
+
**Selector:** `ng-template[monaDropdownSuffixTemplate]`
|
|
610
|
+
|
|
611
|
+
### `DropdownListService`
|
|
612
|
+
|
|
613
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
614
|
+
|
|
615
|
+
**Type parameters:** `TData = unknown`
|
|
616
|
+
|
|
617
|
+
#### Properties
|
|
618
|
+
|
|
619
|
+
| Name | Type |
|
|
620
|
+
| --- | --- |
|
|
621
|
+
| `navigate$` (read-only) | `Subject<{ item: ListItem<TData>; }>` |
|
|
622
|
+
|
|
623
|
+
### Types
|
|
624
|
+
|
|
625
|
+
#### `DROPDOWN_DATA_INPUT_TOKEN`
|
|
626
|
+
|
|
627
|
+
```typescript
|
|
628
|
+
const DROPDOWN_DATA_INPUT_TOKEN: InjectionToken<DropdownDataInput<unknown>>;
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### `DROPDOWN_LIST_DEFAULT_MESSAGES`
|
|
632
|
+
|
|
633
|
+
```typescript
|
|
634
|
+
const DROPDOWN_LIST_DEFAULT_MESSAGES: MonaDropdownListMessages;
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
#### `DROPDOWN_POPUP_INPUT_TOKEN`
|
|
638
|
+
|
|
639
|
+
```typescript
|
|
640
|
+
const DROPDOWN_POPUP_INPUT_TOKEN: InjectionToken<DropdownPopupInput>;
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
#### `DropdownDataInputToken`
|
|
644
|
+
|
|
645
|
+
**Deprecated.** Use `DROPDOWN_DATA_INPUT_TOKEN`.
|
|
646
|
+
|
|
647
|
+
```typescript
|
|
648
|
+
const DropdownDataInputToken: InjectionToken<DropdownDataInput<unknown>>;
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
#### `dropdownPopupThemeVariants`
|
|
652
|
+
|
|
653
|
+
```typescript
|
|
654
|
+
const dropdownPopupThemeVariants: (props?: ({ rounded?: "none" | "small" | "medium" | "large" | "full" | null | undefined; size?: "small" | "medium" | "large" | null | undefined; } & ClassProp) | undefined) => string;
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
#### `DROPDOWNS_DEFAULT_MESSAGES`
|
|
658
|
+
|
|
659
|
+
```typescript
|
|
660
|
+
const DROPDOWNS_DEFAULT_MESSAGES: MonaDropdownsMessages;
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
#### `DropdownDataInput`
|
|
664
|
+
|
|
665
|
+
**Type parameters:** `TData`
|
|
666
|
+
|
|
667
|
+
| Name | Type |
|
|
668
|
+
| --- | --- |
|
|
669
|
+
| `data` (read-only) | `InputSignal<Iterable<TData>>` |
|
|
670
|
+
| `itemDisabled` (read-only) | `InputSignal<DropdownFieldPredicateType<TData>>` |
|
|
671
|
+
| `textField` (read-only) | `InputSignal<DropdownFieldSelectorType<TData, string>>` |
|
|
672
|
+
| `valueField` (read-only) | `InputSignal<DropdownFieldSelectorType<TData, unknown>>` |
|
|
673
|
+
|
|
674
|
+
#### `DropdownPopupInput`
|
|
675
|
+
|
|
676
|
+
| Name | Type |
|
|
677
|
+
| --- | --- |
|
|
678
|
+
| `close` (read-only) | `OutputEmitterRef<PopupCloseEvent>` |
|
|
679
|
+
| `closed` (read-only) | `OutputEmitterRef<void>` |
|
|
680
|
+
| `disabled` (read-only) | `Signal<boolean>` |
|
|
681
|
+
| `open` (read-only) | `OutputEmitterRef<PreventableEvent>` |
|
|
682
|
+
| `opened` (read-only) | `OutputEmitterRef<void>` |
|
|
683
|
+
| `popupHeight` (read-only) | `InputSignal<ListSizeInputType>` |
|
|
684
|
+
| `popupWidth` (read-only) | `InputSignal<ListSizeInputType>` |
|
|
685
|
+
| `readonly` (read-only) | `Signal<boolean>` |
|
|
686
|
+
| `touch` (read-only) | `OutputEmitterRef<void>` |
|
|
687
|
+
|
|
688
|
+
#### `DropdownFieldPredicateType`
|
|
689
|
+
|
|
690
|
+
```typescript
|
|
691
|
+
type DropdownFieldPredicateType<TData> = string | Predicate<TData> | null | undefined;
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
#### `DropdownFieldSelectorType`
|
|
695
|
+
|
|
696
|
+
```typescript
|
|
697
|
+
type DropdownFieldSelectorType<TData, TResult = unknown> = string | Selector<TData, TResult> | null | undefined;
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
#### `FilterChangeEvent`
|
|
701
|
+
|
|
702
|
+
From `@nanahoshi/mona-ui/common`.
|
|
703
|
+
|
|
704
|
+
**Extends:** `PreventableEvent`
|
|
705
|
+
|
|
706
|
+
| Name | Type |
|
|
707
|
+
| --- | --- |
|
|
708
|
+
| `filter` (read-only) | `string` |
|
|
709
|
+
|
|
710
|
+
#### `ListItem`
|
|
711
|
+
|
|
712
|
+
From `@nanahoshi/mona-ui/list`.
|
|
713
|
+
|
|
714
|
+
An item of a list, wrapping its data item.
|
|
715
|
+
|
|
716
|
+
**Type parameters:** `TData`
|
|
717
|
+
|
|
718
|
+
| Name | Type |
|
|
719
|
+
| --- | --- |
|
|
720
|
+
| `data` (read-only) | `TData` |
|
|
721
|
+
| `header` (read-only) | `string` |
|
|
722
|
+
| `isHeader` (read-only) | `boolean` |
|
|
723
|
+
| `uid` (read-only) | `string` |
|
|
724
|
+
|
|
725
|
+
#### `ListSizeInputType`
|
|
726
|
+
|
|
727
|
+
From `@nanahoshi/mona-ui/list`.
|
|
728
|
+
|
|
729
|
+
```typescript
|
|
730
|
+
type ListSizeInputType = ListSizeType | number;
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
#### `ListSizeType`
|
|
734
|
+
|
|
735
|
+
From `@nanahoshi/mona-ui/list`.
|
|
736
|
+
|
|
737
|
+
A CSS length, or nothing to leave it to the stylesheet.
|
|
738
|
+
|
|
739
|
+
```typescript
|
|
740
|
+
type ListSizeType = string | null | undefined;
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
#### `MonaDropdownListMessages`
|
|
744
|
+
|
|
745
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
746
|
+
|
|
747
|
+
| Name | Type |
|
|
748
|
+
| --- | --- |
|
|
749
|
+
| `clear` (read-only) | `string` |
|
|
750
|
+
|
|
751
|
+
#### `MonaDropdownsMessages`
|
|
752
|
+
|
|
753
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
754
|
+
|
|
755
|
+
| Name | Type |
|
|
756
|
+
| --- | --- |
|
|
757
|
+
| `itemPosition` (read-only) | `(text: string, position: number, total: number) => string` |
|
|
758
|
+
| `noResultsFound` (read-only) | `string` |
|
|
759
|
+
| `resultsAvailable` (read-only) | `(count: number) => string` |
|
|
760
|
+
|
|
761
|
+
#### `PreventableEvent`
|
|
762
|
+
|
|
763
|
+
From `@nanahoshi/mona-ui/common`.
|
|
764
|
+
|
|
765
|
+
**Type parameters:** `E extends Event = Event`
|
|
766
|
+
|
|
767
|
+
| Name | Type | Description |
|
|
768
|
+
| --- | --- | --- |
|
|
769
|
+
| `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
|
|
770
|
+
| `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
|
|
771
|
+
|
|
772
|
+
**Methods**
|
|
773
|
+
|
|
774
|
+
| Signature | Description |
|
|
775
|
+
| --- | --- |
|
|
776
|
+
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
777
|
+
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
778
|
+
|
|
779
|
+
**Documented elsewhere:** [`FilterableOptions`](grid.md), [`GroupableOptions`](grid.md), [`PopupCloseEvent`](popup.md), [`VirtualScrollOptions`](list-view.md)
|