@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
|
@@ -2,31 +2,32 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { inject, DestroyRef, computed, contentChildren, input, model, effect, untracked, afterNextRender, Component } from '@angular/core';
|
|
3
3
|
import { outputFromObservable, takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { ButtonService, ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
5
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
6
5
|
import { map, pairwise } from 'rxjs';
|
|
7
6
|
import { twMerge } from 'tailwind-merge';
|
|
8
7
|
import { cva } from 'class-variance-authority';
|
|
9
8
|
|
|
10
|
-
const
|
|
9
|
+
const buttonGroupThemeVariants = cva(`
|
|
11
10
|
inline-flex items-center justify-center
|
|
12
|
-
border border-border
|
|
11
|
+
border border-input-border
|
|
13
12
|
[&>button]:border-0
|
|
13
|
+
[&>button]:shadow-none
|
|
14
|
+
[&>button:not(:last-child)]:border-r
|
|
15
|
+
[&>button:not(:last-child)]:border-border-subtle
|
|
16
|
+
[&>button]:rounded-none
|
|
14
17
|
[&>button]:focus-visible:ring-2
|
|
15
18
|
[&>button]:focus-visible:z-10
|
|
16
|
-
[&>button]:rounded-none
|
|
17
|
-
[&>button]:shadow-none
|
|
18
19
|
`, {
|
|
19
20
|
variants: {
|
|
20
21
|
look: {
|
|
21
22
|
default: "",
|
|
22
|
-
error: "",
|
|
23
|
-
ghost: "border-transparent",
|
|
24
|
-
info: "",
|
|
25
|
-
outline: "
|
|
26
|
-
primary: "",
|
|
27
|
-
secondary: "",
|
|
28
|
-
success: "",
|
|
29
|
-
warning: ""
|
|
23
|
+
error: "border-transparent",
|
|
24
|
+
ghost: "border-transparent [&>button:not(:last-child)]:border-r-0",
|
|
25
|
+
info: "border-transparent",
|
|
26
|
+
outline: "",
|
|
27
|
+
primary: "border-transparent",
|
|
28
|
+
secondary: "border-transparent",
|
|
29
|
+
success: "border-transparent",
|
|
30
|
+
warning: "border-transparent"
|
|
30
31
|
},
|
|
31
32
|
rounded: {
|
|
32
33
|
full: `
|
|
@@ -65,29 +66,17 @@ const buttonGroupVariants = cva(`
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
|
|
68
|
-
const buttonGroupThemeVariants = (theme) => {
|
|
69
|
-
switch (theme) {
|
|
70
|
-
case "mona":
|
|
71
|
-
return buttonGroupVariants;
|
|
72
|
-
default:
|
|
73
|
-
return buttonGroupVariants;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
69
|
class ButtonGroupComponent {
|
|
78
70
|
#buttonService;
|
|
79
71
|
#destroyRef;
|
|
80
|
-
#themeService;
|
|
81
72
|
constructor() {
|
|
82
73
|
this.#buttonService = inject(ButtonService, { self: true });
|
|
83
74
|
this.#destroyRef = inject(DestroyRef);
|
|
84
|
-
this.#themeService = inject(ThemeService);
|
|
85
75
|
this.baseClass = computed(() => {
|
|
86
|
-
const theme = this.#themeService.theme();
|
|
87
76
|
const look = this.look();
|
|
88
77
|
const rounded = this.rounded();
|
|
89
78
|
const size = this.size();
|
|
90
|
-
const variantClasses = buttonGroupThemeVariants(
|
|
79
|
+
const variantClasses = buttonGroupThemeVariants({ look, rounded, size });
|
|
91
80
|
const userClass = this.userClass();
|
|
92
81
|
return twMerge(variantClasses, userClass);
|
|
93
82
|
}, /* @ts-ignore */
|
|
@@ -2,10 +2,10 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { signal, Injectable, inject, ApplicationRef, DestroyRef, ElementRef, Injector, Renderer2, computed, input, model, effect, untracked, afterNextRender, createComponent, Directive } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
5
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
6
5
|
import { Subject, fromEvent, takeWhile } from 'rxjs';
|
|
7
6
|
import { twMerge } from 'tailwind-merge';
|
|
8
7
|
import { cva } from 'class-variance-authority';
|
|
8
|
+
import { themeControlSurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
9
9
|
|
|
10
10
|
class ButtonService {
|
|
11
11
|
constructor() {
|
|
@@ -27,16 +27,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
27
27
|
type: Injectable
|
|
28
28
|
}] });
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const buttonThemeVariants = cva(`
|
|
31
31
|
inline-flex items-center justify-center gap-2
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
cursor-pointer whitespace-nowrap
|
|
33
|
+
text-sm font-medium
|
|
34
|
+
outline-none
|
|
35
35
|
transition-colors duration-100 ease-in-out
|
|
36
36
|
`, {
|
|
37
37
|
variants: {
|
|
38
38
|
disabled: {
|
|
39
|
-
true:
|
|
39
|
+
true: `
|
|
40
|
+
pointer-events-none cursor-not-allowed select-none
|
|
41
|
+
disabled:border-disabled-border disabled:bg-disabled-background disabled:text-disabled-foreground
|
|
42
|
+
disabled:shadow-none
|
|
43
|
+
`,
|
|
40
44
|
false: ""
|
|
41
45
|
},
|
|
42
46
|
iconOnly: {
|
|
@@ -49,67 +53,69 @@ const buttonVariants = cva(`
|
|
|
49
53
|
},
|
|
50
54
|
look: {
|
|
51
55
|
default: `
|
|
52
|
-
|
|
56
|
+
${themeControlSurfaceClasses} text-foreground
|
|
53
57
|
border border-input-border
|
|
54
58
|
hover:bg-hover active:bg-active
|
|
55
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
59
|
+
focus-visible:border-focus-indicator focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
56
60
|
`,
|
|
57
61
|
primary: `
|
|
58
62
|
bg-primary text-primary-foreground
|
|
59
63
|
hover:bg-primary-hover active:bg-primary-active
|
|
60
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
64
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
61
65
|
`,
|
|
62
66
|
success: `
|
|
63
67
|
bg-success text-success-foreground
|
|
64
68
|
hover:bg-success-hover
|
|
65
69
|
active:bg-success-active
|
|
66
|
-
focus-visible:ring-2 focus-visible:ring-success/
|
|
70
|
+
focus-visible:ring-2 focus-visible:ring-success/35
|
|
67
71
|
`,
|
|
68
72
|
error: `
|
|
69
73
|
bg-error text-error-foreground
|
|
70
74
|
hover:bg-error-hover
|
|
71
75
|
active:bg-error-active
|
|
72
|
-
focus-visible:ring-2 focus-visible:ring-error/
|
|
76
|
+
focus-visible:ring-2 focus-visible:ring-error/35
|
|
73
77
|
`,
|
|
74
78
|
warning: `
|
|
75
79
|
bg-warning text-warning-foreground
|
|
76
80
|
hover:bg-warning-hover
|
|
77
81
|
active:bg-warning-active
|
|
78
|
-
focus-visible:ring-2 focus-visible:ring-warning/
|
|
82
|
+
focus-visible:ring-2 focus-visible:ring-warning/35
|
|
79
83
|
`,
|
|
80
84
|
info: `
|
|
81
85
|
bg-info text-info-foreground
|
|
82
86
|
hover:bg-info-hover
|
|
83
87
|
active:bg-info-active
|
|
84
|
-
focus-visible:ring-2 focus-visible:ring-info/
|
|
88
|
+
focus-visible:ring-2 focus-visible:ring-info/35
|
|
85
89
|
`,
|
|
86
90
|
outline: `
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
active:bg-
|
|
90
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
91
|
+
${themeControlSurfaceClasses} text-foreground
|
|
92
|
+
border border-input-border
|
|
93
|
+
hover:bg-hover active:bg-active
|
|
94
|
+
focus-visible:border-focus-indicator focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
91
95
|
`,
|
|
92
96
|
secondary: `
|
|
93
97
|
bg-secondary text-secondary-foreground
|
|
94
98
|
hover:bg-secondary-hover
|
|
95
99
|
active:bg-secondary-active
|
|
96
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
100
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
97
101
|
`,
|
|
98
102
|
ghost: `
|
|
103
|
+
bg-transparent text-foreground
|
|
99
104
|
shadow-none
|
|
100
|
-
hover:bg-
|
|
101
|
-
|
|
102
|
-
focus-visible:ring-2 focus-visible:ring-primary/40
|
|
105
|
+
hover:bg-hover active:bg-active
|
|
106
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
103
107
|
`,
|
|
104
108
|
link: `
|
|
109
|
+
bg-transparent text-foreground
|
|
105
110
|
shadow-none
|
|
106
111
|
underline-offset-4 hover:underline
|
|
107
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
112
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
108
113
|
`,
|
|
109
114
|
clear: `
|
|
110
|
-
bg-transparent
|
|
115
|
+
bg-transparent
|
|
116
|
+
border-0 shadow-none
|
|
111
117
|
hover:bg-transparent active:bg-transparent
|
|
112
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
118
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
113
119
|
`
|
|
114
120
|
},
|
|
115
121
|
rounded: {
|
|
@@ -120,12 +126,12 @@ const buttonVariants = cva(`
|
|
|
120
126
|
small: "rounded-sm"
|
|
121
127
|
},
|
|
122
128
|
size: {
|
|
123
|
-
large: "px-6
|
|
124
|
-
medium: "px-4
|
|
125
|
-
small: "px-3 text-xs
|
|
129
|
+
large: "h-10 px-6",
|
|
130
|
+
medium: "h-9 px-4",
|
|
131
|
+
small: "h-8 px-3 text-xs"
|
|
126
132
|
},
|
|
127
133
|
selected: {
|
|
128
|
-
true: "
|
|
134
|
+
true: ""
|
|
129
135
|
}
|
|
130
136
|
},
|
|
131
137
|
compoundVariants: [
|
|
@@ -133,9 +139,9 @@ const buttonVariants = cva(`
|
|
|
133
139
|
look: "default",
|
|
134
140
|
selected: true,
|
|
135
141
|
class: `
|
|
136
|
-
bg-selected text-foreground
|
|
137
|
-
|
|
138
|
-
active:bg-selected
|
|
142
|
+
bg-(--color-selected) text-(--color-selected-foreground)
|
|
143
|
+
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
144
|
+
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
139
145
|
`
|
|
140
146
|
},
|
|
141
147
|
{
|
|
@@ -143,8 +149,8 @@ const buttonVariants = cva(`
|
|
|
143
149
|
selected: true,
|
|
144
150
|
class: `
|
|
145
151
|
bg-primary-selected text-primary-foreground
|
|
146
|
-
hover:bg-primary-selected
|
|
147
|
-
active:bg-primary-
|
|
152
|
+
hover:bg-primary-selected hover:text-primary-foreground
|
|
153
|
+
active:bg-primary-active active:text-primary-foreground
|
|
148
154
|
`
|
|
149
155
|
},
|
|
150
156
|
{
|
|
@@ -152,8 +158,8 @@ const buttonVariants = cva(`
|
|
|
152
158
|
selected: true,
|
|
153
159
|
class: `
|
|
154
160
|
bg-secondary-selected text-secondary-foreground
|
|
155
|
-
hover:bg-secondary-selected
|
|
156
|
-
active:bg-secondary-
|
|
161
|
+
hover:bg-secondary-selected hover:text-secondary-foreground
|
|
162
|
+
active:bg-secondary-active active:text-secondary-foreground
|
|
157
163
|
`
|
|
158
164
|
},
|
|
159
165
|
{
|
|
@@ -161,8 +167,8 @@ const buttonVariants = cva(`
|
|
|
161
167
|
selected: true,
|
|
162
168
|
class: `
|
|
163
169
|
bg-success-selected text-success-foreground
|
|
164
|
-
hover:bg-success-selected
|
|
165
|
-
active:bg-success-
|
|
170
|
+
hover:bg-success-selected hover:text-success-foreground
|
|
171
|
+
active:bg-success-active active:text-success-foreground
|
|
166
172
|
`
|
|
167
173
|
},
|
|
168
174
|
{
|
|
@@ -170,8 +176,8 @@ const buttonVariants = cva(`
|
|
|
170
176
|
selected: true,
|
|
171
177
|
class: `
|
|
172
178
|
bg-error-selected text-error-foreground
|
|
173
|
-
hover:bg-error-selected
|
|
174
|
-
active:bg-error-
|
|
179
|
+
hover:bg-error-selected hover:text-error-foreground
|
|
180
|
+
active:bg-error-active active:text-error-foreground
|
|
175
181
|
`
|
|
176
182
|
},
|
|
177
183
|
{
|
|
@@ -179,8 +185,8 @@ const buttonVariants = cva(`
|
|
|
179
185
|
selected: true,
|
|
180
186
|
class: `
|
|
181
187
|
bg-warning-selected text-warning-foreground
|
|
182
|
-
hover:bg-warning-selected
|
|
183
|
-
active:bg-warning-
|
|
188
|
+
hover:bg-warning-selected hover:text-warning-foreground
|
|
189
|
+
active:bg-warning-active active:text-warning-foreground
|
|
184
190
|
`
|
|
185
191
|
},
|
|
186
192
|
{
|
|
@@ -188,35 +194,35 @@ const buttonVariants = cva(`
|
|
|
188
194
|
selected: true,
|
|
189
195
|
class: `
|
|
190
196
|
bg-info-selected text-info-foreground
|
|
191
|
-
hover:bg-info-selected
|
|
192
|
-
active:bg-info-
|
|
197
|
+
hover:bg-info-selected hover:text-info-foreground
|
|
198
|
+
active:bg-info-active active:text-info-foreground
|
|
193
199
|
`
|
|
194
200
|
},
|
|
195
201
|
{
|
|
196
202
|
look: "outline",
|
|
197
203
|
selected: true,
|
|
198
204
|
class: `
|
|
199
|
-
bg-
|
|
200
|
-
hover:bg-
|
|
201
|
-
active:bg-
|
|
205
|
+
bg-(--color-selected) text-(--color-selected-foreground)
|
|
206
|
+
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
207
|
+
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
202
208
|
`
|
|
203
209
|
},
|
|
204
210
|
{
|
|
205
211
|
look: "ghost",
|
|
206
212
|
selected: true,
|
|
207
213
|
class: `
|
|
208
|
-
bg-
|
|
209
|
-
hover:bg-
|
|
210
|
-
active:bg-
|
|
214
|
+
bg-(--color-selected) text-(--color-selected-foreground)
|
|
215
|
+
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
216
|
+
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
211
217
|
`
|
|
212
218
|
},
|
|
213
219
|
{
|
|
214
220
|
look: "link",
|
|
215
221
|
selected: true,
|
|
216
222
|
class: `
|
|
217
|
-
bg-
|
|
218
|
-
hover:bg-
|
|
219
|
-
active:bg-
|
|
223
|
+
bg-(--color-selected) text-(--color-selected-foreground)
|
|
224
|
+
hover:bg-(--color-selected-hover) hover:text-(--color-selected-hover-foreground)
|
|
225
|
+
active:bg-(--color-selected-active) active:text-(--color-selected-active-foreground)
|
|
220
226
|
`
|
|
221
227
|
},
|
|
222
228
|
{
|
|
@@ -227,23 +233,28 @@ const buttonVariants = cva(`
|
|
|
227
233
|
hover:bg-transparent active:bg-transparent
|
|
228
234
|
`
|
|
229
235
|
},
|
|
236
|
+
{
|
|
237
|
+
disabled: true,
|
|
238
|
+
look: "ghost",
|
|
239
|
+
class: "disabled:bg-transparent disabled:text-disabled-foreground"
|
|
240
|
+
},
|
|
230
241
|
{
|
|
231
242
|
iconOnly: true,
|
|
232
243
|
loading: false,
|
|
233
244
|
size: "small",
|
|
234
|
-
class: "
|
|
245
|
+
class: "h-8 w-8 p-0"
|
|
235
246
|
},
|
|
236
247
|
{
|
|
237
248
|
iconOnly: true,
|
|
238
249
|
loading: false,
|
|
239
250
|
size: "medium",
|
|
240
|
-
class: "
|
|
251
|
+
class: "h-9 w-9 p-0"
|
|
241
252
|
},
|
|
242
253
|
{
|
|
243
254
|
iconOnly: true,
|
|
244
255
|
loading: false,
|
|
245
256
|
size: "large",
|
|
246
|
-
class: "
|
|
257
|
+
class: "h-10 w-10 p-0"
|
|
247
258
|
}
|
|
248
259
|
],
|
|
249
260
|
defaultVariants: {
|
|
@@ -253,15 +264,6 @@ const buttonVariants = cva(`
|
|
|
253
264
|
}
|
|
254
265
|
});
|
|
255
266
|
|
|
256
|
-
const buttonThemeVariants = (theme) => {
|
|
257
|
-
switch (theme) {
|
|
258
|
-
case "mona":
|
|
259
|
-
return buttonVariants;
|
|
260
|
-
default:
|
|
261
|
-
return buttonVariants;
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
|
|
265
267
|
class ButtonDirective {
|
|
266
268
|
#appRef;
|
|
267
269
|
#buttonService;
|
|
@@ -269,7 +271,6 @@ class ButtonDirective {
|
|
|
269
271
|
#hostElementRef;
|
|
270
272
|
#injector;
|
|
271
273
|
#renderer;
|
|
272
|
-
#themeService;
|
|
273
274
|
#loaderComponentRef;
|
|
274
275
|
#toggleSubscription;
|
|
275
276
|
constructor() {
|
|
@@ -279,7 +280,6 @@ class ButtonDirective {
|
|
|
279
280
|
this.#hostElementRef = inject(ElementRef);
|
|
280
281
|
this.#injector = inject(Injector);
|
|
281
282
|
this.#renderer = inject(Renderer2);
|
|
282
|
-
this.#themeService = inject(ThemeService);
|
|
283
283
|
this.#loaderComponentRef = null;
|
|
284
284
|
this.#toggleSubscription = null;
|
|
285
285
|
this.displaysPressedState = computed(() => this.isInButtonGroup() || !!this.toggleable(), /* @ts-ignore */
|
|
@@ -305,8 +305,7 @@ class ButtonDirective {
|
|
|
305
305
|
const size = this.effectiveSize();
|
|
306
306
|
const selected = this.selected();
|
|
307
307
|
const userClass = this.userClass();
|
|
308
|
-
const
|
|
309
|
-
const variants = buttonThemeVariants(theme);
|
|
308
|
+
const variants = buttonThemeVariants;
|
|
310
309
|
const variantClasses = variants({ disabled, iconOnly, loading, look, rounded, selected, size });
|
|
311
310
|
return twMerge(variantClasses, userClass);
|
|
312
311
|
}, /* @ts-ignore */
|