@nanahoshi/mona-ui 0.25.1 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/README.md +2 -0
  2. package/chart/README.md +2 -2
  3. package/command/package.json +4 -0
  4. package/docs/auto-complete.md +733 -0
  5. package/docs/avatar.md +220 -0
  6. package/docs/breadcrumb.md +320 -0
  7. package/docs/button-group.md +392 -0
  8. package/docs/button.md +256 -0
  9. package/docs/calendar.md +515 -0
  10. package/docs/card.md +292 -0
  11. package/docs/chart-bar.md +714 -0
  12. package/docs/chart-financial.md +567 -0
  13. package/docs/chart-funnel.md +546 -0
  14. package/docs/chart-heatmap.md +535 -0
  15. package/docs/chart-line-area.md +462 -0
  16. package/docs/chart-pie.md +645 -0
  17. package/docs/chart-radar.md +518 -0
  18. package/docs/chart-radial.md +658 -0
  19. package/docs/chart-scatter.md +479 -0
  20. package/docs/chart-treemap.md +651 -0
  21. package/docs/chart.md +2465 -0
  22. package/docs/checkbox.md +374 -0
  23. package/docs/chip.md +339 -0
  24. package/docs/circular-progress-bar.md +287 -0
  25. package/docs/collapsible.md +308 -0
  26. package/docs/color-gradient.md +336 -0
  27. package/docs/color-palette.md +317 -0
  28. package/docs/color-picker.md +387 -0
  29. package/docs/combo-box.md +764 -0
  30. package/docs/command.md +582 -0
  31. package/docs/contextmenu.md +530 -0
  32. package/docs/date-picker.md +251 -0
  33. package/docs/datetime-picker.md +284 -0
  34. package/docs/decimal-textbox.md +260 -0
  35. package/docs/dialog.md +822 -0
  36. package/docs/dropdown-button.md +507 -0
  37. package/docs/dropdown-list.md +779 -0
  38. package/docs/editor.md +374 -0
  39. package/docs/expansion-panel.md +348 -0
  40. package/docs/fieldset.md +217 -0
  41. package/docs/forms.md +162 -0
  42. package/docs/grid.md +2053 -0
  43. package/docs/input.md +197 -0
  44. package/docs/installation.md +54 -0
  45. package/docs/introduction.md +46 -0
  46. package/docs/label.md +340 -0
  47. package/docs/list-box.md +637 -0
  48. package/docs/list-view.md +584 -0
  49. package/docs/menubar.md +559 -0
  50. package/docs/multi-select.md +765 -0
  51. package/docs/notification.md +460 -0
  52. package/docs/numeric-textbox.md +301 -0
  53. package/docs/otp-input.md +539 -0
  54. package/docs/pager.md +513 -0
  55. package/docs/placeholder.md +176 -0
  56. package/docs/popover.md +423 -0
  57. package/docs/popup-menu.md +658 -0
  58. package/docs/popup.md +617 -0
  59. package/docs/progress-bar.md +368 -0
  60. package/docs/radio-button.md +451 -0
  61. package/docs/range-slider.md +367 -0
  62. package/docs/rating.md +518 -0
  63. package/docs/scroll-view.md +375 -0
  64. package/docs/segmented.md +434 -0
  65. package/docs/sheet.md +348 -0
  66. package/docs/sidebar.md +1126 -0
  67. package/docs/skeleton.md +181 -0
  68. package/docs/slider.md +423 -0
  69. package/docs/spinner.md +370 -0
  70. package/docs/split-button.md +522 -0
  71. package/docs/splitter.md +342 -0
  72. package/docs/stepper.md +539 -0
  73. package/docs/switch.md +340 -0
  74. package/docs/tabs.md +542 -0
  75. package/docs/textarea.md +196 -0
  76. package/docs/textbox.md +332 -0
  77. package/docs/theming.md +403 -0
  78. package/docs/time-picker.md +254 -0
  79. package/docs/tooltip-directive.md +340 -0
  80. package/docs/tooltip.md +321 -0
  81. package/docs/tree-view.md +1018 -0
  82. package/docs/window.md +663 -0
  83. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  84. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  85. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  86. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  87. package/fesm2022/nanahoshi-mona-ui-chart.mjs +212 -66
  88. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  89. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  90. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  91. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  92. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  93. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  94. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  95. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  96. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  97. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  98. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  99. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  100. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  101. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  102. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  103. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  104. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  105. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  106. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  107. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  108. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  109. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  111. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  112. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  113. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  114. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  118. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  119. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  120. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  121. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  122. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  123. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  124. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  125. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  126. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  127. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  128. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  129. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  130. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  131. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  132. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  133. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  134. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  135. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  136. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  137. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  138. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  139. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  140. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  141. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  142. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  143. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  144. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  145. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  146. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  147. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  148. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  149. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  150. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  151. package/i18n/catalogs/en-US.messages.json +10 -0
  152. package/internal/popup-menu/package.json +4 -0
  153. package/llms.txt +133 -0
  154. package/locales/ar-sa/ar-sa.messages.json +10 -0
  155. package/locales/de-de/de-de.messages.json +10 -0
  156. package/locales/es-es/es-es.messages.json +10 -0
  157. package/locales/fr-fr/fr-fr.messages.json +10 -0
  158. package/locales/id-id/id-id.messages.json +10 -0
  159. package/locales/it-it/it-it.messages.json +10 -0
  160. package/locales/ja-jp/ja-jp.messages.json +10 -0
  161. package/locales/ko-kr/ko-kr.messages.json +10 -0
  162. package/locales/pt-br/pt-br.messages.json +10 -0
  163. package/locales/ru-ru/ru-ru.messages.json +10 -0
  164. package/locales/tr-tr/tr-tr.messages.json +10 -0
  165. package/locales/zh-cn/zh-cn.messages.json +10 -0
  166. package/locales/zh-tw/zh-tw.messages.json +10 -0
  167. package/package.json +9 -1
  168. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  169. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  170. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  171. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  172. package/types/nanahoshi-mona-ui-chart.d.ts +250 -20
  173. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  174. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  175. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  176. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  177. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  178. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  179. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  180. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  181. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  182. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  183. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  184. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  185. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  186. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  187. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  188. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  189. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  190. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  191. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  192. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  193. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  194. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  195. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  196. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  197. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  198. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  201. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  202. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  203. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  204. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  205. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  206. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  207. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  208. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  209. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  210. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  211. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  212. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  213. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  214. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  215. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  216. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  217. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  218. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  219. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  220. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  221. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  222. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  223. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  224. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  225. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  226. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  227. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  228. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  229. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  230. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  231. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  232. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  233. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
package/docs/chip.md ADDED
@@ -0,0 +1,339 @@
1
+ # Chip
2
+
3
+ > A compact label that can be selected, removed or given a prefix.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/chip`
6
+
7
+ **Selector:** `mona-chip`
8
+
9
+ `ChipComponent` renders a compact inline label element that optionally supports toggle selection, a remove button, and a prefix template slot.
10
+
11
+ ## Overview
12
+
13
+ `ChipComponent` is a compact label element used to represent filterable tags, toggleable options, removable selections, or navigation chips. It supports three content modes — a `label` input string, projected content via `<ng-content>`, or a mix of both with an optional prefix template — and three optional behaviors: toggle selection, removability, and RouterLink navigation.
14
+
15
+ When `toggleable` is `true`, each activation flips the `selected` model. When `removable` is `true`, a remove button appears inside the chip. Both behaviors can be combined.
16
+
17
+ **Use the chip when you need to:**
18
+
19
+ - Display removable tags in a tag input or multiselect
20
+ - Represent filterable categories that the user can toggle on and off
21
+ - Show selectable option badges in a compact collection (skill tags, interest categories)
22
+ - Label entities with an optional avatar or icon prefix (contact chips)
23
+ - Render compact, styled navigation items with `[routerLink]`
24
+
25
+ **Do not use when:**
26
+
27
+ - A standalone action button is needed — use `<button monaButton>` instead
28
+
29
+ ## Import & Quick Start
30
+
31
+ ```typescript
32
+ import { ChipComponent } from "@nanahoshi/mona-ui/chip";
33
+ // Optional: only needed when adding a prefix template
34
+ import { ChipPrefixTemplateDirective } from "@nanahoshi/mona-ui/chip";
35
+ ```
36
+
37
+ Add the imported symbols to your standalone component's `imports` array.
38
+
39
+ **Display chip:**
40
+
41
+ ```html
42
+ <mona-chip label="Angular"></mona-chip>
43
+ ```
44
+
45
+ **RouterLink navigation chip:**
46
+
47
+ ```html
48
+ <mona-chip label="Overview" [routerLink]="['/overview']"></mona-chip>
49
+ ```
50
+
51
+ Add `RouterLink` from `@angular/router` to the same `imports` array.
52
+
53
+ **Custom padding & class override:**
54
+
55
+ ```html
56
+ <mona-chip label="Custom Padding" class="px-6 py-2"></mona-chip>
57
+ ```
58
+
59
+ When `label` is non-empty it takes precedence over projected content — both are not visible at the same time.
60
+
61
+ > **Keyboard access:** Chips receive `tabindex="0"` automatically when `toggleable` is `true` or when functioning as a link (`[routerLink]`). Passive chips and removable-only chips aren't focusable, leaving keyboard access directly on the child remove button.
62
+
63
+ ## Examples
64
+
65
+ ### Filter chips
66
+
67
+ With `toggleable`, each activation flips `selected`, which supports two-way binding.
68
+
69
+ `filters-example.component.ts`
70
+
71
+ ```typescript
72
+ import { Component, computed, signal } from "@angular/core";
73
+ import { ChipComponent } from "@nanahoshi/mona-ui/chip";
74
+
75
+ @Component({
76
+ selector: "app-chip-filters-example",
77
+ imports: [ChipComponent],
78
+ templateUrl: "./filters-example.component.html"
79
+ })
80
+ export class ChipFiltersExampleComponent {
81
+ protected readonly assignedToMe = signal(false);
82
+ protected readonly open = signal(true);
83
+ protected readonly summary = computed(() => {
84
+ const filters = [
85
+ this.open() ? "Open" : "",
86
+ this.assignedToMe() ? "Assigned to me" : "",
87
+ this.urgent() ? "Urgent" : ""
88
+ ].filter(Boolean);
89
+ return filters.length ? filters.join(", ") : "none";
90
+ });
91
+ protected readonly urgent = signal(false);
92
+ }
93
+ ```
94
+
95
+ `filters-example.component.html`
96
+
97
+ ```html
98
+ <div class="flex flex-col gap-3">
99
+ <div class="flex flex-wrap gap-2" role="group" aria-label="Filter issues">
100
+ <mona-chip label="Open" [toggleable]="true" [(selected)]="open"></mona-chip>
101
+ <mona-chip label="Assigned to me" [toggleable]="true" [(selected)]="assignedToMe"></mona-chip>
102
+ <mona-chip label="Urgent" look="error" [toggleable]="true" [(selected)]="urgent"></mona-chip>
103
+ </div>
104
+ <p class="text-sm">Filters: {{ summary() }}</p>
105
+ </div>
106
+ ```
107
+
108
+ ### Removing chips from a list
109
+
110
+ `remove` fires for the remove button and for Delete and Backspace on the chip. The chip doesn't remove itself: your parent destroys it, and focus goes with it, so a keyboard user lands at the top of the page unless you move it. There's no `mona-chip-list` to do this for you. Move focus in the handler, to the next chip or, as here, to the control that adds chips.
111
+
112
+ `removable-example.component.ts`
113
+
114
+ ```typescript
115
+ import { Component, signal } from "@angular/core";
116
+ import { ChipComponent } from "@nanahoshi/mona-ui/chip";
117
+ import { TextBoxDirective } from "@nanahoshi/mona-ui/text-box";
118
+
119
+ @Component({
120
+ selector: "app-chip-removable-example",
121
+ imports: [ChipComponent, TextBoxDirective],
122
+ templateUrl: "./removable-example.component.html"
123
+ })
124
+ export class ChipRemovableExampleComponent {
125
+ protected readonly tags = signal(["Angular", "Signals", "Accessibility"]);
126
+
127
+ protected addTag(tagInput: HTMLInputElement): void {
128
+ const tag = tagInput.value.trim();
129
+ if (tag && !this.tags().includes(tag)) {
130
+ this.tags.update(tags => [...tags, tag]);
131
+ }
132
+ tagInput.value = "";
133
+ }
134
+
135
+ protected removeTag(tag: string, tagInput: HTMLInputElement): void {
136
+ this.tags.update(tags => tags.filter(item => item !== tag));
137
+ tagInput.focus();
138
+ }
139
+ }
140
+ ```
141
+
142
+ `removable-example.component.html`
143
+
144
+ ```html
145
+ <div class="flex max-w-sm flex-col gap-3">
146
+ <div class="flex flex-wrap gap-2">
147
+ @for (tag of tags(); track tag) {
148
+ <mona-chip [label]="tag" [removable]="true" (remove)="removeTag(tag, tagInput)"></mona-chip>
149
+ }
150
+ </div>
151
+ <label class="text-sm" for="chip-removable-tag">Add a tag</label>
152
+ <input
153
+ #tagInput
154
+ id="chip-removable-tag"
155
+ monaTextBox
156
+ placeholder="Type and press Enter"
157
+ type="text"
158
+ (keydown.enter)="addTag(tagInput)" />
159
+ </div>
160
+ ```
161
+
162
+ ### Prefix and projected content
163
+
164
+ The prefix template renders before the label or projected content. It receives no template context. Without a `label`, the chip shows its projected content.
165
+
166
+ `prefix-example.component.ts`
167
+
168
+ ```typescript
169
+ import { Component } from "@angular/core";
170
+ import { LucideTag } from "@lucide/angular";
171
+ import { AvatarComponent } from "@nanahoshi/mona-ui/avatar";
172
+ import { ChipComponent, ChipPrefixTemplateDirective } from "@nanahoshi/mona-ui/chip";
173
+
174
+ @Component({
175
+ selector: "app-chip-prefix-example",
176
+ imports: [AvatarComponent, ChipComponent, ChipPrefixTemplateDirective, LucideTag],
177
+ templateUrl: "./prefix-example.component.html"
178
+ })
179
+ export class ChipPrefixExampleComponent {}
180
+ ```
181
+
182
+ `prefix-example.component.html`
183
+
184
+ ```html
185
+ <div class="flex flex-wrap items-center gap-2">
186
+ <mona-chip label="Jane Smith" rounded="full">
187
+ <ng-template monaChipPrefixTemplate>
188
+ <mona-avatar
189
+ borderRadius="50%"
190
+ label="JS"
191
+ labelFontSize="0.5rem"
192
+ [borderWidth]="0"
193
+ [height]="18"
194
+ [width]="18"></mona-avatar>
195
+ </ng-template>
196
+ </mona-chip>
197
+ <mona-chip look="outline">
198
+ <svg lucideTag aria-hidden="true" [size]="12"></svg>
199
+ Draft
200
+ </mona-chip>
201
+ </div>
202
+ ```
203
+
204
+ ## Appearance & Styling
205
+
206
+ ### Look variants
207
+
208
+ | `look` | Appearance |
209
+ |-------------|----------------------------------------------------|
210
+ | `default` | Background with border; adapts to the active theme |
211
+ | `outline` | Transparent background with border |
212
+ | `primary` | Filled primary color |
213
+ | `secondary` | Filled secondary color |
214
+ | `success` | Filled success color |
215
+ | `error` | Filled error color |
216
+ | `warning` | Filled warning color |
217
+ | `info` | Filled info color |
218
+ | `ghost` | No background or border; hover reveals background |
219
+
220
+ ### Sizes
221
+
222
+ | `size` | Description |
223
+ |----------|----------------------------|
224
+ | `small` | Compact padding |
225
+ | `medium` | Standard padding (default) |
226
+ | `large` | Generous padding |
227
+
228
+ The remove button dimensions scale automatically with `size`.
229
+
230
+ ### Rounded presets
231
+
232
+ | `rounded` | Shape |
233
+ |-----------|--------------------------------|
234
+ | `none` | No rounding |
235
+ | `small` | Slight rounding |
236
+ | `medium` | Moderate rounding (default) |
237
+ | `large` | Strong rounding |
238
+ | `full` | Pill / fully rounded |
239
+
240
+ ### Selected state
241
+
242
+ Each `look` value applies a distinct selected appearance when `selected` is `true`: a shifted background tone and a border in the text's color, which also shows in forced colors. Without `toggleable`, `selected` is only a look, with no state for assistive technology.
243
+
244
+ ### Custom classes
245
+
246
+ ```html
247
+ <mona-chip label="Tag" class="font-bold tracking-wide"></mona-chip>
248
+ <mona-chip label="Custom Padding" class="px-6 py-2"></mona-chip>
249
+ ```
250
+
251
+ Classes passed via `class` are merged with variant classes using `tailwind-merge`. Consumer utilities override Mona UI defaults (e.g. `class="px-6 py-2"` replaces default size padding). Targeted logical side utilities (such as `ps-*` and `pe-*`) can be used for RTL-aware edge specialization.
252
+
253
+ ## Behavior
254
+
255
+ - **Content projection:** default slot for chip body content; use `<ng-template monaChipPrefixTemplate>` for prefix content rendered before the label.
256
+
257
+ ## Accessibility
258
+
259
+ The following attributes are managed automatically on the host element:
260
+
261
+ | Attribute | When present | Value |
262
+ |-----------------|------------------------------------------------|--------------------------------------|
263
+ | `aria-label` | `aria-label` is non-empty | Value of the `aria-label` input. Text in `label` reads itself, so it isn't copied. |
264
+ | `aria-checked` | `toggleable` is `true` | `"true"` or `"false"` |
265
+ | `aria-disabled` | `disabled` is `true`, on a chip with a role | `"true"` |
266
+ | `role` | `toggleable` is `true` | `"checkbox"` |
267
+ | `role` | A `[routerLink]`, and not `toggleable` | `"link"` |
268
+ | `role` | Passive, with an `aria-label` | `"group"` |
269
+ | `tabindex` | Interactive, or set by the input | `0` when interactive, `-1` when disabled |
270
+
271
+ **Toggleable or link, and removable:** an interactive role makes its children presentational, which would hide the remove button. So the host is a `role="group"`, and an inner element holds the `checkbox` or `link` role, `aria-checked`, `aria-disabled`, `aria-label` and `tabindex`, beside the remove button.
272
+
273
+ **Remove button:** When `removable` is `true`, the remove button inside the chip has an automatically computed accessible label: `"Remove, <label>"` using the `label` input or `aria-label`, or `"Remove, item"` with neither. Override this with the `removeLabel` input.
274
+
275
+ The remove button's target is 24 by 24 pixels at every size, though its icon is smaller.
276
+
277
+ | Key | Action |
278
+ |-----|--------|
279
+ | `Enter`, `Space` | Toggles a toggleable chip, once while held. Space doesn't scroll the page. |
280
+ | `Enter` | Follows a link chip. |
281
+ | `Delete`, `Backspace` | Removes a removable chip, also from its remove button. |
282
+
283
+ A control you project into a chip keeps its own clicks and keys, and doesn't toggle the chip. When focus is on the remove button, Enter and Space activate only that button.
284
+
285
+ **Consumer responsibilities:**
286
+
287
+ - When `removable` is `true` and no `label` is set, provide `[removeLabel]` or `[aria-label]` so the remove button carries a meaningful accessible label. It warns in development otherwise.
288
+ - Move focus after removing a chip (see "Removing chips from a list").
289
+ - For icon-only or purely visual chips, set `[aria-label]` to describe what the chip represents.
290
+
291
+ ## API
292
+
293
+ Everything below is imported from `@nanahoshi/mona-ui/chip`.
294
+
295
+ ### `ChipComponent`
296
+
297
+ **Selector:** `mona-chip`
298
+
299
+ #### Inputs
300
+
301
+ | Name | Type | Default | Description |
302
+ | --- | --- | --- | --- |
303
+ | `aria-label` | `string` | `""` | Accessible name of the chip, for one whose text doesn't describe it, such as an icon. On a chip with no other role, it makes the chip a named group. |
304
+ | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
305
+ | `disabled` | `boolean` | `false` | Renders the chip with reduced visual emphasis and removes pointer interaction. |
306
+ | `label` | `string` | `""` | Text label displayed inside the chip. When non-empty, takes precedence over projected content. |
307
+ | `look` | `"default" \| "error" \| "ghost" \| "info" \| "outline" \| "primary" \| "secondary" \| "success" \| "warning"` | `"default"` | Visual style variant controlling the chip's background color, border, and interaction states. |
308
+ | `removable` | `boolean` | `false` | Renders a remove button inside the chip. When activated, emits the `remove` output. |
309
+ | `removeLabel` | `string` | `undefined` | Accessible label for the remove button, overriding the auto-computed `"Remove, <label>"` fallback. A chip with only projected content needs this or `aria-label`, or it warns in development. |
310
+ | `removeTabIndex` | `number \| string` | `0` | Tab index for the remove button, independent of the chip host's own tabindex. Set to `-1` to exclude the remove button from tab order, since Delete and Backspace on the chip also remove it. |
311
+ | `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the chip. |
312
+ | `selected` (two-way) | `boolean` | `false` | Whether the chip is selected. When `toggleable` is `true`, each activation flips this value. Supports two-way binding via `[(selected)]`. Without `toggleable`, it's only a look, with no state for assistive technology. |
313
+ | `size` | `"large" \| "medium" \| "small"` | `"medium"` | Size preset controlling the chip's padding and remove button dimensions. |
314
+ | `tabindex` | `number \| string` | `undefined` | Tab index override for the chip host element. When not set, computed automatically: `0` when `toggleable` is `true` or functioning as a link, not focusable otherwise. Overridden to `-1` when `disabled` is `true`. |
315
+ | `toggleable` | `boolean` | `false` | Enables toggle behavior. When `true`, each activation flips `selected` and the host receives `role="checkbox"` with `aria-checked`. With `removable`, the host is a `group` instead, and an inner element is the checkbox, beside the remove button. |
316
+ | `value` | `unknown` | `undefined` | Arbitrary value associated with this chip. The chip doesn't use it or emit it, so to tell which chip was removed, pass the item in your `(remove)` handler. |
317
+
318
+ #### Outputs
319
+
320
+ | Name | Type | Description |
321
+ | --- | --- | --- |
322
+ | `contentClick` | `void` | Emitted when a toggleable chip body is activated via click, Enter, or Space. Not emitted when the remove button is activated or for non-toggleable chips. |
323
+ | `remove` | `Event` | Emitted when the remove button is clicked, or Delete or Backspace is pressed on the chip. Only fires when `removable` is `true`. Emits the originating `Event`. The chip can't keep focus once its parent destroys it, so move focus to the next chip or the list here. |
324
+ | `selectedChange` | `boolean` | Emitted when `selected` changes. |
325
+
326
+ ### `ChipPrefixTemplateDirective`
327
+
328
+ Apply to an `<ng-template>` directly inside `<mona-chip>` to render prefix content
329
+ (e.g., an avatar or icon) before the chip label or projected content. The template receives no context.
330
+
331
+ **Selector:** `ng-template[monaChipPrefixTemplate]`
332
+
333
+ ### Types
334
+
335
+ #### `CHIP_DEFAULT_MESSAGES`
336
+
337
+ ```typescript
338
+ const CHIP_DEFAULT_MESSAGES: { removeLabel: (label?: string) => string; };
339
+ ```
@@ -0,0 +1,287 @@
1
+ # Circular Progress Bar
2
+
3
+ > A circular progress indicator with an optional custom label.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/circular-progress-bar`
6
+
7
+ **Selector:** `mona-circular-progress-bar`
8
+
9
+ `CircularProgressBarComponent` renders a circular SVG progress indicator with configurable value range, size, stroke thickness, color, and an optional custom label template.
10
+
11
+ ## Overview
12
+
13
+ The circular progress bar communicates a quantified progress value within an explicit range. An indeterminate mode plays a continuous rotation animation for tasks where the completion value is unknown, or a slow fade under `prefers-reduced-motion`.
14
+
15
+ **Use `CircularProgressBarComponent` when you need to:**
16
+
17
+ - Show a compact, self-contained progress indicator in a card, dashboard cell, or list item
18
+ - Communicate upload, download, or calculation progress in a round visual form
19
+ - Display an indeterminate spinner while waiting for an operation of unknown duration
20
+
21
+ **Use `ProgressBarComponent` instead when:**
22
+
23
+ - A horizontal bar fits the layout better
24
+
25
+ ## Import & Quick Start
26
+
27
+ ```typescript
28
+ import { CircularProgressBarComponent } from "@nanahoshi/mona-ui/circular-progress-bar";
29
+ ```
30
+
31
+ Add `CircularProgressBarComponent` to your standalone component's `imports` array.
32
+
33
+ **Determinate progress** — bind `value` and optionally `min` / `max`:
34
+
35
+ ```html
36
+ <mona-circular-progress-bar
37
+ [value]="uploadPercent"
38
+ aria-label="Upload progress">
39
+ </mona-circular-progress-bar>
40
+ ```
41
+
42
+ ## Examples
43
+
44
+ ### Size, thickness and color
45
+
46
+ `color` takes a 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.
47
+
48
+ `sizes-example.component.ts`
49
+
50
+ ```typescript
51
+ import { Component } from "@angular/core";
52
+ import { CircularProgressBarComponent } from "@nanahoshi/mona-ui/circular-progress-bar";
53
+
54
+ @Component({
55
+ selector: "app-circular-progress-bar-sizes-example",
56
+ imports: [CircularProgressBarComponent],
57
+ templateUrl: "./sizes-example.component.html"
58
+ })
59
+ export class CircularProgressBarSizesExampleComponent {
60
+ protected quotaColor = (percent: number): string => (percent >= 90 ? "#b91c1c" : "#4338ca");
61
+ }
62
+ ```
63
+
64
+ `sizes-example.component.html`
65
+
66
+ ```html
67
+ <div class="flex flex-wrap items-center gap-6">
68
+ <mona-circular-progress-bar aria-label="Profile complete" [size]="60" [thickness]="4" [value]="40"></mona-circular-progress-bar>
69
+ <mona-circular-progress-bar aria-label="Storage used" [color]="quotaColor" [value]="72"></mona-circular-progress-bar>
70
+ <mona-circular-progress-bar aria-label="Monthly quota used" [color]="quotaColor" [size]="140" [thickness]="10" [value]="94"></mona-circular-progress-bar>
71
+ </div>
72
+ ```
73
+
74
+ ### Indeterminate
75
+
76
+ Use it when the completion percentage is unknown. Set `aria-valuetext` so screen readers announce a state.
77
+
78
+ `indeterminate-example.component.ts`
79
+
80
+ ```typescript
81
+ import { Component } from "@angular/core";
82
+ import { CircularProgressBarComponent } from "@nanahoshi/mona-ui/circular-progress-bar";
83
+
84
+ @Component({
85
+ selector: "app-circular-progress-bar-indeterminate-example",
86
+ imports: [CircularProgressBarComponent],
87
+ templateUrl: "./indeterminate-example.component.html"
88
+ })
89
+ export class CircularProgressBarIndeterminateExampleComponent {}
90
+ ```
91
+
92
+ `indeterminate-example.component.html`
93
+
94
+ ```html
95
+ <mona-circular-progress-bar
96
+ aria-label="Syncing files"
97
+ aria-valuetext="Loading"
98
+ [indeterminate]="true"
99
+ [size]="64"></mona-circular-progress-bar>
100
+ ```
101
+
102
+ ### Custom range and label
103
+
104
+ `min` and `max` default to 0 / 100 but accept any numeric range. `ng-template[monaCircularProgressBarLabelTemplate]` replaces the percentage inside the circle.
105
+
106
+ `label-example.component.ts`
107
+
108
+ ```typescript
109
+ import { Component, signal } from "@angular/core";
110
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
111
+ import {
112
+ CircularProgressBarComponent,
113
+ CircularProgressBarLabelTemplateDirective
114
+ } from "@nanahoshi/mona-ui/circular-progress-bar";
115
+
116
+ @Component({
117
+ selector: "app-circular-progress-bar-label-example",
118
+ imports: [ButtonDirective, CircularProgressBarComponent, CircularProgressBarLabelTemplateDirective],
119
+ templateUrl: "./label-example.component.html"
120
+ })
121
+ export class CircularProgressBarLabelExampleComponent {
122
+ protected readonly done = signal(3);
123
+ protected readonly total = 8;
124
+
125
+ protected completeTask(): void {
126
+ this.done.update(done => Math.min(done + 1, this.total));
127
+ }
128
+ }
129
+ ```
130
+
131
+ `label-example.component.html`
132
+
133
+ ```html
134
+ <div class="flex items-center gap-4">
135
+ <mona-circular-progress-bar
136
+ aria-label="Tasks done"
137
+ [aria-valuetext]="done() + ' of ' + total + ' tasks'"
138
+ [max]="total"
139
+ [value]="done()">
140
+ <ng-template monaCircularProgressBarLabelTemplate let-max="max" let-value>
141
+ <span class="text-xs font-semibold">{{ value }} / {{ max }}</span>
142
+ </ng-template>
143
+ </mona-circular-progress-bar>
144
+ <button monaButton type="button" [disabled]="done() === total" (click)="completeTask()">Complete a task</button>
145
+ </div>
146
+ ```
147
+
148
+ ## Appearance & Styling
149
+
150
+ ### Size
151
+
152
+ The `size` input controls the outer dimension of the SVG in pixels. Both width and height are set to the same value.
153
+
154
+ | `size` value | Rendered size |
155
+ |--------------|------------------------|
156
+ | `60` | 60 × 60 px |
157
+ | `100` | 100 × 100 px (default) |
158
+ | `160` | 160 × 160 px |
159
+
160
+ ### Stroke thickness
161
+
162
+ `thickness` controls the stroke width of both the track and the progress arc in pixels. The stroke fits inside `size`, so increasing it reduces the effective radius. The default of `6` suits most sizes; reduce it for small sizes or increase it for bold indicators.
163
+
164
+ ### Color
165
+
166
+ When `color` is empty the arc color falls back to `var(--color-primary)`. The track (the full circle behind the arc) always uses the `var(--color-surface-muted)` design token.
167
+
168
+ ### Visual states
169
+
170
+ | State | Appearance |
171
+ |---------------|---------------------------------------------------------------|
172
+ | Default | Arc rendered at `value` percentage of the circumference |
173
+ | Indeterminate | Arc rendered as a fixed partial stroke, rotating continuously, or fading under `prefers-reduced-motion` |
174
+ | Disabled | Reduced opacity, non-interactive |
175
+
176
+ ### Track animation
177
+
178
+ When `animate` is `true` (the default), the arc transitions its fill and color on each value change. Set `[animate]="false"` to disable all transitions — useful when updating `value` at high frequency (e.g., a real-time byte counter).
179
+
180
+ ### Custom class
181
+
182
+ Merge additional Tailwind or custom classes onto the host element via the `class` attribute:
183
+
184
+ ```html
185
+ <mona-circular-progress-bar [value]="75" class="shadow-md" aria-label="Upload progress"></mona-circular-progress-bar>
186
+ ```
187
+
188
+ ### Custom label template
189
+
190
+ By default the component renders the percentage inside the circle, formatted for the locale, such as `40%`, `33,33 %` in German or `%40` in Turkish. Hide it with `[labelVisible]="false"`, or replace it with `ng-template[monaCircularProgressBarLabelTemplate]` for full control, as in the custom label example.
191
+
192
+ The template context exposes four variables:
193
+
194
+ | Variable | Type | Description |
195
+ |-------------|----------|----------------------------------------------|
196
+ | `$implicit` | `number` | The raw `value` input — use `let-value` |
197
+ | `min` | `number` | The raw `min` input |
198
+ | `max` | `number` | The raw `max` input |
199
+ | `percent` | `number` | Computed percentage (0–100, rounded to 2 dp) |
200
+
201
+ The label is hidden in indeterminate mode. Importing the context type:
202
+
203
+ ```typescript
204
+ import type { LabelTemplateContext } from "@nanahoshi/mona-ui/circular-progress-bar";
205
+ ```
206
+
207
+ ## Accessibility
208
+
209
+ The host element carries `role="progressbar"`. The component manages the following ARIA attributes automatically:
210
+
211
+ | Attribute | When present | Value |
212
+ |-----------------|--------------------|------------------|
213
+ | `aria-label` | Always | The `aria-label` input, or the localized "Progress" |
214
+ | `aria-valuemin` | Determinate mode | Bound to `min` |
215
+ | `aria-valuemax` | Determinate mode | Bound to `max` |
216
+ | `aria-valuenow` | Determinate mode | `value`, clamped to the range. A non-finite value counts as `min`, the same place the ring draws it. |
217
+ | `aria-disabled` | `disabled` is true | `true` |
218
+
219
+ With a range that holds nothing, where `max` isn't above `min`, the ring reports no values and a warning is logged in development.
220
+
221
+ Consumer responsibilities:
222
+
223
+ - Set `aria-label`, or `aria-labelledby`, which takes precedence, to name what the indicator measures (e.g., `"Upload progress"`). "Progress" is only a fallback, and it doesn't tell two apart.
224
+ - Set `aria-valuetext` in indeterminate mode to provide a localized state announcement (e.g., `"Loading"`) so screen readers announce state rather than silence.
225
+
226
+ ## API
227
+
228
+ Everything below is imported from `@nanahoshi/mona-ui/circular-progress-bar`.
229
+
230
+ ### `CircularProgressBarComponent`
231
+
232
+ **Selector:** `mona-circular-progress-bar`
233
+
234
+ #### Inputs
235
+
236
+ | Name | Type | Default | Description |
237
+ | --- | --- | --- | --- |
238
+ | `animate` | `boolean` | `true` | Enables CSS transitions on stroke and color changes. Set to `false` when updating `value` at a high frequency. |
239
+ | `aria-label` | `string` | `""` | Accessible name for the host element. Describe what the component represents (e.g., "Upload progress"). When empty, falls back to the localized "Progress". An `aria-labelledby` on the host takes precedence over both. |
240
+ | `aria-valuetext` | `string` | `""` | Human-readable override for the `aria-valuenow` announcement. 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. |
241
+ | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
242
+ | `color` | `string \| Action<number, string>` | `""` | Accent color. Pass a CSS color string, or a function receiving the current percentage (0–100) and returning a string. When empty, falls back to the primary theme color. |
243
+ | `disabled` | `boolean` | `false` | Renders the component with reduced visual emphasis and removes pointer interaction. |
244
+ | `indeterminate` | `boolean` | `false` | Activates indeterminate mode when the completion value is unknown. ARIA value attributes are removed. |
245
+ | `labelVisible` | `boolean` | `true` | Controls label visibility in determinate mode. Has no effect in indeterminate mode, where the label is always hidden. |
246
+ | `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. |
247
+ | `min` | `number` | `0` | Lower bound of the value range. |
248
+ | `size` | `number` | `100` | Diameter of the indicator in pixels. Controls both width and height of the host element. |
249
+ | `thickness` | `number` | `6` | Stroke width of the circular track in pixels. |
250
+ | `value` | `number` | `0` | Current progress value within `[min, max]`. Values outside the range are clamped, for the ring and for `aria-valuenow`; non-finite values count as `min`. |
251
+
252
+ ### `CircularProgressBarLabelTemplateDirective`
253
+
254
+ Structural template directive that replaces the default percentage label inside the circle. The template is hidden
255
+ when `indeterminate` is `true`.
256
+
257
+ **Selector:** `ng-template[monaCircularProgressBarLabelTemplate]`
258
+
259
+ #### Template context
260
+
261
+ | Name | Type |
262
+ | --- | --- |
263
+ | `$implicit` | `number` |
264
+ | `max` | `number` |
265
+ | `min` | `number` |
266
+ | `percent` | `number` |
267
+
268
+ ### Types
269
+
270
+ #### `LabelTemplateContext`
271
+
272
+ | Name | Type |
273
+ | --- | --- |
274
+ | `$implicit` | `number` |
275
+ | `max` | `number` |
276
+ | `min` | `number` |
277
+ | `percent` | `number` |
278
+
279
+ #### `Action`
280
+
281
+ From `@nanahoshi/mona-ui/common`.
282
+
283
+ A function taking a `P` and returning an `R`.
284
+
285
+ ```typescript
286
+ type Action<P = void, R = void> = (arg: P) => R;
287
+ ```