@nanahoshi/mona-ui 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auto-complete/package.json +4 -0
- package/avatar/package.json +4 -0
- package/breadcrumb/package.json +4 -0
- package/button/package.json +4 -0
- package/button-group/package.json +4 -0
- package/calendar/package.json +4 -0
- package/check-box/package.json +4 -0
- package/chip/package.json +4 -0
- package/circular-progress-bar/package.json +4 -0
- package/color-gradient/package.json +4 -0
- package/color-palette/package.json +4 -0
- package/color-picker/package.json +4 -0
- package/combo-box/package.json +4 -0
- package/common/package.json +4 -0
- package/contextmenu/package.json +4 -0
- package/date-input/package.json +4 -0
- package/date-picker/package.json +4 -0
- package/datetime-picker/package.json +4 -0
- package/dialog/package.json +4 -0
- package/dropdown-button/package.json +4 -0
- package/dropdown-list/package.json +4 -0
- package/dropdowns/package.json +4 -0
- package/editor/package.json +4 -0
- package/expansion-panel/package.json +4 -0
- package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +40 -55
- package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +19 -53
- package/fesm2022/nanahoshi-mona-ui-button-group.mjs +15 -26
- package/fesm2022/nanahoshi-mona-ui-button.mjs +67 -68
- package/fesm2022/nanahoshi-mona-ui-calendar.mjs +54 -150
- package/fesm2022/nanahoshi-mona-ui-check-box.mjs +67 -99
- package/fesm2022/nanahoshi-mona-ui-chip.mjs +35 -45
- package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +9 -23
- package/fesm2022/nanahoshi-mona-ui-color-gradient.mjs +27 -78
- package/fesm2022/nanahoshi-mona-ui-color-palette.mjs +17 -39
- package/fesm2022/nanahoshi-mona-ui-color-picker.mjs +39 -48
- package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +34 -54
- package/fesm2022/nanahoshi-mona-ui-date-input.mjs +9 -12
- package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +42 -29
- package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +53 -53
- package/fesm2022/nanahoshi-mona-ui-dialog.mjs +40 -153
- package/fesm2022/nanahoshi-mona-ui-dropdown-list.mjs +33 -54
- package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +7 -12
- package/fesm2022/nanahoshi-mona-ui-editor.mjs +59 -219
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +24 -75
- package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +11 -44
- package/fesm2022/nanahoshi-mona-ui-filter.mjs +11 -41
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-cell.component-B2ETh-uI.mjs → nanahoshi-mona-ui-grid-grid-footer-cell.component-B6FBLtrr.mjs} +2 -2
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-DZk18LJC.mjs → nanahoshi-mona-ui-grid-grid-footer-table-cell.directive-OJe4UYuw.mjs} +4 -8
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-C7WKhhig.mjs → nanahoshi-mona-ui-grid-grid-list.component-DCd8K6ng.mjs} +9 -16
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-toggle.component-BRiY0CDX.mjs → nanahoshi-mona-ui-grid-grid-toggle.component-Dl8Hlkhj.mjs} +15 -44
- package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BrYpFMyF.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-C5FRZlvv.mjs} +11 -20
- package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-T9Bj98kl.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-BRZUd8cE.mjs} +109 -393
- package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
- package/fesm2022/nanahoshi-mona-ui-internal-indicator-icon.mjs +10 -28
- package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +27 -57
- package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +31 -122
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +29 -1
- package/fesm2022/nanahoshi-mona-ui-list-box.mjs +4 -26
- package/fesm2022/nanahoshi-mona-ui-list-view.mjs +5 -18
- package/fesm2022/nanahoshi-mona-ui-menubar.mjs +48 -154
- package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +36 -63
- package/fesm2022/nanahoshi-mona-ui-notification.mjs +24 -108
- package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +38 -64
- package/fesm2022/nanahoshi-mona-ui-pager.mjs +21 -73
- package/fesm2022/nanahoshi-mona-ui-placeholder.mjs +8 -30
- package/fesm2022/nanahoshi-mona-ui-popover.mjs +29 -50
- package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +36 -108
- package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +19 -60
- package/fesm2022/nanahoshi-mona-ui-radio-button.mjs +78 -98
- package/fesm2022/nanahoshi-mona-ui-scroll-view.mjs +53 -144
- package/fesm2022/nanahoshi-mona-ui-slider.mjs +54 -110
- package/fesm2022/nanahoshi-mona-ui-split-button.mjs +7 -20
- package/fesm2022/nanahoshi-mona-ui-splitter.mjs +15 -50
- package/fesm2022/nanahoshi-mona-ui-stepper.mjs +28 -91
- package/fesm2022/nanahoshi-mona-ui-switch.mjs +37 -59
- package/fesm2022/nanahoshi-mona-ui-tabs.mjs +35 -107
- package/fesm2022/nanahoshi-mona-ui-text-area.mjs +19 -31
- package/fesm2022/nanahoshi-mona-ui-text-box.mjs +60 -65
- package/fesm2022/nanahoshi-mona-ui-theme.mjs +1111 -269
- package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +43 -29
- package/fesm2022/nanahoshi-mona-ui-time-selector.mjs +40 -102
- package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +13 -41
- package/fesm2022/nanahoshi-mona-ui-window.mjs +29 -108
- package/fieldset/package.json +4 -0
- package/filter/package.json +4 -0
- package/grid/package.json +4 -0
- package/internal/filter-input/package.json +4 -0
- package/internal/indicator-icon/package.json +4 -0
- package/internal/list/package.json +4 -0
- package/internal/package.json +4 -0
- package/internal/tree/package.json +4 -0
- package/list/package.json +4 -0
- package/list-box/package.json +4 -0
- package/list-view/package.json +4 -0
- package/menubar/package.json +4 -0
- package/multi-select/package.json +4 -0
- package/notification/package.json +4 -0
- package/numeric-text-box/package.json +4 -0
- package/package.json +2 -1
- package/pager/package.json +4 -0
- package/placeholder/package.json +4 -0
- package/popover/package.json +4 -0
- package/popup/package.json +4 -0
- package/popup-menu/package.json +4 -0
- package/progress-bar/package.json +4 -0
- package/query/package.json +4 -0
- package/radio-button/package.json +4 -0
- package/scroll-view/package.json +4 -0
- package/slider/package.json +4 -0
- package/split-button/package.json +4 -0
- package/splitter/package.json +4 -0
- package/stepper/package.json +4 -0
- package/switch/package.json +4 -0
- package/tabs/package.json +4 -0
- package/text-area/package.json +4 -0
- package/text-box/package.json +4 -0
- package/theme/package.json +4 -0
- package/time-picker/package.json +4 -0
- package/time-selector/package.json +4 -0
- package/tooltip/package.json +4 -0
- package/tree-view/package.json +4 -0
- package/types/nanahoshi-mona-ui-auto-complete.d.ts +6 -7
- package/types/nanahoshi-mona-ui-breadcrumb.d.ts +4 -6
- package/types/nanahoshi-mona-ui-button-group.d.ts +2 -3
- package/types/nanahoshi-mona-ui-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-calendar.d.ts +21 -22
- package/types/nanahoshi-mona-ui-check-box.d.ts +18 -10
- package/types/nanahoshi-mona-ui-chip.d.ts +2 -3
- package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +2 -4
- package/types/nanahoshi-mona-ui-color-gradient.d.ts +10 -11
- package/types/nanahoshi-mona-ui-color-palette.d.ts +4 -5
- package/types/nanahoshi-mona-ui-color-picker.d.ts +6 -5
- package/types/nanahoshi-mona-ui-combo-box.d.ts +6 -7
- package/types/nanahoshi-mona-ui-date-input.d.ts +2 -3
- package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-dialog.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdown-list.d.ts +6 -7
- package/types/nanahoshi-mona-ui-dropdowns.d.ts +2 -3
- package/types/nanahoshi-mona-ui-expansion-panel.d.ts +8 -10
- package/types/nanahoshi-mona-ui-fieldset.d.ts +6 -8
- package/types/nanahoshi-mona-ui-filter.d.ts +2 -3
- package/types/nanahoshi-mona-ui-grid.d.ts +14 -15
- package/types/nanahoshi-mona-ui-internal-indicator-icon.d.ts +0 -1
- package/types/nanahoshi-mona-ui-internal.d.ts +8 -1
- package/types/nanahoshi-mona-ui-list-box.d.ts +4 -5
- package/types/nanahoshi-mona-ui-list-view.d.ts +2 -3
- package/types/nanahoshi-mona-ui-menubar.d.ts +6 -7
- package/types/nanahoshi-mona-ui-multi-select.d.ts +8 -9
- package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +2 -3
- package/types/nanahoshi-mona-ui-pager.d.ts +6 -7
- package/types/nanahoshi-mona-ui-placeholder.d.ts +4 -6
- package/types/nanahoshi-mona-ui-popover.d.ts +8 -9
- package/types/nanahoshi-mona-ui-popup-menu.d.ts +12 -13
- package/types/nanahoshi-mona-ui-progress-bar.d.ts +8 -9
- package/types/nanahoshi-mona-ui-radio-button.d.ts +28 -13
- package/types/nanahoshi-mona-ui-scroll-view.d.ts +18 -20
- package/types/nanahoshi-mona-ui-slider.d.ts +18 -18
- package/types/nanahoshi-mona-ui-split-button.d.ts +2 -3
- package/types/nanahoshi-mona-ui-splitter.d.ts +6 -8
- package/types/nanahoshi-mona-ui-stepper.d.ts +12 -13
- package/types/nanahoshi-mona-ui-switch.d.ts +6 -7
- package/types/nanahoshi-mona-ui-tabs.d.ts +14 -16
- package/types/nanahoshi-mona-ui-text-area.d.ts +2 -4
- package/types/nanahoshi-mona-ui-text-box.d.ts +16 -7
- package/types/nanahoshi-mona-ui-theme.d.ts +111 -12
- package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -3
- package/types/nanahoshi-mona-ui-time-selector.d.ts +11 -11
- package/types/nanahoshi-mona-ui-tooltip.d.ts +4 -5
- package/types/nanahoshi-mona-ui-window.d.ts +16 -17
- package/window/package.json +4 -0
|
@@ -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 */
|
|
@@ -88,7 +101,7 @@ class TimePickerComponent {
|
|
|
88
101
|
const controls = this.popupId;
|
|
89
102
|
const expanded = this.#dropdownService.popupRef() != null;
|
|
90
103
|
const hasPopup = "dialog";
|
|
91
|
-
const invalid = this.
|
|
104
|
+
const invalid = this.invalidState();
|
|
92
105
|
return {
|
|
93
106
|
"aria-autocomplete": "none",
|
|
94
107
|
"aria-controls": controls,
|
|
@@ -100,16 +113,15 @@ class TimePickerComponent {
|
|
|
100
113
|
};
|
|
101
114
|
}, /* @ts-ignore */
|
|
102
115
|
...(ngDevMode ? [{ debugName: "inputAttributes" }] : /* istanbul ignore next */ []));
|
|
103
|
-
this.invalidState = computed(() => this.
|
|
116
|
+
this.invalidState = computed(() => this.touched() && (this.invalid() || (this.required() && !this.value())), /* @ts-ignore */
|
|
104
117
|
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
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,13 @@ 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 */ []));
|
|
232
|
+
this.invalidState = computed(() => this.touched() && this.invalid(), /* @ts-ignore */
|
|
233
|
+
...(ngDevMode ? [{ debugName: "invalidState" }] : /* istanbul ignore next */ []));
|
|
295
234
|
this.listContainerClass = computed(() => {
|
|
296
|
-
|
|
297
|
-
return timeSelectorListContainerThemeVariants(theme)();
|
|
235
|
+
return timeSelectorListContainerThemeVariants();
|
|
298
236
|
}, /* @ts-ignore */
|
|
299
237
|
...(ngDevMode ? [{ debugName: "listContainerClass" }] : /* istanbul ignore next */ []));
|
|
300
238
|
this.maxDate = computed(() => {
|
|
@@ -692,7 +630,7 @@ class TimeSelectorComponent {
|
|
|
692
630
|
}
|
|
693
631
|
}
|
|
694
632
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TimeSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
695
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TimeSelectorComponent, isStandalone: true, selector: "mona-time-selector", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, focusOnMount: { classPropertyName: "focusOnMount", publicName: "focusOnMount", isSignal: true, isRequired: false, transformFunction: null }, footer: { classPropertyName: "footer", publicName: "footer", 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 }, 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 }, secondStep: { classPropertyName: "secondStep", publicName: "secondStep", 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 }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { attributes: { "role": "group" }, listeners: { "blur": "onBlur()" }, properties: { "attr.aria-label": "ariaLabel()", "attr.aria-disabled": "disabled()", "attr.aria-invalid": "
|
|
633
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: TimeSelectorComponent, isStandalone: true, selector: "mona-time-selector", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, focusOnMount: { classPropertyName: "focusOnMount", publicName: "focusOnMount", isSignal: true, isRequired: false, transformFunction: null }, footer: { classPropertyName: "footer", publicName: "footer", 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 }, 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 }, secondStep: { classPropertyName: "secondStep", publicName: "secondStep", 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 }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touch: "touch", value: "valueChange" }, host: { attributes: { "role": "group" }, listeners: { "blur": "onBlur()" }, properties: { "attr.aria-label": "ariaLabel()", "attr.aria-disabled": "disabled()", "attr.aria-invalid": "invalidState() ? 'true' : null", "attr.aria-readonly": "readonly()", "attr.aria-required": "required()", "attr.data-invalid": "invalidState() || null", "attr.data-readonly": "readonly() || null", "attr.data-required": "required() || null", "class": "baseClass()" } }, viewQueries: [{ propertyName: "hourListRef", first: true, predicate: ["hourList"], descendants: true, isSignal: true }, { propertyName: "meridiemListRef", first: true, predicate: ["meridiemList"], descendants: true, isSignal: true }, { propertyName: "minuteListRef", first: true, predicate: ["minuteList"], descendants: true, isSignal: true }, { propertyName: "secondListRef", first: true, predicate: ["secondList"], descendants: true, isSignal: true }], ngImport: i0, template: "<div [class]=\"headerClass()\">\n <div>Hr</div>\n <div>Min</div>\n @if (showSeconds()) {\n <div>Sec</div>\n }\n</div>\n\n<div [class]=\"infoContainerClass()\">\n <span>{{ navigatedDateText() }}</span>\n <button\n monaButton\n look=\"ghost\"\n [rounded]=\"rounded()\"\n [size]=\"'small'\"\n (click)=\"onNowClick($event)\"\n (keydown.enter)=\"onNowClick($event)\"\n (keydown.space)=\"onNowClick($event)\">\n Now\n </button>\n</div>\n\n<div [class]=\"listContainerClass()\">\n <ol\n #hourList\n monaTimeSelectorList\n aria-label=\"Hours\"\n [attr.aria-activedescendant]=\"`${hourListId}${navigatedDate().hour}`\"\n [active]=\"focusedList() === 'hours'\"\n [id]=\"hourListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (h of viewHours() | timeLimiter: \"h\" : navigatedDate() : minDate() : maxDate(); track h) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"h.viewValue === hour()\"\n [value]=\"h.value\"\n [id]=\"`${hourListId}${h.value}`\"\n (click)=\"onHourChange(h.value)\">\n {{ h.viewValue | number: \"2.0\" }}\n </li>\n }\n </ol>\n <ol\n #minuteList\n monaTimeSelectorList\n aria-label=\"Minutes\"\n [attr.aria-activedescendant]=\"`${minuteListId}${navigatedDate().minute}`\"\n [active]=\"focusedList() === 'minutes'\"\n [id]=\"minuteListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (m of minutes() | timeLimiter: \"m\" : navigatedDate() : minDate() : maxDate(); track m) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"m.value === minute()\"\n [value]=\"m.value\"\n [id]=\"`${minuteListId}${m.value}`\"\n (click)=\"onMinuteChange(m.value)\">\n {{ m.viewValue | number: \"2.0\" }}\n </li>\n }\n </ol>\n @if (showSeconds()) {\n <ol\n #secondList\n monaTimeSelectorList\n aria-label=\"Seconds\"\n [attr.aria-activedescendant]=\"`${secondListId}${navigatedDate().second}`\"\n [active]=\"focusedList() === 'seconds'\"\n [id]=\"secondListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @for (s of seconds() | timeLimiter: \"s\" : navigatedDate() : minDate() : maxDate(); track s) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"s.value === second()\"\n [value]=\"s.value\"\n [id]=\"`${secondListId}${s.value}`\"\n (click)=\"onSecondChange(s.value)\">\n {{ s.value | number: \"2.0\" }}\n </li>\n }\n </ol>\n }\n @if (hourFormat() === \"12\") {\n <ol\n #meridiemList\n monaTimeSelectorList\n aria-label=\"AM/PM\"\n [attr.aria-activedescendant]=\"`${meridiemListId}${meridiem()}`\"\n [active]=\"focusedList() === 'meridiem'\"\n [id]=\"meridiemListId\"\n [popupHeight]=\"computedPopupHeight()\"\n [size]=\"size()\">\n @if (amMeridiemVisible()) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"meridiem() === 'AM'\"\n [value]=\"'AM'\"\n (click)=\"onMeridiemClick('AM')\"\n [id]=\"`${meridiemListId}AM`\">\n AM\n </li>\n }\n @if (pmMeridiemVisible()) {\n <li\n monaTimeSelectorItem\n [size]=\"size()\"\n [selected]=\"meridiem() === 'PM'\"\n [value]=\"'PM'\"\n (click)=\"onMeridiemClick('PM')\"\n [id]=\"`${meridiemListId}PM`\">\n PM\n </li>\n }\n </ol>\n }\n</div>\n\n@if (footer()) {\n <div [class]=\"footerClass()\">\n <button monaButton look=\"primary\" [rounded]=\"rounded()\" [size]=\"size()\" (click)=\"onSetTimeClick()\">Set</button>\n </div>\n}\n", dependencies: [{ kind: "directive", type: TimeSelectorItemDirective, selector: "li[monaTimeSelectorItem]", inputs: ["selected", "size", "value"] }, { 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: "directive", type: TimeSelectorListDirective, selector: "ol[monaTimeSelectorList]", inputs: ["active", "popupHeight", "size"] }, { kind: "pipe", type: DecimalPipe, name: "number" }, { kind: "pipe", type: TimeLimiterPipe, name: "timeLimiter" }] }); }
|
|
696
634
|
}
|
|
697
635
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: TimeSelectorComponent, decorators: [{
|
|
698
636
|
type: Component,
|
|
@@ -700,10 +638,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImpor
|
|
|
700
638
|
role: "group",
|
|
701
639
|
"[attr.aria-label]": "ariaLabel()",
|
|
702
640
|
"[attr.aria-disabled]": "disabled()",
|
|
703
|
-
"[attr.aria-invalid]": "
|
|
641
|
+
"[attr.aria-invalid]": "invalidState() ? 'true' : null",
|
|
704
642
|
"[attr.aria-readonly]": "readonly()",
|
|
705
643
|
"[attr.aria-required]": "required()",
|
|
706
|
-
"[attr.data-invalid]": "
|
|
644
|
+
"[attr.data-invalid]": "invalidState() || null",
|
|
707
645
|
"[attr.data-readonly]": "readonly() || null",
|
|
708
646
|
"[attr.data-required]": "required() || null",
|
|
709
647
|
"[class]": "baseClass()",
|