@nanahoshi/mona-ui 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +40 -55
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +19 -53
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +15 -26
- package/fesm2022/nanahoshi-mona-ui-button.mjs +67 -68
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +54 -150
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +67 -99
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +35 -45
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +9 -23
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +27 -78
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +17 -39
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +39 -48
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +34 -54
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +9 -12
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +42 -29
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +53 -53
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +40 -153
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +33 -54
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +7 -12
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +59 -219
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +24 -75
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +11 -44
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +11 -41
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B2ETh-uI.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DZk18LJC.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-C7WKhhig.mjs → nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs} +9 -16
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-BRiY0CDX.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +15 -44
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BrYpFMyF.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs} +11 -20
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-T9Bj98kl.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +109 -393
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +27 -57
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +31 -122
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +4 -26
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +5 -18
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +48 -154
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +36 -63
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +24 -108
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +38 -64
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +21 -73
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +8 -30
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +29 -50
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +36 -108
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +19 -60
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +78 -98
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +53 -144
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +54 -110
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +7 -20
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +15 -50
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +28 -91
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +37 -59
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +35 -107
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +19 -31
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +60 -65
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +43 -29
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +40 -102
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +13 -41
- package/fesm2022/nanahoshi-mona-ui-window.mjs +29 -108
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +2 -1
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +18 -10
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -5
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +2 -3
- package/types/nanahoshi-mona-ui-grid.d.ts +14 -15
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +6 -7
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +28 -13
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +12 -13
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +14 -16
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +16 -7
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +11 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { computed, input, output, model, Component, Directive } from '@angular/core';
|
|
4
4
|
import { FormsModule } from '@angular/forms';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
6
|
import { cva } from 'class-variance-authority';
|
|
7
|
+
import { themeControlSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
focus:ring-2 focus:ring-primary focus:ring-offset-2
|
|
9
|
+
const radioButtonThemeVariants = cva(`
|
|
10
|
+
peer absolute inset-0 z-10 h-full w-full
|
|
11
|
+
cursor-pointer appearance-none opacity-0
|
|
12
|
+
outline-none
|
|
14
13
|
disabled:cursor-not-allowed
|
|
15
14
|
`);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
bg-input-background
|
|
15
|
+
const radioButtonCircleThemeVariants = cva(`
|
|
16
|
+
relative flex h-4.5 w-4.5 items-center justify-center
|
|
17
|
+
cursor-pointer overflow-hidden
|
|
18
|
+
${themeControlSurfaceClasses}
|
|
21
19
|
border border-input-border
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
peer-
|
|
26
|
-
|
|
20
|
+
transition-colors duration-(--mona-motion-fast)
|
|
21
|
+
|
|
22
|
+
peer-disabled:cursor-not-allowed
|
|
23
|
+
peer-disabled:border-disabled-border peer-disabled:bg-disabled-background peer-disabled:text-disabled-foreground
|
|
24
|
+
|
|
25
|
+
peer-focus-visible:border-focus-indicator
|
|
26
|
+
peer-focus-visible:ring-2 peer-focus-visible:ring-focus-indicator/35
|
|
27
27
|
|
|
28
28
|
data-[invalid='true']:border-error
|
|
29
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/
|
|
29
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
30
|
+
data-[invalid='true']:peer-focus-visible:border-error
|
|
31
|
+
data-[invalid='true']:peer-focus-visible:ring-error/35
|
|
30
32
|
`, {
|
|
31
33
|
variants: {
|
|
32
34
|
rounded: {
|
|
@@ -38,8 +40,10 @@ const radioButtonCircleVariants = cva(`
|
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
|
-
const
|
|
42
|
-
flex
|
|
43
|
+
const radioButtonIndicatorThemeVariants = cva(`
|
|
44
|
+
flex h-3 w-3
|
|
45
|
+
bg-primary
|
|
46
|
+
transition-all duration-(--mona-motion-fast)
|
|
43
47
|
`, {
|
|
44
48
|
variants: {
|
|
45
49
|
rounded: {
|
|
@@ -51,13 +55,12 @@ const radioButtonIndicatorVariants = cva(`
|
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
});
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
relative
|
|
58
|
+
const radioButtonContainerLabelThemeVariants = cva(`
|
|
59
|
+
relative flex h-full w-full items-center justify-center gap-1
|
|
57
60
|
cursor-pointer
|
|
58
61
|
data-[disabled='true']:pointer-events-none
|
|
59
62
|
data-[disabled='true']:cursor-not-allowed
|
|
60
|
-
data-[disabled='true']:
|
|
63
|
+
data-[disabled='true']:text-disabled-foreground
|
|
61
64
|
`, {
|
|
62
65
|
variants: {
|
|
63
66
|
labelSize: {
|
|
@@ -70,30 +73,31 @@ const radioButtonContainerLabelVariants = cva(`
|
|
|
70
73
|
labelSize: "medium"
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
place-content-center
|
|
80
|
-
flex items-center justify-center
|
|
76
|
+
const radioButtonDirectiveThemeVariants = cva(`
|
|
77
|
+
relative flex h-4.5 w-4.5 items-center justify-center place-content-center
|
|
78
|
+
cursor-pointer appearance-none
|
|
79
|
+
${themeControlSurfaceClasses}
|
|
80
|
+
border border-input-border
|
|
81
|
+
outline-none
|
|
81
82
|
|
|
82
|
-
disabled:pointer-events-none
|
|
83
|
-
disabled:
|
|
84
|
-
disabled:opacity-50
|
|
83
|
+
disabled:pointer-events-none disabled:cursor-not-allowed
|
|
84
|
+
disabled:border-disabled-border disabled:bg-disabled-background disabled:text-disabled-foreground
|
|
85
85
|
|
|
86
|
-
after:content-['']
|
|
87
|
-
after:w-3 after:h-3
|
|
88
86
|
after:inline-grid
|
|
87
|
+
after:h-3 after:w-3
|
|
89
88
|
after:place-content-center
|
|
89
|
+
after:content-['']
|
|
90
90
|
|
|
91
91
|
checked:after:bg-primary
|
|
92
92
|
checked:after:rounded-full
|
|
93
93
|
|
|
94
|
-
focus-visible:
|
|
94
|
+
focus-visible:border-focus-indicator
|
|
95
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
95
96
|
|
|
96
|
-
[
|
|
97
|
+
data-[invalid='true']:border-error
|
|
98
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
99
|
+
data-[invalid='true']:focus-visible:border-error
|
|
100
|
+
data-[invalid='true']:focus-visible:ring-error/35
|
|
97
101
|
`, {
|
|
98
102
|
variants: {
|
|
99
103
|
rounded: {
|
|
@@ -128,70 +132,27 @@ const radioButtonDirectiveVariants = cva(`
|
|
|
128
132
|
]
|
|
129
133
|
});
|
|
130
134
|
|
|
131
|
-
const radioButtonThemeVariants = (theme) => {
|
|
132
|
-
switch (theme) {
|
|
133
|
-
case "mona":
|
|
134
|
-
return radioButtonVariants;
|
|
135
|
-
default:
|
|
136
|
-
return radioButtonVariants; // Default to Mona styles
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
const radioButtonCircleThemeVariants = (theme) => {
|
|
140
|
-
switch (theme) {
|
|
141
|
-
case "mona":
|
|
142
|
-
return radioButtonCircleVariants;
|
|
143
|
-
default:
|
|
144
|
-
return radioButtonCircleVariants; // Default to Mona styles
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const radioButtonIndicatorThemeVariants = (theme) => {
|
|
148
|
-
switch (theme) {
|
|
149
|
-
case "mona":
|
|
150
|
-
return radioButtonIndicatorVariants;
|
|
151
|
-
default:
|
|
152
|
-
return radioButtonIndicatorVariants; // Default to Mona styles
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const radioButtonContainerLabelThemeVariants = (theme) => {
|
|
156
|
-
switch (theme) {
|
|
157
|
-
case "mona":
|
|
158
|
-
return radioButtonContainerLabelVariants;
|
|
159
|
-
default:
|
|
160
|
-
return radioButtonContainerLabelVariants; // Default to Mona styles
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
const radioButtonDirectiveThemeVariants = (theme) => {
|
|
164
|
-
switch (theme) {
|
|
165
|
-
case "mona":
|
|
166
|
-
return radioButtonDirectiveVariants;
|
|
167
|
-
default:
|
|
168
|
-
return radioButtonDirectiveVariants; // Default to Mona styles
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
|
|
172
135
|
class RadioButtonComponent {
|
|
173
136
|
constructor() {
|
|
174
|
-
this.#themeService = inject(ThemeService);
|
|
175
137
|
this.containerLabelClasses = computed(() => {
|
|
176
|
-
const theme = this.#themeService.theme();
|
|
177
138
|
const labelSize = this.labelSize();
|
|
178
139
|
const userClasses = this.userClass();
|
|
179
|
-
const variantClasses = radioButtonContainerLabelThemeVariants(
|
|
140
|
+
const variantClasses = radioButtonContainerLabelThemeVariants({ labelSize });
|
|
180
141
|
return twMerge(variantClasses, userClasses);
|
|
181
142
|
}, /* @ts-ignore */
|
|
182
143
|
...(ngDevMode ? [{ debugName: "containerLabelClasses" }] : /* istanbul ignore next */ []));
|
|
144
|
+
this.invalidState = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
|
|
145
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
183
146
|
this.radioButtonCircleClasses = computed(() => {
|
|
184
|
-
const theme = this.#themeService.theme();
|
|
185
147
|
const rounded = this.rounded();
|
|
186
|
-
return radioButtonCircleThemeVariants(
|
|
148
|
+
return radioButtonCircleThemeVariants({ rounded });
|
|
187
149
|
}, /* @ts-ignore */
|
|
188
150
|
...(ngDevMode ? [{ debugName: "radioButtonCircleClasses" }] : /* istanbul ignore next */ []));
|
|
189
|
-
this.radioButtonClasses = computed(() => radioButtonThemeVariants(
|
|
151
|
+
this.radioButtonClasses = computed(() => radioButtonThemeVariants(), /* @ts-ignore */
|
|
190
152
|
...(ngDevMode ? [{ debugName: "radioButtonClasses" }] : /* istanbul ignore next */ []));
|
|
191
153
|
this.radioButtonIndicatorClasses = computed(() => {
|
|
192
|
-
const theme = this.#themeService.theme();
|
|
193
154
|
const rounded = this.rounded();
|
|
194
|
-
return radioButtonIndicatorThemeVariants(
|
|
155
|
+
return radioButtonIndicatorThemeVariants({ rounded });
|
|
195
156
|
}, /* @ts-ignore */
|
|
196
157
|
...(ngDevMode ? [{ debugName: "radioButtonIndicatorClasses" }] : /* istanbul ignore next */ []));
|
|
197
158
|
/**
|
|
@@ -262,6 +223,13 @@ class RadioButtonComponent {
|
|
|
262
223
|
this.rounded = input("full", /* @ts-ignore */
|
|
263
224
|
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
264
225
|
this.touch = output();
|
|
226
|
+
/**
|
|
227
|
+
* @description Marks the radio button as touched. Error styling requires both `invalid` and `touched` to be `true`.
|
|
228
|
+
* When bound to a signal form field via `[field]`, this is written by the signal forms `Field` directive.
|
|
229
|
+
* @default false
|
|
230
|
+
*/
|
|
231
|
+
this.touched = input(false, /* @ts-ignore */
|
|
232
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
265
233
|
/**
|
|
266
234
|
* @description Additional CSS classes merged onto the label container element via `tailwind-merge`.
|
|
267
235
|
* @default ""
|
|
@@ -276,7 +244,6 @@ class RadioButtonComponent {
|
|
|
276
244
|
this.value = model(undefined, /* @ts-ignore */
|
|
277
245
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
278
246
|
}
|
|
279
|
-
#themeService;
|
|
280
247
|
onBlur(event) {
|
|
281
248
|
this.inputBlur.emit(event);
|
|
282
249
|
this.touch.emit();
|
|
@@ -286,46 +253,59 @@ class RadioButtonComponent {
|
|
|
286
253
|
this.touch.emit();
|
|
287
254
|
}
|
|
288
255
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
289
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: RadioButtonComponent, isStandalone: true, selector: "mona-radio-button", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, labelSize: { classPropertyName: "labelSize", publicName: "labelSize", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, radioValue: { classPropertyName: "radioValue", publicName: "radioValue", 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 }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputBlur: "inputBlur", inputClick: "inputClick", inputFocus: "inputFocus", touch: "touch", value: "valueChange" }, host: { properties: { "attr.data-selected": "radioValue()===value()", "attr.data-disabled": "disabled()" } }, ngImport: i0, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n type=\"radio\"\n [disabled]=\"disabled()\"\n [name]=\"name()\"\n [value]=\"radioValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"radioValue() === value()\"\n [attr.aria-invalid]=\"
|
|
256
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: RadioButtonComponent, isStandalone: true, selector: "mona-radio-button", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, labelSize: { classPropertyName: "labelSize", publicName: "labelSize", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, radioValue: { classPropertyName: "radioValue", publicName: "radioValue", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { inputBlur: "inputBlur", inputClick: "inputClick", inputFocus: "inputFocus", touch: "touch", value: "valueChange" }, host: { properties: { "attr.data-selected": "radioValue()===value()", "attr.data-disabled": "disabled()" } }, ngImport: i0, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n type=\"radio\"\n [disabled]=\"disabled()\"\n [name]=\"name()\"\n [value]=\"radioValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"radioValue() === value()\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n (blur)=\"onBlur($event)\"\n (click)=\"inputClick.emit($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (change)=\"onSelectionChange()\" />\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalidState() || null\">\n @if (radioValue() === value()) {\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
290
257
|
}
|
|
291
258
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonComponent, decorators: [{
|
|
292
259
|
type: Component,
|
|
293
260
|
args: [{ selector: "mona-radio-button", imports: [FormsModule, NgTemplateOutlet], host: {
|
|
294
261
|
"[attr.data-selected]": "radioValue()===value()",
|
|
295
262
|
"[attr.data-disabled]": "disabled()"
|
|
296
|
-
}, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n type=\"radio\"\n [disabled]=\"disabled()\"\n [name]=\"name()\"\n [value]=\"radioValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"radioValue() === value()\"\n [attr.aria-invalid]=\"
|
|
297
|
-
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputClick: [{ type: i0.Output, args: ["inputClick"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], labelSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelSize", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
263
|
+
}, template: "<label [class]=\"containerLabelClasses()\" [attr.data-disabled]=\"disabled()\">\n @if (labelPosition() === \"before\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n <input\n type=\"radio\"\n [disabled]=\"disabled()\"\n [name]=\"name()\"\n [value]=\"radioValue()\"\n [class]=\"radioButtonClasses()\"\n [checked]=\"radioValue() === value()\"\n [attr.aria-invalid]=\"invalidState() ? 'true' : null\"\n (blur)=\"onBlur($event)\"\n (click)=\"inputClick.emit($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (change)=\"onSelectionChange()\" />\n <span [class]=\"radioButtonCircleClasses()\" [attr.data-invalid]=\"invalidState() || null\">\n @if (radioValue() === value()) {\n <span [class]=\"radioButtonIndicatorClasses()\"></span>\n }\n </span>\n @if (labelPosition() === \"after\") {\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\n }\n</label>\n\n<ng-template #labelTemplate>\n @if (label()) {\n <span>{{ label() }}</span>\n } @else {\n <ng-content></ng-content>\n }\n</ng-template>\n" }]
|
|
264
|
+
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputClick: [{ type: i0.Output, args: ["inputClick"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], labelSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelSize", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
298
265
|
|
|
299
266
|
class RadioButtonDirective {
|
|
300
267
|
constructor() {
|
|
301
|
-
this.#themeService = inject(ThemeService);
|
|
302
268
|
this.classes = computed(() => {
|
|
303
|
-
const theme = this.#themeService.theme();
|
|
304
269
|
const rounded = this.rounded();
|
|
305
|
-
return radioButtonDirectiveThemeVariants(
|
|
270
|
+
return radioButtonDirectiveThemeVariants({ rounded });
|
|
306
271
|
}, /* @ts-ignore */
|
|
307
272
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
273
|
+
this.inputInvalid = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
|
|
274
|
+
...(ngDevMode ? [{ debugName: "inputInvalid" }] : /* istanbul ignore next */ []));
|
|
275
|
+
/**
|
|
276
|
+
* @description Marks the radio button as invalid, triggering error border and ring styling.
|
|
277
|
+
* @default false
|
|
278
|
+
*/
|
|
279
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
308
281
|
/**
|
|
309
282
|
* @description Sets the border radius of the radio button.
|
|
310
283
|
* @default "none"
|
|
311
284
|
*/
|
|
312
285
|
this.rounded = input("none", /* @ts-ignore */
|
|
313
286
|
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
287
|
+
/**
|
|
288
|
+
* @description Marks the radio button as touched. Error styling is only shown when both `invalid` and `touched` are `true`.
|
|
289
|
+
* @default false
|
|
290
|
+
*/
|
|
291
|
+
this.touched = input(false, /* @ts-ignore */
|
|
292
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
314
293
|
}
|
|
315
|
-
#themeService;
|
|
316
294
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
317
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: RadioButtonDirective, isStandalone: true, selector: "input[type='radio'][monaRadioButton]", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.role": "'radio'" } }, ngImport: i0 }); }
|
|
295
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: RadioButtonDirective, isStandalone: true, selector: "input[type='radio'][monaRadioButton]", inputs: { invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-invalid": "inputInvalid() || null", "attr.data-invalid": "inputInvalid() || null", "class": "classes()", "attr.role": "'radio'" } }, ngImport: i0 }); }
|
|
318
296
|
}
|
|
319
297
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: RadioButtonDirective, decorators: [{
|
|
320
298
|
type: Directive,
|
|
321
299
|
args: [{
|
|
322
300
|
selector: "input[type='radio'][monaRadioButton]",
|
|
323
301
|
host: {
|
|
302
|
+
"[attr.aria-invalid]": "inputInvalid() || null",
|
|
303
|
+
"[attr.data-invalid]": "inputInvalid() || null",
|
|
324
304
|
"[class]": "classes()",
|
|
325
305
|
"[attr.role]": "'radio'"
|
|
326
306
|
}
|
|
327
307
|
}]
|
|
328
|
-
}], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }] } });
|
|
308
|
+
}], propDecorators: { invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }] } });
|
|
329
309
|
|
|
330
310
|
/*
|
|
331
311
|
* Public API Surface of @nanahoshi/mona-ui/radio-button
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { computed, input, Directive, inject, DestroyRef, DOCUMENT, ElementRef, contentChild, TemplateRef, signal, viewChild, model, afterNextRender, Component } from '@angular/core';
|
|
4
4
|
import { toSignal, toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { toCssValue } from '@nanahoshi/mona-ui/internal';
|
|
6
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
6
|
import { select } from '@mirei/ts-collections';
|
|
8
7
|
import { startWith, pairwise, map, Subject, timer, interval, takeUntil, asyncScheduler, fromEvent, filter, tap } from 'rxjs';
|
|
9
8
|
import { twMerge } from 'tailwind-merge';
|
|
10
9
|
import { cva } from 'class-variance-authority';
|
|
11
10
|
|
|
12
|
-
const
|
|
13
|
-
block
|
|
14
|
-
|
|
15
|
-
border border-border
|
|
11
|
+
const scrollViewBaseThemeVariants = cva(`
|
|
12
|
+
relative block h-full w-full overflow-hidden
|
|
13
|
+
bg-surface outline-none
|
|
14
|
+
border border-border-subtle
|
|
15
|
+
focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-indicator/35
|
|
16
16
|
`, {
|
|
17
17
|
variants: {
|
|
18
18
|
rounded: {
|
|
@@ -23,26 +23,24 @@ const scrollViewBaseVariants = cva(`
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
const
|
|
26
|
+
const scrollViewContentThemeVariants = cva(`
|
|
27
27
|
absolute inset-0 overflow-hidden
|
|
28
28
|
`);
|
|
29
|
-
const
|
|
30
|
-
relative list-none
|
|
29
|
+
const scrollViewListThemeVariants = cva(`
|
|
30
|
+
relative h-full list-none
|
|
31
31
|
[&_li]:absolute
|
|
32
32
|
[&_li]:inset-0
|
|
33
33
|
[&_li]:outline-none
|
|
34
34
|
`);
|
|
35
|
-
const
|
|
36
|
-
absolute top-0 bottom-0
|
|
37
|
-
|
|
35
|
+
const scrollViewArrowThemeVariants = cva(`
|
|
36
|
+
absolute top-0 bottom-0 flex items-center justify-center
|
|
37
|
+
px-1
|
|
38
38
|
cursor-pointer select-none
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
[&_svg]:
|
|
44
|
-
hover:[&_svg]:opacity-100
|
|
45
|
-
[&_svg]:transition-opacity duration-300 ease-out
|
|
39
|
+
bg-surface-overlay/65 text-foreground
|
|
40
|
+
transition-colors duration-(--mona-motion-standard) ease-out
|
|
41
|
+
hover:bg-hover/90 active:bg-active/90
|
|
42
|
+
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-indicator/35
|
|
43
|
+
[&_svg]:stroke-current
|
|
46
44
|
`, {
|
|
47
45
|
variants: {
|
|
48
46
|
hidden: {
|
|
@@ -59,37 +57,37 @@ const scrollViewArrowVariants = cva(`
|
|
|
59
57
|
}
|
|
60
58
|
}
|
|
61
59
|
});
|
|
62
|
-
const
|
|
63
|
-
absolute
|
|
60
|
+
const scrollViewPagerThemeVariants = cva(`
|
|
61
|
+
absolute right-0 bottom-0 left-0 flex items-center justify-center
|
|
64
62
|
`, {
|
|
65
63
|
variants: {
|
|
66
64
|
pagerOverlay: {
|
|
67
|
-
dark: "border-0 border-t border-border
|
|
68
|
-
light: "border-0 border-t border-border
|
|
65
|
+
dark: "bg-canvas/85 border-0 border-t border-border-subtle",
|
|
66
|
+
light: "bg-surface-overlay/85 border-0 border-t border-border-subtle",
|
|
69
67
|
none: ""
|
|
70
68
|
}
|
|
71
69
|
}
|
|
72
70
|
});
|
|
73
|
-
const
|
|
74
|
-
flex items-center justify-center
|
|
75
|
-
flex-1 overflow-hidden
|
|
71
|
+
const scrollViewPagerListContainerThemeVariants = cva(`
|
|
72
|
+
flex flex-1 items-center justify-center overflow-hidden
|
|
76
73
|
`);
|
|
77
|
-
const
|
|
78
|
-
flex items-center gap-2
|
|
79
|
-
list-none
|
|
80
|
-
|
|
74
|
+
const scrollViewPagerListThemeVariants = cva(`
|
|
75
|
+
flex flex-nowrap items-center gap-2
|
|
76
|
+
overflow-hidden list-none
|
|
77
|
+
px-1 py-3
|
|
81
78
|
`);
|
|
82
|
-
const
|
|
83
|
-
w-3
|
|
84
|
-
content-[' ']
|
|
85
|
-
flex-grow-0 flex-shrink-0 flex-basis-3
|
|
79
|
+
const scrollViewPagerListItemThemeVariants = cva(`
|
|
80
|
+
h-3 w-3 flex-none basis-3
|
|
86
81
|
cursor-pointer
|
|
87
|
-
border border-border
|
|
88
|
-
|
|
82
|
+
bg-muted-foreground/40 border border-border-subtle
|
|
83
|
+
transition-colors
|
|
84
|
+
not-last:me-3
|
|
85
|
+
hover:bg-muted-foreground/60 active:bg-foreground
|
|
86
|
+
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
89
87
|
`, {
|
|
90
88
|
variants: {
|
|
91
89
|
active: {
|
|
92
|
-
true: "!bg-
|
|
90
|
+
true: "!bg-foreground hover:!bg-foreground",
|
|
93
91
|
false: ""
|
|
94
92
|
},
|
|
95
93
|
pagerRounded: {
|
|
@@ -101,100 +99,23 @@ const scrollViewPagerListItemVariants = cva(`
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
});
|
|
104
|
-
const
|
|
102
|
+
const scrollViewPagerArrowThemeVariants = cva(`
|
|
105
103
|
flex items-center justify-center
|
|
106
|
-
p-2
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
[&_svg]:
|
|
113
|
-
hover:[&_svg]:opacity-100
|
|
114
|
-
[&_svg]:transition-opacity duration-300 ease-out
|
|
104
|
+
p-2
|
|
105
|
+
cursor-pointer select-none
|
|
106
|
+
font-medium text-muted-foreground
|
|
107
|
+
transition-colors duration-(--mona-motion-standard) ease-out
|
|
108
|
+
hover:bg-hover hover:text-foreground active:bg-active
|
|
109
|
+
focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-indicator/35
|
|
110
|
+
[&_svg]:stroke-current
|
|
115
111
|
`);
|
|
116
112
|
|
|
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
113
|
class ScrollViewActivePageDirective {
|
|
191
114
|
constructor() {
|
|
192
|
-
this.#themeService = inject(ThemeService);
|
|
193
115
|
this.pageItemClass = computed(() => {
|
|
194
|
-
const theme = this.#themeService.theme();
|
|
195
116
|
const active = this.active();
|
|
196
117
|
const pagerRounded = this.rounded();
|
|
197
|
-
return scrollViewPagerListItemThemeVariants(
|
|
118
|
+
return scrollViewPagerListItemThemeVariants({ active, pagerRounded });
|
|
198
119
|
}, /* @ts-ignore */
|
|
199
120
|
...(ngDevMode ? [{ debugName: "pageItemClass" }] : /* istanbul ignore next */ []));
|
|
200
121
|
this.active = input.required(/* @ts-ignore */
|
|
@@ -202,7 +123,6 @@ class ScrollViewActivePageDirective {
|
|
|
202
123
|
this.rounded = input.required(/* @ts-ignore */
|
|
203
124
|
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
204
125
|
}
|
|
205
|
-
#themeService;
|
|
206
126
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ScrollViewActivePageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
207
127
|
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
128
|
}
|
|
@@ -222,7 +142,6 @@ class ScrollViewComponent {
|
|
|
222
142
|
#viewIndex;
|
|
223
143
|
#directionFromIndex;
|
|
224
144
|
#hostElementRef;
|
|
225
|
-
#themeService;
|
|
226
145
|
#resizeObserver;
|
|
227
146
|
#scroll$;
|
|
228
147
|
#scrollMouseUpHandler;
|
|
@@ -256,7 +175,6 @@ class ScrollViewComponent {
|
|
|
256
175
|
initialValue: "right"
|
|
257
176
|
});
|
|
258
177
|
this.#hostElementRef = inject(ElementRef);
|
|
259
|
-
this.#themeService = inject(ThemeService);
|
|
260
178
|
this.#resizeObserver = null;
|
|
261
179
|
this.#scroll$ = new Subject();
|
|
262
180
|
this.#scrollMouseUpHandler = () => this.onPagerScrollEnd();
|
|
@@ -266,16 +184,14 @@ class ScrollViewComponent {
|
|
|
266
184
|
}, /* @ts-ignore */
|
|
267
185
|
...(ngDevMode ? [{ debugName: "animationDuration" }] : /* istanbul ignore next */ []));
|
|
268
186
|
this.baseClass = computed(() => {
|
|
269
|
-
const theme = this.#themeService.theme();
|
|
270
187
|
const rounded = this.rounded();
|
|
271
|
-
const variantClass = scrollViewBaseThemeVariants(
|
|
188
|
+
const variantClass = scrollViewBaseThemeVariants({ rounded });
|
|
272
189
|
const userClass = this.userClass();
|
|
273
190
|
return twMerge(variantClass, userClass);
|
|
274
191
|
}, /* @ts-ignore */
|
|
275
192
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
276
193
|
this.contentClass = computed(() => {
|
|
277
|
-
|
|
278
|
-
return scrollViewContentThemeVariants(theme)();
|
|
194
|
+
return scrollViewContentThemeVariants();
|
|
279
195
|
}, /* @ts-ignore */
|
|
280
196
|
...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
|
|
281
197
|
this.contentTemplate = contentChild(TemplateRef, /* @ts-ignore */
|
|
@@ -291,45 +207,38 @@ class ScrollViewComponent {
|
|
|
291
207
|
}, /* @ts-ignore */
|
|
292
208
|
...(ngDevMode ? [{ debugName: "leaveAnimation" }] : /* istanbul ignore next */ []));
|
|
293
209
|
this.leftArrowClass = computed(() => {
|
|
294
|
-
const theme = this.#themeService.theme();
|
|
295
210
|
const hidden = !this.arrows() || !(this.infinite() || this.index() !== 0);
|
|
296
|
-
return scrollViewArrowThemeVariants(
|
|
211
|
+
return scrollViewArrowThemeVariants({ left: true, hidden });
|
|
297
212
|
}, /* @ts-ignore */
|
|
298
213
|
...(ngDevMode ? [{ debugName: "leftArrowClass" }] : /* istanbul ignore next */ []));
|
|
299
214
|
this.listClass = computed(() => {
|
|
300
|
-
|
|
301
|
-
return scrollViewListThemeVariants(theme)();
|
|
215
|
+
return scrollViewListThemeVariants();
|
|
302
216
|
}, /* @ts-ignore */
|
|
303
217
|
...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
|
|
304
218
|
this.pagerArrowClass = computed(() => {
|
|
305
|
-
|
|
306
|
-
return scrollViewPagerArrowThemeVariants(theme)();
|
|
219
|
+
return scrollViewPagerArrowThemeVariants();
|
|
307
220
|
}, /* @ts-ignore */
|
|
308
221
|
...(ngDevMode ? [{ debugName: "pagerArrowClass" }] : /* istanbul ignore next */ []));
|
|
309
222
|
this.pagerArrowVisible = signal(true, /* @ts-ignore */
|
|
310
223
|
...(ngDevMode ? [{ debugName: "pagerArrowVisible" }] : /* istanbul ignore next */ []));
|
|
311
224
|
this.pagerClass = computed(() => {
|
|
312
|
-
const theme = this.#themeService.theme();
|
|
313
225
|
const pagerOverlay = this.pagerOverlay();
|
|
314
|
-
return scrollViewPagerThemeVariants(
|
|
226
|
+
return scrollViewPagerThemeVariants({ pagerOverlay });
|
|
315
227
|
}, /* @ts-ignore */
|
|
316
228
|
...(ngDevMode ? [{ debugName: "pagerClass" }] : /* istanbul ignore next */ []));
|
|
317
229
|
this.pagerListClass = computed(() => {
|
|
318
|
-
|
|
319
|
-
return scrollViewPagerListThemeVariants(theme)();
|
|
230
|
+
return scrollViewPagerListThemeVariants();
|
|
320
231
|
}, /* @ts-ignore */
|
|
321
232
|
...(ngDevMode ? [{ debugName: "pagerListClass" }] : /* istanbul ignore next */ []));
|
|
322
233
|
this.pagerListContainerClass = computed(() => {
|
|
323
|
-
|
|
324
|
-
return scrollViewPagerListContainerThemeVariants(theme)();
|
|
234
|
+
return scrollViewPagerListContainerThemeVariants();
|
|
325
235
|
}, /* @ts-ignore */
|
|
326
236
|
...(ngDevMode ? [{ debugName: "pagerListContainerClass" }] : /* istanbul ignore next */ []));
|
|
327
237
|
this.pagerListElementRef = viewChild("pagerListElement", /* @ts-ignore */
|
|
328
238
|
...(ngDevMode ? [{ debugName: "pagerListElementRef" }] : /* istanbul ignore next */ []));
|
|
329
239
|
this.rightArrowClass = computed(() => {
|
|
330
|
-
const theme = this.#themeService.theme();
|
|
331
240
|
const hidden = !this.arrows() || !(this.infinite() || this.index() !== this.itemCount() - 1);
|
|
332
|
-
return scrollViewArrowThemeVariants(
|
|
241
|
+
return scrollViewArrowThemeVariants({ right: true, hidden });
|
|
333
242
|
}, /* @ts-ignore */
|
|
334
243
|
...(ngDevMode ? [{ debugName: "rightArrowClass" }] : /* istanbul ignore next */ []));
|
|
335
244
|
this.scrollViewHeight = computed(() => {
|