@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
package/docs/sheet.md ADDED
@@ -0,0 +1,348 @@
1
+ # Sheet
2
+
3
+ > A modal panel attached to an edge of the viewport.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/sheet`
6
+
7
+ **Selector:** `mona-sheet`
8
+
9
+ `SheetComponent` displays a modal panel attached to an edge of the viewport, with an optional title, description, and close button, plus projected content.
10
+
11
+ ## Overview
12
+
13
+ Sheet displays a modal panel attached to an edge of the viewport, with an optional title, description, and close button, plus projected content. It is built on `PopupService` internally, like every other Mona UI overlay.
14
+
15
+ `SheetComponent` (`<mona-sheet>`) is declarative only — there is no `SheetService`. Place it behind an `@if` in your template; the sheet opens after the first render and closes when the host element is destroyed or when the consumer closes it.
16
+
17
+ **Use `Sheet` when:**
18
+
19
+ - The overlay should slide in from a viewport edge (`top`, `right`, `bottom`, or `left`) instead of appearing centered
20
+ - The content is mobile navigation, filters, a form, or a configuration panel
21
+
22
+ **Use `Dialog` instead when:**
23
+
24
+ - You need a modal confirmation, message, or short form centered in the viewport, with a title/description/actions layout and built-in action-button wiring
25
+
26
+ **Use `Window` instead when:**
27
+
28
+ - The user needs to drag, resize, minimize, or maximize the overlay
29
+
30
+ **Use `Popup` directly when:**
31
+
32
+ - You need a custom anchored overlay with no title/header structure at all
33
+
34
+ ## Import & Quick Start
35
+
36
+ ```typescript
37
+ import { SheetComponent } from "@nanahoshi/mona-ui/sheet";
38
+ ```
39
+
40
+ ```html
41
+ <button monaButton (click)="sheetOpen.set(true)">Edit profile</button>
42
+
43
+ @if (sheetOpen()) {
44
+ <mona-sheet title="Edit profile" description="Make changes to your profile." (closed)="sheetOpen.set(false)">
45
+ <form>…</form>
46
+ </mona-sheet>
47
+ }
48
+ ```
49
+
50
+ `SheetComponent` opens automatically once its host renders; there is no explicit `open()` call.
51
+
52
+ ## Examples
53
+
54
+ ### Editing in a sheet
55
+
56
+ The field is copied when the sheet opens, and only saved back when the user saves.
57
+
58
+ `form-example.component.ts`
59
+
60
+ ```typescript
61
+ import { Component, signal } from "@angular/core";
62
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
63
+ import { LabelComponent } from "@nanahoshi/mona-ui/label";
64
+ import { SheetComponent } from "@nanahoshi/mona-ui/sheet";
65
+ import { TextBoxComponent } from "@nanahoshi/mona-ui/text-box";
66
+
67
+ @Component({
68
+ selector: "app-sheet-form-example",
69
+ imports: [ButtonDirective, LabelComponent, SheetComponent, TextBoxComponent],
70
+ templateUrl: "./form-example.component.html"
71
+ })
72
+ export class SheetFormExampleComponent {
73
+ protected readonly draft = signal("");
74
+ protected readonly name = signal("Grace Hopper");
75
+ protected readonly open = signal(false);
76
+
77
+ protected edit(): void {
78
+ this.draft.set(this.name());
79
+ this.open.set(true);
80
+ }
81
+
82
+ protected save(): void {
83
+ this.name.set(this.draft());
84
+ this.open.set(false);
85
+ }
86
+ }
87
+ ```
88
+
89
+ `form-example.component.html`
90
+
91
+ ```html
92
+ <div class="flex items-center gap-3">
93
+ <button monaButton type="button" (click)="edit()">Edit profile</button>
94
+ <span class="text-sm">Name: {{ name() }}</span>
95
+ </div>
96
+
97
+ @if (open()) {
98
+ <mona-sheet description="Changes show once you save them." title="Edit profile" (closed)="open.set(false)">
99
+ <div class="flex flex-col gap-2 px-4">
100
+ <mona-label for="sheet-profile-name">Display name</mona-label>
101
+ <mona-text-box inputId="sheet-profile-name" [(value)]="draft" />
102
+ <div class="flex justify-end gap-2 pt-2">
103
+ <button monaButton type="button" (click)="open.set(false)">Cancel</button>
104
+ <button monaButton look="primary" type="button" (click)="save()">Save changes</button>
105
+ </div>
106
+ </div>
107
+ </mona-sheet>
108
+ }
109
+ ```
110
+
111
+ ### Side
112
+
113
+ `side` accepts `"top" | "right" | "bottom" | "left" | "start" | "end"` and defaults to `"right"`. `left` and `right` are physical edges in every direction; `start` and `end` follow the text direction, so `start` opens from the left in left-to-right pages and from the right in right-to-left ones. The border always faces the page. Left and right sheets default to `min(100dvw, 24rem)` wide and `100dvh` high; top and bottom sheets default to `100dvw` wide with automatic height capped at `90dvh`.
114
+
115
+ ### Mobile bottom sheet
116
+
117
+ `bottom-example.component.ts`
118
+
119
+ ```typescript
120
+ import { Component, signal } from "@angular/core";
121
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
122
+ import { SheetComponent } from "@nanahoshi/mona-ui/sheet";
123
+
124
+ @Component({
125
+ selector: "app-sheet-bottom-example",
126
+ imports: [ButtonDirective, SheetComponent],
127
+ templateUrl: "./bottom-example.component.html"
128
+ })
129
+ export class SheetBottomExampleComponent {
130
+ protected readonly categories = ["Books", "Music", "Games", "Electronics", "Garden"];
131
+ protected readonly open = signal(false);
132
+ }
133
+ ```
134
+
135
+ `bottom-example.component.html`
136
+
137
+ ```html
138
+ <button monaButton type="button" (click)="open.set(true)">Filters</button>
139
+
140
+ @if (open()) {
141
+ <mona-sheet
142
+ description="Narrow the displayed results."
143
+ height="min(90dvh, 24rem)"
144
+ side="bottom"
145
+ title="Filters"
146
+ (closed)="open.set(false)">
147
+ <div class="flex flex-col gap-3 px-4 pb-4">
148
+ <p class="text-sm font-medium">Category</p>
149
+ <div class="flex flex-wrap gap-2">
150
+ @for (category of categories; track category) {
151
+ <button monaButton size="small" type="button" [toggleable]="true">{{ category }}</button>
152
+ }
153
+ </div>
154
+ <button monaButton class="self-end" look="primary" type="button" (click)="open.set(false)">Show results</button>
155
+ </div>
156
+ </mona-sheet>
157
+ }
158
+ ```
159
+
160
+ Large projected content scrolls inside the Sheet while its header and close button remain in place. The page behind it cannot scroll while the sheet is open. Width and height values based on `dvw`/`dvh` adapt when mobile browser chrome or device orientation changes.
161
+
162
+ ### Custom projected content
163
+
164
+ Any Angular content can be projected. If a visible title is not appropriate, provide `aria-label` so the sheet still has an accessible name — Sheet content must have either a `title` or an `aria-label`. This sheet has no close button, so it closes on Escape, a backdrop click, or choosing a page.
165
+
166
+ `navigation-example.component.ts`
167
+
168
+ ```typescript
169
+ import { Component, signal } from "@angular/core";
170
+ import { LucideMenu } from "@lucide/angular";
171
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
172
+ import { SheetComponent } from "@nanahoshi/mona-ui/sheet";
173
+
174
+ @Component({
175
+ selector: "app-sheet-navigation-example",
176
+ imports: [ButtonDirective, LucideMenu, SheetComponent],
177
+ templateUrl: "./navigation-example.component.html"
178
+ })
179
+ export class SheetNavigationExampleComponent {
180
+ protected readonly current = signal("Home");
181
+ protected readonly open = signal(false);
182
+ protected readonly pages = ["Home", "Orders", "Customers", "Settings"];
183
+
184
+ /** Stands in for the router, so the example stays on this page. */
185
+ protected go(event: Event, page: string): void {
186
+ event.preventDefault();
187
+ this.current.set(page);
188
+ this.open.set(false);
189
+ }
190
+ }
191
+ ```
192
+
193
+ `navigation-example.component.html`
194
+
195
+ ```html
196
+ <button monaButton aria-label="Open menu" type="button" [iconOnly]="true" (click)="open.set(true)">
197
+ <svg lucideMenu aria-hidden="true" [size]="16"></svg>
198
+ </button>
199
+
200
+ @if (open()) {
201
+ <mona-sheet aria-label="Main navigation" side="start" width="16rem" [closable]="false" (closed)="open.set(false)">
202
+ <nav aria-label="Main" class="flex flex-col gap-1 p-4">
203
+ @for (page of pages; track page) {
204
+ <a class="rounded-md px-2 py-1.5 text-sm hover:bg-accent" href="/" (click)="go($event, page)">{{ page }}</a>
205
+ }
206
+ </nav>
207
+ </mona-sheet>
208
+ }
209
+ <p class="mt-2 text-sm">Current page: {{ current() }}</p>
210
+ ```
211
+
212
+ ### Preventing a close
213
+
214
+ ```typescript
215
+ protected onSheetClose(event: PopupCloseEvent): void {
216
+ if (this.hasUnsavedChanges()) {
217
+ event.preventDefault();
218
+ }
219
+ }
220
+ ```
221
+
222
+ ```html
223
+ <mona-sheet (close)="onSheetClose($event)"> </mona-sheet>
224
+ ```
225
+
226
+ ## Behavior
227
+
228
+ ### `side` is fixed once the sheet opens
229
+
230
+ `side` is read once, on the first render, and fixes the viewport edge the sheet is attached to, the direction it slides in and out, and the edge its border is on. `start` and `end` are resolved against the direction at that moment. Changing `side` or the direction on an open sheet has no effect — close the sheet and reopen it.
231
+
232
+ Every other input is live: `title`, `description`, `aria-label`, and `closable` re-render as usual, `width` and `height` resize the open sheet, and `closeOnEscape` and `closeOnBackdropClick` apply from the moment they change.
233
+
234
+ ### `close` fires for every close path
235
+
236
+ `close` emits for the close (X) button, the Escape key, and a backdrop click. Call `event.preventDefault()` synchronously inside a `close` handler to cancel any of these, the same way `PopupRef.beforeClose` works (see the Popup documentation's [Preventing a close](popup.md#preventing-a-close) section, since Sheet is built on the same mechanism).
237
+
238
+ ### Scroll blocking
239
+
240
+ Sheet blocks scrolling of the page behind it for as long as it is open, regardless of `side`. The rest of the page is also `inert` until the sheet starts closing, so a pointer, Tab, or a screen reader can't reach it; popups opened from inside the sheet stay usable.
241
+
242
+ ## Forms Integration
243
+
244
+ Sheet is a container, not a form control, so it has no form integration.
245
+
246
+ ## Accessibility
247
+
248
+ ### Keyboard
249
+
250
+ The Escape key requests a close when `closeOnEscape` is `true` (the default).
251
+
252
+ ### Focus
253
+
254
+ Sheet traps focus inside itself for as long as it is open — Tab and Shift+Tab cannot move focus to the rest of the page. Focus is restored to the previously focused element when the sheet closes.
255
+
256
+ ### ARIA
257
+
258
+ | Attribute | When present | Value |
259
+ |--------------------|--------------------------------|-------------------------------|
260
+ | `role` | Always | `"dialog"` |
261
+ | `aria-modal` | Always | `"true"` |
262
+ | `aria-labelledby` | Only when `title` is set | ID of the title element |
263
+ | `aria-describedby` | Only when `description` is set | ID of the description element |
264
+ | `aria-label` | Only when `title` is absent | The `aria-label` input |
265
+
266
+ Sheet content must have either a `title` or an `aria-label` so that the modal has an accessible name. In development mode, a sheet without one logs a warning.
267
+
268
+ ## API
269
+
270
+ Everything below is imported from `@nanahoshi/mona-ui/sheet`.
271
+
272
+ ### `SheetComponent`
273
+
274
+ **Selector:** `mona-sheet`
275
+
276
+ #### Inputs
277
+
278
+ | Name | Type | Default | Description |
279
+ | --- | --- | --- | --- |
280
+ | `aria-label` | `string \| undefined` | `undefined` | Accessible name used when no visible title is provided. |
281
+ | `class` | `ClassInputType` | `undefined` | Additional CSS classes merged onto the sheet panel via `tailwind-merge`. |
282
+ | `closable` | `boolean` | `true` | Whether the close button is displayed. |
283
+ | `closeOnBackdropClick` | `boolean` | `true` | Whether clicking the backdrop requests that the sheet close. |
284
+ | `closeOnEscape` | `boolean` | `true` | Whether pressing Escape requests that the sheet close. |
285
+ | `description` | `string` | — | Supporting text displayed below the title. |
286
+ | `height` | `number \| string` | — | Explicit sheet height. Numbers are interpreted as pixels. |
287
+ | `messages` | `Partial<SheetMessages>` | — | Internationalization message overrides for accessible labels. |
288
+ | `side` | `SheetSide` | `"right"` | Edge of the viewport from which the sheet opens. `left` and `right` are physical; `start` and `end` follow the direction (`start` is the left edge in LTR and the right edge in RTL). The edge is fixed once the sheet opens. |
289
+ | `title` | `string` | — | Title displayed in the sheet header and used as its accessible name. |
290
+ | `width` | `number \| string` | — | Explicit sheet width. Numbers are interpreted as pixels. |
291
+
292
+ #### Outputs
293
+
294
+ | Name | Type | Description |
295
+ | --- | --- | --- |
296
+ | `close` | `PopupCloseEvent<unknown>` | Emitted before the sheet closes. Call preventDefault() to keep it open. |
297
+ | `closed` | `void` | Emitted after the leave animation completes and the popup is disposed. |
298
+
299
+ ### Types
300
+
301
+ #### `SHEET_DEFAULT_MESSAGES`
302
+
303
+ ```typescript
304
+ const SHEET_DEFAULT_MESSAGES: MonaSheetMessages;
305
+ ```
306
+
307
+ #### `SheetPhysicalSide`
308
+
309
+ A side resolved to a physical edge.
310
+
311
+ ```typescript
312
+ type SheetPhysicalSide = "bottom" | "left" | "right" | "top";
313
+ ```
314
+
315
+ #### `SheetSide`
316
+
317
+ Edge the sheet opens from. `left` and `right` are physical, whatever the direction; `start` and `end` follow it
318
+ (`start` is the left edge in LTR and the right edge in RTL).
319
+
320
+ ```typescript
321
+ type SheetSide = "bottom" | "end" | "left" | "right" | "start" | "top";
322
+ ```
323
+
324
+ #### `ClassInputType`
325
+
326
+ From `@nanahoshi/mona-ui/common`.
327
+
328
+ ```typescript
329
+ type ClassInputType = string | string[] | Record<string, unknown> | null | undefined;
330
+ ```
331
+
332
+ #### `MonaSheetMessages`
333
+
334
+ From `@nanahoshi/mona-ui/i18n`.
335
+
336
+ | Name | Type |
337
+ | --- | --- |
338
+ | `closeSheet` (read-only) | `string` |
339
+
340
+ #### `SheetMessages`
341
+
342
+ From `@nanahoshi/mona-ui/i18n`.
343
+
344
+ ```typescript
345
+ type SheetMessages = MonaSheetMessages;
346
+ ```
347
+
348
+ **Documented elsewhere:** [`PopupCloseEvent`](popup.md)