@nanahoshi/mona-ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +40 -55
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +24 -58
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +37 -48
- package/fesm2022/nanahoshi-mona-ui-button.mjs +130 -129
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +69 -165
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +81 -128
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +102 -112
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +11 -25
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +41 -92
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +27 -49
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +64 -65
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +39 -61
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +12 -15
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +44 -33
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +58 -60
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +52 -165
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +36 -59
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +56 -61
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +302 -81
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +33 -84
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +12 -45
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +18 -48
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B9SQH5N-.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +14 -14
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DlLwcCFT.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs +121 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-DIUutx9s.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +26 -55
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs +231 -0
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-C3eZIaJK.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +167 -451
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +57 -87
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +48 -139
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +10 -32
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +8 -21
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +50 -156
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +40 -69
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +32 -116
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +81 -107
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +33 -85
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +12 -34
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +31 -52
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +38 -110
- package/fesm2022/nanahoshi-mona-ui-popup.mjs +4 -4
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +21 -62
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +66 -111
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +60 -151
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +117 -173
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +32 -45
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +29 -64
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +38 -101
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +58 -79
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +42 -118
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +29 -37
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +60 -81
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +45 -39
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +45 -109
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +54 -82
- package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +2 -2
- package/fesm2022/nanahoshi-mona-ui-window.mjs +35 -115
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +31 -5
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +6 -6
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +6 -9
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -8
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +7 -8
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-editor.d.ts +17 -17
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +3 -4
- package/types/nanahoshi-mona-ui-grid.d.ts +16 -17
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal-tree.d.ts +16 -16
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +7 -8
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +8 -11
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +13 -14
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +15 -17
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +4 -6
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +10 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-grid-grid-list.component-Dgea-O0X.mjs +0 -130
- package/fesm2022/nanahoshi-mona-ui-grid-grid-virtual-list.component-DRHycGIh.mjs +0 -240
|
@@ -2,55 +2,56 @@ 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
|
|
11
|
-
inline-flex items-center justify-center
|
|
12
|
-
border border-border
|
|
13
|
-
[&>button]:border-0
|
|
14
|
-
[&>button]:
|
|
15
|
-
[&>button
|
|
16
|
-
[&>button]:
|
|
17
|
-
[&>button]:
|
|
9
|
+
const buttonGroupThemeVariants = cva(`
|
|
10
|
+
inline-flex items-center justify-center
|
|
11
|
+
border border-input-border
|
|
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
|
|
17
|
+
[&>button]:focus-visible:ring-2
|
|
18
|
+
[&>button]:focus-visible:z-10
|
|
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
|
-
full: `
|
|
33
|
-
rounded-full
|
|
34
|
-
[&>button]:first:rounded-ss-full [&>button]:first:rounded-es-full
|
|
35
|
-
[&>button]:last:rounded-se-full [&>button]:last:rounded-ee-full
|
|
33
|
+
full: `
|
|
34
|
+
rounded-full
|
|
35
|
+
[&>button]:first:rounded-ss-full [&>button]:first:rounded-es-full
|
|
36
|
+
[&>button]:last:rounded-se-full [&>button]:last:rounded-ee-full
|
|
36
37
|
`,
|
|
37
|
-
large: `
|
|
38
|
-
rounded-lg
|
|
39
|
-
[&>button]:first:rounded-ss-lg [&>button]:first:rounded-es-lg
|
|
40
|
-
[&>button]:last:rounded-se-lg [&>button]:last:rounded-ee-lg
|
|
38
|
+
large: `
|
|
39
|
+
rounded-lg
|
|
40
|
+
[&>button]:first:rounded-ss-lg [&>button]:first:rounded-es-lg
|
|
41
|
+
[&>button]:last:rounded-se-lg [&>button]:last:rounded-ee-lg
|
|
41
42
|
`,
|
|
42
|
-
medium: `
|
|
43
|
-
rounded-md
|
|
44
|
-
[&>button]:first:rounded-ss-md [&>button]:first:rounded-es-md
|
|
45
|
-
[&>button]:last:rounded-se-md [&>button]:last:rounded-ee-md
|
|
43
|
+
medium: `
|
|
44
|
+
rounded-md
|
|
45
|
+
[&>button]:first:rounded-ss-md [&>button]:first:rounded-es-md
|
|
46
|
+
[&>button]:last:rounded-se-md [&>button]:last:rounded-ee-md
|
|
46
47
|
`,
|
|
47
|
-
none: `
|
|
48
|
-
rounded-none
|
|
48
|
+
none: `
|
|
49
|
+
rounded-none
|
|
49
50
|
`,
|
|
50
|
-
small: `
|
|
51
|
-
rounded-sm
|
|
52
|
-
[&>button]:first:rounded-ss-sm [&>button]:first:rounded-es-sm
|
|
53
|
-
[&>button]:last:rounded-se-sm [&>button]:last:rounded-ee-sm
|
|
51
|
+
small: `
|
|
52
|
+
rounded-sm
|
|
53
|
+
[&>button]:first:rounded-ss-sm [&>button]:first:rounded-es-sm
|
|
54
|
+
[&>button]:last:rounded-se-sm [&>button]:last:rounded-ee-sm
|
|
54
55
|
`
|
|
55
56
|
},
|
|
56
57
|
size: {
|
|
@@ -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
|
|
31
|
-
inline-flex items-center justify-center gap-2
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
transition-colors duration-100 ease-in-out
|
|
30
|
+
const buttonThemeVariants = cva(`
|
|
31
|
+
inline-flex items-center justify-center gap-2
|
|
32
|
+
cursor-pointer whitespace-nowrap
|
|
33
|
+
text-sm font-medium
|
|
34
|
+
outline-none
|
|
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: {
|
|
@@ -48,68 +52,70 @@ const buttonVariants = cva(`
|
|
|
48
52
|
false: ""
|
|
49
53
|
},
|
|
50
54
|
look: {
|
|
51
|
-
default: `
|
|
52
|
-
|
|
53
|
-
border border-input-border
|
|
54
|
-
hover:bg-hover active:bg-active
|
|
55
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
55
|
+
default: `
|
|
56
|
+
${themeControlSurfaceClasses} text-foreground
|
|
57
|
+
border border-input-border
|
|
58
|
+
hover:bg-hover active:bg-active
|
|
59
|
+
focus-visible:border-focus-indicator focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
56
60
|
`,
|
|
57
|
-
primary: `
|
|
58
|
-
bg-primary text-primary-foreground
|
|
59
|
-
hover:bg-primary-hover active:bg-primary-active
|
|
60
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
61
|
+
primary: `
|
|
62
|
+
bg-primary text-primary-foreground
|
|
63
|
+
hover:bg-primary-hover active:bg-primary-active
|
|
64
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
61
65
|
`,
|
|
62
|
-
success: `
|
|
63
|
-
bg-success text-success-foreground
|
|
64
|
-
hover:bg-success-hover
|
|
65
|
-
active:bg-success-active
|
|
66
|
-
focus-visible:ring-2 focus-visible:ring-success/
|
|
66
|
+
success: `
|
|
67
|
+
bg-success text-success-foreground
|
|
68
|
+
hover:bg-success-hover
|
|
69
|
+
active:bg-success-active
|
|
70
|
+
focus-visible:ring-2 focus-visible:ring-success/35
|
|
67
71
|
`,
|
|
68
|
-
error: `
|
|
69
|
-
bg-error text-error-foreground
|
|
70
|
-
hover:bg-error-hover
|
|
71
|
-
active:bg-error-active
|
|
72
|
-
focus-visible:ring-2 focus-visible:ring-error/
|
|
72
|
+
error: `
|
|
73
|
+
bg-error text-error-foreground
|
|
74
|
+
hover:bg-error-hover
|
|
75
|
+
active:bg-error-active
|
|
76
|
+
focus-visible:ring-2 focus-visible:ring-error/35
|
|
73
77
|
`,
|
|
74
|
-
warning: `
|
|
75
|
-
bg-warning text-warning-foreground
|
|
76
|
-
hover:bg-warning-hover
|
|
77
|
-
active:bg-warning-active
|
|
78
|
-
focus-visible:ring-2 focus-visible:ring-warning/
|
|
78
|
+
warning: `
|
|
79
|
+
bg-warning text-warning-foreground
|
|
80
|
+
hover:bg-warning-hover
|
|
81
|
+
active:bg-warning-active
|
|
82
|
+
focus-visible:ring-2 focus-visible:ring-warning/35
|
|
79
83
|
`,
|
|
80
|
-
info: `
|
|
81
|
-
bg-info text-info-foreground
|
|
82
|
-
hover:bg-info-hover
|
|
83
|
-
active:bg-info-active
|
|
84
|
-
focus-visible:ring-2 focus-visible:ring-info/
|
|
84
|
+
info: `
|
|
85
|
+
bg-info text-info-foreground
|
|
86
|
+
hover:bg-info-hover
|
|
87
|
+
active:bg-info-active
|
|
88
|
+
focus-visible:ring-2 focus-visible:ring-info/35
|
|
85
89
|
`,
|
|
86
|
-
outline: `
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
active:bg-
|
|
90
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
90
|
+
outline: `
|
|
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
|
-
secondary: `
|
|
93
|
-
bg-secondary text-secondary-foreground
|
|
94
|
-
hover:bg-secondary-hover
|
|
95
|
-
active:bg-secondary-active
|
|
96
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
96
|
+
secondary: `
|
|
97
|
+
bg-secondary text-secondary-foreground
|
|
98
|
+
hover:bg-secondary-hover
|
|
99
|
+
active:bg-secondary-active
|
|
100
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
97
101
|
`,
|
|
98
|
-
ghost: `
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
active:bg-
|
|
102
|
-
focus-visible:ring-2 focus-visible:ring-
|
|
102
|
+
ghost: `
|
|
103
|
+
bg-transparent text-foreground
|
|
104
|
+
shadow-none
|
|
105
|
+
hover:bg-hover active:bg-active
|
|
106
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
103
107
|
`,
|
|
104
|
-
link: `
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
link: `
|
|
109
|
+
bg-transparent text-foreground
|
|
110
|
+
shadow-none
|
|
111
|
+
underline-offset-4 hover:underline
|
|
112
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
108
113
|
`,
|
|
109
|
-
clear: `
|
|
110
|
-
bg-transparent
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
clear: `
|
|
115
|
+
bg-transparent
|
|
116
|
+
border-0 shadow-none
|
|
117
|
+
hover:bg-transparent active:bg-transparent
|
|
118
|
+
focus-visible:ring-2 focus-visible:ring-focus-indicator/35
|
|
113
119
|
`
|
|
114
120
|
},
|
|
115
121
|
rounded: {
|
|
@@ -120,130 +126,135 @@ 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: [
|
|
132
138
|
{
|
|
133
139
|
look: "default",
|
|
134
140
|
selected: true,
|
|
135
|
-
class: `
|
|
136
|
-
bg-selected text-foreground
|
|
137
|
-
|
|
138
|
-
active:bg-selected
|
|
141
|
+
class: `
|
|
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
|
{
|
|
142
148
|
look: "primary",
|
|
143
149
|
selected: true,
|
|
144
|
-
class: `
|
|
145
|
-
bg-primary-selected text-primary-foreground
|
|
146
|
-
hover:bg-primary-selected
|
|
147
|
-
active:bg-primary-
|
|
150
|
+
class: `
|
|
151
|
+
bg-primary-selected text-primary-foreground
|
|
152
|
+
hover:bg-primary-selected hover:text-primary-foreground
|
|
153
|
+
active:bg-primary-active active:text-primary-foreground
|
|
148
154
|
`
|
|
149
155
|
},
|
|
150
156
|
{
|
|
151
157
|
look: "secondary",
|
|
152
158
|
selected: true,
|
|
153
|
-
class: `
|
|
154
|
-
bg-secondary-selected text-secondary-foreground
|
|
155
|
-
hover:bg-secondary-selected
|
|
156
|
-
active:bg-secondary-
|
|
159
|
+
class: `
|
|
160
|
+
bg-secondary-selected text-secondary-foreground
|
|
161
|
+
hover:bg-secondary-selected hover:text-secondary-foreground
|
|
162
|
+
active:bg-secondary-active active:text-secondary-foreground
|
|
157
163
|
`
|
|
158
164
|
},
|
|
159
165
|
{
|
|
160
166
|
look: "success",
|
|
161
167
|
selected: true,
|
|
162
|
-
class: `
|
|
163
|
-
bg-success-selected text-success-foreground
|
|
164
|
-
hover:bg-success-selected
|
|
165
|
-
active:bg-success-
|
|
168
|
+
class: `
|
|
169
|
+
bg-success-selected text-success-foreground
|
|
170
|
+
hover:bg-success-selected hover:text-success-foreground
|
|
171
|
+
active:bg-success-active active:text-success-foreground
|
|
166
172
|
`
|
|
167
173
|
},
|
|
168
174
|
{
|
|
169
175
|
look: "error",
|
|
170
176
|
selected: true,
|
|
171
|
-
class: `
|
|
172
|
-
bg-error-selected text-error-foreground
|
|
173
|
-
hover:bg-error-selected
|
|
174
|
-
active:bg-error-
|
|
177
|
+
class: `
|
|
178
|
+
bg-error-selected text-error-foreground
|
|
179
|
+
hover:bg-error-selected hover:text-error-foreground
|
|
180
|
+
active:bg-error-active active:text-error-foreground
|
|
175
181
|
`
|
|
176
182
|
},
|
|
177
183
|
{
|
|
178
184
|
look: "warning",
|
|
179
185
|
selected: true,
|
|
180
|
-
class: `
|
|
181
|
-
bg-warning-selected text-warning-foreground
|
|
182
|
-
hover:bg-warning-selected
|
|
183
|
-
active:bg-warning-
|
|
186
|
+
class: `
|
|
187
|
+
bg-warning-selected text-warning-foreground
|
|
188
|
+
hover:bg-warning-selected hover:text-warning-foreground
|
|
189
|
+
active:bg-warning-active active:text-warning-foreground
|
|
184
190
|
`
|
|
185
191
|
},
|
|
186
192
|
{
|
|
187
193
|
look: "info",
|
|
188
194
|
selected: true,
|
|
189
|
-
class: `
|
|
190
|
-
bg-info-selected text-info-foreground
|
|
191
|
-
hover:bg-info-selected
|
|
192
|
-
active:bg-info-
|
|
195
|
+
class: `
|
|
196
|
+
bg-info-selected text-info-foreground
|
|
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
|
-
class: `
|
|
199
|
-
bg-
|
|
200
|
-
hover:bg-
|
|
201
|
-
active:bg-
|
|
204
|
+
class: `
|
|
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
|
-
class: `
|
|
208
|
-
bg-
|
|
209
|
-
hover:bg-
|
|
210
|
-
active:bg-
|
|
213
|
+
class: `
|
|
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
|
-
class: `
|
|
217
|
-
bg-
|
|
218
|
-
hover:bg-
|
|
219
|
-
active:bg-
|
|
222
|
+
class: `
|
|
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
|
{
|
|
223
229
|
look: "clear",
|
|
224
230
|
selected: true,
|
|
225
|
-
class: `
|
|
226
|
-
bg-transparent border-0
|
|
227
|
-
hover:bg-transparent active:bg-transparent
|
|
231
|
+
class: `
|
|
232
|
+
bg-transparent border-0
|
|
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,9 +280,10 @@ 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
|
+
this.displaysPressedState = computed(() => this.isInButtonGroup() || !!this.toggleable(), /* @ts-ignore */
|
|
286
|
+
...(ngDevMode ? [{ debugName: "displaysPressedState" }] : /* istanbul ignore next */ []));
|
|
285
287
|
this.effectiveDisabled = computed(() => this.#buttonService?.groupDisabled() || this.disabled(), /* @ts-ignore */
|
|
286
288
|
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
287
289
|
this.effectiveLook = computed(() => this.#buttonService?.groupLook() ?? this.look(), /* @ts-ignore */
|
|
@@ -290,7 +292,7 @@ class ButtonDirective {
|
|
|
290
292
|
...(ngDevMode ? [{ debugName: "effectiveRounded" }] : /* istanbul ignore next */ []));
|
|
291
293
|
this.effectiveSize = computed(() => this.#buttonService?.groupSize() ?? this.size(), /* @ts-ignore */
|
|
292
294
|
...(ngDevMode ? [{ debugName: "effectiveSize" }] : /* istanbul ignore next */ []));
|
|
293
|
-
this.effectiveToggleable = computed(() => this.
|
|
295
|
+
this.effectiveToggleable = computed(() => this.toggleable() ?? this.isInButtonGroup(), /* @ts-ignore */
|
|
294
296
|
...(ngDevMode ? [{ debugName: "effectiveToggleable" }] : /* istanbul ignore next */ []));
|
|
295
297
|
this.isInButtonGroup = computed(() => !!this.#buttonService, /* @ts-ignore */
|
|
296
298
|
...(ngDevMode ? [{ debugName: "isInButtonGroup" }] : /* istanbul ignore next */ []));
|
|
@@ -303,8 +305,7 @@ class ButtonDirective {
|
|
|
303
305
|
const size = this.effectiveSize();
|
|
304
306
|
const selected = this.selected();
|
|
305
307
|
const userClass = this.userClass();
|
|
306
|
-
const
|
|
307
|
-
const variants = buttonThemeVariants(theme);
|
|
308
|
+
const variants = buttonThemeVariants;
|
|
308
309
|
const variantClasses = variants({ disabled, iconOnly, loading, look, rounded, selected, size });
|
|
309
310
|
return twMerge(variantClasses, userClass);
|
|
310
311
|
}, /* @ts-ignore */
|
|
@@ -385,10 +386,10 @@ class ButtonDirective {
|
|
|
385
386
|
/**
|
|
386
387
|
* @description Enables toggle behavior — each click flips the `selected` state and `aria-pressed` is managed.
|
|
387
388
|
* Must use `[toggleable]="true"` binding syntax, not bare attribute form.
|
|
388
|
-
* @default
|
|
389
|
+
* @default undefined
|
|
389
390
|
*/
|
|
390
|
-
this.toggleable = input(
|
|
391
|
-
...(ngDevMode ? [{ debugName: "toggleable" }] : /* istanbul ignore next */ []));
|
|
391
|
+
this.toggleable = input(/* @ts-ignore */
|
|
392
|
+
...(ngDevMode ? [undefined, { debugName: "toggleable" }] : /* istanbul ignore next */ []));
|
|
392
393
|
/**
|
|
393
394
|
* @description Additional CSS classes merged onto the host element via `tailwind-merge`.
|
|
394
395
|
* @default ""
|
|
@@ -464,7 +465,7 @@ class ButtonDirective {
|
|
|
464
465
|
});
|
|
465
466
|
}
|
|
466
467
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
467
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ButtonDirective, isStandalone: true, selector: "button[monaButton]", inputs: { ariaHasPopup: { classPropertyName: "ariaHasPopup", publicName: "aria-haspopup", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, iconOnly: { classPropertyName: "iconOnly", publicName: "iconOnly", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, toggleable: { classPropertyName: "toggleable", publicName: "toggleable", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", loading: "loadingChange", look: "lookChange", selected: "selectedChange" }, host: { properties: { "attr.aria-busy": "loading() ? 'true' : undefined", "attr.aria-disabled": "effectiveDisabled() || loading() ? 'true' : undefined", "attr.aria-haspopup": "ariaHasPopup() !== 'false' ? ariaHasPopup() : null", "attr.aria-pressed": "
|
|
468
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: ButtonDirective, isStandalone: true, selector: "button[monaButton]", inputs: { ariaHasPopup: { classPropertyName: "ariaHasPopup", publicName: "aria-haspopup", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, iconOnly: { classPropertyName: "iconOnly", publicName: "iconOnly", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, toggleable: { classPropertyName: "toggleable", publicName: "toggleable", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", loading: "loadingChange", look: "lookChange", selected: "selectedChange" }, host: { properties: { "attr.aria-busy": "loading() ? 'true' : undefined", "attr.aria-disabled": "effectiveDisabled() || loading() ? 'true' : undefined", "attr.aria-haspopup": "ariaHasPopup() !== 'false' ? ariaHasPopup() : null", "attr.aria-pressed": "displaysPressedState() ? (selected() ? 'true' : 'false') : undefined", "attr.data-look": "effectiveLook()", "attr.data-size": "effectiveSize()", "attr.disabled": "effectiveDisabled() || loading() ? '' : undefined", "attr.tabindex": "effectiveDisabled() || loading() ? -1 : tabindex()", "attr.type": "'button'", "class": "baseClass()" } }, ngImport: i0 }); }
|
|
468
469
|
}
|
|
469
470
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ButtonDirective, decorators: [{
|
|
470
471
|
type: Directive,
|
|
@@ -474,7 +475,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
474
475
|
"[attr.aria-busy]": "loading() ? 'true' : undefined",
|
|
475
476
|
"[attr.aria-disabled]": "effectiveDisabled() || loading() ? 'true' : undefined",
|
|
476
477
|
"[attr.aria-haspopup]": "ariaHasPopup() !== 'false' ? ariaHasPopup() : null",
|
|
477
|
-
"[attr.aria-pressed]": "
|
|
478
|
+
"[attr.aria-pressed]": "displaysPressedState() ? (selected() ? 'true' : 'false') : undefined",
|
|
478
479
|
"[attr.data-look]": "effectiveLook()",
|
|
479
480
|
"[attr.data-size]": "effectiveSize()",
|
|
480
481
|
"[attr.disabled]": "effectiveDisabled() || loading() ? '' : undefined",
|