@tekus/design-system 5.31.0 → 5.32.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/fesm2022/tekus-design-system-components-color-picker.mjs +1028 -0
- package/fesm2022/tekus-design-system-components-color-picker.mjs.map +1 -0
- package/fesm2022/tekus-design-system-components-date-picker.mjs +269 -204
- package/fesm2022/tekus-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-icon.mjs +119 -7
- package/fesm2022/tekus-design-system-components-icon.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-table.mjs +38 -6
- package/fesm2022/tekus-design-system-components-table.mjs.map +1 -1
- package/fesm2022/tekus-design-system-components-time-picker.mjs +443 -0
- package/fesm2022/tekus-design-system-components-time-picker.mjs.map +1 -0
- package/fesm2022/tekus-design-system-utils-wcag-contrast.mjs +97 -0
- package/fesm2022/tekus-design-system-utils-wcag-contrast.mjs.map +1 -0
- package/package.json +13 -1
- package/types/tekus-design-system-components-color-picker.d.ts +356 -0
- package/types/tekus-design-system-components-date-picker.d.ts +191 -141
- package/types/tekus-design-system-components-icon.d.ts +10 -1
- package/types/tekus-design-system-components-table.d.ts +26 -1
- package/types/tekus-design-system-components-time-picker.d.ts +203 -0
- package/types/tekus-design-system-utils-wcag-contrast.d.ts +55 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor, Validator, NgControl, FormControl, ValidationErrors } from '@angular/forms';
|
|
4
|
+
import { InputMask } from 'primeng/inputmask';
|
|
5
|
+
|
|
6
|
+
declare class TimePickerComponent implements OnInit, ControlValueAccessor, Validator {
|
|
7
|
+
/** @internal */
|
|
8
|
+
readonly ngControl: NgControl | null;
|
|
9
|
+
/** @internal */
|
|
10
|
+
private readonly destroyRef;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* @description
|
|
14
|
+
* Marks the field as required. When `true`, the component returns a
|
|
15
|
+
* `{ required: true }` validation error when no time is selected.
|
|
16
|
+
*
|
|
17
|
+
* @default false
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <tk-time-picker [required]="true" errorMessage="Time is required" />
|
|
21
|
+
*/
|
|
22
|
+
required: _angular_core.InputSignal<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* @description
|
|
25
|
+
* Controls how the user enters the time.
|
|
26
|
+
* - `true` — direct keyboard input via a masked field; the clock icon opens
|
|
27
|
+
* a spinner overlay for visual selection. Only 24-hour format is supported
|
|
28
|
+
* in this mode.
|
|
29
|
+
* - `false` — spinners only; keyboard input is disabled.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
editableInput: _angular_core.InputSignal<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* @description
|
|
36
|
+
* Time display format used both for the masked input and for PrimeNG's spinner.
|
|
37
|
+
* Supported tokens: `HH` (24-h hours), `hh` (12-h hours), `mm` (minutes),
|
|
38
|
+
* `ss` (seconds).
|
|
39
|
+
*
|
|
40
|
+
* @default 'HH:mm'
|
|
41
|
+
*/
|
|
42
|
+
timeFormat: _angular_core.InputSignal<string>;
|
|
43
|
+
/**
|
|
44
|
+
* @description
|
|
45
|
+
* Hour format for the time spinner.
|
|
46
|
+
* - `'24'` — 0–23 hours.
|
|
47
|
+
* - `'12'` — 1–12 hours with AM/PM toggle. Ignored when `editableInput=true`.
|
|
48
|
+
*
|
|
49
|
+
* @default '24'
|
|
50
|
+
*/
|
|
51
|
+
hourFormat: _angular_core.InputSignal<"12" | "24">;
|
|
52
|
+
/** @description Hour increment/decrement step for the spinner. @default 1 */
|
|
53
|
+
stepHour: _angular_core.InputSignal<number>;
|
|
54
|
+
/** @description Minute increment/decrement step for the spinner. @default 1 */
|
|
55
|
+
stepMinute: _angular_core.InputSignal<number>;
|
|
56
|
+
/** @description Second increment/decrement step for the spinner. @default 1 */
|
|
57
|
+
stepSecond: _angular_core.InputSignal<number>;
|
|
58
|
+
/**
|
|
59
|
+
* @description Whether to show the seconds segment. Only active when `hourFormat="24"`.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
showSeconds: _angular_core.InputSignal<boolean>;
|
|
63
|
+
/** @description Shows a clear (×) button that resets the value to `null`. @default true */
|
|
64
|
+
showClear: _angular_core.InputSignal<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* @description
|
|
67
|
+
* Shows the clock icon inside the input field.
|
|
68
|
+
* When `false`, the overlay can only be opened by clicking the input itself.
|
|
69
|
+
*
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
showIcon: _angular_core.InputSignal<boolean>;
|
|
73
|
+
/** @description Disables the component. @default false */
|
|
74
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* @description
|
|
77
|
+
* Earliest selectable time. Enforced through Angular form validation only —
|
|
78
|
+
* the field value is never cleared when the limit is reached.
|
|
79
|
+
*
|
|
80
|
+
* @default null
|
|
81
|
+
*/
|
|
82
|
+
minDate: _angular_core.InputSignal<Date | null>;
|
|
83
|
+
/**
|
|
84
|
+
* @description Latest selectable time. Same validation-only semantics as `minDate`.
|
|
85
|
+
* @default null
|
|
86
|
+
*/
|
|
87
|
+
maxDate: _angular_core.InputSignal<Date | null>;
|
|
88
|
+
/** @description Floating label text shown above the input field. @default 'Select a time' */
|
|
89
|
+
labelText: _angular_core.InputSignal<string>;
|
|
90
|
+
/**
|
|
91
|
+
* @description
|
|
92
|
+
* Validation error message rendered beneath the field when the bound control
|
|
93
|
+
* is invalid and the field has been dirtied or touched.
|
|
94
|
+
*
|
|
95
|
+
* @default null
|
|
96
|
+
*/
|
|
97
|
+
errorMessage: _angular_core.InputSignal<string | null>;
|
|
98
|
+
/**
|
|
99
|
+
* @description
|
|
100
|
+
* Optional external `FormControl` to bind when not using the standard
|
|
101
|
+
* `formControl` / `formControlName` / `ngModel` directives.
|
|
102
|
+
*/
|
|
103
|
+
control: _angular_core.InputSignal<FormControl<any> | undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* @description
|
|
106
|
+
* Target element or CSS selector to which the overlay panel is appended.
|
|
107
|
+
* @default 'body'
|
|
108
|
+
*/
|
|
109
|
+
appendTo: _angular_core.InputSignal<string | HTMLElement | null | undefined>;
|
|
110
|
+
/**
|
|
111
|
+
* @description
|
|
112
|
+
* Two-way signal binding for the selected time value (`Date | null`).
|
|
113
|
+
*/
|
|
114
|
+
modelValue: _angular_core.ModelSignal<Date | null>;
|
|
115
|
+
/** @description Emits the selected value whenever a complete time is chosen. */
|
|
116
|
+
handleSelect: _angular_core.OutputEmitterRef<Date>;
|
|
117
|
+
/** @description Emits when the user clears the field via the clear button. */
|
|
118
|
+
handleClear: _angular_core.OutputEmitterRef<void>;
|
|
119
|
+
/** @internal */
|
|
120
|
+
disabledStatus: _angular_core.WritableSignal<boolean>;
|
|
121
|
+
/** @internal */
|
|
122
|
+
effectiveDisabled: _angular_core.Signal<boolean>;
|
|
123
|
+
/** @internal */
|
|
124
|
+
readonly maskInput: _angular_core.Signal<InputMask | undefined>;
|
|
125
|
+
/**
|
|
126
|
+
* @description
|
|
127
|
+
* Forces `'24'` when `editableInput=true` because the InputMask digit-only
|
|
128
|
+
* pattern cannot represent AM/PM tokens.
|
|
129
|
+
*/
|
|
130
|
+
effectiveHourFormat: _angular_core.Signal<"12" | "24">;
|
|
131
|
+
/**
|
|
132
|
+
* @description
|
|
133
|
+
* PrimeNG InputMask pattern derived from `timeFormat` by replacing all
|
|
134
|
+
* time-letter placeholders with the digit wildcard `'9'`.
|
|
135
|
+
*/
|
|
136
|
+
effectiveTimeMask: _angular_core.Signal<string>;
|
|
137
|
+
/**
|
|
138
|
+
* @description
|
|
139
|
+
* Formats the current `modelValue` as a time string matching `timeFormat`,
|
|
140
|
+
* bound to the InputMask via `[ngModel]`.
|
|
141
|
+
*/
|
|
142
|
+
maskedTimeValue: _angular_core.Signal<string>;
|
|
143
|
+
/** @internal */
|
|
144
|
+
effectiveShowSeconds: _angular_core.Signal<boolean>;
|
|
145
|
+
/** @internal */
|
|
146
|
+
private readonly internalControl;
|
|
147
|
+
/** @internal */
|
|
148
|
+
readonly effectiveControl: _angular_core.Signal<FormControl<any>>;
|
|
149
|
+
/** @internal */
|
|
150
|
+
readonly uid: string;
|
|
151
|
+
/** @internal */
|
|
152
|
+
private readonly partialMask;
|
|
153
|
+
/** @internal */
|
|
154
|
+
private readonly invalidTimeInput;
|
|
155
|
+
/** @internal */ onChange: (value: Date | null) => void;
|
|
156
|
+
/** @internal */ onTouched: () => void;
|
|
157
|
+
/** @internal */ onValidatorChange: () => void;
|
|
158
|
+
/** @internal */ private lastValue;
|
|
159
|
+
/** @internal */ private readonly boundValidate;
|
|
160
|
+
/** @inheritdoc */
|
|
161
|
+
ngOnInit(): void;
|
|
162
|
+
/** @inheritdoc */
|
|
163
|
+
writeValue(value: Date | null): void;
|
|
164
|
+
/** @inheritdoc */
|
|
165
|
+
registerOnChange(fn: (value: Date | null) => void): void;
|
|
166
|
+
/** @inheritdoc */
|
|
167
|
+
registerOnTouched(fn: () => void): void;
|
|
168
|
+
/** @inheritdoc */
|
|
169
|
+
registerOnValidatorChange(fn: () => void): void;
|
|
170
|
+
/** @inheritdoc */
|
|
171
|
+
validate(): ValidationErrors | null;
|
|
172
|
+
/** @inheritdoc */
|
|
173
|
+
setDisabledState(isDisabled: boolean): void;
|
|
174
|
+
/** @description Marks the control as touched when the user leaves the field. */
|
|
175
|
+
onBlur(): void;
|
|
176
|
+
/** @description Programmatically clears the selected value, resetting it to `null`. */
|
|
177
|
+
clear(): void;
|
|
178
|
+
/**
|
|
179
|
+
* @description
|
|
180
|
+
* Parses the string emitted by InputMask and propagates the resulting Date.
|
|
181
|
+
*/
|
|
182
|
+
onMaskedTimeChange(timeStr: string): void;
|
|
183
|
+
/**
|
|
184
|
+
* @description
|
|
185
|
+
* Handles value changes from the hidden spinner overlay in mask+overlay mode.
|
|
186
|
+
*/
|
|
187
|
+
onOverlayTimeChange(value: Date | null): void;
|
|
188
|
+
/**
|
|
189
|
+
* @description
|
|
190
|
+
* Fires when the spinner overlay opens. If no value is selected, auto-commits
|
|
191
|
+
* the time that PrimeNG displays by default (minDate or current time).
|
|
192
|
+
*/
|
|
193
|
+
onOverlayShow(): void;
|
|
194
|
+
/**
|
|
195
|
+
* @description
|
|
196
|
+
* Adjusts hours or minutes when the spinner rolls over a unit boundary.
|
|
197
|
+
*/
|
|
198
|
+
private applyTimeCascading;
|
|
199
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TimePickerComponent, never>;
|
|
200
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<TimePickerComponent, "tk-time-picker", never, { "required": { "alias": "required"; "required": false; "isSignal": true; }; "editableInput": { "alias": "editableInput"; "required": false; "isSignal": true; }; "timeFormat": { "alias": "timeFormat"; "required": false; "isSignal": true; }; "hourFormat": { "alias": "hourFormat"; "required": false; "isSignal": true; }; "stepHour": { "alias": "stepHour"; "required": false; "isSignal": true; }; "stepMinute": { "alias": "stepMinute"; "required": false; "isSignal": true; }; "stepSecond": { "alias": "stepSecond"; "required": false; "isSignal": true; }; "showSeconds": { "alias": "showSeconds"; "required": false; "isSignal": true; }; "showClear": { "alias": "showClear"; "required": false; "isSignal": true; }; "showIcon": { "alias": "showIcon"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "minDate": { "alias": "minDate"; "required": false; "isSignal": true; }; "maxDate": { "alias": "maxDate"; "required": false; "isSignal": true; }; "labelText": { "alias": "labelText"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; "appendTo": { "alias": "appendTo"; "required": false; "isSignal": true; }; "modelValue": { "alias": "modelValue"; "required": false; "isSignal": true; }; }, { "modelValue": "modelValueChange"; "handleSelect": "handleSelect"; "handleClear": "handleClear"; }, never, never, true, never>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { TimePickerComponent };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure utilities implementing the official WCAG 2.x contrast formula
|
|
3
|
+
* (relative luminance + contrast ratio).
|
|
4
|
+
*
|
|
5
|
+
* Thresholds follow the normal-text criteria (conservative):
|
|
6
|
+
* `>= 7` AAA, `>= 4.5` AA, otherwise `fail`.
|
|
7
|
+
*/
|
|
8
|
+
type WcagLevel = 'AAA' | 'AA' | 'fail';
|
|
9
|
+
interface RgbColor {
|
|
10
|
+
r: number;
|
|
11
|
+
g: number;
|
|
12
|
+
b: number;
|
|
13
|
+
}
|
|
14
|
+
interface ContrastResult {
|
|
15
|
+
ratio: number;
|
|
16
|
+
level: WcagLevel;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parses a hex color (`#abc`, `abc`, `#aabbcc` or `aabbcc`) into RGB channels (0–255).
|
|
20
|
+
* Returns `null` when the value is not a valid hex color.
|
|
21
|
+
*/
|
|
22
|
+
declare function hexToRgb(hex: string): RgbColor | null;
|
|
23
|
+
/**
|
|
24
|
+
* WCAG relative luminance of a hex color (0 = black, 1 = white).
|
|
25
|
+
* Returns `NaN` for invalid hex values.
|
|
26
|
+
*/
|
|
27
|
+
declare function relativeLuminance(hex: string): number;
|
|
28
|
+
/**
|
|
29
|
+
* Contrast ratio between two hex colors, rounded to 2 decimals.
|
|
30
|
+
* Range: 1 (identical) to 21 (black on white).
|
|
31
|
+
*/
|
|
32
|
+
declare function calcContrastRatio(bg: string, fg: string): number;
|
|
33
|
+
/**
|
|
34
|
+
* Maps a contrast ratio to its WCAG level for normal text:
|
|
35
|
+
* `>= 7` → AAA, `>= 4.5` → AA, otherwise `fail`.
|
|
36
|
+
*/
|
|
37
|
+
declare function resolveWcagLevel(ratio: number): WcagLevel;
|
|
38
|
+
/**
|
|
39
|
+
* Convenience helper combining {@link calcContrastRatio} and {@link resolveWcagLevel}.
|
|
40
|
+
*/
|
|
41
|
+
declare function getContrastResult(bg: string, fg: string): ContrastResult;
|
|
42
|
+
/**
|
|
43
|
+
* Whether a hex color is perceived as light, using the ITU-R BT.601
|
|
44
|
+
* perceived-luminance formula normalized to [0, 1] with a 0.5 threshold.
|
|
45
|
+
* Invalid hex values are treated as dark (`false`).
|
|
46
|
+
*/
|
|
47
|
+
declare function isLightColor(hex: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Ideal text color over the given background:
|
|
50
|
+
* black (`#000000`) on light backgrounds, white (`#ffffff`) on dark ones.
|
|
51
|
+
*/
|
|
52
|
+
declare function getContrastTextColor(background: string): string;
|
|
53
|
+
|
|
54
|
+
export { calcContrastRatio, getContrastResult, getContrastTextColor, hexToRgb, isLightColor, relativeLuminance, resolveWcagLevel };
|
|
55
|
+
export type { ContrastResult, RgbColor, WcagLevel };
|