@raintonic/formaui 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/CHANGELOG.md +7 -0
- package/README.md +145 -0
- package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs +806 -0
- package/fesm2022/raintonic-formaui-cdk-drag-drop.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-form-field.mjs +86 -0
- package/fesm2022/raintonic-formaui-cdk-form-field.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-overlay.mjs +1757 -0
- package/fesm2022/raintonic-formaui-cdk-overlay.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs +287 -0
- package/fesm2022/raintonic-formaui-cdk-virtual-scroll.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-accordion.mjs +217 -0
- package/fesm2022/raintonic-formaui-components-accordion.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-alert.mjs +161 -0
- package/fesm2022/raintonic-formaui-components-alert.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-autocomplete.mjs +726 -0
- package/fesm2022/raintonic-formaui-components-autocomplete.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-avatar.mjs +92 -0
- package/fesm2022/raintonic-formaui-components-avatar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-badge.mjs +107 -0
- package/fesm2022/raintonic-formaui-components-badge.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-big-menu.mjs +68 -0
- package/fesm2022/raintonic-formaui-components-big-menu.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-breadcrumb.mjs +55 -0
- package/fesm2022/raintonic-formaui-components-breadcrumb.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-button-group.mjs +103 -0
- package/fesm2022/raintonic-formaui-components-button-group.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-button.mjs +241 -0
- package/fesm2022/raintonic-formaui-components-button.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-card.mjs +270 -0
- package/fesm2022/raintonic-formaui-components-card.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-checkbox.mjs +295 -0
- package/fesm2022/raintonic-formaui-components-checkbox.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-data-table.mjs +631 -0
- package/fesm2022/raintonic-formaui-components-data-table.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-date-picker.mjs +1331 -0
- package/fesm2022/raintonic-formaui-components-date-picker.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-divider.mjs +41 -0
- package/fesm2022/raintonic-formaui-components-divider.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-drawer.mjs +190 -0
- package/fesm2022/raintonic-formaui-components-drawer.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-dynamic-form.mjs +266 -0
- package/fesm2022/raintonic-formaui-components-dynamic-form.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-empty-state.mjs +33 -0
- package/fesm2022/raintonic-formaui-components-empty-state.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-file-upload.mjs +246 -0
- package/fesm2022/raintonic-formaui-components-file-upload.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-form-field.mjs +482 -0
- package/fesm2022/raintonic-formaui-components-form-field.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-icon.mjs +117 -0
- package/fesm2022/raintonic-formaui-components-icon.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-input.mjs +327 -0
- package/fesm2022/raintonic-formaui-components-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-list.mjs +149 -0
- package/fesm2022/raintonic-formaui-components-list.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-menu.mjs +896 -0
- package/fesm2022/raintonic-formaui-components-menu.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-number-input.mjs +345 -0
- package/fesm2022/raintonic-formaui-components-number-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-paginator.mjs +139 -0
- package/fesm2022/raintonic-formaui-components-paginator.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-password-input.mjs +306 -0
- package/fesm2022/raintonic-formaui-components-password-input.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-popover.mjs +451 -0
- package/fesm2022/raintonic-formaui-components-popover.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-progressbar.mjs +148 -0
- package/fesm2022/raintonic-formaui-components-progressbar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-radio.mjs +260 -0
- package/fesm2022/raintonic-formaui-components-radio.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-select.mjs +1011 -0
- package/fesm2022/raintonic-formaui-components-select.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-side-panel.mjs +150 -0
- package/fesm2022/raintonic-formaui-components-side-panel.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-sidebar.mjs +257 -0
- package/fesm2022/raintonic-formaui-components-sidebar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-skeleton.mjs +50 -0
- package/fesm2022/raintonic-formaui-components-skeleton.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-slider.mjs +347 -0
- package/fesm2022/raintonic-formaui-components-slider.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-spinner.mjs +63 -0
- package/fesm2022/raintonic-formaui-components-spinner.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-stepper.mjs +317 -0
- package/fesm2022/raintonic-formaui-components-stepper.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tab.mjs +197 -0
- package/fesm2022/raintonic-formaui-components-tab.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tag.mjs +78 -0
- package/fesm2022/raintonic-formaui-components-tag.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-time-picker.mjs +644 -0
- package/fesm2022/raintonic-formaui-components-time-picker.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-toggle.mjs +171 -0
- package/fesm2022/raintonic-formaui-components-toggle.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-toolbar.mjs +140 -0
- package/fesm2022/raintonic-formaui-components-toolbar.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tooltip.mjs +555 -0
- package/fesm2022/raintonic-formaui-components-tooltip.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree-select.mjs +314 -0
- package/fesm2022/raintonic-formaui-components-tree-select.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree-table.mjs +103 -0
- package/fesm2022/raintonic-formaui-components-tree-table.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-components-tree.mjs +430 -0
- package/fesm2022/raintonic-formaui-components-tree.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-core.mjs +62 -0
- package/fesm2022/raintonic-formaui-core.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-dialog.mjs +798 -0
- package/fesm2022/raintonic-formaui-services-dialog.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-notification.mjs +391 -0
- package/fesm2022/raintonic-formaui-services-notification.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-services-theme.mjs +248 -0
- package/fesm2022/raintonic-formaui-services-theme.mjs.map +1 -0
- package/fesm2022/raintonic-formaui-test-utils.mjs +66 -0
- package/fesm2022/raintonic-formaui-test-utils.mjs.map +1 -0
- package/fesm2022/raintonic-formaui.mjs +15 -0
- package/fesm2022/raintonic-formaui.mjs.map +1 -0
- package/llms-full.txt +1627 -0
- package/llms.txt +60 -0
- package/package.json +251 -0
- package/styles/_fonts-entry.scss +3 -0
- package/styles/fonts/dm-mono-400-latin.woff2 +0 -0
- package/styles/fonts/inter-tight-latin-italic.woff2 +0 -0
- package/styles/fonts/inter-tight-latin.woff2 +0 -0
- package/styles/index.scss +127 -0
- package/styles/partials/_constants.scss +29 -0
- package/styles/partials/_fonts.scss +36 -0
- package/styles/partials/_grid.scss +171 -0
- package/styles/partials/_mixins.scss +145 -0
- package/styles/partials/_motion.scss +252 -0
- package/styles/partials/_theme.scss +275 -0
- package/styles/partials/_typography.scss +112 -0
- package/styles/partials/_utilities.scss +480 -0
- package/styles/partials/themes/_dark.scss +254 -0
- package/styles/partials/themes/_light.scss +254 -0
- package/types/raintonic-formaui-cdk-drag-drop.d.ts +196 -0
- package/types/raintonic-formaui-cdk-drag-drop.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-form-field.d.ts +62 -0
- package/types/raintonic-formaui-cdk-form-field.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-overlay.d.ts +843 -0
- package/types/raintonic-formaui-cdk-overlay.d.ts.map +1 -0
- package/types/raintonic-formaui-cdk-virtual-scroll.d.ts +112 -0
- package/types/raintonic-formaui-cdk-virtual-scroll.d.ts.map +1 -0
- package/types/raintonic-formaui-components-accordion.d.ts +124 -0
- package/types/raintonic-formaui-components-accordion.d.ts.map +1 -0
- package/types/raintonic-formaui-components-alert.d.ts +143 -0
- package/types/raintonic-formaui-components-alert.d.ts.map +1 -0
- package/types/raintonic-formaui-components-autocomplete.d.ts +193 -0
- package/types/raintonic-formaui-components-autocomplete.d.ts.map +1 -0
- package/types/raintonic-formaui-components-avatar.d.ts +52 -0
- package/types/raintonic-formaui-components-avatar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-badge.d.ts +47 -0
- package/types/raintonic-formaui-components-badge.d.ts.map +1 -0
- package/types/raintonic-formaui-components-big-menu.d.ts +62 -0
- package/types/raintonic-formaui-components-big-menu.d.ts.map +1 -0
- package/types/raintonic-formaui-components-breadcrumb.d.ts +26 -0
- package/types/raintonic-formaui-components-breadcrumb.d.ts.map +1 -0
- package/types/raintonic-formaui-components-button-group.d.ts +61 -0
- package/types/raintonic-formaui-components-button-group.d.ts.map +1 -0
- package/types/raintonic-formaui-components-button.d.ts +116 -0
- package/types/raintonic-formaui-components-button.d.ts.map +1 -0
- package/types/raintonic-formaui-components-card.d.ts +191 -0
- package/types/raintonic-formaui-components-card.d.ts.map +1 -0
- package/types/raintonic-formaui-components-checkbox.d.ts +132 -0
- package/types/raintonic-formaui-components-checkbox.d.ts.map +1 -0
- package/types/raintonic-formaui-components-data-table.d.ts +368 -0
- package/types/raintonic-formaui-components-data-table.d.ts.map +1 -0
- package/types/raintonic-formaui-components-date-picker.d.ts +341 -0
- package/types/raintonic-formaui-components-date-picker.d.ts.map +1 -0
- package/types/raintonic-formaui-components-divider.d.ts +21 -0
- package/types/raintonic-formaui-components-divider.d.ts.map +1 -0
- package/types/raintonic-formaui-components-drawer.d.ts +48 -0
- package/types/raintonic-formaui-components-drawer.d.ts.map +1 -0
- package/types/raintonic-formaui-components-dynamic-form.d.ts +412 -0
- package/types/raintonic-formaui-components-dynamic-form.d.ts.map +1 -0
- package/types/raintonic-formaui-components-empty-state.d.ts +14 -0
- package/types/raintonic-formaui-components-empty-state.d.ts.map +1 -0
- package/types/raintonic-formaui-components-file-upload.d.ts +77 -0
- package/types/raintonic-formaui-components-file-upload.d.ts.map +1 -0
- package/types/raintonic-formaui-components-form-field.d.ts +271 -0
- package/types/raintonic-formaui-components-form-field.d.ts.map +1 -0
- package/types/raintonic-formaui-components-icon.d.ts +61 -0
- package/types/raintonic-formaui-components-icon.d.ts.map +1 -0
- package/types/raintonic-formaui-components-input.d.ts +149 -0
- package/types/raintonic-formaui-components-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-list.d.ts +48 -0
- package/types/raintonic-formaui-components-list.d.ts.map +1 -0
- package/types/raintonic-formaui-components-menu.d.ts +403 -0
- package/types/raintonic-formaui-components-menu.d.ts.map +1 -0
- package/types/raintonic-formaui-components-number-input.d.ts +127 -0
- package/types/raintonic-formaui-components-number-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-paginator.d.ts +37 -0
- package/types/raintonic-formaui-components-paginator.d.ts.map +1 -0
- package/types/raintonic-formaui-components-password-input.d.ts +111 -0
- package/types/raintonic-formaui-components-password-input.d.ts.map +1 -0
- package/types/raintonic-formaui-components-popover.d.ts +131 -0
- package/types/raintonic-formaui-components-popover.d.ts.map +1 -0
- package/types/raintonic-formaui-components-progressbar.d.ts +111 -0
- package/types/raintonic-formaui-components-progressbar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-radio.d.ts +95 -0
- package/types/raintonic-formaui-components-radio.d.ts.map +1 -0
- package/types/raintonic-formaui-components-select.d.ts +307 -0
- package/types/raintonic-formaui-components-select.d.ts.map +1 -0
- package/types/raintonic-formaui-components-side-panel.d.ts +51 -0
- package/types/raintonic-formaui-components-side-panel.d.ts.map +1 -0
- package/types/raintonic-formaui-components-sidebar.d.ts +174 -0
- package/types/raintonic-formaui-components-sidebar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-skeleton.d.ts +20 -0
- package/types/raintonic-formaui-components-skeleton.d.ts.map +1 -0
- package/types/raintonic-formaui-components-slider.d.ts +108 -0
- package/types/raintonic-formaui-components-slider.d.ts.map +1 -0
- package/types/raintonic-formaui-components-spinner.d.ts +42 -0
- package/types/raintonic-formaui-components-spinner.d.ts.map +1 -0
- package/types/raintonic-formaui-components-stepper.d.ts +126 -0
- package/types/raintonic-formaui-components-stepper.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tab.d.ts +96 -0
- package/types/raintonic-formaui-components-tab.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tag.d.ts +34 -0
- package/types/raintonic-formaui-components-tag.d.ts.map +1 -0
- package/types/raintonic-formaui-components-time-picker.d.ts +172 -0
- package/types/raintonic-formaui-components-time-picker.d.ts.map +1 -0
- package/types/raintonic-formaui-components-toggle.d.ts +70 -0
- package/types/raintonic-formaui-components-toggle.d.ts.map +1 -0
- package/types/raintonic-formaui-components-toolbar.d.ts +128 -0
- package/types/raintonic-formaui-components-toolbar.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tooltip.d.ts +268 -0
- package/types/raintonic-formaui-components-tooltip.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree-select.d.ts +80 -0
- package/types/raintonic-formaui-components-tree-select.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree-table.d.ts +90 -0
- package/types/raintonic-formaui-components-tree-table.d.ts.map +1 -0
- package/types/raintonic-formaui-components-tree.d.ts +104 -0
- package/types/raintonic-formaui-components-tree.d.ts.map +1 -0
- package/types/raintonic-formaui-core.d.ts +115 -0
- package/types/raintonic-formaui-core.d.ts.map +1 -0
- package/types/raintonic-formaui-services-dialog.d.ts +451 -0
- package/types/raintonic-formaui-services-dialog.d.ts.map +1 -0
- package/types/raintonic-formaui-services-notification.d.ts +221 -0
- package/types/raintonic-formaui-services-notification.d.ts.map +1 -0
- package/types/raintonic-formaui-services-theme.d.ts +126 -0
- package/types/raintonic-formaui-services-theme.d.ts.map +1 -0
- package/types/raintonic-formaui-test-utils.d.ts +24 -0
- package/types/raintonic-formaui-test-utils.d.ts.map +1 -0
- package/types/raintonic-formaui.d.ts +4 -0
- package/types/raintonic-formaui.d.ts.map +1 -0
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, signal, effect, ViewChild, ViewEncapsulation, ChangeDetectionStrategy, Component, booleanAttribute, inject, computed, ElementRef, NgZone } from '@angular/core';
|
|
3
|
+
import { NgForm, FormGroupDirective, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { DOCUMENT } from '@angular/common';
|
|
5
|
+
import { Subject, Subscription, fromEvent } from 'rxjs';
|
|
6
|
+
import { filter } from 'rxjs/operators';
|
|
7
|
+
import { injectNgControl, updateErrorState, syncRequiredState, syncNgControlDisabled } from '@raintonic/formaui/cdk/form-field';
|
|
8
|
+
import { DefaultErrorStateMatcher, FUI_FORM_FIELD_CONTROL } from '@raintonic/formaui/core';
|
|
9
|
+
import { FuiOverlayService } from '@raintonic/formaui/cdk/overlay';
|
|
10
|
+
import { FuiIconComponent } from '@raintonic/formaui/components/icon';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Convert a TimeValue to total minutes for comparison purposes.
|
|
14
|
+
*/
|
|
15
|
+
function timeToMinutes(time) {
|
|
16
|
+
return time.hours * 60 + time.minutes + (time.seconds ? time.seconds / 60 : 0);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Compare two TimeValue objects.
|
|
20
|
+
* Returns -1 if a < b, 0 if equal, 1 if a > b.
|
|
21
|
+
*/
|
|
22
|
+
function compareTime(a, b) {
|
|
23
|
+
const aMin = timeToMinutes(a);
|
|
24
|
+
const bMin = timeToMinutes(b);
|
|
25
|
+
if (aMin < bMin)
|
|
26
|
+
return -1;
|
|
27
|
+
if (aMin > bMin)
|
|
28
|
+
return 1;
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if a time is within an optional min/max range (inclusive).
|
|
33
|
+
*/
|
|
34
|
+
function isTimeInRange(time, min, max) {
|
|
35
|
+
if (min && compareTime(time, min) < 0)
|
|
36
|
+
return false;
|
|
37
|
+
if (max && compareTime(time, max) > 0)
|
|
38
|
+
return false;
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Format a TimeValue for display.
|
|
43
|
+
* - 24h: "14:30" or "14:30:00"
|
|
44
|
+
* - 12h: "2:30 PM" or "2:30:00 PM"
|
|
45
|
+
*/
|
|
46
|
+
function formatTime(value, format, showSeconds) {
|
|
47
|
+
if (!value)
|
|
48
|
+
return '';
|
|
49
|
+
const h = value.hours;
|
|
50
|
+
const m = value.minutes;
|
|
51
|
+
const s = value.seconds ?? 0;
|
|
52
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
53
|
+
if (format === '24h') {
|
|
54
|
+
const base = `${pad(h)}:${pad(m)}`;
|
|
55
|
+
return showSeconds ? `${base}:${pad(s)}` : base;
|
|
56
|
+
}
|
|
57
|
+
// 12h format
|
|
58
|
+
const period = h >= 12 ? 'PM' : 'AM';
|
|
59
|
+
let displayHour = h;
|
|
60
|
+
if (h === 0)
|
|
61
|
+
displayHour = 12;
|
|
62
|
+
else if (h > 12)
|
|
63
|
+
displayHour = h - 12;
|
|
64
|
+
const base = `${displayHour}:${pad(m)}`;
|
|
65
|
+
return showSeconds ? `${base}:${pad(s)} ${period}` : `${base} ${period}`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Parse a time string into a TimeValue.
|
|
69
|
+
* Supports formats: "HH:mm", "HH:mm:ss", "h:mm AM/PM", "h:mm:ss AM/PM"
|
|
70
|
+
* Returns null if the string cannot be parsed.
|
|
71
|
+
*/
|
|
72
|
+
function parseTimeString(str, format) {
|
|
73
|
+
if (!str?.trim())
|
|
74
|
+
return null;
|
|
75
|
+
const trimmed = str.trim();
|
|
76
|
+
if (format === '12h') {
|
|
77
|
+
// Match patterns like "2:30 PM", "12:30:45 AM"
|
|
78
|
+
const match12 = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*(AM|PM)$/i.exec(trimmed);
|
|
79
|
+
if (!match12)
|
|
80
|
+
return null;
|
|
81
|
+
let hours = parseInt(match12[1], 10);
|
|
82
|
+
const minutes = parseInt(match12[2], 10);
|
|
83
|
+
const seconds = match12[3] ? parseInt(match12[3], 10) : undefined;
|
|
84
|
+
const period = match12[4].toUpperCase();
|
|
85
|
+
if (hours < 1 || hours > 12 || minutes < 0 || minutes > 59)
|
|
86
|
+
return null;
|
|
87
|
+
if (seconds !== undefined && (seconds < 0 || seconds > 59))
|
|
88
|
+
return null;
|
|
89
|
+
if (period === 'AM' && hours === 12)
|
|
90
|
+
hours = 0;
|
|
91
|
+
else if (period === 'PM' && hours !== 12)
|
|
92
|
+
hours += 12;
|
|
93
|
+
return { hours, minutes, ...(seconds !== undefined ? { seconds } : {}) };
|
|
94
|
+
}
|
|
95
|
+
// 24h format: "HH:mm" or "HH:mm:ss"
|
|
96
|
+
const match24 = /^(\d{1,2}):(\d{2})(?::(\d{2}))?$/.exec(trimmed);
|
|
97
|
+
if (!match24)
|
|
98
|
+
return null;
|
|
99
|
+
const hours = parseInt(match24[1], 10);
|
|
100
|
+
const minutes = parseInt(match24[2], 10);
|
|
101
|
+
const seconds = match24[3] ? parseInt(match24[3], 10) : undefined;
|
|
102
|
+
if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59)
|
|
103
|
+
return null;
|
|
104
|
+
if (seconds !== undefined && (seconds < 0 || seconds > 59))
|
|
105
|
+
return null;
|
|
106
|
+
return { hours, minutes, ...(seconds !== undefined ? { seconds } : {}) };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Generate time options for the dropdown list.
|
|
110
|
+
*/
|
|
111
|
+
function generateTimeOptions(format, minuteStep, showSeconds, min, max) {
|
|
112
|
+
const options = [];
|
|
113
|
+
const step = Math.max(1, Math.min(60, minuteStep));
|
|
114
|
+
for (let h = 0; h < 24; h++) {
|
|
115
|
+
for (let m = 0; m < 60; m += step) {
|
|
116
|
+
const value = { hours: h, minutes: m, ...(showSeconds ? { seconds: 0 } : {}) };
|
|
117
|
+
const label = formatTime(value, format, showSeconds);
|
|
118
|
+
const disabled = !isTimeInRange(value, min, max);
|
|
119
|
+
options.push({ label, value, disabled });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return options;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Convert a TimeValue to an ISO-like string "HH:mm" or "HH:mm:ss".
|
|
126
|
+
*/
|
|
127
|
+
function timeValueToString(value, showSeconds) {
|
|
128
|
+
if (!value)
|
|
129
|
+
return '';
|
|
130
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
131
|
+
const base = `${pad(value.hours)}:${pad(value.minutes)}`;
|
|
132
|
+
return showSeconds ? `${base}:${pad(value.seconds ?? 0)}` : base;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Parse an ISO-like time string "HH:mm" or "HH:mm:ss" into a TimeValue.
|
|
136
|
+
* This always parses in 24h format regardless of display format.
|
|
137
|
+
*/
|
|
138
|
+
function parseISOTimeString(str) {
|
|
139
|
+
if (!str?.trim())
|
|
140
|
+
return null;
|
|
141
|
+
return parseTimeString(str.trim(), '24h');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
class FuiTimeListComponent {
|
|
145
|
+
/** The list of time options to display. */
|
|
146
|
+
options = input.required(...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
147
|
+
/** Currently selected time value. */
|
|
148
|
+
selectedValue = input(null, ...(ngDevMode ? [{ debugName: "selectedValue" }] : /* istanbul ignore next */ []));
|
|
149
|
+
/** Time format for display. */
|
|
150
|
+
format = input('24h', ...(ngDevMode ? [{ debugName: "format" }] : /* istanbul ignore next */ []));
|
|
151
|
+
/** Emitted when an option is selected. */
|
|
152
|
+
optionSelected = output();
|
|
153
|
+
/** Index of the currently focused option for keyboard navigation. */
|
|
154
|
+
_focusedIndex = signal(-1, ...(ngDevMode ? [{ debugName: "_focusedIndex" }] : /* istanbul ignore next */ []));
|
|
155
|
+
listContainer;
|
|
156
|
+
constructor() {
|
|
157
|
+
// Scroll to selected option when options change
|
|
158
|
+
effect(() => {
|
|
159
|
+
this.selectedValue();
|
|
160
|
+
this.options();
|
|
161
|
+
// Defer to next microtask so DOM is rendered
|
|
162
|
+
void Promise.resolve().then(() => {
|
|
163
|
+
this._scrollToSelected();
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
ngAfterViewInit() {
|
|
168
|
+
this._scrollToSelected();
|
|
169
|
+
}
|
|
170
|
+
/** Check if an option matches the selected value. */
|
|
171
|
+
_isSelected(option) {
|
|
172
|
+
const selected = this.selectedValue();
|
|
173
|
+
if (!selected)
|
|
174
|
+
return false;
|
|
175
|
+
return compareTime(option.value, selected) === 0;
|
|
176
|
+
}
|
|
177
|
+
/** Handle option click. */
|
|
178
|
+
_selectOption(option) {
|
|
179
|
+
if (option.disabled)
|
|
180
|
+
return;
|
|
181
|
+
this.optionSelected.emit(option.value);
|
|
182
|
+
}
|
|
183
|
+
/** Handle keyboard navigation. */
|
|
184
|
+
onKeydown(event) {
|
|
185
|
+
const opts = this.options();
|
|
186
|
+
if (!opts.length)
|
|
187
|
+
return;
|
|
188
|
+
switch (event.key) {
|
|
189
|
+
case 'ArrowDown':
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
this._moveFocus(1);
|
|
192
|
+
break;
|
|
193
|
+
case 'ArrowUp':
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
this._moveFocus(-1);
|
|
196
|
+
break;
|
|
197
|
+
case 'Enter':
|
|
198
|
+
event.preventDefault();
|
|
199
|
+
this._selectFocused();
|
|
200
|
+
break;
|
|
201
|
+
case 'Home':
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
this._setFocusedIndex(0);
|
|
204
|
+
break;
|
|
205
|
+
case 'End':
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
this._setFocusedIndex(opts.length - 1);
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/** Move focus by delta, skipping disabled options. */
|
|
212
|
+
_moveFocus(delta) {
|
|
213
|
+
const opts = this.options();
|
|
214
|
+
if (!opts.length)
|
|
215
|
+
return;
|
|
216
|
+
let current = this._focusedIndex();
|
|
217
|
+
const len = opts.length;
|
|
218
|
+
let attempts = 0;
|
|
219
|
+
do {
|
|
220
|
+
current = (current + delta + len) % len;
|
|
221
|
+
attempts++;
|
|
222
|
+
} while (opts[current].disabled && attempts < len);
|
|
223
|
+
if (!opts[current].disabled) {
|
|
224
|
+
this._setFocusedIndex(current);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/** Set focused index and scroll into view. */
|
|
228
|
+
_setFocusedIndex(index) {
|
|
229
|
+
this._focusedIndex.set(index);
|
|
230
|
+
this._scrollToIndex(index);
|
|
231
|
+
}
|
|
232
|
+
/** Select the currently focused option. */
|
|
233
|
+
_selectFocused() {
|
|
234
|
+
const idx = this._focusedIndex();
|
|
235
|
+
const opts = this.options();
|
|
236
|
+
if (idx >= 0 && idx < opts.length && !opts[idx].disabled) {
|
|
237
|
+
this.optionSelected.emit(opts[idx].value);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** Scroll to a specific index in the list. */
|
|
241
|
+
_scrollToIndex(index) {
|
|
242
|
+
const container = this.listContainer?.nativeElement;
|
|
243
|
+
if (!container)
|
|
244
|
+
return;
|
|
245
|
+
const items = container.querySelectorAll('.fui-time-list__option');
|
|
246
|
+
const item = items[index];
|
|
247
|
+
if (!item)
|
|
248
|
+
return;
|
|
249
|
+
const itemTop = item.offsetTop;
|
|
250
|
+
const itemBottom = itemTop + item.offsetHeight;
|
|
251
|
+
const scrollTop = container.scrollTop;
|
|
252
|
+
const scrollBottom = scrollTop + container.clientHeight;
|
|
253
|
+
if (itemTop < scrollTop) {
|
|
254
|
+
container.scrollTop = itemTop;
|
|
255
|
+
}
|
|
256
|
+
else if (itemBottom > scrollBottom) {
|
|
257
|
+
container.scrollTop = itemBottom - container.clientHeight;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/** Scroll to the selected option. */
|
|
261
|
+
_scrollToSelected() {
|
|
262
|
+
const selected = this.selectedValue();
|
|
263
|
+
if (!selected)
|
|
264
|
+
return;
|
|
265
|
+
const opts = this.options();
|
|
266
|
+
const index = opts.findIndex((o) => compareTime(o.value, selected) === 0);
|
|
267
|
+
if (index >= 0) {
|
|
268
|
+
this._focusedIndex.set(index);
|
|
269
|
+
// Defer scroll to ensure DOM is rendered
|
|
270
|
+
requestAnimationFrame(() => {
|
|
271
|
+
this._scrollToIndex(index);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTimeListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
276
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: FuiTimeListComponent, isStandalone: true, selector: "fui-time-list", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, selectedValue: { classPropertyName: "selectedValue", publicName: "selectedValue", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { optionSelected: "optionSelected" }, host: { classAttribute: "fui-time-list" }, viewQueries: [{ propertyName: "listContainer", first: true, predicate: ["listContainer"], descendants: true }], ngImport: i0, template: "<div\n #listContainer\n class=\"fui-time-list__container\"\n role=\"listbox\"\n tabindex=\"0\"\n aria-label=\"Available times\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (option of options(); track option.label) {\n <div\n class=\"fui-time-list__option\"\n [class.fui-time-list__option--selected]=\"_isSelected(option)\"\n [class.fui-time-list__option--disabled]=\"option.disabled\"\n [class.fui-time-list__option--focused]=\"_focusedIndex() === $index\"\n [attr.id]=\"'fui-time-option-' + $index\"\n [attr.aria-selected]=\"_isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n role=\"option\"\n (click)=\"_selectOption(option)\"\n >\n {{ option.label }}\n </div>\n }\n</div>\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}.fui-time-list{display:block}.fui-time-list__container{max-height:200px;overflow-y:auto;overflow-x:hidden;padding:var(--fui-spacing-02) 0}.fui-time-list__container::-webkit-scrollbar{width:8px}.fui-time-list__container::-webkit-scrollbar-track{background:var(--fui-surface-01);border-radius:var(--fui-border-radius-sm)}.fui-time-list__container::-webkit-scrollbar-thumb{background:var(--fui-border-color);border-radius:var(--fui-border-radius-sm)}.fui-time-list__container::-webkit-scrollbar-thumb:hover{background:var(--fui-text-secondary)}.fui-time-list__option{display:flex;align-items:center;padding:var(--fui-spacing-02) var(--fui-spacing-04);font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02);line-height:var(--fui-line-height-02);color:var(--fui-text-primary);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--fui-duration-fast-01) var(--fui-ease-standard) 0ms}.fui-time-list__option:hover:not(.fui-time-list__option--disabled){background-color:var(--fui-surface-02)}.fui-time-list__option--selected{background-color:var(--fui-primary-20);color:var(--fui-primary-80);font-weight:var(--fui-font-weight-medium)}.fui-time-list__option--selected:hover:not(.fui-time-list__option--disabled){background-color:var(--fui-primary-30)}.fui-time-list__option--focused{outline:2px solid var(--fui-primary-60);outline-offset:-2px;border-radius:var(--fui-border-radius-sm)}.fui-time-list__option--disabled{color:var(--fui-text-disabled);cursor:not-allowed;opacity:.5}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
277
|
+
}
|
|
278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTimeListComponent, decorators: [{
|
|
279
|
+
type: Component,
|
|
280
|
+
args: [{ selector: 'fui-time-list', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
281
|
+
class: 'fui-time-list',
|
|
282
|
+
}, template: "<div\n #listContainer\n class=\"fui-time-list__container\"\n role=\"listbox\"\n tabindex=\"0\"\n aria-label=\"Available times\"\n (keydown)=\"onKeydown($event)\"\n>\n @for (option of options(); track option.label) {\n <div\n class=\"fui-time-list__option\"\n [class.fui-time-list__option--selected]=\"_isSelected(option)\"\n [class.fui-time-list__option--disabled]=\"option.disabled\"\n [class.fui-time-list__option--focused]=\"_focusedIndex() === $index\"\n [attr.id]=\"'fui-time-option-' + $index\"\n [attr.aria-selected]=\"_isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n role=\"option\"\n (click)=\"_selectOption(option)\"\n >\n {{ option.label }}\n </div>\n }\n</div>\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}.fui-time-list{display:block}.fui-time-list__container{max-height:200px;overflow-y:auto;overflow-x:hidden;padding:var(--fui-spacing-02) 0}.fui-time-list__container::-webkit-scrollbar{width:8px}.fui-time-list__container::-webkit-scrollbar-track{background:var(--fui-surface-01);border-radius:var(--fui-border-radius-sm)}.fui-time-list__container::-webkit-scrollbar-thumb{background:var(--fui-border-color);border-radius:var(--fui-border-radius-sm)}.fui-time-list__container::-webkit-scrollbar-thumb:hover{background:var(--fui-text-secondary)}.fui-time-list__option{display:flex;align-items:center;padding:var(--fui-spacing-02) var(--fui-spacing-04);font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02);line-height:var(--fui-line-height-02);color:var(--fui-text-primary);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--fui-duration-fast-01) var(--fui-ease-standard) 0ms}.fui-time-list__option:hover:not(.fui-time-list__option--disabled){background-color:var(--fui-surface-02)}.fui-time-list__option--selected{background-color:var(--fui-primary-20);color:var(--fui-primary-80);font-weight:var(--fui-font-weight-medium)}.fui-time-list__option--selected:hover:not(.fui-time-list__option--disabled){background-color:var(--fui-primary-30)}.fui-time-list__option--focused{outline:2px solid var(--fui-primary-60);outline-offset:-2px;border-radius:var(--fui-border-radius-sm)}.fui-time-list__option--disabled{color:var(--fui-text-disabled);cursor:not-allowed;opacity:.5}\n"] }]
|
|
283
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], selectedValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedValue", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], optionSelected: [{ type: i0.Output, args: ["optionSelected"] }], listContainer: [{
|
|
284
|
+
type: ViewChild,
|
|
285
|
+
args: ['listContainer', { static: false }]
|
|
286
|
+
}] } });
|
|
287
|
+
|
|
288
|
+
class FuiTimePickerComponent {
|
|
289
|
+
static nextId = 0;
|
|
290
|
+
controlType = 'fui-time-picker';
|
|
291
|
+
// --- Inputs ---
|
|
292
|
+
formatInput = input('24h', { ...(ngDevMode ? { debugName: "formatInput" } : /* istanbul ignore next */ {}), alias: 'format' });
|
|
293
|
+
showSeconds = input(false, { ...(ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
294
|
+
minuteStep = input(15, ...(ngDevMode ? [{ debugName: "minuteStep" }] : /* istanbul ignore next */ []));
|
|
295
|
+
min = input('', ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
296
|
+
max = input('', ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
297
|
+
placeholderInput = input('', { ...(ngDevMode ? { debugName: "placeholderInput" } : /* istanbul ignore next */ {}), alias: 'placeholder' });
|
|
298
|
+
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled',
|
|
299
|
+
transform: booleanAttribute });
|
|
300
|
+
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
301
|
+
errorStateMatcher = input(null, ...(ngDevMode ? [{ debugName: "errorStateMatcher" }] : /* istanbul ignore next */ []));
|
|
302
|
+
// --- Outputs ---
|
|
303
|
+
timeChange = output();
|
|
304
|
+
// --- Internal state ---
|
|
305
|
+
/** @internal */ _value = signal(null, ...(ngDevMode ? [{ debugName: "_value" }] : /* istanbul ignore next */ []));
|
|
306
|
+
_focused = signal(false, ...(ngDevMode ? [{ debugName: "_focused" }] : /* istanbul ignore next */ []));
|
|
307
|
+
_disabled = signal(false, ...(ngDevMode ? [{ debugName: "_disabled" }] : /* istanbul ignore next */ []));
|
|
308
|
+
_ngControlDisabled = signal(false, ...(ngDevMode ? [{ debugName: "_ngControlDisabled" }] : /* istanbul ignore next */ []));
|
|
309
|
+
_required = signal(false, ...(ngDevMode ? [{ debugName: "_required" }] : /* istanbul ignore next */ []));
|
|
310
|
+
_errorState = signal(false, ...(ngDevMode ? [{ debugName: "_errorState" }] : /* istanbul ignore next */ []));
|
|
311
|
+
_readOnly = signal(false, ...(ngDevMode ? [{ debugName: "_readOnly" }] : /* istanbul ignore next */ []));
|
|
312
|
+
_panelOpen = signal(false, ...(ngDevMode ? [{ debugName: "_panelOpen" }] : /* istanbul ignore next */ []));
|
|
313
|
+
// --- FuiFormFieldControl ---
|
|
314
|
+
stateChanges = new Subject();
|
|
315
|
+
_uid = `fui-time-picker-${FuiTimePickerComponent.nextId++}`;
|
|
316
|
+
_ariaDescribedby = null;
|
|
317
|
+
// Form references
|
|
318
|
+
_parentForm = inject(NgForm, { optional: true });
|
|
319
|
+
_parentFormGroup = inject(FormGroupDirective, { optional: true });
|
|
320
|
+
_defaultErrorStateMatcher = inject(DefaultErrorStateMatcher);
|
|
321
|
+
_ngControlRef = injectNgControl();
|
|
322
|
+
get ngControl() {
|
|
323
|
+
return this._ngControlRef.ngControl;
|
|
324
|
+
}
|
|
325
|
+
// Interface signals
|
|
326
|
+
placeholder = computed(() => this.placeholderInput(), ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
327
|
+
required = this._required;
|
|
328
|
+
value = computed(() => {
|
|
329
|
+
const tv = this._value();
|
|
330
|
+
return tv ? timeValueToString(tv, this.showSeconds()) : null;
|
|
331
|
+
}, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
332
|
+
focused = this._focused;
|
|
333
|
+
disabled = computed(() => this._disabled() || this.disabledInput() || this._ngControlDisabled(), ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
334
|
+
errorState = this._errorState;
|
|
335
|
+
id = this._uid;
|
|
336
|
+
empty = computed(() => {
|
|
337
|
+
return this._value() === null;
|
|
338
|
+
}, ...(ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []));
|
|
339
|
+
// Display value formatted for current format
|
|
340
|
+
_displayValue = computed(() => {
|
|
341
|
+
return formatTime(this._value(), this.formatInput(), this.showSeconds());
|
|
342
|
+
}, ...(ngDevMode ? [{ debugName: "_displayValue" }] : /* istanbul ignore next */ []));
|
|
343
|
+
// Display value for form-field readOnly mode
|
|
344
|
+
displayValue = this._displayValue;
|
|
345
|
+
// Computed time options for dropdown
|
|
346
|
+
_timeOptions = computed(() => {
|
|
347
|
+
const minVal = this.min() ? parseISOTimeString(this.min()) : undefined;
|
|
348
|
+
const maxVal = this.max() ? parseISOTimeString(this.max()) : undefined;
|
|
349
|
+
return generateTimeOptions(this.formatInput(), this.minuteStep(), this.showSeconds(), minVal ?? undefined, maxVal ?? undefined);
|
|
350
|
+
}, ...(ngDevMode ? [{ debugName: "_timeOptions" }] : /* istanbul ignore next */ []));
|
|
351
|
+
// ViewChild
|
|
352
|
+
inputElement;
|
|
353
|
+
timeListPanel;
|
|
354
|
+
// Overlay
|
|
355
|
+
_overlayRef = null;
|
|
356
|
+
_overlaySubscriptions = new Subscription();
|
|
357
|
+
_overlayService = inject(FuiOverlayService);
|
|
358
|
+
_elementRef = inject(ElementRef);
|
|
359
|
+
_document = inject(DOCUMENT);
|
|
360
|
+
_ngZone = inject(NgZone);
|
|
361
|
+
_outsideClickSub;
|
|
362
|
+
// CVA callbacks
|
|
363
|
+
_onChange = () => {
|
|
364
|
+
/* noop */
|
|
365
|
+
};
|
|
366
|
+
_onTouched = () => {
|
|
367
|
+
/* noop */
|
|
368
|
+
};
|
|
369
|
+
constructor() {
|
|
370
|
+
void Promise.resolve().then(() => {
|
|
371
|
+
if (this._ngControlRef.ngControl) {
|
|
372
|
+
this._ngControlRef.ngControl.valueAccessor = this;
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
// Effect to emit state changes
|
|
376
|
+
effect(() => {
|
|
377
|
+
this.placeholderInput();
|
|
378
|
+
this.readonly();
|
|
379
|
+
this.disabledInput();
|
|
380
|
+
this.formatInput();
|
|
381
|
+
this.showSeconds();
|
|
382
|
+
this.minuteStep();
|
|
383
|
+
this.min();
|
|
384
|
+
this.max();
|
|
385
|
+
this.errorStateMatcher();
|
|
386
|
+
this._focused();
|
|
387
|
+
this._disabled();
|
|
388
|
+
this._value();
|
|
389
|
+
this._ngControlDisabled();
|
|
390
|
+
this._required();
|
|
391
|
+
this._errorState();
|
|
392
|
+
this.stateChanges.next();
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
ngDoCheck() {
|
|
396
|
+
if (this.ngControl) {
|
|
397
|
+
updateErrorState(this.ngControl, this._errorState, this.errorStateMatcher(), this._defaultErrorStateMatcher, this._parentForm, this._parentFormGroup, this.stateChanges);
|
|
398
|
+
syncRequiredState(this.ngControl, this._required, this.stateChanges);
|
|
399
|
+
syncNgControlDisabled(this.ngControl, this._ngControlDisabled, this.stateChanges);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
ngOnDestroy() {
|
|
403
|
+
this.stateChanges.complete();
|
|
404
|
+
this._outsideClickSub?.unsubscribe();
|
|
405
|
+
this._disposeOverlay();
|
|
406
|
+
}
|
|
407
|
+
// --- CVA ---
|
|
408
|
+
writeValue(value) {
|
|
409
|
+
if (value) {
|
|
410
|
+
const parsed = parseISOTimeString(value);
|
|
411
|
+
this._value.set(parsed);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
this._value.set(null);
|
|
415
|
+
}
|
|
416
|
+
this.stateChanges.next();
|
|
417
|
+
}
|
|
418
|
+
registerOnChange(fn) {
|
|
419
|
+
this._onChange = fn;
|
|
420
|
+
}
|
|
421
|
+
registerOnTouched(fn) {
|
|
422
|
+
this._onTouched = fn;
|
|
423
|
+
}
|
|
424
|
+
setDisabledState(isDisabled) {
|
|
425
|
+
this._disabled.set(isDisabled);
|
|
426
|
+
this.stateChanges.next();
|
|
427
|
+
}
|
|
428
|
+
// --- FuiFormFieldControl ---
|
|
429
|
+
onContainerClick(_event) {
|
|
430
|
+
if (!this.disabled()) {
|
|
431
|
+
this.inputElement?.nativeElement.focus();
|
|
432
|
+
if (!this._panelOpen()) {
|
|
433
|
+
this.open();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
setDescribedByIds(ids) {
|
|
438
|
+
this._ariaDescribedby = ids.length ? ids.join(' ') : null;
|
|
439
|
+
}
|
|
440
|
+
setReadOnly(readOnly) {
|
|
441
|
+
this._readOnly.set(readOnly);
|
|
442
|
+
}
|
|
443
|
+
// --- Panel open/close ---
|
|
444
|
+
open() {
|
|
445
|
+
if (this.disabled() || this.readonly() || this._panelOpen())
|
|
446
|
+
return;
|
|
447
|
+
requestAnimationFrame(() => {
|
|
448
|
+
this._panelOpen.set(true);
|
|
449
|
+
this._focused.set(true);
|
|
450
|
+
setTimeout(() => {
|
|
451
|
+
this._createOverlay();
|
|
452
|
+
this._listenForOutsideClicks();
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
close() {
|
|
457
|
+
if (!this._panelOpen())
|
|
458
|
+
return;
|
|
459
|
+
this._outsideClickSub?.unsubscribe();
|
|
460
|
+
this._panelOpen.set(false);
|
|
461
|
+
this._focused.set(false);
|
|
462
|
+
this._disposeOverlay();
|
|
463
|
+
this._onTouched();
|
|
464
|
+
setTimeout(() => {
|
|
465
|
+
this.inputElement?.nativeElement.focus();
|
|
466
|
+
}, 0);
|
|
467
|
+
}
|
|
468
|
+
_togglePanel() {
|
|
469
|
+
if (this.disabled() || this.readonly())
|
|
470
|
+
return;
|
|
471
|
+
if (this._panelOpen()) {
|
|
472
|
+
this.close();
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
this.open();
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
// --- Event handlers ---
|
|
479
|
+
_onManualInput(_event) {
|
|
480
|
+
// We handle parsing on blur, not on every keystroke
|
|
481
|
+
}
|
|
482
|
+
_onKeydown(event) {
|
|
483
|
+
if (event.key === 'Escape' && this._panelOpen()) {
|
|
484
|
+
event.preventDefault();
|
|
485
|
+
this.close();
|
|
486
|
+
}
|
|
487
|
+
else if (event.key === 'ArrowDown' && !this._panelOpen()) {
|
|
488
|
+
event.preventDefault();
|
|
489
|
+
this.open();
|
|
490
|
+
}
|
|
491
|
+
else if (event.key === 'Enter' && !this._panelOpen()) {
|
|
492
|
+
event.preventDefault();
|
|
493
|
+
this.open();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
_onFocus() {
|
|
497
|
+
this._focused.set(true);
|
|
498
|
+
}
|
|
499
|
+
_onBlur() {
|
|
500
|
+
const input = this.inputElement?.nativeElement;
|
|
501
|
+
if (!input)
|
|
502
|
+
return;
|
|
503
|
+
const text = input.value;
|
|
504
|
+
if (!text) {
|
|
505
|
+
this._setValue(null);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const parsed = parseTimeString(text, this.formatInput());
|
|
509
|
+
if (parsed) {
|
|
510
|
+
this._setValue(parsed);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
// Invalid input — revert to previous formatted value
|
|
514
|
+
input.value = this._displayValue();
|
|
515
|
+
}
|
|
516
|
+
if (!this._panelOpen()) {
|
|
517
|
+
this._onTouched();
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
/** Called when user selects an option from the time list dropdown. */
|
|
521
|
+
_onOptionSelected(value) {
|
|
522
|
+
this._setValue(value);
|
|
523
|
+
this.close();
|
|
524
|
+
}
|
|
525
|
+
// Start listening for outside clicks when panel opens
|
|
526
|
+
_listenForOutsideClicks() {
|
|
527
|
+
this._outsideClickSub?.unsubscribe();
|
|
528
|
+
this._ngZone.runOutsideAngular(() => {
|
|
529
|
+
setTimeout(() => {
|
|
530
|
+
this._outsideClickSub = fromEvent(this._document, 'click')
|
|
531
|
+
.pipe(filter(() => this._panelOpen()), filter((event) => {
|
|
532
|
+
const target = event.target;
|
|
533
|
+
const hostElement = this._elementRef.nativeElement;
|
|
534
|
+
const overlayElement = this._overlayRef?.overlayElement;
|
|
535
|
+
return !hostElement.contains(target) && !overlayElement?.contains(target);
|
|
536
|
+
}))
|
|
537
|
+
.subscribe(() => {
|
|
538
|
+
this._ngZone.run(() => {
|
|
539
|
+
this.close();
|
|
540
|
+
});
|
|
541
|
+
});
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
// --- Private helpers ---
|
|
546
|
+
_setValue(value) {
|
|
547
|
+
this._value.set(value);
|
|
548
|
+
const stringVal = value ? timeValueToString(value, this.showSeconds()) : null;
|
|
549
|
+
this._onChange(stringVal);
|
|
550
|
+
this.timeChange.emit(stringVal ?? '');
|
|
551
|
+
this.stateChanges.next();
|
|
552
|
+
}
|
|
553
|
+
_createOverlay() {
|
|
554
|
+
if (this._overlayRef || !this.timeListPanel)
|
|
555
|
+
return;
|
|
556
|
+
const triggerElement = this._elementRef.nativeElement;
|
|
557
|
+
const triggerWidth = triggerElement.getBoundingClientRect().width;
|
|
558
|
+
const positions = [
|
|
559
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
560
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
561
|
+
];
|
|
562
|
+
const positionStrategy = this._overlayService
|
|
563
|
+
.position()
|
|
564
|
+
.connectedTo(triggerElement, positions)
|
|
565
|
+
.withPush(true)
|
|
566
|
+
.withViewportMargin(8);
|
|
567
|
+
this._overlayRef = this._overlayService.create({
|
|
568
|
+
positionStrategy,
|
|
569
|
+
scrollStrategy: this._overlayService.scrollStrategies.reposition(),
|
|
570
|
+
hasBackdrop: true,
|
|
571
|
+
backdropClass: 'fui-time-picker-backdrop',
|
|
572
|
+
backdropClickBehavior: 'close',
|
|
573
|
+
panelClass: ['fui-time-picker-overlay-panel'],
|
|
574
|
+
minWidth: Math.max(triggerWidth, 160),
|
|
575
|
+
});
|
|
576
|
+
// Track overlay subscriptions for proper cleanup
|
|
577
|
+
this._overlaySubscriptions.unsubscribe();
|
|
578
|
+
this._overlaySubscriptions = new Subscription();
|
|
579
|
+
this._overlaySubscriptions.add(this._overlayRef.backdropClick.subscribe(() => {
|
|
580
|
+
this.close();
|
|
581
|
+
}));
|
|
582
|
+
this._overlaySubscriptions.add(this._overlayRef.keydownEvents.subscribe((event) => {
|
|
583
|
+
if (event.key === 'Escape') {
|
|
584
|
+
this.close();
|
|
585
|
+
}
|
|
586
|
+
}));
|
|
587
|
+
const panelElement = this.timeListPanel.nativeElement;
|
|
588
|
+
this._overlayRef.attach(panelElement);
|
|
589
|
+
}
|
|
590
|
+
_disposeOverlay() {
|
|
591
|
+
this._overlaySubscriptions.unsubscribe();
|
|
592
|
+
if (this._overlayRef) {
|
|
593
|
+
this._overlayRef.dispose();
|
|
594
|
+
this._overlayRef = null;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
598
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: FuiTimePickerComponent, isStandalone: true, selector: "fui-time-picker", inputs: { formatInput: { classPropertyName: "formatInput", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, placeholderInput: { classPropertyName: "placeholderInput", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { timeChange: "timeChange" }, host: { properties: { "attr.id": "id", "class.fui-time-picker--open": "_panelOpen()", "class.fui-time-picker--disabled": "disabled()", "class.fui-time-picker--focused": "focused()", "class.fui-time-picker--error": "errorState()", "class.fui-time-picker--readonly": "_readOnly()" }, classAttribute: "fui-time-picker" }, providers: [
|
|
599
|
+
{
|
|
600
|
+
provide: NG_VALUE_ACCESSOR,
|
|
601
|
+
useExisting: FuiTimePickerComponent,
|
|
602
|
+
multi: true,
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
provide: FUI_FORM_FIELD_CONTROL,
|
|
606
|
+
useExisting: FuiTimePickerComponent,
|
|
607
|
+
},
|
|
608
|
+
], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "timeListPanel", first: true, predicate: ["timeListPanel"], descendants: true }], ngImport: i0, template: "<div class=\"fui-time-picker__wrapper\">\n <input\n #inputElement\n class=\"fui-time-picker__input\"\n type=\"text\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? '' : null\"\n [attr.readonly]=\"readonly() ? '' : null\"\n [value]=\"_displayValue()\"\n [attr.aria-expanded]=\"_panelOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-describedby]=\"_ariaDescribedby\"\n [attr.aria-required]=\"required()\"\n [attr.aria-invalid]=\"errorState()\"\n role=\"combobox\"\n autocomplete=\"off\"\n (input)=\"_onManualInput($event)\"\n (keydown)=\"_onKeydown($event)\"\n (focus)=\"_onFocus()\"\n (blur)=\"_onBlur()\"\n />\n @if (!_readOnly()) {\n <button\n type=\"button\"\n class=\"fui-time-picker__toggle\"\n (click)=\"_togglePanel()\"\n [disabled]=\"disabled() || readonly()\"\n tabindex=\"-1\"\n aria-label=\"Toggle time picker\"\n >\n <fui-icon name=\"clock\" size=\"sm\"></fui-icon>\n </button>\n }\n</div>\n\n@if (_panelOpen()) {\n <div #timeListPanel class=\"fui-time-picker__panel\" role=\"dialog\" aria-label=\"Time selection\">\n <fui-time-list\n [options]=\"_timeOptions()\"\n [selectedValue]=\"_value()\"\n [format]=\"formatInput()\"\n (optionSelected)=\"_onOptionSelected($event)\"\n />\n </div>\n}\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}.fui-time-picker{--fui-time-picker-font-size: var(--fui-font-size-02);--fui-time-picker-panel-border-radius: var(--fui-border-radius-md);--fui-time-picker-panel-shadow: var(--fui-shadow-03);--fui-time-picker-panel-bg: var(--fui-surface-00);--fui-time-picker-toggle-size: 1.5rem;display:inline-block;width:100%;position:relative}.fui-time-picker__wrapper{width:100%;min-height:100%;display:flex;align-items:center;gap:var(--fui-spacing-01);cursor:pointer;background:transparent;border:none}.fui-time-picker__input{flex:1;min-width:0;border:none;outline:none;background:transparent;font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02);font-weight:var(--fui-font-weight-regular);line-height:var(--fui-line-height-02);letter-spacing:var(--fui-letter-spacing-normal);color:var(--fui-text-primary);padding:0;cursor:text}.fui-time-picker__input::placeholder{color:var(--fui-text-disabled)}.fui-time-picker__input:disabled{cursor:not-allowed;opacity:.5}.fui-time-picker__toggle{background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;outline:none}.fui-time-picker__toggle:focus-visible{outline:2px solid var(--fui-primary);outline-offset:2px}.fui-time-picker__toggle{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--fui-time-picker-toggle-size);height:var(--fui-time-picker-toggle-size);color:var(--fui-text-secondary);border-radius:var(--fui-border-radius-sm);transition:color var(--fui-duration-fast-02) var(--fui-ease-standard) 0ms}.fui-time-picker__toggle:hover:not(:disabled){color:var(--fui-text-primary)}.fui-time-picker__toggle:disabled{color:var(--fui-text-disabled);cursor:not-allowed}.fui-time-picker__panel{background:var(--fui-time-picker-panel-bg);border:1px solid var(--fui-border-color);border-radius:var(--fui-time-picker-panel-border-radius);box-shadow:var(--fui-time-picker-panel-shadow);transition:opacity,transform var(--fui-duration-fast-02) var(--fui-ease-standard) 0ms}.fui-time-picker--disabled{pointer-events:none}.fui-time-picker--disabled .fui-time-picker__wrapper{cursor:not-allowed;opacity:.5}.fui-time-picker--readonly{pointer-events:none}.fui-time-picker--readonly .fui-time-picker__wrapper{cursor:default;opacity:1}.fui-time-picker--readonly .fui-time-picker__input{color:var(--fui-text-primary)!important;-webkit-text-fill-color:var(--fui-text-primary)!important;cursor:default;opacity:1}.fui-time-picker--readonly .fui-time-picker__input:disabled{opacity:1;cursor:default}.fui-time-picker-backdrop{background:transparent}.fui-time-picker-overlay-panel{z-index:var(--fui-z-popover, 1060)}@media(prefers-contrast:high){.fui-time-picker__panel{border-width:2px}}@media(prefers-reduced-motion:reduce){.fui-time-picker__panel{transition:none}}\n"], dependencies: [{ kind: "component", type: FuiIconComponent, selector: "fui-icon", inputs: ["name", "size", "weight", "color", "ariaLabel", "spin", "pulse"] }, { kind: "component", type: FuiTimeListComponent, selector: "fui-time-list", inputs: ["options", "selectedValue", "format"], outputs: ["optionSelected"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
609
|
+
}
|
|
610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuiTimePickerComponent, decorators: [{
|
|
611
|
+
type: Component,
|
|
612
|
+
args: [{ selector: 'fui-time-picker', standalone: true, imports: [FuiIconComponent, FuiTimeListComponent], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
613
|
+
class: 'fui-time-picker',
|
|
614
|
+
'[attr.id]': 'id',
|
|
615
|
+
'[class.fui-time-picker--open]': '_panelOpen()',
|
|
616
|
+
'[class.fui-time-picker--disabled]': 'disabled()',
|
|
617
|
+
'[class.fui-time-picker--focused]': 'focused()',
|
|
618
|
+
'[class.fui-time-picker--error]': 'errorState()',
|
|
619
|
+
'[class.fui-time-picker--readonly]': '_readOnly()',
|
|
620
|
+
}, providers: [
|
|
621
|
+
{
|
|
622
|
+
provide: NG_VALUE_ACCESSOR,
|
|
623
|
+
useExisting: FuiTimePickerComponent,
|
|
624
|
+
multi: true,
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
provide: FUI_FORM_FIELD_CONTROL,
|
|
628
|
+
useExisting: FuiTimePickerComponent,
|
|
629
|
+
},
|
|
630
|
+
], template: "<div class=\"fui-time-picker__wrapper\">\n <input\n #inputElement\n class=\"fui-time-picker__input\"\n type=\"text\"\n [attr.placeholder]=\"placeholder()\"\n [attr.disabled]=\"disabled() ? '' : null\"\n [attr.readonly]=\"readonly() ? '' : null\"\n [value]=\"_displayValue()\"\n [attr.aria-expanded]=\"_panelOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-describedby]=\"_ariaDescribedby\"\n [attr.aria-required]=\"required()\"\n [attr.aria-invalid]=\"errorState()\"\n role=\"combobox\"\n autocomplete=\"off\"\n (input)=\"_onManualInput($event)\"\n (keydown)=\"_onKeydown($event)\"\n (focus)=\"_onFocus()\"\n (blur)=\"_onBlur()\"\n />\n @if (!_readOnly()) {\n <button\n type=\"button\"\n class=\"fui-time-picker__toggle\"\n (click)=\"_togglePanel()\"\n [disabled]=\"disabled() || readonly()\"\n tabindex=\"-1\"\n aria-label=\"Toggle time picker\"\n >\n <fui-icon name=\"clock\" size=\"sm\"></fui-icon>\n </button>\n }\n</div>\n\n@if (_panelOpen()) {\n <div #timeListPanel class=\"fui-time-picker__panel\" role=\"dialog\" aria-label=\"Time selection\">\n <fui-time-list\n [options]=\"_timeOptions()\"\n [selectedValue]=\"_value()\"\n [format]=\"formatInput()\"\n (optionSelected)=\"_onOptionSelected($event)\"\n />\n </div>\n}\n", styles: ["@keyframes fui-skeleton-pulse{0%{opacity:1}50%{opacity:.4}to{opacity:1}}@keyframes fui-spin{to{transform:rotate(360deg)}}@keyframes fui-shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.fui-motion-fade-in{transition:opacity var(--fui-duration-fast-02) var(--fui-ease-entrance) 0ms}.fui-motion-fade-out{transition:opacity var(--fui-duration-fast-01) var(--fui-ease-exit) 0ms}.fui-motion-slide-in-bottom{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-bottom.fui-motion-entering{transform:translateY(1rem)}.fui-motion-slide-in-top{transition:transform var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:translateY(0)}.fui-motion-slide-in-top.fui-motion-entering{transform:translateY(-1rem)}.fui-motion-scale-in{transition:transform,opacity var(--fui-duration-moderate-01) var(--fui-ease-entrance) 0ms;transform:scale(1);opacity:1}.fui-motion-scale-in.fui-motion-entering{transform:scale(.95);opacity:0}.fui-no-motion{transition:none!important;animation:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@keyframes fui-pulse{0%{transform:scale(1);opacity:1}50%{transform:scale(1.05)}to{transform:scale(1);opacity:1}}@keyframes fui-slide-in{0%{transform:translate(120%)}to{transform:translate(0)}}.fui-slide-in{animation:fui-slide-in var(--fui-duration-moderate-01) var(--fui-ease-entrance)}.fui-time-picker{--fui-time-picker-font-size: var(--fui-font-size-02);--fui-time-picker-panel-border-radius: var(--fui-border-radius-md);--fui-time-picker-panel-shadow: var(--fui-shadow-03);--fui-time-picker-panel-bg: var(--fui-surface-00);--fui-time-picker-toggle-size: 1.5rem;display:inline-block;width:100%;position:relative}.fui-time-picker__wrapper{width:100%;min-height:100%;display:flex;align-items:center;gap:var(--fui-spacing-01);cursor:pointer;background:transparent;border:none}.fui-time-picker__input{flex:1;min-width:0;border:none;outline:none;background:transparent;font-family:var(--fui-font-family-sans);font-size:var(--fui-font-size-02);font-weight:var(--fui-font-weight-regular);line-height:var(--fui-line-height-02);letter-spacing:var(--fui-letter-spacing-normal);color:var(--fui-text-primary);padding:0;cursor:text}.fui-time-picker__input::placeholder{color:var(--fui-text-disabled)}.fui-time-picker__input:disabled{cursor:not-allowed;opacity:.5}.fui-time-picker__toggle{background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;outline:none}.fui-time-picker__toggle:focus-visible{outline:2px solid var(--fui-primary);outline-offset:2px}.fui-time-picker__toggle{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:var(--fui-time-picker-toggle-size);height:var(--fui-time-picker-toggle-size);color:var(--fui-text-secondary);border-radius:var(--fui-border-radius-sm);transition:color var(--fui-duration-fast-02) var(--fui-ease-standard) 0ms}.fui-time-picker__toggle:hover:not(:disabled){color:var(--fui-text-primary)}.fui-time-picker__toggle:disabled{color:var(--fui-text-disabled);cursor:not-allowed}.fui-time-picker__panel{background:var(--fui-time-picker-panel-bg);border:1px solid var(--fui-border-color);border-radius:var(--fui-time-picker-panel-border-radius);box-shadow:var(--fui-time-picker-panel-shadow);transition:opacity,transform var(--fui-duration-fast-02) var(--fui-ease-standard) 0ms}.fui-time-picker--disabled{pointer-events:none}.fui-time-picker--disabled .fui-time-picker__wrapper{cursor:not-allowed;opacity:.5}.fui-time-picker--readonly{pointer-events:none}.fui-time-picker--readonly .fui-time-picker__wrapper{cursor:default;opacity:1}.fui-time-picker--readonly .fui-time-picker__input{color:var(--fui-text-primary)!important;-webkit-text-fill-color:var(--fui-text-primary)!important;cursor:default;opacity:1}.fui-time-picker--readonly .fui-time-picker__input:disabled{opacity:1;cursor:default}.fui-time-picker-backdrop{background:transparent}.fui-time-picker-overlay-panel{z-index:var(--fui-z-popover, 1060)}@media(prefers-contrast:high){.fui-time-picker__panel{border-width:2px}}@media(prefers-reduced-motion:reduce){.fui-time-picker__panel{transition:none}}\n"] }]
|
|
631
|
+
}], ctorParameters: () => [], propDecorators: { formatInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], placeholderInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], errorStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorStateMatcher", required: false }] }], timeChange: [{ type: i0.Output, args: ["timeChange"] }], inputElement: [{
|
|
632
|
+
type: ViewChild,
|
|
633
|
+
args: ['inputElement', { static: false }]
|
|
634
|
+
}], timeListPanel: [{
|
|
635
|
+
type: ViewChild,
|
|
636
|
+
args: ['timeListPanel', { static: false }]
|
|
637
|
+
}] } });
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Generated bundle index. Do not edit.
|
|
641
|
+
*/
|
|
642
|
+
|
|
643
|
+
export { FuiTimeListComponent, FuiTimePickerComponent, compareTime, formatTime, generateTimeOptions, isTimeInRange, parseISOTimeString, parseTimeString, timeToMinutes, timeValueToString };
|
|
644
|
+
//# sourceMappingURL=raintonic-formaui-components-time-picker.mjs.map
|