@nanahoshi/mona-ui 0.25.1 → 0.26.1
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/chart/README.md +2 -2
- 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-bar.md +714 -0
- package/docs/chart-financial.md +567 -0
- package/docs/chart-funnel.md +546 -0
- package/docs/chart-heatmap.md +535 -0
- package/docs/chart-line-area.md +462 -0
- package/docs/chart-pie.md +645 -0
- package/docs/chart-radar.md +518 -0
- package/docs/chart-radial.md +658 -0
- package/docs/chart-scatter.md +479 -0
- package/docs/chart-treemap.md +651 -0
- package/docs/chart.md +2465 -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.mjs +12 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +212 -66
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
- 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-segmented.mjs +1 -0
- 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 +7 -2
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
- 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-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 +133 -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/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 +250 -20
- 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,733 @@
|
|
|
1
|
+
# Auto Complete
|
|
2
|
+
|
|
3
|
+
> A text input that suggests matching options as the user types.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/auto-complete`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-auto-complete`
|
|
8
|
+
|
|
9
|
+
`AutoCompleteComponent` is a text input that suggests matching options from a fixed collection as the consumer types, without requiring the typed text to match any option.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Auto Complete renders a real text input. The consumer can type anything; matching options from `data` appear in a popup below the input as suggestions, but the typed text does not have to match one of them. `value` always holds the current text of the input, not a reference to a selected data item.
|
|
14
|
+
|
|
15
|
+
Suggestion filtering, grouping, and virtual scrolling are opt-in through companion attribute directives applied to the `<mona-auto-complete>` host element, the same pattern used by Dropdown List and List View:
|
|
16
|
+
|
|
17
|
+
- `monaDropDownFilterable` — narrows the popup's visible options to those matching the typed text, using a configurable operator and case sensitivity.
|
|
18
|
+
- `monaDropDownGroupable` — groups options under a header row.
|
|
19
|
+
- `monaDropDownVirtualScroll` — renders only the options currently in view.
|
|
20
|
+
|
|
21
|
+
**Use Auto Complete when:**
|
|
22
|
+
|
|
23
|
+
- The consumer enters free text, and suggestions help but are not required — any typed value is acceptable.
|
|
24
|
+
|
|
25
|
+
**Use `DropDownList` instead when:**
|
|
26
|
+
|
|
27
|
+
- The consumer must pick one of a bounded set of options and free-text entry into the value area is not wanted.
|
|
28
|
+
|
|
29
|
+
**Use `ComboBox` instead when:**
|
|
30
|
+
|
|
31
|
+
- Typing should also be possible, but the committed value should still resolve to one of the listed options rather than arbitrary text.
|
|
32
|
+
|
|
33
|
+
**Use `MultiSelect` instead when:**
|
|
34
|
+
|
|
35
|
+
- More than one value can be selected at once.
|
|
36
|
+
|
|
37
|
+
## Import & Quick Start
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { AutoCompleteComponent } from "@nanahoshi/mona-ui/auto-complete";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
protected readonly countries = [{ name: "United States" }, { name: "Canada" }, { name: "Mexico" }];
|
|
45
|
+
protected readonly countryText = signal<string | null>(null);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
|
|
50
|
+
<mona-auto-complete
|
|
51
|
+
[data]="countries"
|
|
52
|
+
textField="name"
|
|
53
|
+
placeholder="Type a country"
|
|
54
|
+
[(value)]="countryText">
|
|
55
|
+
</mona-auto-complete>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`textField` accepts a property name or an accessor function used both to render each suggestion's text and to determine what typed text an option "matches." When omitted, the data item itself is used as the display text.
|
|
59
|
+
|
|
60
|
+
## Anatomy
|
|
61
|
+
|
|
62
|
+
Each structural directive below is an `ng-template` placed as projected content inside `<mona-auto-complete>...</mona-auto-complete>`. Unlike Dropdown List, there is no value-template directive — the value area is a plain text input, not a rendered data item.
|
|
63
|
+
|
|
64
|
+
| Directive | Selector | Template context | Replaces |
|
|
65
|
+
|----------------------------------------|------------------------------------------------|-------------------------------------------------|---------------------------------------------------------------------------------|
|
|
66
|
+
| `DropdownItemTemplateDirective` | `ng-template[monaDropDownItemTemplate]` | `{ $implicit: TData }` (the option's data item) | Each option's default text rendering inside the popup |
|
|
67
|
+
| `DropdownGroupHeaderTemplateDirective` | `ng-template[monaDropDownGroupHeaderTemplate]` | `{ $implicit: group }` | The default group header row, when grouping is enabled |
|
|
68
|
+
| `DropdownHeaderTemplateDirective` | `ng-template[monaDropDownHeaderTemplate]` | None | No default — renders above the option list inside the popup |
|
|
69
|
+
| `DropdownFooterTemplateDirective` | `ng-template[monaDropDownFooterTemplate]` | None | No default — renders below the option list inside the popup |
|
|
70
|
+
| `DropdownNoDataTemplateDirective` | `ng-template[monaDropDownNoDataTemplate]` | None | The popup's default empty-state content |
|
|
71
|
+
| `DropdownPrefixTemplateDirective` | `ng-template[monaDropdownPrefixTemplate]` | None | No default — projected content rendered before the input |
|
|
72
|
+
| `DropdownSuffixTemplateDirective` | `ng-template[monaDropdownSuffixTemplate]` | None | No default — projected content rendered after the input, before the live region |
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
### Filtering the suggestion list
|
|
77
|
+
|
|
78
|
+
`monaDropDownFilterable` narrows the popup's visible options to those matching the typed text. Without it, the popup shows the full `data` collection while still highlighting the best match — see [Matching without `monaDropDownFilterable`](#matching-without-monadropdownfilterable).
|
|
79
|
+
|
|
80
|
+
`filtering-example.component.ts`
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { Component, signal } from "@angular/core";
|
|
84
|
+
import { AutoCompleteComponent } from "@nanahoshi/mona-ui/auto-complete";
|
|
85
|
+
import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
86
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: "app-auto-complete-filtering-example",
|
|
90
|
+
imports: [AutoCompleteComponent, DropdownFilterableDirective, LabelDirective],
|
|
91
|
+
templateUrl: "./filtering-example.component.html"
|
|
92
|
+
})
|
|
93
|
+
export class AutoCompleteFilteringExampleComponent {
|
|
94
|
+
protected readonly countries = ["Argentina", "Canada", "Chile", "Germany", "Japan", "Kenya", "Mexico", "Norway"];
|
|
95
|
+
protected readonly country = signal<string | null>(null);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`filtering-example.component.html`
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
103
|
+
<label monaLabel for="auto-complete-filtering-country">Country</label>
|
|
104
|
+
<mona-auto-complete
|
|
105
|
+
inputId="auto-complete-filtering-country"
|
|
106
|
+
monaDropDownFilterable
|
|
107
|
+
placeholder="Type a country"
|
|
108
|
+
[data]="countries"
|
|
109
|
+
[(value)]="country" />
|
|
110
|
+
<span aria-live="polite" class="text-sm">Value: {{ country() ?? "none" }}</span>
|
|
111
|
+
</div>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Grouping
|
|
115
|
+
|
|
116
|
+
`monaDropDownGroupable` groups options under a header row, driven by `groupBy`.
|
|
117
|
+
|
|
118
|
+
`grouping-example.component.ts`
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { Component, signal } from "@angular/core";
|
|
122
|
+
import { AutoCompleteComponent } from "@nanahoshi/mona-ui/auto-complete";
|
|
123
|
+
import { DropdownFilterableDirective, DropdownGroupableDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
124
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
125
|
+
|
|
126
|
+
@Component({
|
|
127
|
+
selector: "app-auto-complete-grouping-example",
|
|
128
|
+
imports: [AutoCompleteComponent, DropdownFilterableDirective, DropdownGroupableDirective, LabelDirective],
|
|
129
|
+
templateUrl: "./grouping-example.component.html"
|
|
130
|
+
})
|
|
131
|
+
export class AutoCompleteGroupingExampleComponent {
|
|
132
|
+
protected readonly cities = [
|
|
133
|
+
{ name: "Hamburg", country: "Germany" },
|
|
134
|
+
{ name: "Munich", country: "Germany" },
|
|
135
|
+
{ name: "Osaka", country: "Japan" },
|
|
136
|
+
{ name: "Tokyo", country: "Japan" },
|
|
137
|
+
{ name: "Bergen", country: "Norway" },
|
|
138
|
+
{ name: "Oslo", country: "Norway" }
|
|
139
|
+
];
|
|
140
|
+
protected readonly city = signal<string | null>(null);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`grouping-example.component.html`
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
148
|
+
<label monaLabel for="auto-complete-grouping-city">City</label>
|
|
149
|
+
<mona-auto-complete
|
|
150
|
+
groupBy="country"
|
|
151
|
+
inputId="auto-complete-grouping-city"
|
|
152
|
+
monaDropDownFilterable
|
|
153
|
+
monaDropDownGroupable
|
|
154
|
+
placeholder="Type a city"
|
|
155
|
+
textField="name"
|
|
156
|
+
[data]="cities"
|
|
157
|
+
[(value)]="city" />
|
|
158
|
+
</div>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Custom templates
|
|
162
|
+
|
|
163
|
+
The item template replaces each option's text, the prefix template adds content before the input, and the no-data template replaces the empty popup.
|
|
164
|
+
|
|
165
|
+
`templates-example.component.ts`
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
import { Component, signal } from "@angular/core";
|
|
169
|
+
import { LucideSearch } from "@lucide/angular";
|
|
170
|
+
import { AutoCompleteComponent } from "@nanahoshi/mona-ui/auto-complete";
|
|
171
|
+
import {
|
|
172
|
+
DropdownItemTemplateDirective,
|
|
173
|
+
DropdownNoDataTemplateDirective,
|
|
174
|
+
DropdownPrefixTemplateDirective
|
|
175
|
+
} from "@nanahoshi/mona-ui/dropdowns";
|
|
176
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
177
|
+
|
|
178
|
+
@Component({
|
|
179
|
+
selector: "app-auto-complete-templates-example",
|
|
180
|
+
imports: [
|
|
181
|
+
AutoCompleteComponent,
|
|
182
|
+
DropdownItemTemplateDirective,
|
|
183
|
+
DropdownNoDataTemplateDirective,
|
|
184
|
+
DropdownPrefixTemplateDirective,
|
|
185
|
+
LabelDirective,
|
|
186
|
+
LucideSearch
|
|
187
|
+
],
|
|
188
|
+
templateUrl: "./templates-example.component.html"
|
|
189
|
+
})
|
|
190
|
+
export class AutoCompleteTemplatesExampleComponent {
|
|
191
|
+
protected readonly language = signal<string | null>(null);
|
|
192
|
+
protected readonly languages = [
|
|
193
|
+
{ name: "English", code: "en" },
|
|
194
|
+
{ name: "French", code: "fr" },
|
|
195
|
+
{ name: "Japanese", code: "ja" },
|
|
196
|
+
{ name: "Portuguese", code: "pt" },
|
|
197
|
+
{ name: "Spanish", code: "es" },
|
|
198
|
+
{ name: "Turkish", code: "tr" }
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
`templates-example.component.html`
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
207
|
+
<label monaLabel for="auto-complete-templates-language">Language</label>
|
|
208
|
+
<mona-auto-complete
|
|
209
|
+
inputId="auto-complete-templates-language"
|
|
210
|
+
placeholder="Type a language"
|
|
211
|
+
textField="name"
|
|
212
|
+
[data]="languages"
|
|
213
|
+
[(value)]="language">
|
|
214
|
+
<ng-template monaDropdownPrefixTemplate>
|
|
215
|
+
<svg lucideSearch aria-hidden="true" class="ms-2" [size]="16"></svg>
|
|
216
|
+
</ng-template>
|
|
217
|
+
<ng-template let-item monaDropDownItemTemplate>
|
|
218
|
+
<span class="flex-1">{{ item.name }}</span>
|
|
219
|
+
<span class="text-muted-foreground text-xs">{{ item.code }}</span>
|
|
220
|
+
</ng-template>
|
|
221
|
+
<ng-template monaDropDownNoDataTemplate>
|
|
222
|
+
<span class="p-2 text-sm">No language matches.</span>
|
|
223
|
+
</ng-template>
|
|
224
|
+
</mona-auto-complete>
|
|
225
|
+
</div>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Signal Forms integration
|
|
229
|
+
|
|
230
|
+
Binding `[formField]` synchronizes `value`, `disabled`, `readonly`, `required`, `invalid`, and `touched` with a signal forms field automatically. The field's value type must be `string | null`.
|
|
231
|
+
|
|
232
|
+
`forms-example.component.ts`
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
import { Component, signal } from "@angular/core";
|
|
236
|
+
import { form, FormField, required } from "@angular/forms/signals";
|
|
237
|
+
import { AutoCompleteComponent } from "@nanahoshi/mona-ui/auto-complete";
|
|
238
|
+
import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
239
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
240
|
+
|
|
241
|
+
interface AddressModel {
|
|
242
|
+
city: string | null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@Component({
|
|
246
|
+
selector: "app-auto-complete-forms-example",
|
|
247
|
+
imports: [AutoCompleteComponent, DropdownFilterableDirective, FormField, LabelDirective],
|
|
248
|
+
templateUrl: "./forms-example.component.html"
|
|
249
|
+
})
|
|
250
|
+
export class AutoCompleteFormsExampleComponent {
|
|
251
|
+
readonly #model = signal<AddressModel>({ city: null });
|
|
252
|
+
protected readonly address = form(this.#model, path => {
|
|
253
|
+
required(path.city);
|
|
254
|
+
});
|
|
255
|
+
protected readonly cities = ["Amsterdam", "Lisbon", "Madrid", "Prague", "Vienna", "Warsaw"];
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
`forms-example.component.html`
|
|
260
|
+
|
|
261
|
+
```html
|
|
262
|
+
<div class="flex max-w-xs flex-col gap-1">
|
|
263
|
+
<label monaLabel for="auto-complete-forms-city">City</label>
|
|
264
|
+
<mona-auto-complete
|
|
265
|
+
aria-describedby="auto-complete-forms-city-hint"
|
|
266
|
+
inputId="auto-complete-forms-city"
|
|
267
|
+
monaDropDownFilterable
|
|
268
|
+
[data]="cities"
|
|
269
|
+
[formField]="address.city" />
|
|
270
|
+
<p id="auto-complete-forms-city-hint" class="text-sm">Required. Any text is accepted.</p>
|
|
271
|
+
@if (address.city().touched() && address.city().invalid()) {
|
|
272
|
+
<p class="text-error text-sm" role="alert">Enter a city.</p>
|
|
273
|
+
}
|
|
274
|
+
</div>
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Highlight the first match while typing
|
|
278
|
+
|
|
279
|
+
`highlightFirst` (default `true`) highlights the first option whose text matches the typed text as the consumer types, so `Enter` can commit it immediately. Set it to `false` to require the consumer to navigate to an option explicitly before `Enter` commits it.
|
|
280
|
+
|
|
281
|
+
```html
|
|
282
|
+
|
|
283
|
+
<mona-auto-complete [data]="countries" textField="name" [highlightFirst]="false"></mona-auto-complete>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Disabled, readonly, loading, and required states
|
|
287
|
+
|
|
288
|
+
`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 prevents interaction while an operation is in progress. `required` marks the field for form validation and affects the invalid state once the control is touched.
|
|
289
|
+
|
|
290
|
+
```html
|
|
291
|
+
|
|
292
|
+
<mona-auto-complete
|
|
293
|
+
[data]="countries"
|
|
294
|
+
textField="name"
|
|
295
|
+
[disabled]="isDisabled()"
|
|
296
|
+
[readonly]="isReadonly()"
|
|
297
|
+
[loading]="isLoading()"
|
|
298
|
+
[required]="true">
|
|
299
|
+
</mona-auto-complete>
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Virtual scrolling
|
|
303
|
+
|
|
304
|
+
`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.
|
|
305
|
+
|
|
306
|
+
```html
|
|
307
|
+
|
|
308
|
+
<mona-auto-complete
|
|
309
|
+
[data]="countries"
|
|
310
|
+
textField="name"
|
|
311
|
+
monaDropDownVirtualScroll
|
|
312
|
+
[monaDropDownVirtualScroll]="{ height: 32 }">
|
|
313
|
+
</mona-auto-complete>
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Behavior
|
|
317
|
+
|
|
318
|
+
### `value` is always the typed text, not a data item
|
|
319
|
+
|
|
320
|
+
`value` is typed `string | null` and always reflects the input's text — either what the consumer typed, or the text of a selected option. It never becomes the option's underlying data item or a field derived through `valueField`, even when `textField`/`valueField` are set.
|
|
321
|
+
|
|
322
|
+
### `valueField`'s effect is unclear
|
|
323
|
+
|
|
324
|
+
`valueField` is accepted and forwarded to the internal list state, the same as `textField`, but `AutoCompleteComponent` never reads it to shape `value` or to mark an option "selected" the way `DropdownListComponent` does. `TODO(owner-review): confirm whether valueField has any consumer-observable effect on AutoComplete, or whether its description should be corrected/removed for this component.`
|
|
325
|
+
|
|
326
|
+
### Matching without `monaDropDownFilterable`
|
|
327
|
+
|
|
328
|
+
Even when `monaDropDownFilterable` is not applied, typing still highlights the best-matching option (when `highlightFirst` is `true`) using a case-insensitive "starts with" comparison against `textField`. The popup's visible option list itself is only narrowed once `monaDropDownFilterable` is applied — without it, all options remain visible regardless of what has been typed.
|
|
329
|
+
|
|
330
|
+
### Committing and clearing
|
|
331
|
+
|
|
332
|
+
Blurring the input while the popup is closed commits the typed text as `value`, even without pressing `Enter`. Clearing the input's text (for example by pressing `Escape` when the popup is closed) also clears `value`.
|
|
333
|
+
|
|
334
|
+
### `open` and `close` are cancelable
|
|
335
|
+
|
|
336
|
+
`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.
|
|
337
|
+
|
|
338
|
+
### `DropdownFieldSelectorType`, `DropdownFieldPredicateType`, and `ListSizeInputType` are not exported
|
|
339
|
+
|
|
340
|
+
`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.
|
|
341
|
+
`TODO(owner-review): confirm whether these types should be added to the public barrel export.`
|
|
342
|
+
|
|
343
|
+
## Forms Integration
|
|
344
|
+
|
|
345
|
+
`AutoCompleteComponent` implements the signal forms `FormValueControl<string | null>` interface 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.
|
|
346
|
+
|
|
347
|
+
## Accessibility
|
|
348
|
+
|
|
349
|
+
### Keyboard
|
|
350
|
+
|
|
351
|
+
| Key | Action |
|
|
352
|
+
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
353
|
+
| `ArrowDown` / `ArrowUp` | Highlight the next or previous option. Never commits the value by itself. |
|
|
354
|
+
| `Alt+ArrowDown` | Open the popup. |
|
|
355
|
+
| `Alt+ArrowUp` | Close the popup. |
|
|
356
|
+
| `Enter` | Commit the highlighted option's text (if any), or the currently typed text otherwise, and close the popup. |
|
|
357
|
+
| `Escape` | Close the popup if it is open; otherwise clear the typed text. |
|
|
358
|
+
| `Tab` | Close the popup. |
|
|
359
|
+
| Any other character | Typed into the input as usual. When `monaDropDownFilterable` is applied, also narrows the popup's visible options — see [Matching without `monaDropDownFilterable`](#matching-without-monadropdownfilterable). |
|
|
360
|
+
|
|
361
|
+
### Focus
|
|
362
|
+
|
|
363
|
+
The host element itself is not a Tab stop (`tabindex="-1"`); the inner `<input>` element receives focus and is the actual Tab stop. Arrow-key navigation moves an internal highlighted-option pointer, reflected through `aria-activedescendant` on the input, instead of moving DOM focus into the popup.
|
|
364
|
+
|
|
365
|
+
### ARIA
|
|
366
|
+
|
|
367
|
+
| Element | Attribute | When present | Value |
|
|
368
|
+
|--------------|-------------------------|------------------------------------------------------------------------------------------------|---------------------------------------------------|
|
|
369
|
+
| Host element | `aria-disabled` | `disabled` is `true` | `"true"` |
|
|
370
|
+
| Host element | `aria-haspopup` | Always | `"listbox"` |
|
|
371
|
+
| Host element | `aria-invalid` | `invalid` is `true`, or `required` is `true` and the control is `touched` with no value | `"true"` |
|
|
372
|
+
| Host element | `aria-readonly` | `readonly` is `true` | `"true"` |
|
|
373
|
+
| Host element | `aria-required` | `required` is `true` | `"true"` |
|
|
374
|
+
| Input | `role` | Always | `"combobox"` |
|
|
375
|
+
| Input | `aria-autocomplete` | Always | `"list"` |
|
|
376
|
+
| Input | `aria-haspopup` | Always | `"listbox"` |
|
|
377
|
+
| Input | `aria-controls` | Always | The popup listbox's element id |
|
|
378
|
+
| Input | `aria-expanded` | Always | Reflects the popup's open state |
|
|
379
|
+
| Input | `aria-busy` | Always | Reflects the `loading` input |
|
|
380
|
+
| Input | `aria-activedescendant` | While an option is highlighted | The highlighted option's element id |
|
|
381
|
+
| Input | `aria-invalid` | `invalid` is `true`, or `required` is `true` and the control is `touched` with no value | `"true"` |
|
|
382
|
+
| Input | `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 |
|
|
383
|
+
| Input | `aria-labelledby` | The `aria-labelledby` input is set | The `aria-labelledby` value |
|
|
384
|
+
| Input | `aria-describedby` | The `aria-describedby` input is set | The `aria-describedby` value |
|
|
385
|
+
|
|
386
|
+
Provide `aria-label` or `aria-labelledby` when `placeholder` does not already identify the input's purpose, or point a `<label for>` or `<mona-label for>` at `inputId`. Provide `aria-describedby` to associate error messages or help text with the input.
|
|
387
|
+
|
|
388
|
+
The control also renders a visually hidden live region that announces the highlighted option's text and position to screen reader users as the consumer types.
|
|
389
|
+
|
|
390
|
+
## API
|
|
391
|
+
|
|
392
|
+
Everything below is imported from `@nanahoshi/mona-ui/auto-complete`, `@nanahoshi/mona-ui/dropdowns`, as noted.
|
|
393
|
+
|
|
394
|
+
### `AutoCompleteComponent`
|
|
395
|
+
|
|
396
|
+
**Selector:** `mona-auto-complete`
|
|
397
|
+
**Type parameters:** `TData = unknown`
|
|
398
|
+
**Implements:** `FormValueControl<string \| null>`
|
|
399
|
+
|
|
400
|
+
#### Inputs
|
|
401
|
+
|
|
402
|
+
| Name | Type | Default | Description |
|
|
403
|
+
| --- | --- | --- | --- |
|
|
404
|
+
| `aria-describedby` | `string` | `""` | ID of an element that provides an extended description for the input. Use this to associate error messages or help text with the input. |
|
|
405
|
+
| `aria-label` | `string` | `""` | Accessible name for the input. Describe what the autocomplete represents. Prefer a visible label, linked through `inputId` or `aria-labelledby`; without any of them, browsers fall back to the `placeholder`. |
|
|
406
|
+
| `aria-labelledby` | `string` | `""` | ID of an external element that provides the accessible name for the input. |
|
|
407
|
+
| `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
408
|
+
| `data` | `Iterable<TData>` | `[]` | Collection of items to render. |
|
|
409
|
+
| `disabled` | `boolean` | `false` | Renders the component with reduced visual emphasis and removes pointer interaction. |
|
|
410
|
+
| `highlightFirst` | `boolean` | `true` | Defines whether the first matching item should be highlighted while typing. |
|
|
411
|
+
| `inputId` | `string` | `generated` | Id of the inner `<input>` element. Point a `<label for>` or `<mona-label for>` at it to label the autocomplete. A unique id is generated when it isn't set. |
|
|
412
|
+
| `invalid` | `boolean` | `false` | Marks the autocomplete as invalid. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
413
|
+
| `itemDisabled` | `DropdownFieldPredicateType<TData>` | `undefined` | Predicate or field name used to determine whether an individual item is disabled. |
|
|
414
|
+
| `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. |
|
|
415
|
+
| `placeholder` | `string` | `""` | Placeholder text shown when no value is selected or entered. |
|
|
416
|
+
| `popupClass` | `string` | `""` | Additional CSS classes applied to the popup element. |
|
|
417
|
+
| `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. |
|
|
418
|
+
| `popupWidth` | `ListSizeInputType` | `null` | Width of the popup element. |
|
|
419
|
+
| `readonly` | `boolean` | `false` | Prevents value changes while preserving the component's visual state. |
|
|
420
|
+
| `required` | `boolean` | `false` | Marks the field as required for form validation. |
|
|
421
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the component. |
|
|
422
|
+
| `showClearButton` | `boolean` | `true` | Displays a button that clears the current value when clicked. Unlike the other dropdowns, this defaults to `true`. |
|
|
423
|
+
| `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the component's dimensions. |
|
|
424
|
+
| `textField` | `DropdownFieldSelectorType<TData, string>` | `null` | Property name or accessor used to derive the display text from a data item. If null, the item itself is used as the display text. |
|
|
425
|
+
| `touched` | `boolean` | `false` | Sets the touched state of the autocomplete. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
426
|
+
| `value` (two-way) | `string \| null` | `null` | Two-way bindable current autocomplete value. Implements `FormValueControl<string \| null>`, enabling signal forms `[formField]` binding. |
|
|
427
|
+
| `valueField` | `DropdownFieldSelectorType<TData, unknown>` | `null` | Property name or accessor used to derive the value from a data item. If null, the item itself is used as the value. |
|
|
428
|
+
|
|
429
|
+
#### Outputs
|
|
430
|
+
|
|
431
|
+
| Name | Type | Description |
|
|
432
|
+
| --- | --- | --- |
|
|
433
|
+
| `close` | `PopupCloseEvent<unknown>` | Emits when the popup is about to close. This event is preventable. |
|
|
434
|
+
| `closed` | `void` | Emits after the popup is closed. |
|
|
435
|
+
| `open` | `PreventableEvent<Event>` | Emits when the popup is about to open. This event is preventable. |
|
|
436
|
+
| `opened` | `void` | Emits after the popup is opened. |
|
|
437
|
+
| `touch` | `void` | Emitted when focus leaves the autocomplete. Moving between its input, clear button and popup doesn't count. The `FormField` directive listens to this to mark the field as touched. |
|
|
438
|
+
| `valueChange` | `string \| null` | Emitted when `value` changes. |
|
|
439
|
+
|
|
440
|
+
#### Methods
|
|
441
|
+
|
|
442
|
+
| Signature | Description |
|
|
443
|
+
| --- | --- |
|
|
444
|
+
| `focus(options?: FocusOptions): void` | Moves focus to the inner input. The caret goes to the end of the text. |
|
|
445
|
+
|
|
446
|
+
### `DropdownFilterableDirective`
|
|
447
|
+
|
|
448
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
449
|
+
|
|
450
|
+
**Selector:** `mona-auto-complete[monaDropDownFilterable], mona-dropdown-list[monaDropDownFilterable], mona-combo-box[monaDropDownFilterable], mona-multi-select[monaDropDownFilterable]`
|
|
451
|
+
|
|
452
|
+
#### Inputs
|
|
453
|
+
|
|
454
|
+
| Name | Type | Default | Description |
|
|
455
|
+
| --- | --- | --- | --- |
|
|
456
|
+
| `filter` | `string` | `""` | Current filter text used to narrow the visible options. |
|
|
457
|
+
| `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. |
|
|
458
|
+
| `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. |
|
|
459
|
+
|
|
460
|
+
#### Outputs
|
|
461
|
+
|
|
462
|
+
| Name | Type | Description |
|
|
463
|
+
| --- | --- | --- |
|
|
464
|
+
| `filterChange` | `FilterChangeEvent` | Emitted when the filter value changes. Cancelable. |
|
|
465
|
+
|
|
466
|
+
### `DropdownGroupableDirective`
|
|
467
|
+
|
|
468
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
469
|
+
|
|
470
|
+
**Selector:** `mona-auto-complete[monaDropDownGroupable], mona-combo-box[monaDropDownGroupable], mona-dropdown-list[monaDropDownGroupable], mona-multi-select[monaDropDownGroupable]`
|
|
471
|
+
**Type parameters:** `TData`
|
|
472
|
+
|
|
473
|
+
#### Inputs
|
|
474
|
+
|
|
475
|
+
| Name | Type | Default | Description |
|
|
476
|
+
| --- | --- | --- | --- |
|
|
477
|
+
| `groupBy` | `string \| Selector<TData, unknown> \| null \| undefined` | `""` | Property name, or accessor, used to derive an option's group. |
|
|
478
|
+
| `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. |
|
|
479
|
+
|
|
480
|
+
### `DropdownVirtualScrollDirective`
|
|
481
|
+
|
|
482
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
483
|
+
|
|
484
|
+
**Selector:** `mona-auto-complete[monaDropDownVirtualScroll], mona-dropdown-list[monaDropDownVirtualScroll], mona-combo-box[monaDropDownVirtualScroll], mona-multi-select[monaDropDownVirtualScroll]`
|
|
485
|
+
|
|
486
|
+
#### Inputs
|
|
487
|
+
|
|
488
|
+
| Name | Type | Default | Description |
|
|
489
|
+
| --- | --- | --- | --- |
|
|
490
|
+
| `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. |
|
|
491
|
+
|
|
492
|
+
### `DropdownDataHandlerDirective`
|
|
493
|
+
|
|
494
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
495
|
+
|
|
496
|
+
**Selector:** `[monaDropdownDataHandler]`
|
|
497
|
+
|
|
498
|
+
### `DropdownFooterTemplateDirective`
|
|
499
|
+
|
|
500
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
501
|
+
|
|
502
|
+
**Selector:** `ng-template[monaDropDownFooterTemplate], ng-template[monaAutoCompleteFooterTemplate], ng-template[monaDropDownListFooterTemplate], ng-template[monaDropDownTreeFooterTemplate], ng-template[monaComboBoxFooterTemplate], ng-template[monaMultiSelectFooterTemplate]`
|
|
503
|
+
|
|
504
|
+
### `DropdownGroupHeaderTemplateDirective`
|
|
505
|
+
|
|
506
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
507
|
+
|
|
508
|
+
**Selector:** `ng-template[monaDropDownGroupHeaderTemplate], ng-template[monaAutoCompleteGroupHeaderTemplate], ng-template[monaDropDownListGroupHeaderTemplate], ng-template[monaComboBoxGroupHeaderTemplate], ng-template[monaMultiSelectGroupHeaderTemplate]`
|
|
509
|
+
|
|
510
|
+
### `DropdownHeaderTemplateDirective`
|
|
511
|
+
|
|
512
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
513
|
+
|
|
514
|
+
**Selector:** `ng-template[monaDropDownHeaderTemplate], ng-template[monaAutoCompleteHeaderTemplate], ng-template[monaDropDownListHeaderTemplate], ng-template[monaDropDownTreeHeaderTemplate], ng-template[monaComboBoxHeaderTemplate], ng-template[monaMultiSelectHeaderTemplate]`
|
|
515
|
+
|
|
516
|
+
### `DropdownItemTemplateDirective`
|
|
517
|
+
|
|
518
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
519
|
+
|
|
520
|
+
**Selector:** `ng-template[monaDropDownItemTemplate], ng-template[monaAutoCompleteItemTemplate], ng-template[monaDropDownListItemTemplate], ng-template[monaComboBoxItemTemplate], ng-template[monaMultiSelectItemTemplate]`
|
|
521
|
+
|
|
522
|
+
### `DropdownListPopupHandlerDirective`
|
|
523
|
+
|
|
524
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
525
|
+
|
|
526
|
+
**Selector:** `[monaDropdownListPopupHandler]`
|
|
527
|
+
|
|
528
|
+
### `DropdownLiveRegionDirective`
|
|
529
|
+
|
|
530
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
531
|
+
|
|
532
|
+
Announces how many results a dropdown shows after its list is filtered, or after its items change, while the
|
|
533
|
+
popup is open ("3 results available", "No results found").
|
|
534
|
+
|
|
535
|
+
The announcement goes through the CDK `LiveAnnouncer`, whose live region lives at the end of the document, so it
|
|
536
|
+
never becomes part of the combobox's content. The highlighted option isn't announced here:
|
|
537
|
+
`aria-activedescendant` already does that.
|
|
538
|
+
|
|
539
|
+
**Selector:** `[monaDropdownLiveRegion]`
|
|
540
|
+
|
|
541
|
+
### `DropdownNoDataTemplateDirective`
|
|
542
|
+
|
|
543
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
544
|
+
|
|
545
|
+
**Selector:** `ng-template[monaDropDownNoDataTemplate], ng-template[monaAutoCompleteNoDataTemplate], ng-template[monaDropDownListNoDataTemplate], ng-template[monaDropDownTreeNoDataTemplate], ng-template[monaComboBoxNoDataTemplate], ng-template[monaMultiSelectNoDataTemplate]`
|
|
546
|
+
|
|
547
|
+
### `DropdownPopupHandlerDirective`
|
|
548
|
+
|
|
549
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
550
|
+
|
|
551
|
+
**Selector:** `[monaDropdownPopupHandler]`
|
|
552
|
+
|
|
553
|
+
### `DropdownPrefixTemplateDirective`
|
|
554
|
+
|
|
555
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
556
|
+
|
|
557
|
+
**Selector:** `ng-template[monaDropdownPrefixTemplate]`
|
|
558
|
+
|
|
559
|
+
### `DropdownSuffixTemplateDirective`
|
|
560
|
+
|
|
561
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
562
|
+
|
|
563
|
+
**Selector:** `ng-template[monaDropdownSuffixTemplate]`
|
|
564
|
+
|
|
565
|
+
### `DropdownListService`
|
|
566
|
+
|
|
567
|
+
From `@nanahoshi/mona-ui/dropdowns`.
|
|
568
|
+
|
|
569
|
+
**Type parameters:** `TData = unknown`
|
|
570
|
+
|
|
571
|
+
#### Properties
|
|
572
|
+
|
|
573
|
+
| Name | Type |
|
|
574
|
+
| --- | --- |
|
|
575
|
+
| `navigate$` (read-only) | `Subject<{ item: ListItem<TData>; }>` |
|
|
576
|
+
|
|
577
|
+
### Types
|
|
578
|
+
|
|
579
|
+
#### `AUTO_COMPLETE_DEFAULT_MESSAGES`
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
const AUTO_COMPLETE_DEFAULT_MESSAGES: MonaAutoCompleteMessages;
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
#### `DROPDOWN_DATA_INPUT_TOKEN`
|
|
586
|
+
|
|
587
|
+
```typescript
|
|
588
|
+
const DROPDOWN_DATA_INPUT_TOKEN: InjectionToken<DropdownDataInput<unknown>>;
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
#### `DROPDOWN_POPUP_INPUT_TOKEN`
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
const DROPDOWN_POPUP_INPUT_TOKEN: InjectionToken<DropdownPopupInput>;
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
#### `DropdownDataInputToken`
|
|
598
|
+
|
|
599
|
+
**Deprecated.** Use `DROPDOWN_DATA_INPUT_TOKEN`.
|
|
600
|
+
|
|
601
|
+
```typescript
|
|
602
|
+
const DropdownDataInputToken: InjectionToken<DropdownDataInput<unknown>>;
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
#### `dropdownPopupThemeVariants`
|
|
606
|
+
|
|
607
|
+
```typescript
|
|
608
|
+
const dropdownPopupThemeVariants: (props?: ({ rounded?: "none" | "small" | "medium" | "large" | "full" | null | undefined; size?: "small" | "medium" | "large" | null | undefined; } & ClassProp) | undefined) => string;
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
#### `DROPDOWNS_DEFAULT_MESSAGES`
|
|
612
|
+
|
|
613
|
+
```typescript
|
|
614
|
+
const DROPDOWNS_DEFAULT_MESSAGES: MonaDropdownsMessages;
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
#### `DropdownDataInput`
|
|
618
|
+
|
|
619
|
+
**Type parameters:** `TData`
|
|
620
|
+
|
|
621
|
+
| Name | Type |
|
|
622
|
+
| --- | --- |
|
|
623
|
+
| `data` (read-only) | `InputSignal<Iterable<TData>>` |
|
|
624
|
+
| `itemDisabled` (read-only) | `InputSignal<DropdownFieldPredicateType<TData>>` |
|
|
625
|
+
| `textField` (read-only) | `InputSignal<DropdownFieldSelectorType<TData, string>>` |
|
|
626
|
+
| `valueField` (read-only) | `InputSignal<DropdownFieldSelectorType<TData, unknown>>` |
|
|
627
|
+
|
|
628
|
+
#### `DropdownPopupInput`
|
|
629
|
+
|
|
630
|
+
| Name | Type |
|
|
631
|
+
| --- | --- |
|
|
632
|
+
| `close` (read-only) | `OutputEmitterRef<PopupCloseEvent>` |
|
|
633
|
+
| `closed` (read-only) | `OutputEmitterRef<void>` |
|
|
634
|
+
| `disabled` (read-only) | `Signal<boolean>` |
|
|
635
|
+
| `open` (read-only) | `OutputEmitterRef<PreventableEvent>` |
|
|
636
|
+
| `opened` (read-only) | `OutputEmitterRef<void>` |
|
|
637
|
+
| `popupHeight` (read-only) | `InputSignal<ListSizeInputType>` |
|
|
638
|
+
| `popupWidth` (read-only) | `InputSignal<ListSizeInputType>` |
|
|
639
|
+
| `readonly` (read-only) | `Signal<boolean>` |
|
|
640
|
+
| `touch` (read-only) | `OutputEmitterRef<void>` |
|
|
641
|
+
|
|
642
|
+
#### `DropdownFieldPredicateType`
|
|
643
|
+
|
|
644
|
+
```typescript
|
|
645
|
+
type DropdownFieldPredicateType<TData> = string | Predicate<TData> | null | undefined;
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
#### `DropdownFieldSelectorType`
|
|
649
|
+
|
|
650
|
+
```typescript
|
|
651
|
+
type DropdownFieldSelectorType<TData, TResult = unknown> = string | Selector<TData, TResult> | null | undefined;
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
#### `FilterChangeEvent`
|
|
655
|
+
|
|
656
|
+
From `@nanahoshi/mona-ui/common`.
|
|
657
|
+
|
|
658
|
+
**Extends:** `PreventableEvent`
|
|
659
|
+
|
|
660
|
+
| Name | Type |
|
|
661
|
+
| --- | --- |
|
|
662
|
+
| `filter` (read-only) | `string` |
|
|
663
|
+
|
|
664
|
+
#### `ListItem`
|
|
665
|
+
|
|
666
|
+
From `@nanahoshi/mona-ui/list`.
|
|
667
|
+
|
|
668
|
+
An item of a list, wrapping its data item.
|
|
669
|
+
|
|
670
|
+
**Type parameters:** `TData`
|
|
671
|
+
|
|
672
|
+
| Name | Type |
|
|
673
|
+
| --- | --- |
|
|
674
|
+
| `data` (read-only) | `TData` |
|
|
675
|
+
| `header` (read-only) | `string` |
|
|
676
|
+
| `isHeader` (read-only) | `boolean` |
|
|
677
|
+
| `uid` (read-only) | `string` |
|
|
678
|
+
|
|
679
|
+
#### `ListSizeInputType`
|
|
680
|
+
|
|
681
|
+
From `@nanahoshi/mona-ui/list`.
|
|
682
|
+
|
|
683
|
+
```typescript
|
|
684
|
+
type ListSizeInputType = ListSizeType | number;
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
#### `ListSizeType`
|
|
688
|
+
|
|
689
|
+
From `@nanahoshi/mona-ui/list`.
|
|
690
|
+
|
|
691
|
+
A CSS length, or nothing to leave it to the stylesheet.
|
|
692
|
+
|
|
693
|
+
```typescript
|
|
694
|
+
type ListSizeType = string | null | undefined;
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
#### `MonaAutoCompleteMessages`
|
|
698
|
+
|
|
699
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
700
|
+
|
|
701
|
+
| Name | Type |
|
|
702
|
+
| --- | --- |
|
|
703
|
+
| `clear` (read-only) | `string` |
|
|
704
|
+
|
|
705
|
+
#### `MonaDropdownsMessages`
|
|
706
|
+
|
|
707
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
708
|
+
|
|
709
|
+
| Name | Type |
|
|
710
|
+
| --- | --- |
|
|
711
|
+
| `itemPosition` (read-only) | `(text: string, position: number, total: number) => string` |
|
|
712
|
+
| `noResultsFound` (read-only) | `string` |
|
|
713
|
+
| `resultsAvailable` (read-only) | `(count: number) => string` |
|
|
714
|
+
|
|
715
|
+
#### `PreventableEvent`
|
|
716
|
+
|
|
717
|
+
From `@nanahoshi/mona-ui/common`.
|
|
718
|
+
|
|
719
|
+
**Type parameters:** `E extends Event = Event`
|
|
720
|
+
|
|
721
|
+
| Name | Type | Description |
|
|
722
|
+
| --- | --- | --- |
|
|
723
|
+
| `originalEvent` (read-only) | `E \| undefined` | The DOM event that caused this one, when there is one. |
|
|
724
|
+
| `type` (read-only) | `string \| undefined` | A name for the kind of event, when the component that emits it sets one. |
|
|
725
|
+
|
|
726
|
+
**Methods**
|
|
727
|
+
|
|
728
|
+
| Signature | Description |
|
|
729
|
+
| --- | --- |
|
|
730
|
+
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
731
|
+
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
732
|
+
|
|
733
|
+
**Documented elsewhere:** [`FilterableOptions`](grid.md), [`GroupableOptions`](grid.md), [`PopupCloseEvent`](popup.md), [`VirtualScrollOptions`](list-view.md)
|