@nanahoshi/mona-ui 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +38 -53
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +19 -53
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +15 -26
- package/fesm2022/nanahoshi-mona-ui-button.mjs +67 -68
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +53 -149
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +48 -95
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +35 -45
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +9 -23
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +26 -77
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +16 -38
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +41 -46
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +32 -52
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +9 -12
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +40 -27
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +51 -51
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +40 -153
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +32 -53
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +7 -12
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +59 -219
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +24 -75
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +11 -44
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +11 -41
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B2ETh-uI.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DZk18LJC.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-C7WKhhig.mjs → nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs} +9 -16
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-BRiY0CDX.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +15 -44
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BrYpFMyF.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs} +11 -20
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-T9Bj98kl.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +109 -393
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +26 -56
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +31 -122
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +4 -26
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +5 -18
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +48 -154
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +35 -62
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +24 -108
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +37 -63
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +21 -73
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +8 -30
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +29 -50
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +36 -108
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +19 -60
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +47 -92
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +53 -144
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +54 -110
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +7 -20
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +15 -50
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +28 -91
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +37 -58
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +35 -107
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +22 -30
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +40 -61
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +41 -27
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +35 -99
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +13 -41
- package/fesm2022/nanahoshi-mona-ui-window.mjs +29 -108
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +2 -1
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +6 -9
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -5
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +2 -3
- package/types/nanahoshi-mona-ui-grid.d.ts +14 -15
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +6 -7
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +8 -11
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +12 -13
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +14 -16
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +4 -6
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +10 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
|
@@ -5,7 +5,6 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
5
5
|
import { LucideChevronDown } from '@lucide/angular';
|
|
6
6
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
7
7
|
import { PopupMenuGroupTemplateDirective, PopupMenuTemplateOrigin, PopupMenuGroupTemplateToken, PopupMenuIconTemplateDirective, PopupMenuIconTemplateToken, PopupMenuShortcutTemplateDirective, PopupMenuShortcutTemplateToken, PopupMenuTextTemplateDirective, PopupMenuTextTemplateToken, PopupMenuToken, PopupMenuComponent, PopupMenuItemType, PopupMenuTemplateType, ensurePopupComponentTypes, PopupMenuOrigin, ensurePopupTemplateTypes, PopupMenuCheckboxItemComponent, PopupMenuGroupComponent, PopupMenuItemComponent, PopupMenuRadioGroupComponent, PopupMenuRadioItemComponent, PopupMenuRadioItemToken, PopupMenuSeparatorComponent } from '@nanahoshi/mona-ui/popup-menu';
|
|
8
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
9
8
|
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
10
9
|
import { fromEvent } from 'rxjs';
|
|
11
10
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -137,10 +136,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
137
136
|
}]
|
|
138
137
|
}] });
|
|
139
138
|
|
|
140
|
-
const
|
|
139
|
+
const splitButtonThemeVariants = cva(`
|
|
141
140
|
inline-flex flex-nowrap items-center
|
|
142
141
|
[&>button]:focus-visible:z-10
|
|
143
|
-
[&_svg]:
|
|
142
|
+
[&_svg]:h-5 [&_svg]:w-5
|
|
144
143
|
`, {
|
|
145
144
|
variants: {
|
|
146
145
|
look: {
|
|
@@ -148,7 +147,7 @@ const splitButtonVariants = cva(`
|
|
|
148
147
|
error: "",
|
|
149
148
|
ghost: "border-transparent",
|
|
150
149
|
info: "",
|
|
151
|
-
outline: "[&>button:not(:last-child)]:border-r",
|
|
150
|
+
outline: "[&>button:not(:last-child)]:border-r [&>button:not(:last-child)]:border-input-border",
|
|
152
151
|
primary: "",
|
|
153
152
|
secondary: "",
|
|
154
153
|
success: "",
|
|
@@ -181,13 +180,13 @@ const splitButtonVariants = cva(`
|
|
|
181
180
|
},
|
|
182
181
|
size: {
|
|
183
182
|
large: `
|
|
184
|
-
[&_svg]:
|
|
183
|
+
[&_svg]:h-5 [&_svg]:w-5
|
|
185
184
|
`,
|
|
186
185
|
medium: `
|
|
187
|
-
[&_svg]:
|
|
186
|
+
[&_svg]:h-5 [&_svg]:w-5
|
|
188
187
|
`,
|
|
189
188
|
small: `
|
|
190
|
-
[&_svg]:
|
|
189
|
+
[&_svg]:h-4 [&_svg]:w-4
|
|
191
190
|
`
|
|
192
191
|
}
|
|
193
192
|
},
|
|
@@ -198,32 +197,20 @@ const splitButtonVariants = cva(`
|
|
|
198
197
|
}
|
|
199
198
|
});
|
|
200
199
|
|
|
201
|
-
const splitButtonThemeVariants = (theme) => {
|
|
202
|
-
switch (theme) {
|
|
203
|
-
case "mona":
|
|
204
|
-
return splitButtonVariants;
|
|
205
|
-
default:
|
|
206
|
-
return splitButtonVariants; // Default to Mona styles
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
|
|
210
200
|
class SplitButtonComponent {
|
|
211
201
|
#destroyRef;
|
|
212
|
-
#themeService;
|
|
213
202
|
constructor() {
|
|
214
203
|
this.#destroyRef = inject(DestroyRef);
|
|
215
|
-
this.#themeService = inject(ThemeService);
|
|
216
204
|
this.menuItemComponents = contentChildren(PopupMenuToken, { ...(ngDevMode ? { debugName: "menuItemComponents" } : /* istanbul ignore next */ {}), descendants: false });
|
|
217
205
|
this.menuButtonRef = viewChild("menuButton", /* @ts-ignore */
|
|
218
206
|
...(ngDevMode ? [{ debugName: "menuButtonRef" }] : /* istanbul ignore next */ []));
|
|
219
207
|
this.popupMenuRef = viewChild("popupMenu", /* @ts-ignore */
|
|
220
208
|
...(ngDevMode ? [{ debugName: "popupMenuRef" }] : /* istanbul ignore next */ []));
|
|
221
209
|
this.classes = computed(() => {
|
|
222
|
-
const theme = this.#themeService.theme();
|
|
223
210
|
const look = this.look();
|
|
224
211
|
const rounded = this.rounded();
|
|
225
212
|
const size = this.size();
|
|
226
|
-
const classes = splitButtonThemeVariants(
|
|
213
|
+
const classes = splitButtonThemeVariants({
|
|
227
214
|
look,
|
|
228
215
|
rounded,
|
|
229
216
|
size
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { computed, input, Directive, model, viewChild, TemplateRef, Component,
|
|
3
|
+
import { computed, input, Directive, model, viewChild, TemplateRef, Component, output, inject, DestroyRef, ElementRef, signal, afterNextRender, afterRenderEffect, contentChildren } from '@angular/core';
|
|
4
4
|
import { where, compact, from } from '@mirei/ts-collections';
|
|
5
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
6
5
|
import { cva } from 'class-variance-authority';
|
|
7
6
|
import { v4 } from 'uuid';
|
|
8
7
|
import { Directionality } from '@angular/cdk/bidi';
|
|
@@ -105,8 +104,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
105
104
|
}]
|
|
106
105
|
}], propDecorators: { pane: [{ type: i0.Input, args: [{ isSignal: true, alias: "pane", required: true }] }], paneList: [{ type: i0.Input, args: [{ isSignal: true, alias: "paneList", required: true }] }] } });
|
|
107
106
|
|
|
108
|
-
const
|
|
109
|
-
flex
|
|
107
|
+
const splitterBaseThemeVariants = cva(`
|
|
108
|
+
flex h-full w-full min-h-0 min-w-0 overflow-hidden
|
|
110
109
|
`, {
|
|
111
110
|
variants: {
|
|
112
111
|
orientation: {
|
|
@@ -118,13 +117,13 @@ const splitterBaseVariants = cva(`
|
|
|
118
117
|
orientation: "horizontal"
|
|
119
118
|
}
|
|
120
119
|
});
|
|
121
|
-
const
|
|
122
|
-
flex items-center justify-center
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
active:bg-
|
|
126
|
-
|
|
127
|
-
focus-visible:
|
|
120
|
+
const splitterResizerThemeVariants = cva(`
|
|
121
|
+
relative flex shrink-0 items-center justify-center
|
|
122
|
+
bg-border-subtle outline-none
|
|
123
|
+
transition-colors
|
|
124
|
+
hover:bg-border-control active:bg-border-control-hover
|
|
125
|
+
focus-visible:bg-border-control
|
|
126
|
+
focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-indicator/35
|
|
128
127
|
`, {
|
|
129
128
|
variants: {
|
|
130
129
|
orientation: {
|
|
@@ -132,7 +131,7 @@ const splitterResizerVariants = cva(`
|
|
|
132
131
|
vertical: "h-0.5 flex-row"
|
|
133
132
|
},
|
|
134
133
|
resizing: {
|
|
135
|
-
true: "",
|
|
134
|
+
true: "bg-border-control-hover",
|
|
136
135
|
false: ""
|
|
137
136
|
}
|
|
138
137
|
},
|
|
@@ -141,7 +140,7 @@ const splitterResizerVariants = cva(`
|
|
|
141
140
|
resizing: false
|
|
142
141
|
}
|
|
143
142
|
});
|
|
144
|
-
const
|
|
143
|
+
const splitterResizerHandleThemeVariants = cva(`
|
|
145
144
|
flex items-center justify-center
|
|
146
145
|
[&_button]:p-0
|
|
147
146
|
`, {
|
|
@@ -156,31 +155,6 @@ const splitterResizerHandleVariants = cva(`
|
|
|
156
155
|
}
|
|
157
156
|
});
|
|
158
157
|
|
|
159
|
-
const splitterBaseThemeVariants = (theme) => {
|
|
160
|
-
switch (theme) {
|
|
161
|
-
case "mona":
|
|
162
|
-
return splitterBaseVariants;
|
|
163
|
-
default:
|
|
164
|
-
return splitterBaseVariants;
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
const splitterResizerThemeVariants = (theme) => {
|
|
168
|
-
switch (theme) {
|
|
169
|
-
case "mona":
|
|
170
|
-
return splitterResizerVariants;
|
|
171
|
-
default:
|
|
172
|
-
return splitterResizerVariants;
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
const splitterResizerHandleThemeVariants = (theme) => {
|
|
176
|
-
switch (theme) {
|
|
177
|
-
case "mona":
|
|
178
|
-
return splitterResizerHandleVariants;
|
|
179
|
-
default:
|
|
180
|
-
return splitterResizerHandleVariants;
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
158
|
class SplitterPaneComponent {
|
|
185
159
|
constructor() {
|
|
186
160
|
/**
|
|
@@ -238,11 +212,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
238
212
|
|
|
239
213
|
class SplitterResizerHandleComponent {
|
|
240
214
|
constructor() {
|
|
241
|
-
this.#themeService = inject(ThemeService);
|
|
242
215
|
this.baseClass = computed(() => {
|
|
243
|
-
const theme = this.#themeService.theme();
|
|
244
216
|
const orientation = this.orientation();
|
|
245
|
-
return splitterResizerHandleThemeVariants(
|
|
217
|
+
return splitterResizerHandleThemeVariants({ orientation });
|
|
246
218
|
}, /* @ts-ignore */
|
|
247
219
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
248
220
|
this.collapseNext = output();
|
|
@@ -256,7 +228,6 @@ class SplitterResizerHandleComponent {
|
|
|
256
228
|
this.resizable = input.required(/* @ts-ignore */
|
|
257
229
|
...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
|
|
258
230
|
}
|
|
259
|
-
#themeService;
|
|
260
231
|
onPointerDown(event) {
|
|
261
232
|
event.preventDefault();
|
|
262
233
|
event.stopPropagation();
|
|
@@ -277,14 +248,12 @@ class SplitterResizerComponent {
|
|
|
277
248
|
#hostElementRef;
|
|
278
249
|
#paneSizeMemory;
|
|
279
250
|
#splitter;
|
|
280
|
-
#themeService;
|
|
281
251
|
constructor() {
|
|
282
252
|
this.#destroyRef = inject(DestroyRef);
|
|
283
253
|
this.#directionality = inject(Directionality);
|
|
284
254
|
this.#hostElementRef = inject(ElementRef);
|
|
285
255
|
this.#paneSizeMemory = new WeakMap();
|
|
286
256
|
this.#splitter = inject(SplitterComponent);
|
|
287
|
-
this.#themeService = inject(ThemeService);
|
|
288
257
|
this.ariaValueMax = signal(0, /* @ts-ignore */
|
|
289
258
|
...(ngDevMode ? [{ debugName: "ariaValueMax" }] : /* istanbul ignore next */ []));
|
|
290
259
|
this.ariaValueMin = signal(0, /* @ts-ignore */
|
|
@@ -292,10 +261,9 @@ class SplitterResizerComponent {
|
|
|
292
261
|
this.ariaValueNow = signal(0, /* @ts-ignore */
|
|
293
262
|
...(ngDevMode ? [{ debugName: "ariaValueNow" }] : /* istanbul ignore next */ []));
|
|
294
263
|
this.baseClass = computed(() => {
|
|
295
|
-
const theme = this.#themeService.theme();
|
|
296
264
|
const orientation = this.orientation();
|
|
297
265
|
const resizing = this.resizing();
|
|
298
|
-
return splitterResizerThemeVariants(
|
|
266
|
+
return splitterResizerThemeVariants({ orientation, resizing });
|
|
299
267
|
}, /* @ts-ignore */
|
|
300
268
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
301
269
|
this.hovered = signal(false, /* @ts-ignore */
|
|
@@ -798,11 +766,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
798
766
|
|
|
799
767
|
class SplitterComponent {
|
|
800
768
|
constructor() {
|
|
801
|
-
this.#themeService = inject(ThemeService);
|
|
802
769
|
this.baseClass = computed(() => {
|
|
803
|
-
const theme = this.#themeService.theme();
|
|
804
770
|
const orientation = this.orientation();
|
|
805
|
-
return splitterBaseThemeVariants(
|
|
771
|
+
return splitterBaseThemeVariants({ orientation });
|
|
806
772
|
}, /* @ts-ignore */
|
|
807
773
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
808
774
|
this.paneList = contentChildren(SplitterPaneComponent, /* @ts-ignore */
|
|
@@ -814,7 +780,6 @@ class SplitterComponent {
|
|
|
814
780
|
this.orientation = input("horizontal", /* @ts-ignore */
|
|
815
781
|
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
816
782
|
}
|
|
817
|
-
#themeService;
|
|
818
783
|
/**
|
|
819
784
|
* @internal Used by SplitterResizerComponent to resolve sibling panes by id.
|
|
820
785
|
*/
|
|
@@ -3,7 +3,6 @@ import { Directive, inject, ElementRef, computed, input, afterRenderEffect, Dest
|
|
|
3
3
|
import { NgTemplateOutlet } from '@angular/common';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import { select } from '@mirei/ts-collections';
|
|
6
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
7
6
|
import { fromEvent } from 'rxjs';
|
|
8
7
|
import { cva } from 'class-variance-authority';
|
|
9
8
|
|
|
@@ -53,12 +52,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
53
52
|
}]
|
|
54
53
|
}] });
|
|
55
54
|
|
|
56
|
-
const
|
|
55
|
+
const stepperBaseThemeVariants = cva(`
|
|
57
56
|
relative grid outline-none
|
|
58
57
|
`, {
|
|
59
58
|
variants: {
|
|
60
59
|
orientation: {
|
|
61
|
-
horizontal: "w-full
|
|
60
|
+
horizontal: "h-auto w-full",
|
|
62
61
|
vertical: "h-full w-auto"
|
|
63
62
|
}
|
|
64
63
|
},
|
|
@@ -66,18 +65,18 @@ const stepperBaseVariants = cva(`
|
|
|
66
65
|
orientation: "horizontal"
|
|
67
66
|
}
|
|
68
67
|
});
|
|
69
|
-
const
|
|
70
|
-
absolute
|
|
71
|
-
font-medium
|
|
68
|
+
const stepperStepListThemeVariants = cva(`
|
|
69
|
+
absolute z-1 col-span-full flex list-none
|
|
70
|
+
font-medium
|
|
72
71
|
`, {
|
|
73
72
|
variants: {
|
|
74
73
|
orientation: {
|
|
75
74
|
horizontal: `
|
|
76
|
-
flex-row
|
|
75
|
+
w-full flex-row
|
|
77
76
|
-translate-y-3
|
|
78
77
|
`,
|
|
79
78
|
vertical: `
|
|
80
|
-
|
|
79
|
+
h-full w-max flex-col
|
|
81
80
|
-translate-x-3
|
|
82
81
|
`
|
|
83
82
|
}
|
|
@@ -86,35 +85,31 @@ const stepperStepListVariants = cva(`
|
|
|
86
85
|
orientation: "horizontal"
|
|
87
86
|
}
|
|
88
87
|
});
|
|
89
|
-
const
|
|
90
|
-
flex items-center
|
|
91
|
-
grow-1 shrink-0 basis-auto
|
|
92
|
-
z-1
|
|
88
|
+
const stepperStepListItemThemeVariants = cva(`
|
|
89
|
+
z-1 flex grow-1 shrink-0 basis-auto items-center
|
|
93
90
|
`, {
|
|
94
91
|
variants: {
|
|
95
92
|
orientation: {
|
|
96
93
|
horizontal: "flex-col gap-2",
|
|
97
|
-
vertical: "flex-row gap-2
|
|
94
|
+
vertical: "flex-row justify-start gap-2"
|
|
98
95
|
}
|
|
99
96
|
},
|
|
100
97
|
defaultVariants: {
|
|
101
98
|
orientation: "horizontal"
|
|
102
99
|
}
|
|
103
100
|
});
|
|
104
|
-
const
|
|
105
|
-
w-8
|
|
106
|
-
|
|
107
|
-
bg-background border border-border
|
|
108
|
-
text-foreground outline-none
|
|
101
|
+
const stepperStepIndicatorThemeVariants = cva(`
|
|
102
|
+
flex h-8 w-8 items-center justify-center
|
|
103
|
+
border border-border outline-none
|
|
109
104
|
transition-colors duration-400 ease-in-out
|
|
110
105
|
`, {
|
|
111
106
|
variants: {
|
|
112
107
|
active: {
|
|
113
108
|
true: "bg-primary text-primary-foreground",
|
|
114
|
-
false: ""
|
|
109
|
+
false: "bg-surface-raised text-foreground"
|
|
115
110
|
},
|
|
116
111
|
focused: {
|
|
117
|
-
true: "ring-2 ring-
|
|
112
|
+
true: "border-focus-indicator ring-2 ring-focus-indicator/35",
|
|
118
113
|
false: ""
|
|
119
114
|
},
|
|
120
115
|
rounded: {
|
|
@@ -126,13 +121,14 @@ const stepperStepIndicatorVariants = cva(`
|
|
|
126
121
|
}
|
|
127
122
|
}
|
|
128
123
|
});
|
|
129
|
-
const
|
|
124
|
+
const stepperTrackThemeVariants = cva(`
|
|
130
125
|
relative grid
|
|
131
|
-
bg-
|
|
126
|
+
bg-surface-muted text-foreground
|
|
127
|
+
border border-border-subtle
|
|
132
128
|
`, {
|
|
133
129
|
variants: {
|
|
134
130
|
orientation: {
|
|
135
|
-
horizontal: "w-full
|
|
131
|
+
horizontal: "h-2 w-full",
|
|
136
132
|
vertical: "h-full w-2"
|
|
137
133
|
}
|
|
138
134
|
},
|
|
@@ -140,13 +136,13 @@ const stepperTrackVariants = cva(`
|
|
|
140
136
|
orientation: "horizontal"
|
|
141
137
|
}
|
|
142
138
|
});
|
|
143
|
-
const
|
|
139
|
+
const stepperTrackLineThemeVariants = cva(`
|
|
144
140
|
absolute bg-primary
|
|
145
141
|
`, {
|
|
146
142
|
variants: {
|
|
147
143
|
orientation: {
|
|
148
|
-
horizontal: "h-full transition-width duration-
|
|
149
|
-
vertical: "w-full transition-height duration-
|
|
144
|
+
horizontal: "h-full transition-width duration-(--mona-motion-standard) ease-out",
|
|
145
|
+
vertical: "w-full transition-height duration-(--mona-motion-standard) ease-out"
|
|
150
146
|
}
|
|
151
147
|
},
|
|
152
148
|
defaultVariants: {
|
|
@@ -154,69 +150,17 @@ const stepperTrackLineVariants = cva(`
|
|
|
154
150
|
}
|
|
155
151
|
});
|
|
156
152
|
|
|
157
|
-
const stepperBaseThemeVariants = (theme) => {
|
|
158
|
-
switch (theme) {
|
|
159
|
-
case "mona":
|
|
160
|
-
return stepperBaseVariants;
|
|
161
|
-
default:
|
|
162
|
-
return stepperBaseVariants;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const stepperStepListThemeVariants = (theme) => {
|
|
166
|
-
switch (theme) {
|
|
167
|
-
case "mona":
|
|
168
|
-
return stepperStepListVariants;
|
|
169
|
-
default:
|
|
170
|
-
return stepperStepListVariants;
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
const stepperStepListItemThemeVariants = (theme) => {
|
|
174
|
-
switch (theme) {
|
|
175
|
-
case "mona":
|
|
176
|
-
return stepperStepListItemVariants;
|
|
177
|
-
default:
|
|
178
|
-
return stepperStepListItemVariants;
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
const stepperStepIndicatorThemeVariants = (theme) => {
|
|
182
|
-
switch (theme) {
|
|
183
|
-
case "mona":
|
|
184
|
-
return stepperStepIndicatorVariants;
|
|
185
|
-
default:
|
|
186
|
-
return stepperStepIndicatorVariants;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const stepperTrackThemeVariants = (theme) => {
|
|
190
|
-
switch (theme) {
|
|
191
|
-
case "mona":
|
|
192
|
-
return stepperTrackVariants;
|
|
193
|
-
default:
|
|
194
|
-
return stepperTrackVariants;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const stepperTrackLineThemeVariants = (theme) => {
|
|
198
|
-
switch (theme) {
|
|
199
|
-
case "mona":
|
|
200
|
-
return stepperTrackLineVariants;
|
|
201
|
-
default:
|
|
202
|
-
return stepperTrackLineVariants;
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
153
|
class StepperIndicatorDirective {
|
|
207
154
|
#wasFocused;
|
|
208
155
|
#host;
|
|
209
|
-
#themeService;
|
|
210
156
|
constructor() {
|
|
211
157
|
this.#wasFocused = false;
|
|
212
158
|
this.#host = inject(ElementRef);
|
|
213
|
-
this.#themeService = inject(ThemeService);
|
|
214
159
|
this.stepIndicatorClass = computed(() => {
|
|
215
|
-
const theme = this.#themeService.theme();
|
|
216
160
|
const active = this.active();
|
|
217
161
|
const focused = this.focused();
|
|
218
162
|
const rounded = this.rounded();
|
|
219
|
-
return stepperStepIndicatorThemeVariants(
|
|
163
|
+
return stepperStepIndicatorThemeVariants({ active, focused, rounded });
|
|
220
164
|
}, /* @ts-ignore */
|
|
221
165
|
...(ngDevMode ? [{ debugName: "stepIndicatorClass" }] : /* istanbul ignore next */ []));
|
|
222
166
|
this.active = input.required(/* @ts-ignore */
|
|
@@ -251,13 +195,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
251
195
|
class StepperComponent {
|
|
252
196
|
#destroyRef;
|
|
253
197
|
#hostElementRef;
|
|
254
|
-
#themeService;
|
|
255
198
|
#trackItemSize;
|
|
256
199
|
#trackLength;
|
|
257
200
|
constructor() {
|
|
258
201
|
this.#destroyRef = inject(DestroyRef);
|
|
259
202
|
this.#hostElementRef = inject(ElementRef);
|
|
260
|
-
this.#themeService = inject(ThemeService);
|
|
261
203
|
this.#trackItemSize = computed(() => {
|
|
262
204
|
const stepCount = this.viewSteps().length;
|
|
263
205
|
return stepCount !== 0 ? 100 / stepCount : 0;
|
|
@@ -280,9 +222,8 @@ class StepperComponent {
|
|
|
280
222
|
}, /* @ts-ignore */
|
|
281
223
|
...(ngDevMode ? [{ debugName: "activeStep" }] : /* istanbul ignore next */ []));
|
|
282
224
|
this.baseClass = computed(() => {
|
|
283
|
-
const theme = this.#themeService.theme();
|
|
284
225
|
const orientation = this.orientation();
|
|
285
|
-
return stepperBaseThemeVariants(
|
|
226
|
+
return stepperBaseThemeVariants({ orientation });
|
|
286
227
|
}, /* @ts-ignore */
|
|
287
228
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
288
229
|
this.highlightedStep = signal(0, /* @ts-ignore */
|
|
@@ -301,15 +242,13 @@ class StepperComponent {
|
|
|
301
242
|
});
|
|
302
243
|
this.labelTemplate = contentChild(StepperLabelTemplateDirective, { read: TemplateRef });
|
|
303
244
|
this.listClass = computed(() => {
|
|
304
|
-
const theme = this.#themeService.theme();
|
|
305
245
|
const orientation = this.orientation();
|
|
306
|
-
return stepperStepListThemeVariants(
|
|
246
|
+
return stepperStepListThemeVariants({ orientation });
|
|
307
247
|
}, /* @ts-ignore */
|
|
308
248
|
...(ngDevMode ? [{ debugName: "listClass" }] : /* istanbul ignore next */ []));
|
|
309
249
|
this.listItemClass = computed(() => {
|
|
310
|
-
const theme = this.#themeService.theme();
|
|
311
250
|
const orientation = this.orientation();
|
|
312
|
-
return stepperStepListItemThemeVariants(
|
|
251
|
+
return stepperStepListItemThemeVariants({ orientation });
|
|
313
252
|
}, /* @ts-ignore */
|
|
314
253
|
...(ngDevMode ? [{ debugName: "listItemClass" }] : /* istanbul ignore next */ []));
|
|
315
254
|
this.progressMax = computed(() => Math.max(this.viewSteps().length - 1, 0), /* @ts-ignore */
|
|
@@ -318,9 +257,8 @@ class StepperComponent {
|
|
|
318
257
|
read: TemplateRef
|
|
319
258
|
});
|
|
320
259
|
this.trackClass = computed(() => {
|
|
321
|
-
const theme = this.#themeService.theme();
|
|
322
260
|
const orientation = this.orientation();
|
|
323
|
-
return stepperTrackThemeVariants(
|
|
261
|
+
return stepperTrackThemeVariants({ orientation });
|
|
324
262
|
}, /* @ts-ignore */
|
|
325
263
|
...(ngDevMode ? [{ debugName: "trackClass" }] : /* istanbul ignore next */ []));
|
|
326
264
|
this.trackInnerStyles = computed(() => {
|
|
@@ -340,9 +278,8 @@ class StepperComponent {
|
|
|
340
278
|
}, /* @ts-ignore */
|
|
341
279
|
...(ngDevMode ? [{ debugName: "trackItemStyles" }] : /* istanbul ignore next */ []));
|
|
342
280
|
this.trackLineClass = computed(() => {
|
|
343
|
-
const theme = this.#themeService.theme();
|
|
344
281
|
const orientation = this.orientation();
|
|
345
|
-
return stepperTrackLineThemeVariants(
|
|
282
|
+
return stepperTrackLineThemeVariants({ orientation });
|
|
346
283
|
}, /* @ts-ignore */
|
|
347
284
|
...(ngDevMode ? [{ debugName: "trackLineClass" }] : /* istanbul ignore next */ []));
|
|
348
285
|
this.trackStyles = computed(() => {
|
|
@@ -2,10 +2,10 @@ import { NgTemplateOutlet } from '@angular/common';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Directive, inject, DestroyRef, ElementRef, computed, contentChild, TemplateRef, input, model, output, afterNextRender, Component } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
6
5
|
import { fromEvent, filter, tap, merge } from 'rxjs';
|
|
7
6
|
import { twMerge } from 'tailwind-merge';
|
|
8
7
|
import { cva } from 'class-variance-authority';
|
|
8
|
+
import { themeControlSurfaceClasses, themeRaisedSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
9
9
|
|
|
10
10
|
class SwitchHandleContentTemplateDirective {
|
|
11
11
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: SwitchHandleContentTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
@@ -40,26 +40,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
40
40
|
}]
|
|
41
41
|
}] });
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
relative flex items-center
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
bg-input-background
|
|
43
|
+
const switchThemeVariants = cva(`
|
|
44
|
+
group relative flex items-center
|
|
45
|
+
cursor-pointer select-none
|
|
46
|
+
${themeControlSurfaceClasses}
|
|
48
47
|
border border-input-border
|
|
49
48
|
outline-none
|
|
50
|
-
|
|
51
|
-
focus-within:ring-2 focus-within:ring-primary/40
|
|
49
|
+
transition-[background,border-color]
|
|
52
50
|
|
|
53
51
|
data-[disabled='true']:pointer-events-none
|
|
54
|
-
data-[disabled='true']:
|
|
52
|
+
data-[disabled='true']:cursor-not-allowed
|
|
53
|
+
data-[disabled='true']:border-disabled-border
|
|
54
|
+
data-[disabled='true']:bg-disabled-background
|
|
55
|
+
data-[disabled='true']:text-disabled-foreground
|
|
55
56
|
|
|
56
57
|
data-[active='true']:bg-primary
|
|
57
58
|
data-[active='true']:text-primary-foreground
|
|
59
|
+
data-[disabled='true']:data-[active='true']:bg-disabled-background
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
focus-visible:border-focus-indicator
|
|
62
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
60
63
|
|
|
64
|
+
[&.ng-touched.ng-invalid]:border-error
|
|
61
65
|
data-[invalid='true']:border-error
|
|
62
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/
|
|
66
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
67
|
+
data-[invalid='true']:focus-visible:border-error
|
|
68
|
+
data-[invalid='true']:focus-visible:ring-error/35
|
|
63
69
|
`, {
|
|
64
70
|
variants: {
|
|
65
71
|
rounded: {
|
|
@@ -70,18 +76,21 @@ const switchVariants = cva(`
|
|
|
70
76
|
small: "rounded-sm"
|
|
71
77
|
},
|
|
72
78
|
size: {
|
|
73
|
-
large: "
|
|
74
|
-
medium: "
|
|
75
|
-
small: "
|
|
79
|
+
large: "h-7.5 w-14 text-md",
|
|
80
|
+
medium: "h-6.5 w-12 text-sm",
|
|
81
|
+
small: "h-5.5 w-10 text-xs"
|
|
76
82
|
}
|
|
77
83
|
}
|
|
78
84
|
});
|
|
79
|
-
const
|
|
80
|
-
absolute inline-flex
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
const switchHandleThemeVariants = cva(`
|
|
86
|
+
absolute inline-flex items-center justify-center
|
|
87
|
+
${themeRaisedSurfaceClasses} text-foreground
|
|
88
|
+
border border-border-subtle shadow-(--shadow-control)
|
|
89
|
+
outline-none
|
|
90
|
+
transition-[left,background] duration-(--mona-motion-standard) ease-in-out
|
|
91
|
+
data-[active='true']:bg-primary-foreground
|
|
92
|
+
group-data-[disabled='true']:border-disabled-border
|
|
93
|
+
group-data-[disabled='true']:bg-disabled-background
|
|
85
94
|
`, {
|
|
86
95
|
variants: {
|
|
87
96
|
rounded: {
|
|
@@ -93,82 +102,52 @@ const switchHandleVariants = cva(`
|
|
|
93
102
|
},
|
|
94
103
|
size: {
|
|
95
104
|
large: `
|
|
96
|
-
|
|
105
|
+
h-6 w-6
|
|
97
106
|
data-[active='true']:left-[calc(100%-26px)]
|
|
98
107
|
data-[active='false']:left-0.5
|
|
99
108
|
`,
|
|
100
109
|
medium: `
|
|
101
|
-
|
|
110
|
+
h-5 w-5
|
|
102
111
|
data-[active='true']:left-[calc(100%-22px)]
|
|
103
112
|
data-[active='false']:left-0.5
|
|
104
113
|
`,
|
|
105
114
|
small: `
|
|
106
|
-
|
|
115
|
+
h-4 w-4
|
|
107
116
|
data-[active='true']:left-[calc(100%-18px)]
|
|
108
117
|
data-[active='false']:left-0.5
|
|
109
118
|
`
|
|
110
119
|
}
|
|
111
120
|
}
|
|
112
121
|
});
|
|
113
|
-
const
|
|
114
|
-
h-full flex
|
|
122
|
+
const switchLabelThemeVariants = cva(`
|
|
123
|
+
flex h-full flex-1 items-center justify-center text-xs
|
|
115
124
|
`);
|
|
116
125
|
|
|
117
|
-
const switchThemeVariants = (theme) => {
|
|
118
|
-
switch (theme) {
|
|
119
|
-
case "mona":
|
|
120
|
-
return switchVariants;
|
|
121
|
-
default:
|
|
122
|
-
return switchVariants; // Default to Mona styles
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const switchHandleThemeVariants = (theme) => {
|
|
126
|
-
switch (theme) {
|
|
127
|
-
case "mona":
|
|
128
|
-
return switchHandleVariants;
|
|
129
|
-
default:
|
|
130
|
-
return switchHandleVariants; // Default to Mona styles
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const switchLabelThemeVariants = (theme) => {
|
|
134
|
-
switch (theme) {
|
|
135
|
-
case "mona":
|
|
136
|
-
return switchLabelVariants;
|
|
137
|
-
default:
|
|
138
|
-
return switchLabelVariants; // Default to Mona styles
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|
|
142
126
|
class SwitchComponent {
|
|
143
127
|
#destroyRef;
|
|
144
128
|
#hostElementRef;
|
|
145
|
-
#themeService;
|
|
146
129
|
constructor() {
|
|
147
130
|
this.#destroyRef = inject(DestroyRef);
|
|
148
131
|
this.#hostElementRef = inject((ElementRef));
|
|
149
|
-
this.#themeService = inject(ThemeService);
|
|
150
132
|
this.classes = computed(() => {
|
|
151
|
-
const theme = this.#themeService.theme();
|
|
152
133
|
const rounded = this.rounded();
|
|
153
134
|
const size = this.size();
|
|
154
|
-
const classes = switchThemeVariants(
|
|
135
|
+
const classes = switchThemeVariants({ rounded, size });
|
|
155
136
|
return twMerge(classes, this.userClass());
|
|
156
137
|
}, /* @ts-ignore */
|
|
157
138
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
158
139
|
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && !this.checked()), /* @ts-ignore */
|
|
159
140
|
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
160
141
|
this.handleClasses = computed(() => {
|
|
161
|
-
const theme = this.#themeService.theme();
|
|
162
142
|
const rounded = this.rounded();
|
|
163
143
|
const size = this.size();
|
|
164
|
-
const classes = switchHandleThemeVariants(
|
|
144
|
+
const classes = switchHandleThemeVariants({ rounded, size });
|
|
165
145
|
return twMerge(classes);
|
|
166
146
|
}, /* @ts-ignore */
|
|
167
147
|
...(ngDevMode ? [{ debugName: "handleClasses" }] : /* istanbul ignore next */ []));
|
|
168
148
|
this.handleContentTemplate = contentChild(SwitchHandleContentTemplateDirective, { ...(ngDevMode ? { debugName: "handleContentTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
169
149
|
this.labelClasses = computed(() => {
|
|
170
|
-
const
|
|
171
|
-
const classes = switchLabelThemeVariants(theme)();
|
|
150
|
+
const classes = switchLabelThemeVariants();
|
|
172
151
|
return twMerge(classes);
|
|
173
152
|
}, /* @ts-ignore */
|
|
174
153
|
...(ngDevMode ? [{ debugName: "labelClasses" }] : /* istanbul ignore next */ []));
|