@nanahoshi/mona-ui 0.25.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/command/package.json +4 -0
- package/docs/auto-complete.md +733 -0
- package/docs/avatar.md +220 -0
- package/docs/breadcrumb.md +320 -0
- package/docs/button-group.md +392 -0
- package/docs/button.md +256 -0
- package/docs/calendar.md +515 -0
- package/docs/card.md +292 -0
- package/docs/chart.md +4058 -0
- package/docs/checkbox.md +374 -0
- package/docs/chip.md +339 -0
- package/docs/circular-progress-bar.md +287 -0
- package/docs/collapsible.md +308 -0
- package/docs/color-gradient.md +336 -0
- package/docs/color-palette.md +317 -0
- package/docs/color-picker.md +387 -0
- package/docs/combo-box.md +764 -0
- package/docs/command.md +582 -0
- package/docs/contextmenu.md +530 -0
- package/docs/date-picker.md +251 -0
- package/docs/datetime-picker.md +284 -0
- package/docs/decimal-textbox.md +260 -0
- package/docs/dialog.md +822 -0
- package/docs/dropdown-button.md +507 -0
- package/docs/dropdown-list.md +779 -0
- package/docs/editor.md +374 -0
- package/docs/expansion-panel.md +348 -0
- package/docs/fieldset.md +217 -0
- package/docs/forms.md +162 -0
- package/docs/grid.md +2053 -0
- package/docs/input.md +197 -0
- package/docs/installation.md +54 -0
- package/docs/introduction.md +46 -0
- package/docs/label.md +340 -0
- package/docs/list-box.md +637 -0
- package/docs/list-view.md +584 -0
- package/docs/menubar.md +559 -0
- package/docs/multi-select.md +765 -0
- package/docs/notification.md +460 -0
- package/docs/numeric-textbox.md +301 -0
- package/docs/otp-input.md +539 -0
- package/docs/pager.md +513 -0
- package/docs/placeholder.md +176 -0
- package/docs/popover.md +423 -0
- package/docs/popup-menu.md +658 -0
- package/docs/popup.md +617 -0
- package/docs/progress-bar.md +368 -0
- package/docs/radio-button.md +451 -0
- package/docs/range-slider.md +367 -0
- package/docs/rating.md +518 -0
- package/docs/scroll-view.md +375 -0
- package/docs/segmented.md +434 -0
- package/docs/sheet.md +348 -0
- package/docs/sidebar.md +1126 -0
- package/docs/skeleton.md +181 -0
- package/docs/slider.md +423 -0
- package/docs/spinner.md +370 -0
- package/docs/split-button.md +522 -0
- package/docs/splitter.md +342 -0
- package/docs/stepper.md +539 -0
- package/docs/switch.md +340 -0
- package/docs/tabs.md +542 -0
- package/docs/textarea.md +196 -0
- package/docs/textbox.md +332 -0
- package/docs/theming.md +403 -0
- package/docs/time-picker.md +254 -0
- package/docs/tooltip-directive.md +340 -0
- package/docs/tooltip.md +321 -0
- package/docs/tree-view.md +1018 -0
- package/docs/window.md +663 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +86 -0
- 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 +123 -0
- package/locales/ar-sa/ar-sa.messages.json +10 -0
- package/locales/de-de/de-de.messages.json +10 -0
- package/locales/es-es/es-es.messages.json +10 -0
- package/locales/fr-fr/fr-fr.messages.json +10 -0
- package/locales/id-id/id-id.messages.json +10 -0
- package/locales/it-it/it-it.messages.json +10 -0
- package/locales/ja-jp/ja-jp.messages.json +10 -0
- package/locales/ko-kr/ko-kr.messages.json +10 -0
- package/locales/pt-br/pt-br.messages.json +10 -0
- package/locales/ru-ru/ru-ru.messages.json +10 -0
- package/locales/tr-tr/tr-tr.messages.json +10 -0
- package/locales/zh-cn/zh-cn.messages.json +10 -0
- package/locales/zh-tw/zh-tw.messages.json +10 -0
- package/package.json +9 -1
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
- package/types/nanahoshi-mona-ui-button.d.ts +12 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-command.d.ts +253 -0
- package/types/nanahoshi-mona-ui-common.d.ts +17 -1
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
- package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
- package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
- package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
- package/types/nanahoshi-mona-ui-label.d.ts +1 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
- package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
- package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
- package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
- package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
- package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
- package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
- package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
- package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
- package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
- package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
- package/types/nanahoshi-mona-ui-window.d.ts +66 -1
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
# Progress Bar
|
|
2
|
+
|
|
3
|
+
> A horizontal progress indicator with determinate and indeterminate modes.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/progress-bar`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-progress-bar`
|
|
8
|
+
|
|
9
|
+
`ProgressBarComponent` renders a horizontal progress indicator with a configurable value range, fill color, label, and an indeterminate animation for tasks whose completion is unknown.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
`ProgressBarComponent` renders a full-width horizontal bar that fills proportionally to a numeric value within an explicit range. The label remains readable regardless of the current fill level.
|
|
14
|
+
|
|
15
|
+
An indeterminate mode is available for tasks where the total duration is unknown. In that mode the label is hidden, including a custom one, and a repeating diagonal stripe animation fills the bar.
|
|
16
|
+
|
|
17
|
+
**Use `ProgressBarComponent` when you need to:**
|
|
18
|
+
|
|
19
|
+
- Show file upload, download, or step-based task progress inline in a layout
|
|
20
|
+
- Display a multi-step wizard progress indicator in a horizontal banner
|
|
21
|
+
- Communicate an indeterminate loading state with a full-width animated bar
|
|
22
|
+
|
|
23
|
+
**Use `CircularProgressBarComponent` instead when:**
|
|
24
|
+
|
|
25
|
+
- A compact, self-contained round indicator suits the layout better (e.g., a dashboard card)
|
|
26
|
+
|
|
27
|
+
## Import & Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { ProgressBarComponent } from "@nanahoshi/mona-ui/progress-bar";
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Add `ProgressBarComponent` to your standalone component's `imports` array.
|
|
34
|
+
|
|
35
|
+
**Determinate** — bind `value`, optionally `min` / `max`:
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<mona-progress-bar [value]="uploadPercent" aria-label="Upload progress"></mona-progress-bar>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Examples
|
|
42
|
+
|
|
43
|
+
### Upload with a dynamic color
|
|
44
|
+
|
|
45
|
+
`color` takes a CSS string, or a function that maps the current percentage to a color. Arrow functions cannot be defined inline in Angular templates, so assign the function to a class member and reference it by name.
|
|
46
|
+
|
|
47
|
+
`color` sets the fill only. The label keeps its own color, so set `labelStyles` if your fill needs a different one. `color` doesn't apply while disabled.
|
|
48
|
+
|
|
49
|
+
`upload-example.component.ts`
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { Component, DestroyRef, inject, signal } from "@angular/core";
|
|
53
|
+
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
54
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
55
|
+
import { ProgressBarComponent } from "@nanahoshi/mona-ui/progress-bar";
|
|
56
|
+
import { interval, map, take } from "rxjs";
|
|
57
|
+
|
|
58
|
+
@Component({
|
|
59
|
+
selector: "app-progress-bar-upload-example",
|
|
60
|
+
imports: [ButtonDirective, ProgressBarComponent],
|
|
61
|
+
templateUrl: "./upload-example.component.html"
|
|
62
|
+
})
|
|
63
|
+
export class ProgressBarUploadExampleComponent {
|
|
64
|
+
readonly #destroyRef = inject(DestroyRef);
|
|
65
|
+
protected readonly progress = signal(0);
|
|
66
|
+
protected readonly uploading = signal(false);
|
|
67
|
+
|
|
68
|
+
protected color = (percent: number): string => (percent >= 100 ? "#15803d" : "#4338ca");
|
|
69
|
+
|
|
70
|
+
protected upload(): void {
|
|
71
|
+
this.progress.set(0);
|
|
72
|
+
this.uploading.set(true);
|
|
73
|
+
// Stands in for upload progress events from a server.
|
|
74
|
+
interval(200)
|
|
75
|
+
.pipe(
|
|
76
|
+
take(20),
|
|
77
|
+
map(tick => (tick + 1) * 5),
|
|
78
|
+
takeUntilDestroyed(this.#destroyRef)
|
|
79
|
+
)
|
|
80
|
+
.subscribe({
|
|
81
|
+
complete: () => this.uploading.set(false),
|
|
82
|
+
next: percent => this.progress.set(percent)
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`upload-example.component.html`
|
|
89
|
+
|
|
90
|
+
```html
|
|
91
|
+
<div class="flex max-w-md flex-col items-start gap-3">
|
|
92
|
+
<mona-progress-bar aria-label="Upload progress" class="w-full" [color]="color" [value]="progress()"></mona-progress-bar>
|
|
93
|
+
<button monaButton look="primary" type="button" [disabled]="uploading()" (click)="upload()">
|
|
94
|
+
{{ progress() >= 100 ? "Upload again" : "Upload" }}
|
|
95
|
+
</button>
|
|
96
|
+
</div>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Indeterminate
|
|
100
|
+
|
|
101
|
+
Use it when the completion value is unknown. Set `aria-valuetext` so screen readers announce a state.
|
|
102
|
+
|
|
103
|
+
`indeterminate-example.component.ts`
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { Component } from "@angular/core";
|
|
107
|
+
import { ProgressBarComponent } from "@nanahoshi/mona-ui/progress-bar";
|
|
108
|
+
|
|
109
|
+
@Component({
|
|
110
|
+
selector: "app-progress-bar-indeterminate-example",
|
|
111
|
+
imports: [ProgressBarComponent],
|
|
112
|
+
templateUrl: "./indeterminate-example.component.html"
|
|
113
|
+
})
|
|
114
|
+
export class ProgressBarIndeterminateExampleComponent {}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`indeterminate-example.component.html`
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<div class="max-w-md">
|
|
121
|
+
<mona-progress-bar aria-label="Preparing export" aria-valuetext="Loading" [indeterminate]="true"></mona-progress-bar>
|
|
122
|
+
</div>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Steps with a custom label
|
|
126
|
+
|
|
127
|
+
`min` and `max` set the range, and `ng-template[monaProgressBarLabelTemplate]` replaces the percentage label.
|
|
128
|
+
|
|
129
|
+
`steps-example.component.ts`
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
import { Component, signal } from "@angular/core";
|
|
133
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
134
|
+
import { ProgressBarComponent, ProgressBarLabelTemplateDirective } from "@nanahoshi/mona-ui/progress-bar";
|
|
135
|
+
|
|
136
|
+
@Component({
|
|
137
|
+
selector: "app-progress-bar-steps-example",
|
|
138
|
+
imports: [ButtonDirective, ProgressBarComponent, ProgressBarLabelTemplateDirective],
|
|
139
|
+
templateUrl: "./steps-example.component.html"
|
|
140
|
+
})
|
|
141
|
+
export class ProgressBarStepsExampleComponent {
|
|
142
|
+
protected readonly completed = signal(2);
|
|
143
|
+
protected readonly total = 5;
|
|
144
|
+
|
|
145
|
+
protected back(): void {
|
|
146
|
+
this.completed.update(steps => Math.max(steps - 1, 0));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
protected next(): void {
|
|
150
|
+
this.completed.update(steps => Math.min(steps + 1, this.total));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`steps-example.component.html`
|
|
156
|
+
|
|
157
|
+
```html
|
|
158
|
+
<div class="flex max-w-md flex-col gap-3">
|
|
159
|
+
<mona-progress-bar
|
|
160
|
+
aria-label="Setup steps completed"
|
|
161
|
+
[aria-valuetext]="completed() + ' of ' + total + ' steps'"
|
|
162
|
+
[max]="total"
|
|
163
|
+
[value]="completed()">
|
|
164
|
+
<ng-template monaProgressBarLabelTemplate let-max="max" let-value>
|
|
165
|
+
<span class="text-xs font-medium">{{ value }} / {{ max }}</span>
|
|
166
|
+
</ng-template>
|
|
167
|
+
</mona-progress-bar>
|
|
168
|
+
<div class="flex gap-2">
|
|
169
|
+
<button monaButton type="button" [disabled]="completed() === 0" (click)="back()">Back</button>
|
|
170
|
+
<button monaButton look="primary" type="button" [disabled]="completed() === total" (click)="next()">Next</button>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Label position and visibility
|
|
176
|
+
|
|
177
|
+
`labels-example.component.ts`
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { Component } from "@angular/core";
|
|
181
|
+
import { ProgressBarComponent } from "@nanahoshi/mona-ui/progress-bar";
|
|
182
|
+
|
|
183
|
+
@Component({
|
|
184
|
+
selector: "app-progress-bar-labels-example",
|
|
185
|
+
imports: [ProgressBarComponent],
|
|
186
|
+
templateUrl: "./labels-example.component.html"
|
|
187
|
+
})
|
|
188
|
+
export class ProgressBarLabelsExampleComponent {}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`labels-example.component.html`
|
|
192
|
+
|
|
193
|
+
```html
|
|
194
|
+
<div class="flex max-w-md flex-col gap-3">
|
|
195
|
+
<mona-progress-bar aria-label="Disk usage" labelPosition="start" [value]="35"></mona-progress-bar>
|
|
196
|
+
<mona-progress-bar aria-label="Memory usage" [value]="60"></mona-progress-bar>
|
|
197
|
+
<mona-progress-bar aria-label="Network usage" labelPosition="end" [value]="85"></mona-progress-bar>
|
|
198
|
+
<mona-progress-bar aria-label="Battery charge" [labelVisible]="false" [value]="50"></mona-progress-bar>
|
|
199
|
+
</div>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Appearance & Styling
|
|
203
|
+
|
|
204
|
+
### Rounded presets
|
|
205
|
+
|
|
206
|
+
| `rounded` | Shape |
|
|
207
|
+
|-----------|-----------------------------|
|
|
208
|
+
| `none` | No rounding |
|
|
209
|
+
| `small` | Slight rounding |
|
|
210
|
+
| `medium` | Moderate rounding (default) |
|
|
211
|
+
| `large` | Strong rounding |
|
|
212
|
+
| `full` | Pill / fully rounded |
|
|
213
|
+
|
|
214
|
+
### Label alignment
|
|
215
|
+
|
|
216
|
+
| `labelPosition` | Label alignment |
|
|
217
|
+
|-----------------|--------------------|
|
|
218
|
+
| `start` | Flush with the start of the bar, left in LTR and right in RTL |
|
|
219
|
+
| `center` | Centered (default) |
|
|
220
|
+
| `end` | Flush with the end of the bar, right in LTR and left in RTL |
|
|
221
|
+
|
|
222
|
+
### Visual states
|
|
223
|
+
|
|
224
|
+
| State | Appearance |
|
|
225
|
+
|---------------|---------------------------------------------------------------|
|
|
226
|
+
| Default | Fill extends from the start of the bar to `value` percentage of its width |
|
|
227
|
+
| Indeterminate | Repeating diagonal stripe animation, or still stripes under `prefers-reduced-motion`; label hidden |
|
|
228
|
+
| Disabled | Disabled colors, non-interactive |
|
|
229
|
+
| Zero value | Fill area is transparent (bar appears empty) |
|
|
230
|
+
|
|
231
|
+
### Track animation
|
|
232
|
+
|
|
233
|
+
When `animate` is `true` (the default), the progress track transitions its fill and color on each value change. Set `[animate]="false"` to disable all transitions — useful when updating value rapidly (e.g., a real-time byte counter).
|
|
234
|
+
|
|
235
|
+
### Custom label template
|
|
236
|
+
|
|
237
|
+
The default label is the percentage, formatted for the locale, such as `40%`, `33,33 %` in German or `%40` in Turkish. Replace it with any content using `ng-template[monaProgressBarLabelTemplate]`, as in the steps example.
|
|
238
|
+
|
|
239
|
+
The template context exposes four variables:
|
|
240
|
+
|
|
241
|
+
| Variable | Type | Description |
|
|
242
|
+
|-------------|----------|----------------------------------------------|
|
|
243
|
+
| `$implicit` | `number` | The raw `value` input — use `let-value` |
|
|
244
|
+
| `min` | `number` | The raw `min` input |
|
|
245
|
+
| `max` | `number` | The raw `max` input |
|
|
246
|
+
| `percent` | `number` | Computed percentage (0–100, rounded to 2 dp) |
|
|
247
|
+
|
|
248
|
+
The template is rendered twice, one copy over the fill and one over the track, which keeps text readable against both. So don't put ids or anything with a side effect in it.
|
|
249
|
+
|
|
250
|
+
### Custom label styles
|
|
251
|
+
|
|
252
|
+
Use `labelStyles` to apply arbitrary inline styles to the default `<span>` label. This has no effect when a custom `monaProgressBarLabelTemplate` is in use:
|
|
253
|
+
|
|
254
|
+
```html
|
|
255
|
+
<mona-progress-bar [value]="60" [labelStyles]="{ fontWeight: '700', fontSize: '10px' }" aria-label="Upload progress">
|
|
256
|
+
</mona-progress-bar>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Custom class
|
|
260
|
+
|
|
261
|
+
Merge additional Tailwind or custom classes onto the host element via the `class` attribute. They are applied through `tailwind-merge` to avoid conflicts with the computed classes:
|
|
262
|
+
|
|
263
|
+
```html
|
|
264
|
+
<mona-progress-bar [value]="80" class="h-3" aria-label="Upload progress"></mona-progress-bar>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Accessibility
|
|
268
|
+
|
|
269
|
+
The host element carries `role="progressbar"`. The component manages the following ARIA attributes automatically:
|
|
270
|
+
|
|
271
|
+
| Attribute | When present | Value |
|
|
272
|
+
|-----------------|--------------------|------------------|
|
|
273
|
+
| `aria-label` | Always | The `aria-label` input, or the localized "Progress" |
|
|
274
|
+
| `aria-valuemin` | Determinate mode | Bound to `min` |
|
|
275
|
+
| `aria-valuemax` | Determinate mode | Bound to `max` |
|
|
276
|
+
| `aria-valuenow` | Determinate mode | `value`, clamped to the range. A non-finite value counts as `min`, the same place the bar draws it. |
|
|
277
|
+
| `aria-disabled` | `disabled` is true | `true` |
|
|
278
|
+
|
|
279
|
+
With a range that holds nothing, where `max` isn't above `min`, the bar reports no values and a warning is logged in development.
|
|
280
|
+
|
|
281
|
+
Consumer responsibilities:
|
|
282
|
+
|
|
283
|
+
- Set `aria-label`, or `aria-labelledby`, which takes precedence, to name what the bar measures (e.g., `"Upload progress"`). "Progress" is only a fallback, and it doesn't tell two bars apart.
|
|
284
|
+
- Set `aria-valuetext` when a human-readable announcement is needed. In indeterminate mode, use a localized string such as `"Loading"` so screen readers announce state rather than silence.
|
|
285
|
+
|
|
286
|
+
## API
|
|
287
|
+
|
|
288
|
+
Everything below is imported from `@nanahoshi/mona-ui/progress-bar`.
|
|
289
|
+
|
|
290
|
+
### `ProgressBarComponent`
|
|
291
|
+
|
|
292
|
+
**Selector:** `mona-progress-bar`
|
|
293
|
+
|
|
294
|
+
#### Inputs
|
|
295
|
+
|
|
296
|
+
| Name | Type | Default | Description |
|
|
297
|
+
| --- | --- | --- | --- |
|
|
298
|
+
| `animate` | `boolean` | `true` | Enables CSS transitions on fill and color changes. Set to `false` when updating `value` at high frequency (e.g., a real-time byte counter). |
|
|
299
|
+
| `aria-label` | `string` | `""` | Accessible label for the progress bar host element. Use to describe what is being measured (e.g., "Upload progress"). When empty, falls back to the localized "Progress". An `aria-labelledby` on the host takes precedence over both. |
|
|
300
|
+
| `aria-valuetext` | `string` | `""` | Overrides the numeric aria-valuenow announcement for assistive technology. Particularly useful in indeterminate mode — set to a localized string such as "Loading" so screen readers announce state rather than silence. When empty, assistive technology falls back to the numeric value. |
|
|
301
|
+
| `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
302
|
+
| `color` | `string \| Action<number, string>` | `""` | Fill color of the progress track. Pass a CSS color string, or a function that receives the current percentage (0–100) and returns a color string. When empty, falls back to the primary theme color. |
|
|
303
|
+
| `disabled` | `boolean` | `false` | Renders the bar with reduced visual emphasis and removes pointer interaction. `color` doesn't apply while disabled. |
|
|
304
|
+
| `indeterminate` | `boolean` | `false` | Switches to indeterminate mode: plays a looping animation and hides the label. ARIA value attributes are removed. |
|
|
305
|
+
| `labelPosition` | `LabelPosition` | `"center"` | Horizontal alignment of the label within the bar. |
|
|
306
|
+
| `labelStyles` | `Partial<CSSStyleDeclaration>` | `{}` | Inline styles applied to the default label span. Has no effect when a custom `monaProgressBarLabelTemplate` is provided. |
|
|
307
|
+
| `labelVisible` | `boolean` | `true` | Controls label visibility in determinate mode. Has no effect in indeterminate mode — the label is always hidden there. |
|
|
308
|
+
| `max` | `number` | `100` | Upper bound of the value range. Must be greater than `min`; otherwise the bar reports no values and a warning is logged in development. |
|
|
309
|
+
| `min` | `number` | `0` | Lower bound of the value range. |
|
|
310
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the bar. |
|
|
311
|
+
| `value` | `number` | `0` | Current progress value within `[min, max]`. Values outside the range are clamped, for the bar and for `aria-valuenow`; non-finite values count as `min`. |
|
|
312
|
+
|
|
313
|
+
### `ProgressBarLabelTemplateDirective`
|
|
314
|
+
|
|
315
|
+
Structural template directive that replaces the default percentage label. The template is hidden when `indeterminate`
|
|
316
|
+
is `true`.
|
|
317
|
+
|
|
318
|
+
**Selector:** `ng-template[monaProgressBarLabelTemplate]`
|
|
319
|
+
|
|
320
|
+
#### Template context
|
|
321
|
+
|
|
322
|
+
| Name | Type |
|
|
323
|
+
| --- | --- |
|
|
324
|
+
| `$implicit` | `number` |
|
|
325
|
+
| `max` | `number` |
|
|
326
|
+
| `min` | `number` |
|
|
327
|
+
| `percent` | `number` |
|
|
328
|
+
|
|
329
|
+
### Types
|
|
330
|
+
|
|
331
|
+
#### `PROGRESS_BAR_DEFAULT_MESSAGES`
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
const PROGRESS_BAR_DEFAULT_MESSAGES: MonaProgressBarMessages;
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
#### `LabelTemplateContext`
|
|
338
|
+
|
|
339
|
+
| Name | Type |
|
|
340
|
+
| --- | --- |
|
|
341
|
+
| `$implicit` | `number` |
|
|
342
|
+
| `max` | `number` |
|
|
343
|
+
| `min` | `number` |
|
|
344
|
+
| `percent` | `number` |
|
|
345
|
+
|
|
346
|
+
#### `LabelPosition`
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
type LabelPosition = "start" | "center" | "end";
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
#### `Action`
|
|
353
|
+
|
|
354
|
+
From `@nanahoshi/mona-ui/common`.
|
|
355
|
+
|
|
356
|
+
A function taking a `P` and returning an `R`.
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
type Action<P = void, R = void> = (arg: P) => R;
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
#### `MonaProgressBarMessages`
|
|
363
|
+
|
|
364
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
365
|
+
|
|
366
|
+
| Name | Type |
|
|
367
|
+
| --- | --- |
|
|
368
|
+
| `label` (read-only) | `string` |
|