@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/skeleton.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
> A decorative placeholder block for content that is still loading.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/skeleton`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-skeleton`
|
|
8
|
+
|
|
9
|
+
`SkeletonComponent` renders a decorative placeholder block for content that is still loading. Set its `width` and `height` to reserve the expected space, then replace it with the loaded content when it is available.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use `SkeletonComponent` to reserve space for content while it loads. It renders a non-interactive placeholder surface with a subtle pulse animation that respects the user's motion preferences.
|
|
14
|
+
|
|
15
|
+
The component has no projected content, model inputs, or event outputs. It is a decorative visual only; the region that contains it should communicate loading state to assistive technology when needed.
|
|
16
|
+
|
|
17
|
+
## Import & Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { Component } from "@angular/core";
|
|
21
|
+
import { SkeletonComponent } from "@nanahoshi/mona-ui/skeleton";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Add `SkeletonComponent` to the `imports` array of a standalone component:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
@Component({
|
|
28
|
+
imports: [SkeletonComponent],
|
|
29
|
+
template: `
|
|
30
|
+
<mona-skeleton width="12rem" height="1.25rem"></mona-skeleton>
|
|
31
|
+
`
|
|
32
|
+
})
|
|
33
|
+
export class ProfileHeaderComponent {}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Numbers passed to `width` or `height` are interpreted as pixels. Strings can contain any CSS length accepted by the host element, such as `"12rem"`, `"240px"`, or `"100%"`. Both are set as inline styles, so a class like `w-8` has no effect. Use these inputs.
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Loading card
|
|
41
|
+
|
|
42
|
+
The card is marked `aria-busy` while it loads, and the skeleton is replaced with the content when it's done.
|
|
43
|
+
|
|
44
|
+
`card-example.component.ts`
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { Component, signal } from "@angular/core";
|
|
48
|
+
import { ButtonDirective } from "@nanahoshi/mona-ui/button";
|
|
49
|
+
import { SkeletonComponent } from "@nanahoshi/mona-ui/skeleton";
|
|
50
|
+
|
|
51
|
+
@Component({
|
|
52
|
+
selector: "app-skeleton-card-example",
|
|
53
|
+
imports: [ButtonDirective, SkeletonComponent],
|
|
54
|
+
templateUrl: "./card-example.component.html"
|
|
55
|
+
})
|
|
56
|
+
export class SkeletonCardExampleComponent {
|
|
57
|
+
protected readonly loading = signal(true);
|
|
58
|
+
|
|
59
|
+
public constructor() {
|
|
60
|
+
this.reload();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
protected reload(): void {
|
|
64
|
+
this.loading.set(true);
|
|
65
|
+
// Stands in for a request to a server.
|
|
66
|
+
setTimeout(() => this.loading.set(false), 1500);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`card-example.component.html`
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<div class="flex max-w-sm flex-col items-start gap-3">
|
|
75
|
+
<section aria-label="Profile" class="flex w-full items-center gap-4 rounded-md border border-border p-4" [attr.aria-busy]="loading()">
|
|
76
|
+
@if (loading()) {
|
|
77
|
+
<mona-skeleton rounded="full" [height]="56" [width]="56"></mona-skeleton>
|
|
78
|
+
<div class="flex flex-1 flex-col gap-2">
|
|
79
|
+
<mona-skeleton height="1.25rem" width="8rem"></mona-skeleton>
|
|
80
|
+
<mona-skeleton height="1rem"></mona-skeleton>
|
|
81
|
+
</div>
|
|
82
|
+
} @else {
|
|
83
|
+
<div class="flex size-14 shrink-0 items-center justify-center rounded-full bg-primary font-bold text-primary-foreground" aria-hidden="true">JS</div>
|
|
84
|
+
<div class="flex flex-col">
|
|
85
|
+
<span class="font-semibold">Jane Smith</span>
|
|
86
|
+
<span class="text-sm">Product designer, Lisbon</span>
|
|
87
|
+
</div>
|
|
88
|
+
}
|
|
89
|
+
</section>
|
|
90
|
+
<button monaButton type="button" [disabled]="loading()" (click)="reload()">Reload</button>
|
|
91
|
+
</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### List rows
|
|
95
|
+
|
|
96
|
+
Repeat a row of skeletons in the shape of the items that will load.
|
|
97
|
+
|
|
98
|
+
`list-example.component.ts`
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { Component } from "@angular/core";
|
|
102
|
+
import { SkeletonComponent } from "@nanahoshi/mona-ui/skeleton";
|
|
103
|
+
|
|
104
|
+
@Component({
|
|
105
|
+
selector: "app-skeleton-list-example",
|
|
106
|
+
imports: [SkeletonComponent],
|
|
107
|
+
templateUrl: "./list-example.component.html"
|
|
108
|
+
})
|
|
109
|
+
export class SkeletonListExampleComponent {
|
|
110
|
+
protected readonly rows = [1, 2, 3];
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`list-example.component.html`
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<div aria-busy="true" aria-label="Loading messages" class="flex max-w-md flex-col gap-4" role="region">
|
|
118
|
+
@for (row of rows; track row) {
|
|
119
|
+
<div class="flex items-center gap-3">
|
|
120
|
+
<mona-skeleton rounded="full" [height]="40" [width]="40"></mona-skeleton>
|
|
121
|
+
<div class="flex flex-1 flex-col gap-2">
|
|
122
|
+
<mona-skeleton rounded="small" width="40%"></mona-skeleton>
|
|
123
|
+
<mona-skeleton rounded="small" height="0.75rem"></mona-skeleton>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
}
|
|
127
|
+
</div>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Appearance & Styling
|
|
131
|
+
|
|
132
|
+
### Rounded presets
|
|
133
|
+
|
|
134
|
+
| `rounded` | Shape |
|
|
135
|
+
|-----------|-------|
|
|
136
|
+
| `none` | No rounding |
|
|
137
|
+
| `small` | Slight rounding |
|
|
138
|
+
| `medium` | Moderate rounding (default) |
|
|
139
|
+
| `large` | Strong rounding |
|
|
140
|
+
| `full` | Fully rounded |
|
|
141
|
+
|
|
142
|
+
Use the public `class` input to add classes or other consumer styling to the host element. Classes are merged with the component's generated classes through `tailwind-merge`.
|
|
143
|
+
|
|
144
|
+
## Accessibility
|
|
145
|
+
|
|
146
|
+
The skeleton host always has `aria-hidden="true"` because the placeholder itself is decorative and does not convey content. Mark the surrounding loading region with `aria-busy="true"` and give that region an accessible name or description when the loading state needs to be announced.
|
|
147
|
+
|
|
148
|
+
When loading completes, remove the busy state and replace the skeleton with the actual content. The component does not provide a live region or loading announcement.
|
|
149
|
+
|
|
150
|
+
## API
|
|
151
|
+
|
|
152
|
+
Everything below is imported from `@nanahoshi/mona-ui/skeleton`.
|
|
153
|
+
|
|
154
|
+
### `SkeletonComponent`
|
|
155
|
+
|
|
156
|
+
A placeholder block standing in for content that has not loaded yet. Size it with `width` and
|
|
157
|
+
`height`, which set inline styles, so utility classes for size have no effect.
|
|
158
|
+
|
|
159
|
+
It is decorative, so it is hidden from assistive technology. Mark the region it fills with
|
|
160
|
+
`aria-busy` and describe what is loading there instead.
|
|
161
|
+
|
|
162
|
+
**Selector:** `mona-skeleton`
|
|
163
|
+
|
|
164
|
+
#### Inputs
|
|
165
|
+
|
|
166
|
+
| Name | Type | Default | Description |
|
|
167
|
+
| --- | --- | --- | --- |
|
|
168
|
+
| `class` | `ClassInputType` | `""` | Additional CSS classes merged onto the host element via `tailwind-merge`. |
|
|
169
|
+
| `height` | `string \| number` | `"1rem"` | Height of the placeholder. Numbers are treated as pixels. |
|
|
170
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"medium"` | Border-radius preset applied to the placeholder. |
|
|
171
|
+
| `width` | `string \| number` | `"100%"` | Width of the placeholder. Numbers are treated as pixels. |
|
|
172
|
+
|
|
173
|
+
### Types
|
|
174
|
+
|
|
175
|
+
#### `ClassInputType`
|
|
176
|
+
|
|
177
|
+
From `@nanahoshi/mona-ui/common`.
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
type ClassInputType = string | string[] | Record<string, unknown> | null | undefined;
|
|
181
|
+
```
|
package/docs/slider.md
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
> A single-handle slider for selecting a numeric value.
|
|
4
|
+
|
|
5
|
+
Entry point: `@nanahoshi/mona-ui/slider`
|
|
6
|
+
|
|
7
|
+
**Selector:** `mona-slider`
|
|
8
|
+
|
|
9
|
+
`SliderComponent` is a single-handle range input that lets the user select a numeric value by dragging, clicking, or using keyboard navigation. It integrates with Angular signal forms via `FormValueControl<number>`.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Use `SliderComponent` when the user must select a single numeric value within a defined range. The selected value updates immediately as the handle moves.
|
|
14
|
+
|
|
15
|
+
**Use Slider instead of RangeSlider when:**
|
|
16
|
+
|
|
17
|
+
- The user selects one value (e.g., volume, brightness, zoom level)
|
|
18
|
+
- A minimum bound is fixed and only the upper value changes
|
|
19
|
+
|
|
20
|
+
**Use RangeSlider when:**
|
|
21
|
+
|
|
22
|
+
- The user needs to select both a lower and an upper bound simultaneously (e.g., a price filter)
|
|
23
|
+
|
|
24
|
+
## Import & Quick Start
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { SliderComponent } from "@nanahoshi/mona-ui/slider";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Direct value binding:**
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
|
|
34
|
+
<mona-slider [(value)]="volume" aria-label="Volume"></mona-slider>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Signal forms integration:**
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { signal } from "@angular/core";
|
|
41
|
+
import { form, FormField } from "@angular/forms/signals";
|
|
42
|
+
|
|
43
|
+
protected readonly myForm = form(signal({ volume: 5 }));
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
|
|
48
|
+
<mona-slider [formField]="myForm.volume" aria-label="Volume"></mona-slider>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Anatomy
|
|
52
|
+
|
|
53
|
+
Two structural directives allow customising the handle and tick labels.
|
|
54
|
+
|
|
55
|
+
### Custom handle
|
|
56
|
+
|
|
57
|
+
Use `monaSliderHandleTemplate` to replace the default circular handle. The template context exposes the current value as the implicit variable:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { SliderComponent, SliderHandleTemplateDirective } from "@nanahoshi/mona-ui/slider";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
|
|
65
|
+
<mona-slider [(value)]="value" aria-label="Rating">
|
|
66
|
+
<ng-template monaSliderHandleTemplate let-value>
|
|
67
|
+
<span>{{ value }}</span>
|
|
68
|
+
</ng-template>
|
|
69
|
+
</mona-slider>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Custom tick labels
|
|
73
|
+
|
|
74
|
+
Use `monaSliderTickValueTemplate` to replace default numeric tick labels. The template context exposes the tick value as the implicit variable. This template has no effect unless `showTicks` and `showLabels` are both enabled:
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { SliderComponent, SliderTickValueTemplateDirective } from "@nanahoshi/mona-ui/slider";
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
|
|
82
|
+
<mona-slider [showTicks]="true" [showLabels]="true" aria-label="Temperature">
|
|
83
|
+
<ng-template monaSliderTickValueTemplate let-value>
|
|
84
|
+
{{ value }}°C
|
|
85
|
+
</ng-template>
|
|
86
|
+
</mona-slider>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
### Tick marks and labels
|
|
92
|
+
|
|
93
|
+
Use `labelStep` to render only every n-th label (e.g., `[labelStep]="2"` shows every other label). Use `largeTickStep` to visually enlarge every n-th tick mark.
|
|
94
|
+
|
|
95
|
+
`ticks-example.component.ts`
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { Component, signal } from "@angular/core";
|
|
99
|
+
import { SliderComponent } from "@nanahoshi/mona-ui/slider";
|
|
100
|
+
|
|
101
|
+
@Component({
|
|
102
|
+
selector: "app-slider-ticks-example",
|
|
103
|
+
imports: [SliderComponent],
|
|
104
|
+
templateUrl: "./ticks-example.component.html"
|
|
105
|
+
})
|
|
106
|
+
export class SliderTicksExampleComponent {
|
|
107
|
+
protected readonly volume = signal(40);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`ticks-example.component.html`
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<div class="flex max-w-sm flex-col gap-2">
|
|
115
|
+
<mona-slider
|
|
116
|
+
aria-label="Volume"
|
|
117
|
+
[labelStep]="2"
|
|
118
|
+
[largeTickStep]="2"
|
|
119
|
+
[maxValue]="100"
|
|
120
|
+
[showLabels]="true"
|
|
121
|
+
[showTicks]="true"
|
|
122
|
+
[step]="10"
|
|
123
|
+
[(value)]="volume" />
|
|
124
|
+
<span class="text-sm">Volume: {{ volume() }}</span>
|
|
125
|
+
</div>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Vertical orientation
|
|
129
|
+
|
|
130
|
+
A vertical slider is 200 pixels tall unless you give it another height.
|
|
131
|
+
|
|
132
|
+
`vertical-example.component.ts`
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { Component, signal } from "@angular/core";
|
|
136
|
+
import { SliderComponent } from "@nanahoshi/mona-ui/slider";
|
|
137
|
+
|
|
138
|
+
@Component({
|
|
139
|
+
selector: "app-slider-vertical-example",
|
|
140
|
+
imports: [SliderComponent],
|
|
141
|
+
templateUrl: "./vertical-example.component.html"
|
|
142
|
+
})
|
|
143
|
+
export class SliderVerticalExampleComponent {
|
|
144
|
+
protected readonly bass = signal(6);
|
|
145
|
+
protected readonly middle = signal(0);
|
|
146
|
+
protected readonly treble = signal(-3);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`vertical-example.component.html`
|
|
151
|
+
|
|
152
|
+
```html
|
|
153
|
+
<div class="flex gap-10">
|
|
154
|
+
<div class="flex flex-col items-center gap-2">
|
|
155
|
+
<mona-slider aria-label="Bass" orientation="vertical" [maxValue]="12" [minValue]="-12" [(value)]="bass" />
|
|
156
|
+
<span class="text-sm">Bass {{ bass() }} dB</span>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="flex flex-col items-center gap-2">
|
|
159
|
+
<mona-slider aria-label="Middle" orientation="vertical" [maxValue]="12" [minValue]="-12" [(value)]="middle" />
|
|
160
|
+
<span class="text-sm">Middle {{ middle() }} dB</span>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="flex flex-col items-center gap-2">
|
|
163
|
+
<mona-slider aria-label="Treble" orientation="vertical" [maxValue]="12" [minValue]="-12" [(value)]="treble" />
|
|
164
|
+
<span class="text-sm">Treble {{ treble() }} dB</span>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Disabled state
|
|
170
|
+
|
|
171
|
+
```html
|
|
172
|
+
|
|
173
|
+
<mona-slider [disabled]="true" [value]="5" aria-label="Level"></mona-slider>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Read-only state
|
|
177
|
+
|
|
178
|
+
`readonly` blocks dragging, track clicks and keys. The handle stays focusable and readable, and gets `aria-readonly="true"`. With `[formField]`, the signal forms `readonly` rule writes it.
|
|
179
|
+
|
|
180
|
+
```html
|
|
181
|
+
|
|
182
|
+
<mona-slider readonly [value]="5" aria-label="Level"></mona-slider>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Accessible value text
|
|
186
|
+
|
|
187
|
+
Provide `ariaValueText` to give screen readers a richer announcement than the raw number:
|
|
188
|
+
|
|
189
|
+
`value-text-example.component.ts`
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
import { Component, signal } from "@angular/core";
|
|
193
|
+
import { SliderComponent } from "@nanahoshi/mona-ui/slider";
|
|
194
|
+
|
|
195
|
+
const PRIORITIES = ["Low", "Medium", "High"];
|
|
196
|
+
|
|
197
|
+
@Component({
|
|
198
|
+
selector: "app-slider-value-text-example",
|
|
199
|
+
imports: [SliderComponent],
|
|
200
|
+
templateUrl: "./value-text-example.component.html"
|
|
201
|
+
})
|
|
202
|
+
export class SliderValueTextExampleComponent {
|
|
203
|
+
protected readonly priority = signal(1);
|
|
204
|
+
protected readonly priorityName = (value: number): string => PRIORITIES[value] ?? "";
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`value-text-example.component.html`
|
|
209
|
+
|
|
210
|
+
```html
|
|
211
|
+
<div class="flex max-w-xs flex-col gap-2">
|
|
212
|
+
<mona-slider aria-label="Priority" [ariaValueText]="priorityName" [maxValue]="2" [(value)]="priority" />
|
|
213
|
+
<span class="text-sm">Priority: {{ priorityName(priority()) }}</span>
|
|
214
|
+
</div>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Signal forms
|
|
218
|
+
|
|
219
|
+
The field's `min` and `max` rules set the slider's bounds.
|
|
220
|
+
|
|
221
|
+
`forms-example.component.ts`
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
import { Component, signal } from "@angular/core";
|
|
225
|
+
import { form, FormField, max, min } from "@angular/forms/signals";
|
|
226
|
+
import { LabelComponent } from "@nanahoshi/mona-ui/label";
|
|
227
|
+
import { SliderComponent } from "@nanahoshi/mona-ui/slider";
|
|
228
|
+
|
|
229
|
+
@Component({
|
|
230
|
+
selector: "app-slider-forms-example",
|
|
231
|
+
imports: [FormField, LabelComponent, SliderComponent],
|
|
232
|
+
templateUrl: "./forms-example.component.html"
|
|
233
|
+
})
|
|
234
|
+
export class SliderFormsExampleComponent {
|
|
235
|
+
readonly #model = signal({ guests: 4 });
|
|
236
|
+
protected readonly booking = form(this.#model, path => {
|
|
237
|
+
min(path.guests, 1);
|
|
238
|
+
max(path.guests, 12);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`forms-example.component.html`
|
|
244
|
+
|
|
245
|
+
```html
|
|
246
|
+
<div class="flex max-w-sm flex-col gap-2">
|
|
247
|
+
<mona-label text="Guests">
|
|
248
|
+
<mona-slider [formField]="booking.guests" />
|
|
249
|
+
</mona-label>
|
|
250
|
+
<span class="text-sm">Table for {{ booking.guests().value() }}</span>
|
|
251
|
+
</div>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Behavior
|
|
255
|
+
|
|
256
|
+
### Values Out of Range
|
|
257
|
+
|
|
258
|
+
The slider never writes a corrected value on its own. A value that is out of range or off the step grid is shown at the nearest valid value, and the model keeps its own until the user changes it. The next user change saves a valid value. This way a `maxValue` that loads late can't overwrite saved data.
|
|
259
|
+
|
|
260
|
+
In development, the slider warns once per instance when this happens. That includes a `maxValue` that loads late, and a value left unset below `minValue`, since `value` defaults to `0`. It also warns once when the minimum isn't lower than the maximum.
|
|
261
|
+
|
|
262
|
+
`maxValue` can always be reached, even when it isn't a whole number of steps from `minValue`.
|
|
263
|
+
|
|
264
|
+
## Forms Integration
|
|
265
|
+
|
|
266
|
+
`SliderComponent` implements `FormValueControl<number>` from `@angular/forms/signals`. Connect it to a signal form field using the `[formField]` binding, as in [Signal forms](#signal-forms).
|
|
267
|
+
|
|
268
|
+
`FormField` writes `value`, `disabled`, `invalid`, `readonly`, `touched`, and, from the field's `min` and `max` rules, the `min` and `max` inputs, which win over `minValue` and `maxValue`. Don't set those on the same element, because Angular rejects the template. `minValue` and `maxValue` are still allowed. The `touch` output fires when the handle loses focus, marking the field as touched. A click on the track moves focus to the handle first.
|
|
269
|
+
|
|
270
|
+
`SliderComponent` doesn't implement `ControlValueAccessor`. `[(ngModel)]` binds to its `value` model through Angular's support for custom controls. Prefer `[formField]`.
|
|
271
|
+
|
|
272
|
+
## Accessibility
|
|
273
|
+
|
|
274
|
+
`SliderComponent` renders a focusable `div` with `role="slider"` and manages the following ARIA attributes on that element:
|
|
275
|
+
|
|
276
|
+
| Attribute | When present | Value |
|
|
277
|
+
|--------------------|-----------------------------------|---------------------------------------|
|
|
278
|
+
| `role` | Always | `"slider"` |
|
|
279
|
+
| `aria-valuemin` | Always | The lower bound |
|
|
280
|
+
| `aria-valuemax` | Always | The upper bound |
|
|
281
|
+
| `aria-valuenow` | Always | Current value (clamped and snapped) |
|
|
282
|
+
| `aria-valuetext` | When `ariaValueText` is provided | Return value of the provided function |
|
|
283
|
+
| `aria-orientation` | Always | `"horizontal"` or `"vertical"` |
|
|
284
|
+
| `aria-disabled` | When disabled | `true` |
|
|
285
|
+
| `aria-readonly` | When read-only | `true` |
|
|
286
|
+
| `aria-invalid` | When `invalid` and `touched` | `true` |
|
|
287
|
+
| `aria-describedby` | When `aria-describedby` is set | The given id |
|
|
288
|
+
| `tabindex` | Always | `0` (enabled) or `-1` (disabled) |
|
|
289
|
+
|
|
290
|
+
The slider has no required state, because ARIA doesn't allow one on role `slider`.
|
|
291
|
+
|
|
292
|
+
**Accessible name:**
|
|
293
|
+
|
|
294
|
+
The slider has no visible text label of its own. Provide a name using one of:
|
|
295
|
+
|
|
296
|
+
- `aria-label` input: `<mona-slider aria-label="Volume">`
|
|
297
|
+
- `aria-labelledby` input: reference an existing element by ID: `<mona-slider aria-labelledby="volume-label-id">`
|
|
298
|
+
- A `mona-label` with `text` wrapped around it. A click on the caption focuses the handle.
|
|
299
|
+
- A `mona-label` or `label[monaLabel]` bound to it with `[for]="ref"`. A string `for` can't work, because the slider has no native input.
|
|
300
|
+
|
|
301
|
+
Without any of these, it falls back to the generic localized name "Slider value".
|
|
302
|
+
|
|
303
|
+
### Keyboard Interaction
|
|
304
|
+
|
|
305
|
+
| Key | Action |
|
|
306
|
+
|-----------------------------------|---------------------------------------------------------|
|
|
307
|
+
| `ArrowRight` / `ArrowUp` | Increase value by `step` |
|
|
308
|
+
| `ArrowLeft` / `ArrowDown` | Decrease value by `step` |
|
|
309
|
+
| `Shift` + `ArrowRight`/`ArrowUp` | Increase value by `step × shiftMultiplier` |
|
|
310
|
+
| `Shift` + `ArrowLeft`/`ArrowDown` | Decrease value by `step × shiftMultiplier` |
|
|
311
|
+
| `Home` | Jump to the lower bound |
|
|
312
|
+
| `End` | Jump to the upper bound |
|
|
313
|
+
| `PageUp` | Increase value by 10% of the total range, at least `step` |
|
|
314
|
+
| `PageDown` | Decrease value by 10% of the total range, at least `step` |
|
|
315
|
+
|
|
316
|
+
In RTL, `ArrowLeft` increases and `ArrowRight` decreases.
|
|
317
|
+
|
|
318
|
+
## API
|
|
319
|
+
|
|
320
|
+
Everything below is imported from `@nanahoshi/mona-ui/slider`.
|
|
321
|
+
|
|
322
|
+
### `SliderComponent`
|
|
323
|
+
|
|
324
|
+
**Selector:** `mona-slider`
|
|
325
|
+
**Implements:** `FormValueControl<number>`
|
|
326
|
+
|
|
327
|
+
#### Inputs
|
|
328
|
+
|
|
329
|
+
| Name | Type | Default | Description |
|
|
330
|
+
| --- | --- | --- | --- |
|
|
331
|
+
| `aria-describedby` | `string \| null` | `null` | Id of an element that describes the control, such as an error message. On a range slider it describes each handle. |
|
|
332
|
+
| `aria-label` | `string \| null` | `null` | Accessible name of the control. On a range slider it names the group holding both handles. |
|
|
333
|
+
| `aria-labelledby` | `string \| null` | `null` | Id of the element that labels the control. On a range slider each handle reads it before its own name. |
|
|
334
|
+
| `ariaValueText` | `((value: number) => string) \| null` | `null` | Human-readable override for the `aria-valuenow` announcement. Pass a function that receives the current value and returns the string to announce. |
|
|
335
|
+
| `disabled` | `boolean` | `false` | Renders the component with reduced visual emphasis and removes pointer interaction. |
|
|
336
|
+
| `handleClasses` | `string \| string[]` | `[]` | Additional CSS classes to apply to the slider handle. |
|
|
337
|
+
| `handleStyles` | `Partial<CSSStyleDeclaration>` | `{}` | Additional inline styles to apply to the slider handle. |
|
|
338
|
+
| `invalid` | `boolean` | `false` | Marks the control as invalid for form validation purposes, reflecting `aria-invalid` on the handle element once the control is touched. |
|
|
339
|
+
| `labelPosition` | `SliderLabelPosition` | `"after"` | Position of the label relative to the component. |
|
|
340
|
+
| `labelStep` | `number` | `1` | Controls which tick labels are shown — only every n<sup>th</sup> label is rendered. |
|
|
341
|
+
| `largeTickStep` | `number \| null` | `null` | Controls which ticks render at large size — only every n<sup>th</sup> tick is enlarged. Pass `null` to disable large ticks. |
|
|
342
|
+
| `max` | `number \| undefined` | `undefined` | Upper bound that wins over `maxValue`. When bound to a signal form field via `[formField]`, this is written from the field's `max` rule. |
|
|
343
|
+
| `maxValue` | `number` | `10` | Upper bound of the value range. Must be greater than `minValue`. |
|
|
344
|
+
| `min` | `number \| undefined` | `undefined` | Lower bound that wins over `minValue`. When bound to a signal form field via `[formField]`, this is written from the field's `min` rule. |
|
|
345
|
+
| `minValue` | `number` | `0` | Lower bound of the value range. |
|
|
346
|
+
| `orientation` | `Orientation` | `"horizontal"` | Layout orientation of the component. |
|
|
347
|
+
| `readonly` | `boolean` | `false` | Prevents value changes while the control stays focusable and readable. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
348
|
+
| `rounded` | `"full" \| "large" \| "medium" \| "none" \| "small"` | `"full"` | Border-radius preset applied to the slider handle. |
|
|
349
|
+
| `selectionBackground` | `string \| Partial<CSSStyleDeclaration> \| null` | `null` | Background color of the filled selection area between the minimum and the current value. Accepts a CSS color string or a `CSSStyleDeclaration` partial. |
|
|
350
|
+
| `shiftMultiplier` | `number` | `10` | Multiplier applied to the step when the user holds Shift while pressing an arrow key. |
|
|
351
|
+
| `showLabels` | `boolean` | `false` | Displays value labels alongside tick marks. Only takes effect when `showTicks` is `true`. |
|
|
352
|
+
| `showTicks` | `boolean` | `false` | Displays tick marks at each step position along the track. |
|
|
353
|
+
| `smallTickStep` | `number` | `1` | Controls how many ticks are visible — only every n<sup>th</sup> tick is rendered. |
|
|
354
|
+
| `step` | `number` | `1` | Distance between the values the control can take. `maxValue` can always be reached, even when it isn't a whole number of steps from `minValue`. |
|
|
355
|
+
| `touched` | `boolean` | `false` | Marks the slider as touched. Error styling requires both `invalid` and `touched` to be `true`. When bound to a signal form field via `[formField]`, this is written by the `FormField` directive. |
|
|
356
|
+
| `trackBackground` | `string \| Partial<CSSStyleDeclaration> \| null` | `null` | Background color of the unfilled track portion. Accepts a CSS color string or a `CSSStyleDeclaration` partial. |
|
|
357
|
+
| `trackSize` | `string \| number` | `undefined` | Width (vertical orientation) or height (horizontal orientation) of the track. Accepts a pixel number or any CSS length string. |
|
|
358
|
+
| `value` (two-way) | `number` | `0` | Current value. A value out of range or off the step grid is shown at the nearest valid value, and the model keeps its own until the user changes it, so a `maxValue` that loads late can't overwrite saved data. A development warning reports it. |
|
|
359
|
+
|
|
360
|
+
#### Outputs
|
|
361
|
+
|
|
362
|
+
| Name | Type | Description |
|
|
363
|
+
| --- | --- | --- |
|
|
364
|
+
| `touch` | `void` | Emitted when a handle loses focus. A click on the track moves focus to the handle first. |
|
|
365
|
+
| `valueChange` | `number` | Emitted when `value` changes. |
|
|
366
|
+
|
|
367
|
+
#### Methods
|
|
368
|
+
|
|
369
|
+
| Signature | Description |
|
|
370
|
+
| --- | --- |
|
|
371
|
+
| `focus(options?: FocusOptions): void` | Moves focus to the handle. Does nothing while disabled. |
|
|
372
|
+
|
|
373
|
+
### `SliderHandleTemplateDirective`
|
|
374
|
+
|
|
375
|
+
**Selector:** `ng-template[monaSliderHandleTemplate]`
|
|
376
|
+
|
|
377
|
+
#### Template context
|
|
378
|
+
|
|
379
|
+
| Name | Type |
|
|
380
|
+
| --- | --- |
|
|
381
|
+
| `$implicit` | `number` |
|
|
382
|
+
|
|
383
|
+
### `SliderTickValueTemplateDirective`
|
|
384
|
+
|
|
385
|
+
**Selector:** `ng-template[monaSliderTickValueTemplate]`
|
|
386
|
+
|
|
387
|
+
#### Template context
|
|
388
|
+
|
|
389
|
+
| Name | Type |
|
|
390
|
+
| --- | --- |
|
|
391
|
+
| `$implicit` | `number` |
|
|
392
|
+
|
|
393
|
+
### Types
|
|
394
|
+
|
|
395
|
+
#### `SLIDER_DEFAULT_MESSAGES`
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
const SLIDER_DEFAULT_MESSAGES: MonaSliderMessages;
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
#### `SliderLabelPosition`
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
type SliderLabelPosition = "before" | "after";
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
#### `MonaSliderMessages`
|
|
408
|
+
|
|
409
|
+
From `@nanahoshi/mona-ui/i18n`.
|
|
410
|
+
|
|
411
|
+
| Name | Type |
|
|
412
|
+
| --- | --- |
|
|
413
|
+
| `maximumValue` (read-only) | `string` |
|
|
414
|
+
| `minimumValue` (read-only) | `string` |
|
|
415
|
+
| `sliderValue` (read-only) | `string` |
|
|
416
|
+
|
|
417
|
+
#### `Orientation`
|
|
418
|
+
|
|
419
|
+
From `@nanahoshi/mona-ui/common`.
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
type Orientation = "horizontal" | "vertical";
|
|
423
|
+
```
|