@nanahoshi/mona-ui 0.1.1 → 0.2.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/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 +38 -53
- 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 +53 -149
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +48 -95
- 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 +26 -77
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +16 -38
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +41 -46
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +32 -52
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +9 -12
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +40 -27
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +51 -51
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +40 -153
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +32 -53
- 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 +26 -56
- 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 +35 -62
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +24 -108
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +37 -63
- 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 +47 -92
- 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 -58
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +35 -107
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +22 -30
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +40 -61
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +41 -27
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +35 -99
- 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 +6 -9
- 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 +8 -11
- 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 +4 -6
- 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 +10 -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
|
@@ -7,8 +7,7 @@ import * as i1 from '@angular/forms';
|
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
8
8
|
import { LucideChevronUp, LucideChevronDown } from '@lucide/angular';
|
|
9
9
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
10
|
-
import { rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
11
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
10
|
+
import { themeControlSurfaceClasses, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
12
11
|
import { Subject, filter, switchMap, of, tap, delay, concatMap, timer, takeUntil, distinctUntilChanged, map } from 'rxjs';
|
|
13
12
|
import { twMerge } from 'tailwind-merge';
|
|
14
13
|
import { TextBoxDirective } from '@nanahoshi/mona-ui/text-box';
|
|
@@ -26,26 +25,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
26
25
|
}]
|
|
27
26
|
}] });
|
|
28
27
|
|
|
29
|
-
const
|
|
30
|
-
flex
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
placeholder:text-muted-foreground
|
|
36
|
-
|
|
28
|
+
const numericTextboxThemeVariants = cva(`
|
|
29
|
+
flex w-full min-w-0 items-center
|
|
30
|
+
overflow-hidden p-0
|
|
31
|
+
${themeControlSurfaceClasses} text-foreground
|
|
32
|
+
border border-input-border shadow-(--shadow-control)
|
|
33
|
+
outline-none
|
|
37
34
|
selection:bg-primary selection:text-primary-foreground
|
|
38
|
-
transition-[color,box-shadow,border] ease-in-out
|
|
35
|
+
transition-[color,box-shadow,border] duration-300 ease-in-out
|
|
36
|
+
placeholder:text-muted-foreground
|
|
39
37
|
|
|
40
38
|
data-[disabled='true']:pointer-events-none
|
|
41
39
|
data-[disabled='true']:cursor-not-allowed
|
|
42
|
-
data-[disabled='true']:
|
|
40
|
+
data-[disabled='true']:border-disabled-border
|
|
41
|
+
data-[disabled='true']:bg-disabled-background
|
|
42
|
+
data-[disabled='true']:text-disabled-foreground
|
|
43
|
+
data-[disabled='true']:shadow-none
|
|
44
|
+
data-[readonly='true']:cursor-default
|
|
43
45
|
|
|
44
|
-
focus-within:
|
|
45
|
-
focus-within:
|
|
46
|
+
focus-within:border-focus-indicator
|
|
47
|
+
focus-within:ring-2 focus-within:ring-focus-indicator/35
|
|
46
48
|
|
|
47
49
|
data-[invalid='true']:border-error
|
|
48
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/
|
|
50
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
51
|
+
data-[invalid='true']:focus-within:border-error
|
|
52
|
+
data-[invalid='true']:focus-within:ring-error/35
|
|
49
53
|
`, {
|
|
50
54
|
variants: {
|
|
51
55
|
rounded: {
|
|
@@ -62,11 +66,13 @@ const numericTextboxVariants = cva(`
|
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
});
|
|
65
|
-
const
|
|
66
|
-
border-0 outline-none ring-0
|
|
69
|
+
const numericTextboxInputThemeVariants = cva(`
|
|
67
70
|
h-full w-full
|
|
68
|
-
|
|
71
|
+
bg-transparent
|
|
72
|
+
border-0 shadow-none
|
|
69
73
|
rounded-none
|
|
74
|
+
outline-none ring-0
|
|
75
|
+
focus-visible:border-transparent focus-visible:ring-0
|
|
70
76
|
`, {
|
|
71
77
|
variants: {
|
|
72
78
|
leftRounded: {
|
|
@@ -110,15 +116,13 @@ const numericTextboxInputVariants = cva(`
|
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
});
|
|
113
|
-
const
|
|
114
|
-
h-full flex
|
|
119
|
+
const numericTextboxButtonThemeVariants = cva(`
|
|
120
|
+
flex h-full flex-col
|
|
115
121
|
overflow-y-hidden
|
|
116
|
-
|
|
117
|
-
[&>button]:flex
|
|
118
|
-
[&>button]:items-center
|
|
119
|
-
[&>button]:p-0
|
|
120
|
-
[&>button]:rounded-none
|
|
122
|
+
border-s border-border-subtle
|
|
121
123
|
|
|
124
|
+
[&>button]:flex [&>button]:flex-1 [&>button]:items-center
|
|
125
|
+
[&>button]:rounded-none [&>button]:p-0
|
|
122
126
|
[&>button]:first:rounded-tl-none
|
|
123
127
|
[&>button]:first:rounded-bl-none
|
|
124
128
|
[&>button]:first:rounded-br-none
|
|
@@ -130,64 +134,35 @@ const numericTextboxButtonVariants = cva(`
|
|
|
130
134
|
`, {
|
|
131
135
|
variants: {
|
|
132
136
|
size: {
|
|
133
|
-
large: "
|
|
134
|
-
medium: "
|
|
135
|
-
small: "
|
|
137
|
+
large: "w-16 min-w-16",
|
|
138
|
+
medium: "w-10 min-w-10",
|
|
139
|
+
small: "w-8 min-w-8"
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
});
|
|
139
143
|
|
|
140
|
-
const numericTextboxThemeVariants = (theme) => {
|
|
141
|
-
switch (theme) {
|
|
142
|
-
case "mona":
|
|
143
|
-
return numericTextboxVariants;
|
|
144
|
-
default:
|
|
145
|
-
return numericTextboxVariants; // Default to Mona styles
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
const numericTextboxInputThemeVariants = (theme) => {
|
|
149
|
-
switch (theme) {
|
|
150
|
-
case "mona":
|
|
151
|
-
return numericTextboxInputVariants;
|
|
152
|
-
default:
|
|
153
|
-
return numericTextboxInputVariants; // Default to Mona styles
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
const numericTextboxButtonThemeVariants = (theme) => {
|
|
157
|
-
switch (theme) {
|
|
158
|
-
case "mona":
|
|
159
|
-
return numericTextboxButtonVariants;
|
|
160
|
-
default:
|
|
161
|
-
return numericTextboxButtonVariants; // Default to Mona styles
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
144
|
class NumericTextBoxComponent {
|
|
166
145
|
#destroyRef;
|
|
167
146
|
#focusMonitor;
|
|
168
147
|
#hostElementRef;
|
|
169
|
-
#themeService;
|
|
170
148
|
constructor() {
|
|
171
149
|
this.#destroyRef = inject(DestroyRef);
|
|
172
150
|
this.#focusMonitor = inject(FocusMonitor);
|
|
173
151
|
this.#hostElementRef = inject((ElementRef));
|
|
174
|
-
this.#themeService = inject(ThemeService);
|
|
175
152
|
this.beforeInput$ = new Subject();
|
|
176
153
|
this.classes = computed(() => {
|
|
177
|
-
const theme = this.#themeService.theme();
|
|
178
154
|
const rounded = this.rounded();
|
|
179
155
|
const size = this.size();
|
|
180
|
-
const classes = numericTextboxThemeVariants(
|
|
156
|
+
const classes = numericTextboxThemeVariants({ rounded, size });
|
|
181
157
|
const userClass = this.userClass();
|
|
182
158
|
return twMerge(classes, userClass);
|
|
183
159
|
}, /* @ts-ignore */
|
|
184
160
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
185
161
|
this.inputClasses = computed(() => {
|
|
186
|
-
const theme = this.#themeService.theme();
|
|
187
162
|
const hasPrefixTemplate = this.prefixTemplateList().length > 0;
|
|
188
163
|
const leftRounded = hasPrefixTemplate ? "none" : this.rounded();
|
|
189
164
|
const rightRounded = this.spinners() ? "none" : this.rounded();
|
|
190
|
-
const inputVariants = numericTextboxInputThemeVariants(
|
|
165
|
+
const inputVariants = numericTextboxInputThemeVariants({ leftRounded, rightRounded });
|
|
191
166
|
return twMerge(inputVariants);
|
|
192
167
|
}, /* @ts-ignore */
|
|
193
168
|
...(ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []));
|
|
@@ -206,9 +181,8 @@ class NumericTextBoxComponent {
|
|
|
206
181
|
this.rawInputValue = signal("", /* @ts-ignore */
|
|
207
182
|
...(ngDevMode ? [{ debugName: "rawInputValue" }] : /* istanbul ignore next */ []));
|
|
208
183
|
this.spinButtonClasses = computed(() => {
|
|
209
|
-
const theme = this.#themeService.theme();
|
|
210
184
|
const size = this.size();
|
|
211
|
-
return numericTextboxButtonThemeVariants(
|
|
185
|
+
return numericTextboxButtonThemeVariants({ size });
|
|
212
186
|
}, /* @ts-ignore */
|
|
213
187
|
...(ngDevMode ? [{ debugName: "spinButtonClasses" }] : /* istanbul ignore next */ []));
|
|
214
188
|
this.spinButtonIconSize = computed(() => {
|
|
@@ -570,7 +544,7 @@ class NumericTextBoxComponent {
|
|
|
570
544
|
return parseFloat(sanitizedValue);
|
|
571
545
|
}
|
|
572
546
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NumericTextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
573
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: NumericTextBoxComponent, isStandalone: true, selector: "mona-numeric-text-box", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, decimals: { classPropertyName: "decimals", publicName: "decimals", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, formatter: { classPropertyName: "formatter", publicName: "formatter", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, nullable: { classPropertyName: "nullable", publicName: "nullable", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, spinners: { classPropertyName: "spinners", publicName: "spinners", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", 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", inputFocus: "inputFocus", inputFocusOut: "inputFocusOut", touch: "touch", value: "valueChange" }, host: { properties: { "class": "classes()", "attr.data-disabled": "disabled() || null", "attr.data-invalid": "invalidInput() || null", "attr.data-readonly": "readonly() || null", "attr.data-required": "required() || null" } }, queries: [{ propertyName: "prefixTemplateList", predicate: NumericTextBoxPrefixTemplateDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "valueTextBoxRef", first: true, predicate: ["valueTextBox"], descendants: true, isSignal: true }], ngImport: i0, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex
|
|
547
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: NumericTextBoxComponent, isStandalone: true, selector: "mona-numeric-text-box", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, decimals: { classPropertyName: "decimals", publicName: "decimals", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, formatter: { classPropertyName: "formatter", publicName: "formatter", isSignal: true, isRequired: false, transformFunction: null }, maxValue: { classPropertyName: "maxValue", publicName: "maxValue", isSignal: true, isRequired: false, transformFunction: null }, minValue: { classPropertyName: "minValue", publicName: "minValue", isSignal: true, isRequired: false, transformFunction: null }, nullable: { classPropertyName: "nullable", publicName: "nullable", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, spinners: { classPropertyName: "spinners", publicName: "spinners", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", 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", inputFocus: "inputFocus", inputFocusOut: "inputFocusOut", touch: "touch", value: "valueChange" }, host: { properties: { "class": "classes()", "attr.data-disabled": "disabled() || null", "attr.data-invalid": "invalidInput() || null", "attr.data-readonly": "readonly() || null", "attr.data-required": "required() || null" } }, queries: [{ propertyName: "prefixTemplateList", predicate: NumericTextBoxPrefixTemplateDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "valueTextBoxRef", first: true, predicate: ["valueTextBox"], descendants: true, isSignal: true }], ngImport: i0, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex h-full flex-none flex-wrap items-center overflow-hidden border-none\">\n <ng-container *ngTemplateOutlet=\"prefixTemplate\"></ng-container>\n </span>\n}\n<input\n monaTextBox\n [disabled]=\"disabled()\"\n [required]=\"required()\"\n [type]=\"'text'\"\n inputmode=\"numeric\"\n [readonly]=\"readonly()\"\n [tabIndex]=\"tabindex()\"\n [ngModel]=\"formattedValue()\"\n (ngModelChange)=\"applyRawValue($event)\"\n (keydown)=\"keydown$.next($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (focusout)=\"inputFocusOut.emit($event)\"\n (blur)=\"onBlur($event)\"\n (beforeinput)=\"beforeInput$.next($event)\"\n (wheel)=\"wheel$.next($event)\"\n [size]=\"size()\"\n [class]=\"inputClasses()\"\n autocomplete=\"off\"\n role=\"spinbutton\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-invalid]=\"invalidInput() || null\"\n [attr.aria-readonly]=\"readonly()\"\n [attr.aria-required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-valuenow]=\"value()\"\n [attr.aria-valuemin]=\"minValue()\"\n [attr.aria-valuemax]=\"maxValue()\"\n [attr.aria-valuetext]=\"formattedValue()\"\n [attr.data-spinners]=\"spinners()\"\n #valueTextBox />\n@if (spinners()) {\n <div [class]=\"spinButtonClasses()\">\n <button\n monaButton\n [disabled]=\"disabled()\"\n [tabindex]=\"-1\"\n look=\"ghost\"\n [size]=\"size()\"\n (mousedown)=\"$event.preventDefault()\"\n (pointerdown)=\"spin$.next('+')\"\n (pointerup)=\"spinStop$.next()\"\n (pointerleave)=\"spinStop$.next()\"\n aria-label=\"Increase value\">\n <svg lucideChevronUp [size]=\"spinButtonIconSize()\"></svg>\n </button>\n <button\n monaButton\n [disabled]=\"disabled()\"\n [tabindex]=\"-1\"\n look=\"ghost\"\n [size]=\"size()\"\n (mousedown)=\"$event.preventDefault()\"\n (pointerdown)=\"spin$.next('-')\"\n (pointerup)=\"spinStop$.next()\"\n (pointerleave)=\"spinStop$.next()\"\n aria-label=\"Decrease value\">\n <svg lucideChevronDown [size]=\"spinButtonIconSize()\"></svg>\n </button>\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TextBoxDirective, selector: "input[monaTextBox]", inputs: ["rounded", "size", "class"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "component", type: LucideChevronUp, selector: "svg[lucideChevronUp]" }, { kind: "component", type: LucideChevronDown, selector: "svg[lucideChevronDown]" }] }); }
|
|
574
548
|
}
|
|
575
549
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: NumericTextBoxComponent, decorators: [{
|
|
576
550
|
type: Component,
|
|
@@ -580,7 +554,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
580
554
|
"[attr.data-invalid]": "invalidInput() || null",
|
|
581
555
|
"[attr.data-readonly]": "readonly() || null",
|
|
582
556
|
"[attr.data-required]": "required() || null"
|
|
583
|
-
}, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex
|
|
557
|
+
}, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex h-full flex-none flex-wrap items-center overflow-hidden border-none\">\n <ng-container *ngTemplateOutlet=\"prefixTemplate\"></ng-container>\n </span>\n}\n<input\n monaTextBox\n [disabled]=\"disabled()\"\n [required]=\"required()\"\n [type]=\"'text'\"\n inputmode=\"numeric\"\n [readonly]=\"readonly()\"\n [tabIndex]=\"tabindex()\"\n [ngModel]=\"formattedValue()\"\n (ngModelChange)=\"applyRawValue($event)\"\n (keydown)=\"keydown$.next($event)\"\n (focus)=\"inputFocus.emit($event)\"\n (focusout)=\"inputFocusOut.emit($event)\"\n (blur)=\"onBlur($event)\"\n (beforeinput)=\"beforeInput$.next($event)\"\n (wheel)=\"wheel$.next($event)\"\n [size]=\"size()\"\n [class]=\"inputClasses()\"\n autocomplete=\"off\"\n role=\"spinbutton\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.aria-invalid]=\"invalidInput() || null\"\n [attr.aria-readonly]=\"readonly()\"\n [attr.aria-required]=\"required()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-valuenow]=\"value()\"\n [attr.aria-valuemin]=\"minValue()\"\n [attr.aria-valuemax]=\"maxValue()\"\n [attr.aria-valuetext]=\"formattedValue()\"\n [attr.data-spinners]=\"spinners()\"\n #valueTextBox />\n@if (spinners()) {\n <div [class]=\"spinButtonClasses()\">\n <button\n monaButton\n [disabled]=\"disabled()\"\n [tabindex]=\"-1\"\n look=\"ghost\"\n [size]=\"size()\"\n (mousedown)=\"$event.preventDefault()\"\n (pointerdown)=\"spin$.next('+')\"\n (pointerup)=\"spinStop$.next()\"\n (pointerleave)=\"spinStop$.next()\"\n aria-label=\"Increase value\">\n <svg lucideChevronUp [size]=\"spinButtonIconSize()\"></svg>\n </button>\n <button\n monaButton\n [disabled]=\"disabled()\"\n [tabindex]=\"-1\"\n look=\"ghost\"\n [size]=\"size()\"\n (mousedown)=\"$event.preventDefault()\"\n (pointerdown)=\"spin$.next('-')\"\n (pointerup)=\"spinStop$.next()\"\n (pointerleave)=\"spinStop$.next()\"\n aria-label=\"Decrease value\">\n <svg lucideChevronDown [size]=\"spinButtonIconSize()\"></svg>\n </button>\n </div>\n}\n" }]
|
|
584
558
|
}], ctorParameters: () => [], propDecorators: { prefixTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => NumericTextBoxPrefixTemplateDirective), { ...{
|
|
585
559
|
read: TemplateRef
|
|
586
560
|
}, isSignal: true }] }], valueTextBoxRef: [{ type: i0.ViewChild, args: ["valueTextBox", { isSignal: true }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], decimals: [{ type: i0.Input, args: [{ isSignal: true, alias: "decimals", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], formatter: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatter", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputFocusOut: [{ type: i0.Output, args: ["inputFocusOut"] }], maxValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxValue", required: false }] }], minValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "minValue", required: false }] }], nullable: [{ type: i0.Input, args: [{ isSignal: true, alias: "nullable", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], spinners: [{ type: i0.Input, args: [{ isSignal: true, alias: "spinners", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", 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"] }] } });
|
|
@@ -9,9 +9,8 @@ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
|
9
9
|
import { PreventableEvent, SlicePipe } from '@nanahoshi/mona-ui/common';
|
|
10
10
|
import { DropdownListComponent, DropdownListValueTemplateDirective } from '@nanahoshi/mona-ui/dropdown-list';
|
|
11
11
|
import { DropdownVirtualScrollDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
12
|
-
import { NavigationKeys } from '@nanahoshi/mona-ui/internal';
|
|
12
|
+
import { themeRaisedBackdropClasses, NavigationKeys } from '@nanahoshi/mona-ui/internal';
|
|
13
13
|
import { NumericTextBoxComponent } from '@nanahoshi/mona-ui/numeric-text-box';
|
|
14
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
15
14
|
import { twMerge } from 'tailwind-merge';
|
|
16
15
|
import { cva } from 'class-variance-authority';
|
|
17
16
|
|
|
@@ -92,16 +91,15 @@ class PageSizeChangeEvent extends PreventableEvent {
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
const
|
|
96
|
-
flex py-1
|
|
97
|
-
bg-background text-foreground
|
|
98
|
-
border border-border
|
|
94
|
+
const pagerBaseThemeVariants = cva(`
|
|
95
|
+
flex px-2 py-1
|
|
99
96
|
text-sm
|
|
97
|
+
bg-(--mona-pager-background) ${themeRaisedBackdropClasses} text-foreground
|
|
98
|
+
border border-border-subtle
|
|
100
99
|
[&_mona-numeric-text-box]:ml-4
|
|
101
100
|
[&_mona-numeric-text-box]:w-12
|
|
102
|
-
[&_mona-numeric-text-box_input]:text-center
|
|
103
101
|
[&_mona-numeric-text-box_input]:bg-input-background
|
|
104
|
-
|
|
102
|
+
[&_mona-numeric-text-box_input]:text-center
|
|
105
103
|
[&_mona-dropdown-list]:mx-1
|
|
106
104
|
[&_mona-dropdown-list]:my-0
|
|
107
105
|
`, {
|
|
@@ -120,27 +118,24 @@ const pagerBaseVariants = cva(`
|
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
});
|
|
123
|
-
const
|
|
124
|
-
flex items-center justify-end
|
|
125
|
-
|
|
121
|
+
const pagerInfoThemeVariants = cva(`
|
|
122
|
+
flex flex-1 items-center justify-end pl-2
|
|
123
|
+
whitespace-nowrap text-muted-foreground
|
|
126
124
|
`);
|
|
127
|
-
const
|
|
125
|
+
const pagerInputThemeVariants = cva(`
|
|
128
126
|
flex items-center
|
|
129
|
-
[&_mona-numeric-text-box]:w-12
|
|
130
127
|
[&_mona-numeric-text-box]:mx-1
|
|
131
|
-
|
|
128
|
+
[&_mona-numeric-text-box]:w-12
|
|
132
129
|
`);
|
|
133
|
-
const
|
|
130
|
+
const pagerListThemeVariants = cva(`
|
|
134
131
|
flex flex-wrap
|
|
135
|
-
[&_li]:list-none
|
|
136
|
-
[&_li]:
|
|
137
|
-
[&_li]:items-center
|
|
138
|
-
[&_li]:justify-center
|
|
132
|
+
[&_li]:flex [&_li]:list-none
|
|
133
|
+
[&_li]:items-center [&_li]:justify-center
|
|
139
134
|
`);
|
|
140
|
-
const
|
|
135
|
+
const pagerListItemThemeVariants = cva("", {
|
|
141
136
|
variants: {
|
|
142
137
|
active: {
|
|
143
|
-
true: "font-semibold",
|
|
138
|
+
true: "font-semibold text-foreground",
|
|
144
139
|
false: ""
|
|
145
140
|
}
|
|
146
141
|
},
|
|
@@ -149,47 +144,6 @@ const pagerListItemVariants = cva("", {
|
|
|
149
144
|
}
|
|
150
145
|
});
|
|
151
146
|
|
|
152
|
-
const pagerBaseThemeVariants = (theme) => {
|
|
153
|
-
switch (theme) {
|
|
154
|
-
case "mona":
|
|
155
|
-
return pagerBaseVariants;
|
|
156
|
-
default:
|
|
157
|
-
return pagerBaseVariants;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
const pagerInfoThemeVariants = (theme) => {
|
|
161
|
-
switch (theme) {
|
|
162
|
-
case "mona":
|
|
163
|
-
return pagerInfoVariants;
|
|
164
|
-
default:
|
|
165
|
-
return pagerInfoVariants;
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
const pagerInputThemeVariants = (theme) => {
|
|
169
|
-
switch (theme) {
|
|
170
|
-
case "mona":
|
|
171
|
-
return pagerInputVariants;
|
|
172
|
-
default:
|
|
173
|
-
return pagerInputVariants;
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
const pagerListThemeVariants = (theme) => {
|
|
177
|
-
switch (theme) {
|
|
178
|
-
case "mona":
|
|
179
|
-
return pagerListVariants;
|
|
180
|
-
default:
|
|
181
|
-
return pagerListVariants;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
const pagerListItemThemeVariants = (theme) => {
|
|
185
|
-
switch (theme) {
|
|
186
|
-
case "mona":
|
|
187
|
-
return pagerListItemVariants;
|
|
188
|
-
default:
|
|
189
|
-
return pagerListItemVariants;
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
147
|
const PAGER_FOCUSABLE_ATTRIBUTE = "data-mona-pager-focusable";
|
|
194
148
|
const FOCUSABLE_TARGET_SELECTOR = "button, input, select, textarea, a[href], [tabindex]";
|
|
195
149
|
class PagerComponent {
|
|
@@ -200,7 +154,6 @@ class PagerComponent {
|
|
|
200
154
|
#managedFocusTargets;
|
|
201
155
|
#originalTabIndices;
|
|
202
156
|
#skip;
|
|
203
|
-
#themeService;
|
|
204
157
|
#widthObserver;
|
|
205
158
|
#previousPageSize;
|
|
206
159
|
constructor() {
|
|
@@ -214,16 +167,14 @@ class PagerComponent {
|
|
|
214
167
|
this.#originalTabIndices = new WeakMap();
|
|
215
168
|
this.#skip = linkedSignal(() => this.skip(), /* @ts-ignore */
|
|
216
169
|
...(ngDevMode ? [{ debugName: "#skip" }] : /* istanbul ignore next */ []));
|
|
217
|
-
this.#themeService = inject(ThemeService);
|
|
218
170
|
this.#widthObserver = null;
|
|
219
171
|
this.#previousPageSize = 10;
|
|
220
172
|
this.navigationButtonsTemplateList = contentChildren(PagerNavigationButtonsTemplateDirective, /* @ts-ignore */
|
|
221
173
|
...(ngDevMode ? [{ debugName: "navigationButtonsTemplateList" }] : /* istanbul ignore next */ []));
|
|
222
174
|
this.baseClasses = computed(() => {
|
|
223
|
-
const theme = this.#themeService.theme();
|
|
224
175
|
const rounded = this.rounded();
|
|
225
176
|
const userClasses = this.userClasses();
|
|
226
|
-
const classes = pagerBaseThemeVariants(
|
|
177
|
+
const classes = pagerBaseThemeVariants({ rounded });
|
|
227
178
|
return twMerge(classes, userClasses);
|
|
228
179
|
}, /* @ts-ignore */
|
|
229
180
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
@@ -248,8 +199,7 @@ class PagerComponent {
|
|
|
248
199
|
}, /* @ts-ignore */
|
|
249
200
|
...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
250
201
|
this.infoClasses = computed(() => {
|
|
251
|
-
|
|
252
|
-
return pagerInfoThemeVariants(theme)();
|
|
202
|
+
return pagerInfoThemeVariants();
|
|
253
203
|
}, /* @ts-ignore */
|
|
254
204
|
...(ngDevMode ? [{ debugName: "infoClasses" }] : /* istanbul ignore next */ []));
|
|
255
205
|
this.infoVisible = computed(() => {
|
|
@@ -259,8 +209,7 @@ class PagerComponent {
|
|
|
259
209
|
}, /* @ts-ignore */
|
|
260
210
|
...(ngDevMode ? [{ debugName: "infoVisible" }] : /* istanbul ignore next */ []));
|
|
261
211
|
this.inputClasses = computed(() => {
|
|
262
|
-
|
|
263
|
-
return pagerInputThemeVariants(theme)();
|
|
212
|
+
return pagerInputThemeVariants();
|
|
264
213
|
}, /* @ts-ignore */
|
|
265
214
|
...(ngDevMode ? [{ debugName: "inputClasses" }] : /* istanbul ignore next */ []));
|
|
266
215
|
this.inputValue = linkedSignal(() => this.page(), /* @ts-ignore */
|
|
@@ -276,8 +225,7 @@ class PagerComponent {
|
|
|
276
225
|
}, /* @ts-ignore */
|
|
277
226
|
...(ngDevMode ? [{ debugName: "lastPageNavigationTemplate" }] : /* istanbul ignore next */ []));
|
|
278
227
|
this.listClasses = computed(() => {
|
|
279
|
-
|
|
280
|
-
return pagerListThemeVariants(theme)();
|
|
228
|
+
return pagerListThemeVariants();
|
|
281
229
|
}, /* @ts-ignore */
|
|
282
230
|
...(ngDevMode ? [{ debugName: "listClasses" }] : /* istanbul ignore next */ []));
|
|
283
231
|
this.nextJumperVisible = computed(() => {
|
|
@@ -599,7 +547,7 @@ class PagerComponent {
|
|
|
599
547
|
this.setPage(page);
|
|
600
548
|
}
|
|
601
549
|
pageItemClasses(active) {
|
|
602
|
-
return pagerListItemThemeVariants(
|
|
550
|
+
return pagerListItemThemeVariants({ active });
|
|
603
551
|
}
|
|
604
552
|
activateInnerNavigation() {
|
|
605
553
|
const targets = this.getFocusableTargets();
|
|
@@ -1,49 +1,28 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
2
|
+
import { computed, input, Component } from '@angular/core';
|
|
4
3
|
import { twMerge } from 'tailwind-merge';
|
|
5
4
|
import { cva } from 'class-variance-authority';
|
|
6
5
|
|
|
7
|
-
const
|
|
6
|
+
const placeholderBaseThemeVariants = cva(`
|
|
8
7
|
flex items-center justify-center
|
|
9
|
-
|
|
8
|
+
h-full w-full
|
|
10
9
|
p-2
|
|
10
|
+
bg-surface-muted/50
|
|
11
11
|
`);
|
|
12
|
-
const
|
|
13
|
-
text-muted-foreground
|
|
14
|
-
uppercase
|
|
12
|
+
const placeholderTextThemeVariants = cva(`
|
|
13
|
+
uppercase text-muted-foreground
|
|
15
14
|
`);
|
|
16
15
|
|
|
17
|
-
const placeholderBaseThemeVariants = (theme) => {
|
|
18
|
-
switch (theme) {
|
|
19
|
-
case "mona":
|
|
20
|
-
return placeholderBaseVariants;
|
|
21
|
-
default:
|
|
22
|
-
return placeholderBaseVariants;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const placeholderTextThemeVariants = (theme) => {
|
|
26
|
-
switch (theme) {
|
|
27
|
-
case "mona":
|
|
28
|
-
return placeholderTextVariants;
|
|
29
|
-
default:
|
|
30
|
-
return placeholderTextVariants;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
16
|
class PlaceholderComponent {
|
|
35
17
|
constructor() {
|
|
36
|
-
this.#themeService = inject(ThemeService);
|
|
37
18
|
this.baseClass = computed(() => {
|
|
38
|
-
const
|
|
39
|
-
const variantClass = placeholderBaseThemeVariants(theme)();
|
|
19
|
+
const variantClass = placeholderBaseThemeVariants();
|
|
40
20
|
const userClass = this.userClass();
|
|
41
21
|
return twMerge(variantClass, userClass);
|
|
42
22
|
}, /* @ts-ignore */
|
|
43
23
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
44
24
|
this.textClass = computed(() => {
|
|
45
|
-
|
|
46
|
-
return placeholderTextThemeVariants(theme)();
|
|
25
|
+
return placeholderTextThemeVariants();
|
|
47
26
|
}, /* @ts-ignore */
|
|
48
27
|
...(ngDevMode ? [{ debugName: "textClass" }] : /* istanbul ignore next */ []));
|
|
49
28
|
/**
|
|
@@ -60,7 +39,6 @@ class PlaceholderComponent {
|
|
|
60
39
|
*/
|
|
61
40
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
62
41
|
}
|
|
63
|
-
#themeService;
|
|
64
42
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PlaceholderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
65
43
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: PlaceholderComponent, isStandalone: true, selector: "mona-placeholder", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "baseClass()" } }, ngImport: i0, template: "@if (text()) {\n <span [class]=\"textClass()\">{{ text() }}</span>\n} @else {\n <ng-content></ng-content>\n}\n" }); }
|
|
66
44
|
}
|
|
@@ -3,13 +3,13 @@ import * as i0 from '@angular/core';
|
|
|
3
3
|
import { Directive, inject, DestroyRef, Renderer2, computed, contentChild, TemplateRef, viewChild, input, output, effect, ElementRef, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { PopupService, fadePopupAnimation } from '@nanahoshi/mona-ui/popup';
|
|
6
|
-
import {
|
|
7
|
-
import { tooltipArrowThemeVariants, getPositionConnectionPoints, getOffsetForPosition } from '@nanahoshi/mona-ui/tooltip';
|
|
6
|
+
import { getPositionConnectionPoints, getOffsetForPosition } from '@nanahoshi/mona-ui/tooltip';
|
|
8
7
|
import { takeUntil, take, fromEvent, filter, tap } from 'rxjs';
|
|
9
8
|
import { twMerge } from 'tailwind-merge';
|
|
10
9
|
import { v4 } from 'uuid';
|
|
11
10
|
import { PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
12
11
|
import { cva } from 'class-variance-authority';
|
|
12
|
+
import { themeOverlaySurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
13
13
|
|
|
14
14
|
class PopoverFooterTemplateDirective {
|
|
15
15
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: PopoverFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
@@ -55,10 +55,10 @@ class PopoverShownEvent {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
const
|
|
59
|
-
flex flex-col items-center justify-center
|
|
60
|
-
|
|
61
|
-
shadow-
|
|
58
|
+
const popoverBaseThemeVariants = cva(`
|
|
59
|
+
relative z-1 flex flex-col items-center justify-center
|
|
60
|
+
${themeOverlaySurfaceClasses} text-foreground
|
|
61
|
+
border border-border shadow-(--shadow-overlay)
|
|
62
62
|
`, {
|
|
63
63
|
variants: {
|
|
64
64
|
rounded: {
|
|
@@ -69,9 +69,9 @@ const popoverBaseVariants = cva(`
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
const
|
|
73
|
-
flex items-center justify-between
|
|
74
|
-
font-semibold
|
|
72
|
+
const popoverHeaderThemeVariants = cva(`
|
|
73
|
+
flex w-full items-center justify-between overflow-hidden
|
|
74
|
+
font-semibold
|
|
75
75
|
`, {
|
|
76
76
|
variants: {
|
|
77
77
|
rounded: {
|
|
@@ -82,76 +82,55 @@ const popoverHeaderVariants = cva(`
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
const popoverContentThemeVariants = cva(`
|
|
86
|
+
h-full w-full flex-1 overflow-hidden
|
|
87
|
+
`);
|
|
88
|
+
const popoverArrowThemeVariants = cva(`
|
|
89
|
+
absolute z-0 h-3 w-3 rotate-45 transform-center box-border
|
|
90
|
+
pointer-events-none
|
|
91
|
+
${themeOverlaySurfaceClasses} text-foreground
|
|
92
|
+
border border-border
|
|
93
|
+
data-[position="top"]:-bottom-1.5 data-[position="top"]:border-t-0 data-[position="top"]:border-l-0
|
|
94
|
+
data-[position="top"]:[clip-path:inset(1px_0_0_1px)]
|
|
95
|
+
data-[position="bottom"]:-top-1.5 data-[position="bottom"]:border-r-0 data-[position="bottom"]:border-b-0
|
|
96
|
+
data-[position="bottom"]:[clip-path:inset(0_1px_1px_0)]
|
|
97
|
+
data-[position="left"]:-right-1.5 data-[position="left"]:border-b-0 data-[position="left"]:border-l-0
|
|
98
|
+
data-[position="left"]:[clip-path:inset(0_0_1px_1px)]
|
|
99
|
+
data-[position="right"]:-left-1.5 data-[position="right"]:border-t-0 data-[position="right"]:border-r-0
|
|
100
|
+
data-[position="right"]:[clip-path:inset(1px_1px_0_0)]
|
|
88
101
|
`);
|
|
89
|
-
|
|
90
|
-
const popoverBaseThemeVariants = (theme) => {
|
|
91
|
-
switch (theme) {
|
|
92
|
-
case "mona":
|
|
93
|
-
return popoverBaseVariants;
|
|
94
|
-
default:
|
|
95
|
-
return popoverBaseVariants;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const popoverHeaderThemeVariants = (theme) => {
|
|
99
|
-
switch (theme) {
|
|
100
|
-
case "mona":
|
|
101
|
-
return popoverHeaderVariants;
|
|
102
|
-
default:
|
|
103
|
-
return popoverHeaderVariants;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const popoverContentThemeVariants = (theme) => {
|
|
107
|
-
switch (theme) {
|
|
108
|
-
case "mona":
|
|
109
|
-
return popoverContentVariants;
|
|
110
|
-
default:
|
|
111
|
-
return popoverContentVariants;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
const popoverArrowThemeVariants = (theme) => {
|
|
115
|
-
return tooltipArrowThemeVariants(theme);
|
|
116
|
-
};
|
|
117
102
|
|
|
118
103
|
class PopoverComponent {
|
|
119
104
|
#destroyRef;
|
|
120
105
|
#popupService;
|
|
121
106
|
#renderer;
|
|
122
|
-
#themeService;
|
|
123
107
|
#subscription;
|
|
124
108
|
constructor() {
|
|
125
109
|
this.#destroyRef = inject(DestroyRef);
|
|
126
110
|
this.#popupService = inject(PopupService);
|
|
127
111
|
this.#renderer = inject(Renderer2);
|
|
128
|
-
this.#themeService = inject(ThemeService);
|
|
129
112
|
this.#subscription = null;
|
|
130
113
|
this.arrowClasses = computed(() => {
|
|
131
|
-
|
|
132
|
-
return popoverArrowThemeVariants(theme)();
|
|
114
|
+
return popoverArrowThemeVariants();
|
|
133
115
|
}, /* @ts-ignore */
|
|
134
116
|
...(ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []));
|
|
135
117
|
this.baseClasses = computed(() => {
|
|
136
|
-
const theme = this.#themeService.theme();
|
|
137
118
|
const rounded = this.rounded();
|
|
138
|
-
return popoverBaseThemeVariants(
|
|
119
|
+
return popoverBaseThemeVariants({ rounded });
|
|
139
120
|
}, /* @ts-ignore */
|
|
140
121
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
141
122
|
this.contentClasses = computed(() => {
|
|
142
|
-
|
|
143
|
-
return popoverContentThemeVariants(theme)();
|
|
123
|
+
return popoverContentThemeVariants();
|
|
144
124
|
}, /* @ts-ignore */
|
|
145
125
|
...(ngDevMode ? [{ debugName: "contentClasses" }] : /* istanbul ignore next */ []));
|
|
146
126
|
this.currentArrowPosition = computed(() => this.position(), /* @ts-ignore */
|
|
147
127
|
...(ngDevMode ? [{ debugName: "currentArrowPosition" }] : /* istanbul ignore next */ []));
|
|
148
128
|
this.footerTemplateRef = contentChild(PopoverFooterTemplateDirective, { ...(ngDevMode ? { debugName: "footerTemplateRef" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
149
129
|
this.headerClasses = computed(() => {
|
|
150
|
-
const theme = this.#themeService.theme();
|
|
151
130
|
const rounded = this.rounded();
|
|
152
131
|
const hasTemplate = !!this.titleTemplateRef();
|
|
153
132
|
const padding = hasTemplate ? "p-0" : "p-2";
|
|
154
|
-
const variants = popoverHeaderThemeVariants(
|
|
133
|
+
const variants = popoverHeaderThemeVariants({ rounded });
|
|
155
134
|
return twMerge(variants, padding);
|
|
156
135
|
}, /* @ts-ignore */
|
|
157
136
|
...(ngDevMode ? [{ debugName: "headerClasses" }] : /* istanbul ignore next */ []));
|