@nanahoshi/mona-ui 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/command/package.json +4 -0
- package/docs/auto-complete.md +733 -0
- package/docs/avatar.md +220 -0
- package/docs/breadcrumb.md +320 -0
- package/docs/button-group.md +392 -0
- package/docs/button.md +256 -0
- package/docs/calendar.md +515 -0
- package/docs/card.md +292 -0
- package/docs/chart.md +4058 -0
- package/docs/checkbox.md +374 -0
- package/docs/chip.md +339 -0
- package/docs/circular-progress-bar.md +287 -0
- package/docs/collapsible.md +308 -0
- package/docs/color-gradient.md +336 -0
- package/docs/color-palette.md +317 -0
- package/docs/color-picker.md +387 -0
- package/docs/combo-box.md +764 -0
- package/docs/command.md +582 -0
- package/docs/contextmenu.md +530 -0
- package/docs/date-picker.md +251 -0
- package/docs/datetime-picker.md +284 -0
- package/docs/decimal-textbox.md +260 -0
- package/docs/dialog.md +822 -0
- package/docs/dropdown-button.md +507 -0
- package/docs/dropdown-list.md +779 -0
- package/docs/editor.md +374 -0
- package/docs/expansion-panel.md +348 -0
- package/docs/fieldset.md +217 -0
- package/docs/forms.md +162 -0
- package/docs/grid.md +2053 -0
- package/docs/input.md +197 -0
- package/docs/installation.md +54 -0
- package/docs/introduction.md +46 -0
- package/docs/label.md +340 -0
- package/docs/list-box.md +637 -0
- package/docs/list-view.md +584 -0
- package/docs/menubar.md +559 -0
- package/docs/multi-select.md +765 -0
- package/docs/notification.md +460 -0
- package/docs/numeric-textbox.md +301 -0
- package/docs/otp-input.md +539 -0
- package/docs/pager.md +513 -0
- package/docs/placeholder.md +176 -0
- package/docs/popover.md +423 -0
- package/docs/popup-menu.md +658 -0
- package/docs/popup.md +617 -0
- package/docs/progress-bar.md +368 -0
- package/docs/radio-button.md +451 -0
- package/docs/range-slider.md +367 -0
- package/docs/rating.md +518 -0
- package/docs/scroll-view.md +375 -0
- package/docs/segmented.md +434 -0
- package/docs/sheet.md +348 -0
- package/docs/sidebar.md +1126 -0
- package/docs/skeleton.md +181 -0
- package/docs/slider.md +423 -0
- package/docs/spinner.md +370 -0
- package/docs/split-button.md +522 -0
- package/docs/splitter.md +342 -0
- package/docs/stepper.md +539 -0
- package/docs/switch.md +340 -0
- package/docs/tabs.md +542 -0
- package/docs/textarea.md +196 -0
- package/docs/textbox.md +332 -0
- package/docs/theming.md +403 -0
- package/docs/time-picker.md +254 -0
- package/docs/tooltip-directive.md +340 -0
- package/docs/tooltip.md +321 -0
- package/docs/tree-view.md +1018 -0
- package/docs/window.md +663 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-button.mjs +14 -2
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
- package/fesm2022/nanahoshi-mona-ui-chart.mjs +108 -22
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
- package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +7 -3
- package/fesm2022/nanahoshi-mona-ui-segmented.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
- package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +8 -3
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +10 -7
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +53 -21
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
- package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
- package/i18n/catalogs/en-US.messages.json +10 -0
- package/internal/popup-menu/package.json +4 -0
- package/llms.txt +123 -0
- package/locales/ar-sa/ar-sa.messages.json +10 -0
- package/locales/de-de/de-de.messages.json +10 -0
- package/locales/es-es/es-es.messages.json +10 -0
- package/locales/fr-fr/fr-fr.messages.json +10 -0
- package/locales/id-id/id-id.messages.json +10 -0
- package/locales/it-it/it-it.messages.json +10 -0
- package/locales/ja-jp/ja-jp.messages.json +10 -0
- package/locales/ko-kr/ko-kr.messages.json +10 -0
- package/locales/pt-br/pt-br.messages.json +10 -0
- package/locales/ru-ru/ru-ru.messages.json +10 -0
- package/locales/tr-tr/tr-tr.messages.json +10 -0
- package/locales/zh-cn/zh-cn.messages.json +10 -0
- package/locales/zh-tw/zh-tw.messages.json +10 -0
- package/package.json +9 -1
- package/styles.css +12 -2
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
- package/types/nanahoshi-mona-ui-button.d.ts +12 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
- package/types/nanahoshi-mona-ui-chart.d.ts +200 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-command.d.ts +253 -0
- package/types/nanahoshi-mona-ui-common.d.ts +17 -1
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
- package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
- package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
- package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
- package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
- package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
- package/types/nanahoshi-mona-ui-label.d.ts +1 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
- package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
- package/types/nanahoshi-mona-ui-list.d.ts +1 -1
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
- package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
- package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
- package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
- package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
- package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
- package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
- package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
- package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
- package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
- package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
- package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
- package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
- package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
- package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
- package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
- package/types/nanahoshi-mona-ui-window.d.ts +66 -1
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)
|