@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
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, ElementRef, computed, signal, input, output, model, Component } from '@angular/core';
|
|
3
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
4
3
|
import { count } from '@mirei/ts-collections';
|
|
5
4
|
import { cva } from 'class-variance-authority';
|
|
6
5
|
|
|
7
|
-
const
|
|
6
|
+
const colorPaletteBaseThemeVariants = cva(`
|
|
8
7
|
grid gap-0.125 p-0.0625
|
|
8
|
+
data-[disabled='true']:pointer-events-none
|
|
9
9
|
data-[disabled='true']:cursor-not-allowed
|
|
10
10
|
data-[disabled='true']:opacity-50
|
|
11
|
-
data-[disabled='true']:pointer-events-none
|
|
12
11
|
data-[readonly='true']:cursor-default
|
|
13
12
|
data-[invalid='true']:border
|
|
14
13
|
data-[invalid='true']:border-error
|
|
15
14
|
data-[invalid='true']:ring-1
|
|
16
|
-
data-[invalid='true']:ring-error
|
|
15
|
+
data-[invalid='true']:ring-error/35
|
|
17
16
|
`);
|
|
18
|
-
const
|
|
17
|
+
const colorPaletteItemThemeVariants = cva(`
|
|
19
18
|
cursor-pointer
|
|
19
|
+
transition-transform
|
|
20
20
|
data-[readonly='true']:cursor-default
|
|
21
|
-
data-[selected='true']:border
|
|
22
|
-
data-[selected='true']:border-border
|
|
23
|
-
data-[selected='true']:outline
|
|
24
|
-
data-[selected='true']:outline-2
|
|
25
|
-
data-[selected='true']:outline-foreground
|
|
26
21
|
data-[selected='true']:scale-90
|
|
27
|
-
|
|
22
|
+
data-[selected='true']:border-2 data-[selected='true']:border-black/90
|
|
23
|
+
data-[selected='true']:outline data-[selected='true']:outline-2 data-[selected='true']:outline-white/90
|
|
24
|
+
hover:scale-95
|
|
28
25
|
|
|
29
|
-
focus:
|
|
30
|
-
focus:not-data-[selected='true']:border-
|
|
31
|
-
focus:not-data-[selected='true']:
|
|
32
|
-
focus:not-data-[selected='true']:
|
|
26
|
+
focus-visible:z-1
|
|
27
|
+
focus-visible:not-data-[selected='true']:border-2
|
|
28
|
+
focus-visible:not-data-[selected='true']:border-black/90
|
|
29
|
+
focus-visible:not-data-[selected='true']:outline
|
|
30
|
+
focus-visible:not-data-[selected='true']:outline-2
|
|
31
|
+
focus-visible:not-data-[selected='true']:outline-white/90
|
|
33
32
|
`, {
|
|
34
33
|
variants: {
|
|
35
34
|
rounded: {
|
|
@@ -42,23 +41,6 @@ const colorPaletteItemVariants = cva(`
|
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
|
|
45
|
-
const colorPaletteBaseThemeVariants = (theme) => {
|
|
46
|
-
switch (theme) {
|
|
47
|
-
case "mona":
|
|
48
|
-
return colorPaletteBaseVariants;
|
|
49
|
-
default:
|
|
50
|
-
return colorPaletteBaseVariants;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const colorPaletteItemThemeVariants = (theme) => {
|
|
54
|
-
switch (theme) {
|
|
55
|
-
case "mona":
|
|
56
|
-
return colorPaletteItemVariants;
|
|
57
|
-
default:
|
|
58
|
-
return colorPaletteItemVariants;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
44
|
const flatColorScheme = {
|
|
63
45
|
name: "flat",
|
|
64
46
|
columns: 20,
|
|
@@ -687,10 +669,8 @@ const websafeColorScheme = {
|
|
|
687
669
|
class ColorPaletteComponent {
|
|
688
670
|
constructor() {
|
|
689
671
|
this.#elementRef = inject((ElementRef));
|
|
690
|
-
this.#themeService = inject(ThemeService);
|
|
691
672
|
this.baseClasses = computed(() => {
|
|
692
|
-
|
|
693
|
-
return colorPaletteBaseThemeVariants(theme)();
|
|
673
|
+
return colorPaletteBaseThemeVariants();
|
|
694
674
|
}, /* @ts-ignore */
|
|
695
675
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
696
676
|
this.colorScheme = computed(() => {
|
|
@@ -714,9 +694,8 @@ class ColorPaletteComponent {
|
|
|
714
694
|
}, /* @ts-ignore */
|
|
715
695
|
...(ngDevMode ? [{ debugName: "colorScheme" }] : /* istanbul ignore next */ []));
|
|
716
696
|
this.paletteItemClasses = computed(() => {
|
|
717
|
-
const theme = this.#themeService.theme();
|
|
718
697
|
const rounded = this.rounded();
|
|
719
|
-
return colorPaletteItemThemeVariants(
|
|
698
|
+
return colorPaletteItemThemeVariants({ rounded });
|
|
720
699
|
}, /* @ts-ignore */
|
|
721
700
|
...(ngDevMode ? [{ debugName: "paletteItemClasses" }] : /* istanbul ignore next */ []));
|
|
722
701
|
this.colorRows = computed(() => {
|
|
@@ -807,7 +786,6 @@ class ColorPaletteComponent {
|
|
|
807
786
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
808
787
|
}
|
|
809
788
|
#elementRef;
|
|
810
|
-
#themeService;
|
|
811
789
|
focusColorTile(index) {
|
|
812
790
|
setTimeout(() => {
|
|
813
791
|
const colorTiles = this.#elementRef.nativeElement.querySelectorAll("[data-color-index]");
|
|
@@ -6,11 +6,11 @@ import { LucideCircleX } from '@lucide/angular';
|
|
|
6
6
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
7
7
|
import { ColorGradientComponent } from '@nanahoshi/mona-ui/color-gradient';
|
|
8
8
|
import { ColorPaletteComponent } from '@nanahoshi/mona-ui/color-palette';
|
|
9
|
-
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
9
|
+
import { themeControlSurfaceClasses, themeOverlaySurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
10
10
|
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
11
11
|
import { PopupService, dropdownPopupAnimation } from '@nanahoshi/mona-ui/popup';
|
|
12
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
13
12
|
import { take, fromEvent, takeUntil } from 'rxjs';
|
|
13
|
+
import { twMerge } from 'tailwind-merge';
|
|
14
14
|
import { cva } from 'class-variance-authority';
|
|
15
15
|
|
|
16
16
|
class ColorPickerValueTemplateDirective {
|
|
@@ -24,32 +24,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
24
24
|
}]
|
|
25
25
|
}] });
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const colorPickerBaseThemeVariants = cva(`
|
|
28
28
|
flex items-center
|
|
29
|
-
border border-input-border
|
|
30
|
-
bg-background outline-none
|
|
31
|
-
shadow-xs text-foreground
|
|
32
29
|
cursor-pointer
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
transition-[color,box-shadow,border] ease-in-out
|
|
30
|
+
${themeControlSurfaceClasses} text-foreground
|
|
31
|
+
border border-input-border
|
|
32
|
+
shadow-(--shadow-control) outline-none
|
|
33
|
+
transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
|
|
37
34
|
|
|
38
35
|
data-[disabled='true']:pointer-events-none
|
|
39
36
|
data-[disabled='true']:cursor-not-allowed
|
|
40
|
-
data-[disabled='true']:
|
|
37
|
+
data-[disabled='true']:border-disabled-border
|
|
38
|
+
data-[disabled='true']:bg-disabled-background
|
|
39
|
+
data-[disabled='true']:text-disabled-foreground
|
|
40
|
+
data-[disabled='true']:shadow-none
|
|
41
41
|
data-[readonly='true']:cursor-default
|
|
42
|
-
data-[invalid='true']:border-error
|
|
43
|
-
data-[invalid='true']:ring-1
|
|
44
|
-
data-[invalid='true']:ring-error
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
hover:bg-hover active:bg-active
|
|
44
|
+
|
|
45
|
+
focus-within:border-focus-indicator
|
|
46
|
+
focus-within:ring-2 focus-within:ring-focus-indicator/35
|
|
47
47
|
|
|
48
|
+
data-[invalid='true']:border-error
|
|
49
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
50
|
+
data-[invalid='true']:focus-within:border-error
|
|
51
|
+
data-[invalid='true']:focus-within:ring-error/35
|
|
48
52
|
[&.ng-touched.ng-invalid]:border-error
|
|
53
|
+
[&.ng-touched.ng-invalid]:ring-2 [&.ng-touched.ng-invalid]:ring-error/35
|
|
54
|
+
[&.ng-touched.ng-invalid]:focus-within:border-error
|
|
55
|
+
[&.ng-touched.ng-invalid]:focus-within:ring-error/35
|
|
49
56
|
`, {
|
|
50
57
|
variants: {
|
|
51
58
|
expanded: {
|
|
52
|
-
true: "ring-
|
|
59
|
+
true: "border-focus-indicator ring-2 ring-focus-indicator/35",
|
|
60
|
+
false: ""
|
|
53
61
|
},
|
|
54
62
|
rounded: {
|
|
55
63
|
none: "rounded-none",
|
|
@@ -63,9 +71,15 @@ const colorPickerBaseVariants = cva(`
|
|
|
63
71
|
medium: "h-9 text-sm",
|
|
64
72
|
small: "h-8 text-xs"
|
|
65
73
|
}
|
|
66
|
-
}
|
|
74
|
+
},
|
|
75
|
+
compoundVariants: [
|
|
76
|
+
{
|
|
77
|
+
expanded: true,
|
|
78
|
+
class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
67
81
|
});
|
|
68
|
-
const
|
|
82
|
+
const colorPickerColorThemeVariants = cva(`
|
|
69
83
|
flex items-center justify-center
|
|
70
84
|
mx-1
|
|
71
85
|
`, {
|
|
@@ -78,30 +92,13 @@ const colorPickerColorVariants = cva(`
|
|
|
78
92
|
full: "rounded-full"
|
|
79
93
|
},
|
|
80
94
|
size: {
|
|
81
|
-
large: "
|
|
82
|
-
medium: "
|
|
83
|
-
small: "
|
|
95
|
+
large: "mx-2 h-6 w-6",
|
|
96
|
+
medium: "mx-2 h-5 w-5",
|
|
97
|
+
small: "mx-1 h-4 w-4"
|
|
84
98
|
}
|
|
85
99
|
}
|
|
86
100
|
});
|
|
87
101
|
|
|
88
|
-
const colorPickerBaseThemeVariants = (theme) => {
|
|
89
|
-
switch (theme) {
|
|
90
|
-
case "mona":
|
|
91
|
-
return colorPickerBaseVariants;
|
|
92
|
-
default:
|
|
93
|
-
return colorPickerBaseVariants;
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const colorPickerColorThemeVariants = (theme) => {
|
|
97
|
-
switch (theme) {
|
|
98
|
-
case "mona":
|
|
99
|
-
return colorPickerColorVariants;
|
|
100
|
-
default:
|
|
101
|
-
return colorPickerColorVariants;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
102
|
class ColorPickerComponent {
|
|
106
103
|
constructor() {
|
|
107
104
|
this.#destroyRef = inject(DestroyRef);
|
|
@@ -109,26 +106,25 @@ class ColorPickerComponent {
|
|
|
109
106
|
this.#popupService = inject(PopupService);
|
|
110
107
|
this.#popupRef = signal(null, /* @ts-ignore */
|
|
111
108
|
...(ngDevMode ? [{ debugName: "#popupRef" }] : /* istanbul ignore next */ []));
|
|
112
|
-
this.#themeService = inject(ThemeService);
|
|
113
109
|
this.baseClasses = computed(() => {
|
|
114
|
-
const theme = this.#themeService.theme();
|
|
115
110
|
const expanded = this.expanded();
|
|
116
111
|
const rounded = this.rounded();
|
|
117
112
|
const size = this.size();
|
|
118
|
-
return colorPickerBaseThemeVariants(
|
|
113
|
+
return twMerge(colorPickerBaseThemeVariants({ expanded, rounded, size }));
|
|
119
114
|
}, /* @ts-ignore */
|
|
120
115
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
121
116
|
this.colorClasses = computed(() => {
|
|
122
|
-
const theme = this.#themeService.theme();
|
|
123
117
|
const rounded = this.rounded();
|
|
124
118
|
const size = this.size();
|
|
125
|
-
return colorPickerColorThemeVariants(
|
|
119
|
+
return colorPickerColorThemeVariants({ rounded, size });
|
|
126
120
|
}, /* @ts-ignore */
|
|
127
121
|
...(ngDevMode ? [{ debugName: "colorClasses" }] : /* istanbul ignore next */ []));
|
|
128
122
|
this.expanded = computed(() => this.#popupRef() !== null, /* @ts-ignore */
|
|
129
123
|
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
130
124
|
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && !this.value()), /* @ts-ignore */
|
|
131
125
|
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
126
|
+
this.gradientPopupClasses = `${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay)`;
|
|
127
|
+
this.palettePopupClasses = `flex flex-col p-0.5 ${themeOverlaySurfaceClasses} border border-border shadow-(--shadow-overlay) outline-none`;
|
|
132
128
|
this.popupId = createElementControlId();
|
|
133
129
|
this.popupTemplate = viewChild.required("popupTemplate", /* @ts-ignore */
|
|
134
130
|
...(ngDevMode ? [{ debugName: "popupTemplate" }] : /* istanbul ignore next */ []));
|
|
@@ -238,7 +234,6 @@ class ColorPickerComponent {
|
|
|
238
234
|
#hostElementRef;
|
|
239
235
|
#popupService;
|
|
240
236
|
#popupRef;
|
|
241
|
-
#themeService;
|
|
242
237
|
ngOnInit() {
|
|
243
238
|
this.setEventListeners();
|
|
244
239
|
this.setKeyboardEventListeners();
|
|
@@ -456,7 +451,7 @@ class ColorPickerComponent {
|
|
|
456
451
|
});
|
|
457
452
|
}
|
|
458
453
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
459
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPickerComponent, isStandalone: true, selector: "mona-color-picker", inputs: { closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, palette: { classPropertyName: "palette", publicName: "palette", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.tabindex": "disabled() ? -1 : 0", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.data-open": "expanded() || null", "attr.data-readonly": "readonly()", "attr.data-required": "required() || null", "attr.role": "'combobox'", "attr.aria-controls": "popupId", "attr.aria-expanded": "expanded() || null", "attr.aria-haspopup": "'dialog'", "attr.aria-label": "'Color picker'", "attr.aria-disabled": "disabled()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-readonly": "readonly()", "attr.aria-required": "required()" } }, queries: [{ propertyName: "valueTemplate", first: true, predicate: ColorPickerValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n class=\"
|
|
454
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ColorPickerComponent, isStandalone: true, selector: "mona-color-picker", inputs: { closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, palette: { classPropertyName: "palette", publicName: "palette", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { properties: { "class": "baseClasses()", "attr.tabindex": "disabled() ? -1 : 0", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.data-open": "expanded() || null", "attr.data-readonly": "readonly()", "attr.data-required": "required() || null", "attr.role": "'combobox'", "attr.aria-controls": "popupId", "attr.aria-expanded": "expanded() || null", "attr.aria-haspopup": "'dialog'", "attr.aria-label": "'Color picker'", "attr.aria-disabled": "disabled()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-readonly": "readonly()", "attr.aria-required": "required()" } }, queries: [{ propertyName: "valueTemplate", first: true, predicate: ColorPickerValueTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n aria-label=\"Color palette picker\"\n data-palette-container\n (keydown)=\"onPaletteContainerKeyDown($event)\">\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\n <button monaButton look=\"ghost\" size=\"small\" (click)=\"onClearClick()\">\n <i class=\"ri-blur-off-line\"></i>\n </button>\n </div>\n }\n <mona-color-palette\n [palette]=\"palette()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (touch)=\"onColorPaletteTouch()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n aria-label=\"Color gradient picker\">\n <mona-color-gradient\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [disabled]=\"disabled() || readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (touch)=\"onColorGradientTouch()\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n", dependencies: [{ kind: "directive", type: ButtonDirective, selector: "button[monaButton]", inputs: ["aria-haspopup", "disabled", "iconOnly", "loading", "look", "rounded", "selected", "size", "tabindex", "toggleable", "class"], outputs: ["disabledChange", "loadingChange", "lookChange", "selectedChange"] }, { kind: "component", type: ColorPaletteComponent, selector: "mona-color-palette", inputs: ["columns", "disabled", "invalid", "palette", "readonly", "rounded", "required", "tileSize", "touched", "value"], outputs: ["touch", "valueChange"] }, { kind: "component", type: ColorGradientComponent, selector: "mona-color-gradient", inputs: ["disabled", "format", "invalid", "opacity", "required", "rounded", "showButtons", "showHexInput", "showColorInputs", "touched", "value"], outputs: ["apply", "cancel", "touch", "valueChange"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideCircleX, selector: "svg[lucideCircleX], svg[lucideXCircle]" }, { kind: "component", type: IndicatorIconComponent, selector: "mona-indicator-icon", inputs: ["icon", "interactive", "label", "preset", "size", "class"], outputs: ["activate"] }] }); }
|
|
460
455
|
}
|
|
461
456
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ColorPickerComponent, decorators: [{
|
|
462
457
|
type: Component,
|
|
@@ -484,7 +479,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
484
479
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
485
480
|
"[attr.aria-readonly]": "readonly()",
|
|
486
481
|
"[attr.aria-required]": "required()"
|
|
487
|
-
}, template: "@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n class=\"
|
|
482
|
+
}, template: "@if (valueTemplate()) {\n <ng-container\n [ngTemplateOutlet]=\"valueTemplate() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: value() }\"></ng-container>\n} @else {\n <div [style.background]=\"value()\" [class]=\"colorClasses()\">\n @if (!value()) {\n <svg lucideXCircle [size]=\"16\"></svg>\n }\n </div>\n}\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<ng-template #popupTemplate>\n @if (view() === \"palette\") {\n <div\n [id]=\"popupId\"\n [class]=\"palettePopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n aria-label=\"Color palette picker\"\n data-palette-container\n (keydown)=\"onPaletteContainerKeyDown($event)\">\n @if (showClearButton()) {\n <div class=\"flex items-center justify-end p-1\">\n <button monaButton look=\"ghost\" size=\"small\" (click)=\"onClearClick()\">\n <i class=\"ri-blur-off-line\"></i>\n </button>\n </div>\n }\n <mona-color-palette\n [palette]=\"palette()\"\n [columns]=\"columns()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorPaletteValueChange($event)\"\n (touch)=\"onColorPaletteTouch()\"></mona-color-palette>\n </div>\n } @else if (view() === \"gradient\") {\n <div\n [id]=\"popupId\"\n [class]=\"gradientPopupClasses\"\n tabindex=\"0\"\n role=\"dialog\"\n aria-label=\"Color gradient picker\">\n <mona-color-gradient\n [opacity]=\"opacity()\"\n [rounded]=\"rounded()\"\n [disabled]=\"disabled() || readonly()\"\n [value]=\"value()\"\n (valueChange)=\"onColorGradientValueChange($event)\"\n (touch)=\"onColorGradientTouch()\"\n (apply)=\"onColorGradientApply()\"\n (cancel)=\"onColorGradientCancel()\"></mona-color-gradient>\n </div>\n }\n</ng-template>\n" }]
|
|
488
483
|
}], propDecorators: { popupTemplate: [{ type: i0.ViewChild, args: ["popupTemplate", { isSignal: true }] }], valueTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ColorPickerValueTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], palette: [{ type: i0.Input, args: [{ isSignal: true, alias: "palette", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
489
484
|
|
|
490
485
|
/*
|
|
@@ -7,32 +7,36 @@ import { FormsModule } from '@angular/forms';
|
|
|
7
7
|
import { FilterChangeEvent } from '@nanahoshi/mona-ui/common';
|
|
8
8
|
import * as i1 from '@nanahoshi/mona-ui/dropdowns';
|
|
9
9
|
import { DropdownListService, DropdownService, DropdownFooterTemplateDirective, DropdownGroupHeaderTemplateDirective, DropdownHeaderTemplateDirective, DropdownItemTemplateDirective, dropdownPopupThemeVariants, DropdownNoDataTemplateDirective, DropdownPrefixTemplateDirective, DropdownLiveRegionDirective, DropdownDataInputToken, DropdownPopupInputToken, DropdownDataHandlerDirective, DropdownListPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
10
|
-
import { createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
10
|
+
import { themeControlSurfaceClasses, createElementControlId, rxTimeout } from '@nanahoshi/mona-ui/internal';
|
|
11
11
|
import { IndicatorIconComponent } from '@nanahoshi/mona-ui/internal/indicator-icon';
|
|
12
12
|
import { ListService, ListComponent, ListGroupHeaderTemplateDirective, ListFooterTemplateDirective, ListHeaderTemplateDirective, ListNoDataTemplateDirective, ListItemTemplateDirective } from '@nanahoshi/mona-ui/internal/list';
|
|
13
13
|
import { TextBoxDirective } from '@nanahoshi/mona-ui/text-box';
|
|
14
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
15
14
|
import { Subject, fromEvent, filter, debounceTime, take, tap } from 'rxjs';
|
|
16
15
|
import { twMerge } from 'tailwind-merge';
|
|
17
16
|
import { cva } from 'class-variance-authority';
|
|
18
17
|
|
|
19
|
-
const
|
|
18
|
+
const comboBoxBaseThemeVariants = cva(`
|
|
20
19
|
flex items-center
|
|
21
|
-
border border-input-border outline-none
|
|
22
|
-
bg-background shadow-xs text-foreground
|
|
23
20
|
cursor-pointer
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
${themeControlSurfaceClasses} text-foreground
|
|
22
|
+
border border-input-border shadow-(--shadow-control) outline-none
|
|
23
|
+
transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out
|
|
24
|
+
data-[readonly='true']:cursor-default
|
|
25
|
+
focus-within:border-focus-indicator focus-within:ring-2 focus-within:ring-focus-indicator/35
|
|
26
26
|
`, {
|
|
27
27
|
variants: {
|
|
28
28
|
disabled: {
|
|
29
|
-
true:
|
|
29
|
+
true: `
|
|
30
|
+
pointer-events-none cursor-not-allowed
|
|
31
|
+
bg-disabled-background text-disabled-foreground
|
|
32
|
+
border-disabled-border shadow-none
|
|
33
|
+
`
|
|
30
34
|
},
|
|
31
35
|
focused: {
|
|
32
|
-
true: "ring-
|
|
36
|
+
true: "border-focus-indicator ring-2 ring-focus-indicator/35"
|
|
33
37
|
},
|
|
34
38
|
invalid: {
|
|
35
|
-
true: "border-error ring-
|
|
39
|
+
true: "border-error ring-2 ring-error/35 focus-within:border-error focus-within:ring-error/35",
|
|
36
40
|
false: ""
|
|
37
41
|
},
|
|
38
42
|
rounded: {
|
|
@@ -48,6 +52,13 @@ const comboBoxBaseVariants = cva(`
|
|
|
48
52
|
large: "h-10 text-md"
|
|
49
53
|
}
|
|
50
54
|
},
|
|
55
|
+
compoundVariants: [
|
|
56
|
+
{
|
|
57
|
+
focused: true,
|
|
58
|
+
invalid: true,
|
|
59
|
+
class: "border-error ring-error/35"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
51
62
|
defaultVariants: {
|
|
52
63
|
disabled: false,
|
|
53
64
|
focused: false,
|
|
@@ -56,10 +67,9 @@ const comboBoxBaseVariants = cva(`
|
|
|
56
67
|
size: "medium"
|
|
57
68
|
}
|
|
58
69
|
});
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
bg-transparent shadow-none
|
|
62
|
-
px-2 h-full w-full text-ellipsis
|
|
70
|
+
const comboBoxTextInputThemeVariants = cva(`
|
|
71
|
+
h-full w-full px-2 text-ellipsis
|
|
72
|
+
bg-transparent border-none shadow-none outline-none
|
|
63
73
|
focus-within:ring-0 focus-within:shadow-none
|
|
64
74
|
focus-visible:ring-0 focus-visible:shadow-none
|
|
65
75
|
`, {
|
|
@@ -73,32 +83,7 @@ const comboBoxTextInputVariants = cva(`
|
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
85
|
});
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const comboBoxBaseThemeVariants = (theme) => {
|
|
79
|
-
switch (theme) {
|
|
80
|
-
case "mona":
|
|
81
|
-
return comboBoxBaseVariants;
|
|
82
|
-
default:
|
|
83
|
-
return comboBoxBaseVariants;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const comboBoxTextInputThemeVariants = (theme) => {
|
|
87
|
-
switch (theme) {
|
|
88
|
-
case "mona":
|
|
89
|
-
return comboBoxTextInputVariants;
|
|
90
|
-
default:
|
|
91
|
-
return comboBoxTextInputVariants;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const comboBoxAffixContainerThemeVariants = (theme) => {
|
|
95
|
-
switch (theme) {
|
|
96
|
-
case "mona":
|
|
97
|
-
return comboBoxAffixContainerVariants;
|
|
98
|
-
default:
|
|
99
|
-
return comboBoxAffixContainerVariants;
|
|
100
|
-
}
|
|
101
|
-
};
|
|
86
|
+
const comboBoxAffixContainerThemeVariants = cva(`flex h-full flex-none items-center justify-center`);
|
|
102
87
|
|
|
103
88
|
class ComboBoxComponent {
|
|
104
89
|
#destroyRef;
|
|
@@ -108,7 +93,6 @@ class ComboBoxComponent {
|
|
|
108
93
|
#listService;
|
|
109
94
|
#navigatedValue;
|
|
110
95
|
#popupRef;
|
|
111
|
-
#themeService;
|
|
112
96
|
#userNavigatedViaArrows;
|
|
113
97
|
constructor() {
|
|
114
98
|
this.#destroyRef = inject(DestroyRef);
|
|
@@ -119,7 +103,6 @@ class ComboBoxComponent {
|
|
|
119
103
|
this.#navigatedValue = linkedSignal(() => this.value(), /* @ts-ignore */
|
|
120
104
|
...(ngDevMode ? [{ debugName: "#navigatedValue" }] : /* istanbul ignore next */ []));
|
|
121
105
|
this.#popupRef = this.#dropdownService.popupRef;
|
|
122
|
-
this.#themeService = inject(ThemeService);
|
|
123
106
|
this.#userNavigatedViaArrows = signal(false, /* @ts-ignore */
|
|
124
107
|
...(ngDevMode ? [{ debugName: "#userNavigatedViaArrows" }] : /* istanbul ignore next */ []));
|
|
125
108
|
this.activeDescendant = computed(() => {
|
|
@@ -128,18 +111,16 @@ class ComboBoxComponent {
|
|
|
128
111
|
}, /* @ts-ignore */
|
|
129
112
|
...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
|
|
130
113
|
this.affixClass = computed(() => {
|
|
131
|
-
|
|
132
|
-
return comboBoxAffixContainerThemeVariants(theme)();
|
|
114
|
+
return comboBoxAffixContainerThemeVariants();
|
|
133
115
|
}, /* @ts-ignore */
|
|
134
116
|
...(ngDevMode ? [{ debugName: "affixClass" }] : /* istanbul ignore next */ []));
|
|
135
117
|
this.baseClass = computed(() => {
|
|
136
|
-
const theme = this.#themeService.theme();
|
|
137
118
|
const disabled = this.disabled();
|
|
138
119
|
const focused = this.#popupRef() != null;
|
|
139
120
|
const invalid = this.invalidState();
|
|
140
121
|
const rounded = this.rounded();
|
|
141
122
|
const size = this.size();
|
|
142
|
-
const variantClass = comboBoxBaseThemeVariants(
|
|
123
|
+
const variantClass = comboBoxBaseThemeVariants({ disabled, focused, invalid, rounded, size });
|
|
143
124
|
const userClass = this.userClass();
|
|
144
125
|
return twMerge(variantClass, userClass);
|
|
145
126
|
}, /* @ts-ignore */
|
|
@@ -156,9 +137,8 @@ class ComboBoxComponent {
|
|
|
156
137
|
this.headerTemplate = contentChild(DropdownHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "headerTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
157
138
|
this.id = createElementControlId();
|
|
158
139
|
this.inputClass = computed(() => {
|
|
159
|
-
const theme = this.#themeService.theme();
|
|
160
140
|
const rounded = this.rounded();
|
|
161
|
-
return comboBoxTextInputThemeVariants(
|
|
141
|
+
return comboBoxTextInputThemeVariants({ rounded });
|
|
162
142
|
}, /* @ts-ignore */
|
|
163
143
|
...(ngDevMode ? [{ debugName: "inputClass" }] : /* istanbul ignore next */ []));
|
|
164
144
|
this.invalidState = computed(() => this.invalid() || (this.required() && this.touched() && this.value() == null), /* @ts-ignore */
|
|
@@ -166,11 +146,10 @@ class ComboBoxComponent {
|
|
|
166
146
|
this.itemTemplate = contentChild(DropdownItemTemplateDirective, { ...(ngDevMode ? { debugName: "itemTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
167
147
|
this.listId = createElementControlId();
|
|
168
148
|
this.listPopupClass = computed(() => {
|
|
169
|
-
const theme = this.#themeService.theme();
|
|
170
149
|
const rounded = this.rounded();
|
|
171
150
|
const size = this.size();
|
|
172
151
|
const userClass = this.popupClass();
|
|
173
|
-
const variantClass = dropdownPopupThemeVariants(
|
|
152
|
+
const variantClass = dropdownPopupThemeVariants({ rounded, size });
|
|
174
153
|
return twMerge(variantClass, userClass);
|
|
175
154
|
}, /* @ts-ignore */
|
|
176
155
|
...(ngDevMode ? [{ debugName: "listPopupClass" }] : /* istanbul ignore next */ []));
|
|
@@ -616,7 +595,7 @@ class ComboBoxComponent {
|
|
|
616
595
|
}
|
|
617
596
|
}
|
|
618
597
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: ComboBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
619
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ComboBoxComponent, isStandalone: true, selector: "mona-combo-box", inputs: { allowCustomValue: { classPropertyName: "allowCustomValue", publicName: "allowCustomValue", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, itemDisabled: { classPropertyName: "itemDisabled", publicName: "itemDisabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", disabled: "disabledChange", open: "open", opened: "opened", touch: "touch", valueAdd: "valueAdd", value: "valueChange" }, host: { properties: { "attr.aria-disabled": "disabled() ? true : undefined", "attr.aria-invalid": "invalidState() ? true : undefined", "attr.aria-readonly": "readonly() ? true : undefined", "attr.aria-required": "required() ? true : undefined", "attr.data-disabled": "disabled()", "attr.data-invalid": "invalidState() || null", "attr.tabindex": "-1", "class": "baseClass()" } }, providers: [
|
|
598
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: ComboBoxComponent, isStandalone: true, selector: "mona-combo-box", inputs: { allowCustomValue: { classPropertyName: "allowCustomValue", publicName: "allowCustomValue", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, itemDisabled: { classPropertyName: "itemDisabled", publicName: "itemDisabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, popupClass: { classPropertyName: "popupClass", publicName: "popupClass", isSignal: true, isRequired: false, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: false, transformFunction: null }, popupWidth: { classPropertyName: "popupWidth", publicName: "popupWidth", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, textField: { classPropertyName: "textField", publicName: "textField", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, valueField: { classPropertyName: "valueField", publicName: "valueField", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", disabled: "disabledChange", open: "open", opened: "opened", touch: "touch", valueAdd: "valueAdd", value: "valueChange" }, host: { properties: { "attr.aria-disabled": "disabled() ? true : undefined", "attr.aria-invalid": "invalidState() ? true : undefined", "attr.aria-readonly": "readonly() ? true : undefined", "attr.aria-required": "required() ? true : undefined", "attr.data-disabled": "disabled() || null", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly() || null", "attr.tabindex": "-1", "class": "baseClass()" } }, providers: [
|
|
620
599
|
ListService,
|
|
621
600
|
DropdownService,
|
|
622
601
|
DropdownListService,
|
|
@@ -665,8 +644,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
665
644
|
"[attr.aria-invalid]": "invalidState() ? true : undefined",
|
|
666
645
|
"[attr.aria-readonly]": "readonly() ? true : undefined",
|
|
667
646
|
"[attr.aria-required]": "required() ? true : undefined",
|
|
668
|
-
"[attr.data-disabled]": "disabled()",
|
|
647
|
+
"[attr.data-disabled]": "disabled() || null",
|
|
669
648
|
"[attr.data-invalid]": "invalidState() || null",
|
|
649
|
+
"[attr.data-readonly]": "readonly() || null",
|
|
670
650
|
"[attr.tabindex]": "-1",
|
|
671
651
|
"[class]": "baseClass()"
|
|
672
652
|
}, template: "@if (prefixTemplate()) {\n <span [class]=\"affixClass()\">\n <ng-container [ngTemplateOutlet]=\"prefixTemplate()\"></ng-container>\n </span>\n}\n\n<input\n monaTextBox\n [class]=\"inputClass()\"\n [disabled]=\"disabled()\"\n [id]=\"id\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"readonly()\"\n [required]=\"required()\"\n [ngModel]=\"comboBoxValue()\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-autocomplete]=\"'list'\"\n [attr.aria-busy]=\"loading()\"\n [attr.aria-controls]=\"listId\"\n [attr.aria-describedby]=\"ariaDescribedBy() || undefined\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-invalid]=\"invalidState() || undefined\"\n [attr.aria-label]=\"effectiveAriaLabel() || undefined\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || undefined\"\n role=\"combobox\"\n (ngModelChange)=\"comboBoxValue$.next($event)\"\n (blur)=\"onInputBlur()\" />\n\n@if (showClearButton() && selectedListItem() && !loading()) {\n <mona-indicator-icon\n preset=\"clear\"\n [interactive]=\"true\"\n label=\"Clear\"\n (activate)=\"onValueClear($event)\"></mona-indicator-icon>\n}\n\n@if (loading()) {\n <mona-indicator-icon preset=\"loading\" [size]=\"12\"></mona-indicator-icon>\n}\n\n<mona-indicator-icon preset=\"dropdown\" [size]=\"18\"></mona-indicator-icon>\n\n<span monaDropdownLiveRegion></span>\n\n<ng-template #popupTemplate>\n <div [class]=\"listPopupClass()\">\n <mona-list (itemSelect)=\"onItemSelect($event)\" [focusOnMount]=\"false\" [size]=\"size()\" [listId]=\"listId\">\n @if (footerTemplate()) {\n <ng-template monaListFooterTemplate>\n <ng-container [ngTemplateOutlet]=\"footerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (groupHeaderTemplate()) {\n <ng-template monaListGroupHeaderTemplate let-group>\n <ng-container\n [ngTemplateOutlet]=\"groupHeaderTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: group }\"></ng-container>\n </ng-template>\n }\n @if (headerTemplate()) {\n <ng-template monaListHeaderTemplate>\n <ng-container [ngTemplateOutlet]=\"headerTemplate()\"></ng-container>\n </ng-template>\n }\n @if (itemTemplate()) {\n <ng-template monaListItemTemplate let-dataItem>\n <ng-container\n [ngTemplateOutlet]=\"itemTemplate()\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"></ng-container>\n </ng-template>\n }\n @if (noDataTemplate()) {\n <ng-template monaListNoDataTemplate>\n <ng-container [ngTemplateOutlet]=\"noDataTemplate()\"></ng-container>\n </ng-template>\n }\n </mona-list>\n </div>\n</ng-template>\n" }]
|
|
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Directive, Pipe, Injectable } from '@angular/core';
|
|
3
3
|
import { toImmutableSet, where, select, sequence } from '@mirei/ts-collections';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { themeOverlaySurfaceClasses } from '@nanahoshi/mona-ui/internal';
|
|
5
6
|
import { Subject } from 'rxjs';
|
|
6
7
|
|
|
7
8
|
class DateInputPrefixTemplateDirective {
|
|
@@ -46,10 +47,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
46
47
|
}]
|
|
47
48
|
}] });
|
|
48
49
|
|
|
49
|
-
const
|
|
50
|
-
bg-background shadow-md text-foreground
|
|
51
|
-
border border-input-border
|
|
50
|
+
const datePopupThemeVariants = cva(`
|
|
52
51
|
h-full overflow-auto
|
|
52
|
+
[scrollbar-color:var(--color-scrollbar-thumb)_var(--color-scrollbar-track)] [scrollbar-width:thin]
|
|
53
|
+
${themeOverlaySurfaceClasses} text-foreground
|
|
54
|
+
border border-border shadow-(--shadow-overlay)
|
|
55
|
+
[&_mona-calendar]:[background-color:var(--mona-date-popup-calendar-background,var(--mona-calendar-background))]!
|
|
56
|
+
[&_mona-calendar]:[background-image:var(--mona-date-popup-calendar-background-image,var(--mona-effect-raised-background-image))]!
|
|
57
|
+
[&_mona-calendar]:[backdrop-filter:var(--mona-date-popup-calendar-backdrop-filter,var(--mona-effect-raised-backdrop-filter))]!
|
|
58
|
+
[&_mona-calendar]:[-webkit-backdrop-filter:var(--mona-date-popup-calendar-backdrop-filter,var(--mona-effect-raised-backdrop-filter))]!
|
|
53
59
|
[&_mona-calendar]:border-none
|
|
54
60
|
[&_mona-calendar]:shadow-none
|
|
55
61
|
`, {
|
|
@@ -73,15 +79,6 @@ const datePopupVariants = cva(`
|
|
|
73
79
|
}
|
|
74
80
|
});
|
|
75
81
|
|
|
76
|
-
const datePopupThemeVariants = (theme) => {
|
|
77
|
-
switch (theme) {
|
|
78
|
-
case "mona":
|
|
79
|
-
return datePopupVariants;
|
|
80
|
-
default:
|
|
81
|
-
return datePopupVariants;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
82
|
class CalendarService {
|
|
86
83
|
constructor() {
|
|
87
84
|
this.keydown$ = new Subject();
|