@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.
Files changed (222) hide show
  1. package/README.md +2 -0
  2. package/command/package.json +4 -0
  3. package/docs/auto-complete.md +733 -0
  4. package/docs/avatar.md +220 -0
  5. package/docs/breadcrumb.md +320 -0
  6. package/docs/button-group.md +392 -0
  7. package/docs/button.md +256 -0
  8. package/docs/calendar.md +515 -0
  9. package/docs/card.md +292 -0
  10. package/docs/chart.md +4058 -0
  11. package/docs/checkbox.md +374 -0
  12. package/docs/chip.md +339 -0
  13. package/docs/circular-progress-bar.md +287 -0
  14. package/docs/collapsible.md +308 -0
  15. package/docs/color-gradient.md +336 -0
  16. package/docs/color-palette.md +317 -0
  17. package/docs/color-picker.md +387 -0
  18. package/docs/combo-box.md +764 -0
  19. package/docs/command.md +582 -0
  20. package/docs/contextmenu.md +530 -0
  21. package/docs/date-picker.md +251 -0
  22. package/docs/datetime-picker.md +284 -0
  23. package/docs/decimal-textbox.md +260 -0
  24. package/docs/dialog.md +822 -0
  25. package/docs/dropdown-button.md +507 -0
  26. package/docs/dropdown-list.md +779 -0
  27. package/docs/editor.md +374 -0
  28. package/docs/expansion-panel.md +348 -0
  29. package/docs/fieldset.md +217 -0
  30. package/docs/forms.md +162 -0
  31. package/docs/grid.md +2053 -0
  32. package/docs/input.md +197 -0
  33. package/docs/installation.md +54 -0
  34. package/docs/introduction.md +46 -0
  35. package/docs/label.md +340 -0
  36. package/docs/list-box.md +637 -0
  37. package/docs/list-view.md +584 -0
  38. package/docs/menubar.md +559 -0
  39. package/docs/multi-select.md +765 -0
  40. package/docs/notification.md +460 -0
  41. package/docs/numeric-textbox.md +301 -0
  42. package/docs/otp-input.md +539 -0
  43. package/docs/pager.md +513 -0
  44. package/docs/placeholder.md +176 -0
  45. package/docs/popover.md +423 -0
  46. package/docs/popup-menu.md +658 -0
  47. package/docs/popup.md +617 -0
  48. package/docs/progress-bar.md +368 -0
  49. package/docs/radio-button.md +451 -0
  50. package/docs/range-slider.md +367 -0
  51. package/docs/rating.md +518 -0
  52. package/docs/scroll-view.md +375 -0
  53. package/docs/segmented.md +434 -0
  54. package/docs/sheet.md +348 -0
  55. package/docs/sidebar.md +1126 -0
  56. package/docs/skeleton.md +181 -0
  57. package/docs/slider.md +423 -0
  58. package/docs/spinner.md +370 -0
  59. package/docs/split-button.md +522 -0
  60. package/docs/splitter.md +342 -0
  61. package/docs/stepper.md +539 -0
  62. package/docs/switch.md +340 -0
  63. package/docs/tabs.md +542 -0
  64. package/docs/textarea.md +196 -0
  65. package/docs/textbox.md +332 -0
  66. package/docs/theming.md +403 -0
  67. package/docs/time-picker.md +254 -0
  68. package/docs/tooltip-directive.md +340 -0
  69. package/docs/tooltip.md +321 -0
  70. package/docs/tree-view.md +1018 -0
  71. package/docs/window.md +663 -0
  72. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  73. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  74. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  75. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  76. package/fesm2022/nanahoshi-mona-ui-chart.mjs +86 -0
  77. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  78. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  79. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  80. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  81. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  82. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  83. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  84. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  85. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  86. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  87. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  88. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  89. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  90. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  91. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  92. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  93. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  94. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  95. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  96. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  97. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  98. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  99. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  100. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  101. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  102. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  103. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  104. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  105. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  106. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  107. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  108. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  109. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  111. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  112. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  113. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  114. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  118. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  119. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  120. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  121. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  122. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  123. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  124. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  125. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  126. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  127. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  128. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  129. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  130. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  131. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  132. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  133. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  134. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  135. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  136. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  137. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  138. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  139. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  140. package/i18n/catalogs/en-US.messages.json +10 -0
  141. package/internal/popup-menu/package.json +4 -0
  142. package/llms.txt +123 -0
  143. package/locales/ar-sa/ar-sa.messages.json +10 -0
  144. package/locales/de-de/de-de.messages.json +10 -0
  145. package/locales/es-es/es-es.messages.json +10 -0
  146. package/locales/fr-fr/fr-fr.messages.json +10 -0
  147. package/locales/id-id/id-id.messages.json +10 -0
  148. package/locales/it-it/it-it.messages.json +10 -0
  149. package/locales/ja-jp/ja-jp.messages.json +10 -0
  150. package/locales/ko-kr/ko-kr.messages.json +10 -0
  151. package/locales/pt-br/pt-br.messages.json +10 -0
  152. package/locales/ru-ru/ru-ru.messages.json +10 -0
  153. package/locales/tr-tr/tr-tr.messages.json +10 -0
  154. package/locales/zh-cn/zh-cn.messages.json +10 -0
  155. package/locales/zh-tw/zh-tw.messages.json +10 -0
  156. package/package.json +9 -1
  157. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  158. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  159. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  160. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  161. package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
  162. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  163. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  164. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  165. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  166. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  167. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  168. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  169. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  170. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  171. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  172. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  173. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  174. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  175. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  176. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  177. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  178. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  179. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  180. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  181. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  182. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  183. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  184. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  185. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  186. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  187. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  188. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  189. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  190. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  191. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  192. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  193. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  194. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  195. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  196. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  197. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  198. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  201. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  202. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  203. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  204. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  205. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  206. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  207. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  208. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  209. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  210. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  211. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  212. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  213. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  214. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  215. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  216. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  217. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  218. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  219. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  220. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  221. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  222. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,370 @@
1
+ # Spinner
2
+
3
+ > An animated loading indicator and a service for loading overlays.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/spinner`
6
+
7
+ **Selector:** `mona-spinner`
8
+
9
+ **Entry Point:** `@nanahoshi/mona-ui/spinner`
10
+
11
+ `SpinnerComponent` is a lightweight inline visual primitive for communicating indeterminate loading states. It supports multiple appearances (`default`, `pulsing`, `pulsing-triad`, `pulsing-ring`, `converging-spinner`), standard sizes, and semantic color inheritance.
12
+
13
+ `SpinnerService` is an imperative orchestration service for showing loading overlays over targeted elements or the full page, supporting concurrency deduplication, delays, minimum visible durations, and cancellation.
14
+
15
+ ## Overview
16
+
17
+ Use `SpinnerComponent` for inline indeterminate loading indicators, or `SpinnerService` to show loading overlays over specific elements or the entire page.
18
+
19
+ ### Features
20
+ - **Visual Primitive (`SpinnerComponent`)**: Lightweight CSS-driven animations, reduced-motion safe, and inherits color through `currentColor`.
21
+ - **Imperative Service (`SpinnerService`)**: Manages logical loading requests, handles concurrency with **at most one physical overlay per target**, and provides delays, minimum visible durations, cancellation, and RxJS `track()` integration.
22
+
23
+ ---
24
+
25
+ ## Import & Quick Start
26
+
27
+ ```typescript
28
+ import { Component, inject } from "@angular/core";
29
+ import { SpinnerComponent, SpinnerService } from "@nanahoshi/mona-ui/spinner";
30
+
31
+ @Component({
32
+ imports: [SpinnerComponent],
33
+ template: `
34
+ <mona-spinner appearance="default" size="medium" />
35
+
36
+ <div class="flex items-center gap-2 text-primary">
37
+ <mona-spinner decorative />
38
+ <span>Loading profile...</span>
39
+ </div>
40
+ `
41
+ })
42
+ export class MyComponent {
43
+ private readonly spinnerService = inject(SpinnerService);
44
+
45
+ public loadData(targetElement: HTMLElement): void {
46
+ const spinner = this.spinnerService.show({
47
+ target: targetElement,
48
+ text: "Loading records..."
49
+ });
50
+
51
+ // Close when operation completes
52
+ // spinner.close();
53
+ }
54
+ }
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Examples
60
+
61
+ ### Appearances
62
+
63
+ Every appearance inherits its color through `currentColor`. Use `decorative` when visible text says the same thing.
64
+
65
+ `inline-example.component.ts`
66
+
67
+ ```typescript
68
+ import { Component } from "@angular/core";
69
+ import { SpinnerComponent } from "@nanahoshi/mona-ui/spinner";
70
+
71
+ @Component({
72
+ selector: "app-spinner-inline-example",
73
+ imports: [SpinnerComponent],
74
+ templateUrl: "./inline-example.component.html"
75
+ })
76
+ export class SpinnerInlineExampleComponent {}
77
+ ```
78
+
79
+ `inline-example.component.html`
80
+
81
+ ```html
82
+ <div class="flex flex-col gap-4">
83
+ <div class="flex flex-wrap items-center gap-6 text-primary">
84
+ <mona-spinner appearance="default" />
85
+ <mona-spinner appearance="pulsing" />
86
+ <mona-spinner appearance="pulsing-triad" />
87
+ <mona-spinner appearance="pulsing-ring" />
88
+ <mona-spinner appearance="converging-spinner" />
89
+ </div>
90
+ <div class="flex items-center gap-2">
91
+ <mona-spinner size="small" [decorative]="true" />
92
+ <span>Loading profile…</span>
93
+ </div>
94
+ </div>
95
+ ```
96
+
97
+ ### Element overlay
98
+
99
+ `show()` with a `target` covers that element until you call `close()` on the returned `SpinnerRef`.
100
+
101
+ `overlay-example.component.ts`
102
+
103
+ ```typescript
104
+ import { Component, inject, signal } from "@angular/core";
105
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
106
+ import { SpinnerService } from "@nanahoshi/mona-ui/spinner";
107
+
108
+ @Component({
109
+ selector: "app-spinner-overlay-example",
110
+ imports: [ButtonDirective],
111
+ templateUrl: "./overlay-example.component.html"
112
+ })
113
+ export class SpinnerOverlayExampleComponent {
114
+ readonly #spinnerService = inject(SpinnerService);
115
+ protected readonly saving = signal(false);
116
+
117
+ protected save(panel: HTMLElement): void {
118
+ this.saving.set(true);
119
+ const spinner = this.#spinnerService.show({ target: panel, text: "Saving changes…" });
120
+ // Stands in for a request to a server.
121
+ setTimeout(() => {
122
+ spinner.close();
123
+ this.saving.set(false);
124
+ }, 2000);
125
+ }
126
+ }
127
+ ```
128
+
129
+ `overlay-example.component.html`
130
+
131
+ ```html
132
+ <div #panel class="flex max-w-sm flex-col gap-3 rounded-md border border-border p-4">
133
+ <h3 class="font-semibold">Profile</h3>
134
+ <p class="text-sm">Saving covers only this panel. The rest of the page stays usable.</p>
135
+ <button monaButton look="primary" type="button" [disabled]="saving()" (click)="save(panel)">Save</button>
136
+ </div>
137
+ ```
138
+
139
+ ### Tracking an observable
140
+
141
+ `track()` starts the spinner upon subscription and closes it upon completion, error, or unsubscription. With `cancellable`, Cancel unsubscribes from the source, which aborts an HTTP request, and completes the returned observable without its result. An `onCancel` you gave still runs.
142
+
143
+ `track-example.component.ts`
144
+
145
+ ```typescript
146
+ import { Component, DestroyRef, inject, signal } from "@angular/core";
147
+ import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
148
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
149
+ import { SpinnerService } from "@nanahoshi/mona-ui/spinner";
150
+ import { map, timer } from "rxjs";
151
+
152
+ @Component({
153
+ selector: "app-spinner-track-example",
154
+ imports: [ButtonDirective],
155
+ templateUrl: "./track-example.component.html"
156
+ })
157
+ export class SpinnerTrackExampleComponent {
158
+ readonly #destroyRef = inject(DestroyRef);
159
+ readonly #spinnerService = inject(SpinnerService);
160
+ protected readonly status = signal("Not loaded");
161
+
162
+ protected load(panel: HTMLElement): void {
163
+ this.status.set("Loading…");
164
+ // Stands in for an HTTP request that answers with a record count.
165
+ const request = timer(3000).pipe(map(() => 128));
166
+ this.#spinnerService
167
+ .track(request, { cancellable: true, target: panel, text: "Downloading report…" })
168
+ .pipe(takeUntilDestroyed(this.#destroyRef))
169
+ .subscribe({
170
+ complete: () => this.status.update(status => (status === "Loading…" ? "Cancelled" : status)),
171
+ next: count => this.status.set(`Loaded ${count} records`)
172
+ });
173
+ }
174
+ }
175
+ ```
176
+
177
+ `track-example.component.html`
178
+
179
+ ```html
180
+ <div #panel class="flex max-w-sm flex-col gap-3 rounded-md border border-border p-4">
181
+ <p class="text-sm" aria-live="polite">Report: {{ status() }}</p>
182
+ <button monaButton type="button" [disabled]="status() === 'Loading…'" (click)="load(panel)">Download report</button>
183
+ </div>
184
+ ```
185
+
186
+ ### Full-Page Overlay
187
+
188
+ Leave `target` out for the whole page. At z-index `1001` it sits above CDK overlays, so it covers open dialogs too:
189
+
190
+ ```typescript
191
+ const spinner = this.spinnerService.show({
192
+ text: "Preparing workspace..."
193
+ });
194
+
195
+ // In async completion:
196
+ spinner.close();
197
+ ```
198
+
199
+ Only leaving the key out means the whole page. A `target` that's present but doesn't resolve to an element, such as `undefined` from a `viewChild` before its first render, shows no overlay and logs an error in development, so a spinner meant for one panel can't take over the page.
200
+
201
+ ### Delay & Anti-Flicker
202
+
203
+ Short operations finishing before `delay` (in ms) never create a physical DOM overlay:
204
+
205
+ ```typescript
206
+ const spinner = this.spinnerService.show({
207
+ target: this.containerRef,
208
+ delay: 150
209
+ });
210
+ ```
211
+
212
+ ### Minimum Visible Duration
213
+
214
+ Prevents flash-of-loading by keeping the spinner visible for at least `minimumVisibleDuration` ms:
215
+
216
+ ```typescript
217
+ const spinner = this.spinnerService.show({
218
+ target: this.containerRef,
219
+ minimumVisibleDuration: 300
220
+ });
221
+ ```
222
+
223
+ ### Cancellation
224
+
225
+ ```typescript
226
+ const controller = new AbortController();
227
+
228
+ const spinner = this.spinnerService.show({
229
+ target: this.containerRef,
230
+ text: "Downloading dataset...",
231
+ cancellable: {
232
+ text: "Cancel Download",
233
+ onCancel: () => controller.abort()
234
+ }
235
+ });
236
+
237
+ // Or listen via Observable:
238
+ spinner.cancelled$.subscribe(() => {
239
+ console.log("Spinner was cancelled by user");
240
+ });
241
+ ```
242
+
243
+ The button text is localized unless you give your own. While `minimumVisibleDuration` keeps a closed spinner on screen, the button is gone, because there's nothing left to cancel.
244
+
245
+ ### Concurrency Guarantees
246
+
247
+ When multiple independent operations target the same element:
248
+ - Exactly **one physical overlay** is created.
249
+ - The latest active request controls the visible text/appearance.
250
+ - Closing one operation falls back to the remaining active operations without removing the overlay until all requests finish. A request still in its `delay` shows at once if it's all that's left.
251
+ - `minimumVisibleDuration` holds the overlay for the longest asked for by any request on the target.
252
+
253
+ ---
254
+
255
+ ## Accessibility
256
+
257
+ ### Inline spinner
258
+
259
+ `mona-spinner` is `role="img"` with a localized "Loading" name, or your `aria-label`. A screen reader finds it when it gets there, but it isn't announced when it appears. To announce loading, use `SpinnerService`, or put the text in a live region that's already on the page. Use `decorative` when visible text says the same thing.
260
+
261
+ ### Service overlays
262
+
263
+ - **Announcing:** the service announces through the CDK `LiveAnnouncer` when a request becomes visible, with its `text` or the localized "Loading". A later `update({ text })` is read out too, at most once every 5 seconds, ending on the latest text.
264
+ - **`aria-busy`:** set on a targeted element from the moment of the request, including its `delay`, and put back as it was afterwards. It isn't set on the body for a full-page overlay. It would tell assistive technology it can skip the whole page, including the overlay. On a targeted element the Cancel button is inside the busy region, so for a cancellable request, give users another way to reach it if your screen reader support needs it.
265
+ - **Focus:** when the Cancel button goes with focus on it, because it was pressed, the request closed, another request on the same target took over without a Cancel button of its own, or `minimumVisibleDuration` is holding a closed spinner on screen, focus returns to where it came from.
266
+ - **It's not a modal lock:** the overlay blocks the pointer, not the keyboard. Focus stays where it was and the content behind stays reachable, so disable your own actions while they run if resubmitting would be a problem.
267
+ - **Motion and color:** every appearance honors `prefers-reduced-motion`, and stays visible in forced colors.
268
+
269
+ ## API
270
+
271
+ Everything below is imported from `@nanahoshi/mona-ui/spinner`.
272
+
273
+ ### `SpinnerComponent`
274
+
275
+ An indeterminate loading indicator primitive for communicating ongoing activity.
276
+ Supports multiple appearances and standard sizes. It's a named image, so it's found when a screen reader reaches it,
277
+ not announced. To announce loading, use `SpinnerService` or a live region that's already on the page.
278
+
279
+ **Selector:** `mona-spinner`
280
+
281
+ #### Inputs
282
+
283
+ | Name | Type | Default | Description |
284
+ | --- | --- | --- | --- |
285
+ | `appearance` | `SpinnerAppearance` | `"default"` | Visual appearance of the spinner animation. |
286
+ | `aria-label` | `string \| undefined` | `undefined` | Accessible name of the spinner when it is not decorative. When not set, falls back to the localized loading text. |
287
+ | `class` | `ClassInputType` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
288
+ | `decorative` | `boolean` | `false` | When `true`, removes the `img` role and hides the spinner from assistive technology with `aria-hidden="true"`. Useful when visible text says the same thing, or a parent element already manages loading semantics (such as `aria-busy="true"` on a button). |
289
+ | `size` | `SpinnerSize` | `"medium"` | Size preset controlling the dimensions of the indicator. |
290
+
291
+ ### `SpinnerService`
292
+
293
+ #### Methods
294
+
295
+ | Signature | Description |
296
+ | --- | --- |
297
+ | `hide(refOrId: SpinnerRef \| string): void` | Hides and destroys the spinner associated with the given `SpinnerRef` or string `id`. |
298
+ | `show(options?: SpinnerOptions): SpinnerRef` | Displays a spinner loading overlay according to the provided options. Returns a `SpinnerRef` handle for lifecycle management and updates. |
299
+ | `track<T>(source: Observable<T>, options?: SpinnerOptions): Observable<T>` | Wraps an Observable operation with a Spinner lifecycle. Shows the spinner on subscription and closes it when the observable completes, errors, or is unsubscribed. Cancelling a `cancellable` spinner completes the returned observable and unsubscribes from the source, which also aborts an HTTP request. |
300
+
301
+ ### Types
302
+
303
+ #### `SPINNER_DEFAULT_MESSAGES`
304
+
305
+ ```typescript
306
+ const SPINNER_DEFAULT_MESSAGES: { cancel: string; loading: string; };
307
+ ```
308
+
309
+ #### `SpinnerRef`
310
+
311
+ | Name | Type | Description |
312
+ | --- | --- | --- |
313
+ | `cancelled$` (read-only) | `Observable<void>` | Emits when the user cancels the loading request. Completes when the request ends, without emitting if it wasn't cancelled. |
314
+ | `id` (read-only) | `string` | Unique request identifier. |
315
+
316
+ **Methods**
317
+
318
+ | Signature | Description |
319
+ | --- | --- |
320
+ | `close(): void` | Idempotently closes the request and releases target leases. |
321
+ | `update(update: SpinnerUpdate): void` | Dynamically updates `text`, `appearance`, or `size`. |
322
+
323
+ #### `SpinnerCancelOptions`
324
+
325
+ | Name | Type |
326
+ | --- | --- |
327
+ | `onCancel?` | `() => void` |
328
+ | `text?` | `string` |
329
+
330
+ #### `SpinnerOptions`
331
+
332
+ | Name | Type |
333
+ | --- | --- |
334
+ | `appearance?` | `SpinnerAppearance` |
335
+ | `cancellable?` | `boolean \| SpinnerCancelOptions` |
336
+ | `delay?` | `number` |
337
+ | `id?` | `string` |
338
+ | `minimumVisibleDuration?` | `number` |
339
+ | `size?` | `SpinnerSize` |
340
+ | `target?` | `HTMLElement \| ElementRef<HTMLElement> \| readonly (HTMLElement \| ElementRef<HTMLElement>)[]` |
341
+ | `text?` | `string` |
342
+ | `zIndex?` | `number` |
343
+
344
+ #### `SpinnerUpdate`
345
+
346
+ | Name | Type |
347
+ | --- | --- |
348
+ | `appearance?` | `SpinnerAppearance` |
349
+ | `size?` | `SpinnerSize` |
350
+ | `text?` | `string` |
351
+
352
+ #### `SpinnerAppearance`
353
+
354
+ ```typescript
355
+ type SpinnerAppearance = "default" | "pulsing" | "pulsing-triad" | "pulsing-ring" | "converging-spinner";
356
+ ```
357
+
358
+ #### `SpinnerSize`
359
+
360
+ ```typescript
361
+ type SpinnerSize = "small" | "medium" | "large";
362
+ ```
363
+
364
+ #### `ClassInputType`
365
+
366
+ From `@nanahoshi/mona-ui/common`.
367
+
368
+ ```typescript
369
+ type ClassInputType = string | string[] | Record<string, unknown> | null | undefined;
370
+ ```