@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
@@ -0,0 +1,348 @@
1
+ # Expansion Panel
2
+
3
+ > A header that shows and hides its content, designed to stack with other panels.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/expansion-panel`
6
+
7
+ **Selectors:** `mona-expansion-panel` · `mona-accordion`
8
+
9
+ `ExpansionPanelComponent` is a disclosure component that shows a clickable header and hides its content until the panel is expanded — designed to stack vertically with adjacent panels sharing a seamless border, and to work as an accordion inside `mona-accordion`.
10
+
11
+ ## Overview
12
+
13
+ `ExpansionPanelComponent` renders a header bar and a collapsible content region. The header's title and icon are a native button that fills the row, so clicking it, or pressing `Enter` or `Space` on it, toggles the `expanded` state. Controls from the actions template sit beside that button, not inside it. The expand/collapse animation is driven by a CSS grid-row transition with no JavaScript involvement at runtime.
14
+
15
+ When multiple panels are stacked directly adjacent to one another, the component's border styles stitch the group into a visually continuous block: non-last panels suppress their bottom border and bottom radius, and non-first panels suppress their top radius. That's only how they look: each panel still opens on its own. For one panel open at a time and arrow keys between the headers, wrap them in `AccordionComponent`.
16
+
17
+ **Use `ExpansionPanelComponent` when you need to:**
18
+
19
+ - Collapse optional detail content inside a form, settings page, or record view
20
+ - Build an accordion, with `mona-accordion`, where items expand in place
21
+ - Group and hide a block of secondary information behind a labelled header
22
+
23
+ ## Import & Quick Start
24
+
25
+ ```typescript
26
+ import { ExpansionPanelComponent } from "@nanahoshi/mona-ui/expansion-panel";
27
+ ```
28
+
29
+ Add `ExpansionPanelComponent` to your standalone component's `imports` array.
30
+
31
+ **Minimal panel with a string title:**
32
+
33
+ ```html
34
+ <mona-expansion-panel title="Details">
35
+ <p>Content shown when expanded.</p>
36
+ </mona-expansion-panel>
37
+ ```
38
+
39
+ **Accordion** — `mona-accordion` keeps one panel open at a time, and `Up`, `Down`, `Home` and `End` move between the headers. Add `multiple` to let several stay open. It comes from the same entry point:
40
+
41
+ ```typescript
42
+ import { AccordionComponent, ExpansionPanelComponent } from "@nanahoshi/mona-ui/expansion-panel";
43
+ ```
44
+
45
+ **Stacked panels** — placed directly adjacent with no wrapper, panels look like one block, with the border and radius stitching applied automatically, and each one opens independently.
46
+
47
+ **Content isn't lazy** — what you project is created with the panel and stays alive while it's collapsed. For heavy content, render it yourself once the panel has opened:
48
+
49
+ ```html
50
+ <mona-expansion-panel title="Report" [(expanded)]="reportOpen">
51
+ @if (reportOpen()) {
52
+ <app-report></app-report>
53
+ }
54
+ </mona-expansion-panel>
55
+ ```
56
+
57
+ **Heading level** — each header is a heading, level 3 by default. Set `headingLevel` to fit the page's outline, from 1 to 6, or to `null` for no heading. Anything else counts as 3:
58
+
59
+ ```html
60
+ <h2>Settings</h2>
61
+ <mona-expansion-panel title="Notifications" [headingLevel]="3">...</mona-expansion-panel>
62
+ ```
63
+
64
+ ## Examples
65
+
66
+ ### Accordion
67
+
68
+ Opening one panel closes the one that was open.
69
+
70
+ `accordion-example.component.ts`
71
+
72
+ ```typescript
73
+ import { Component } from "@angular/core";
74
+ import { AccordionComponent, ExpansionPanelComponent } from "@nanahoshi/mona-ui/expansion-panel";
75
+
76
+ @Component({
77
+ selector: "app-expansion-panel-accordion-example",
78
+ imports: [AccordionComponent, ExpansionPanelComponent],
79
+ templateUrl: "./accordion-example.component.html"
80
+ })
81
+ export class ExpansionPanelAccordionExampleComponent {
82
+ protected readonly questions = [
83
+ { answer: "Orders ship within two working days.", title: "When will my order ship?" },
84
+ { answer: "You can return an item within 30 days of delivery.", title: "Can I return an item?" },
85
+ { answer: "We accept cards and bank transfers.", title: "How can I pay?" }
86
+ ];
87
+ }
88
+ ```
89
+
90
+ `accordion-example.component.html`
91
+
92
+ ```html
93
+ <mona-accordion>
94
+ @for (question of questions; track question.title) {
95
+ <mona-expansion-panel [title]="question.title">
96
+ <p class="p-3 text-sm">{{ question.answer }}</p>
97
+ </mona-expansion-panel>
98
+ }
99
+ </mona-accordion>
100
+ ```
101
+
102
+ ### Opening from code
103
+
104
+ `expanded` is a two-way model, so a control outside the panel can open and close it.
105
+
106
+ `controlled-example.component.ts`
107
+
108
+ ```typescript
109
+ import { Component, signal } from "@angular/core";
110
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
111
+ import { ExpansionPanelComponent } from "@nanahoshi/mona-ui/expansion-panel";
112
+
113
+ @Component({
114
+ selector: "app-expansion-panel-controlled-example",
115
+ imports: [ButtonDirective, ExpansionPanelComponent],
116
+ templateUrl: "./controlled-example.component.html"
117
+ })
118
+ export class ExpansionPanelControlledExampleComponent {
119
+ protected readonly detailsOpen = signal(false);
120
+ }
121
+ ```
122
+
123
+ `controlled-example.component.html`
124
+
125
+ ```html
126
+ <div class="flex flex-col gap-3">
127
+ <button monaButton class="self-start" type="button" (click)="detailsOpen.set(!detailsOpen())">
128
+ {{ detailsOpen() ? "Hide" : "Show" }} shipping details
129
+ </button>
130
+ <mona-expansion-panel title="Shipping details" [(expanded)]="detailsOpen">
131
+ <dl class="grid grid-cols-2 gap-1 p-3 text-sm">
132
+ <dt>Carrier</dt>
133
+ <dd>Northwind Freight</dd>
134
+ <dt>Tracking number</dt>
135
+ <dd>NW-482-117</dd>
136
+ </dl>
137
+ </mona-expansion-panel>
138
+ </div>
139
+ ```
140
+
141
+ ### Header actions and icon
142
+
143
+ A button in the actions template sits beside the header's toggle, so clicking it doesn't open the panel. The icon template gets the expanded state as `let-expanded`.
144
+
145
+ `header-templates-example.component.ts`
146
+
147
+ ```typescript
148
+ import { Component, signal } from "@angular/core";
149
+ import { LucideChevronDown, LucideSettings } from "@lucide/angular";
150
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
151
+ import {
152
+ ExpansionPanelActionsTemplateDirective,
153
+ ExpansionPanelComponent,
154
+ ExpansionPanelIconTemplateDirective
155
+ } from "@nanahoshi/mona-ui/expansion-panel";
156
+
157
+ @Component({
158
+ selector: "app-expansion-panel-header-templates-example",
159
+ imports: [
160
+ ButtonDirective,
161
+ ExpansionPanelActionsTemplateDirective,
162
+ ExpansionPanelComponent,
163
+ ExpansionPanelIconTemplateDirective,
164
+ LucideChevronDown,
165
+ LucideSettings
166
+ ],
167
+ templateUrl: "./header-templates-example.component.html"
168
+ })
169
+ export class ExpansionPanelHeaderTemplatesExampleComponent {
170
+ protected readonly settingsClicks = signal(0);
171
+ }
172
+ ```
173
+
174
+ `header-templates-example.component.html`
175
+
176
+ ```html
177
+ <div class="flex flex-col gap-3">
178
+ <mona-expansion-panel title="Notifications">
179
+ <ng-template monaExpansionPanelActionsTemplate>
180
+ <button
181
+ monaButton
182
+ aria-label="Notification settings"
183
+ look="ghost"
184
+ size="small"
185
+ type="button"
186
+ [iconOnly]="true"
187
+ (click)="settingsClicks.set(settingsClicks() + 1)">
188
+ <svg lucideSettings aria-hidden="true" [size]="14"></svg>
189
+ </button>
190
+ </ng-template>
191
+ <ng-template let-expanded monaExpansionPanelIconTemplate>
192
+ <svg class="mx-2 transition-transform" lucideChevronDown aria-hidden="true" [class.rotate-180]="expanded" [size]="16"></svg>
193
+ </ng-template>
194
+ <p class="p-3 text-sm">Email me when someone mentions me or replies to my comment.</p>
195
+ </mona-expansion-panel>
196
+ <p aria-live="polite" class="text-sm">Settings opened {{ settingsClicks() }} times</p>
197
+ </div>
198
+ ```
199
+
200
+ ## Appearance & Styling
201
+
202
+ ### Rounded presets
203
+
204
+ | `rounded` | Shape |
205
+ |-----------|------------------------|
206
+ | `none` | Square corners |
207
+ | `small` | `rounded-sm` |
208
+ | `medium` | `rounded-md` (default) |
209
+ | `large` | `rounded-lg` |
210
+
211
+ When panels are stacked, border-radius is only visible on the first panel's top corners and the last panel's bottom corners. The `rounded` value must be consistent across all panels in a stack for the stitching to look correct.
212
+
213
+ ### Disabled state
214
+
215
+ Set `disabled` to disable the header's button. The header renders with reduced visual emphasis and leaves the tab order, and the controls in the actions template are made inert along with it.
216
+
217
+ ### Content animation
218
+
219
+ The content region uses `grid-rows-[0fr]` (collapsed) → `grid-rows-[1fr]` (expanded) with an ease-out CSS transition. Its duration is the theme's `--mona-motion-standard`, which is 300 ms in the Mona theme. No JavaScript is involved in the animation, and it's switched off for `prefers-reduced-motion`.
220
+
221
+ ### Custom classes
222
+
223
+ Pass `class` to merge additional CSS classes onto the host element through `tailwind-merge`.
224
+
225
+ ### Template slots
226
+
227
+ Three `ng-template` directives customize the header:
228
+
229
+ | Slot | Selector | Replaces |
230
+ |------------------|--------------------------------------------------|-------------------------------------------------|
231
+ | Title template | `ng-template[monaExpansionPanelTitleTemplate]` | The string `title` inside the header's button |
232
+ | Actions template | `ng-template[monaExpansionPanelActionsTemplate]` | Injected beside the button, between title and icon |
233
+ | Icon template | `ng-template[monaExpansionPanelIconTemplate]` | The default plus/minus icon |
234
+
235
+ **Title template** — replace the string title. It renders inside the button, so it can hold text, icons and images, but not controls: put those in the actions template.
236
+
237
+ ```html
238
+ <mona-expansion-panel>
239
+ <ng-template monaExpansionPanelTitleTemplate>
240
+ <span class="uppercase text-sm font-semibold">Advanced options</span>
241
+ </ng-template>
242
+ <p>Panel content.</p>
243
+ </mona-expansion-panel>
244
+ ```
245
+
246
+ **Actions template** — inject controls into the header. They sit beside the toggle button, so their clicks and keys are their own, and nothing has to stop them from reaching it. See [Header actions and icon](#header-actions-and-icon).
247
+
248
+ **Icon template** — replace the default plus/minus toggle icon. The template context exposes `$implicit` as the current boolean expanded state (`let-expanded`), as in the same example.
249
+
250
+ ## Accessibility
251
+
252
+ The header's button is native, so a click, `Enter` and `Space` all work as a button's do, and it follows the [WAI-ARIA accordion pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/). A panel needs a `title` or a title template with text, or its button has no name, which is warned about in development.
253
+
254
+ | Element | Attribute | When present | Value |
255
+ |----------------|-------------------|---------------------------|--------------------------------------------------|
256
+ | Heading | `role` | Unless `headingLevel` is `null` | `"heading"` |
257
+ | Heading | `aria-level` | Unless `headingLevel` is `null` | `headingLevel`, 3 by default |
258
+ | Button | `aria-expanded` | Always | Reflects the current `expanded` state |
259
+ | Button | `aria-controls` | Always | The content region's generated `id` |
260
+ | Button | `disabled` | When `disabled` is `true` | Present |
261
+ | Button | `aria-disabled` | When `disabled` is `true` | `"true"` |
262
+ | Actions | `inert` | When `disabled` is `true` | Present |
263
+ | Content region | `role` | Always | `"region"` |
264
+ | Content region | `aria-labelledby` | Always | The button's `id` |
265
+ | Content region | `aria-hidden` | Always | `"true"` when collapsed, `"false"` when expanded |
266
+ | Content region | `inert` | When collapsed | Present (blocks focus from entering) |
267
+
268
+ **Keyboard in `mona-accordion`** (when a header has focus):
269
+
270
+ | Key | Action |
271
+ |---------------------|-----------------------------------------------------------|
272
+ | `ArrowDown` / `ArrowUp` | Move focus to the next or previous enabled header, wrapping around. Doesn't toggle. |
273
+ | `Home` / `End` | Move focus to the first or last enabled header. |
274
+ | `Enter` / `Space` | Toggle the panel, as without the accordion. |
275
+
276
+ ## API
277
+
278
+ Everything below is imported from `@nanahoshi/mona-ui/expansion-panel`.
279
+
280
+ ### `ExpansionPanelComponent`
281
+
282
+ **Selector:** `mona-expansion-panel`
283
+
284
+ #### Inputs
285
+
286
+ | Name | Type | Default | Description |
287
+ | --- | --- | --- | --- |
288
+ | `class` | `string` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
289
+ | `disabled` | `boolean` | `false` | Disables the header: toggling by click or key, and the actions in it. |
290
+ | `expanded` (two-way) | `boolean` | `false` | Sets whether the expansion panel is expanded or collapsed. |
291
+ | `headingLevel` | `number \| null` | `3` | The level of the heading around the header's button, from 1 to 6. Set it to fit the page's outline, or to `null` for no heading. |
292
+ | `rounded` | `"large" \| "medium" \| "none" \| "small"` | `"medium"` | Sets the border radius of the expansion panel. |
293
+ | `title` | `string` | `""` | Sets the title of the expansion panel, which also names its button and region. |
294
+
295
+ #### Outputs
296
+
297
+ | Name | Type | Description |
298
+ | --- | --- | --- |
299
+ | `expandedChange` | `boolean` | Emitted when `expanded` changes. |
300
+
301
+ #### Properties
302
+
303
+ | Name | Type | Description |
304
+ | --- | --- | --- |
305
+ | `animate` (read-only) | `Signal<boolean>` | Always enabled. Satisfies the `CollapsibleConfig` contract for `monaCollapsibleTrigger`; this component doesn't use `monaCollapsibleContent`, so no animation ever consults it. |
306
+
307
+ #### Methods
308
+
309
+ | Signature | Description |
310
+ | --- | --- |
311
+ | `collapse(): void` | Collapses the panel, even when `disabled`. |
312
+ | `expand(): void` | Expands the panel, even when `disabled`. |
313
+ | `focus(): void` | Moves focus to the panel's header button. |
314
+ | `toggle(): void` | Toggles the panel, unless it's `disabled`. |
315
+
316
+ ### `AccordionComponent`
317
+
318
+ Groups `mona-expansion-panel` elements: only one is open at a time unless `multiple` is set, and Up, Down, Home and End
319
+ move between their headers. Adds no role of its own, as the pattern asks: each panel brings its heading and region.
320
+
321
+ **Selector:** `mona-accordion`
322
+
323
+ #### Inputs
324
+
325
+ | Name | Type | Default | Description |
326
+ | --- | --- | --- | --- |
327
+ | `multiple` | `boolean` | `false` | Lets several panels stay open. Without it, opening a panel closes the others, however it was opened. |
328
+
329
+ ### `ExpansionPanelActionsTemplateDirective`
330
+
331
+ Injects content beside the header's button, between the title and the toggle icon. Its controls are the application's
332
+ own: their clicks and keys don't reach the button, and they need their own accessible names. The template has no
333
+ context variables.
334
+
335
+ **Selector:** `ng-template[monaExpansionPanelActionsTemplate]`
336
+
337
+ ### `ExpansionPanelIconTemplateDirective`
338
+
339
+ Replaces the default plus/minus toggle icon.
340
+
341
+ **Selector:** `ng-template[monaExpansionPanelIconTemplate]`
342
+
343
+ ### `ExpansionPanelTitleTemplateDirective`
344
+
345
+ Replaces the string `title` in the header's button with projected content. It can't hold controls, since it's inside
346
+ a button. The template has no context variables.
347
+
348
+ **Selector:** `ng-template[monaExpansionPanelTitleTemplate]`
@@ -0,0 +1,217 @@
1
+ # Fieldset
2
+
3
+ > Groups related form controls under a labelled border.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/fieldset`
6
+
7
+ **Selector:** `mona-fieldset`
8
+
9
+ `FieldsetComponent` wraps a native `<fieldset>` and `<legend>` to visually and semantically group related form controls under a labelled border.
10
+
11
+ ## Overview
12
+
13
+ `FieldsetComponent` renders a styled native `<fieldset>` element. The component provides Mona UI theming for the border and legend notch without replacing the underlying HTML semantics — screen readers still announce the legend as the accessible group label for all form controls projected inside.
14
+
15
+ The legend is hidden entirely when neither `legend` nor `monaFieldsetLegendTemplate` is provided, avoiding an empty `<legend>` element in the DOM.
16
+
17
+ **Use `FieldsetComponent` when you need to:**
18
+
19
+ - Group related form controls (inputs, checkboxes, radios) under a shared visible label
20
+ - Communicate to assistive technology that a set of fields belongs together
21
+ - Add a bordered, themed container around a form section
22
+
23
+ **Do not use `FieldsetComponent` when:**
24
+
25
+ - The grouping is purely visual with no form controls — a plain `<div>` or a card component is more appropriate; `<fieldset>` carries form semantics AT will announce
26
+
27
+ ## Import & Quick Start
28
+
29
+ ```typescript
30
+ import { FieldsetComponent } from "@nanahoshi/mona-ui/fieldset";
31
+ ```
32
+
33
+ Add `FieldsetComponent` to your standalone component's `imports` array.
34
+
35
+ **Basic usage with a string legend:**
36
+
37
+ ```html
38
+ <mona-fieldset legend="Personal information">
39
+ <div class="p-4 flex flex-col gap-3">
40
+ <input monaTextBox placeholder="First name" aria-label="First name" />
41
+ <input monaTextBox placeholder="Last name" aria-label="Last name" />
42
+ </div>
43
+ </mona-fieldset>
44
+ ```
45
+
46
+ > **Accessibility note:** Provide `legend` or `monaFieldsetLegendTemplate`. Without a legend, name the group with `aria-label` or `aria-labelledby`. A `<fieldset>` with no name offers no benefit over a plain `<div>`.
47
+
48
+ ## Examples
49
+
50
+ ### Custom legend
51
+
52
+ `monaFieldsetLegendTemplate` replaces the string legend with any content. The legend's own surface, border and padding aren't applied to a template, so style it yourself.
53
+
54
+ `legend-template-example.component.ts`
55
+
56
+ ```typescript
57
+ import { Component } from "@angular/core";
58
+ import { LucideCreditCard } from "@lucide/angular";
59
+ import { FieldsetComponent, FieldsetLegendTemplateDirective } from "@nanahoshi/mona-ui/fieldset";
60
+ import { LabelComponent } from "@nanahoshi/mona-ui/label";
61
+ import { TextBoxComponent } from "@nanahoshi/mona-ui/text-box";
62
+
63
+ @Component({
64
+ selector: "app-fieldset-legend-template-example",
65
+ imports: [FieldsetComponent, FieldsetLegendTemplateDirective, LabelComponent, LucideCreditCard, TextBoxComponent],
66
+ templateUrl: "./legend-template-example.component.html"
67
+ })
68
+ export class FieldsetLegendTemplateExampleComponent {}
69
+ ```
70
+
71
+ `legend-template-example.component.html`
72
+
73
+ ```html
74
+ <mona-fieldset class="max-w-md">
75
+ <ng-template monaFieldsetLegendTemplate>
76
+ <span class="flex items-center gap-2 px-2 font-semibold">
77
+ <svg lucideCreditCard aria-hidden="true" [size]="16"></svg>
78
+ Billing address
79
+ </span>
80
+ </ng-template>
81
+ <div class="flex flex-col gap-3 p-4">
82
+ <mona-label text="Street">
83
+ <mona-text-box />
84
+ </mona-label>
85
+ <mona-label text="Postal code">
86
+ <mona-text-box />
87
+ </mona-label>
88
+ </div>
89
+ </mona-fieldset>
90
+ ```
91
+
92
+ ### Disabling a section
93
+
94
+ `disabled` disables the controls inside it. The switch stays outside the fieldset, so it stays enabled. "Disabled state" below lists which controls follow it and its limits.
95
+
96
+ `disabled-example.component.ts`
97
+
98
+ ```typescript
99
+ import { Component, signal } from "@angular/core";
100
+ import { CheckBoxComponent } from "@nanahoshi/mona-ui/check-box";
101
+ import { FieldsetComponent } from "@nanahoshi/mona-ui/fieldset";
102
+ import { LabelComponent } from "@nanahoshi/mona-ui/label";
103
+ import { SwitchComponent } from "@nanahoshi/mona-ui/switch";
104
+ import { TextBoxComponent } from "@nanahoshi/mona-ui/text-box";
105
+
106
+ @Component({
107
+ selector: "app-fieldset-disabled-example",
108
+ imports: [CheckBoxComponent, FieldsetComponent, LabelComponent, SwitchComponent, TextBoxComponent],
109
+ templateUrl: "./disabled-example.component.html"
110
+ })
111
+ export class FieldsetDisabledExampleComponent {
112
+ protected readonly sameAsBilling = signal(true);
113
+ }
114
+ ```
115
+
116
+ `disabled-example.component.html`
117
+
118
+ ```html
119
+ <div class="flex max-w-md flex-col gap-3">
120
+ <mona-label text="Ship to my billing address">
121
+ <mona-switch [(checked)]="sameAsBilling" />
122
+ </mona-label>
123
+ <mona-fieldset legend="Shipping address" [disabled]="sameAsBilling()">
124
+ <div class="flex flex-col gap-3 p-4">
125
+ <mona-label text="Street">
126
+ <mona-text-box />
127
+ </mona-label>
128
+ <mona-label text="City">
129
+ <mona-text-box />
130
+ </mona-label>
131
+ <mona-check-box label="Leave at the door" />
132
+ </div>
133
+ </mona-fieldset>
134
+ </div>
135
+ ```
136
+
137
+ ## Appearance & Styling
138
+
139
+ ### Rounded presets
140
+
141
+ | `rounded` | Shape |
142
+ |-----------|------------------------|
143
+ | `none` | Square corners |
144
+ | `small` | `rounded-sm` |
145
+ | `medium` | `rounded-md` (default) |
146
+ | `large` | `rounded-lg` |
147
+ | `full` | `rounded-full` |
148
+
149
+ The `rounded` value applies to both the fieldset border and the legend notch, keeping them visually aligned.
150
+
151
+ ### Legend styling
152
+
153
+ When a plain `legend` string is supplied, the legend notch has a raised surface background, a border, and padding. When `monaFieldsetLegendTemplate` is used, none of that is applied — the consumer controls the appearance entirely.
154
+
155
+ ### Custom class
156
+
157
+ Pass additional classes via the `class` attribute; they are merged onto the rendered `<fieldset>` element via `tailwind-merge`, so they can override the default border, background, or rounding:
158
+
159
+ ```html
160
+ <mona-fieldset legend="Preferences" class="border-primary"></mona-fieldset>
161
+ ```
162
+
163
+ ### Disabled state
164
+
165
+ Set `disabled` to disable the rendered `<fieldset>`, to apply the disabled colors, and to disable the controls inside it.
166
+
167
+ It reaches controls in two ways:
168
+
169
+ - **Native controls** are disabled by the browser, because the rendered `<fieldset>` has the native `disabled` attribute. This covers `monaTextBox`, `monaTextArea`, `monaCheckbox`, `monaRadioButton` and any other native input, select, textarea or button.
170
+ - **Mona UI controls** read the state of the enclosing `mona-fieldset`, at any depth, including nested fieldsets: auto complete, button group, calendar, check box, color gradient, color palette, color picker, combo box, date picker, date-time picker, dropdown list, editor, multi-select, numeric text box, OTP input, radio button, radio group, rating, segmented, slider, range slider, switch, text box, time picker and time selector.
171
+
172
+ It has these limits:
173
+
174
+ - **Other controls:** chip, tree view and the list controls (list box, list view) don't read it. Disable those yourself.
175
+ - **A nested fieldset** shows the disabled colors under a disabled parent, as well as disabling its controls.
176
+ - **The form model:** a signal form field inside stays enabled in the form model, so its validation keeps running. Use the signal forms `disabled` rule when the field itself should be disabled.
177
+ - **The first legend:** the browser leaves native controls in a fieldset's first `<legend>` enabled. Mona UI controls get no such exemption, so one in `monaFieldsetLegendTemplate` is disabled too.
178
+ - **A plain `<fieldset>`:** a native `<fieldset disabled>` you write yourself only reaches native controls. Mona UI controls that draw their own focusable element stay enabled inside it. Use `mona-fieldset` for those.
179
+
180
+ ## Accessibility
181
+
182
+ The component renders a native `<fieldset>`, which has the implicit `group` role. When `legend` or `monaFieldsetLegendTemplate` is set, a native `<legend>` names the group, and screen readers announce it with the controls inside. With no legend, no `<legend>` is rendered, and the `aria-label` and `aria-labelledby` inputs are set on the `<fieldset>` instead of the host.
183
+
184
+ `disabled` sets the native `disabled` attribute on the `<fieldset>`. The component adds no keyboard handling: focus moves through the projected controls in document order.
185
+
186
+ **Consumer responsibilities**
187
+
188
+ - Name the group with `legend`, `monaFieldsetLegendTemplate`, `aria-label` or `aria-labelledby`.
189
+ - Give each control inside its own label. The legend names the group, not the fields.
190
+
191
+ ## API
192
+
193
+ Everything below is imported from `@nanahoshi/mona-ui/fieldset`.
194
+
195
+ ### `FieldsetComponent`
196
+
197
+ **Selector:** `mona-fieldset`
198
+
199
+ #### Inputs
200
+
201
+ | Name | Type | Default | Description |
202
+ | --- | --- | --- | --- |
203
+ | `aria-label` | `string` | `""` | Accessible name of the fieldset when it has no legend. |
204
+ | `aria-labelledby` | `string` | `""` | Id of the element that labels the fieldset when it has no legend. |
205
+ | `class` | `string` | `""` | Additional CSS classes merged onto the rendered `<fieldset>` element via `tailwind-merge`. |
206
+ | `disabled` | `boolean` | `false` | Whether the fieldset and the Mona UI form controls inside it are disabled, including nested fieldsets. Reflected as the native `disabled` attribute on the rendered `<fieldset>`, which also covers native controls. A signal form field inside stays enabled in the form model, so its validation keeps running. |
207
+ | `legend` | `string` | `""` | The legend text of the fieldset. Shown in the top border as a labelled notch. Ignored when `monaFieldsetLegendTemplate` is provided. |
208
+ | `name` | `string \| undefined` | `undefined` | The `name` attribute reflected onto the rendered `<fieldset>` element. |
209
+ | `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the fieldset and its legend. |
210
+
211
+ ### `FieldsetLegendTemplateDirective`
212
+
213
+ Replaces the string `legend` with projected content inside the `<legend>` element. When this template is present, no
214
+ default legend styling is applied — the consumer is responsible for all visual treatment. The template has no context
215
+ variables.
216
+
217
+ **Selector:** `ng-template[monaFieldsetLegendTemplate]`