@cdevhub/ngx-tw 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/LICENSE +21 -0
- package/README.md +134 -0
- package/fesm2022/cdevhub-ngx-tw-accordion.mjs +108 -0
- package/fesm2022/cdevhub-ngx-tw-accordion.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-alert.mjs +240 -0
- package/fesm2022/cdevhub-ngx-tw-alert.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-avatar.mjs +287 -0
- package/fesm2022/cdevhub-ngx-tw-avatar.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-badge.mjs +332 -0
- package/fesm2022/cdevhub-ngx-tw-badge.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs +452 -0
- package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-button.mjs +227 -0
- package/fesm2022/cdevhub-ngx-tw-button.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs +417 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-testing.mjs +232 -0
- package/fesm2022/cdevhub-ngx-tw-calendar-testing.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-calendar.mjs +4482 -0
- package/fesm2022/cdevhub-ngx-tw-calendar.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-card.mjs +157 -0
- package/fesm2022/cdevhub-ngx-tw-card.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-carousel.mjs +1454 -0
- package/fesm2022/cdevhub-ngx-tw-carousel.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-checkbox.mjs +593 -0
- package/fesm2022/cdevhub-ngx-tw-checkbox.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-code-block.mjs +228 -0
- package/fesm2022/cdevhub-ngx-tw-code-block.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-collapsible.mjs +510 -0
- package/fesm2022/cdevhub-ngx-tw-collapsible.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-combobox.mjs +1721 -0
- package/fesm2022/cdevhub-ngx-tw-combobox.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-command-palette.mjs +721 -0
- package/fesm2022/cdevhub-ngx-tw-command-palette.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-core.mjs +861 -0
- package/fesm2022/cdevhub-ngx-tw-core.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-date-picker.mjs +1558 -0
- package/fesm2022/cdevhub-ngx-tw-date-picker.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs +1833 -0
- package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs +693 -0
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-empty-state.mjs +331 -0
- package/fesm2022/cdevhub-ngx-tw-empty-state.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-flip-card.mjs +289 -0
- package/fesm2022/cdevhub-ngx-tw-flip-card.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-form-field.mjs +572 -0
- package/fesm2022/cdevhub-ngx-tw-form-field.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs +36 -0
- package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-icon.mjs +278 -0
- package/fesm2022/cdevhub-ngx-tw-icon.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-input.mjs +355 -0
- package/fesm2022/cdevhub-ngx-tw-input.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-item.mjs +241 -0
- package/fesm2022/cdevhub-ngx-tw-item.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-menu.mjs +433 -0
- package/fesm2022/cdevhub-ngx-tw-menu.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-paginator.mjs +691 -0
- package/fesm2022/cdevhub-ngx-tw-paginator.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-popover.mjs +678 -0
- package/fesm2022/cdevhub-ngx-tw-popover.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs +335 -0
- package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-radio.mjs +708 -0
- package/fesm2022/cdevhub-ngx-tw-radio.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs +319 -0
- package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-select.mjs +1722 -0
- package/fesm2022/cdevhub-ngx-tw-select.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-separator.mjs +115 -0
- package/fesm2022/cdevhub-ngx-tw-separator.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs +768 -0
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-skeleton.mjs +149 -0
- package/fesm2022/cdevhub-ngx-tw-skeleton.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-slider.mjs +1147 -0
- package/fesm2022/cdevhub-ngx-tw-slider.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-sort.mjs +346 -0
- package/fesm2022/cdevhub-ngx-tw-sort.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-spinner.mjs +186 -0
- package/fesm2022/cdevhub-ngx-tw-spinner.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-split.mjs +1082 -0
- package/fesm2022/cdevhub-ngx-tw-split.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-stat.mjs +579 -0
- package/fesm2022/cdevhub-ngx-tw-stat.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-stepper.mjs +443 -0
- package/fesm2022/cdevhub-ngx-tw-stepper.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-switch.mjs +391 -0
- package/fesm2022/cdevhub-ngx-tw-switch.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs +315 -0
- package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-table.mjs +994 -0
- package/fesm2022/cdevhub-ngx-tw-table.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tabs.mjs +508 -0
- package/fesm2022/cdevhub-ngx-tw-tabs.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-textarea.mjs +147 -0
- package/fesm2022/cdevhub-ngx-tw-textarea.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-theme.mjs +178 -0
- package/fesm2022/cdevhub-ngx-tw-theme.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-time-picker.mjs +1344 -0
- package/fesm2022/cdevhub-ngx-tw-time-picker.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-timeline.mjs +1136 -0
- package/fesm2022/cdevhub-ngx-tw-timeline.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-toast.mjs +1311 -0
- package/fesm2022/cdevhub-ngx-tw-toast.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tooltip.mjs +533 -0
- package/fesm2022/cdevhub-ngx-tw-tooltip.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw.mjs +61 -0
- package/fesm2022/cdevhub-ngx-tw.mjs.map +1 -0
- package/package.json +265 -0
- package/theme/_base.css +394 -0
- package/theme/_dark.css +510 -0
- package/theme/_high-contrast.css +290 -0
- package/theme/_semantic.css +317 -0
- package/theme/_typography.css +9 -0
- package/theme/index.css +54 -0
- package/types/cdevhub-ngx-tw-accordion.d.ts +48 -0
- package/types/cdevhub-ngx-tw-alert.d.ts +67 -0
- package/types/cdevhub-ngx-tw-avatar.d.ts +79 -0
- package/types/cdevhub-ngx-tw-badge.d.ts +94 -0
- package/types/cdevhub-ngx-tw-breadcrumbs.d.ts +227 -0
- package/types/cdevhub-ngx-tw-button.d.ts +74 -0
- package/types/cdevhub-ngx-tw-calendar-luxon.d.ts +200 -0
- package/types/cdevhub-ngx-tw-calendar-testing.d.ts +113 -0
- package/types/cdevhub-ngx-tw-calendar.d.ts +1704 -0
- package/types/cdevhub-ngx-tw-card.d.ts +48 -0
- package/types/cdevhub-ngx-tw-carousel.d.ts +406 -0
- package/types/cdevhub-ngx-tw-checkbox.d.ts +136 -0
- package/types/cdevhub-ngx-tw-code-block.d.ts +93 -0
- package/types/cdevhub-ngx-tw-collapsible.d.ts +151 -0
- package/types/cdevhub-ngx-tw-combobox.d.ts +389 -0
- package/types/cdevhub-ngx-tw-command-palette.d.ts +215 -0
- package/types/cdevhub-ngx-tw-core.d.ts +719 -0
- package/types/cdevhub-ngx-tw-date-picker.d.ts +317 -0
- package/types/cdevhub-ngx-tw-date-range-picker.d.ts +313 -0
- package/types/cdevhub-ngx-tw-dialog.d.ts +303 -0
- package/types/cdevhub-ngx-tw-empty-state.d.ts +104 -0
- package/types/cdevhub-ngx-tw-flip-card.d.ts +95 -0
- package/types/cdevhub-ngx-tw-form-field.d.ts +210 -0
- package/types/cdevhub-ngx-tw-icon-lucide.d.ts +29 -0
- package/types/cdevhub-ngx-tw-icon.d.ts +134 -0
- package/types/cdevhub-ngx-tw-input.d.ts +110 -0
- package/types/cdevhub-ngx-tw-item.d.ts +70 -0
- package/types/cdevhub-ngx-tw-menu.d.ts +99 -0
- package/types/cdevhub-ngx-tw-paginator.d.ts +305 -0
- package/types/cdevhub-ngx-tw-popover.d.ts +157 -0
- package/types/cdevhub-ngx-tw-progress-bar.d.ts +100 -0
- package/types/cdevhub-ngx-tw-radio.d.ts +174 -0
- package/types/cdevhub-ngx-tw-segmented-control.d.ts +66 -0
- package/types/cdevhub-ngx-tw-select.d.ts +384 -0
- package/types/cdevhub-ngx-tw-separator.d.ts +28 -0
- package/types/cdevhub-ngx-tw-sheet.d.ts +335 -0
- package/types/cdevhub-ngx-tw-skeleton.d.ts +52 -0
- package/types/cdevhub-ngx-tw-slider.d.ts +258 -0
- package/types/cdevhub-ngx-tw-sort.d.ts +136 -0
- package/types/cdevhub-ngx-tw-spinner.d.ts +50 -0
- package/types/cdevhub-ngx-tw-split.d.ts +265 -0
- package/types/cdevhub-ngx-tw-stat.d.ts +140 -0
- package/types/cdevhub-ngx-tw-stepper.d.ts +127 -0
- package/types/cdevhub-ngx-tw-switch.d.ts +88 -0
- package/types/cdevhub-ngx-tw-tab-nav.d.ts +107 -0
- package/types/cdevhub-ngx-tw-table.d.ts +479 -0
- package/types/cdevhub-ngx-tw-tabs.d.ts +121 -0
- package/types/cdevhub-ngx-tw-textarea.d.ts +62 -0
- package/types/cdevhub-ngx-tw-theme.d.ts +106 -0
- package/types/cdevhub-ngx-tw-time-picker.d.ts +303 -0
- package/types/cdevhub-ngx-tw-timeline.d.ts +278 -0
- package/types/cdevhub-ngx-tw-toast.d.ts +388 -0
- package/types/cdevhub-ngx-tw-tooltip.d.ts +95 -0
- package/types/cdevhub-ngx-tw.d.ts +49 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { TwColor } from '@cdevhub/ngx-tw/core';
|
|
3
|
+
|
|
4
|
+
/** Visual style of the progress bar. */
|
|
5
|
+
type ProgressBarVariant = 'linear' | 'segmented';
|
|
6
|
+
/** Size scale specific to progress bars (bar thickness). */
|
|
7
|
+
type ProgressBarSize = 'sm' | 'md' | 'lg';
|
|
8
|
+
/** Function signature for formatting the visible / announced progress value. */
|
|
9
|
+
type ProgressBarValueFormatter = (value: number, max: number, min: number) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Non-visual configuration bundled into a single input to keep the component's public
|
|
12
|
+
* surface small. Every field is optional and falls back to a sensible default.
|
|
13
|
+
*/
|
|
14
|
+
interface ProgressBarOptions {
|
|
15
|
+
/** Lower bound of the value range. Defaults to `0`. */
|
|
16
|
+
min?: number;
|
|
17
|
+
/** Upper bound of the value range. Defaults to `100`. */
|
|
18
|
+
max?: number;
|
|
19
|
+
/** Number of equal cells when `variant` is `'segmented'`. Ignored for `'linear'`. Defaults to `5`. */
|
|
20
|
+
segments?: number;
|
|
21
|
+
/** When true, renders the formatted progress value next to the label. Defaults to `false`. */
|
|
22
|
+
showValue?: boolean;
|
|
23
|
+
/** Custom formatter for the displayed and announced value. Defaults to an integer percentage, e.g. `'42%'`. */
|
|
24
|
+
formatter?: ProgressBarValueFormatter;
|
|
25
|
+
/** Accessible name when no visible `label` is provided. Mirrored to `aria-label` on the progressbar element. */
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
/** ID of an external element that labels the progress bar. Mirrored to `aria-labelledby`. */
|
|
28
|
+
ariaLabelledby?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Indicates progress toward the completion of a task.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```html
|
|
35
|
+
* <tw-progress-bar [value]="40" />
|
|
36
|
+
* <tw-progress-bar label="Fetching records" />
|
|
37
|
+
* <tw-progress-bar
|
|
38
|
+
* variant="segmented"
|
|
39
|
+
* [value]="step() * 25"
|
|
40
|
+
* [options]="{ segments: 4 }"
|
|
41
|
+
* />
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare class ProgressBarComponent {
|
|
45
|
+
/** Current progress value. When null or undefined, the bar renders indeterminate. Values outside `[options.min, options.max]` are clamped. */
|
|
46
|
+
readonly value: _angular_core.InputSignal<number | null | undefined>;
|
|
47
|
+
/** Visual style of the bar. `'linear'` renders a single fill; `'segmented'` splits the rail into discrete steps. Defaults to `'linear'`. */
|
|
48
|
+
readonly variant: _angular_core.InputSignal<ProgressBarVariant>;
|
|
49
|
+
/** Semantic color of the filled portion. Defaults to `'primary'`. Use status colors (`success`/`warning`/`error`) to reflect task outcome. */
|
|
50
|
+
readonly color: _angular_core.InputSignal<TwColor>;
|
|
51
|
+
/** Bar thickness. `'sm'` = h-1, `'md'` = h-2, `'lg'` = h-3. Defaults to `'md'`. */
|
|
52
|
+
readonly size: _angular_core.InputSignal<ProgressBarSize>;
|
|
53
|
+
/** Visible label rendered above the bar. When set, the bar is wired to the label via `aria-labelledby`. */
|
|
54
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
55
|
+
/** Bundles non-visual configuration: value range (`min`/`max`/`segments`), value readout (`showValue`/`formatter`), and accessibility fallbacks (`ariaLabel`/`ariaLabelledby`). Every field is optional. */
|
|
56
|
+
readonly options: _angular_core.InputSignal<ProgressBarOptions | undefined>;
|
|
57
|
+
/** @internal */
|
|
58
|
+
readonly labelId: string;
|
|
59
|
+
/** @internal */
|
|
60
|
+
readonly resolvedMin: _angular_core.Signal<number>;
|
|
61
|
+
/** @internal */
|
|
62
|
+
readonly resolvedMax: _angular_core.Signal<number>;
|
|
63
|
+
/** @internal */
|
|
64
|
+
readonly resolvedSegments: _angular_core.Signal<number>;
|
|
65
|
+
/** @internal */
|
|
66
|
+
readonly resolvedShowValue: _angular_core.Signal<boolean>;
|
|
67
|
+
/** @internal */
|
|
68
|
+
readonly isIndeterminate: _angular_core.Signal<boolean>;
|
|
69
|
+
/** @internal */
|
|
70
|
+
readonly clampedValue: _angular_core.Signal<number>;
|
|
71
|
+
/** @internal */
|
|
72
|
+
readonly progressRatio: _angular_core.Signal<number>;
|
|
73
|
+
/** @internal */
|
|
74
|
+
readonly formattedValue: _angular_core.Signal<string>;
|
|
75
|
+
/** @internal */
|
|
76
|
+
readonly hasHeader: _angular_core.Signal<boolean>;
|
|
77
|
+
/** @internal */
|
|
78
|
+
readonly segmentIndices: _angular_core.Signal<number[]>;
|
|
79
|
+
/** @internal */
|
|
80
|
+
readonly resolvedAriaLabel: _angular_core.Signal<string | null>;
|
|
81
|
+
/** @internal */
|
|
82
|
+
readonly resolvedAriaLabelledby: _angular_core.Signal<string | null>;
|
|
83
|
+
private readonly variantResult;
|
|
84
|
+
readonly rootClasses: _angular_core.Signal<string>;
|
|
85
|
+
readonly headerClasses: _angular_core.Signal<string>;
|
|
86
|
+
readonly labelClasses: _angular_core.Signal<string>;
|
|
87
|
+
readonly valueTextClasses: _angular_core.Signal<string>;
|
|
88
|
+
readonly railClasses: _angular_core.Signal<string>;
|
|
89
|
+
readonly fillClasses: _angular_core.Signal<string>;
|
|
90
|
+
readonly segmentListClasses: _angular_core.Signal<string>;
|
|
91
|
+
private readonly segmentBaseClasses;
|
|
92
|
+
/** @internal */
|
|
93
|
+
segmentClassFor(index: number): string;
|
|
94
|
+
constructor();
|
|
95
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ProgressBarComponent, never>;
|
|
96
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ProgressBarComponent, "tw-progress-bar", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export { ProgressBarComponent };
|
|
100
|
+
export type { ProgressBarOptions, ProgressBarSize, ProgressBarValueFormatter, ProgressBarVariant };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnInit, ElementRef, Signal } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { TwColor, TwSize, ErrorStateMatcher } from '@cdevhub/ngx-tw/core';
|
|
5
|
+
|
|
6
|
+
/** Visual style of the selected radio indicator. */
|
|
7
|
+
type RadioVariant = 'solid' | 'outline';
|
|
8
|
+
/** Layout direction of a radio group. */
|
|
9
|
+
type RadioOrientation = 'horizontal' | 'vertical';
|
|
10
|
+
/** Position of the label relative to the radio control. */
|
|
11
|
+
type RadioLabelPosition = 'before' | 'after';
|
|
12
|
+
declare class RadioComponent implements ControlValueAccessor, OnInit {
|
|
13
|
+
/** The value this radio contributes when selected inside a `tw-radio-group`. Required when nested in a group; ignored when used standalone. */
|
|
14
|
+
readonly value: _angular_core.InputSignal<unknown>;
|
|
15
|
+
/** Overrides the parent group's color for this radio. When undefined, inherits from the group (or defaults to `'primary'` standalone). */
|
|
16
|
+
readonly color: _angular_core.InputSignal<TwColor | undefined>;
|
|
17
|
+
/** Overrides the parent group's size for this radio. When undefined, inherits from the group (or defaults to `'md'` standalone). */
|
|
18
|
+
readonly size: _angular_core.InputSignal<TwSize | undefined>;
|
|
19
|
+
/** Overrides the parent group's variant for this radio. When undefined, inherits from the group (or defaults to `'solid'` standalone). */
|
|
20
|
+
readonly variant: _angular_core.InputSignal<RadioVariant | undefined>;
|
|
21
|
+
/** When true, disables this radio regardless of the group's state. Group-disabled always wins as an OR. Defaults to `false`. */
|
|
22
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
23
|
+
/** Optional inline label rendered next to the radio. Use default content projection for rich label content instead. */
|
|
24
|
+
readonly label: _angular_core.InputSignal<string | undefined>;
|
|
25
|
+
/** Optional secondary description rendered under the label. Use `[slot="description"]` content projection for rich content instead. */
|
|
26
|
+
readonly description: _angular_core.InputSignal<string | undefined>;
|
|
27
|
+
/** Position of the label/description relative to the radio. Defaults to `'after'`. */
|
|
28
|
+
readonly labelPosition: _angular_core.InputSignal<RadioLabelPosition>;
|
|
29
|
+
/** Optional name attribute for standalone use. Ignored when the parent group provides a name. */
|
|
30
|
+
readonly name: _angular_core.InputSignal<string | undefined>;
|
|
31
|
+
/** Accessible name when no visible label is provided. Mirrored to `aria-label`. */
|
|
32
|
+
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
33
|
+
/** ID of an external element that labels the radio. Mirrored to `aria-labelledby`. */
|
|
34
|
+
readonly ariaLabelledby: _angular_core.InputSignal<string | undefined>;
|
|
35
|
+
/** ID of an external element that describes the radio. Mirrored to `aria-describedby`. */
|
|
36
|
+
readonly ariaDescribedby: _angular_core.InputSignal<string | undefined>;
|
|
37
|
+
/** Two-way bound checked state. Authoritative only in standalone mode; when inside a `tw-radio-group`, this model reflects group selection but does NOT drive it. */
|
|
38
|
+
readonly checked: _angular_core.ModelSignal<boolean>;
|
|
39
|
+
/** Per-instance override of the {@link ErrorStateMatcher}. When omitted, the radio uses the `TW_ERROR_STATE_MATCHER` token's value. */
|
|
40
|
+
readonly errorStateMatcher: _angular_core.InputSignal<ErrorStateMatcher | undefined>;
|
|
41
|
+
/** Fires after the checked state changes from a user interaction on this radio. In grouped mode only fires when this radio becomes the selected one. Does not fire when selection is updated programmatically. */
|
|
42
|
+
readonly change: _angular_core.OutputEmitterRef<boolean>;
|
|
43
|
+
private readonly focusMonitor;
|
|
44
|
+
readonly elementRef: ElementRef<any>;
|
|
45
|
+
private readonly destroyRef;
|
|
46
|
+
private readonly parent;
|
|
47
|
+
private readonly ngControl;
|
|
48
|
+
private readonly parentForm;
|
|
49
|
+
private readonly parentFormGroup;
|
|
50
|
+
private readonly defaultMatcher;
|
|
51
|
+
private onChange;
|
|
52
|
+
private onTouched;
|
|
53
|
+
private readonly cvaDisabled;
|
|
54
|
+
private readonly _ngControlRev;
|
|
55
|
+
private readonly _formSubmitRev;
|
|
56
|
+
private readonly uid;
|
|
57
|
+
readonly hostId: string;
|
|
58
|
+
readonly labelId: string;
|
|
59
|
+
readonly descriptionId: string;
|
|
60
|
+
private readonly internalChecked;
|
|
61
|
+
/** Resolved color — radio's own color wins, then group's, then `'primary'`. */
|
|
62
|
+
readonly effectiveColor: Signal<TwColor>;
|
|
63
|
+
/** Resolved size — radio's own size wins, then group's, then `'md'`. */
|
|
64
|
+
readonly effectiveSize: Signal<TwSize>;
|
|
65
|
+
/** Resolved variant — radio's own variant wins, then group's, then `'solid'`. */
|
|
66
|
+
readonly effectiveVariant: Signal<RadioVariant>;
|
|
67
|
+
/** Resolved name attribute — parent group's name wins for HTML form semantics. */
|
|
68
|
+
readonly effectiveName: Signal<any>;
|
|
69
|
+
/** Whether this radio is currently selected (grouped: parent.value === this.value; standalone: internal checked). */
|
|
70
|
+
readonly isSelected: Signal<boolean>;
|
|
71
|
+
/** Whether this radio is disabled (own disabled OR parent's disabled OR CVA-disabled). */
|
|
72
|
+
readonly isDisabled: Signal<any>;
|
|
73
|
+
/** Whether the radio is in an error state per the configured `ErrorStateMatcher`. Inherits from the parent group when wrapped; falls back to its own NgControl when standalone. */
|
|
74
|
+
readonly errorState: Signal<boolean>;
|
|
75
|
+
/** Roving tabindex: in a group, only the selected (or first enabled if none selected) radio is focusable. Standalone radios are always focusable unless disabled. */
|
|
76
|
+
readonly isFocusable: Signal<boolean>;
|
|
77
|
+
readonly effectiveAriaLabelledby: Signal<string | undefined>;
|
|
78
|
+
readonly effectiveAriaDescribedby: Signal<string>;
|
|
79
|
+
private readonly variantResult;
|
|
80
|
+
readonly rootClasses: Signal<string>;
|
|
81
|
+
readonly circleWrapClasses: Signal<string>;
|
|
82
|
+
readonly labelWrapClasses: Signal<string>;
|
|
83
|
+
readonly labelClasses: Signal<string>;
|
|
84
|
+
readonly descriptionClasses: Signal<string>;
|
|
85
|
+
readonly dotWrapClasses: Signal<string>;
|
|
86
|
+
readonly circleClasses: Signal<string>;
|
|
87
|
+
readonly dotClasses: Signal<string>;
|
|
88
|
+
constructor();
|
|
89
|
+
/** Called by user click or group keyboard handler. Selects this radio. */
|
|
90
|
+
onActivate(): void;
|
|
91
|
+
/** Handles keyboard activation. Space selects; Enter does NOT — matches native `<input type="radio">` semantics. */
|
|
92
|
+
onKeydown(event: KeyboardEvent): void;
|
|
93
|
+
/** @internal Host blur. In a group, notifies the group's CVA touched callback; standalone, notifies the local CVA. */
|
|
94
|
+
onBlur(): void;
|
|
95
|
+
/** Focuses the host element. Required for keyboard navigation from the group. */
|
|
96
|
+
focus(): void;
|
|
97
|
+
writeValue(value: boolean | null | undefined): void;
|
|
98
|
+
registerOnChange(fn: (value: boolean) => void): void;
|
|
99
|
+
registerOnTouched(fn: () => void): void;
|
|
100
|
+
setDisabledState(isDisabled: boolean): void;
|
|
101
|
+
ngOnInit(): void;
|
|
102
|
+
private hasAccessibleNameHint;
|
|
103
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RadioComponent, never>;
|
|
104
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RadioComponent, "tw-radio", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "labelPosition": { "alias": "labelPosition"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "checked": { "alias": "checked"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; }, { "checked": "checkedChange"; "change": "change"; }, never, ["[slot='dot']", "*", "[slot='description']"], true, never>;
|
|
105
|
+
}
|
|
106
|
+
declare class RadioGroupComponent<T = unknown> implements ControlValueAccessor, OnInit {
|
|
107
|
+
/** Sets the semantic color applied to the selected radio's dot/ring. Propagated to children unless a child overrides it. Defaults to `'primary'`. */
|
|
108
|
+
readonly color: _angular_core.InputSignal<TwColor>;
|
|
109
|
+
/** Controls the overall scale of radios inside the group. Propagated to children unless a child overrides it. Defaults to `'md'`. */
|
|
110
|
+
readonly size: _angular_core.InputSignal<TwSize>;
|
|
111
|
+
/** Visual style of the selected indicator. `'solid'` fills the dot with the color against a colored ring; `'outline'` keeps a transparent fill with a colored ring and colored dot. Propagated to children unless a child overrides it. Defaults to `'solid'`. */
|
|
112
|
+
readonly variant: _angular_core.InputSignal<RadioVariant>;
|
|
113
|
+
/** Layout direction of the group. Drives `aria-orientation` and the arrow-key model. Defaults to `'vertical'`. */
|
|
114
|
+
readonly orientation: _angular_core.InputSignal<RadioOrientation>;
|
|
115
|
+
/** When true, disables every radio in the group and blocks keyboard interaction. Defaults to `false`. */
|
|
116
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
117
|
+
/** When true, sets `aria-required="true"` on the group for assistive tech. Defaults to `false`. */
|
|
118
|
+
readonly required: _angular_core.InputSignal<boolean>;
|
|
119
|
+
/** Optional form-association name. Propagated to each child radio's host `name` attribute so standard HTML form semantics still apply. */
|
|
120
|
+
readonly name: _angular_core.InputSignal<string | undefined>;
|
|
121
|
+
/** Accessible name for the group when no visible label is provided. Mirrored to `aria-label`. */
|
|
122
|
+
readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
|
|
123
|
+
/** ID of an external element that labels the group. Mirrored to `aria-labelledby`. */
|
|
124
|
+
readonly ariaLabelledby: _angular_core.InputSignal<string | undefined>;
|
|
125
|
+
/** ID of an external element that describes the group. Mirrored to `aria-describedby`. */
|
|
126
|
+
readonly ariaDescribedby: _angular_core.InputSignal<string | undefined>;
|
|
127
|
+
/** Two-way bound selected value. Updates when the user picks a radio; fires `valueChange`. `null` means no selection. */
|
|
128
|
+
readonly value: _angular_core.ModelSignal<T | null>;
|
|
129
|
+
/** Per-instance override of the {@link ErrorStateMatcher}. When omitted, the group uses the `TW_ERROR_STATE_MATCHER` token's value. */
|
|
130
|
+
readonly errorStateMatcher: _angular_core.InputSignal<ErrorStateMatcher | undefined>;
|
|
131
|
+
/** Fires after the selected value changes from a user interaction. Does not fire when the value is updated programmatically via `writeValue`. */
|
|
132
|
+
readonly change: _angular_core.OutputEmitterRef<T | null>;
|
|
133
|
+
/** @internal Child radios discovered via content projection. */
|
|
134
|
+
readonly radios: Signal<readonly RadioComponent[]>;
|
|
135
|
+
private readonly focusMonitor;
|
|
136
|
+
private readonly elementRef;
|
|
137
|
+
private readonly destroyRef;
|
|
138
|
+
private readonly ngControl;
|
|
139
|
+
private readonly parentForm;
|
|
140
|
+
private readonly parentFormGroup;
|
|
141
|
+
private readonly defaultMatcher;
|
|
142
|
+
readonly hostId: string;
|
|
143
|
+
private onChange;
|
|
144
|
+
private onTouched;
|
|
145
|
+
private readonly cvaDisabled;
|
|
146
|
+
private readonly _ngControlRev;
|
|
147
|
+
private readonly _formSubmitRev;
|
|
148
|
+
/** Effective disabled state — input OR CVA disabled. */
|
|
149
|
+
readonly isDisabled: Signal<boolean>;
|
|
150
|
+
/** Group-level error state per the configured `ErrorStateMatcher`. Reads the bound `NgControl.invalid` through the matcher; child radios inherit from this when wrapped in the group. */
|
|
151
|
+
readonly errorState: Signal<boolean>;
|
|
152
|
+
readonly activeValue: _angular_core.WritableSignal<T | null>;
|
|
153
|
+
private readonly variantResult;
|
|
154
|
+
readonly rootClasses: Signal<string>;
|
|
155
|
+
constructor();
|
|
156
|
+
/** Selects the given value from a user interaction. Updates the model and notifies forms. */
|
|
157
|
+
selectValue(next: unknown): void;
|
|
158
|
+
/** @internal Called by child radios on blur — propagates to CVA onTouched and bumps the errorState revision so a blur on a child radio refreshes the group's `aria-invalid`. */
|
|
159
|
+
notifyTouched(): void;
|
|
160
|
+
onKeydown(event: KeyboardEvent): void;
|
|
161
|
+
private findNextEnabledIndex;
|
|
162
|
+
private firstEnabledIndex;
|
|
163
|
+
private lastEnabledIndex;
|
|
164
|
+
writeValue(value: T | null): void;
|
|
165
|
+
registerOnChange(fn: (value: T | null) => void): void;
|
|
166
|
+
registerOnTouched(fn: () => void): void;
|
|
167
|
+
setDisabledState(isDisabled: boolean): void;
|
|
168
|
+
ngOnInit(): void;
|
|
169
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<RadioGroupComponent<any>, never>;
|
|
170
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<RadioGroupComponent<any>, "tw-radio-group", never, { "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "name": { "alias": "name"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "aria-label"; "required": false; "isSignal": true; }; "ariaLabelledby": { "alias": "aria-labelledby"; "required": false; "isSignal": true; }; "ariaDescribedby": { "alias": "aria-describedby"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "errorStateMatcher": { "alias": "errorStateMatcher"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "change": "change"; }, ["radios"], ["*"], true, never>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { RadioComponent, RadioGroupComponent };
|
|
174
|
+
export type { RadioLabelPosition, RadioOrientation, RadioVariant };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ElementRef } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { TwColor, TwSize, TwOrientation } from '@cdevhub/ngx-tw/core';
|
|
5
|
+
|
|
6
|
+
/** Visual style of the active indicator. */
|
|
7
|
+
type SegmentedControlVariant = 'surface' | 'filled' | 'outline';
|
|
8
|
+
/** Border-radius shape of the container and options. */
|
|
9
|
+
type SegmentedControlRounded = 'pill' | 'md';
|
|
10
|
+
declare class SegmentedControlOptionComponent {
|
|
11
|
+
/** Unique value identifying this option. Required. */
|
|
12
|
+
readonly value: _angular_core.InputSignal<string>;
|
|
13
|
+
/** When true, this option cannot be selected and is skipped by keyboard navigation. Defaults to `false`. */
|
|
14
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
15
|
+
readonly elementRef: ElementRef<any>;
|
|
16
|
+
private readonly parent;
|
|
17
|
+
readonly id: string;
|
|
18
|
+
constructor();
|
|
19
|
+
readonly isActive: _angular_core.Signal<boolean>;
|
|
20
|
+
readonly isDisabled: _angular_core.Signal<boolean>;
|
|
21
|
+
readonly isFocusable: _angular_core.Signal<boolean>;
|
|
22
|
+
readonly classes: _angular_core.Signal<string>;
|
|
23
|
+
select(): void;
|
|
24
|
+
focus(): void;
|
|
25
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SegmentedControlOptionComponent, never>;
|
|
26
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SegmentedControlOptionComponent, "tw-segmented-option", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
27
|
+
}
|
|
28
|
+
declare class SegmentedControlComponent implements ControlValueAccessor {
|
|
29
|
+
/** Controls the active indicator style. `'surface'` shows a raised white pill; `'filled'` shows a solid colored background; `'outline'` shows a colored ring border. Defaults to `'surface'`. */
|
|
30
|
+
readonly variant: _angular_core.InputSignal<SegmentedControlVariant>;
|
|
31
|
+
/** Sets the semantic color for the active option indicator. Defaults to `'primary'`. */
|
|
32
|
+
readonly color: _angular_core.InputSignal<TwColor>;
|
|
33
|
+
/** Controls padding, font size, and gap of options. Defaults to `'md'`. */
|
|
34
|
+
readonly size: _angular_core.InputSignal<TwSize>;
|
|
35
|
+
/** Layout direction of the control. Defaults to `'horizontal'`. */
|
|
36
|
+
readonly orientation: _angular_core.InputSignal<TwOrientation>;
|
|
37
|
+
/** Controls the border-radius shape of the container and options. `'pill'` uses fully rounded corners; `'md'` uses standard radius. Vertical orientation forces `'md'`. Defaults to `'pill'`. */
|
|
38
|
+
readonly rounded: _angular_core.InputSignal<SegmentedControlRounded>;
|
|
39
|
+
/** When true, prevents all interaction and applies muted styling. Defaults to `false`. */
|
|
40
|
+
readonly disabled: _angular_core.InputSignal<boolean>;
|
|
41
|
+
/** The value of the currently selected option. Two-way bound. Updates on user selection. */
|
|
42
|
+
readonly value: _angular_core.ModelSignal<string | null>;
|
|
43
|
+
/** @internal */
|
|
44
|
+
readonly options: _angular_core.Signal<readonly SegmentedControlOptionComponent[]>;
|
|
45
|
+
private onChange;
|
|
46
|
+
private onTouched;
|
|
47
|
+
private readonly cvaDisabled;
|
|
48
|
+
readonly isDisabled: _angular_core.Signal<boolean>;
|
|
49
|
+
readonly activeValue: _angular_core.WritableSignal<string | null>;
|
|
50
|
+
/** @internal Read by `SegmentedControlOptionComponent.classes` to resolve the option's tv() bucket. Vertical orientation forces `'md'` regardless of input. */
|
|
51
|
+
readonly effectiveRounded: _angular_core.Signal<SegmentedControlRounded>;
|
|
52
|
+
private readonly variantResult;
|
|
53
|
+
readonly rootClasses: _angular_core.Signal<string>;
|
|
54
|
+
selectOption(val: string): void;
|
|
55
|
+
onKeydown(event: KeyboardEvent): void;
|
|
56
|
+
private findNextEnabledIndex;
|
|
57
|
+
writeValue(val: string | null): void;
|
|
58
|
+
registerOnChange(fn: (value: string | null) => void): void;
|
|
59
|
+
registerOnTouched(fn: () => void): void;
|
|
60
|
+
setDisabledState(isDisabled: boolean): void;
|
|
61
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SegmentedControlComponent, never>;
|
|
62
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<SegmentedControlComponent, "tw-segmented-control", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "rounded": { "alias": "rounded"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, ["options"], ["*"], true, never>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { SegmentedControlComponent, SegmentedControlOptionComponent };
|
|
66
|
+
export type { SegmentedControlRounded, SegmentedControlVariant };
|