@nanahoshi/mona-ui 0.1.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 +25 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +590 -0
- package/fesm2022/nanahoshi-mona-ui-avatar.mjs +168 -0
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +220 -0
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +225 -0
- package/fesm2022/nanahoshi-mona-ui-button.mjs +497 -0
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +1569 -0
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +453 -0
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +200 -0
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +853 -0
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +923 -0
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +495 -0
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +686 -0
- package/fesm2022/nanahoshi-mona-ui-common.mjs +642 -0
- package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +485 -0
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +132 -0
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +460 -0
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +659 -0
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +828 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +523 -0
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +615 -0
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +701 -0
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +1400 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +245 -0
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +170 -0
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +680 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs +105 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs +42 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +130 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs +773 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +240 -0
- package/fesm2022/nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs +5374 -0
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +2 -0
- package/fesm2022/nanahoshi-mona-ui-internal-filter-input.mjs +87 -0
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +154 -0
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1356 -0
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +2263 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +379 -0
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +630 -0
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +527 -0
- package/fesm2022/nanahoshi-mona-ui-list.mjs +4 -0
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +966 -0
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +641 -0
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +536 -0
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +597 -0
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +790 -0
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +83 -0
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +325 -0
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +1559 -0
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +1321 -0
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +294 -0
- package/fesm2022/nanahoshi-mona-ui-query.mjs +175 -0
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +339 -0
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +565 -0
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +1049 -0
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +636 -0
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +843 -0
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +537 -0
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +308 -0
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +664 -0
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +111 -0
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +369 -0
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +314 -0
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +450 -0
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +723 -0
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +716 -0
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +733 -0
- package/fesm2022/nanahoshi-mona-ui-window.mjs +1329 -0
- package/fesm2022/nanahoshi-mona-ui.mjs +9 -0
- package/package.json +289 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +223 -0
- package/types/nanahoshi-mona-ui-avatar.d.ts +642 -0
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +70 -0
- package/types/nanahoshi-mona-ui-button-group.d.ts +77 -0
- package/types/nanahoshi-mona-ui-button.d.ts +111 -0
- package/types/nanahoshi-mona-ui-calendar.d.ts +262 -0
- package/types/nanahoshi-mona-ui-check-box.d.ts +133 -0
- package/types/nanahoshi-mona-ui-chip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +113 -0
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +201 -0
- package/types/nanahoshi-mona-ui-color-palette.d.ts +102 -0
- package/types/nanahoshi-mona-ui-color-picker.d.ts +156 -0
- package/types/nanahoshi-mona-ui-combo-box.d.ts +232 -0
- package/types/nanahoshi-mona-ui-common.d.ts +386 -0
- package/types/nanahoshi-mona-ui-contextmenu.d.ts +129 -0
- package/types/nanahoshi-mona-ui-date-input.d.ts +60 -0
- package/types/nanahoshi-mona-ui-date-picker.d.ts +177 -0
- package/types/nanahoshi-mona-ui-datetime-picker.d.ts +199 -0
- package/types/nanahoshi-mona-ui-dialog.d.ts +261 -0
- package/types/nanahoshi-mona-ui-dropdown-button.d.ts +159 -0
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +219 -0
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +176 -0
- package/types/nanahoshi-mona-ui-editor.d.ts +113 -0
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +87 -0
- package/types/nanahoshi-mona-ui-fieldset.d.ts +68 -0
- package/types/nanahoshi-mona-ui-filter.d.ts +115 -0
- package/types/nanahoshi-mona-ui-grid.d.ts +1114 -0
- package/types/nanahoshi-mona-ui-internal-filter-input.d.ts +25 -0
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +28 -0
- package/types/nanahoshi-mona-ui-internal-list.d.ts +269 -0
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +391 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +136 -0
- package/types/nanahoshi-mona-ui-list-box.d.ts +225 -0
- package/types/nanahoshi-mona-ui-list-view.d.ts +188 -0
- package/types/nanahoshi-mona-ui-list.d.ts +1 -0
- package/types/nanahoshi-mona-ui-menubar.d.ts +198 -0
- package/types/nanahoshi-mona-ui-multi-select.d.ts +247 -0
- package/types/nanahoshi-mona-ui-notification.d.ts +106 -0
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +161 -0
- package/types/nanahoshi-mona-ui-pager.d.ts +238 -0
- package/types/nanahoshi-mona-ui-placeholder.d.ts +35 -0
- package/types/nanahoshi-mona-ui-popover.d.ts +130 -0
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +412 -0
- package/types/nanahoshi-mona-ui-popup.d.ts +485 -0
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +139 -0
- package/types/nanahoshi-mona-ui-query.d.ts +89 -0
- package/types/nanahoshi-mona-ui-radio-button.d.ts +128 -0
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +166 -0
- package/types/nanahoshi-mona-ui-slider.d.ts +305 -0
- package/types/nanahoshi-mona-ui-split-button.d.ts +182 -0
- package/types/nanahoshi-mona-ui-splitter.d.ts +70 -0
- package/types/nanahoshi-mona-ui-stepper.d.ts +173 -0
- package/types/nanahoshi-mona-ui-switch.d.ts +125 -0
- package/types/nanahoshi-mona-ui-tabs.d.ts +158 -0
- package/types/nanahoshi-mona-ui-text-area.d.ts +42 -0
- package/types/nanahoshi-mona-ui-text-box.d.ts +164 -0
- package/types/nanahoshi-mona-ui-theme.d.ts +23 -0
- package/types/nanahoshi-mona-ui-time-picker.d.ts +184 -0
- package/types/nanahoshi-mona-ui-time-selector.d.ts +143 -0
- package/types/nanahoshi-mona-ui-tooltip.d.ts +130 -0
- package/types/nanahoshi-mona-ui-tree-view.d.ts +274 -0
- package/types/nanahoshi-mona-ui-window.d.ts +295 -0
- package/types/nanahoshi-mona-ui.d.ts +2 -0
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, computed, input, Directive, DestroyRef, DOCUMENT, ElementRef, contentChild, TemplateRef, signal, viewChild, model, afterNextRender, Component } from '@angular/core';
|
|
4
|
+
import { toSignal, toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { toCssValue } from '@nanahoshi/mona-ui/internal';
|
|
6
|
+
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
|
+
import { select } from '@mirei/ts-collections';
|
|
8
|
+
import { startWith, pairwise, map, Subject, timer, interval, takeUntil, asyncScheduler, fromEvent, filter, tap } from 'rxjs';
|
|
9
|
+
import { twMerge } from 'tailwind-merge';
|
|
10
|
+
import { cva } from 'class-variance-authority';
|
|
11
|
+
|
|
12
|
+
const scrollViewBaseVariants = cva(`
|
|
13
|
+
block relative w-full h-full outline-none
|
|
14
|
+
overflow-hidden
|
|
15
|
+
border border-border border-2
|
|
16
|
+
`, {
|
|
17
|
+
variants: {
|
|
18
|
+
rounded: {
|
|
19
|
+
small: "rounded-sm",
|
|
20
|
+
medium: "rounded-md",
|
|
21
|
+
large: "rounded-lg",
|
|
22
|
+
none: "rounded-none"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const scrollViewContentVariants = cva(`
|
|
27
|
+
absolute inset-0 overflow-hidden
|
|
28
|
+
`);
|
|
29
|
+
const scrollViewListVariants = cva(`
|
|
30
|
+
relative list-none h-full
|
|
31
|
+
[&_li]:absolute
|
|
32
|
+
[&_li]:inset-0
|
|
33
|
+
[&_li]:outline-none
|
|
34
|
+
`);
|
|
35
|
+
const scrollViewArrowVariants = cva(`
|
|
36
|
+
absolute top-0 bottom-0 px-1
|
|
37
|
+
flex items-center justify-center
|
|
38
|
+
cursor-pointer select-none
|
|
39
|
+
|
|
40
|
+
text-foreground
|
|
41
|
+
[&_svg]:stroke-white
|
|
42
|
+
[&_svg]:drop-shadow-[0_0_15px_#000]
|
|
43
|
+
[&_svg]:opacity-40
|
|
44
|
+
hover:[&_svg]:opacity-100
|
|
45
|
+
[&_svg]:transition-opacity duration-300 ease-out
|
|
46
|
+
`, {
|
|
47
|
+
variants: {
|
|
48
|
+
hidden: {
|
|
49
|
+
true: "hidden",
|
|
50
|
+
false: ""
|
|
51
|
+
},
|
|
52
|
+
left: {
|
|
53
|
+
true: "left-0",
|
|
54
|
+
false: ""
|
|
55
|
+
},
|
|
56
|
+
right: {
|
|
57
|
+
true: "right-0",
|
|
58
|
+
false: ""
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const scrollViewPagerVariants = cva(`
|
|
63
|
+
absolute left-0 right-0 bottom-0 flex items-center justify-center
|
|
64
|
+
`, {
|
|
65
|
+
variants: {
|
|
66
|
+
pagerOverlay: {
|
|
67
|
+
dark: "border-0 border-t border-border/20 bg-background-dark/20",
|
|
68
|
+
light: "border-0 border-t border-border/20 bg-background/20",
|
|
69
|
+
none: ""
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const scrollViewPagerListContainerVariants = cva(`
|
|
74
|
+
flex items-center justify-center
|
|
75
|
+
flex-1 overflow-hidden
|
|
76
|
+
`);
|
|
77
|
+
const scrollViewPagerListVariants = cva(`
|
|
78
|
+
flex items-center gap-2
|
|
79
|
+
list-none overflow-hidden
|
|
80
|
+
flex-nowrap px-1 py-3
|
|
81
|
+
`);
|
|
82
|
+
const scrollViewPagerListItemVariants = cva(`
|
|
83
|
+
w-3 h-3
|
|
84
|
+
content-[' ']
|
|
85
|
+
flex-grow-0 flex-shrink-0 flex-basis-3
|
|
86
|
+
cursor-pointer
|
|
87
|
+
border border-border bg-white
|
|
88
|
+
not-last:mr-3
|
|
89
|
+
`, {
|
|
90
|
+
variants: {
|
|
91
|
+
active: {
|
|
92
|
+
true: "!bg-primary",
|
|
93
|
+
false: ""
|
|
94
|
+
},
|
|
95
|
+
pagerRounded: {
|
|
96
|
+
small: "rounded-sm",
|
|
97
|
+
medium: "rounded-md",
|
|
98
|
+
large: "rounded-lg",
|
|
99
|
+
full: "rounded-full",
|
|
100
|
+
none: "rounded-none"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const scrollViewPagerArrowVariants = cva(`
|
|
105
|
+
flex items-center justify-center
|
|
106
|
+
p-2 cursor-pointer select-none
|
|
107
|
+
transition-opacity duration-300 ease-out
|
|
108
|
+
opacity-70 hover:opacity-100
|
|
109
|
+
font-medium
|
|
110
|
+
[&_svg]:stroke-white
|
|
111
|
+
[&_svg]:drop-shadow-[0_0_15px_#000]
|
|
112
|
+
[&_svg]:opacity-40
|
|
113
|
+
hover:[&_svg]:opacity-100
|
|
114
|
+
[&_svg]:transition-opacity duration-300 ease-out
|
|
115
|
+
`);
|
|
116
|
+
|
|
117
|
+
const scrollViewBaseThemeVariants = (theme) => {
|
|
118
|
+
switch (theme) {
|
|
119
|
+
case "mona":
|
|
120
|
+
return scrollViewBaseVariants;
|
|
121
|
+
default:
|
|
122
|
+
return scrollViewBaseVariants;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const scrollViewContentThemeVariants = (theme) => {
|
|
126
|
+
switch (theme) {
|
|
127
|
+
case "mona":
|
|
128
|
+
return scrollViewContentVariants;
|
|
129
|
+
default:
|
|
130
|
+
return scrollViewContentVariants;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const scrollViewListThemeVariants = (theme) => {
|
|
134
|
+
switch (theme) {
|
|
135
|
+
case "mona":
|
|
136
|
+
return scrollViewListVariants;
|
|
137
|
+
default:
|
|
138
|
+
return scrollViewListVariants;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
const scrollViewArrowThemeVariants = (theme) => {
|
|
142
|
+
switch (theme) {
|
|
143
|
+
case "mona":
|
|
144
|
+
return scrollViewArrowVariants;
|
|
145
|
+
default:
|
|
146
|
+
return scrollViewArrowVariants;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const scrollViewPagerThemeVariants = (theme) => {
|
|
150
|
+
switch (theme) {
|
|
151
|
+
case "mona":
|
|
152
|
+
return scrollViewPagerVariants;
|
|
153
|
+
default:
|
|
154
|
+
return scrollViewPagerVariants;
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const scrollViewPagerListContainerThemeVariants = (theme) => {
|
|
158
|
+
switch (theme) {
|
|
159
|
+
case "mona":
|
|
160
|
+
return scrollViewPagerListContainerVariants;
|
|
161
|
+
default:
|
|
162
|
+
return scrollViewPagerListContainerVariants;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
const scrollViewPagerListThemeVariants = (theme) => {
|
|
166
|
+
switch (theme) {
|
|
167
|
+
case "mona":
|
|
168
|
+
return scrollViewPagerListVariants;
|
|
169
|
+
default:
|
|
170
|
+
return scrollViewPagerListVariants;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const scrollViewPagerListItemThemeVariants = (theme) => {
|
|
174
|
+
switch (theme) {
|
|
175
|
+
case "mona":
|
|
176
|
+
return scrollViewPagerListItemVariants;
|
|
177
|
+
default:
|
|
178
|
+
return scrollViewPagerListItemVariants;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const scrollViewPagerArrowThemeVariants = (theme) => {
|
|
182
|
+
switch (theme) {
|
|
183
|
+
case "mona":
|
|
184
|
+
return scrollViewPagerArrowVariants;
|
|
185
|
+
default:
|
|
186
|
+
return scrollViewPagerArrowVariants;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
class ScrollViewActivePageDirective {
|
|
191
|
+
constructor() {
|
|
192
|
+
this.#themeService = inject(ThemeService);
|
|
193
|
+
this.pageItemClass = computed(() => {
|
|
194
|
+
const theme = this.#themeService.theme();
|
|
195
|
+
const active = this.active();
|
|
196
|
+
const pagerRounded = this.rounded();
|
|
197
|
+
return scrollViewPagerListItemThemeVariants(theme)({ active, pagerRounded });
|
|
198
|
+
}, /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "pageItemClass" }] : /* istanbul ignore next */ []));
|
|
200
|
+
this.active = input.required(/* @ts-ignore */
|
|
201
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
202
|
+
this.rounded = input.required(/* @ts-ignore */
|
|
203
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
204
|
+
}
|
|
205
|
+
#themeService;
|
|
206
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ScrollViewActivePageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
207
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ScrollViewActivePageDirective, isStandalone: true, selector: "button[monaScrollViewActivePage]", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "pageItemClass()" } }, ngImport: i0 }); }
|
|
208
|
+
}
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ScrollViewActivePageDirective, decorators: [{
|
|
210
|
+
type: Directive,
|
|
211
|
+
args: [{
|
|
212
|
+
selector: "button[monaScrollViewActivePage]",
|
|
213
|
+
host: {
|
|
214
|
+
"[class]": "pageItemClass()"
|
|
215
|
+
}
|
|
216
|
+
}]
|
|
217
|
+
}], propDecorators: { active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: true }] }] } });
|
|
218
|
+
|
|
219
|
+
class ScrollViewComponent {
|
|
220
|
+
#destroyRef;
|
|
221
|
+
#document;
|
|
222
|
+
#viewIndex;
|
|
223
|
+
#directionFromIndex;
|
|
224
|
+
#hostElementRef;
|
|
225
|
+
#themeService;
|
|
226
|
+
#resizeObserver;
|
|
227
|
+
#scroll$;
|
|
228
|
+
#scrollMouseUpHandler;
|
|
229
|
+
constructor() {
|
|
230
|
+
this.#destroyRef = inject(DestroyRef);
|
|
231
|
+
this.#document = inject(DOCUMENT);
|
|
232
|
+
this.#viewIndex = computed(() => {
|
|
233
|
+
const infinite = this.infinite();
|
|
234
|
+
const index = this.index();
|
|
235
|
+
const viewData = this.viewData();
|
|
236
|
+
if (viewData.length === 0) {
|
|
237
|
+
return 0;
|
|
238
|
+
}
|
|
239
|
+
return infinite ? index % viewData.length : index;
|
|
240
|
+
}, /* @ts-ignore */
|
|
241
|
+
...(ngDevMode ? [{ debugName: "#viewIndex" }] : /* istanbul ignore next */ []));
|
|
242
|
+
this.#directionFromIndex = toSignal(toObservable(this.#viewIndex).pipe(startWith(0), pairwise(), map(([prevIndex, index]) => {
|
|
243
|
+
const infinite = this.infinite();
|
|
244
|
+
const totalItems = this.itemCount();
|
|
245
|
+
if (infinite && totalItems > 1) {
|
|
246
|
+
const lastIndex = totalItems - 1;
|
|
247
|
+
if (prevIndex === lastIndex && index === 0) {
|
|
248
|
+
return "right";
|
|
249
|
+
}
|
|
250
|
+
if (prevIndex === 0 && index === lastIndex) {
|
|
251
|
+
return "left";
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return index < prevIndex ? "left" : "right";
|
|
255
|
+
})), {
|
|
256
|
+
initialValue: "right"
|
|
257
|
+
});
|
|
258
|
+
this.#hostElementRef = inject(ElementRef);
|
|
259
|
+
this.#themeService = inject(ThemeService);
|
|
260
|
+
this.#resizeObserver = null;
|
|
261
|
+
this.#scroll$ = new Subject();
|
|
262
|
+
this.#scrollMouseUpHandler = () => this.onPagerScrollEnd();
|
|
263
|
+
this.animationDuration = computed(() => {
|
|
264
|
+
const animate = this.animate();
|
|
265
|
+
return typeof animate === "boolean" ? (animate ? 500 : 0) : animate;
|
|
266
|
+
}, /* @ts-ignore */
|
|
267
|
+
...(ngDevMode ? [{ debugName: "animationDuration" }] : /* istanbul ignore next */ []));
|
|
268
|
+
this.baseClass = computed(() => {
|
|
269
|
+
const theme = this.#themeService.theme();
|
|
270
|
+
const rounded = this.rounded();
|
|
271
|
+
const variantClass = scrollViewBaseThemeVariants(theme)({ rounded });
|
|
272
|
+
const userClass = this.userClass();
|
|
273
|
+
return twMerge(variantClass, userClass);
|
|
274
|
+
}, /* @ts-ignore */
|
|
275
|
+
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
276
|
+
this.contentClass = computed(() => {
|
|
277
|
+
const theme = this.#themeService.theme();
|
|
278
|
+
return scrollViewContentThemeVariants(theme)();
|
|
279
|
+
}, /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
|
|
281
|
+
this.contentTemplate = contentChild(TemplateRef, /* @ts-ignore */
|
|
282
|
+
...(ngDevMode ? [{ debugName: "contentTemplate" }] : /* istanbul ignore next */ []));
|
|
283
|
+
this.enterAnimation = computed(() => {
|
|
284
|
+
return this.#directionFromIndex() === "right" ? "slide-in-from-right" : "slide-in-from-left";
|
|
285
|
+
}, /* @ts-ignore */
|
|
286
|
+
...(ngDevMode ? [{ debugName: "enterAnimation" }] : /* istanbul ignore next */ []));
|
|
287
|
+
this.itemCount = computed(() => this.viewData().length, /* @ts-ignore */
|
|
288
|
+
...(ngDevMode ? [{ debugName: "itemCount" }] : /* istanbul ignore next */ []));
|
|
289
|
+
this.leaveAnimation = computed(() => {
|
|
290
|
+
return this.#directionFromIndex() === "right" ? "slide-out-to-left" : "slide-out-to-right";
|
|
291
|
+
}, /* @ts-ignore */
|
|
292
|
+
...(ngDevMode ? [{ debugName: "leaveAnimation" }] : /* istanbul ignore next */ []));
|
|
293
|
+
this.leftArrowClass = computed(() => {
|
|
294
|
+
const theme = this.#themeService.theme();
|
|
295
|
+
const hidden = !this.arrows() || !(this.infinite() || this.index() !== 0);
|
|
296
|
+
return scrollViewArrowThemeVariants(theme)({ left: true, hidden });
|
|
297
|
+
}, /* @ts-ignore */
|
|
298
|
+
...(ngDevMode ? [{ debugName: "leftArrowClass" }] : /* istanbul ignore next */ []));
|
|
299
|
+
this.listClass = computed(() => {
|
|
300
|
+
const theme = this.#themeService.theme();
|
|
301
|
+
return scrollViewListThemeVariants(theme)();
|
|
302
|
+
}, /* @ts-ignore */
|
|
303
|
+
...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
|
|
304
|
+
this.pagerArrowClass = computed(() => {
|
|
305
|
+
const theme = this.#themeService.theme();
|
|
306
|
+
return scrollViewPagerArrowThemeVariants(theme)();
|
|
307
|
+
}, /* @ts-ignore */
|
|
308
|
+
...(ngDevMode ? [{ debugName: "pagerArrowClass" }] : /* istanbul ignore next */ []));
|
|
309
|
+
this.pagerArrowVisible = signal(true, /* @ts-ignore */
|
|
310
|
+
...(ngDevMode ? [{ debugName: "pagerArrowVisible" }] : /* istanbul ignore next */ []));
|
|
311
|
+
this.pagerClass = computed(() => {
|
|
312
|
+
const theme = this.#themeService.theme();
|
|
313
|
+
const pagerOverlay = this.pagerOverlay();
|
|
314
|
+
return scrollViewPagerThemeVariants(theme)({ pagerOverlay });
|
|
315
|
+
}, /* @ts-ignore */
|
|
316
|
+
...(ngDevMode ? [{ debugName: "pagerClass" }] : /* istanbul ignore next */ []));
|
|
317
|
+
this.pagerListClass = computed(() => {
|
|
318
|
+
const theme = this.#themeService.theme();
|
|
319
|
+
return scrollViewPagerListThemeVariants(theme)();
|
|
320
|
+
}, /* @ts-ignore */
|
|
321
|
+
...(ngDevMode ? [{ debugName: "pagerListClass" }] : /* istanbul ignore next */ []));
|
|
322
|
+
this.pagerListContainerClass = computed(() => {
|
|
323
|
+
const theme = this.#themeService.theme();
|
|
324
|
+
return scrollViewPagerListContainerThemeVariants(theme)();
|
|
325
|
+
}, /* @ts-ignore */
|
|
326
|
+
...(ngDevMode ? [{ debugName: "pagerListContainerClass" }] : /* istanbul ignore next */ []));
|
|
327
|
+
this.pagerListElementRef = viewChild("pagerListElement", /* @ts-ignore */
|
|
328
|
+
...(ngDevMode ? [{ debugName: "pagerListElementRef" }] : /* istanbul ignore next */ []));
|
|
329
|
+
this.rightArrowClass = computed(() => {
|
|
330
|
+
const theme = this.#themeService.theme();
|
|
331
|
+
const hidden = !this.arrows() || !(this.infinite() || this.index() !== this.itemCount() - 1);
|
|
332
|
+
return scrollViewArrowThemeVariants(theme)({ right: true, hidden });
|
|
333
|
+
}, /* @ts-ignore */
|
|
334
|
+
...(ngDevMode ? [{ debugName: "rightArrowClass" }] : /* istanbul ignore next */ []));
|
|
335
|
+
this.scrollViewHeight = computed(() => {
|
|
336
|
+
const height = this.height();
|
|
337
|
+
return toCssValue(height);
|
|
338
|
+
}, /* @ts-ignore */
|
|
339
|
+
...(ngDevMode ? [{ debugName: "scrollViewHeight" }] : /* istanbul ignore next */ []));
|
|
340
|
+
this.scrollViewWidth = computed(() => {
|
|
341
|
+
const width = this.width();
|
|
342
|
+
return toCssValue(width);
|
|
343
|
+
}, /* @ts-ignore */
|
|
344
|
+
...(ngDevMode ? [{ debugName: "scrollViewWidth" }] : /* istanbul ignore next */ []));
|
|
345
|
+
this.viewData = computed(() => {
|
|
346
|
+
const data = this.data();
|
|
347
|
+
return select(data, d => ({ data: d })).toImmutableSet();
|
|
348
|
+
}, /* @ts-ignore */
|
|
349
|
+
...(ngDevMode ? [{ debugName: "viewData" }] : /* istanbul ignore next */ []));
|
|
350
|
+
this.viewIndex = this.#viewIndex;
|
|
351
|
+
this.ariaLabel = computed(() => {
|
|
352
|
+
const index = this.viewIndex();
|
|
353
|
+
const count = this.itemCount();
|
|
354
|
+
return count > 0 ? `Page ${index + 1} of ${count}` : undefined;
|
|
355
|
+
}, /* @ts-ignore */
|
|
356
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
357
|
+
/**
|
|
358
|
+
* @description Sets whether page transitions are animated.
|
|
359
|
+
* Pass a boolean for default duration (500ms) or a number for custom duration in milliseconds.
|
|
360
|
+
* @default true
|
|
361
|
+
*/
|
|
362
|
+
this.animate = input(true, /* @ts-ignore */
|
|
363
|
+
...(ngDevMode ? [{ debugName: "animate" }] : /* istanbul ignore next */ []));
|
|
364
|
+
/**
|
|
365
|
+
* @description Represents the state of arrows' visibility or activity.
|
|
366
|
+
* @default false
|
|
367
|
+
*/
|
|
368
|
+
this.arrows = input(false, /* @ts-ignore */
|
|
369
|
+
...(ngDevMode ? [{ debugName: "arrows" }] : /* istanbul ignore next */ []));
|
|
370
|
+
/**
|
|
371
|
+
* @description Sets the data of the scroll view.
|
|
372
|
+
*/
|
|
373
|
+
this.data = input([], /* @ts-ignore */
|
|
374
|
+
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
375
|
+
/**
|
|
376
|
+
* @description Sets the height of the scroll view.
|
|
377
|
+
* This property is required.
|
|
378
|
+
*/
|
|
379
|
+
this.height = input.required(/* @ts-ignore */
|
|
380
|
+
...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
381
|
+
/**
|
|
382
|
+
* @description Sets the active page of the scroll view.
|
|
383
|
+
* @default 0
|
|
384
|
+
*/
|
|
385
|
+
this.index = model(0, /* @ts-ignore */
|
|
386
|
+
...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
387
|
+
/**
|
|
388
|
+
* @description Sets whether the scroll view is infinite.
|
|
389
|
+
* @default false
|
|
390
|
+
*/
|
|
391
|
+
this.infinite = input(false, /* @ts-ignore */
|
|
392
|
+
...(ngDevMode ? [{ debugName: "infinite" }] : /* istanbul ignore next */ []));
|
|
393
|
+
/**
|
|
394
|
+
* @description Sets whether the pager is visible.
|
|
395
|
+
*/
|
|
396
|
+
this.pageable = input(false, /* @ts-ignore */
|
|
397
|
+
...(ngDevMode ? [{ debugName: "pageable" }] : /* istanbul ignore next */ []));
|
|
398
|
+
/**
|
|
399
|
+
* @description Sets the background blur of the pager in pixels.
|
|
400
|
+
* @default 3
|
|
401
|
+
*/
|
|
402
|
+
this.pagerBlur = input(3, /* @ts-ignore */
|
|
403
|
+
...(ngDevMode ? [{ debugName: "pagerBlur" }] : /* istanbul ignore next */ []));
|
|
404
|
+
/**
|
|
405
|
+
* @description Sets the color of the pager.
|
|
406
|
+
* @default "dark"
|
|
407
|
+
*/
|
|
408
|
+
this.pagerOverlay = input("dark", /* @ts-ignore */
|
|
409
|
+
...(ngDevMode ? [{ debugName: "pagerOverlay" }] : /* istanbul ignore next */ []));
|
|
410
|
+
/**
|
|
411
|
+
* @description Sets the border radius of the pager items.
|
|
412
|
+
* @default "medium"
|
|
413
|
+
*/
|
|
414
|
+
this.pagerRounded = input("medium", /* @ts-ignore */
|
|
415
|
+
...(ngDevMode ? [{ debugName: "pagerRounded" }] : /* istanbul ignore next */ []));
|
|
416
|
+
/**
|
|
417
|
+
* @description Sets the border radius of the scroll view.
|
|
418
|
+
* @default "medium"
|
|
419
|
+
*/
|
|
420
|
+
this.rounded = input("medium", /* @ts-ignore */
|
|
421
|
+
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
422
|
+
/**
|
|
423
|
+
* @description Sets custom CSS classes on the component host element. Merged with base classes via tailwind-merge.
|
|
424
|
+
*/
|
|
425
|
+
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
426
|
+
/**
|
|
427
|
+
* @description Sets the width of the scroll view.
|
|
428
|
+
*/
|
|
429
|
+
this.width = input.required(/* @ts-ignore */
|
|
430
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
431
|
+
this.#destroyRef.onDestroy(() => {
|
|
432
|
+
this.#scroll$.complete();
|
|
433
|
+
this.#resizeObserver?.disconnect();
|
|
434
|
+
this.#document.removeEventListener("mouseup", this.#scrollMouseUpHandler);
|
|
435
|
+
});
|
|
436
|
+
afterNextRender(() => {
|
|
437
|
+
this.setPagerListResizeObserver();
|
|
438
|
+
this.setSubscriptions();
|
|
439
|
+
this.scrollActivePageIntoView();
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
onArrowClick(direction) {
|
|
443
|
+
this.navigate(direction, this.infinite());
|
|
444
|
+
}
|
|
445
|
+
onPageClick(index, element) {
|
|
446
|
+
this.index.set(index);
|
|
447
|
+
element.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
|
|
448
|
+
}
|
|
449
|
+
onPagerScroll(element, direction, type) {
|
|
450
|
+
if (type === "continuous") {
|
|
451
|
+
this.#document.addEventListener("mouseup", this.#scrollMouseUpHandler, { once: true });
|
|
452
|
+
}
|
|
453
|
+
const timeFunction = type === "single" ? timer : interval;
|
|
454
|
+
timeFunction(60)
|
|
455
|
+
.pipe(takeUntil(this.#scroll$), takeUntilDestroyed(this.#destroyRef))
|
|
456
|
+
.subscribe(() => {
|
|
457
|
+
let left = 0;
|
|
458
|
+
switch (direction) {
|
|
459
|
+
case "left":
|
|
460
|
+
left = Math.max(element.scrollLeft - 100, 0);
|
|
461
|
+
element.scrollTo({ left, behavior: "smooth" });
|
|
462
|
+
break;
|
|
463
|
+
case "right":
|
|
464
|
+
left = Math.min(element.scrollLeft + 100, element.scrollWidth);
|
|
465
|
+
element.scrollTo({ left, behavior: "smooth" });
|
|
466
|
+
break;
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
onPagerScrollEnd() {
|
|
471
|
+
this.#document.removeEventListener("mouseup", this.#scrollMouseUpHandler);
|
|
472
|
+
this.#scroll$.next();
|
|
473
|
+
this.#scroll$.complete();
|
|
474
|
+
this.#scroll$ = new Subject();
|
|
475
|
+
}
|
|
476
|
+
navigate(direction, infinite) {
|
|
477
|
+
if (direction === "left") {
|
|
478
|
+
this.navigateLeft(infinite);
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
this.navigateRight(infinite);
|
|
482
|
+
}
|
|
483
|
+
this.scrollActivePageIntoView();
|
|
484
|
+
}
|
|
485
|
+
navigateLeft(infinite) {
|
|
486
|
+
const currentIndex = this.index();
|
|
487
|
+
const dataLength = this.viewData().length;
|
|
488
|
+
if (dataLength === 0) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (infinite) {
|
|
492
|
+
this.index.set((currentIndex - 1 + dataLength) % dataLength);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
this.index.set(Math.max(0, currentIndex - 1));
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
navigateRight(infinite) {
|
|
499
|
+
const currentIndex = this.index();
|
|
500
|
+
const dataLength = this.viewData().length;
|
|
501
|
+
if (dataLength === 0) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
if (infinite) {
|
|
505
|
+
this.index.set((currentIndex + 1) % dataLength);
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
this.index.set(Math.min(dataLength - 1, currentIndex + 1));
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
scrollActivePageIntoView() {
|
|
512
|
+
asyncScheduler.schedule(() => {
|
|
513
|
+
const element = this.#hostElementRef.nativeElement.querySelector("button[data-active-page='true']");
|
|
514
|
+
if (element) {
|
|
515
|
+
element.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
setPagerListResizeObserver() {
|
|
520
|
+
const pagerListElementRef = this.pagerListElementRef();
|
|
521
|
+
if (pagerListElementRef) {
|
|
522
|
+
const element = pagerListElementRef.nativeElement;
|
|
523
|
+
this.pagerArrowVisible.set(element.scrollWidth > element.clientWidth);
|
|
524
|
+
this.#resizeObserver = new ResizeObserver(() => {
|
|
525
|
+
const scrollWidth = element.scrollWidth;
|
|
526
|
+
const clientWidth = element.clientWidth;
|
|
527
|
+
this.pagerArrowVisible.set(scrollWidth > clientWidth);
|
|
528
|
+
});
|
|
529
|
+
this.#resizeObserver.observe(element);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
setSubscriptions() {
|
|
533
|
+
fromEvent(this.#hostElementRef.nativeElement, "keydown")
|
|
534
|
+
.pipe(takeUntilDestroyed(this.#destroyRef), filter(event => event.key === "ArrowLeft" || event.key === "ArrowRight"), tap(event => {
|
|
535
|
+
const direction = event.key === "ArrowLeft" ? "left" : "right";
|
|
536
|
+
this.navigate(direction, this.infinite());
|
|
537
|
+
}))
|
|
538
|
+
.subscribe();
|
|
539
|
+
}
|
|
540
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ScrollViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
541
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ScrollViewComponent, isStandalone: true, selector: "mona-scroll-view", inputs: { animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null }, arrows: { classPropertyName: "arrows", publicName: "arrows", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: true, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, infinite: { classPropertyName: "infinite", publicName: "infinite", isSignal: true, isRequired: false, transformFunction: null }, pageable: { classPropertyName: "pageable", publicName: "pageable", isSignal: true, isRequired: false, transformFunction: null }, pagerBlur: { classPropertyName: "pagerBlur", publicName: "pagerBlur", isSignal: true, isRequired: false, transformFunction: null }, pagerOverlay: { classPropertyName: "pagerOverlay", publicName: "pagerOverlay", isSignal: true, isRequired: false, transformFunction: null }, pagerRounded: { classPropertyName: "pagerRounded", publicName: "pagerRounded", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { index: "indexChange" }, host: { properties: { "class": "baseClass()", "attr.tabindex": "0", "style.height": "scrollViewHeight()", "style.width": "scrollViewWidth()", "attr.role": "'region'", "attr.aria-roledescription": "'carousel'", "attr.aria-label": "ariaLabel()" } }, queries: [{ propertyName: "contentTemplate", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "pagerListElementRef", first: true, predicate: ["pagerListElement"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"contentClass()\" #contentElement>\n <ul [class]=\"listClass()\">\n @for (item of viewData(); track $index) {\n @if ($index === viewIndex()) {\n <li\n role=\"group\"\n aria-roledescription=\"slide\"\n [attr.aria-label]=\"$index + 1 + ' of ' + itemCount()\"\n [animate.enter]=\"enterAnimation()\"\n [animate.leave]=\"leaveAnimation()\"\n [style.animation-duration.ms]=\"animationDuration()\">\n @let width = contentElement.clientWidth;\n @let height = contentElement.clientHeight;\n <ng-container\n [ngTemplateOutlet]=\"contentTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.data, width, height }\"></ng-container>\n </li>\n }\n }\n </ul>\n</div>\n<button\n type=\"button\"\n [class]=\"leftArrowClass()\"\n (click)=\"onArrowClick('left')\"\n [attr.data-navigate-prev]=\"true\"\n aria-label=\"Previous page\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-left-icon lucide-chevron-left\">\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n</button>\n<button\n type=\"button\"\n [class]=\"rightArrowClass()\"\n (click)=\"onArrowClick('right')\"\n [attr.data-navigate-next]=\"true\"\n aria-label=\"Next page\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-right-icon lucide-chevron-right\">\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n</button>\n\n@if (pageable()) {\n <div [class]=\"pagerClass()\" [style.backdrop-filter]=\"'blur(' + pagerBlur() + 'px)'\">\n @if (pagerArrowVisible()) {\n <button\n type=\"button\"\n [class]=\"pagerArrowClass()\"\n aria-label=\"Scroll pager left\"\n (click)=\"onPagerScroll(pagerListElement, 'left', 'single')\"\n (mousedown)=\"onPagerScroll(pagerListElement, 'left', 'continuous')\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-left-icon lucide-chevron-left\">\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n }\n <div [class]=\"pagerListContainerClass()\">\n <ul [class]=\"pagerListClass()\" #pagerListElement>\n @for (_ of viewData(); track $index) {\n <li [attr.data-page-index]=\"$index\" [attr.data-page-item]=\"true\">\n <button\n type=\"button\"\n monaScrollViewActivePage\n [active]=\"$index === viewIndex()\"\n [rounded]=\"pagerRounded()\"\n [attr.data-active-page]=\"$index === viewIndex()\"\n [attr.aria-current]=\"$index === viewIndex() ? true : null\"\n [attr.aria-label]=\"'Page ' + ($index + 1)\"\n (click)=\"onPageClick($index, pagerItemElement)\"\n #pagerItemElement></button>\n </li>\n }\n </ul>\n </div>\n @if (pagerArrowVisible()) {\n <button\n type=\"button\"\n [class]=\"pagerArrowClass()\"\n aria-label=\"Scroll pager right\"\n (click)=\"onPagerScroll(pagerListElement, 'right', 'single')\"\n (mousedown)=\"onPagerScroll(pagerListElement, 'right', 'continuous')\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-right-icon lucide-chevron-right\">\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n }\n </div>\n}\n", styles: ["@keyframes slideInFromRight{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideOutToLeft{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes slideInFromLeft{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideOutToRight{0%{transform:translate(0)}to{transform:translate(100%)}}.slide-in-from-right{animation:slideInFromRight .5s ease-out both}.slide-out-to-left{animation:slideOutToLeft .5s ease-out both}.slide-in-from-left{animation:slideInFromLeft .5s ease-out both}.slide-out-to-right{animation:slideOutToRight .5s ease-out both}@media(prefers-reduced-motion:reduce){.slide-in-from-right,.slide-out-to-left,.slide-in-from-left,.slide-out-to-right{animation-duration:1ms}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ScrollViewActivePageDirective, selector: "button[monaScrollViewActivePage]", inputs: ["active", "rounded"] }] }); }
|
|
542
|
+
}
|
|
543
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ScrollViewComponent, decorators: [{
|
|
544
|
+
type: Component,
|
|
545
|
+
args: [{ selector: "mona-scroll-view", imports: [NgTemplateOutlet, ScrollViewActivePageDirective], host: {
|
|
546
|
+
"[class]": "baseClass()",
|
|
547
|
+
"[attr.tabindex]": "0",
|
|
548
|
+
"[style.height]": "scrollViewHeight()",
|
|
549
|
+
"[style.width]": "scrollViewWidth()",
|
|
550
|
+
"[attr.role]": "'region'",
|
|
551
|
+
"[attr.aria-roledescription]": "'carousel'",
|
|
552
|
+
"[attr.aria-label]": "ariaLabel()"
|
|
553
|
+
}, template: "<div [class]=\"contentClass()\" #contentElement>\n <ul [class]=\"listClass()\">\n @for (item of viewData(); track $index) {\n @if ($index === viewIndex()) {\n <li\n role=\"group\"\n aria-roledescription=\"slide\"\n [attr.aria-label]=\"$index + 1 + ' of ' + itemCount()\"\n [animate.enter]=\"enterAnimation()\"\n [animate.leave]=\"leaveAnimation()\"\n [style.animation-duration.ms]=\"animationDuration()\">\n @let width = contentElement.clientWidth;\n @let height = contentElement.clientHeight;\n <ng-container\n [ngTemplateOutlet]=\"contentTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: item.data, width, height }\"></ng-container>\n </li>\n }\n }\n </ul>\n</div>\n<button\n type=\"button\"\n [class]=\"leftArrowClass()\"\n (click)=\"onArrowClick('left')\"\n [attr.data-navigate-prev]=\"true\"\n aria-label=\"Previous page\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-left-icon lucide-chevron-left\">\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n</button>\n<button\n type=\"button\"\n [class]=\"rightArrowClass()\"\n (click)=\"onArrowClick('right')\"\n [attr.data-navigate-next]=\"true\"\n aria-label=\"Next page\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"48\"\n height=\"48\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-right-icon lucide-chevron-right\">\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n</button>\n\n@if (pageable()) {\n <div [class]=\"pagerClass()\" [style.backdrop-filter]=\"'blur(' + pagerBlur() + 'px)'\">\n @if (pagerArrowVisible()) {\n <button\n type=\"button\"\n [class]=\"pagerArrowClass()\"\n aria-label=\"Scroll pager left\"\n (click)=\"onPagerScroll(pagerListElement, 'left', 'single')\"\n (mousedown)=\"onPagerScroll(pagerListElement, 'left', 'continuous')\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-left-icon lucide-chevron-left\">\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n </button>\n }\n <div [class]=\"pagerListContainerClass()\">\n <ul [class]=\"pagerListClass()\" #pagerListElement>\n @for (_ of viewData(); track $index) {\n <li [attr.data-page-index]=\"$index\" [attr.data-page-item]=\"true\">\n <button\n type=\"button\"\n monaScrollViewActivePage\n [active]=\"$index === viewIndex()\"\n [rounded]=\"pagerRounded()\"\n [attr.data-active-page]=\"$index === viewIndex()\"\n [attr.aria-current]=\"$index === viewIndex() ? true : null\"\n [attr.aria-label]=\"'Page ' + ($index + 1)\"\n (click)=\"onPageClick($index, pagerItemElement)\"\n #pagerItemElement></button>\n </li>\n }\n </ul>\n </div>\n @if (pagerArrowVisible()) {\n <button\n type=\"button\"\n [class]=\"pagerArrowClass()\"\n aria-label=\"Scroll pager right\"\n (click)=\"onPagerScroll(pagerListElement, 'right', 'single')\"\n (mousedown)=\"onPagerScroll(pagerListElement, 'right', 'continuous')\">\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"lucide lucide-chevron-right-icon lucide-chevron-right\">\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </button>\n }\n </div>\n}\n", styles: ["@keyframes slideInFromRight{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideOutToLeft{0%{transform:translate(0)}to{transform:translate(-100%)}}@keyframes slideInFromLeft{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes slideOutToRight{0%{transform:translate(0)}to{transform:translate(100%)}}.slide-in-from-right{animation:slideInFromRight .5s ease-out both}.slide-out-to-left{animation:slideOutToLeft .5s ease-out both}.slide-in-from-left{animation:slideInFromLeft .5s ease-out both}.slide-out-to-right{animation:slideOutToRight .5s ease-out both}@media(prefers-reduced-motion:reduce){.slide-in-from-right,.slide-out-to-left,.slide-in-from-left,.slide-out-to-right{animation-duration:1ms}}\n"] }]
|
|
554
|
+
}], ctorParameters: () => [], propDecorators: { contentTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }], pagerListElementRef: [{ type: i0.ViewChild, args: ["pagerListElement", { isSignal: true }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], arrows: [{ type: i0.Input, args: [{ isSignal: true, alias: "arrows", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: true }] }], index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }, { type: i0.Output, args: ["indexChange"] }], infinite: [{ type: i0.Input, args: [{ isSignal: true, alias: "infinite", required: false }] }], pageable: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageable", required: false }] }], pagerBlur: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagerBlur", required: false }] }], pagerOverlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagerOverlay", required: false }] }], pagerRounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagerRounded", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: true }] }] } });
|
|
555
|
+
|
|
556
|
+
/*
|
|
557
|
+
* Public API Surface of @nanahoshi/mona-ui/scroll-view
|
|
558
|
+
*/
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Generated bundle index. Do not edit.
|
|
562
|
+
*/
|
|
563
|
+
|
|
564
|
+
export { ScrollViewActivePageDirective, ScrollViewComponent };
|
|
565
|
+
//# sourceMappingURL=nanahoshi-mona-ui-scroll-view.mjs.map
|