@nanahoshi/mona-ui 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +38 -53
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +19 -53
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +15 -26
- package/fesm2022/nanahoshi-mona-ui-button.mjs +67 -68
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +53 -149
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +48 -95
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +35 -45
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +9 -23
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +26 -77
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +16 -38
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +41 -46
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +32 -52
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +9 -12
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +40 -27
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +51 -51
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +40 -153
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +32 -53
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +7 -12
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +59 -219
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +24 -75
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +11 -44
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +11 -41
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B2ETh-uI.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DZk18LJC.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-C7WKhhig.mjs → nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs} +9 -16
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-BRiY0CDX.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +15 -44
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BrYpFMyF.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs} +11 -20
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-T9Bj98kl.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +109 -393
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +26 -56
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +31 -122
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +4 -26
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +5 -18
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +48 -154
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +35 -62
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +24 -108
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +37 -63
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +21 -73
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +8 -30
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +29 -50
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +36 -108
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +19 -60
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +47 -92
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +53 -144
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +54 -110
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +7 -20
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +15 -50
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +28 -91
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +37 -58
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +35 -107
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +22 -30
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +40 -61
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +41 -27
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +35 -99
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +13 -41
- package/fesm2022/nanahoshi-mona-ui-window.mjs +29 -108
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +2 -1
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +6 -9
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -5
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +2 -3
- package/types/nanahoshi-mona-ui-grid.d.ts +14 -15
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +6 -7
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +8 -11
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +12 -13
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +14 -16
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +4 -6
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +10 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
|
@@ -5,27 +5,46 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
5
5
|
import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
6
6
|
import * as i1 from '@nanahoshi/mona-ui/dropdowns';
|
|
7
7
|
import { DropdownService, dropdownPopupThemeVariants, DropdownPopupInputToken, DropdownPopupHandlerDirective } from '@nanahoshi/mona-ui/dropdowns';
|
|
8
|
-
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
8
|
+
import { themeControlSurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
9
9
|
import { TextBoxComponent, TextBoxSuffixTemplateDirective } from '@nanahoshi/mona-ui/text-box';
|
|
10
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
11
10
|
import { TimeSelectorComponent } from '@nanahoshi/mona-ui/time-selector';
|
|
12
11
|
import { DateTime } from 'luxon';
|
|
13
12
|
import { fromEvent } from 'rxjs';
|
|
14
13
|
import { twMerge } from 'tailwind-merge';
|
|
15
14
|
import { cva } from 'class-variance-authority';
|
|
16
15
|
|
|
17
|
-
const
|
|
18
|
-
flex items-center
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const timePickerBaseThemeVariants = cva(`
|
|
17
|
+
flex w-full items-center
|
|
18
|
+
${themeControlSurfaceClasses} text-foreground
|
|
19
|
+
border border-input-border shadow-(--shadow-control)
|
|
20
|
+
outline-none
|
|
21
|
+
|
|
22
|
+
data-[disabled='true']:pointer-events-none
|
|
23
|
+
data-[disabled='true']:cursor-not-allowed
|
|
24
|
+
data-[disabled='true']:border-disabled-border
|
|
25
|
+
data-[disabled='true']:bg-disabled-background
|
|
26
|
+
data-[disabled='true']:text-disabled-foreground
|
|
27
|
+
data-[disabled='true']:shadow-none
|
|
28
|
+
data-[readonly='true']:cursor-default
|
|
29
|
+
|
|
30
|
+
focus-within:border-focus-indicator
|
|
31
|
+
focus-within:ring-2 focus-within:ring-focus-indicator/35
|
|
32
|
+
|
|
21
33
|
data-[invalid='true']:border-error
|
|
22
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/
|
|
34
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
35
|
+
data-[invalid='true']:focus-within:border-error
|
|
36
|
+
data-[invalid='true']:focus-within:ring-error/35
|
|
37
|
+
|
|
23
38
|
[&_mona-text-box]:h-full
|
|
24
39
|
[&_mona-text-box]:border-none
|
|
40
|
+
[&_mona-text-box]:shadow-none
|
|
41
|
+
[&_mona-text-box]:focus-within:ring-0
|
|
42
|
+
[&_mona-text-box[data-invalid='true']]:ring-0
|
|
25
43
|
`, {
|
|
26
44
|
variants: {
|
|
27
45
|
focused: {
|
|
28
|
-
true:
|
|
46
|
+
true: "border-focus-indicator ring-2 ring-focus-indicator/35",
|
|
47
|
+
false: ""
|
|
29
48
|
},
|
|
30
49
|
rounded: {
|
|
31
50
|
full: "rounded-full",
|
|
@@ -39,36 +58,30 @@ const timePickerBaseVariants = cva(`
|
|
|
39
58
|
medium: "h-9 text-sm",
|
|
40
59
|
small: "h-8 text-xs"
|
|
41
60
|
}
|
|
42
|
-
}
|
|
61
|
+
},
|
|
62
|
+
compoundVariants: [
|
|
63
|
+
{
|
|
64
|
+
focused: true,
|
|
65
|
+
class: "data-[invalid='true']:border-error data-[invalid='true']:ring-error/35"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
43
68
|
});
|
|
44
69
|
|
|
45
|
-
const timePickerBaseThemeVariants = (theme) => {
|
|
46
|
-
switch (theme) {
|
|
47
|
-
case "mona":
|
|
48
|
-
return timePickerBaseVariants;
|
|
49
|
-
default:
|
|
50
|
-
return timePickerBaseVariants;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
70
|
class TimePickerComponent {
|
|
55
71
|
#destroyRef;
|
|
56
72
|
#dropdownService;
|
|
57
73
|
#hostElementRef;
|
|
58
74
|
#id;
|
|
59
|
-
#themeService;
|
|
60
75
|
constructor() {
|
|
61
76
|
this.#destroyRef = inject(DestroyRef);
|
|
62
77
|
this.#dropdownService = inject(DropdownService);
|
|
63
78
|
this.#hostElementRef = inject(ElementRef);
|
|
64
79
|
this.#id = createElementControlId();
|
|
65
|
-
this.#themeService = inject(ThemeService);
|
|
66
80
|
this.baseClass = computed(() => {
|
|
67
|
-
const theme = this.#themeService.theme();
|
|
68
81
|
const focused = this.#dropdownService.popupRef() != null;
|
|
69
82
|
const rounded = this.rounded();
|
|
70
83
|
const size = this.size();
|
|
71
|
-
const variantClass = timePickerBaseThemeVariants(
|
|
84
|
+
const variantClass = timePickerBaseThemeVariants({ focused, rounded, size });
|
|
72
85
|
const userClass = this.userClass();
|
|
73
86
|
return twMerge(variantClass, userClass);
|
|
74
87
|
}, /* @ts-ignore */
|
|
@@ -105,11 +118,10 @@ class TimePickerComponent {
|
|
|
105
118
|
this.navigatedDate = signal(new Date(), /* @ts-ignore */
|
|
106
119
|
...(ngDevMode ? [{ debugName: "navigatedDate" }] : /* istanbul ignore next */ []));
|
|
107
120
|
this.pickerPopupClass = computed(() => {
|
|
108
|
-
const theme = this.#themeService.theme();
|
|
109
121
|
const rounded = this.rounded();
|
|
110
122
|
const size = this.size();
|
|
111
123
|
const userClass = this.popupClass();
|
|
112
|
-
const variantClass = dropdownPopupThemeVariants(
|
|
124
|
+
const variantClass = dropdownPopupThemeVariants({ rounded, size });
|
|
113
125
|
return twMerge(variantClass, userClass);
|
|
114
126
|
}, /* @ts-ignore */
|
|
115
127
|
...(ngDevMode ? [{ debugName: "pickerPopupClass" }] : /* istanbul ignore next */ []));
|
|
@@ -402,14 +414,14 @@ class TimePickerComponent {
|
|
|
402
414
|
this.currentDateString.set(dateString);
|
|
403
415
|
}
|
|
404
416
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
405
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: TimePickerComponent, isStandalone: true, selector: "mona-time-picker", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, hourFormat: { classPropertyName: "hourFormat", publicName: "hourFormat", isSignal: true, isRequired: false, transformFunction: null }, hourStep: { classPropertyName: "hourStep", publicName: "hourStep", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", 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 }, readonlyInput: { classPropertyName: "readonlyInput", publicName: "readonlyInput", 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 }, secondStep: { classPropertyName: "secondStep", publicName: "secondStep", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", open: "open", opened: "opened", touch: "touch", value: "valueChange" }, host: { listeners: { "blur": "onTimeInputBlur()" }, properties: { "attr.tabindex": "disabled() ? null : -1", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-expanded": "expanded()", "attr.data-invalid": "invalidState() || null", "class": "baseClass()" } }, providers: [
|
|
417
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: TimePickerComponent, isStandalone: true, selector: "mona-time-picker", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, hourFormat: { classPropertyName: "hourFormat", publicName: "hourFormat", isSignal: true, isRequired: false, transformFunction: null }, hourStep: { classPropertyName: "hourStep", publicName: "hourStep", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", 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 }, readonlyInput: { classPropertyName: "readonlyInput", publicName: "readonlyInput", 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 }, secondStep: { classPropertyName: "secondStep", publicName: "secondStep", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", closed: "closed", open: "open", opened: "opened", touch: "touch", value: "valueChange" }, host: { listeners: { "blur": "onTimeInputBlur()" }, properties: { "attr.tabindex": "disabled() ? null : -1", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.data-disabled": "disabled() || null", "attr.data-expanded": "expanded()", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly() || null", "class": "baseClass()" } }, providers: [
|
|
406
418
|
DropdownService,
|
|
407
419
|
{
|
|
408
420
|
provide: DropdownPopupInputToken,
|
|
409
421
|
useExisting: forwardRef(() => TimePickerComponent),
|
|
410
422
|
multi: false
|
|
411
423
|
}
|
|
412
|
-
], viewQueries: [{ propertyName: "timePopupTemplateRef", first: true, predicate: ["timePopupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }], ngImport: i0, template: "<mona-text-box\n [disabled]=\"disabled()\"\n [readonly]=\"readonly() || readonlyInput()\"\n [required]=\"required()\"\n [value]=\"currentDateString()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalid()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"onDateStringEdit($event)\"\n (inputBlur)=\"onTimeInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"h-full w-auto
|
|
424
|
+
], viewQueries: [{ propertyName: "timePopupTemplateRef", first: true, predicate: ["timePopupTemplate"], descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.DropdownPopupHandlerDirective }], ngImport: i0, template: "<mona-text-box\n [disabled]=\"disabled()\"\n [readonly]=\"readonly() || readonlyInput()\"\n [required]=\"required()\"\n [value]=\"currentDateString()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalid()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"onDateStringEdit($event)\"\n (inputBlur)=\"onTimeInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"'Open time picker'\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"disabled() || readonly()\"\n [tabindex]=\"-1\">\n <i class=\"ri-time-line\"></i>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #timePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n aria-label=\"Time picker\"\n cdkTrapFocus>\n <mona-time-selector\n [value]=\"value()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [max]=\"max()\"\n [min]=\"min()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [hourFormat]=\"hourFormat()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\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: TimeSelectorComponent, selector: "mona-time-selector", inputs: ["ariaLabel", "disabled", "focusOnMount", "footer", "hourFormat", "hourStep", "invalid", "max", "min", "minuteStep", "readonly", "required", "rounded", "secondStep", "showSeconds", "size", "touched", "value"], outputs: ["touch", "valueChange"] }, { kind: "component", type: TextBoxComponent, selector: "mona-text-box", inputs: ["clearButton", "disabled", "inputAttributes", "inputClass", "inputStyle", "invalid", "placeholder", "readonly", "required", "rounded", "size", "touched", "type", "class", "value"], outputs: ["inputBlur", "inputFocus", "touch", "valueChange"] }, { kind: "directive", type: TextBoxSuffixTemplateDirective, selector: "ng-template[monaTextBoxSuffixTemplate]" }, { kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }] }); }
|
|
413
425
|
}
|
|
414
426
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TimePickerComponent, decorators: [{
|
|
415
427
|
type: Component,
|
|
@@ -423,11 +435,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
423
435
|
], imports: [ButtonDirective, TimeSelectorComponent, TextBoxComponent, TextBoxSuffixTemplateDirective, CdkTrapFocus], hostDirectives: [DropdownPopupHandlerDirective], host: {
|
|
424
436
|
"[attr.tabindex]": "disabled() ? null : -1",
|
|
425
437
|
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
438
|
+
"[attr.data-disabled]": "disabled() || null",
|
|
426
439
|
"[attr.data-expanded]": "expanded()",
|
|
427
440
|
"[attr.data-invalid]": "invalidState() || null",
|
|
441
|
+
"[attr.data-readonly]": "readonly() || null",
|
|
428
442
|
"[class]": "baseClass()",
|
|
429
443
|
"(blur)": "onTimeInputBlur()"
|
|
430
|
-
}, template: "<mona-text-box\n [disabled]=\"disabled()\"\n [readonly]=\"readonly() || readonlyInput()\"\n [required]=\"required()\"\n [value]=\"currentDateString()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalid()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"onDateStringEdit($event)\"\n (inputBlur)=\"onTimeInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"h-full w-auto
|
|
444
|
+
}, template: "<mona-text-box\n [disabled]=\"disabled()\"\n [readonly]=\"readonly() || readonlyInput()\"\n [required]=\"required()\"\n [value]=\"currentDateString()\"\n [inputAttributes]=\"inputAttributes()\"\n [invalid]=\"invalid()\"\n [placeholder]=\"placeholder()\"\n [rounded]=\"rounded()\"\n [size]=\"size()\"\n [touched]=\"touched()\"\n [clearButton]=\"showClearButton()\"\n (valueChange)=\"onDateStringEdit($event)\"\n (inputBlur)=\"onTimeInputBlur()\">\n <ng-template monaTextBoxSuffixTemplate>\n <button\n monaButton\n look=\"ghost\"\n [iconOnly]=\"true\"\n [size]=\"size()\"\n [rounded]=\"'none'\"\n (click)=\"onTimeInputButtonClick()\"\n class=\"aspect-square h-full w-auto\"\n [attr.aria-label]=\"'Open time picker'\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"popupId\"\n [disabled]=\"disabled() || readonly()\"\n [tabindex]=\"-1\">\n <i class=\"ri-time-line\"></i>\n </button>\n </ng-template>\n</mona-text-box>\n\n<ng-template #timePopupTemplate>\n <div\n [class]=\"pickerPopupClass()\"\n [id]=\"popupId\"\n aria-modal=\"true\"\n role=\"dialog\"\n aria-label=\"Time picker\"\n cdkTrapFocus>\n <mona-time-selector\n [value]=\"value()\"\n (valueChange)=\"onTimeSelectorValueChange($event)\"\n [max]=\"max()\"\n [min]=\"min()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [hourFormat]=\"hourFormat()\"\n [hourStep]=\"hourStep()\"\n [minuteStep]=\"minuteStep()\"\n [secondStep]=\"secondStep()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [showSeconds]=\"showSeconds()\"></mona-time-selector>\n </div>\n</ng-template>\n" }]
|
|
431
445
|
}], ctorParameters: () => [], propDecorators: { timePopupTemplateRef: [{ type: i0.ViewChild, args: ["timePopupTemplate", { isSignal: true }] }], close: [{ type: i0.Output, args: ["close"] }], closed: [{ type: i0.Output, args: ["closed"] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], hourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourFormat", required: false }] }], hourStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "hourStep", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], open: [{ type: i0.Output, args: ["open"] }], opened: [{ type: i0.Output, args: ["opened"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], popupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupClass", required: false }] }], popupHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupHeight", required: false }] }], popupWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "popupWidth", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], readonlyInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonlyInput", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], secondStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "secondStep", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], touch: [{ type: i0.Output, args: ["touch"] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
432
446
|
|
|
433
447
|
/*
|
|
@@ -6,20 +6,19 @@ import { ButtonDirective } from '@nanahoshi/mona-ui/button';
|
|
|
6
6
|
import { PreventableEvent } from '@nanahoshi/mona-ui/common';
|
|
7
7
|
import { TimeSelectorService, generateMinuteSet, generateSecondSet, generateHourSet, TimeLimiterPipe } from '@nanahoshi/mona-ui/date-input';
|
|
8
8
|
import { rxTimeout, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
9
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
10
9
|
import { DateTime } from 'luxon';
|
|
11
10
|
import { tap, fromEvent } from 'rxjs';
|
|
12
11
|
import { filter } from 'rxjs/operators';
|
|
13
12
|
import { cva } from 'class-variance-authority';
|
|
14
13
|
|
|
15
|
-
const
|
|
16
|
-
flex
|
|
14
|
+
const timeSelectorBaseThemeVariants = cva(`
|
|
15
|
+
flex h-full w-full flex-col overflow-hidden
|
|
17
16
|
data-[invalid='true']:border data-[invalid='true']:border-error
|
|
18
|
-
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/
|
|
17
|
+
data-[invalid='true']:ring-2 data-[invalid='true']:ring-error/35
|
|
19
18
|
`, {
|
|
20
19
|
variants: {
|
|
21
20
|
disabled: {
|
|
22
|
-
true: "
|
|
21
|
+
true: "pointer-events-none cursor-not-allowed text-disabled-foreground",
|
|
23
22
|
false: ""
|
|
24
23
|
},
|
|
25
24
|
size: {
|
|
@@ -29,32 +28,37 @@ const timeSelectorBaseVariants = cva(`
|
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
|
-
const
|
|
33
|
-
w-full
|
|
31
|
+
const timeSelectorFooterThemeVariants = cva(`
|
|
32
|
+
flex w-full items-center justify-end px-1 py-1
|
|
33
|
+
bg-surface-muted
|
|
34
|
+
border-0 border-t border-border-subtle
|
|
34
35
|
`);
|
|
35
|
-
const
|
|
36
|
-
flex
|
|
37
|
-
border-b border-input-border
|
|
36
|
+
const timeSelectorHeaderThemeVariants = cva(`
|
|
37
|
+
flex
|
|
38
38
|
text-xs font-semibold uppercase
|
|
39
|
+
bg-surface-muted text-foreground
|
|
40
|
+
border-b border-border-subtle
|
|
39
41
|
[&>div]:flex-1 [&>div]:py-2 [&>div]:text-center
|
|
40
42
|
`);
|
|
41
|
-
const
|
|
43
|
+
const timeSelectorInfoContainerThemeVariants = cva(`
|
|
42
44
|
flex items-center justify-between
|
|
43
|
-
px-2 py-1
|
|
45
|
+
px-2 py-1
|
|
46
|
+
border-b border-border-subtle
|
|
44
47
|
[&>span]:text-xs [&>span]:font-medium [&>span]:select-none
|
|
45
48
|
`);
|
|
46
|
-
const
|
|
47
|
-
|
|
49
|
+
const timeSelectorListContainerThemeVariants = cva(`
|
|
50
|
+
relative flex w-full flex-row overflow-hidden
|
|
48
51
|
`);
|
|
49
|
-
const
|
|
50
|
-
flex-1 overflow-y-auto
|
|
52
|
+
const timeSelectorListThemeVariants = cva(`
|
|
53
|
+
h-full flex-1 overflow-y-auto
|
|
54
|
+
[scrollbar-color:var(--color-scrollbar-thumb)_var(--color-scrollbar-track)] [scrollbar-width:thin]
|
|
51
55
|
scrollbar-hide scroll-smooth
|
|
52
56
|
snap-y snap-mandatory
|
|
53
57
|
scrollbar-width:none
|
|
54
58
|
select-none outline-none
|
|
55
59
|
[&::-webkit-scrollbar]:hidden
|
|
56
|
-
focus-visible:bg-
|
|
57
|
-
focus-within:bg-
|
|
60
|
+
focus-visible:bg-(--color-focus-surface)
|
|
61
|
+
focus-within:bg-(--color-focus-surface)
|
|
58
62
|
`, {
|
|
59
63
|
variants: {
|
|
60
64
|
size: {
|
|
@@ -64,13 +68,14 @@ const timeSelectorListVariants = cva(`
|
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
});
|
|
67
|
-
const
|
|
68
|
-
flex items-center justify-center
|
|
69
|
-
|
|
71
|
+
const timeSelectorListItemThemeVariants = cva(`
|
|
72
|
+
relative z-10 flex cursor-pointer snap-center items-center justify-center
|
|
73
|
+
text-foreground
|
|
74
|
+
hover:bg-hover active:bg-active
|
|
70
75
|
`, {
|
|
71
76
|
variants: {
|
|
72
77
|
selected: {
|
|
73
|
-
true: "bg-
|
|
78
|
+
true: "bg-active font-medium text-foreground hover:bg-active",
|
|
74
79
|
false: ""
|
|
75
80
|
},
|
|
76
81
|
size: {
|
|
@@ -84,79 +89,19 @@ const timeSelectorListItemVariants = cva(`
|
|
|
84
89
|
}
|
|
85
90
|
});
|
|
86
91
|
|
|
87
|
-
const timeSelectorBaseThemeVariants = (theme) => {
|
|
88
|
-
switch (theme) {
|
|
89
|
-
case "mona":
|
|
90
|
-
return timeSelectorBaseVariants;
|
|
91
|
-
default:
|
|
92
|
-
return timeSelectorBaseVariants;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const timeSelectorFooterThemeVariants = (theme) => {
|
|
96
|
-
switch (theme) {
|
|
97
|
-
case "mona":
|
|
98
|
-
return timeSelectorFooterVariants;
|
|
99
|
-
default:
|
|
100
|
-
return timeSelectorFooterVariants;
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const timeSelectorHeaderThemeVariants = (theme) => {
|
|
104
|
-
switch (theme) {
|
|
105
|
-
case "mona":
|
|
106
|
-
return timeSelectorHeaderVariants;
|
|
107
|
-
default:
|
|
108
|
-
return timeSelectorHeaderVariants;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
const timeSelectorInfoContainerThemeVariants = (theme) => {
|
|
112
|
-
switch (theme) {
|
|
113
|
-
case "mona":
|
|
114
|
-
return timeSelectorInfoContainerVariants;
|
|
115
|
-
default:
|
|
116
|
-
return timeSelectorInfoContainerVariants;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
const timeSelectorListContainerThemeVariants = (theme) => {
|
|
120
|
-
switch (theme) {
|
|
121
|
-
case "mona":
|
|
122
|
-
return timeSelectorListContainerVariants;
|
|
123
|
-
default:
|
|
124
|
-
return timeSelectorListContainerVariants;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
const timeSelectorListThemeVariants = (theme) => {
|
|
128
|
-
switch (theme) {
|
|
129
|
-
case "mona":
|
|
130
|
-
return timeSelectorListVariants;
|
|
131
|
-
default:
|
|
132
|
-
return timeSelectorListVariants;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const timeSelectorListItemThemeVariants = (theme) => {
|
|
136
|
-
switch (theme) {
|
|
137
|
-
case "mona":
|
|
138
|
-
return timeSelectorListItemVariants;
|
|
139
|
-
default:
|
|
140
|
-
return timeSelectorListItemVariants;
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
|
|
144
92
|
class TimeSelectorItemDirective {
|
|
145
93
|
#destroyRef;
|
|
146
94
|
#host;
|
|
147
95
|
#scrollBehavior;
|
|
148
|
-
#themeService;
|
|
149
96
|
constructor() {
|
|
150
97
|
this.#destroyRef = inject(DestroyRef);
|
|
151
98
|
this.#host = inject((ElementRef));
|
|
152
99
|
this.#scrollBehavior = signal("instant", /* @ts-ignore */
|
|
153
100
|
...(ngDevMode ? [{ debugName: "#scrollBehavior" }] : /* istanbul ignore next */ []));
|
|
154
|
-
this.#themeService = inject(ThemeService);
|
|
155
101
|
this.baseClass = computed(() => {
|
|
156
|
-
const theme = this.#themeService.theme();
|
|
157
102
|
const selected = this.selected();
|
|
158
103
|
const size = this.size();
|
|
159
|
-
return timeSelectorListItemThemeVariants(
|
|
104
|
+
return timeSelectorListItemThemeVariants({ selected, size });
|
|
160
105
|
}, /* @ts-ignore */
|
|
161
106
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
162
107
|
this.selected = input.required(/* @ts-ignore */
|
|
@@ -200,10 +145,9 @@ class TimeSelectorListDirective {
|
|
|
200
145
|
return size === "small" ? 24 : size === "medium" ? 28 : 32; // TODO: Get rid of magic numbers
|
|
201
146
|
}, /* @ts-ignore */
|
|
202
147
|
...(ngDevMode ? [{ debugName: "#itemHeight" }] : /* istanbul ignore next */ []));
|
|
203
|
-
this.#themeService = inject(ThemeService);
|
|
204
148
|
this.baseClass = computed(() => {
|
|
205
|
-
const
|
|
206
|
-
return timeSelectorListThemeVariants(
|
|
149
|
+
const size = this.size();
|
|
150
|
+
return timeSelectorListThemeVariants({ size });
|
|
207
151
|
}, /* @ts-ignore */
|
|
208
152
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
209
153
|
this.listPadding = computed(() => {
|
|
@@ -220,7 +164,6 @@ class TimeSelectorListDirective {
|
|
|
220
164
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
221
165
|
}
|
|
222
166
|
#itemHeight;
|
|
223
|
-
#themeService;
|
|
224
167
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TimeSelectorListDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
225
168
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.6", type: TimeSelectorListDirective, isStandalone: true, selector: "ol[monaTimeSelectorList]", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, popupHeight: { classPropertyName: "popupHeight", publicName: "popupHeight", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "listbox" }, properties: { "class": "baseClass()", "style.padding-top.px": "listPadding()", "style.padding-bottom.px": "listPadding()", "attr.tabindex": "active() ? 0 : -1" } }, ngImport: i0 }); }
|
|
226
169
|
}
|
|
@@ -242,14 +185,12 @@ class TimeSelectorComponent {
|
|
|
242
185
|
#destroyRef;
|
|
243
186
|
#height;
|
|
244
187
|
#hostElementRef;
|
|
245
|
-
#themeService;
|
|
246
188
|
#timeSelectorService;
|
|
247
189
|
constructor() {
|
|
248
190
|
this.#destroyRef = inject(DestroyRef);
|
|
249
191
|
this.#height = signal(0, /* @ts-ignore */
|
|
250
192
|
...(ngDevMode ? [{ debugName: "#height" }] : /* istanbul ignore next */ []));
|
|
251
193
|
this.#hostElementRef = inject((ElementRef));
|
|
252
|
-
this.#themeService = inject(ThemeService);
|
|
253
194
|
this.#timeSelectorService = inject(TimeSelectorService, { optional: true });
|
|
254
195
|
this.amMeridiemVisible = computed(() => {
|
|
255
196
|
const min = this.min();
|
|
@@ -257,22 +198,19 @@ class TimeSelectorComponent {
|
|
|
257
198
|
}, /* @ts-ignore */
|
|
258
199
|
...(ngDevMode ? [{ debugName: "amMeridiemVisible" }] : /* istanbul ignore next */ []));
|
|
259
200
|
this.baseClass = computed(() => {
|
|
260
|
-
const theme = this.#themeService.theme();
|
|
261
201
|
const disabled = this.disabled();
|
|
262
|
-
return timeSelectorBaseThemeVariants(
|
|
202
|
+
return timeSelectorBaseThemeVariants({ disabled });
|
|
263
203
|
}, /* @ts-ignore */
|
|
264
204
|
...(ngDevMode ? [{ debugName: "baseClass" }] : /* istanbul ignore next */ []));
|
|
265
205
|
this.computedPopupHeight = this.#height.asReadonly();
|
|
266
206
|
this.focusedList = signal("hours", /* @ts-ignore */
|
|
267
207
|
...(ngDevMode ? [{ debugName: "focusedList" }] : /* istanbul ignore next */ []));
|
|
268
208
|
this.footerClass = computed(() => {
|
|
269
|
-
|
|
270
|
-
return timeSelectorFooterThemeVariants(theme)();
|
|
209
|
+
return timeSelectorFooterThemeVariants();
|
|
271
210
|
}, /* @ts-ignore */
|
|
272
211
|
...(ngDevMode ? [{ debugName: "footerClass" }] : /* istanbul ignore next */ []));
|
|
273
212
|
this.headerClass = computed(() => {
|
|
274
|
-
|
|
275
|
-
return timeSelectorHeaderThemeVariants(theme)();
|
|
213
|
+
return timeSelectorHeaderThemeVariants();
|
|
276
214
|
}, /* @ts-ignore */
|
|
277
215
|
...(ngDevMode ? [{ debugName: "headerClass" }] : /* istanbul ignore next */ []));
|
|
278
216
|
this.hour = computed(() => {
|
|
@@ -288,13 +226,11 @@ class TimeSelectorComponent {
|
|
|
288
226
|
this.hourListRef = viewChild.required("hourList", /* @ts-ignore */
|
|
289
227
|
...(ngDevMode ? [{ debugName: "hourListRef" }] : /* istanbul ignore next */ []));
|
|
290
228
|
this.infoContainerClass = computed(() => {
|
|
291
|
-
|
|
292
|
-
return timeSelectorInfoContainerThemeVariants(theme)();
|
|
229
|
+
return timeSelectorInfoContainerThemeVariants();
|
|
293
230
|
}, /* @ts-ignore */
|
|
294
231
|
...(ngDevMode ? [{ debugName: "infoContainerClass" }] : /* istanbul ignore next */ []));
|
|
295
232
|
this.listContainerClass = computed(() => {
|
|
296
|
-
|
|
297
|
-
return timeSelectorListContainerThemeVariants(theme)();
|
|
233
|
+
return timeSelectorListContainerThemeVariants();
|
|
298
234
|
}, /* @ts-ignore */
|
|
299
235
|
...(ngDevMode ? [{ debugName: "listContainerClass" }] : /* istanbul ignore next */ []));
|
|
300
236
|
this.maxDate = computed(() => {
|
|
@@ -2,17 +2,16 @@ import { DOCUMENT } from '@angular/common';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { inject, DestroyRef, Renderer2, computed, linkedSignal, viewChild, TemplateRef, input, output, afterRenderEffect, Component, ElementRef, EnvironmentInjector, signal, createComponent, Directive, ChangeDetectionStrategy } from '@angular/core';
|
|
4
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
5
|
+
import { themeOverlaySurfaceClasses, createElementControlId } from '@nanahoshi/mona-ui/internal';
|
|
6
6
|
import { PopupService, fadePopupAnimation } from '@nanahoshi/mona-ui/popup';
|
|
7
|
-
import { ThemeService } from '@nanahoshi/mona-ui/theme';
|
|
8
7
|
import { take, takeUntil, Subscription, fromEvent, tap } from 'rxjs';
|
|
9
8
|
import { cva } from 'class-variance-authority';
|
|
10
9
|
import { twMerge } from 'tailwind-merge';
|
|
11
10
|
|
|
12
|
-
const
|
|
13
|
-
flex items-center justify-center
|
|
14
|
-
|
|
15
|
-
shadow-
|
|
11
|
+
const tooltipBaseThemeVariants = cva(`
|
|
12
|
+
relative z-1 flex items-center justify-center
|
|
13
|
+
${themeOverlaySurfaceClasses} text-foreground
|
|
14
|
+
border border-border shadow-(--shadow-overlay)
|
|
16
15
|
`, {
|
|
17
16
|
variants: {
|
|
18
17
|
rounded: {
|
|
@@ -24,13 +23,11 @@ const tooltipBaseVariants = cva(`
|
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
});
|
|
27
|
-
const
|
|
28
|
-
absolute
|
|
26
|
+
const tooltipArrowThemeVariants = cva(`
|
|
27
|
+
absolute z-0 h-3 w-3 rotate-45 transform-center box-border
|
|
29
28
|
pointer-events-none
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
border border-border
|
|
29
|
+
${themeOverlaySurfaceClasses}
|
|
30
|
+
border border-border shadow-(--shadow-overlay)
|
|
34
31
|
|
|
35
32
|
data-[position="top"]:-bottom-1.5
|
|
36
33
|
data-[position="top"]:border-t-0
|
|
@@ -53,23 +50,6 @@ const tooltipArrowVariants = cva(`
|
|
|
53
50
|
data-[position="right"]:[clip-path:inset(1px_1px_0_0)]
|
|
54
51
|
`);
|
|
55
52
|
|
|
56
|
-
const tooltipBaseThemeVariants = (theme) => {
|
|
57
|
-
switch (theme) {
|
|
58
|
-
case "mona":
|
|
59
|
-
return tooltipBaseVariants;
|
|
60
|
-
default:
|
|
61
|
-
return tooltipBaseVariants;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const tooltipArrowThemeVariants = (theme) => {
|
|
65
|
-
switch (theme) {
|
|
66
|
-
case "mona":
|
|
67
|
-
return tooltipArrowVariants;
|
|
68
|
-
default:
|
|
69
|
-
return tooltipArrowVariants;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
|
|
73
53
|
/**
|
|
74
54
|
* Derives the tooltip arrow position from a ConnectionPositionPair.
|
|
75
55
|
* This function determines where the arrow should be positioned based on
|
|
@@ -143,7 +123,6 @@ class TooltipComponent {
|
|
|
143
123
|
#document;
|
|
144
124
|
#popupService;
|
|
145
125
|
#renderer;
|
|
146
|
-
#themeService;
|
|
147
126
|
#currentAnchor;
|
|
148
127
|
#eventSubscription;
|
|
149
128
|
#hideTimeoutId;
|
|
@@ -155,7 +134,6 @@ class TooltipComponent {
|
|
|
155
134
|
this.#document = inject(DOCUMENT);
|
|
156
135
|
this.#popupService = inject(PopupService);
|
|
157
136
|
this.#renderer = inject(Renderer2);
|
|
158
|
-
this.#themeService = inject(ThemeService);
|
|
159
137
|
this.#currentAnchor = null;
|
|
160
138
|
this.#eventSubscription = null;
|
|
161
139
|
this.#hideTimeoutId = null;
|
|
@@ -163,14 +141,12 @@ class TooltipComponent {
|
|
|
163
141
|
this.#popupRef = null;
|
|
164
142
|
this.#showTimeoutId = null;
|
|
165
143
|
this.arrowClasses = computed(() => {
|
|
166
|
-
|
|
167
|
-
return tooltipArrowThemeVariants(theme)();
|
|
144
|
+
return tooltipArrowThemeVariants();
|
|
168
145
|
}, /* @ts-ignore */
|
|
169
146
|
...(ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []));
|
|
170
147
|
this.baseClasses = computed(() => {
|
|
171
|
-
const theme = this.#themeService.theme();
|
|
172
148
|
const rounded = this.rounded();
|
|
173
|
-
return tooltipBaseThemeVariants(
|
|
149
|
+
return tooltipBaseThemeVariants({ rounded });
|
|
174
150
|
}, /* @ts-ignore */
|
|
175
151
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
176
152
|
this.currentArrowPosition = linkedSignal(() => this.position(), /* @ts-ignore */
|
|
@@ -635,17 +611,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
635
611
|
}], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], hideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideDelay", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipRounded", required: false }] }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "showDelay", required: false }] }], hidden: [{ type: i0.Output, args: ["hidden"] }], shown: [{ type: i0.Output, args: ["shown"] }] } });
|
|
636
612
|
class TooltipTemplateComponent {
|
|
637
613
|
constructor() {
|
|
638
|
-
this.#themeService = inject(ThemeService);
|
|
639
614
|
this.arrowClasses = computed(() => {
|
|
640
|
-
|
|
641
|
-
return tooltipArrowThemeVariants(theme)();
|
|
615
|
+
return tooltipArrowThemeVariants();
|
|
642
616
|
}, /* @ts-ignore */
|
|
643
617
|
...(ngDevMode ? [{ debugName: "arrowClasses" }] : /* istanbul ignore next */ []));
|
|
644
618
|
this.baseClasses = computed(() => {
|
|
645
|
-
const theme = this.#themeService.theme();
|
|
646
619
|
const rounded = this.rounded();
|
|
647
620
|
const userClasses = `p-2`;
|
|
648
|
-
const variants = tooltipBaseThemeVariants(
|
|
621
|
+
const variants = tooltipBaseThemeVariants({ rounded });
|
|
649
622
|
return twMerge(variants, userClasses);
|
|
650
623
|
}, /* @ts-ignore */
|
|
651
624
|
...(ngDevMode ? [{ debugName: "baseClasses" }] : /* istanbul ignore next */ []));
|
|
@@ -674,7 +647,6 @@ class TooltipTemplateComponent {
|
|
|
674
647
|
this.templateRef = viewChild.required(TemplateRef, /* @ts-ignore */
|
|
675
648
|
...(ngDevMode ? [{ debugName: "templateRef" }] : /* istanbul ignore next */ []));
|
|
676
649
|
}
|
|
677
|
-
#themeService;
|
|
678
650
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TooltipTemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
679
651
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.6", type: TooltipTemplateComponent, isStandalone: true, selector: "ng-component", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, tooltipId: { classPropertyName: "tooltipId", publicName: "tooltipId", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
680
652
|
<ng-template>
|