@nanahoshi/mona-ui 0.34.0 → 0.36.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/alert/package.json +4 -0
- package/badge/package.json +4 -0
- package/docs/alert.md +219 -0
- package/docs/api/alert.md +78 -0
- package/docs/api/avatar.md +25 -0
- package/docs/api/badge.md +24 -0
- package/docs/api/common.md +3 -3
- package/docs/api/i18n.md +71 -5
- package/docs/api/locales.md +14 -14
- package/docs/api/masked-text-box.md +137 -0
- package/docs/api/multi-select.md +3 -0
- package/docs/api/separator.md +23 -0
- package/docs/api/toolbar.md +81 -0
- package/docs/avatar.md +108 -6
- package/docs/badge.md +181 -0
- package/docs/masked-textbox.md +334 -0
- package/docs/multi-select.md +120 -0
- package/docs/separator.md +147 -0
- package/docs/sidebar-menus.md +1 -1
- package/docs/toolbar.md +327 -0
- package/fesm2022/nanahoshi-mona-ui-alert.mjs +422 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +182 -3
- package/fesm2022/nanahoshi-mona-ui-badge.mjs +273 -0
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +20 -1
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +54 -15
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +13 -1
- package/fesm2022/nanahoshi-mona-ui-masked-text-box.mjs +1302 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +112 -3
- package/fesm2022/nanahoshi-mona-ui-separator.mjs +165 -0
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +3 -3
- package/fesm2022/nanahoshi-mona-ui-toolbar.mjs +536 -0
- package/i18n/catalogs/en-US.messages.json +19 -1
- package/llms.txt +13 -3
- package/locales/ar-sa/ar-sa.messages.json +19 -1
- package/locales/de-de/de-de.messages.json +19 -1
- package/locales/es-es/es-es.messages.json +19 -1
- package/locales/fr-fr/fr-fr.messages.json +19 -1
- package/locales/id-id/id-id.messages.json +19 -1
- package/locales/it-it/it-it.messages.json +19 -1
- package/locales/ja-jp/ja-jp.messages.json +19 -1
- package/locales/ko-kr/ko-kr.messages.json +19 -1
- package/locales/pl-pl/pl-pl.messages.json +19 -1
- package/locales/pt-br/pt-br.messages.json +19 -1
- package/locales/ru-ru/ru-ru.messages.json +19 -1
- package/locales/tr-tr/tr-tr.messages.json +19 -1
- package/locales/zh-cn/zh-cn.messages.json +19 -1
- package/locales/zh-tw/zh-tw.messages.json +19 -1
- package/masked-text-box/package.json +4 -0
- package/package.json +21 -1
- package/separator/package.json +4 -0
- package/toolbar/package.json +4 -0
- package/types/nanahoshi-mona-ui-alert.d.ts +144 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +66 -0
- package/types/nanahoshi-mona-ui-badge.d.ts +82 -0
- package/types/nanahoshi-mona-ui-i18n.d.ts +44 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +12 -0
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +18 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +18 -0
- package/types/nanahoshi-mona-ui-masked-text-box.d.ts +391 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +38 -0
- package/types/nanahoshi-mona-ui-separator.d.ts +66 -0
- package/types/nanahoshi-mona-ui-toolbar.d.ts +183 -0
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# Masked Text Box
|
|
2
|
+
|
|
3
|
+
> A text input for values in a fixed format, such as phone numbers, that fills in the format as you type.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/masked-text-box`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-masked-text-box`
|
|
8
|
+
|
|
9
|
+
`MaskedTextBoxComponent` is a text input for values in one fixed format, such as a phone number, a postal code or a product key. Each character goes into a slot of the mask, the mask's own characters, such as the parentheses and dash of `(000) 000-0000`, are filled in as you type, and the rest of the format shows after what's typed. A character a slot doesn't take is turned down, and screen readers say what the slot takes.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use a masked text box when a value always has the same shape, and people copy it from somewhere else: a phone number in one country's format, a postal code, the expiry date on a card, a licence key. The mask shows the shape before they start, and fills in the separators so they only type what matters.
|
|
14
|
+
|
|
15
|
+
**Use a masked text box when you need to:**
|
|
16
|
+
|
|
17
|
+
- Take a value whose length and separators never change
|
|
18
|
+
- Show the format in the field itself, as people type
|
|
19
|
+
- Keep separators out of the value, or put them in, whichever way the user typed them
|
|
20
|
+
|
|
21
|
+
**Use something else when:**
|
|
22
|
+
|
|
23
|
+
- The format varies, such as phone numbers from any country, names or street addresses: use a [text box](textbox.md) with a hint, and check the value with a validator. A mask that doesn't fit someone's real value stops them from entering it at all.
|
|
24
|
+
- The value is a date or a time: use the [date picker](date-picker.md) or the [time picker](time-picker.md), which follow the user's locale and offer a calendar or a list.
|
|
25
|
+
- The value is a number in a range: use the [numeric text box](numeric-textbox.md).
|
|
26
|
+
- The value is a one-time code: use the [OTP input](otp-input.md), which shows a box per character and works with autofill from text messages.
|
|
27
|
+
|
|
28
|
+
## Import & Quick Start
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { MaskedTextBoxComponent } from "@nanahoshi/mona-ui/masked-text-box";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<mona-form-field label="Phone" hint="10 digits, such as (555) 123-4567.">
|
|
36
|
+
<mona-masked-text-box mask="(000) 000-0000" [(value)]="phone" />
|
|
37
|
+
</mona-form-field>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The value holds what's typed into the slots, `5551234567`. Set `includeLiterals` for `(555) 123-4567`.
|
|
41
|
+
|
|
42
|
+
## Anatomy
|
|
43
|
+
|
|
44
|
+
### Mask characters
|
|
45
|
+
|
|
46
|
+
| Character | Takes | Required |
|
|
47
|
+
|-----------|-------|----------|
|
|
48
|
+
| `0` | A digit | Yes |
|
|
49
|
+
| `9` | A digit | No |
|
|
50
|
+
| `#` | A digit, `+` or `-` | No |
|
|
51
|
+
| `L` | A letter | Yes |
|
|
52
|
+
| `?` | A letter | No |
|
|
53
|
+
| `A` | A letter or a digit | Yes |
|
|
54
|
+
| `a` | A letter or a digit | No |
|
|
55
|
+
| `&` | Any character but a space | Yes |
|
|
56
|
+
| `C` | Any character but a space | No |
|
|
57
|
+
|
|
58
|
+
Any other character is a literal, shown as it is and filled in as you type, such as the parentheses, space and dash of `(000) 000-0000`. A backslash makes a mask character a literal: `\#` is a hash sign. In a template that's `mask="\#HHHHHH"`, and in a TypeScript string the backslash needs escaping, `"\\#HHHHHH"`.
|
|
59
|
+
|
|
60
|
+
A letter is a letter of any script. Digits of any script, such as the Arabic-Indic `٣`, and the full-width digits and letters CJK input methods type, are kept as ASCII, so the value is `3`.
|
|
61
|
+
|
|
62
|
+
`rules` adds mask characters of your own, each a pattern one character must match, such as `{ H: /[0-9a-f]/i }` for a hexadecimal digit. A rule can replace a built-in one, and its slots are required.
|
|
63
|
+
|
|
64
|
+
### Parts
|
|
65
|
+
|
|
66
|
+
| Part | What it is |
|
|
67
|
+
|------|------------|
|
|
68
|
+
| Input | The native `<input>`. It holds what's typed and the literals up to it, and takes the id, the name, the description and `aria-invalid`. |
|
|
69
|
+
| The rest of the mask | Muted text after what's typed: the `prompt` character for each empty slot, and the literals between them. It's drawn behind the input and hidden from assistive technology. |
|
|
70
|
+
| Clear button | Shown with `clearButton` while there's a value. |
|
|
71
|
+
| Prefix and suffix | Content from `ng-template monaMaskedTextBoxPrefixTemplate` and `ng-template monaMaskedTextBoxSuffixTemplate`, such as a country code or a unit. |
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
### A phone number
|
|
76
|
+
|
|
77
|
+
The value is the ten digits. `formatMaskedValue` formats a stored value with the same mask, for showing it elsewhere, such as in a table. The `autocomplete` token asks autofill for a number in the national format the mask takes.
|
|
78
|
+
|
|
79
|
+
`phone-example.component.ts`
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { Component, computed, signal } from "@angular/core";
|
|
83
|
+
import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
|
|
84
|
+
import { formatMaskedValue, MaskedTextBoxComponent } from "@nanahoshi/mona-ui/masked-text-box";
|
|
85
|
+
|
|
86
|
+
const PHONE_MASK = "(000) 000-0000";
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: "app-masked-textbox-phone-example",
|
|
90
|
+
imports: [FormFieldComponent, MaskedTextBoxComponent],
|
|
91
|
+
templateUrl: "./phone-example.component.html"
|
|
92
|
+
})
|
|
93
|
+
export class MaskedTextboxPhoneExampleComponent {
|
|
94
|
+
protected readonly mask = PHONE_MASK;
|
|
95
|
+
protected readonly phone = signal("5551234567");
|
|
96
|
+
// Autofill offers a number in the national format the mask takes.
|
|
97
|
+
protected readonly phoneAttributes = { autocomplete: "tel-national" };
|
|
98
|
+
protected readonly shown = computed(() => formatMaskedValue(this.phone(), PHONE_MASK));
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`phone-example.component.html`
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<div class="flex max-w-xs flex-col gap-3">
|
|
106
|
+
<mona-form-field label="Phone" hint="10 digits, such as (555) 123-4567.">
|
|
107
|
+
<mona-masked-text-box
|
|
108
|
+
[mask]="mask"
|
|
109
|
+
[clearButton]="true"
|
|
110
|
+
[inputAttributes]="phoneAttributes"
|
|
111
|
+
[(value)]="phone" />
|
|
112
|
+
</mona-form-field>
|
|
113
|
+
<dl class="grid grid-cols-[auto_1fr] gap-x-3 text-sm">
|
|
114
|
+
<dt class="text-muted-foreground">Value</dt>
|
|
115
|
+
<dd>{{ phone() || "empty" }}</dd>
|
|
116
|
+
<dt class="text-muted-foreground">Formatted</dt>
|
|
117
|
+
<dd>{{ shown() || "empty" }}</dd>
|
|
118
|
+
</dl>
|
|
119
|
+
</div>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Checking the value is complete
|
|
123
|
+
|
|
124
|
+
`isMaskComplete` tells a validator whether every required slot is filled, and the validator can check more, such as that the month is from 01 to 12. Once touched, the box shows as invalid while it's partly filled, and the form field shows the validator's message.
|
|
125
|
+
|
|
126
|
+
`validation-example.component.ts`
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { Component, signal } from "@angular/core";
|
|
130
|
+
import { form, FormField, required, submit, validate } from "@angular/forms/signals";
|
|
131
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
132
|
+
import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
|
|
133
|
+
import { isMaskComplete, MaskedTextBoxComponent } from "@nanahoshi/mona-ui/masked-text-box";
|
|
134
|
+
|
|
135
|
+
const EXPIRY_MASK = "00/00";
|
|
136
|
+
|
|
137
|
+
@Component({
|
|
138
|
+
selector: "app-masked-textbox-validation-example",
|
|
139
|
+
imports: [ButtonDirective, FormField, FormFieldComponent, MaskedTextBoxComponent],
|
|
140
|
+
templateUrl: "./validation-example.component.html"
|
|
141
|
+
})
|
|
142
|
+
export class MaskedTextboxValidationExampleComponent {
|
|
143
|
+
readonly #model = signal({ expiry: "" });
|
|
144
|
+
protected readonly card = form(this.#model, path => {
|
|
145
|
+
required(path.expiry, { message: "Enter the expiry date." });
|
|
146
|
+
validate(path.expiry, ({ value }) => {
|
|
147
|
+
const expiry = value();
|
|
148
|
+
// An empty field is left to required, which has its own message.
|
|
149
|
+
if (expiry === "") {
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
if (!isMaskComplete(expiry, EXPIRY_MASK)) {
|
|
153
|
+
return { kind: "incomplete", message: "Enter the month and the year, such as 08/29." };
|
|
154
|
+
}
|
|
155
|
+
const month = Number(expiry.slice(0, 2));
|
|
156
|
+
return month >= 1 && month <= 12 ? undefined : { kind: "month", message: "Enter a month from 01 to 12." };
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
protected readonly mask = EXPIRY_MASK;
|
|
160
|
+
protected readonly saved = signal(false);
|
|
161
|
+
|
|
162
|
+
protected onSubmit(event: Event): void {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
void submit(this.card, async () => {
|
|
165
|
+
this.saved.set(true);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`validation-example.component.html`
|
|
172
|
+
|
|
173
|
+
```html
|
|
174
|
+
<form class="flex max-w-xs flex-col gap-4" novalidate (submit)="onSubmit($event)">
|
|
175
|
+
<mona-form-field label="Expiry date" hint="Month and year, as on the card.">
|
|
176
|
+
<mona-masked-text-box placeholder="MM/YY" class="w-28" [mask]="mask" [formField]="card.expiry" />
|
|
177
|
+
</mona-form-field>
|
|
178
|
+
<div class="flex items-center gap-3">
|
|
179
|
+
<button monaButton look="primary" type="submit">Save card</button>
|
|
180
|
+
@if (saved()) {
|
|
181
|
+
<span class="text-sm" role="status">Saved.</span>
|
|
182
|
+
}
|
|
183
|
+
</div>
|
|
184
|
+
</form>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### A format of your own
|
|
188
|
+
|
|
189
|
+
A rule for `H` takes a hexadecimal digit, and `\#` puts a literal hash sign first. With `includeLiterals`, the value is a CSS color, which the suffix shows once all six digits are in.
|
|
190
|
+
|
|
191
|
+
`custom-rules-example.component.ts`
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
import { Component, computed, signal } from "@angular/core";
|
|
195
|
+
import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
|
|
196
|
+
import {
|
|
197
|
+
isMaskComplete,
|
|
198
|
+
MaskedTextBoxComponent,
|
|
199
|
+
MaskedTextBoxSuffixTemplateDirective,
|
|
200
|
+
type MaskRules
|
|
201
|
+
} from "@nanahoshi/mona-ui/masked-text-box";
|
|
202
|
+
|
|
203
|
+
// "#" is a mask character, so the backslash makes it the literal the color starts with.
|
|
204
|
+
const COLOR_MASK = "\\#HHHHHH";
|
|
205
|
+
const COLOR_RULES: MaskRules = { H: /[0-9a-f]/i };
|
|
206
|
+
|
|
207
|
+
@Component({
|
|
208
|
+
selector: "app-masked-textbox-custom-rules-example",
|
|
209
|
+
imports: [FormFieldComponent, MaskedTextBoxComponent, MaskedTextBoxSuffixTemplateDirective],
|
|
210
|
+
templateUrl: "./custom-rules-example.component.html"
|
|
211
|
+
})
|
|
212
|
+
export class MaskedTextboxCustomRulesExampleComponent {
|
|
213
|
+
protected readonly color = signal("#7c3aed");
|
|
214
|
+
protected readonly mask = COLOR_MASK;
|
|
215
|
+
protected readonly rules = COLOR_RULES;
|
|
216
|
+
/** The swatch shows the color once all six digits are in. */
|
|
217
|
+
protected readonly swatch = computed(() =>
|
|
218
|
+
isMaskComplete(this.color(), COLOR_MASK, { includeLiterals: true, rules: COLOR_RULES }) ? this.color() : null
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
`custom-rules-example.component.html`
|
|
224
|
+
|
|
225
|
+
```html
|
|
226
|
+
<div class="flex max-w-xs flex-col gap-3">
|
|
227
|
+
<mona-form-field label="Brand color" hint="A hex color: six digits from 0 to 9 and A to F.">
|
|
228
|
+
<mona-masked-text-box class="w-40" [mask]="mask" [rules]="rules" [includeLiterals]="true" [(value)]="color">
|
|
229
|
+
<ng-template monaMaskedTextBoxSuffixTemplate>
|
|
230
|
+
<span
|
|
231
|
+
aria-hidden="true"
|
|
232
|
+
class="me-2 size-5 rounded-sm border border-border forced-color-adjust-none"
|
|
233
|
+
[style.background-color]="swatch()"></span>
|
|
234
|
+
</ng-template>
|
|
235
|
+
</mona-masked-text-box>
|
|
236
|
+
</mona-form-field>
|
|
237
|
+
<p class="text-sm">Value: {{ color() || "empty" }}</p>
|
|
238
|
+
</div>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Appearance & Styling
|
|
242
|
+
|
|
243
|
+
The masked text box has the sizes and corner roundings of the [text box](textbox.md): `size` is `small`, `medium` (default) or `large`, and `rounded` is `none`, `small`, `medium` (default), `large` or `full`.
|
|
244
|
+
|
|
245
|
+
| Input | What it shows |
|
|
246
|
+
|-------|---------------|
|
|
247
|
+
| `prompt` | The character in each empty slot, `_` by default |
|
|
248
|
+
| `placeholder` | Text in place of the mask while the box is empty and doesn't have focus |
|
|
249
|
+
| `clearButton` | A button that empties the value |
|
|
250
|
+
|
|
251
|
+
The rest of the mask is drawn in the muted text color, and in forced colors in the system's gray text color. The field is always left to right, in a right-to-left page too, since phone numbers and codes read that way.
|
|
252
|
+
|
|
253
|
+
`class` is merged onto the box and `inputClass` onto the input, through `tailwind-merge`. The box fills its container, so set a width that fits the mask, such as `class="w-40"`.
|
|
254
|
+
|
|
255
|
+
## Behavior
|
|
256
|
+
|
|
257
|
+
### Typing and deleting
|
|
258
|
+
|
|
259
|
+
- A character goes into the slot at the caret, or the next one after the literals. A character the slot doesn't take is turned down, and a literal typed where the mask has it, such as a space or a dash, moves past it.
|
|
260
|
+
- Typing over a filled slot replaces it. Slots keep their places, so nothing moves along as you type or delete in the middle.
|
|
261
|
+
- Backspace empties the slot before the caret, past any literals, and Delete the slot after it. Deleting a word empties the group of slots between two literals.
|
|
262
|
+
- Pasted text is fitted in from the caret, skipping what doesn't fit, so `555.123.4567` and `555-123-4567` both fill `(000) 000-0000`.
|
|
263
|
+
- Cut copies the selection as it shows, then empties its slots.
|
|
264
|
+
- Undo and redo go through the box's own history, since the browser's would go back to text the box replaced. A run of typing undoes in one step.
|
|
265
|
+
- Text an input method composes, and text autofill writes, are fitted in once they're done.
|
|
266
|
+
- On touch devices, a mask of only digits brings up the number keyboard. An `inputmode` in `inputAttributes` replaces it.
|
|
267
|
+
|
|
268
|
+
### The value
|
|
269
|
+
|
|
270
|
+
- The value is the characters in the slots, up to the last one filled, with a space for an empty slot before it. With `includeLiterals`, it has the literals between them too: `(55 ) 123-4567` once the third digit is deleted. The literals at the end of a mask, such as ` kg` in `000 kg`, come along once its last slot is filled.
|
|
271
|
+
- A value set from outside that lines up with the mask fills the slots in place. One that doesn't, such as `555-123-4567` without `includeLiterals`, is fitted in as a paste would be and written back as it reads.
|
|
272
|
+
- An empty box's value is `""`. ngModel's first `null` reads as empty, and isn't written back.
|
|
273
|
+
- `focus()` puts the caret at the first empty slot.
|
|
274
|
+
|
|
275
|
+
## Forms Integration
|
|
276
|
+
|
|
277
|
+
The masked text box is a signal forms control: bind it with `[formField]`, and the form writes its disabled, read-only, required, invalid and touched states. `ngModel` and `formControl` work too.
|
|
278
|
+
|
|
279
|
+
The box doesn't add errors to the form. Once touched, it shows as invalid while it's partly filled, but a validator has to say so, to stop the form from submitting and to give a message. `isMaskComplete` takes the value, the mask and the box's `includeLiterals` and `rules`:
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
const PHONE_MASK = "(000) 000-0000";
|
|
283
|
+
|
|
284
|
+
protected readonly contact = form(this.#model, path => {
|
|
285
|
+
validate(path.phone, ({ value }) =>
|
|
286
|
+
value() === "" || isMaskComplete(value(), PHONE_MASK)
|
|
287
|
+
? undefined
|
|
288
|
+
: { kind: "mask", message: "Enter all 10 digits." }
|
|
289
|
+
);
|
|
290
|
+
});
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Accessibility
|
|
294
|
+
|
|
295
|
+
- The input is a native text input. Name it with `mona-form-field`, a `mona-label` whose `for` points at it, or `aria-label`.
|
|
296
|
+
- Give the format in a hint, with an example, such as "10 digits, such as (555) 123-4567". The rest of the mask is hidden from assistive technology, so the hint is what tells screen reader users the format, and it helps everyone else too.
|
|
297
|
+
- Screen readers read what's typed and the literals up to it, not the prompts after it. A slot emptied in the middle reads as its prompt character.
|
|
298
|
+
- A character a slot turns down is announced politely with what the slot takes, such as "Only a digit fits here".
|
|
299
|
+
- Once touched, a partly filled box has `aria-invalid="true"`, and so does one the form marks invalid. Pair it with a message: the form field shows the validator's.
|
|
300
|
+
- In forced colors, the rest of the mask is drawn in the system's gray text color and the focus outline stays visible.
|
|
301
|
+
- Use a mask only for a format that really is fixed. One that doesn't fit someone's real value, such as a phone number from another country, leaves them no way to enter it.
|
|
302
|
+
|
|
303
|
+
| Key | Action |
|
|
304
|
+
|-----|--------|
|
|
305
|
+
| A character | Fills the slot at the caret, or is turned down |
|
|
306
|
+
| `Backspace` | Empties the slot before the caret |
|
|
307
|
+
| `Delete` | Empties the slot after the caret |
|
|
308
|
+
| `Ctrl` + `Backspace` / `Option` + `Backspace` | Empties the group of slots before the caret |
|
|
309
|
+
| `Ctrl` + `Z` / `Cmd` + `Z` | Undoes the last edit |
|
|
310
|
+
| `Ctrl` + `Y` / `Cmd` + `Shift` + `Z` | Redoes it |
|
|
311
|
+
|
|
312
|
+
The announcement and the clear button's name are in the `maskedTextBox` messages: `characterNotAllowed`, `clear`, `digitOnly`, `digitOrSignOnly`, `letterOnly` and `letterOrDigitOnly`.
|
|
313
|
+
|
|
314
|
+
## API
|
|
315
|
+
|
|
316
|
+
Everything below is imported from `@nanahoshi/mona-ui/masked-text-box`. Each name links to its reference page, with every input, output, property and method.
|
|
317
|
+
|
|
318
|
+
| Name | Kind | Description |
|
|
319
|
+
| --- | --- | --- |
|
|
320
|
+
| [`MaskedTextBoxComponent`](api/masked-text-box.md#maskedtextboxcomponent) | Component | A text box that takes a value in a fixed format, such as a phone number or a postal code. |
|
|
321
|
+
| [`MaskedTextBoxPrefixTemplateDirective`](api/masked-text-box.md#maskedtextboxprefixtemplatedirective) | Directive | Marks an `<ng-template>` as content before the masked text box's input, such as an icon or a country code. |
|
|
322
|
+
| [`MaskedTextBoxSuffixTemplateDirective`](api/masked-text-box.md#maskedtextboxsuffixtemplatedirective) | Directive | Marks an `<ng-template>` as content after the masked text box's input and its clear button, such as a unit or a button. |
|
|
323
|
+
| [`formatMaskedValue`](api/masked-text-box.md#formatmaskedvalue) | Function | Formats a value for display with its mask's literals, such as `"5551234567"` as `"(555) 123-4567"` for the mask `"(000) 000-0000"`. |
|
|
324
|
+
| [`isMaskComplete`](api/masked-text-box.md#ismaskcomplete) | Function | Whether a value fills every required slot of a mask, for a validator. |
|
|
325
|
+
|
|
326
|
+
### Types
|
|
327
|
+
|
|
328
|
+
| Type | Kind | Description |
|
|
329
|
+
| --- | --- | --- |
|
|
330
|
+
| [`MASKED_TEXT_BOX_DEFAULT_MESSAGES`](api/masked-text-box.md#masked-text-box-default-messages) | Constant | |
|
|
331
|
+
| [`MaskOptions`](api/masked-text-box.md#maskoptions) | Interface | How a value is read against a mask, for `isMaskComplete` and `formatMaskedValue`. |
|
|
332
|
+
| [`MaskRules`](api/masked-text-box.md#maskrules) | Type alias | Mask characters of your own, each mapped to a pattern that one character must match, such as `{ H: /[0-9a-f]/i }` for a hexadecimal digit. |
|
|
333
|
+
|
|
334
|
+
**Related types:** [`AttributeConfig`](api/common.md#attributeconfig), [`MonaMaskedTextBoxMessages`](api/i18n.md#monamaskedtextboxmessages)
|
package/docs/multi-select.md
CHANGED
|
@@ -126,6 +126,63 @@ export class MultiSelectCheckboxesExampleComponent {
|
|
|
126
126
|
</div>
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
### Selecting every option at once
|
|
130
|
+
|
|
131
|
+
`showSelectAll` puts a "Select all" option first in the popup. It selects every enabled option the filter leaves, and once they're all selected, deselects them. Its checkbox shows a dash while only some of them are selected. Options that are disabled keep their state, so Legal here stays out.
|
|
132
|
+
|
|
133
|
+
`select-all-example.component.ts`
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { Component, signal } from "@angular/core";
|
|
137
|
+
import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
138
|
+
import { FormFieldComponent } from "@nanahoshi/mona-ui/form-field";
|
|
139
|
+
import { MultiSelectComponent } from "@nanahoshi/mona-ui/multi-select";
|
|
140
|
+
|
|
141
|
+
interface Team {
|
|
142
|
+
readonly archived?: boolean;
|
|
143
|
+
readonly id: string;
|
|
144
|
+
readonly name: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@Component({
|
|
148
|
+
selector: "app-multi-select-select-all-example",
|
|
149
|
+
imports: [DropdownFilterableDirective, FormFieldComponent, MultiSelectComponent],
|
|
150
|
+
templateUrl: "./select-all-example.component.html"
|
|
151
|
+
})
|
|
152
|
+
export class MultiSelectSelectAllExampleComponent {
|
|
153
|
+
protected readonly notified = signal<string[]>(["design"]);
|
|
154
|
+
protected readonly teams: readonly Team[] = [
|
|
155
|
+
{ id: "design", name: "Design" },
|
|
156
|
+
{ id: "engineering", name: "Engineering" },
|
|
157
|
+
{ id: "finance", name: "Finance" },
|
|
158
|
+
{ archived: true, id: "legal", name: "Legal" },
|
|
159
|
+
{ id: "marketing", name: "Marketing" },
|
|
160
|
+
{ id: "sales", name: "Sales" },
|
|
161
|
+
{ id: "support", name: "Support" }
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`select-all-example.component.html`
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<div class="flex max-w-sm flex-col gap-2">
|
|
170
|
+
<mona-form-field label="Notify" hint="Legal is archived and can't be notified.">
|
|
171
|
+
<mona-multi-select
|
|
172
|
+
monaDropDownFilterable
|
|
173
|
+
textField="name"
|
|
174
|
+
valueField="id"
|
|
175
|
+
itemDisabled="archived"
|
|
176
|
+
[valuePrimitive]="true"
|
|
177
|
+
[checkboxes]="true"
|
|
178
|
+
[showSelectAll]="true"
|
|
179
|
+
[data]="teams"
|
|
180
|
+
[(value)]="notified" />
|
|
181
|
+
</mona-form-field>
|
|
182
|
+
<span aria-live="polite" class="text-sm">{{ notified().length }} of {{ teams.length }} teams</span>
|
|
183
|
+
</div>
|
|
184
|
+
```
|
|
185
|
+
|
|
129
186
|
### Collapsing tags into a summary
|
|
130
187
|
|
|
131
188
|
Apply `monaMultiSelectSummaryTag` to collapse tags beyond `tagCount` into a single summary chip (default text: "+N items"). A negative `tagCount` (the default) shows every selected item as its own tag and never renders the summary chip. `monaMultiSelectSummaryTagTemplate` replaces the summary chip's text.
|
|
@@ -285,6 +342,55 @@ export class MultiSelectFormsExampleComponent {
|
|
|
285
342
|
</div>
|
|
286
343
|
```
|
|
287
344
|
|
|
345
|
+
### Adding values that aren't listed
|
|
346
|
+
|
|
347
|
+
With `allowCustomValue` and `monaDropDownFilterable`, the popup's filter box doubles as a tag input. Enter on text that no option matches emits `valueAdd` with the trimmed text: add it to `data` and to `value`, and it shows as a tag. Text that names an option, in any case, selects that option instead. Either way the filter box is cleared for the next one. Say how it works near the field, as the hint here does, since nothing in the popup does.
|
|
348
|
+
|
|
349
|
+
`custom-values-example.component.ts`
|
|
350
|
+
|
|
351
|
+
```typescript
|
|
352
|
+
import { Component, signal } from "@angular/core";
|
|
353
|
+
import { DropdownFilterableDirective } from "@nanahoshi/mona-ui/dropdowns";
|
|
354
|
+
import { LabelDirective } from "@nanahoshi/mona-ui/label";
|
|
355
|
+
import { MultiSelectComponent } from "@nanahoshi/mona-ui/multi-select";
|
|
356
|
+
|
|
357
|
+
@Component({
|
|
358
|
+
selector: "app-multi-select-custom-values-example",
|
|
359
|
+
imports: [DropdownFilterableDirective, LabelDirective, MultiSelectComponent],
|
|
360
|
+
templateUrl: "./custom-values-example.component.html"
|
|
361
|
+
})
|
|
362
|
+
export class MultiSelectCustomValuesExampleComponent {
|
|
363
|
+
protected readonly skills = signal(["Angular", "CSS", "Go", "Rust", "TypeScript"]);
|
|
364
|
+
protected readonly value = signal<string[]>(["Angular", "TypeScript"]);
|
|
365
|
+
|
|
366
|
+
protected add(skill: string): void {
|
|
367
|
+
this.skills.update(skills => [...skills, skill]);
|
|
368
|
+
this.value.update(value => [...value, skill]);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
`custom-values-example.component.html`
|
|
374
|
+
|
|
375
|
+
```html
|
|
376
|
+
<div class="flex max-w-sm flex-col gap-1">
|
|
377
|
+
<label id="multi-select-custom-label" monaLabel [for]="skillList">Skills</label>
|
|
378
|
+
<mona-multi-select
|
|
379
|
+
#skillList
|
|
380
|
+
aria-labelledby="multi-select-custom-label"
|
|
381
|
+
aria-describedby="multi-select-custom-hint"
|
|
382
|
+
filterPlaceholder="Find or add a skill"
|
|
383
|
+
monaDropDownFilterable
|
|
384
|
+
[allowCustomValue]="true"
|
|
385
|
+
[data]="skills()"
|
|
386
|
+
[(value)]="value"
|
|
387
|
+
(valueAdd)="add($event)" />
|
|
388
|
+
<span id="multi-select-custom-hint" class="text-sm text-muted-foreground">
|
|
389
|
+
Type a skill that isn't listed and press Enter to add it.
|
|
390
|
+
</span>
|
|
391
|
+
</div>
|
|
392
|
+
```
|
|
393
|
+
|
|
288
394
|
### Closing the popup after each selection
|
|
289
395
|
|
|
290
396
|
Set `autoClose` to `true` to close the popup after each selection instead of keeping it open.
|
|
@@ -342,6 +448,17 @@ Set `autoClose` to `true` to close the popup after each selection instead of kee
|
|
|
342
448
|
|
|
343
449
|
`placeholder` shows while nothing is selected. It also names the control when neither `aria-label` nor `aria-labelledby` is set.
|
|
344
450
|
|
|
451
|
+
### Enter in the filter box
|
|
452
|
+
|
|
453
|
+
With nothing highlighted, such as when the filter matches no option, Enter in the filter box does nothing, and leaves the selection as it is. With `allowCustomValue`, it adds the typed text, unless an option was reached with the arrow keys since the text last changed: then it toggles that option, as it would without custom values. `allowCustomValue` without `monaDropDownFilterable` has nowhere to type, and warns in development.
|
|
454
|
+
|
|
455
|
+
### Select all
|
|
456
|
+
|
|
457
|
+
- "Select all" covers the options the filter leaves, so filtering and then choosing it adds only those, and keeps the options already selected. Choosing it again, once all of those are selected, deselects only those.
|
|
458
|
+
- It has a checkbox whether or not `checkboxes` is set, and it reads as selected once every option it covers is selected.
|
|
459
|
+
- It's left out while the filter leaves no enabled option, and with `autoClose` the popup closes after it as after any option.
|
|
460
|
+
- It counts among the options, in the position screen readers announce. Its text is the multi-select's `selectAll` message.
|
|
461
|
+
|
|
345
462
|
### `showClearButton` clears every selection
|
|
346
463
|
|
|
347
464
|
`showClearButton` renders a single clear button that removes all selected items at once, not one at a time.
|
|
@@ -369,10 +486,13 @@ Set `autoClose` to `true` to close the popup after each selection instead of kee
|
|
|
369
486
|
| `Alt+ArrowDown` | Open the popup. |
|
|
370
487
|
| `Alt+ArrowUp` | Close the popup. |
|
|
371
488
|
| `Enter` | Open the popup when closed. When open, toggles the highlighted option's selected state; closes the popup afterward only if `autoClose` is `true`. |
|
|
489
|
+
| `Enter` in the filter box | Toggles the option highlighted with the arrow keys. With `allowCustomValue`, adds the typed text instead, or selects the option it names. |
|
|
372
490
|
| `Space` | Toggle the popup open or closed. |
|
|
373
491
|
| `Backspace` | Remove the most recently selected tag. |
|
|
374
492
|
| `Escape` / `Tab` | Close the popup. |
|
|
375
493
|
|
|
494
|
+
With `showSelectAll`, "Select all" is the first option in the list, so the arrow keys reach it as they reach any other, wrapping included. `Enter` on it selects or deselects the options it covers.
|
|
495
|
+
|
|
376
496
|
### Focus
|
|
377
497
|
|
|
378
498
|
The host element is the only Tab stop; DOM focus does not move into the popup's option list, and tags are not individually focusable (`tabindex="-1"` on each chip). Arrow-key navigation moves an internal highlighted-option pointer, reflected through `aria-activedescendant` on the host element, instead.
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Separator
|
|
2
|
+
|
|
3
|
+
> A thin line between groups of content, across or down, with an optional label.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/separator`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-separator`
|
|
8
|
+
|
|
9
|
+
`SeparatorComponent` draws a thin line between groups of content, across a column or down a row, with an optional label such as "or" in its middle. Like an `<hr>`, it's a separator for assistive technology unless it's marked decorative.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use a separator to divide content that belongs together from content that doesn't: the header of a panel from its body, or two ways to sign in. In a row, a vertical one divides items such as a date and a reading time.
|
|
14
|
+
|
|
15
|
+
**Use a separator when you need to:**
|
|
16
|
+
|
|
17
|
+
- Divide a panel, a card or a form into parts without a heading for each
|
|
18
|
+
- Offer two alternatives, with "or" between them
|
|
19
|
+
- Separate items in a row of metadata or links
|
|
20
|
+
|
|
21
|
+
**Use something else when:**
|
|
22
|
+
|
|
23
|
+
- The parts deserve names: use headings, which also help people navigate
|
|
24
|
+
- The line divides items in a menu: menus have their own separator items, such as `mona-dropdown-button-separator`
|
|
25
|
+
- The groups are in a toolbar: a separator works there too, and a toolbar item moves it into its More menu with the items around it
|
|
26
|
+
|
|
27
|
+
## Import & Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { SeparatorComponent } from "@nanahoshi/mona-ui/separator";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<mona-separator class="my-4" />
|
|
35
|
+
<mona-separator label="or" />
|
|
36
|
+
<mona-separator orientation="vertical" />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Two ways to sign in
|
|
42
|
+
|
|
43
|
+
A labelled separator reads its label as text, "or", and the lines around it stay out of the way.
|
|
44
|
+
|
|
45
|
+
`sign-in-example.component.ts`
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { Component } from "@angular/core";
|
|
49
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
50
|
+
import { SeparatorComponent } from "@nanahoshi/mona-ui/separator";
|
|
51
|
+
import { TextBoxDirective } from "@nanahoshi/mona-ui/text-box";
|
|
52
|
+
|
|
53
|
+
@Component({
|
|
54
|
+
selector: "app-separator-sign-in-example",
|
|
55
|
+
imports: [ButtonDirective, SeparatorComponent, TextBoxDirective],
|
|
56
|
+
templateUrl: "./sign-in-example.component.html"
|
|
57
|
+
})
|
|
58
|
+
export class SeparatorSignInExampleComponent {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`sign-in-example.component.html`
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<section aria-labelledby="sign-in-heading" class="flex max-w-xs flex-col gap-4 rounded-lg border border-border p-6">
|
|
65
|
+
<h3 id="sign-in-heading" class="text-base font-semibold">Sign in</h3>
|
|
66
|
+
<button monaButton type="button" class="w-full">Continue with a passkey</button>
|
|
67
|
+
<mona-separator label="or" />
|
|
68
|
+
<label class="flex flex-col gap-1 text-sm font-medium">
|
|
69
|
+
Email
|
|
70
|
+
<input monaTextBox type="email" autocomplete="email" />
|
|
71
|
+
</label>
|
|
72
|
+
<button monaButton type="button" look="primary" class="w-full">Email me a link</button>
|
|
73
|
+
</section>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Across and down
|
|
77
|
+
|
|
78
|
+
The horizontal separator between the heading and the details is announced, since it marks where the details start. The vertical ones only space out items that already read apart, so they're `decorative`.
|
|
79
|
+
|
|
80
|
+
`inline-example.component.ts`
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { Component } from "@angular/core";
|
|
84
|
+
import { SeparatorComponent } from "@nanahoshi/mona-ui/separator";
|
|
85
|
+
|
|
86
|
+
@Component({
|
|
87
|
+
selector: "app-separator-inline-example",
|
|
88
|
+
imports: [SeparatorComponent],
|
|
89
|
+
templateUrl: "./inline-example.component.html"
|
|
90
|
+
})
|
|
91
|
+
export class SeparatorInlineExampleComponent {}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`inline-example.component.html`
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<article class="flex max-w-md flex-col gap-3">
|
|
98
|
+
<div>
|
|
99
|
+
<h3 class="text-base font-semibold">Release notes</h3>
|
|
100
|
+
<p class="text-sm text-muted-foreground">What changed in version 4.2.</p>
|
|
101
|
+
</div>
|
|
102
|
+
<mona-separator />
|
|
103
|
+
<div class="flex h-5 items-center gap-3 text-sm">
|
|
104
|
+
<span>18 November</span>
|
|
105
|
+
<mona-separator orientation="vertical" [decorative]="true" />
|
|
106
|
+
<span>5 min read</span>
|
|
107
|
+
<mona-separator orientation="vertical" [decorative]="true" />
|
|
108
|
+
<span>Platform team</span>
|
|
109
|
+
</div>
|
|
110
|
+
</article>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Appearance & Styling
|
|
114
|
+
|
|
115
|
+
| `orientation` | Line | Size |
|
|
116
|
+
|---------------|------|------|
|
|
117
|
+
| `horizontal` (default) | Across its container | 1px tall, full width |
|
|
118
|
+
| `vertical` | Down its row | 1px wide, the row's height. Give the row a height, or items that set one. |
|
|
119
|
+
|
|
120
|
+
The line is drawn in the theme's border color. A labelled separator is always horizontal, with the label in small muted text between two lines.
|
|
121
|
+
|
|
122
|
+
The separator has no margin of its own. Add one with `class`, such as `class="my-4"`, which is merged with its own classes through `tailwind-merge`; `class="bg-primary"` recolors the line.
|
|
123
|
+
|
|
124
|
+
In forced colors, where backgrounds don't paint, the line takes the text color.
|
|
125
|
+
|
|
126
|
+
## Accessibility
|
|
127
|
+
|
|
128
|
+
| Separator | Role | Notes |
|
|
129
|
+
|-----------|------|-------|
|
|
130
|
+
| Horizontal | `separator` | Horizontal is the role's default, so it has no `aria-orientation` |
|
|
131
|
+
| Vertical | `separator` | With `aria-orientation="vertical"` |
|
|
132
|
+
| `decorative` | None | Skipped by assistive technology |
|
|
133
|
+
| With a `label` | None | The label is read as text; a separator's role would hide it |
|
|
134
|
+
|
|
135
|
+
Mark a separator `decorative` when it repeats a boundary the content already makes, such as between cards with their own borders, or between items that a screen reader reads apart anyway. A separator isn't focusable and has no keyboard interaction.
|
|
136
|
+
|
|
137
|
+
## API
|
|
138
|
+
|
|
139
|
+
Everything below is imported from `@nanahoshi/mona-ui/separator`. Each name links to its reference page, with every input, output, property and method.
|
|
140
|
+
|
|
141
|
+
| Name | Kind | Description |
|
|
142
|
+
| --- | --- | --- |
|
|
143
|
+
| [`SeparatorComponent`](api/separator.md#separatorcomponent) | Component | A thin line between groups of content, across a column or down a row, with an optional label in its middle. |
|
|
144
|
+
|
|
145
|
+
### Types
|
|
146
|
+
|
|
147
|
+
**Related types:** [`ClassInputType`](api/common.md#classinputtype)
|
package/docs/sidebar-menus.md
CHANGED
|
@@ -23,7 +23,7 @@ A sidebar's content is groups of rows. Every part below is a directive on your o
|
|
|
23
23
|
| `[monaSidebarMenuItem]` | `li` | One row; owns the highlight and `active` |
|
|
24
24
|
| `[monaSidebarMenuButton]` | `a` / `button` | The row's control; takes `tooltip`, `size`, `disabled`, `closeOnSelect` |
|
|
25
25
|
| `[monaSidebarMenuAction]` | `button` | A trailing control inside the row; needs an `aria-label` |
|
|
26
|
-
| `[monaSidebarMenuBadge]` | any | A trailing count or status; stands down on the rail |
|
|
26
|
+
| `[monaSidebarMenuBadge]` | any | A trailing count or status, shaped like a [Badge](badge.md); stands down on the rail |
|
|
27
27
|
| `[monaSidebarMenuSub]` | `ul` | An indented submenu inside a collapsible item |
|
|
28
28
|
| `[monaSidebarInput]` | `input` | A text input sized for the sidebar; stands down on the rail |
|
|
29
29
|
| `mona-sidebar-menu-skeleton` | element | A loading placeholder row |
|