@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
package/docs/alert.md
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
> A message that stays on the page, tinted for what it means, with optional actions and dismissal.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/alert`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-alert`
|
|
8
|
+
|
|
9
|
+
`AlertComponent` shows a message that stays on the page, such as a failed payment above a form or a maintenance notice above a dashboard, tinted and marked with an icon for what it means, with an optional title, actions and dismiss button.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use an alert for a message that belongs to a place on the page and stays there until it's no longer true or someone dismisses it. It can be part of the page from the start, such as a notice, or appear because of something the user did, such as a save that failed.
|
|
14
|
+
|
|
15
|
+
**Use an alert when you need to:**
|
|
16
|
+
|
|
17
|
+
- Explain why a form didn't submit, with a way to try again
|
|
18
|
+
- Warn about something that affects the page, such as a plan running out of storage
|
|
19
|
+
- Confirm that a long task finished, where the result is shown
|
|
20
|
+
|
|
21
|
+
**Use something else when:**
|
|
22
|
+
|
|
23
|
+
- The message is brief and not tied to a place: use a [Notification](notification.md), which comes and goes on its own
|
|
24
|
+
- The user has to decide before carrying on: use a [Dialog](dialog.md)
|
|
25
|
+
- The message is about one field: use the [Form Field](form-field.md)'s error, next to the field
|
|
26
|
+
- It's a short status beside something: use a [Badge](badge.md)
|
|
27
|
+
|
|
28
|
+
## Import & Quick Start
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { AlertComponent } from "@nanahoshi/mona-ui/alert";
|
|
32
|
+
// Only for a row of buttons below the text:
|
|
33
|
+
import { AlertActionsDirective } from "@nanahoshi/mona-ui/alert";
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<mona-alert look="warning" title="Storage almost full">
|
|
38
|
+
You've used 92% of your plan.
|
|
39
|
+
</mona-alert>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Anatomy
|
|
43
|
+
|
|
44
|
+
| Part | How to set it |
|
|
45
|
+
|------|---------------|
|
|
46
|
+
| Icon | Set by `look`. Replace it with `<ng-template monaAlertIconTemplate>`, or leave it out with `[showIcon]="false"`. |
|
|
47
|
+
| Title | `title`, in bold above the text. |
|
|
48
|
+
| Text | The alert's content. |
|
|
49
|
+
| Actions | An element marked `monaAlertActions`, such as a `div` of buttons. It's placed below the text, wherever it is in the content. |
|
|
50
|
+
| Dismiss button | `dismissible`, in the corner. It emits `dismiss`. |
|
|
51
|
+
|
|
52
|
+
## Examples
|
|
53
|
+
|
|
54
|
+
### Looks
|
|
55
|
+
|
|
56
|
+
`looks-example.component.ts`
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { Component } from "@angular/core";
|
|
60
|
+
import { AlertComponent } from "@nanahoshi/mona-ui/alert";
|
|
61
|
+
|
|
62
|
+
@Component({
|
|
63
|
+
selector: "app-alert-looks-example",
|
|
64
|
+
imports: [AlertComponent],
|
|
65
|
+
templateUrl: "./looks-example.component.html"
|
|
66
|
+
})
|
|
67
|
+
export class AlertLooksExampleComponent {}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`looks-example.component.html`
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<div class="flex max-w-xl flex-col gap-3">
|
|
74
|
+
<mona-alert look="info" title="Scheduled maintenance">
|
|
75
|
+
The dashboard is read-only on Sunday from 02:00 to 04:00 UTC.
|
|
76
|
+
</mona-alert>
|
|
77
|
+
<mona-alert look="success" title="Backup complete">All 1,204 files were copied to the archive.</mona-alert>
|
|
78
|
+
<mona-alert look="warning" title="Storage almost full">
|
|
79
|
+
You've used 92% of your plan. Older builds are deleted first when it runs out.
|
|
80
|
+
</mona-alert>
|
|
81
|
+
<mona-alert look="error" title="Payment failed">Your card was declined. Update it to keep your plan.</mona-alert>
|
|
82
|
+
<mona-alert look="neutral">Prices exclude VAT, which is added at checkout.</mona-alert>
|
|
83
|
+
</div>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### A form that failed to save
|
|
87
|
+
|
|
88
|
+
The alert appears when saving fails, and `announce="assertive"` reads its title and text at once, so a screen reader user hears why nothing changed. Both its buttons go away with it, so each one moves focus to the Save button first: Try again before it hides the alert, and the dismiss handler after.
|
|
89
|
+
|
|
90
|
+
`form-error-example.component.ts`
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
import { Component, type ElementRef, signal, viewChild } from "@angular/core";
|
|
94
|
+
import { AlertActionsDirective, AlertComponent } from "@nanahoshi/mona-ui/alert";
|
|
95
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
96
|
+
import { TextBoxDirective } from "@nanahoshi/mona-ui/text-box";
|
|
97
|
+
|
|
98
|
+
@Component({
|
|
99
|
+
selector: "app-alert-form-error-example",
|
|
100
|
+
imports: [AlertActionsDirective, AlertComponent, ButtonDirective, TextBoxDirective],
|
|
101
|
+
templateUrl: "./form-error-example.component.html"
|
|
102
|
+
})
|
|
103
|
+
export class AlertFormErrorExampleComponent {
|
|
104
|
+
protected readonly failed = signal(false);
|
|
105
|
+
protected readonly saveButton = viewChild.required<ElementRef<HTMLButtonElement>>("saveButton");
|
|
106
|
+
protected readonly saving = signal(false);
|
|
107
|
+
|
|
108
|
+
protected dismiss(): void {
|
|
109
|
+
this.failed.set(false);
|
|
110
|
+
// The dismiss button goes with the alert, so focus moves to where the user carries on.
|
|
111
|
+
this.saveButton().nativeElement.focus();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
protected retry(): void {
|
|
115
|
+
// The alert, and the button that was pressed, go away while it saves again.
|
|
116
|
+
this.saveButton().nativeElement.focus();
|
|
117
|
+
this.save();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
protected submit(event: Event): void {
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
this.save();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private save(): void {
|
|
126
|
+
this.failed.set(false);
|
|
127
|
+
this.saving.set(true);
|
|
128
|
+
// Stands in for a request that fails.
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
this.saving.set(false);
|
|
131
|
+
this.failed.set(true);
|
|
132
|
+
}, 800);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`form-error-example.component.html`
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<form class="flex max-w-md flex-col gap-4" (submit)="submit($event)">
|
|
141
|
+
@if (failed()) {
|
|
142
|
+
<mona-alert
|
|
143
|
+
look="error"
|
|
144
|
+
title="Changes not saved"
|
|
145
|
+
announce="assertive"
|
|
146
|
+
[dismissible]="true"
|
|
147
|
+
(dismiss)="dismiss()">
|
|
148
|
+
The server didn't respond. Your changes are still here.
|
|
149
|
+
<div monaAlertActions>
|
|
150
|
+
<button monaButton type="button" size="small" look="error" (click)="retry()">Try again</button>
|
|
151
|
+
</div>
|
|
152
|
+
</mona-alert>
|
|
153
|
+
}
|
|
154
|
+
<label class="flex flex-col gap-1 text-sm font-medium">
|
|
155
|
+
Display name
|
|
156
|
+
<input monaTextBox type="text" value="Jane Smith" />
|
|
157
|
+
</label>
|
|
158
|
+
<div>
|
|
159
|
+
<button #saveButton monaButton type="submit" look="primary" [loading]="saving()">Save</button>
|
|
160
|
+
</div>
|
|
161
|
+
</form>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Appearance & Styling
|
|
165
|
+
|
|
166
|
+
| `look` | Means | Icon |
|
|
167
|
+
|-----------|-----------------------------------------|----------------|
|
|
168
|
+
| `info` | Something to know (default) | Info |
|
|
169
|
+
| `success` | Something finished as hoped | Circle check |
|
|
170
|
+
| `warning` | Something may go wrong | Triangle alert |
|
|
171
|
+
| `error` | Something went wrong | Circle X |
|
|
172
|
+
| `neutral` | A note with no urgency | Info |
|
|
173
|
+
|
|
174
|
+
Each look uses the theme's subtle tint, the text color paired with it at 4.5:1 or more, and a border at 3:1 or more against the tint. The alert fills its container's width; set a `max-w-*` class on it, or on its container, to keep lines short.
|
|
175
|
+
|
|
176
|
+
Classes passed via `class` are merged with the alert's own through `tailwind-merge`, so `class="p-3"` replaces its padding.
|
|
177
|
+
|
|
178
|
+
## Behavior
|
|
179
|
+
|
|
180
|
+
### Announcing
|
|
181
|
+
|
|
182
|
+
`announce` reads the title and text aloud once, after the alert first renders: `assertive` interrupts what's being read, and `polite` waits. The actions aren't read. Use it for an alert that appears because of something the user did. An alert that's part of the page when it loads shouldn't announce itself, and keeps the default, `off`. Changing the text later isn't announced; show a new alert, or announce the change yourself.
|
|
183
|
+
|
|
184
|
+
### Dismissing
|
|
185
|
+
|
|
186
|
+
`dismissible` adds a dismiss button that emits `dismiss`. The alert doesn't hide itself: remove it in your handler, for example with `@if`, and decide whether it stays dismissed.
|
|
187
|
+
|
|
188
|
+
## Accessibility
|
|
189
|
+
|
|
190
|
+
The alert adds no role. It reads in place, as part of the page, and `announce` is what makes a new one heard, through a live region the page already has, which screen readers announce more reliably than one that appears with its content.
|
|
191
|
+
|
|
192
|
+
- **Say what it means in words.** The tint and the icon back the text up; the icon is hidden from assistive technology. A title such as "Payment failed" does this well.
|
|
193
|
+
- **Move focus when it goes.** The dismiss button, and any action that hides the alert, are removed with it, and focus would fall back to the top of the page. Move it to where the user carries on, as the form example does.
|
|
194
|
+
- **Name the dismiss button.** It's named "Dismiss" followed by the title, such as "Dismiss, Payment failed", in the current locale. `dismissLabel` replaces "Dismiss".
|
|
195
|
+
- **Keep headings out.** The title isn't a heading, so it doesn't add to the page outline. Put a heading in the content if the alert starts a section.
|
|
196
|
+
|
|
197
|
+
| Key | Action |
|
|
198
|
+
|-----|--------|
|
|
199
|
+
| `Tab` | Reaches the actions and the dismiss button, in that order |
|
|
200
|
+
| `Enter`, `Space` | Activates the focused button |
|
|
201
|
+
|
|
202
|
+
## API
|
|
203
|
+
|
|
204
|
+
Everything below is imported from `@nanahoshi/mona-ui/alert`. Each name links to its reference page, with every input, output, property and method.
|
|
205
|
+
|
|
206
|
+
| Name | Kind | Description |
|
|
207
|
+
| --- | --- | --- |
|
|
208
|
+
| [`AlertComponent`](api/alert.md#alertcomponent) | Component | A message that stays on the page, such as a failed payment above a form or a notice above a table, tinted by what it means and marked with an icon. |
|
|
209
|
+
| [`AlertActionsDirective`](api/alert.md#alertactionsdirective) | Directive | Marks an element inside `<mona-alert>` as its row of actions, such as a Retry button. |
|
|
210
|
+
| [`AlertIconTemplateDirective`](api/alert.md#alerticontemplatedirective) | Directive | Apply to an `<ng-template>` directly inside `<mona-alert>` to draw the alert's icon in place of the one its look shows. |
|
|
211
|
+
|
|
212
|
+
### Types
|
|
213
|
+
|
|
214
|
+
| Type | Kind | Description |
|
|
215
|
+
| --- | --- | --- |
|
|
216
|
+
| [`ALERT_DEFAULT_MESSAGES`](api/alert.md#alert-default-messages) | Constant | |
|
|
217
|
+
| [`AlertAnnouncement`](api/alert.md#alertannouncement) | Type alias | How an alert is read aloud when it's shown: not at all, after what's being read, or at once. |
|
|
218
|
+
|
|
219
|
+
**Related types:** [`ClassInputType`](api/common.md#classinputtype), [`MonaAlertMessages`](api/i18n.md#monaalertmessages)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# `@nanahoshi/mona-ui/alert`
|
|
2
|
+
|
|
3
|
+
Everything `@nanahoshi/mona-ui/alert` exports.
|
|
4
|
+
|
|
5
|
+
**Guides:** [Alert](../alert.md)
|
|
6
|
+
|
|
7
|
+
## `AlertComponent`
|
|
8
|
+
|
|
9
|
+
Component.
|
|
10
|
+
|
|
11
|
+
A message that stays on the page, such as a failed payment above a form or a notice above a table, tinted by what it
|
|
12
|
+
means and marked with an icon. It can have a title, actions and a dismiss button, and it can be announced when it's
|
|
13
|
+
shown.
|
|
14
|
+
|
|
15
|
+
**Selector:** `mona-alert`
|
|
16
|
+
|
|
17
|
+
### Inputs
|
|
18
|
+
|
|
19
|
+
| Name | Type | Default | Description |
|
|
20
|
+
| --- | --- | --- | --- |
|
|
21
|
+
| `announce` | `AlertAnnouncement` | `"off"` | Reads the alert's title and text aloud once, when the alert is shown. Use it for an alert that appears because of something the user did, such as a failed save: `assertive` interrupts, for something that needs attention now, and `polite` waits for a pause. Leave it `off` for an alert that's part of the page when it loads. |
|
|
22
|
+
| `class` | `ClassInputType` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
23
|
+
| `dismissible` | `boolean` | `false` | Shows a button in the alert's corner that emits `dismiss`. |
|
|
24
|
+
| `dismissLabel` | `string` | `""` | Name of the dismiss button, in place of the localized "Dismiss", followed by the title when there is one. |
|
|
25
|
+
| `look` | `"error" \| "info" \| "neutral" \| "success" \| "warning"` | `"info"` | What the alert means, which sets its tint, border and icon. Say it in the text too, since color and shape alone don't reach everyone. |
|
|
26
|
+
| `showIcon` | `boolean` | `true` | Shows the look's icon before the text. A `monaAlertIconTemplate` replaces the icon. |
|
|
27
|
+
| `title` | `string` | `""` | A short heading above the text, in bold. It also names the dismiss button. |
|
|
28
|
+
|
|
29
|
+
### Outputs
|
|
30
|
+
|
|
31
|
+
| Name | Type | Description |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| `dismiss` | `Event` | Emitted when the dismiss button is activated, with the click event. The alert doesn't hide itself: remove it in your handler, and move focus to where the user can carry on, since the button goes with it. |
|
|
34
|
+
|
|
35
|
+
## `AlertActionsDirective`
|
|
36
|
+
|
|
37
|
+
Directive.
|
|
38
|
+
|
|
39
|
+
Marks an element inside `<mona-alert>` as its row of actions, such as a Retry button. The alert places it
|
|
40
|
+
below its text, and it lays out its buttons in a wrapping row.
|
|
41
|
+
|
|
42
|
+
**Selector:** `[monaAlertActions]`
|
|
43
|
+
|
|
44
|
+
### Inputs
|
|
45
|
+
|
|
46
|
+
| Name | Type | Default | Description |
|
|
47
|
+
| --- | --- | --- | --- |
|
|
48
|
+
| `class` | `ClassInputType` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
49
|
+
|
|
50
|
+
## `AlertIconTemplateDirective`
|
|
51
|
+
|
|
52
|
+
Directive.
|
|
53
|
+
|
|
54
|
+
Apply to an `<ng-template>` directly inside `<mona-alert>` to draw the alert's icon in place of the one
|
|
55
|
+
its look shows. The template receives no context, and what it renders is hidden from assistive technology, like the
|
|
56
|
+
default icon.
|
|
57
|
+
|
|
58
|
+
**Selector:** `ng-template[monaAlertIconTemplate]`
|
|
59
|
+
|
|
60
|
+
## `ALERT_DEFAULT_MESSAGES`
|
|
61
|
+
|
|
62
|
+
Constant.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const ALERT_DEFAULT_MESSAGES: MonaAlertMessages;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## `AlertAnnouncement`
|
|
69
|
+
|
|
70
|
+
Type alias.
|
|
71
|
+
|
|
72
|
+
How an alert is read aloud when it's shown: not at all, after what's being read, or at once.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
type AlertAnnouncement = "assertive" | "off" | "polite";
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Used by:** [`AlertComponent`](alert.md#alertcomponent)
|
package/docs/api/avatar.md
CHANGED
|
@@ -29,3 +29,28 @@ Component.
|
|
|
29
29
|
| `labelFontSize` | `string` | `"1rem"` | Font size of the label text. Ignored in image mode. |
|
|
30
30
|
| `labelFontWeight` | `string` | `"700"` | Font weight of the label text. Ignored in image mode. |
|
|
31
31
|
| `width` | `string \| number` | `"64px"` | Width of the host element. A string is used as-is; a number is converted to `px`. |
|
|
32
|
+
|
|
33
|
+
## `AvatarGroupComponent`
|
|
34
|
+
|
|
35
|
+
Component.
|
|
36
|
+
|
|
37
|
+
Stacks `mona-avatar`s in an overlapping row, such as the members of a project. Past `max`, the rest collapse into one
|
|
38
|
+
item that counts them, as in "+3".
|
|
39
|
+
|
|
40
|
+
**Selector:** `mona-avatar-group`
|
|
41
|
+
|
|
42
|
+
### Inputs
|
|
43
|
+
|
|
44
|
+
| Name | Type | Default | Description |
|
|
45
|
+
| --- | --- | --- | --- |
|
|
46
|
+
| `aria-label` | `string` | `""` | Accessible name of the group, such as "Project members". The group is read as one, with each avatar's name inside it. |
|
|
47
|
+
| `class` | `ClassInputType` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
48
|
+
| `max` | `string \| number \| null \| undefined` | `null` | How many avatars to show. The rest collapse into one item that counts them, named such as "3 more". Without it, every avatar shows. |
|
|
49
|
+
|
|
50
|
+
## `AVATAR_DEFAULT_MESSAGES`
|
|
51
|
+
|
|
52
|
+
Constant.
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
const AVATAR_DEFAULT_MESSAGES: MonaAvatarMessages;
|
|
56
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# `@nanahoshi/mona-ui/badge`
|
|
2
|
+
|
|
3
|
+
Everything `@nanahoshi/mona-ui/badge` exports.
|
|
4
|
+
|
|
5
|
+
**Guides:** [Badge](../badge.md)
|
|
6
|
+
|
|
7
|
+
## `BadgeDirective`
|
|
8
|
+
|
|
9
|
+
Directive.
|
|
10
|
+
|
|
11
|
+
A short count or status, such as `12` or `Draft`, drawn as a small filled or outlined label. It adds no role, so its text
|
|
12
|
+
reads as part of what's around it.
|
|
13
|
+
|
|
14
|
+
**Selector:** `[monaBadge]`
|
|
15
|
+
|
|
16
|
+
### Inputs
|
|
17
|
+
|
|
18
|
+
| Name | Type | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- |
|
|
20
|
+
| `class` | `ClassInputType` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
21
|
+
| `fill` | `"outline" \| "solid" \| "subtle"` | `"solid"` | How the badge is drawn: `solid` fills it with the look's color, `subtle` with a light tint of it, and `outline` draws only its border. |
|
|
22
|
+
| `look` | `"error" \| "info" \| "primary" \| "secondary" \| "success" \| "warning"` | `"secondary"` | The badge's color role. Pick it for what the badge means, such as `error` for a failed state, and say that in its text too, since color alone doesn't reach everyone. |
|
|
23
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset. `full` makes a pill, and a round dot for a single digit. |
|
|
24
|
+
| `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the badge's height, padding, text and icon size. |
|
package/docs/api/common.md
CHANGED
|
@@ -101,7 +101,7 @@ Class.
|
|
|
101
101
|
| `isDefaultPrevented(): boolean` | Whether `preventDefault()` was called. |
|
|
102
102
|
| `preventDefault(): void` | Cancels what the event announces, such as opening or closing a popup, or closing a dialog. |
|
|
103
103
|
|
|
104
|
-
**Used by:** [`AutoCompleteComponent`](auto-complete.md#autocompletecomponent), [`CellEditEvent`](grid.md#celleditevent), [`ColumnReorderEvent`](grid.md#columnreorderevent), [`ColumnSortEvent`](grid.md#columnsortevent), [`ComboBoxComponent`](combo-box.md#comboboxcomponent), [`DatePickerComponent`](date-picker.md#datepickercomponent), [`DateRangePickerComponent`](date-range-picker.md#daterangepickercomponent), [`DateTimePickerComponent`](datetime-picker.md#datetimepickercomponent), [`DialogActionEvent`](dialog.md#dialogactionevent), [`DropdownListComponent`](dropdown-list.md#dropdownlistcomponent), [`FilterChangeEvent`](common.md#filterchangeevent), [`GridAddEvent`](grid.md#gridaddevent), [`GridCancelEvent`](grid.md#gridcancelevent), [`GridEditEvent`](grid.md#grideditevent), [`GridRemoveEvent`](grid.md#gridremoveevent), [`GridSaveEvent`](grid.md#gridsaveevent), [`ListBoxClearEvent`](list-box.md#listboxclearevent), [`ListBoxMoveEvent`](list-box.md#listboxmoveevent), [`ListBoxRemoveEvent`](list-box.md#listboxremoveevent), [`ListBoxTransferEvent`](list-box.md#listboxtransferevent), [`MultiSelectComponent`](multi-select.md#multiselectcomponent), [`NodeCheckEvent`](tree-view.md#nodecheckevent), [`NodeClickEvent`](tree-view.md#nodeclickevent), [`NodeSelectEvent`](tree-view.md#nodeselectevent), [`PageSizeChangeEvent`](pager.md#pagesizechangeevent), [`PopoverHideEvent`](popover.md#popoverhideevent), [`PopoverShowEvent`](popover.md#popovershowevent), [`PopupCloseEvent`](popup.md#popupcloseevent), [`PopupMenuCloseEvent`](popup-menu.md#popupmenucloseevent), [`PopupMenuItemClickEvent`](popup-menu.md#popupmenuitemclickevent), [`RowEditEvent`](grid.md#roweditevent), [`RowReorderEvent`](grid.md#rowreorderevent), [`StepSelectEvent`](stepper.md#stepselectevent), [`TabCloseEvent`](tabs.md#tabcloseevent), [`TabSelectEvent`](tabs.md#tabselectevent), [`TimePickerComponent`](time-picker.md#timepickercomponent)
|
|
104
|
+
**Used by:** [`AutoCompleteComponent`](auto-complete.md#autocompletecomponent), [`CellEditEvent`](grid.md#celleditevent), [`ColumnReorderEvent`](grid.md#columnreorderevent), [`ColumnSortEvent`](grid.md#columnsortevent), [`ComboBoxComponent`](combo-box.md#comboboxcomponent), [`DatePickerComponent`](date-picker.md#datepickercomponent), [`DateRangePickerComponent`](date-range-picker.md#daterangepickercomponent), [`DateTimePickerComponent`](datetime-picker.md#datetimepickercomponent), [`DialogActionEvent`](dialog.md#dialogactionevent), [`DropdownListComponent`](dropdown-list.md#dropdownlistcomponent), [`FilterChangeEvent`](common.md#filterchangeevent), [`GridAddEvent`](grid.md#gridaddevent), [`GridCancelEvent`](grid.md#gridcancelevent), [`GridEditEvent`](grid.md#grideditevent), [`GridRemoveEvent`](grid.md#gridremoveevent), [`GridSaveEvent`](grid.md#gridsaveevent), [`ListBoxClearEvent`](list-box.md#listboxclearevent), [`ListBoxMoveEvent`](list-box.md#listboxmoveevent), [`ListBoxRemoveEvent`](list-box.md#listboxremoveevent), [`ListBoxTransferEvent`](list-box.md#listboxtransferevent), [`MultiSelectComponent`](multi-select.md#multiselectcomponent), [`NodeCheckEvent`](tree-view.md#nodecheckevent), [`NodeClickEvent`](tree-view.md#nodeclickevent), [`NodeSelectEvent`](tree-view.md#nodeselectevent), [`PageSizeChangeEvent`](pager.md#pagesizechangeevent), [`PopoverHideEvent`](popover.md#popoverhideevent), [`PopoverShowEvent`](popover.md#popovershowevent), [`PopupCloseEvent`](popup.md#popupcloseevent), [`PopupMenuCloseEvent`](popup-menu.md#popupmenucloseevent), [`PopupMenuItemClickEvent`](popup-menu.md#popupmenuitemclickevent), [`RowEditEvent`](grid.md#roweditevent), [`RowReorderEvent`](grid.md#rowreorderevent), [`StepSelectEvent`](stepper.md#stepselectevent), [`TabCloseEvent`](tabs.md#tabcloseevent), [`TabSelectEvent`](tabs.md#tabselectevent), [`TimePickerComponent`](time-picker.md#timepickercomponent), [`ToolbarItemDirective`](toolbar.md#toolbaritemdirective)
|
|
105
105
|
|
|
106
106
|
## `FilterChangeEvent`
|
|
107
107
|
|
|
@@ -461,7 +461,7 @@ HTML attributes by name, to apply to an element.
|
|
|
461
461
|
type AttributeConfig = Record<string, unknown>;
|
|
462
462
|
```
|
|
463
463
|
|
|
464
|
-
**Used by:** [`OtpInputComponent`](otp-input.md#otpinputcomponent), [`TextBoxComponent`](text-box.md#textboxcomponent)
|
|
464
|
+
**Used by:** [`MaskedTextBoxComponent`](masked-text-box.md#maskedtextboxcomponent), [`OtpInputComponent`](otp-input.md#otpinputcomponent), [`TextBoxComponent`](text-box.md#textboxcomponent)
|
|
465
465
|
|
|
466
466
|
## `BaseChangeStrategy`
|
|
467
467
|
|
|
@@ -493,7 +493,7 @@ Type alias.
|
|
|
493
493
|
type ClassInputType = string | string[] | Record<string, unknown> | null | undefined;
|
|
494
494
|
```
|
|
495
495
|
|
|
496
|
-
**Used by:** [`CardFooterComponent`](card.md#cardfootercomponent), [`CardHeaderComponent`](card.md#cardheadercomponent), [`classInputToClass`](common.md#classinputtoclass), [`PlaceholderComponent`](placeholder.md#placeholdercomponent), [`PopupMenuComponent`](popup-menu.md#popupmenucomponent), [`SheetComponent`](sheet.md#sheetcomponent), [`SidebarComponent`](sidebar.md#sidebarcomponent), [`SidebarFooterDirective`](sidebar.md#sidebarfooterdirective), [`SidebarHeaderDirective`](sidebar.md#sidebarheaderdirective), [`SidebarInsetDirective`](sidebar.md#sidebarinsetdirective), [`SidebarLayoutComponent`](sidebar.md#sidebarlayoutcomponent), [`SidebarMenuBadgeDirective`](sidebar.md#sidebarmenubadgedirective), [`SidebarMenuButtonDirective`](sidebar.md#sidebarmenubuttondirective), [`SidebarMenuDirective`](sidebar.md#sidebarmenudirective), [`SidebarMenuItemDirective`](sidebar.md#sidebarmenuitemdirective), [`SidebarMenuSubDirective`](sidebar.md#sidebarmenusubdirective), [`SidebarSeparatorDirective`](sidebar.md#sidebarseparatordirective), [`SkeletonComponent`](skeleton.md#skeletoncomponent), [`SpinnerComponent`](spinner.md#spinnercomponent)
|
|
496
|
+
**Used by:** [`AlertActionsDirective`](alert.md#alertactionsdirective), [`AlertComponent`](alert.md#alertcomponent), [`AvatarGroupComponent`](avatar.md#avatargroupcomponent), [`BadgeDirective`](badge.md#badgedirective), [`CardFooterComponent`](card.md#cardfootercomponent), [`CardHeaderComponent`](card.md#cardheadercomponent), [`classInputToClass`](common.md#classinputtoclass), [`PlaceholderComponent`](placeholder.md#placeholdercomponent), [`PopupMenuComponent`](popup-menu.md#popupmenucomponent), [`SeparatorComponent`](separator.md#separatorcomponent), [`SheetComponent`](sheet.md#sheetcomponent), [`SidebarComponent`](sidebar.md#sidebarcomponent), [`SidebarFooterDirective`](sidebar.md#sidebarfooterdirective), [`SidebarHeaderDirective`](sidebar.md#sidebarheaderdirective), [`SidebarInsetDirective`](sidebar.md#sidebarinsetdirective), [`SidebarLayoutComponent`](sidebar.md#sidebarlayoutcomponent), [`SidebarMenuBadgeDirective`](sidebar.md#sidebarmenubadgedirective), [`SidebarMenuButtonDirective`](sidebar.md#sidebarmenubuttondirective), [`SidebarMenuDirective`](sidebar.md#sidebarmenudirective), [`SidebarMenuItemDirective`](sidebar.md#sidebarmenuitemdirective), [`SidebarMenuSubDirective`](sidebar.md#sidebarmenusubdirective), [`SidebarSeparatorDirective`](sidebar.md#sidebarseparatordirective), [`SkeletonComponent`](skeleton.md#skeletoncomponent), [`SpinnerComponent`](spinner.md#spinnercomponent), [`ToolbarComponent`](toolbar.md#toolbarcomponent)
|
|
497
497
|
|
|
498
498
|
## `ColorOutputFormat`
|
|
499
499
|
|
package/docs/api/i18n.md
CHANGED
|
@@ -646,6 +646,34 @@ validator's own `message` wins over these.
|
|
|
646
646
|
|
|
647
647
|
**Used by:** [`MonaLocaleMessages`](i18n.md#monalocalemessages)
|
|
648
648
|
|
|
649
|
+
## `MonaAlertMessages`
|
|
650
|
+
|
|
651
|
+
Interface.
|
|
652
|
+
|
|
653
|
+
The alert's dismiss button.
|
|
654
|
+
|
|
655
|
+
### Methods
|
|
656
|
+
|
|
657
|
+
| Signature | Description |
|
|
658
|
+
| --- | --- |
|
|
659
|
+
| `dismissLabel(title?: string): string` | Name of the button that dismisses the alert, with the alert's title when it has one. |
|
|
660
|
+
|
|
661
|
+
**Used by:** [`ALERT_DEFAULT_MESSAGES`](alert.md#alert-default-messages), [`MonaLocaleMessages`](i18n.md#monalocalemessages)
|
|
662
|
+
|
|
663
|
+
## `MonaAvatarMessages`
|
|
664
|
+
|
|
665
|
+
Interface.
|
|
666
|
+
|
|
667
|
+
The avatar group's count of the avatars it doesn't show.
|
|
668
|
+
|
|
669
|
+
### Methods
|
|
670
|
+
|
|
671
|
+
| Signature | Description |
|
|
672
|
+
| --- | --- |
|
|
673
|
+
| `moreLabel(count: number): string` | Name of the item that stands for the avatars past `max`, such as "3 more". It shows the count as "+3". |
|
|
674
|
+
|
|
675
|
+
**Used by:** [`AVATAR_DEFAULT_MESSAGES`](avatar.md#avatar-default-messages), [`MonaLocaleMessages`](i18n.md#monalocalemessages)
|
|
676
|
+
|
|
649
677
|
## `MonaChipMessages`
|
|
650
678
|
|
|
651
679
|
Interface.
|
|
@@ -1262,7 +1290,9 @@ Interface.
|
|
|
1262
1290
|
|
|
1263
1291
|
| Name | Type |
|
|
1264
1292
|
| --- | --- |
|
|
1293
|
+
| `alert` | `MonaAlertMessages` |
|
|
1265
1294
|
| `autoComplete` | `MonaAutoCompleteMessages` |
|
|
1295
|
+
| `avatar` | `MonaAvatarMessages` |
|
|
1266
1296
|
| `breadcrumb` | `MonaBreadcrumbMessages` |
|
|
1267
1297
|
| `buttonGroup` | `MonaButtonGroupMessages` |
|
|
1268
1298
|
| `calendar` | `MonaCalendarMessages` |
|
|
@@ -1288,6 +1318,7 @@ Interface.
|
|
|
1288
1318
|
| `label` | `MonaLabelMessages` |
|
|
1289
1319
|
| `list` | `MonaListMessages` |
|
|
1290
1320
|
| `listBox` | `MonaListBoxMessages` |
|
|
1321
|
+
| `maskedTextBox` | `MonaMaskedTextBoxMessages` |
|
|
1291
1322
|
| `multiSelect` | `MonaMultiSelectMessages` |
|
|
1292
1323
|
| `notification` | `MonaNotificationMessages` |
|
|
1293
1324
|
| `numericTextBox` | `MonaNumericTextBoxMessages` |
|
|
@@ -1308,11 +1339,31 @@ Interface.
|
|
|
1308
1339
|
| `textBox` | `MonaTextBoxMessages` |
|
|
1309
1340
|
| `timePicker` | `MonaTimePickerMessages` |
|
|
1310
1341
|
| `timeSelector` | `MonaTimeSelectorMessages` |
|
|
1342
|
+
| `toolbar` | `MonaToolbarMessages` |
|
|
1311
1343
|
| `treeView` | `MonaTreeViewMessages` |
|
|
1312
1344
|
| `window` | `MonaWindowMessages` |
|
|
1313
1345
|
|
|
1314
1346
|
**Used by:** [`generatePseudoLocale`](i18n.md#generatepseudolocale), [`MonaI18nConfig`](i18n.md#monai18nconfig), [`MonaI18nService`](i18n.md#monai18nservice), [`MonaLocale`](i18n.md#monalocale), [`MonaMessageNamespace`](i18n.md#monamessagenamespace)
|
|
1315
1347
|
|
|
1348
|
+
## `MonaMaskedTextBoxMessages`
|
|
1349
|
+
|
|
1350
|
+
Interface.
|
|
1351
|
+
|
|
1352
|
+
The masked text box's clear button, and what it says when a typed character doesn't fit the slot at the caret.
|
|
1353
|
+
|
|
1354
|
+
### Properties
|
|
1355
|
+
|
|
1356
|
+
| Name | Type | Description |
|
|
1357
|
+
| --- | --- | --- |
|
|
1358
|
+
| `characterNotAllowed` (read-only) | `string` | Read out when a character doesn't fit a slot that takes something else, such as one of a custom rule. |
|
|
1359
|
+
| `clear` (read-only) | `string` | Name of the button that clears the value. |
|
|
1360
|
+
| `digitOnly` (read-only) | `string` | Read out when a character doesn't fit a slot that takes a digit. |
|
|
1361
|
+
| `digitOrSignOnly` (read-only) | `string` | Read out when a character doesn't fit a slot that takes a digit, `+` or `-`. |
|
|
1362
|
+
| `letterOnly` (read-only) | `string` | Read out when a character doesn't fit a slot that takes a letter. |
|
|
1363
|
+
| `letterOrDigitOnly` (read-only) | `string` | Read out when a character doesn't fit a slot that takes a letter or a digit. |
|
|
1364
|
+
|
|
1365
|
+
**Used by:** [`MASKED_TEXT_BOX_DEFAULT_MESSAGES`](masked-text-box.md#masked-text-box-default-messages), [`MonaLocaleMessages`](i18n.md#monalocalemessages)
|
|
1366
|
+
|
|
1316
1367
|
## `MonaMessageOverrideOptions`
|
|
1317
1368
|
|
|
1318
1369
|
Interface.
|
|
@@ -1331,11 +1382,12 @@ Interface.
|
|
|
1331
1382
|
|
|
1332
1383
|
### Properties
|
|
1333
1384
|
|
|
1334
|
-
| Name | Type |
|
|
1335
|
-
| --- | --- |
|
|
1336
|
-
| `clear` (read-only) | `string` |
|
|
1337
|
-
| `itemsCount` (read-only) | `(count: number) => string` |
|
|
1338
|
-
| `removeMoreItems` (read-only) | `(count: number) => string` |
|
|
1385
|
+
| Name | Type | Description |
|
|
1386
|
+
| --- | --- | --- |
|
|
1387
|
+
| `clear` (read-only) | `string` | |
|
|
1388
|
+
| `itemsCount` (read-only) | `(count: number) => string` | |
|
|
1389
|
+
| `removeMoreItems` (read-only) | `(count: number) => string` | |
|
|
1390
|
+
| `selectAll` (read-only) | `string` | The option at the top of the list that selects every item shown, or clears them when they're all selected. |
|
|
1339
1391
|
|
|
1340
1392
|
**Used by:** [`MonaLocaleMessages`](i18n.md#monalocalemessages), [`MULTI_SELECT_DEFAULT_MESSAGES`](multi-select.md#multi-select-default-messages)
|
|
1341
1393
|
|
|
@@ -1585,6 +1637,20 @@ Interface.
|
|
|
1585
1637
|
|
|
1586
1638
|
**Used by:** [`MonaLocaleMessages`](i18n.md#monalocalemessages), [`TIME_SELECTOR_DEFAULT_MESSAGES`](time-selector.md#time-selector-default-messages), [`TimeSelectorMessages`](i18n.md#timeselectormessages)
|
|
1587
1639
|
|
|
1640
|
+
## `MonaToolbarMessages`
|
|
1641
|
+
|
|
1642
|
+
Interface.
|
|
1643
|
+
|
|
1644
|
+
The toolbar's overflow menu.
|
|
1645
|
+
|
|
1646
|
+
### Properties
|
|
1647
|
+
|
|
1648
|
+
| Name | Type | Description |
|
|
1649
|
+
| --- | --- | --- |
|
|
1650
|
+
| `moreLabel` (read-only) | `string` | Name of the button that opens the menu of the items that don't fit. |
|
|
1651
|
+
|
|
1652
|
+
**Used by:** [`MonaLocaleMessages`](i18n.md#monalocalemessages), [`TOOLBAR_DEFAULT_MESSAGES`](toolbar.md#toolbar-default-messages)
|
|
1653
|
+
|
|
1588
1654
|
## `MonaWindowMessages`
|
|
1589
1655
|
|
|
1590
1656
|
Interface.
|