@nanahoshi/mona-ui 0.1.0 → 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 +40 -55
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +24 -58
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -48
- package/fesm2022/nanahoshi-mona-ui-button.mjs +130 -129
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +69 -165
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +81 -128
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +102 -112
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +11 -25
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +41 -92
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +27 -49
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +64 -65
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +39 -61
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +12 -15
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +44 -33
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +58 -60
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +52 -165
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +36 -59
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +56 -61
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +302 -81
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +33 -84
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +12 -45
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +18 -48
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +14 -14
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs +121 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +26 -55
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs +231 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +167 -451
- 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 +57 -87
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +48 -139
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +10 -32
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +8 -21
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +50 -156
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +40 -69
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +32 -116
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +81 -107
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +33 -85
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +12 -34
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +31 -52
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +38 -110
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +21 -62
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +66 -111
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +60 -151
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +117 -173
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +32 -45
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +29 -64
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +38 -101
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +58 -79
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +42 -118
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +29 -37
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +60 -81
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +45 -39
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +45 -109
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +54 -82
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-window.mjs +35 -115
- 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 +31 -5
- 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 +6 -6
- 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 -8
- 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 +7 -8
- 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-editor.d.ts +17 -17
- 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 +3 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +16 -17
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +16 -16
- 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 +7 -8
- 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 +13 -14
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +15 -17
- 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
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +0 -130
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +0 -240
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { Directive,
|
|
3
|
+
import { Directive, computed, input, inject, DestroyRef, signal, viewChild, viewChildren, ElementRef, model, output, afterRenderEffect, untracked, afterNextRender, Component, contentChild, TemplateRef, ChangeDetectionStrategy, contentChildren, linkedSignal } from '@angular/core';
|
|
4
4
|
import { NgTemplateOutlet } from '@angular/common';
|
|
5
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
6
5
|
import { firstOrDefault, select } from '@mirei/ts-collections';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
|
+
import { themeRaisedBackdropClasses, themeRaisedSurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
8
9
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
9
|
-
import {
|
|
10
|
-
import { faChevronLeft, faChevronRight, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
10
|
+
import { LucideChevronLeft, LucideChevronRight, LucideX } from '@lucide/angular';
|
|
11
11
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
12
12
|
import { Subject, switchMap, EMPTY, timer, interval, tap, asapScheduler } from 'rxjs';
|
|
13
|
-
import { twMerge } from 'tailwind-merge';
|
|
14
|
-
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
15
13
|
|
|
16
14
|
class TabCloseEvent extends PreventableEvent {
|
|
17
15
|
#index;
|
|
@@ -64,11 +62,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
64
62
|
}]
|
|
65
63
|
}] });
|
|
66
64
|
|
|
67
|
-
const
|
|
68
|
-
w-fit max-w-full
|
|
69
|
-
|
|
70
|
-
bg-
|
|
71
|
-
font-medium text-sm
|
|
65
|
+
const tabListBaseThemeVariants = cva(`
|
|
66
|
+
flex w-fit max-w-full overflow-hidden
|
|
67
|
+
text-sm font-medium
|
|
68
|
+
bg-(--mona-tab-list-background) ${themeRaisedBackdropClasses}
|
|
72
69
|
`, {
|
|
73
70
|
variants: {
|
|
74
71
|
rounded: {
|
|
@@ -85,27 +82,24 @@ const tabListBaseVariants = cva(`
|
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
});
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
flex h-full w-full overflow-hidden
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
p-[3px]
|
|
94
|
-
transition-colors duration-300 ease-out
|
|
85
|
+
const tabListListWrapperThemeVariants = cva(`h-full w-full overflow-hidden`);
|
|
86
|
+
const tabListListThemeVariants = cva(`
|
|
87
|
+
flex h-full w-full list-none overflow-hidden p-[3px]
|
|
88
|
+
cursor-default select-none whitespace-nowrap
|
|
89
|
+
transition-colors duration-(--mona-motion-standard) ease-out
|
|
95
90
|
`);
|
|
96
|
-
const
|
|
97
|
-
flex items-center justify-center
|
|
98
|
-
cursor-pointer
|
|
99
|
-
|
|
100
|
-
focus-visible:ring-2 focus-visible:ring-primary/40
|
|
91
|
+
const tabListListItemThemeVariants = cva(`
|
|
92
|
+
flex items-center justify-center px-2
|
|
93
|
+
cursor-pointer outline-none
|
|
94
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
101
95
|
`, {
|
|
102
96
|
variants: {
|
|
103
97
|
active: {
|
|
104
|
-
true:
|
|
98
|
+
true: `${themeRaisedSurfaceClasses} font-semibold text-foreground shadow-(--shadow-control) inset-ring-1 inset-ring-border-subtle`,
|
|
105
99
|
false: ""
|
|
106
100
|
},
|
|
107
101
|
disabled: {
|
|
108
|
-
true: "pointer-events-none cursor-not-allowed
|
|
102
|
+
true: "pointer-events-none cursor-not-allowed select-none text-disabled-foreground",
|
|
109
103
|
false: ""
|
|
110
104
|
},
|
|
111
105
|
rounded: {
|
|
@@ -120,14 +114,17 @@ const tabListListItemVariants = cva(`
|
|
|
120
114
|
rounded: "medium"
|
|
121
115
|
}
|
|
122
116
|
});
|
|
123
|
-
const
|
|
124
|
-
flex items-center justify-center
|
|
125
|
-
|
|
117
|
+
const tabListScrollButtonThemeVariants = cva(`
|
|
118
|
+
flex h-full items-center justify-center px-2
|
|
119
|
+
text-muted-foreground
|
|
120
|
+
hover:bg-hover hover:text-foreground
|
|
121
|
+
active:bg-active
|
|
126
122
|
`);
|
|
127
|
-
const
|
|
128
|
-
w-full overflow-auto
|
|
129
|
-
|
|
130
|
-
bg-background
|
|
123
|
+
const tabContentThemeVariants = cva(`
|
|
124
|
+
flex-1 w-full overflow-auto
|
|
125
|
+
[scrollbar-color:var(--color-scrollbar-thumb)_var(--color-scrollbar-track)] [scrollbar-width:thin]
|
|
126
|
+
bg-(--mona-tab-content-background) ${themeRaisedBackdropClasses} text-foreground
|
|
127
|
+
border border-border shadow-(--shadow-raised)
|
|
131
128
|
`, {
|
|
132
129
|
variants: {
|
|
133
130
|
rounded: {
|
|
@@ -142,77 +139,17 @@ const tabContentVariants = cva(`
|
|
|
142
139
|
rounded: "medium"
|
|
143
140
|
}
|
|
144
141
|
});
|
|
145
|
-
const
|
|
146
|
-
max-w-full
|
|
147
|
-
flex flex-col gap-2
|
|
142
|
+
const tabsBaseThemeVariants = cva(`
|
|
143
|
+
flex max-w-full flex-col gap-2
|
|
148
144
|
`);
|
|
149
145
|
|
|
150
|
-
const tabListBaseThemeVariants = (theme) => {
|
|
151
|
-
switch (theme) {
|
|
152
|
-
case "mona":
|
|
153
|
-
return tabListBaseVariants;
|
|
154
|
-
default:
|
|
155
|
-
return tabListBaseVariants;
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
const tabListListWrapperThemeVariants = (theme) => {
|
|
159
|
-
switch (theme) {
|
|
160
|
-
case "mona":
|
|
161
|
-
return tabListListWrapperVariants;
|
|
162
|
-
default:
|
|
163
|
-
return tabListListWrapperVariants;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const tabListListThemeVariants = (theme) => {
|
|
167
|
-
switch (theme) {
|
|
168
|
-
case "mona":
|
|
169
|
-
return tabListListVariants;
|
|
170
|
-
default:
|
|
171
|
-
return tabListListVariants;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
const tabListListItemThemeVariants = (theme) => {
|
|
175
|
-
switch (theme) {
|
|
176
|
-
case "mona":
|
|
177
|
-
return tabListListItemVariants;
|
|
178
|
-
default:
|
|
179
|
-
return tabListListItemVariants;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
const tabListScrollButtonThemeVariants = (theme) => {
|
|
183
|
-
switch (theme) {
|
|
184
|
-
case "mona":
|
|
185
|
-
return tabListScrollButtonVariants;
|
|
186
|
-
default:
|
|
187
|
-
return tabListScrollButtonVariants;
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
const tabContentThemeVariants = (theme) => {
|
|
191
|
-
switch (theme) {
|
|
192
|
-
case "mona":
|
|
193
|
-
return tabContentVariants;
|
|
194
|
-
default:
|
|
195
|
-
return tabContentVariants;
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
const tabsBaseThemeVariants = (theme) => {
|
|
199
|
-
switch (theme) {
|
|
200
|
-
case "mona":
|
|
201
|
-
return tabsBaseVariants;
|
|
202
|
-
default:
|
|
203
|
-
return tabsBaseVariants;
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
|
|
207
146
|
class TabListItemDirective {
|
|
208
147
|
constructor() {
|
|
209
|
-
this.#themeService = inject(ThemeService);
|
|
210
148
|
this.listItemClass = computed(() => {
|
|
211
|
-
const theme = this.#themeService.theme();
|
|
212
149
|
const active = this.active();
|
|
213
150
|
const disabled = this.disabled();
|
|
214
151
|
const rounded = this.rounded();
|
|
215
|
-
return tabListListItemThemeVariants(
|
|
152
|
+
return tabListListItemThemeVariants({ active, disabled, rounded });
|
|
216
153
|
}, /* @ts-ignore */
|
|
217
154
|
...(ngDevMode ? [{ debugName: "listItemClass" }] : /* istanbul ignore next */ []));
|
|
218
155
|
this.active = input.required(/* @ts-ignore */
|
|
@@ -222,7 +159,6 @@ class TabListItemDirective {
|
|
|
222
159
|
this.rounded = input.required(/* @ts-ignore */
|
|
223
160
|
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
224
161
|
}
|
|
225
|
-
#themeService;
|
|
226
162
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TabListItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
227
163
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TabListItemDirective, isStandalone: true, selector: "li[monaTabListItem]", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: true, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null } }, host: { properties: { "class": "listItemClass()" } }, ngImport: i0 }); }
|
|
228
164
|
}
|
|
@@ -238,38 +174,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
238
174
|
|
|
239
175
|
class TabListComponent {
|
|
240
176
|
#destroyRef;
|
|
241
|
-
#themeService;
|
|
242
177
|
#keydown$;
|
|
243
178
|
#resizeObserver;
|
|
244
179
|
#scrollIntent$;
|
|
245
180
|
constructor() {
|
|
246
181
|
this.#destroyRef = inject(DestroyRef);
|
|
247
|
-
this.#themeService = inject(ThemeService);
|
|
248
182
|
this.#keydown$ = new Subject();
|
|
249
183
|
this.#resizeObserver = null;
|
|
250
184
|
this.#scrollIntent$ = new Subject();
|
|
251
185
|
this.baseClass = computed(() => {
|
|
252
|
-
const theme = this.#themeService.theme();
|
|
253
186
|
const rounded = this.rounded();
|
|
254
187
|
const size = this.size();
|
|
255
|
-
return tabListBaseThemeVariants(
|
|
188
|
+
return tabListBaseThemeVariants({ rounded, size });
|
|
256
189
|
}, /* @ts-ignore */
|
|
257
190
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
258
191
|
this.listClass = computed(() => {
|
|
259
|
-
|
|
260
|
-
return tabListListThemeVariants(theme)();
|
|
192
|
+
return tabListListThemeVariants();
|
|
261
193
|
}, /* @ts-ignore */
|
|
262
194
|
...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
|
|
263
195
|
this.scrollButtonClass = computed(() => {
|
|
264
|
-
|
|
265
|
-
return tabListScrollButtonThemeVariants(theme)();
|
|
196
|
+
return tabListScrollButtonThemeVariants();
|
|
266
197
|
}, /* @ts-ignore */
|
|
267
198
|
...(ngDevMode ? [{ debugName: "scrollButtonClass" }] : /* istanbul ignore next */ []));
|
|
268
|
-
this.scrollLeftIcon = faChevronLeft;
|
|
269
|
-
this.scrollRightIcon = faChevronRight;
|
|
270
199
|
this.scrollsVisible = signal(false, /* @ts-ignore */
|
|
271
200
|
...(ngDevMode ? [{ debugName: "scrollsVisible" }] : /* istanbul ignore next */ []));
|
|
272
|
-
this.tabCloseIcon = faXmark;
|
|
273
201
|
this.tabListElement = viewChild.required("tabListElement", /* @ts-ignore */
|
|
274
202
|
...(ngDevMode ? [{ debugName: "tabListElement" }] : /* istanbul ignore next */ []));
|
|
275
203
|
this.tabListItems = viewChildren(TabListItemDirective, { ...(ngDevMode ? { debugName: "tabListItems" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
@@ -474,14 +402,14 @@ class TabListComponent {
|
|
|
474
402
|
});
|
|
475
403
|
}
|
|
476
404
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TabListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
477
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TabListComponent, isStandalone: true, selector: "mona-tab-list", inputs: { closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, selectedTabId: { classPropertyName: "selectedTabId", publicName: "selectedTabId", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: true, transformFunction: null }, tabList: { classPropertyName: "tabList", publicName: "tabList", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selectedTabId: "selectedTabIdChange", tabClose: "tabClose", tabSelect: "tabSelect" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "baseClass()" } }, viewQueries: [{ propertyName: "tabListElement", first: true, predicate: ["tabListElement"], descendants: true, isSignal: true }, { propertyName: "tabListItems", predicate: TabListItemDirective, descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "@if (scrollsVisible()) {\
|
|
405
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TabListComponent, isStandalone: true, selector: "mona-tab-list", inputs: { closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: true, transformFunction: null }, selectedTabId: { classPropertyName: "selectedTabId", publicName: "selectedTabId", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: true, transformFunction: null }, tabList: { classPropertyName: "tabList", publicName: "tabList", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { selectedTabId: "selectedTabIdChange", tabClose: "tabClose", tabSelect: "tabSelect" }, host: { listeners: { "keydown": "onKeydown($event)" }, properties: { "class": "baseClass()" } }, viewQueries: [{ propertyName: "tabListElement", first: true, predicate: ["tabListElement"], descendants: true, isSignal: true }, { propertyName: "tabListItems", predicate: TabListItemDirective, descendants: true, read: ElementRef, isSignal: true }], ngImport: i0, template: "@if (scrollsVisible()) {\n <button\n monaButton\n look=\"link\"\n size=\"small\"\n [class]=\"scrollButtonClass()\"\n (click)=\"startScrolling(tabListElement, 'left', 'single')\"\n (pointerdown)=\"startContinuousScroll($event, tabListElement, 'left')\"\n (pointerup)=\"stopScrolling()\"\n [attr.aria-hidden]=\"true\"\n tabindex=\"-1\">\n <svg lucideChevronLeft [size]=\"16\"></svg>\n </button>\n}\n<div class=\"w-full h-full overflow-hidden\">\n <ul [class]=\"listClass()\" #tabListElement role=\"tablist\">\n @for (tab of tabList(); track tab) {\n @let selected = tab.id === selectedTabId();\n @let itemDisabled = tab.disabled || disabled();\n <li\n monaTabListItem\n [id]=\"tab.id + '-tab'\"\n [active]=\"selected\"\n [disabled]=\"itemDisabled\"\n [rounded]=\"rounded()\"\n role=\"tab\"\n [tabindex]=\"selected ? 0 : -1\"\n [attr.aria-selected]=\"selected\"\n [attr.aria-disabled]=\"itemDisabled\"\n [attr.aria-controls]=\"tab.id + '-panel'\"\n [attr.data-selected]=\"selected\"\n [attr.data-tab-id]=\"tab.id\"\n (click)=\"onTabClick(tab, tabListElement, $event)\">\n <div>\n @if (tab.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"tab.titleTemplate\"></ng-container>\n } @else {\n <span>{{ tab.title }}</span>\n }\n </div>\n @if (tab.closable || closable()) {\n <button\n monaButton\n look=\"link\"\n [disabled]=\"itemDisabled\"\n (click)=\"onTabClose(tab, $event)\"\n class=\"px-0 h-fit ml-1 w-min\"\n tabindex=\"-1\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n }\n </li>\n }\n </ul>\n</div>\n@if (scrollsVisible()) {\n <button\n monaButton\n look=\"link\"\n size=\"small\"\n [class]=\"scrollButtonClass()\"\n (click)=\"startScrolling(tabListElement, 'right', 'single')\"\n (pointerdown)=\"startContinuousScroll($event, tabListElement, 'right')\"\n (pointerup)=\"stopScrolling()\"\n [attr.aria-hidden]=\"true\"\n tabindex=\"-1\">\n <svg lucideChevronRight [size]=\"16\"></svg>\n </button>\n}\n", dependencies: [{ 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: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: TabListItemDirective, selector: "li[monaTabListItem]", inputs: ["active", "disabled", "rounded"] }, { kind: "component", type: LucideChevronLeft, selector: "svg[lucideChevronLeft]" }, { kind: "component", type: LucideChevronRight, selector: "svg[lucideChevronRight]" }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }] }); }
|
|
478
406
|
}
|
|
479
407
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TabListComponent, decorators: [{
|
|
480
408
|
type: Component,
|
|
481
|
-
args: [{ selector: "mona-tab-list", imports: [ButtonDirective,
|
|
409
|
+
args: [{ selector: "mona-tab-list", imports: [ButtonDirective, NgTemplateOutlet, TabListItemDirective, LucideChevronLeft, LucideChevronRight, LucideX], host: {
|
|
482
410
|
"[class]": "baseClass()",
|
|
483
411
|
"(keydown)": "onKeydown($event)"
|
|
484
|
-
}, template: "@if (scrollsVisible()) {\
|
|
412
|
+
}, template: "@if (scrollsVisible()) {\n <button\n monaButton\n look=\"link\"\n size=\"small\"\n [class]=\"scrollButtonClass()\"\n (click)=\"startScrolling(tabListElement, 'left', 'single')\"\n (pointerdown)=\"startContinuousScroll($event, tabListElement, 'left')\"\n (pointerup)=\"stopScrolling()\"\n [attr.aria-hidden]=\"true\"\n tabindex=\"-1\">\n <svg lucideChevronLeft [size]=\"16\"></svg>\n </button>\n}\n<div class=\"w-full h-full overflow-hidden\">\n <ul [class]=\"listClass()\" #tabListElement role=\"tablist\">\n @for (tab of tabList(); track tab) {\n @let selected = tab.id === selectedTabId();\n @let itemDisabled = tab.disabled || disabled();\n <li\n monaTabListItem\n [id]=\"tab.id + '-tab'\"\n [active]=\"selected\"\n [disabled]=\"itemDisabled\"\n [rounded]=\"rounded()\"\n role=\"tab\"\n [tabindex]=\"selected ? 0 : -1\"\n [attr.aria-selected]=\"selected\"\n [attr.aria-disabled]=\"itemDisabled\"\n [attr.aria-controls]=\"tab.id + '-panel'\"\n [attr.data-selected]=\"selected\"\n [attr.data-tab-id]=\"tab.id\"\n (click)=\"onTabClick(tab, tabListElement, $event)\">\n <div>\n @if (tab.titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"tab.titleTemplate\"></ng-container>\n } @else {\n <span>{{ tab.title }}</span>\n }\n </div>\n @if (tab.closable || closable()) {\n <button\n monaButton\n look=\"link\"\n [disabled]=\"itemDisabled\"\n (click)=\"onTabClose(tab, $event)\"\n class=\"px-0 h-fit ml-1 w-min\"\n tabindex=\"-1\">\n <svg lucideX [size]=\"16\"></svg>\n </button>\n }\n </li>\n }\n </ul>\n</div>\n@if (scrollsVisible()) {\n <button\n monaButton\n look=\"link\"\n size=\"small\"\n [class]=\"scrollButtonClass()\"\n (click)=\"startScrolling(tabListElement, 'right', 'single')\"\n (pointerdown)=\"startContinuousScroll($event, tabListElement, 'right')\"\n (pointerup)=\"stopScrolling()\"\n [attr.aria-hidden]=\"true\"\n tabindex=\"-1\">\n <svg lucideChevronRight [size]=\"16\"></svg>\n </button>\n}\n" }]
|
|
485
413
|
}], ctorParameters: () => [], propDecorators: { tabListElement: [{ type: i0.ViewChild, args: ["tabListElement", { isSignal: true }] }], tabListItems: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => TabListItemDirective), { ...{ read: ElementRef }, isSignal: true }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: true }] }], selectedTabId: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedTabId", required: false }] }, { type: i0.Output, args: ["selectedTabIdChange"] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: true }] }], tabClose: [{ type: i0.Output, args: ["tabClose"] }], tabSelect: [{ type: i0.Output, args: ["tabSelect"] }], tabList: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabList", required: true }] }] } });
|
|
486
414
|
|
|
487
415
|
class TabComponent {
|
|
@@ -555,22 +483,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
555
483
|
|
|
556
484
|
class TabsComponent {
|
|
557
485
|
constructor() {
|
|
558
|
-
this.#themeService = inject(ThemeService);
|
|
559
486
|
this.tabListComponent = viewChild.required(TabListComponent, /* @ts-ignore */
|
|
560
487
|
...(ngDevMode ? [{ debugName: "tabListComponent" }] : /* istanbul ignore next */ []));
|
|
561
488
|
this.tabs = contentChildren(TabComponent, /* @ts-ignore */
|
|
562
489
|
...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
563
490
|
this.baseClass = computed(() => {
|
|
564
|
-
const
|
|
565
|
-
const variantClass = tabsBaseThemeVariants(theme)();
|
|
491
|
+
const variantClass = tabsBaseThemeVariants();
|
|
566
492
|
const userClass = this.userClass();
|
|
567
493
|
return twMerge(variantClass, userClass);
|
|
568
494
|
}, /* @ts-ignore */
|
|
569
495
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
570
496
|
this.contentClass = computed(() => {
|
|
571
|
-
const theme = this.#themeService.theme();
|
|
572
497
|
const rounded = this.rounded() === "full" ? "large" : this.rounded();
|
|
573
|
-
return tabContentThemeVariants(
|
|
498
|
+
return tabContentThemeVariants({ rounded });
|
|
574
499
|
}, /* @ts-ignore */
|
|
575
500
|
...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
|
|
576
501
|
this.selectedTabId = linkedSignal({ ...(ngDevMode ? { debugName: "selectedTabId" } : /* istanbul ignore next */ {}), source: () => this.tabList(),
|
|
@@ -632,7 +557,6 @@ class TabsComponent {
|
|
|
632
557
|
*/
|
|
633
558
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
634
559
|
}
|
|
635
|
-
#themeService;
|
|
636
560
|
handlePanelKeyDown(event) {
|
|
637
561
|
if (event.key === "Tab" && event.shiftKey) {
|
|
638
562
|
if (event.target !== event.currentTarget) {
|
|
@@ -643,13 +567,13 @@ class TabsComponent {
|
|
|
643
567
|
}
|
|
644
568
|
}
|
|
645
569
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
646
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TabsComponent, isStandalone: true, selector: "mona-tabs", inputs: { closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, keepTabContent: { classPropertyName: "keepTabContent", publicName: "keepTabContent", 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 }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tabClose: "tabClose", tabSelect: "tabSelect" }, host: { properties: { "class": "baseClass()" } }, queries: [{ propertyName: "tabs", predicate: TabComponent, isSignal: true }], viewQueries: [{ propertyName: "tabListComponent", first: true, predicate: TabListComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<mona-tab-list\
|
|
570
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TabsComponent, isStandalone: true, selector: "mona-tabs", inputs: { closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, keepTabContent: { classPropertyName: "keepTabContent", publicName: "keepTabContent", 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 }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { tabClose: "tabClose", tabSelect: "tabSelect" }, host: { properties: { "class": "baseClass()" } }, queries: [{ propertyName: "tabs", predicate: TabComponent, isSignal: true }], viewQueries: [{ propertyName: "tabListComponent", first: true, predicate: TabListComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<mona-tab-list\n [closable]=\"closable()\"\n [disabled]=\"disabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [tabList]=\"tabList()\"\n [selectedTabId]=\"selectedTabId()\"\n (selectedTabIdChange)=\"selectedTabId.set($event)\"\n (tabClose)=\"tabClose.emit($event)\"\n (tabSelect)=\"tabSelect.emit($event)\"></mona-tab-list>\n<div [class]=\"contentClass()\">\n @for (tab of tabList(); track tab) {\n @let selected = tab.id === selectedTabId();\n @let tabLoaded = keepTabContent() || selected;\n @let tabHidden = keepTabContent() && !selected;\n @if (tabLoaded) {\n <div\n class=\"w-full h-full outline-none\"\n [class.hidden]=\"tabHidden\"\n role=\"tabpanel\"\n [id]=\"tab.id + '-panel'\"\n tabindex=\"0\"\n (keydown)=\"handlePanelKeyDown($event)\"\n [attr.aria-hidden]=\"tabHidden\"\n [attr.aria-labelledby]=\"tab.id + '-tab'\">\n <ng-container [ngTemplateOutlet]=\"tab.contentTemplate\"></ng-container>\n </div>\n }\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TabListComponent, selector: "mona-tab-list", inputs: ["closable", "disabled", "rounded", "selectedTabId", "size", "tabList"], outputs: ["selectedTabIdChange", "tabClose", "tabSelect"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
647
571
|
}
|
|
648
572
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TabsComponent, decorators: [{
|
|
649
573
|
type: Component,
|
|
650
574
|
args: [{ selector: "mona-tabs", changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, TabListComponent], host: {
|
|
651
575
|
"[class]": "baseClass()"
|
|
652
|
-
}, template: "<mona-tab-list\
|
|
576
|
+
}, template: "<mona-tab-list\n [closable]=\"closable()\"\n [disabled]=\"disabled()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [tabList]=\"tabList()\"\n [selectedTabId]=\"selectedTabId()\"\n (selectedTabIdChange)=\"selectedTabId.set($event)\"\n (tabClose)=\"tabClose.emit($event)\"\n (tabSelect)=\"tabSelect.emit($event)\"></mona-tab-list>\n<div [class]=\"contentClass()\">\n @for (tab of tabList(); track tab) {\n @let selected = tab.id === selectedTabId();\n @let tabLoaded = keepTabContent() || selected;\n @let tabHidden = keepTabContent() && !selected;\n @if (tabLoaded) {\n <div\n class=\"w-full h-full outline-none\"\n [class.hidden]=\"tabHidden\"\n role=\"tabpanel\"\n [id]=\"tab.id + '-panel'\"\n tabindex=\"0\"\n (keydown)=\"handlePanelKeyDown($event)\"\n [attr.aria-hidden]=\"tabHidden\"\n [attr.aria-labelledby]=\"tab.id + '-tab'\">\n <ng-container [ngTemplateOutlet]=\"tab.contentTemplate\"></ng-container>\n </div>\n }\n }\n</div>\n" }]
|
|
653
577
|
}], propDecorators: { tabListComponent: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TabListComponent), { isSignal: true }] }], tabs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TabComponent), { isSignal: true }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], keepTabContent: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepTabContent", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], tabClose: [{ type: i0.Output, args: ["tabClose"] }], tabSelect: [{ type: i0.Output, args: ["tabSelect"] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
654
578
|
|
|
655
579
|
/*
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { computed, input, Directive } from '@angular/core';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
5
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { themeControlSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
shadow-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[&.ng-touched.ng-invalid]:border-error
|
|
26
|
-
[&.ng-touched.ng-invalid]:ring-error/
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
const textAreaThemeVariants = cva(`
|
|
8
|
+
px-2 py-1
|
|
9
|
+
text-sm text-foreground
|
|
10
|
+
${themeControlSurfaceClasses}
|
|
11
|
+
border border-input-border shadow-(--shadow-control)
|
|
12
|
+
outline-none
|
|
13
|
+
selection:bg-primary selection:text-primary-foreground
|
|
14
|
+
transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
|
|
15
|
+
placeholder:text-muted-foreground
|
|
16
|
+
|
|
17
|
+
disabled:pointer-events-none disabled:cursor-not-allowed disabled:select-none
|
|
18
|
+
disabled:border-disabled-border disabled:bg-disabled-background disabled:text-disabled-foreground
|
|
19
|
+
disabled:shadow-none
|
|
20
|
+
read-only:cursor-default
|
|
21
|
+
|
|
22
|
+
focus-visible:border-focus-indicator
|
|
23
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
24
|
+
|
|
25
|
+
[&.ng-touched.ng-invalid]:border-error
|
|
26
|
+
[&.ng-touched.ng-invalid]:ring-2 [&.ng-touched.ng-invalid]:ring-error/35
|
|
27
|
+
[&.ng-touched.ng-invalid]:focus-visible:border-error
|
|
28
|
+
[&.ng-touched.ng-invalid]:focus-visible:ring-error/35
|
|
29
|
+
data-[invalid='true']:border-error
|
|
30
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
31
|
+
data-[invalid='true']:focus-visible:border-error
|
|
32
|
+
data-[invalid='true']:focus-visible:ring-error/35
|
|
29
33
|
`, {
|
|
30
34
|
variants: {
|
|
31
35
|
rounded: {
|
|
@@ -37,22 +41,11 @@ const textAreaVariants = cva(`
|
|
|
37
41
|
}
|
|
38
42
|
});
|
|
39
43
|
|
|
40
|
-
const textAreaThemeVariants = (theme) => {
|
|
41
|
-
switch (theme) {
|
|
42
|
-
case "mona":
|
|
43
|
-
return textAreaVariants;
|
|
44
|
-
default:
|
|
45
|
-
return textAreaVariants;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
44
|
class TextAreaDirective {
|
|
50
45
|
constructor() {
|
|
51
|
-
this.#themeService = inject(ThemeService);
|
|
52
46
|
this.baseClass = computed(() => {
|
|
53
|
-
const theme = this.#themeService.theme();
|
|
54
47
|
const rounded = this.rounded();
|
|
55
|
-
const classes = textAreaThemeVariants(
|
|
48
|
+
const classes = textAreaThemeVariants({ rounded });
|
|
56
49
|
const userClass = this.userClass();
|
|
57
50
|
return twMerge(classes, userClass);
|
|
58
51
|
}, /* @ts-ignore */
|
|
@@ -83,7 +76,6 @@ class TextAreaDirective {
|
|
|
83
76
|
*/
|
|
84
77
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
85
78
|
}
|
|
86
|
-
#themeService;
|
|
87
79
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextAreaDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
88
80
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TextAreaDirective, isStandalone: true, selector: "textarea[monaTextArea]", inputs: { rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", 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 } }, host: { properties: { "attr.aria-invalid": "inputInvalid() || null", "attr.data-invalid": "inputInvalid() || null", "class": "baseClass()" } }, ngImport: i0 }); }
|
|
89
81
|
}
|