@nanahoshi/mona-ui 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +40 -55
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +19 -53
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +15 -26
- package/fesm2022/nanahoshi-mona-ui-button.mjs +67 -68
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +54 -150
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +67 -99
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +35 -45
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +9 -23
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +27 -78
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +17 -39
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +39 -48
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +34 -54
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +9 -12
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +42 -29
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +53 -53
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +40 -153
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +33 -54
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +7 -12
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +59 -219
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +24 -75
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +11 -44
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +11 -41
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B2ETh-uI.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DZk18LJC.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-C7WKhhig.mjs → nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs} +9 -16
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-BRiY0CDX.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +15 -44
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BrYpFMyF.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs} +11 -20
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-T9Bj98kl.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +109 -393
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +27 -57
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +31 -122
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +4 -26
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +5 -18
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +48 -154
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +36 -63
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +24 -108
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +38 -64
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +21 -73
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +8 -30
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +29 -50
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +36 -108
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +19 -60
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +78 -98
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +53 -144
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +54 -110
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +7 -20
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +15 -50
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +28 -91
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +37 -59
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +35 -107
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +19 -31
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +60 -65
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +43 -29
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +40 -102
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +13 -41
- package/fesm2022/nanahoshi-mona-ui-window.mjs +29 -108
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +2 -1
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +18 -10
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -5
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +2 -3
- package/types/nanahoshi-mona-ui-grid.d.ts +14 -15
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +6 -7
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +28 -13
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +12 -13
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +14 -16
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +16 -7
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +11 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
|
@@ -1,16 +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
5
|
import { firstOrDefault, select } from '@mirei/ts-collections';
|
|
6
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
6
|
import { twMerge } from 'tailwind-merge';
|
|
8
7
|
import { cva } from 'class-variance-authority';
|
|
8
|
+
import { themeRaisedBackdropClasses, themeRaisedSurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
9
9
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
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 { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
14
13
|
|
|
15
14
|
class TabCloseEvent extends PreventableEvent {
|
|
16
15
|
#index;
|
|
@@ -63,11 +62,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
63
62
|
}]
|
|
64
63
|
}] });
|
|
65
64
|
|
|
66
|
-
const
|
|
67
|
-
w-fit max-w-full
|
|
68
|
-
|
|
69
|
-
bg-
|
|
70
|
-
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}
|
|
71
69
|
`, {
|
|
72
70
|
variants: {
|
|
73
71
|
rounded: {
|
|
@@ -84,27 +82,24 @@ const tabListBaseVariants = cva(`
|
|
|
84
82
|
}
|
|
85
83
|
}
|
|
86
84
|
});
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
flex h-full w-full overflow-hidden
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
p-[3px]
|
|
93
|
-
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
|
|
94
90
|
`);
|
|
95
|
-
const
|
|
96
|
-
flex items-center justify-center
|
|
97
|
-
cursor-pointer
|
|
98
|
-
|
|
99
|
-
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
|
|
100
95
|
`, {
|
|
101
96
|
variants: {
|
|
102
97
|
active: {
|
|
103
|
-
true:
|
|
98
|
+
true: `${themeRaisedSurfaceClasses} font-semibold text-foreground shadow-(--shadow-control) inset-ring-1 inset-ring-border-subtle`,
|
|
104
99
|
false: ""
|
|
105
100
|
},
|
|
106
101
|
disabled: {
|
|
107
|
-
true: "pointer-events-none cursor-not-allowed
|
|
102
|
+
true: "pointer-events-none cursor-not-allowed select-none text-disabled-foreground",
|
|
108
103
|
false: ""
|
|
109
104
|
},
|
|
110
105
|
rounded: {
|
|
@@ -119,14 +114,17 @@ const tabListListItemVariants = cva(`
|
|
|
119
114
|
rounded: "medium"
|
|
120
115
|
}
|
|
121
116
|
});
|
|
122
|
-
const
|
|
123
|
-
flex items-center justify-center
|
|
124
|
-
|
|
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
|
|
125
122
|
`);
|
|
126
|
-
const
|
|
127
|
-
w-full overflow-auto
|
|
128
|
-
|
|
129
|
-
bg-background text-foreground
|
|
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)
|
|
130
128
|
`, {
|
|
131
129
|
variants: {
|
|
132
130
|
rounded: {
|
|
@@ -141,77 +139,17 @@ const tabContentVariants = cva(`
|
|
|
141
139
|
rounded: "medium"
|
|
142
140
|
}
|
|
143
141
|
});
|
|
144
|
-
const
|
|
145
|
-
max-w-full
|
|
146
|
-
flex flex-col gap-2
|
|
142
|
+
const tabsBaseThemeVariants = cva(`
|
|
143
|
+
flex max-w-full flex-col gap-2
|
|
147
144
|
`);
|
|
148
145
|
|
|
149
|
-
const tabListBaseThemeVariants = (theme) => {
|
|
150
|
-
switch (theme) {
|
|
151
|
-
case "mona":
|
|
152
|
-
return tabListBaseVariants;
|
|
153
|
-
default:
|
|
154
|
-
return tabListBaseVariants;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
const tabListListWrapperThemeVariants = (theme) => {
|
|
158
|
-
switch (theme) {
|
|
159
|
-
case "mona":
|
|
160
|
-
return tabListListWrapperVariants;
|
|
161
|
-
default:
|
|
162
|
-
return tabListListWrapperVariants;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const tabListListThemeVariants = (theme) => {
|
|
166
|
-
switch (theme) {
|
|
167
|
-
case "mona":
|
|
168
|
-
return tabListListVariants;
|
|
169
|
-
default:
|
|
170
|
-
return tabListListVariants;
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
const tabListListItemThemeVariants = (theme) => {
|
|
174
|
-
switch (theme) {
|
|
175
|
-
case "mona":
|
|
176
|
-
return tabListListItemVariants;
|
|
177
|
-
default:
|
|
178
|
-
return tabListListItemVariants;
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
const tabListScrollButtonThemeVariants = (theme) => {
|
|
182
|
-
switch (theme) {
|
|
183
|
-
case "mona":
|
|
184
|
-
return tabListScrollButtonVariants;
|
|
185
|
-
default:
|
|
186
|
-
return tabListScrollButtonVariants;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const tabContentThemeVariants = (theme) => {
|
|
190
|
-
switch (theme) {
|
|
191
|
-
case "mona":
|
|
192
|
-
return tabContentVariants;
|
|
193
|
-
default:
|
|
194
|
-
return tabContentVariants;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const tabsBaseThemeVariants = (theme) => {
|
|
198
|
-
switch (theme) {
|
|
199
|
-
case "mona":
|
|
200
|
-
return tabsBaseVariants;
|
|
201
|
-
default:
|
|
202
|
-
return tabsBaseVariants;
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
146
|
class TabListItemDirective {
|
|
207
147
|
constructor() {
|
|
208
|
-
this.#themeService = inject(ThemeService);
|
|
209
148
|
this.listItemClass = computed(() => {
|
|
210
|
-
const theme = this.#themeService.theme();
|
|
211
149
|
const active = this.active();
|
|
212
150
|
const disabled = this.disabled();
|
|
213
151
|
const rounded = this.rounded();
|
|
214
|
-
return tabListListItemThemeVariants(
|
|
152
|
+
return tabListListItemThemeVariants({ active, disabled, rounded });
|
|
215
153
|
}, /* @ts-ignore */
|
|
216
154
|
...(ngDevMode ? [{ debugName: "listItemClass" }] : /* istanbul ignore next */ []));
|
|
217
155
|
this.active = input.required(/* @ts-ignore */
|
|
@@ -221,7 +159,6 @@ class TabListItemDirective {
|
|
|
221
159
|
this.rounded = input.required(/* @ts-ignore */
|
|
222
160
|
...(ngDevMode ? [{ debugName: "rounded" }] : /* istanbul ignore next */ []));
|
|
223
161
|
}
|
|
224
|
-
#themeService;
|
|
225
162
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TabListItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
226
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 }); }
|
|
227
164
|
}
|
|
@@ -237,31 +174,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
237
174
|
|
|
238
175
|
class TabListComponent {
|
|
239
176
|
#destroyRef;
|
|
240
|
-
#themeService;
|
|
241
177
|
#keydown$;
|
|
242
178
|
#resizeObserver;
|
|
243
179
|
#scrollIntent$;
|
|
244
180
|
constructor() {
|
|
245
181
|
this.#destroyRef = inject(DestroyRef);
|
|
246
|
-
this.#themeService = inject(ThemeService);
|
|
247
182
|
this.#keydown$ = new Subject();
|
|
248
183
|
this.#resizeObserver = null;
|
|
249
184
|
this.#scrollIntent$ = new Subject();
|
|
250
185
|
this.baseClass = computed(() => {
|
|
251
|
-
const theme = this.#themeService.theme();
|
|
252
186
|
const rounded = this.rounded();
|
|
253
187
|
const size = this.size();
|
|
254
|
-
return tabListBaseThemeVariants(
|
|
188
|
+
return tabListBaseThemeVariants({ rounded, size });
|
|
255
189
|
}, /* @ts-ignore */
|
|
256
190
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
257
191
|
this.listClass = computed(() => {
|
|
258
|
-
|
|
259
|
-
return tabListListThemeVariants(theme)();
|
|
192
|
+
return tabListListThemeVariants();
|
|
260
193
|
}, /* @ts-ignore */
|
|
261
194
|
...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
|
|
262
195
|
this.scrollButtonClass = computed(() => {
|
|
263
|
-
|
|
264
|
-
return tabListScrollButtonThemeVariants(theme)();
|
|
196
|
+
return tabListScrollButtonThemeVariants();
|
|
265
197
|
}, /* @ts-ignore */
|
|
266
198
|
...(ngDevMode ? [{ debugName: "scrollButtonClass" }] : /* istanbul ignore next */ []));
|
|
267
199
|
this.scrollsVisible = signal(false, /* @ts-ignore */
|
|
@@ -551,22 +483,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
551
483
|
|
|
552
484
|
class TabsComponent {
|
|
553
485
|
constructor() {
|
|
554
|
-
this.#themeService = inject(ThemeService);
|
|
555
486
|
this.tabListComponent = viewChild.required(TabListComponent, /* @ts-ignore */
|
|
556
487
|
...(ngDevMode ? [{ debugName: "tabListComponent" }] : /* istanbul ignore next */ []));
|
|
557
488
|
this.tabs = contentChildren(TabComponent, /* @ts-ignore */
|
|
558
489
|
...(ngDevMode ? [{ debugName: "tabs" }] : /* istanbul ignore next */ []));
|
|
559
490
|
this.baseClass = computed(() => {
|
|
560
|
-
const
|
|
561
|
-
const variantClass = tabsBaseThemeVariants(theme)();
|
|
491
|
+
const variantClass = tabsBaseThemeVariants();
|
|
562
492
|
const userClass = this.userClass();
|
|
563
493
|
return twMerge(variantClass, userClass);
|
|
564
494
|
}, /* @ts-ignore */
|
|
565
495
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
566
496
|
this.contentClass = computed(() => {
|
|
567
|
-
const theme = this.#themeService.theme();
|
|
568
497
|
const rounded = this.rounded() === "full" ? "large" : this.rounded();
|
|
569
|
-
return tabContentThemeVariants(
|
|
498
|
+
return tabContentThemeVariants({ rounded });
|
|
570
499
|
}, /* @ts-ignore */
|
|
571
500
|
...(ngDevMode ? [{ debugName: "contentClass" }] : /* istanbul ignore next */ []));
|
|
572
501
|
this.selectedTabId = linkedSignal({ ...(ngDevMode ? { debugName: "selectedTabId" } : /* istanbul ignore next */ {}), source: () => this.tabList(),
|
|
@@ -628,7 +557,6 @@ class TabsComponent {
|
|
|
628
557
|
*/
|
|
629
558
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
630
559
|
}
|
|
631
|
-
#themeService;
|
|
632
560
|
handlePanelKeyDown(event) {
|
|
633
561
|
if (event.key === "Tab" && event.shiftKey) {
|
|
634
562
|
if (event.target !== event.currentTarget) {
|
|
@@ -1,31 +1,31 @@
|
|
|
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
|
-
|
|
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
|
|
11
13
|
selection:bg-primary selection:text-primary-foreground
|
|
12
|
-
transition-[color,box-shadow,border] ease-in-out
|
|
13
|
-
|
|
14
|
-
shadow-xs
|
|
15
|
-
px-2 py-1 text-sm
|
|
16
|
-
|
|
14
|
+
transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
|
|
17
15
|
placeholder:text-muted-foreground
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
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
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
focus-visible:border-focus-indicator
|
|
23
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
24
24
|
|
|
25
|
-
[&.ng-touched.ng-invalid]:border-error
|
|
26
|
-
[&.ng-touched.ng-invalid]:ring-error/40
|
|
27
25
|
data-[invalid='true']:border-error
|
|
28
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/
|
|
26
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
27
|
+
data-[invalid='true']:focus-visible:border-error
|
|
28
|
+
data-[invalid='true']:focus-visible:ring-error/35
|
|
29
29
|
`, {
|
|
30
30
|
variants: {
|
|
31
31
|
rounded: {
|
|
@@ -37,22 +37,11 @@ const textAreaVariants = cva(`
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
const textAreaThemeVariants = (theme) => {
|
|
41
|
-
switch (theme) {
|
|
42
|
-
case "mona":
|
|
43
|
-
return textAreaVariants;
|
|
44
|
-
default:
|
|
45
|
-
return textAreaVariants;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
40
|
class TextAreaDirective {
|
|
50
41
|
constructor() {
|
|
51
|
-
this.#themeService = inject(ThemeService);
|
|
52
42
|
this.baseClass = computed(() => {
|
|
53
|
-
const theme = this.#themeService.theme();
|
|
54
43
|
const rounded = this.rounded();
|
|
55
|
-
const classes = textAreaThemeVariants(
|
|
44
|
+
const classes = textAreaThemeVariants({ rounded });
|
|
56
45
|
const userClass = this.userClass();
|
|
57
46
|
return twMerge(classes, userClass);
|
|
58
47
|
}, /* @ts-ignore */
|
|
@@ -83,7 +72,6 @@ class TextAreaDirective {
|
|
|
83
72
|
*/
|
|
84
73
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
85
74
|
}
|
|
86
|
-
#themeService;
|
|
87
75
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextAreaDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
88
76
|
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
77
|
}
|
|
@@ -5,8 +5,7 @@ import * as i1 from '@angular/forms';
|
|
|
5
5
|
import { FormsModule } from '@angular/forms';
|
|
6
6
|
import { LucideX } from '@lucide/angular';
|
|
7
7
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
8
|
-
import { rxTimeout, AttributeBinderDirective } from '@nanahoshi/mona-ui/internal';
|
|
9
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
8
|
+
import { themeControlSurfaceClasses, rxTimeout, AttributeBinderDirective } from '@nanahoshi/mona-ui/internal';
|
|
10
9
|
import { twMerge } from 'tailwind-merge';
|
|
11
10
|
import { cva } from 'class-variance-authority';
|
|
12
11
|
|
|
@@ -32,31 +31,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
32
31
|
}]
|
|
33
32
|
}] });
|
|
34
33
|
|
|
35
|
-
const
|
|
36
|
-
flex
|
|
34
|
+
const textBoxThemeVariants = cva(`
|
|
35
|
+
flex w-full min-w-0 items-center
|
|
37
36
|
overflow-hidden
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
${themeControlSurfaceClasses} text-foreground
|
|
38
|
+
border border-input-border shadow-(--shadow-control)
|
|
39
|
+
outline-none
|
|
41
40
|
selection:bg-primary selection:text-primary-foreground
|
|
42
|
-
|
|
43
|
-
transition-[color,box-shadow,border] ease-in-out duration-300
|
|
41
|
+
transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
|
|
44
42
|
|
|
45
43
|
data-[disabled='true']:pointer-events-none
|
|
46
44
|
data-[disabled='true']:cursor-not-allowed
|
|
47
|
-
data-[disabled='true']:
|
|
45
|
+
data-[disabled='true']:border-disabled-border
|
|
46
|
+
data-[disabled='true']:bg-disabled-background
|
|
47
|
+
data-[disabled='true']:text-disabled-foreground
|
|
48
|
+
data-[disabled='true']:shadow-none
|
|
49
|
+
data-[readonly='true']:cursor-default
|
|
48
50
|
|
|
49
|
-
focus-within:
|
|
50
|
-
focus-within:
|
|
51
|
+
focus-within:border-focus-indicator
|
|
52
|
+
focus-within:ring-2 focus-within:ring-focus-indicator/35
|
|
53
|
+
|
|
54
|
+
data-[invalid='true']:border-error
|
|
55
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
56
|
+
data-[invalid='true']:focus-within:border-error
|
|
57
|
+
data-[invalid='true']:focus-within:ring-error/35
|
|
51
58
|
|
|
52
|
-
[&>input]:
|
|
59
|
+
[&>input]:h-full [&>input]:w-full
|
|
60
|
+
[&>input]:px-2
|
|
53
61
|
[&>input]:bg-transparent
|
|
54
62
|
[&>input]:border-0 [&>input]:outline-none
|
|
55
63
|
[&>input]:placeholder:text-muted-foreground
|
|
56
|
-
[&>input]:px-2
|
|
57
|
-
|
|
58
|
-
data-[invalid='true']:border-error
|
|
59
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/40
|
|
60
64
|
`, {
|
|
61
65
|
variants: {
|
|
62
66
|
rounded: {
|
|
@@ -73,33 +77,31 @@ const textBoxVariants = cva(`
|
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
79
|
});
|
|
76
|
-
const
|
|
77
|
-
bg-input-background
|
|
80
|
+
const inputThemeVariants = cva(`
|
|
78
81
|
px-2
|
|
79
|
-
|
|
80
|
-
border border-input-border
|
|
82
|
+
${themeControlSurfaceClasses} text-foreground
|
|
83
|
+
border border-input-border shadow-(--shadow-control)
|
|
84
|
+
outline-none
|
|
81
85
|
selection:bg-primary selection:text-primary-foreground
|
|
86
|
+
transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
|
|
82
87
|
|
|
83
|
-
transition-[color,box-shadow,border] ease-in-out duration-300
|
|
84
|
-
|
|
85
|
-
shadow-xs
|
|
86
|
-
|
|
87
|
-
file:text-foreground
|
|
88
88
|
file:inline-flex file:border-0
|
|
89
89
|
file:bg-transparent file:text-xs
|
|
90
|
-
file:font-medium
|
|
91
|
-
|
|
90
|
+
file:font-medium file:text-foreground
|
|
92
91
|
placeholder:text-muted-foreground
|
|
93
92
|
|
|
94
|
-
disabled:pointer-events-none
|
|
95
|
-
disabled:
|
|
96
|
-
disabled:
|
|
93
|
+
disabled:pointer-events-none disabled:cursor-not-allowed
|
|
94
|
+
disabled:border-disabled-border disabled:bg-disabled-background disabled:text-disabled-foreground
|
|
95
|
+
disabled:shadow-none
|
|
96
|
+
read-only:cursor-default
|
|
97
97
|
|
|
98
|
-
focus-visible:
|
|
99
|
-
focus-visible:
|
|
98
|
+
focus-visible:border-focus-indicator
|
|
99
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
100
100
|
|
|
101
|
-
[
|
|
102
|
-
[
|
|
101
|
+
data-[invalid='true']:border-error
|
|
102
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
103
|
+
data-[invalid='true']:focus-visible:border-error
|
|
104
|
+
data-[invalid='true']:focus-visible:ring-error/35
|
|
103
105
|
`, {
|
|
104
106
|
variants: {
|
|
105
107
|
rounded: {
|
|
@@ -134,39 +136,20 @@ const inputVariants = cva(`
|
|
|
134
136
|
]
|
|
135
137
|
});
|
|
136
138
|
|
|
137
|
-
const textBoxThemeVariants = (theme) => {
|
|
138
|
-
switch (theme) {
|
|
139
|
-
case "mona":
|
|
140
|
-
return textBoxVariants;
|
|
141
|
-
default:
|
|
142
|
-
return textBoxVariants; // Default to Mona styles
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
const inputThemeVariants = (theme) => {
|
|
146
|
-
switch (theme) {
|
|
147
|
-
case "mona":
|
|
148
|
-
return inputVariants;
|
|
149
|
-
default:
|
|
150
|
-
return inputVariants; // Default to Mona styles
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
139
|
class TextBoxComponent {
|
|
155
140
|
constructor() {
|
|
156
141
|
this.#destroyRef = inject(DestroyRef);
|
|
157
|
-
this.#themeService = inject(ThemeService);
|
|
158
142
|
this.classes = computed(() => {
|
|
159
|
-
const theme = this.#themeService.theme();
|
|
160
143
|
const rounded = this.rounded();
|
|
161
144
|
const size = this.size();
|
|
162
|
-
const classes = textBoxThemeVariants(
|
|
145
|
+
const classes = textBoxThemeVariants({ rounded, size });
|
|
163
146
|
const userClass = this.userClass();
|
|
164
147
|
return twMerge(classes, userClass);
|
|
165
148
|
}, /* @ts-ignore */
|
|
166
149
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
167
150
|
this.inputRef = viewChild.required("input", /* @ts-ignore */
|
|
168
151
|
...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
|
|
169
|
-
this.invalidInput = computed(() => this.
|
|
152
|
+
this.invalidInput = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
|
|
170
153
|
...(ngDevMode ? [{ debugName: "invalidInput" }] : /* istanbul ignore next */ []));
|
|
171
154
|
this.prefixTemplateList = contentChildren(TextBoxPrefixTemplateDirective, { ...(ngDevMode ? { debugName: "prefixTemplateList" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
172
155
|
this.suffixTemplateList = contentChildren(TextBoxSuffixTemplateDirective, { ...(ngDevMode ? { debugName: "suffixTemplateList" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
@@ -278,7 +261,6 @@ class TextBoxComponent {
|
|
|
278
261
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
279
262
|
}
|
|
280
263
|
#destroyRef;
|
|
281
|
-
#themeService;
|
|
282
264
|
focus() {
|
|
283
265
|
const el = this.inputRef().nativeElement;
|
|
284
266
|
el.focus();
|
|
@@ -300,7 +282,7 @@ class TextBoxComponent {
|
|
|
300
282
|
this.touch.emit();
|
|
301
283
|
}
|
|
302
284
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
303
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TextBoxComponent, isStandalone: true, selector: "mona-text-box", inputs: { clearButton: { classPropertyName: "clearButton", publicName: "clearButton", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputAttributes: { classPropertyName: "inputAttributes", publicName: "inputAttributes", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, inputStyle: { classPropertyName: "inputStyle", publicName: "inputStyle", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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 }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", 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", touch: "touch", value: "valueChange" }, host: { properties: { "attr.data-disabled": "disabled() || null", "attr.data-readonly": "readonly() || null", "attr.data-required": "required() || null", "attr.data-invalid": "invalidInput() || null", "class": "classes()" } }, queries: [{ propertyName: "prefixTemplateList", predicate: TextBoxPrefixTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "suffixTemplateList", predicate: TextBoxSuffixTemplateDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex
|
|
285
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TextBoxComponent, isStandalone: true, selector: "mona-text-box", inputs: { clearButton: { classPropertyName: "clearButton", publicName: "clearButton", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, inputAttributes: { classPropertyName: "inputAttributes", publicName: "inputAttributes", isSignal: true, isRequired: false, transformFunction: null }, inputClass: { classPropertyName: "inputClass", publicName: "inputClass", isSignal: true, isRequired: false, transformFunction: null }, inputStyle: { classPropertyName: "inputStyle", publicName: "inputStyle", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", 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 }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", 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", touch: "touch", value: "valueChange" }, host: { properties: { "attr.data-disabled": "disabled() || null", "attr.data-readonly": "readonly() || null", "attr.data-required": "required() || null", "attr.data-invalid": "invalidInput() || null", "class": "classes()" } }, queries: [{ propertyName: "prefixTemplateList", predicate: TextBoxPrefixTemplateDirective, read: TemplateRef, isSignal: true }, { propertyName: "suffixTemplateList", predicate: TextBoxSuffixTemplateDirective, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["input"], descendants: true, isSignal: true }], ngImport: i0, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex h-full flex-wrap items-center\">\n <ng-container *ngTemplateOutlet=\"prefixTemplate\"></ng-container>\n </span>\n}\n<input\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [placeholder]=\"placeholder()\"\n [type]=\"type()\"\n [class]=\"inputClass()\"\n [style]=\"inputStyle()\"\n [attr.aria-invalid]=\"invalidInput() ? 'true' : null\"\n [monaAttributeBinder]=\"inputAttributes()\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #input />\n\n@let textBoxValue = value();\n@if (clearButton() && textBoxValue && textBoxValue.length !== 0) {\n <button monaButton look=\"link\" size=\"small\" class=\"me-2 p-0\" aria-label=\"Clear\" (click)=\"onClearClick()\">\n <svg lucideX class=\"size-4 opacity-50 hover:opacity-90\"></svg>\n </button>\n}\n\n@for (suffixTemplate of suffixTemplateList(); track $index) {\n <span class=\"flex h-full flex-wrap items-center\">\n <ng-container *ngTemplateOutlet=\"suffixTemplate\"></ng-container>\n </span>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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: "directive", type: AttributeBinderDirective, selector: "[monaAttributeBinder]", inputs: ["monaAttributeBinder"] }, { kind: "component", type: LucideX, selector: "svg[lucideX]" }] }); }
|
|
304
286
|
}
|
|
305
287
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxComponent, decorators: [{
|
|
306
288
|
type: Component,
|
|
@@ -310,21 +292,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
310
292
|
"[attr.data-required]": "required() || null",
|
|
311
293
|
"[attr.data-invalid]": "invalidInput() || null",
|
|
312
294
|
"[class]": "classes()"
|
|
313
|
-
}, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex
|
|
295
|
+
}, template: "@for (prefixTemplate of prefixTemplateList(); track $index) {\n <span class=\"flex h-full flex-wrap items-center\">\n <ng-container *ngTemplateOutlet=\"prefixTemplate\"></ng-container>\n </span>\n}\n<input\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [placeholder]=\"placeholder()\"\n [type]=\"type()\"\n [class]=\"inputClass()\"\n [style]=\"inputStyle()\"\n [attr.aria-invalid]=\"invalidInput() ? 'true' : null\"\n [monaAttributeBinder]=\"inputAttributes()\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onValueChange($event)\"\n (blur)=\"onInputBlur($event)\"\n (focus)=\"inputFocus.emit($event)\"\n #input />\n\n@let textBoxValue = value();\n@if (clearButton() && textBoxValue && textBoxValue.length !== 0) {\n <button monaButton look=\"link\" size=\"small\" class=\"me-2 p-0\" aria-label=\"Clear\" (click)=\"onClearClick()\">\n <svg lucideX class=\"size-4 opacity-50 hover:opacity-90\"></svg>\n </button>\n}\n\n@for (suffixTemplate of suffixTemplateList(); track $index) {\n <span class=\"flex h-full flex-wrap items-center\">\n <ng-container *ngTemplateOutlet=\"suffixTemplate\"></ng-container>\n </span>\n}\n" }]
|
|
314
296
|
}], propDecorators: { inputRef: [{ type: i0.ViewChild, args: ["input", { isSignal: true }] }], prefixTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TextBoxPrefixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], suffixTemplateList: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TextBoxSuffixTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], clearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearButton", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputAttributes: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputAttributes", required: false }] }], inputBlur: [{ type: i0.Output, args: ["inputBlur"] }], inputFocus: [{ type: i0.Output, args: ["inputFocus"] }], inputClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputClass", required: false }] }], inputStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputStyle", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", 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"] }] } });
|
|
315
297
|
|
|
316
298
|
class TextBoxDirective {
|
|
317
299
|
constructor() {
|
|
318
|
-
this.#themeService = inject(ThemeService);
|
|
319
300
|
this.classes = computed(() => {
|
|
320
301
|
const rounded = this.rounded();
|
|
321
302
|
const size = this.size();
|
|
322
|
-
const
|
|
323
|
-
const classes = inputThemeVariants(theme)({ rounded, size });
|
|
303
|
+
const classes = inputThemeVariants({ rounded, size });
|
|
324
304
|
const userClass = this.userClass();
|
|
325
305
|
return twMerge(classes, userClass);
|
|
326
306
|
}, /* @ts-ignore */
|
|
327
307
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
308
|
+
this.inputInvalid = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
|
|
309
|
+
...(ngDevMode ? [{ debugName: "inputInvalid" }] : /* istanbul ignore next */ []));
|
|
310
|
+
/**
|
|
311
|
+
* @description Marks the input as invalid, triggering error border and ring styling.
|
|
312
|
+
* @default false
|
|
313
|
+
*/
|
|
314
|
+
this.invalid = input(false, /* @ts-ignore */
|
|
315
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
328
316
|
/**
|
|
329
317
|
* @description Border-radius preset applied to the component.
|
|
330
318
|
* @default "medium"
|
|
@@ -337,25 +325,32 @@ class TextBoxDirective {
|
|
|
337
325
|
*/
|
|
338
326
|
this.size = input("medium", /* @ts-ignore */
|
|
339
327
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
328
|
+
/**
|
|
329
|
+
* @description Marks the input as touched. Error styling is only shown when both `invalid` and `touched` are `true`.
|
|
330
|
+
* @default false
|
|
331
|
+
*/
|
|
332
|
+
this.touched = input(false, /* @ts-ignore */
|
|
333
|
+
...(ngDevMode ? [{ debugName: "touched" }] : /* istanbul ignore next */ []));
|
|
340
334
|
/**
|
|
341
335
|
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
342
336
|
* @default ""
|
|
343
337
|
*/
|
|
344
338
|
this.userClass = input("", { ...(ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {}), alias: "class" });
|
|
345
339
|
}
|
|
346
|
-
#themeService;
|
|
347
340
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
348
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TextBoxDirective, isStandalone: true, selector: "input[monaTextBox]", inputs: { 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 } }, host: { properties: { "class": "classes()" } }, ngImport: i0 }); }
|
|
341
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TextBoxDirective, isStandalone: true, selector: "input[monaTextBox]", inputs: { 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 }, 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": "classes()" } }, ngImport: i0 }); }
|
|
349
342
|
}
|
|
350
343
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TextBoxDirective, decorators: [{
|
|
351
344
|
type: Directive,
|
|
352
345
|
args: [{
|
|
353
346
|
selector: "input[monaTextBox]",
|
|
354
347
|
host: {
|
|
348
|
+
"[attr.aria-invalid]": "inputInvalid() || null",
|
|
349
|
+
"[attr.data-invalid]": "inputInvalid() || null",
|
|
355
350
|
"[class]": "classes()"
|
|
356
351
|
}
|
|
357
352
|
}]
|
|
358
|
-
}], propDecorators: { rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
353
|
+
}], propDecorators: { 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 }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
359
354
|
|
|
360
355
|
/*
|
|
361
356
|
* Public API Surface of @nanahoshi/mona-ui/text-box
|