@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.
Files changed (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -0
  3. package/fesm2022/cdevhub-ngx-tw-accordion.mjs +108 -0
  4. package/fesm2022/cdevhub-ngx-tw-accordion.mjs.map +1 -0
  5. package/fesm2022/cdevhub-ngx-tw-alert.mjs +240 -0
  6. package/fesm2022/cdevhub-ngx-tw-alert.mjs.map +1 -0
  7. package/fesm2022/cdevhub-ngx-tw-avatar.mjs +287 -0
  8. package/fesm2022/cdevhub-ngx-tw-avatar.mjs.map +1 -0
  9. package/fesm2022/cdevhub-ngx-tw-badge.mjs +332 -0
  10. package/fesm2022/cdevhub-ngx-tw-badge.mjs.map +1 -0
  11. package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs +452 -0
  12. package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs.map +1 -0
  13. package/fesm2022/cdevhub-ngx-tw-button.mjs +227 -0
  14. package/fesm2022/cdevhub-ngx-tw-button.mjs.map +1 -0
  15. package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs +417 -0
  16. package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs.map +1 -0
  17. package/fesm2022/cdevhub-ngx-tw-calendar-testing.mjs +232 -0
  18. package/fesm2022/cdevhub-ngx-tw-calendar-testing.mjs.map +1 -0
  19. package/fesm2022/cdevhub-ngx-tw-calendar.mjs +4482 -0
  20. package/fesm2022/cdevhub-ngx-tw-calendar.mjs.map +1 -0
  21. package/fesm2022/cdevhub-ngx-tw-card.mjs +157 -0
  22. package/fesm2022/cdevhub-ngx-tw-card.mjs.map +1 -0
  23. package/fesm2022/cdevhub-ngx-tw-carousel.mjs +1454 -0
  24. package/fesm2022/cdevhub-ngx-tw-carousel.mjs.map +1 -0
  25. package/fesm2022/cdevhub-ngx-tw-checkbox.mjs +593 -0
  26. package/fesm2022/cdevhub-ngx-tw-checkbox.mjs.map +1 -0
  27. package/fesm2022/cdevhub-ngx-tw-code-block.mjs +228 -0
  28. package/fesm2022/cdevhub-ngx-tw-code-block.mjs.map +1 -0
  29. package/fesm2022/cdevhub-ngx-tw-collapsible.mjs +510 -0
  30. package/fesm2022/cdevhub-ngx-tw-collapsible.mjs.map +1 -0
  31. package/fesm2022/cdevhub-ngx-tw-combobox.mjs +1721 -0
  32. package/fesm2022/cdevhub-ngx-tw-combobox.mjs.map +1 -0
  33. package/fesm2022/cdevhub-ngx-tw-command-palette.mjs +721 -0
  34. package/fesm2022/cdevhub-ngx-tw-command-palette.mjs.map +1 -0
  35. package/fesm2022/cdevhub-ngx-tw-core.mjs +861 -0
  36. package/fesm2022/cdevhub-ngx-tw-core.mjs.map +1 -0
  37. package/fesm2022/cdevhub-ngx-tw-date-picker.mjs +1558 -0
  38. package/fesm2022/cdevhub-ngx-tw-date-picker.mjs.map +1 -0
  39. package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs +1833 -0
  40. package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs.map +1 -0
  41. package/fesm2022/cdevhub-ngx-tw-dialog.mjs +693 -0
  42. package/fesm2022/cdevhub-ngx-tw-dialog.mjs.map +1 -0
  43. package/fesm2022/cdevhub-ngx-tw-empty-state.mjs +331 -0
  44. package/fesm2022/cdevhub-ngx-tw-empty-state.mjs.map +1 -0
  45. package/fesm2022/cdevhub-ngx-tw-flip-card.mjs +289 -0
  46. package/fesm2022/cdevhub-ngx-tw-flip-card.mjs.map +1 -0
  47. package/fesm2022/cdevhub-ngx-tw-form-field.mjs +572 -0
  48. package/fesm2022/cdevhub-ngx-tw-form-field.mjs.map +1 -0
  49. package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs +36 -0
  50. package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs.map +1 -0
  51. package/fesm2022/cdevhub-ngx-tw-icon.mjs +278 -0
  52. package/fesm2022/cdevhub-ngx-tw-icon.mjs.map +1 -0
  53. package/fesm2022/cdevhub-ngx-tw-input.mjs +355 -0
  54. package/fesm2022/cdevhub-ngx-tw-input.mjs.map +1 -0
  55. package/fesm2022/cdevhub-ngx-tw-item.mjs +241 -0
  56. package/fesm2022/cdevhub-ngx-tw-item.mjs.map +1 -0
  57. package/fesm2022/cdevhub-ngx-tw-menu.mjs +433 -0
  58. package/fesm2022/cdevhub-ngx-tw-menu.mjs.map +1 -0
  59. package/fesm2022/cdevhub-ngx-tw-paginator.mjs +691 -0
  60. package/fesm2022/cdevhub-ngx-tw-paginator.mjs.map +1 -0
  61. package/fesm2022/cdevhub-ngx-tw-popover.mjs +678 -0
  62. package/fesm2022/cdevhub-ngx-tw-popover.mjs.map +1 -0
  63. package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs +335 -0
  64. package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs.map +1 -0
  65. package/fesm2022/cdevhub-ngx-tw-radio.mjs +708 -0
  66. package/fesm2022/cdevhub-ngx-tw-radio.mjs.map +1 -0
  67. package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs +319 -0
  68. package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs.map +1 -0
  69. package/fesm2022/cdevhub-ngx-tw-select.mjs +1722 -0
  70. package/fesm2022/cdevhub-ngx-tw-select.mjs.map +1 -0
  71. package/fesm2022/cdevhub-ngx-tw-separator.mjs +115 -0
  72. package/fesm2022/cdevhub-ngx-tw-separator.mjs.map +1 -0
  73. package/fesm2022/cdevhub-ngx-tw-sheet.mjs +768 -0
  74. package/fesm2022/cdevhub-ngx-tw-sheet.mjs.map +1 -0
  75. package/fesm2022/cdevhub-ngx-tw-skeleton.mjs +149 -0
  76. package/fesm2022/cdevhub-ngx-tw-skeleton.mjs.map +1 -0
  77. package/fesm2022/cdevhub-ngx-tw-slider.mjs +1147 -0
  78. package/fesm2022/cdevhub-ngx-tw-slider.mjs.map +1 -0
  79. package/fesm2022/cdevhub-ngx-tw-sort.mjs +346 -0
  80. package/fesm2022/cdevhub-ngx-tw-sort.mjs.map +1 -0
  81. package/fesm2022/cdevhub-ngx-tw-spinner.mjs +186 -0
  82. package/fesm2022/cdevhub-ngx-tw-spinner.mjs.map +1 -0
  83. package/fesm2022/cdevhub-ngx-tw-split.mjs +1082 -0
  84. package/fesm2022/cdevhub-ngx-tw-split.mjs.map +1 -0
  85. package/fesm2022/cdevhub-ngx-tw-stat.mjs +579 -0
  86. package/fesm2022/cdevhub-ngx-tw-stat.mjs.map +1 -0
  87. package/fesm2022/cdevhub-ngx-tw-stepper.mjs +443 -0
  88. package/fesm2022/cdevhub-ngx-tw-stepper.mjs.map +1 -0
  89. package/fesm2022/cdevhub-ngx-tw-switch.mjs +391 -0
  90. package/fesm2022/cdevhub-ngx-tw-switch.mjs.map +1 -0
  91. package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs +315 -0
  92. package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs.map +1 -0
  93. package/fesm2022/cdevhub-ngx-tw-table.mjs +994 -0
  94. package/fesm2022/cdevhub-ngx-tw-table.mjs.map +1 -0
  95. package/fesm2022/cdevhub-ngx-tw-tabs.mjs +508 -0
  96. package/fesm2022/cdevhub-ngx-tw-tabs.mjs.map +1 -0
  97. package/fesm2022/cdevhub-ngx-tw-textarea.mjs +147 -0
  98. package/fesm2022/cdevhub-ngx-tw-textarea.mjs.map +1 -0
  99. package/fesm2022/cdevhub-ngx-tw-theme.mjs +178 -0
  100. package/fesm2022/cdevhub-ngx-tw-theme.mjs.map +1 -0
  101. package/fesm2022/cdevhub-ngx-tw-time-picker.mjs +1344 -0
  102. package/fesm2022/cdevhub-ngx-tw-time-picker.mjs.map +1 -0
  103. package/fesm2022/cdevhub-ngx-tw-timeline.mjs +1136 -0
  104. package/fesm2022/cdevhub-ngx-tw-timeline.mjs.map +1 -0
  105. package/fesm2022/cdevhub-ngx-tw-toast.mjs +1311 -0
  106. package/fesm2022/cdevhub-ngx-tw-toast.mjs.map +1 -0
  107. package/fesm2022/cdevhub-ngx-tw-tooltip.mjs +533 -0
  108. package/fesm2022/cdevhub-ngx-tw-tooltip.mjs.map +1 -0
  109. package/fesm2022/cdevhub-ngx-tw.mjs +61 -0
  110. package/fesm2022/cdevhub-ngx-tw.mjs.map +1 -0
  111. package/package.json +265 -0
  112. package/theme/_base.css +394 -0
  113. package/theme/_dark.css +510 -0
  114. package/theme/_high-contrast.css +290 -0
  115. package/theme/_semantic.css +317 -0
  116. package/theme/_typography.css +9 -0
  117. package/theme/index.css +54 -0
  118. package/types/cdevhub-ngx-tw-accordion.d.ts +48 -0
  119. package/types/cdevhub-ngx-tw-alert.d.ts +67 -0
  120. package/types/cdevhub-ngx-tw-avatar.d.ts +79 -0
  121. package/types/cdevhub-ngx-tw-badge.d.ts +94 -0
  122. package/types/cdevhub-ngx-tw-breadcrumbs.d.ts +227 -0
  123. package/types/cdevhub-ngx-tw-button.d.ts +74 -0
  124. package/types/cdevhub-ngx-tw-calendar-luxon.d.ts +200 -0
  125. package/types/cdevhub-ngx-tw-calendar-testing.d.ts +113 -0
  126. package/types/cdevhub-ngx-tw-calendar.d.ts +1704 -0
  127. package/types/cdevhub-ngx-tw-card.d.ts +48 -0
  128. package/types/cdevhub-ngx-tw-carousel.d.ts +406 -0
  129. package/types/cdevhub-ngx-tw-checkbox.d.ts +136 -0
  130. package/types/cdevhub-ngx-tw-code-block.d.ts +93 -0
  131. package/types/cdevhub-ngx-tw-collapsible.d.ts +151 -0
  132. package/types/cdevhub-ngx-tw-combobox.d.ts +389 -0
  133. package/types/cdevhub-ngx-tw-command-palette.d.ts +215 -0
  134. package/types/cdevhub-ngx-tw-core.d.ts +719 -0
  135. package/types/cdevhub-ngx-tw-date-picker.d.ts +317 -0
  136. package/types/cdevhub-ngx-tw-date-range-picker.d.ts +313 -0
  137. package/types/cdevhub-ngx-tw-dialog.d.ts +303 -0
  138. package/types/cdevhub-ngx-tw-empty-state.d.ts +104 -0
  139. package/types/cdevhub-ngx-tw-flip-card.d.ts +95 -0
  140. package/types/cdevhub-ngx-tw-form-field.d.ts +210 -0
  141. package/types/cdevhub-ngx-tw-icon-lucide.d.ts +29 -0
  142. package/types/cdevhub-ngx-tw-icon.d.ts +134 -0
  143. package/types/cdevhub-ngx-tw-input.d.ts +110 -0
  144. package/types/cdevhub-ngx-tw-item.d.ts +70 -0
  145. package/types/cdevhub-ngx-tw-menu.d.ts +99 -0
  146. package/types/cdevhub-ngx-tw-paginator.d.ts +305 -0
  147. package/types/cdevhub-ngx-tw-popover.d.ts +157 -0
  148. package/types/cdevhub-ngx-tw-progress-bar.d.ts +100 -0
  149. package/types/cdevhub-ngx-tw-radio.d.ts +174 -0
  150. package/types/cdevhub-ngx-tw-segmented-control.d.ts +66 -0
  151. package/types/cdevhub-ngx-tw-select.d.ts +384 -0
  152. package/types/cdevhub-ngx-tw-separator.d.ts +28 -0
  153. package/types/cdevhub-ngx-tw-sheet.d.ts +335 -0
  154. package/types/cdevhub-ngx-tw-skeleton.d.ts +52 -0
  155. package/types/cdevhub-ngx-tw-slider.d.ts +258 -0
  156. package/types/cdevhub-ngx-tw-sort.d.ts +136 -0
  157. package/types/cdevhub-ngx-tw-spinner.d.ts +50 -0
  158. package/types/cdevhub-ngx-tw-split.d.ts +265 -0
  159. package/types/cdevhub-ngx-tw-stat.d.ts +140 -0
  160. package/types/cdevhub-ngx-tw-stepper.d.ts +127 -0
  161. package/types/cdevhub-ngx-tw-switch.d.ts +88 -0
  162. package/types/cdevhub-ngx-tw-tab-nav.d.ts +107 -0
  163. package/types/cdevhub-ngx-tw-table.d.ts +479 -0
  164. package/types/cdevhub-ngx-tw-tabs.d.ts +121 -0
  165. package/types/cdevhub-ngx-tw-textarea.d.ts +62 -0
  166. package/types/cdevhub-ngx-tw-theme.d.ts +106 -0
  167. package/types/cdevhub-ngx-tw-time-picker.d.ts +303 -0
  168. package/types/cdevhub-ngx-tw-timeline.d.ts +278 -0
  169. package/types/cdevhub-ngx-tw-toast.d.ts +388 -0
  170. package/types/cdevhub-ngx-tw-tooltip.d.ts +95 -0
  171. package/types/cdevhub-ngx-tw.d.ts +49 -0
@@ -0,0 +1,127 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { TemplateRef, AfterViewInit, Provider } from '@angular/core';
3
+ import * as i1 from '@angular/cdk/stepper';
4
+ import { CdkStep, CdkStepLabel, CdkStepper, StepperOrientation, StepState, StepperOptions } from '@angular/cdk/stepper';
5
+ export { STEPPER_GLOBAL_OPTIONS, STEP_STATE, StepState, StepperOptions, StepperOrientation, StepperSelectionEvent } from '@angular/cdk/stepper';
6
+ import { TwColor, TwSize } from '@cdevhub/ngx-tw/core';
7
+
8
+ /** Visual style of the step indicator strip. */
9
+ type StepperVariant = 'default' | 'dot' | 'simple';
10
+ /** Context passed to custom `*twStepperIcon` templates. */
11
+ interface StepperIconContext {
12
+ $implicit: {
13
+ index: number;
14
+ active: boolean;
15
+ };
16
+ }
17
+ type StepStyleState = 'pending' | 'active' | 'completed' | 'error' | 'disabled';
18
+ /**
19
+ * Structural-style directive on an `<ng-template>` that replaces the default
20
+ * indicator icon for a given step state.
21
+ */
22
+ declare class StepperIconDirective {
23
+ /** Step state this template overrides. Matches CDK's `StepState` values (`'number' | 'edit' | 'done' | 'error'`). */
24
+ readonly state: _angular_core.InputSignal<string | undefined>;
25
+ /** @internal */
26
+ readonly templateRef: TemplateRef<any>;
27
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StepperIconDirective, never>;
28
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<StepperIconDirective, "ng-template[twStepperIcon]", never, { "state": { "alias": "state"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
29
+ }
30
+ /**
31
+ * Structural-style directive on an `<ng-template>` used as a custom step header
32
+ * label. Consumers write `<ng-template twStepLabel>…</ng-template>` inside `<tw-step>`.
33
+ */
34
+ declare class StepLabelDirective extends CdkStepLabel {
35
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StepLabelDirective, never>;
36
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<StepLabelDirective, "ng-template[twStepLabel]", never, {}, {}, never, never, true, never>;
37
+ }
38
+ declare class StepComponent extends CdkStep {
39
+ /** Optional descriptive text shown under the step label in the `'default'` variant. */
40
+ readonly description: _angular_core.InputSignal<string>;
41
+ /** @internal Custom indicator icon templates (one per state) projected into this step. */
42
+ readonly iconTemplates: _angular_core.Signal<readonly StepperIconDirective[]>;
43
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StepComponent, never>;
44
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StepComponent, "tw-step", ["twStep"], { "description": { "alias": "description"; "required": false; "isSignal": true; }; }, {}, ["iconTemplates"], ["*"], true, never>;
45
+ }
46
+ declare class StepperComponent extends CdkStepper implements AfterViewInit {
47
+ /** Visual style of the indicator strip. `'default'` = numbered circles, `'dot'` = compact filled dots, `'simple'` = indicators only (labels hidden visually). Defaults to `'default'`. */
48
+ readonly variant: _angular_core.InputSignal<StepperVariant>;
49
+ /** Semantic color for active and completed indicators and connectors. Defaults to `'primary'`. */
50
+ readonly color: _angular_core.InputSignal<TwColor>;
51
+ /** Controls indicator size and label typography. Defaults to `'md'`. */
52
+ readonly size: _angular_core.InputSignal<TwSize>;
53
+ /** When true, steps with `hasError` render error styling, icon, and `aria-invalid`. Defaults to `true`. */
54
+ readonly showError: _angular_core.InputSignal<boolean>;
55
+ /** When true, clicking a navigable step header selects it. Set to `false` to only allow advancement via `twStepperNext` / `twStepperPrevious`. Defaults to `true`. */
56
+ readonly headerInteractive: _angular_core.InputSignal<boolean>;
57
+ private readonly _liveAnnouncer;
58
+ private readonly _destroyRef;
59
+ private readonly _globalOptions;
60
+ /**
61
+ * CdkStepper exposes its state via class properties (selectedIndex,
62
+ * previousIndex, orientation), not signals. We mirror those into signals so
63
+ * templates can react via @if/@for and OnPush change detection works without
64
+ * manual `markForCheck`. Sync happens in the property setters and lifecycle
65
+ * hooks below — keep these mirrors in lock-step with the CDK fields.
66
+ */
67
+ private readonly _orientationSignal;
68
+ private readonly _selectedIndexSignal;
69
+ private readonly _previousIndexSignal;
70
+ /** @internal Reactive mirror of CDK's `orientation` input. */
71
+ readonly orientationValue: _angular_core.Signal<StepperOrientation>;
72
+ /** @internal Reactive mirror of CDK's `selectedIndex`. */
73
+ readonly selectedIndexValue: _angular_core.Signal<number>;
74
+ set orientation(value: StepperOrientation);
75
+ get orientation(): StepperOrientation;
76
+ private readonly _variantResult;
77
+ readonly rootClasses: _angular_core.Signal<string>;
78
+ readonly headerClasses: _angular_core.Signal<string>;
79
+ readonly stepItemClasses: _angular_core.Signal<string>;
80
+ readonly stepHeaderClasses: _angular_core.Signal<string>;
81
+ readonly stepIndicatorBaseClasses: _angular_core.Signal<string>;
82
+ readonly stepNumberClasses: _angular_core.Signal<string>;
83
+ readonly stepIconSlotClasses: _angular_core.Signal<string>;
84
+ readonly stepLabelWrapperClasses: _angular_core.Signal<string>;
85
+ readonly stepLabelBaseClasses: _angular_core.Signal<string>;
86
+ readonly stepDescriptionClasses: _angular_core.Signal<string>;
87
+ readonly stepOptionalHintClasses: _angular_core.Signal<string>;
88
+ readonly stepConnectorBaseClasses: _angular_core.Signal<string>;
89
+ readonly stepPanelClasses: _angular_core.Signal<string>;
90
+ readonly panelAnimationClass: _angular_core.Signal<"step-panel-enter-forward" | "step-panel-enter-backward" | null>;
91
+ ngAfterViewInit(): void;
92
+ /** @internal Typed view of projected steps. */
93
+ get twSteps(): readonly StepComponent[];
94
+ /** @internal Resolves the visual state of a step for color/theming purposes. */
95
+ getStepStyleState(step: StepComponent, index: number): StepStyleState;
96
+ /** @internal */
97
+ getIndicatorClass(step: StepComponent, index: number): string;
98
+ /** @internal */
99
+ getLabelClass(step: StepComponent, index: number): string;
100
+ /** @internal */
101
+ getConnectorClass(step: StepComponent, index: number): string;
102
+ /** @internal Resolves which indicator glyph to render for a step. */
103
+ getIndicatorType(step: StepComponent): StepState;
104
+ /** @internal Looks up a consumer-supplied custom template for a given indicator state. */
105
+ resolveIconTemplate(step: StepComponent, state: StepState): TemplateRef<StepperIconContext> | null;
106
+ /** @internal Context supplied to custom icon templates. */
107
+ iconContext(index: number): StepperIconContext;
108
+ /** @internal Click handler for the step header button. */
109
+ onHeaderClick(step: StepComponent, index: number): void;
110
+ /** @internal Whether the stepper should render the error state for a step. */
111
+ shouldRenderError(step: StepComponent): boolean;
112
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StepperComponent, never>;
113
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StepperComponent, "tw-stepper", ["twStepper"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "showError": { "alias": "showError"; "required": false; "isSignal": true; }; "headerInteractive": { "alias": "headerInteractive"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
114
+ }
115
+ declare class StepperNextDirective {
116
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StepperNextDirective, never>;
117
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<StepperNextDirective, "button[twStepperNext]", never, {}, {}, never, never, true, [{ directive: typeof i1.CdkStepperNext; inputs: { "type": "type"; }; outputs: {}; }]>;
118
+ }
119
+ declare class StepperPreviousDirective {
120
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StepperPreviousDirective, never>;
121
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<StepperPreviousDirective, "button[twStepperPrevious]", never, {}, {}, never, never, true, [{ directive: typeof i1.CdkStepperPrevious; inputs: { "type": "type"; }; outputs: {}; }]>;
122
+ }
123
+ /** Provides app-wide stepper defaults via `STEPPER_GLOBAL_OPTIONS`. */
124
+ declare function provideTwStepperOptions(options: StepperOptions): Provider[];
125
+
126
+ export { StepComponent, StepLabelDirective, StepperComponent, StepperIconDirective, StepperNextDirective, StepperPreviousDirective, provideTwStepperOptions };
127
+ export type { StepperIconContext, StepperVariant };
@@ -0,0 +1,88 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { OnInit, Signal } from '@angular/core';
3
+ import { ControlValueAccessor } from '@angular/forms';
4
+ import { TwColor, TwSize, ErrorStateMatcher } from '@cdevhub/ngx-tw/core';
5
+
6
+ /** Position of the label relative to the switch control. */
7
+ type SwitchLabelPosition = 'before' | 'after';
8
+ declare class SwitchComponent implements ControlValueAccessor, OnInit {
9
+ /** Sets the semantic color for the active (checked) track. Defaults to `'primary'`. */
10
+ readonly color: _angular_core.InputSignal<TwColor>;
11
+ /** Controls the overall scale of the track, thumb, and label typography. Defaults to `'md'`. */
12
+ readonly size: _angular_core.InputSignal<TwSize>;
13
+ /** When true, prevents interaction and applies muted styling. Defaults to `false`. */
14
+ readonly disabled: _angular_core.InputSignal<boolean>;
15
+ /** When true, sets `aria-required="true"` so assistive tech announces the control as required. Defaults to `false`. */
16
+ readonly required: _angular_core.InputSignal<boolean>;
17
+ /** Optional inline label rendered next to the switch. Use default content projection for rich label content instead. */
18
+ readonly label: _angular_core.InputSignal<string | undefined>;
19
+ /** Optional secondary description rendered under the label. Use `[slot="description"]` content projection for rich content instead. */
20
+ readonly description: _angular_core.InputSignal<string | undefined>;
21
+ /** Position of the label/description relative to the switch. Defaults to `'after'`. */
22
+ readonly labelPosition: _angular_core.InputSignal<SwitchLabelPosition>;
23
+ /** Optional name attribute, mirrored to the host for form association. */
24
+ readonly name: _angular_core.InputSignal<string | undefined>;
25
+ /** Accessible name when no visible label is provided. Mirrored to `aria-label`. */
26
+ readonly ariaLabel: _angular_core.InputSignal<string | undefined>;
27
+ /** ID of an external element that labels the switch. Mirrored to `aria-labelledby`. */
28
+ readonly ariaLabelledby: _angular_core.InputSignal<string | undefined>;
29
+ /** ID of an external element that describes the switch. Mirrored to `aria-describedby`. */
30
+ readonly ariaDescribedby: _angular_core.InputSignal<string | undefined>;
31
+ /** Two-way bound checked state. Updates when the user toggles via click or Space. */
32
+ readonly checked: _angular_core.ModelSignal<boolean>;
33
+ /** Per-instance override of the {@link ErrorStateMatcher}. When omitted, the switch uses the `TW_ERROR_STATE_MATCHER` token's value. */
34
+ readonly errorStateMatcher: _angular_core.InputSignal<ErrorStateMatcher | undefined>;
35
+ /** Fires after the checked state changes from a user interaction. Does not fire when the value is updated programmatically via `writeValue`. */
36
+ readonly change: _angular_core.OutputEmitterRef<boolean>;
37
+ private readonly focusMonitor;
38
+ private readonly elementRef;
39
+ private readonly destroyRef;
40
+ private readonly ngControl;
41
+ private readonly parentForm;
42
+ private readonly parentFormGroup;
43
+ private readonly defaultMatcher;
44
+ private onChange;
45
+ private onTouched;
46
+ private readonly cvaDisabled;
47
+ private readonly _ngControlRev;
48
+ private readonly _formSubmitRev;
49
+ private readonly uid;
50
+ readonly hostId: string;
51
+ readonly labelId: string;
52
+ readonly descriptionId: string;
53
+ constructor();
54
+ readonly isDisabled: Signal<boolean>;
55
+ /** Whether the switch is in an error state per the configured `ErrorStateMatcher`. Reads the bound `NgControl.invalid` through the matcher. */
56
+ readonly errorState: Signal<boolean>;
57
+ readonly internalChecked: _angular_core.WritableSignal<boolean>;
58
+ readonly effectiveAriaLabelledby: Signal<string | undefined>;
59
+ readonly effectiveAriaDescribedby: Signal<string>;
60
+ private readonly variantResult;
61
+ readonly rootClasses: Signal<string>;
62
+ readonly switchClasses: Signal<string>;
63
+ readonly labelWrapClasses: Signal<string>;
64
+ readonly labelClasses: Signal<string>;
65
+ readonly descriptionClasses: Signal<string>;
66
+ readonly iconWrapClasses: Signal<string>;
67
+ readonly thumbClasses: Signal<string>;
68
+ readonly trackClasses: Signal<string>;
69
+ readonly onIconClasses: Signal<string>;
70
+ readonly offIconClasses: Signal<string>;
71
+ /** Toggles the checked state. No-op when disabled. */
72
+ toggle(): void;
73
+ /** Handles keyboard activation. Space toggles the switch — matches the ARIA `switch` role pattern (Enter is intentionally NOT handled, mirroring `<tw-checkbox>`). */
74
+ onKeydown(event: KeyboardEvent): void;
75
+ /** @internal Called on host blur to notify forms the control has been touched and recompute errorState. */
76
+ onBlur(): void;
77
+ writeValue(value: boolean | null | undefined): void;
78
+ registerOnChange(fn: (value: boolean) => void): void;
79
+ registerOnTouched(fn: () => void): void;
80
+ setDisabledState(isDisabled: boolean): void;
81
+ ngOnInit(): void;
82
+ private hasAccessibleNameHint;
83
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<SwitchComponent, never>;
84
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SwitchComponent, "tw-switch", never, { "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "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='off-icon']", "[slot='on-icon']", "*", "[slot='description']"], true, never>;
85
+ }
86
+
87
+ export { SwitchComponent };
88
+ export type { SwitchLabelPosition };
@@ -0,0 +1,107 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { ElementRef } from '@angular/core';
3
+ import { TabTriggerVariant, TwColor, TwSize } from '@cdevhub/ngx-tw/core';
4
+
5
+ /** Visual style of the tab navigation strip. */
6
+ type TabNavVariant = TabTriggerVariant;
7
+ /** Optional label overrides for screen-reader announcements emitted by `TabNavComponent`. */
8
+ interface TabNavLabels {
9
+ /** Formatter for the LiveAnnouncer message emitted when the active link changes in the ARIA tabs pattern. Receives the link's visible text, its 1-based index, and the total link count. */
10
+ activeTabAnnouncement?: (label: string, index: number, total: number) => string;
11
+ }
12
+ declare class TabNavPanel {
13
+ /** Unique id for this panel. Referenced by the active link's `aria-controls`. Auto-generated when not provided. */
14
+ readonly id: _angular_core.InputSignal<string>;
15
+ /** @internal Id of the active link — set by the associated TabNavComponent. */
16
+ readonly activeTabId: _angular_core.WritableSignal<string | undefined>;
17
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabNavPanel, never>;
18
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TabNavPanel, "tw-tab-nav-panel", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
19
+ }
20
+ declare class TabNavComponent {
21
+ /** Visual style of the tab strip. Defaults to `'underline'`. */
22
+ readonly variant: _angular_core.InputSignal<TabTriggerVariant>;
23
+ /** Semantic color used for the active link indicator and text. Defaults to `'primary'`. */
24
+ readonly color: _angular_core.InputSignal<TwColor>;
25
+ /** Controls padding and font size of tab links. Defaults to `'md'`. */
26
+ readonly size: _angular_core.InputSignal<TwSize>;
27
+ /** When true, tab links stretch to fill available width equally. Defaults to `false`. */
28
+ readonly fitted: _angular_core.InputSignal<boolean>;
29
+ /** Associated panel element. When provided, the nav follows the ARIA tabs pattern (role=tablist). When omitted, it uses the standard navigation landmark pattern with `aria-current="page"` on the active link. A panel projected as a child of the `<nav>` is auto-discovered. */
30
+ readonly tabPanel: _angular_core.InputSignal<TabNavPanel | undefined>;
31
+ /** Additional classes merged onto the `<nav>` host. Useful for layout tweaks or borders that the default tv() config does not cover. */
32
+ readonly navClass: _angular_core.InputSignal<string>;
33
+ /** Additional classes merged onto every tab link. Applied after base/active/disabled classes so consumer styles always win the cascade. */
34
+ readonly linkClass: _angular_core.InputSignal<string>;
35
+ /** Optional label overrides for screen-reader announcements. Only used in the ARIA tabs pattern (i.e. when a panel is associated). */
36
+ readonly labels: _angular_core.InputSignal<TabNavLabels>;
37
+ /** @internal Tab links discovered via content projection. */
38
+ readonly links: _angular_core.Signal<readonly TabLinkDirective[]>;
39
+ /** @internal Panel discovered as a content child of the nav. */
40
+ readonly projectedPanel: _angular_core.Signal<TabNavPanel | undefined>;
41
+ /** @internal Resolved panel — explicit `tabPanel` input wins, falls back to a projected `<tw-tab-nav-panel>` inside the nav. */
42
+ readonly resolvedPanel: _angular_core.Signal<TabNavPanel | undefined>;
43
+ private readonly liveAnnouncer;
44
+ /** Tracks the previously-announced active link id so we only announce on actual changes. `null` = before the first sync. */
45
+ private readonly previousActiveLinkId;
46
+ private readonly layoutResult;
47
+ private readonly triggerResult;
48
+ /** @internal Combined classes applied to the `<nav>` host. */
49
+ readonly navClasses: _angular_core.Signal<string>;
50
+ /** @internal Base trigger classes (without active/inactive state). `no-underline` is appended because anchors need to override the default browser underline — tabs (which uses `<div role="tab">`) doesn't need it. */
51
+ readonly linkBaseClasses: _angular_core.Signal<string>;
52
+ /** @internal ARIA role — `tablist` when a tabPanel is associated, otherwise inherited from `<nav>`. */
53
+ readonly role: _angular_core.Signal<"tablist" | null>;
54
+ /** @internal ARIA orientation — only set in the tabs pattern. */
55
+ readonly ariaOrientation: _angular_core.Signal<"horizontal" | null>;
56
+ /** @internal Classes applied to the active state of a link, based on current variant and color. tab-nav is horizontal-only, so the orientation argument is hard-coded. */
57
+ readonly activeLinkClasses: _angular_core.Signal<string>;
58
+ /** @internal Classes applied to the inactive state of a link, based on current variant. */
59
+ readonly inactiveLinkClasses: _angular_core.Signal<string>;
60
+ private keyManager;
61
+ constructor();
62
+ /** @internal Handles arrow-key navigation in the ARIA tabs pattern via CDK FocusKeyManager. Manual activation: focus moves, but the link is only activated on Enter/Space (handled by the anchor itself). */
63
+ onKeydown(event: KeyboardEvent): void;
64
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabNavComponent, never>;
65
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TabNavComponent, "nav[twTabNav]", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "fitted": { "alias": "fitted"; "required": false; "isSignal": true; }; "tabPanel": { "alias": "tabPanel"; "required": false; "isSignal": true; }; "navClass": { "alias": "navClass"; "required": false; "isSignal": true; }; "linkClass": { "alias": "linkClass"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, {}, ["links", "projectedPanel"], ["*"], true, never>;
66
+ }
67
+ declare class TabLinkDirective {
68
+ /** @internal */
69
+ readonly elementRef: ElementRef<HTMLAnchorElement>;
70
+ private readonly parent;
71
+ /** Whether the link represents the current active page/tab. Typically bound to router state. Defaults to `false`. */
72
+ readonly active: _angular_core.InputSignal<boolean>;
73
+ /** When true, the link is visually disabled and cannot be activated by click or keyboard. Defaults to `false`. */
74
+ readonly disabled: _angular_core.InputSignal<boolean>;
75
+ /** Unique id for this link. Referenced by the panel's `aria-labelledby` when the link is active. Auto-generated when not provided. */
76
+ readonly linkId: _angular_core.InputSignal<string>;
77
+ /**
78
+ * @internal ARIA role — `'tab'` when the nav is wired to a panel (APG
79
+ * tablist pattern requires `role="tab"` on every link); `null` otherwise so
80
+ * the anchor's native `role="link"` wins. Do NOT collapse to a single
81
+ * branch — both are meaningful.
82
+ */
83
+ readonly linkRole: _angular_core.Signal<"tab" | null>;
84
+ /** @internal `aria-current="page"` on the active link when no tabPanel is associated. */
85
+ readonly ariaCurrent: _angular_core.Signal<"page" | null>;
86
+ /** @internal `aria-selected` applied only in the tabs pattern. */
87
+ readonly ariaSelected: _angular_core.Signal<"true" | "false" | null>;
88
+ /** @internal `aria-controls` points to the associated panel id. */
89
+ readonly ariaControls: _angular_core.Signal<string | null>;
90
+ /** @internal */
91
+ readonly ariaDisabled: _angular_core.Signal<"true" | null>;
92
+ /** @internal Tabindex — roving in the tabs pattern, default for navigation links, always -1 when disabled. */
93
+ readonly tabIndex: _angular_core.Signal<0 | -1 | null>;
94
+ /** @internal Combined classes: base + active/inactive state + disabled modifiers + consumer overrides. */
95
+ readonly classes: _angular_core.Signal<string>;
96
+ /** Programmatically focus this link. */
97
+ focus(): void;
98
+ /** @internal Intercepts clicks on disabled links to prevent navigation. */
99
+ onClick(event: MouseEvent): void;
100
+ /** @internal Handles keyboard activation: blocks Enter/Space on disabled links, and activates the link on Space for enabled ones (anchors do not respond to Space by default). */
101
+ onKeydown(event: KeyboardEvent): void;
102
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TabLinkDirective, never>;
103
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TabLinkDirective, "a[twTabLink]", never, { "active": { "alias": "active"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "linkId": { "alias": "linkId"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
104
+ }
105
+
106
+ export { TabLinkDirective, TabNavComponent, TabNavPanel };
107
+ export type { TabNavLabels, TabNavVariant };