@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,719 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Signal, ElementRef, ViewContainerRef, Injector, ComponentRef, EventEmitter } from '@angular/core';
|
|
3
|
+
import { AbstractControl } from '@angular/forms';
|
|
4
|
+
import { ConnectedPosition, Overlay, ScrollStrategy, OverlayRef } from '@angular/cdk/overlay';
|
|
5
|
+
import { ComponentType } from '@angular/cdk/portal';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
8
|
+
|
|
9
|
+
/** Semantic color palette used across all ngx-tw components. */
|
|
10
|
+
type TwColor = 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
|
|
11
|
+
/** Size scale used across all ngx-tw components. */
|
|
12
|
+
type TwSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
/** Layout axis used by oriented components (tabs, segmented-control, separator, etc.). */
|
|
14
|
+
type TwOrientation = 'horizontal' | 'vertical';
|
|
15
|
+
/** Tailwind-aligned breakpoint. Used by responsive component inputs. */
|
|
16
|
+
type TwBreakpoint = 'sm' | 'md' | 'lg' | 'xl';
|
|
17
|
+
/**
|
|
18
|
+
* Range-mode behavior knobs shared by `tw-calendar` (when `mode="range"`) and
|
|
19
|
+
* by overlay-bearing range pickers that forward to it. Consumer inputs accept
|
|
20
|
+
* `Partial<RangeBehaviorConfig>`; unset fields fall back to the documented
|
|
21
|
+
* defaults — `allowSingleDayRange` and `persistPartialRange` default to `true`
|
|
22
|
+
* because dropping either would surprise consumers (clicking the same cell
|
|
23
|
+
* twice and committing one day; an in-flight draft surviving navigation are
|
|
24
|
+
* the expected gestures). `allowBackwardRange` and
|
|
25
|
+
* `disableRangesCrossingDisabledDates` default to `false`.
|
|
26
|
+
*/
|
|
27
|
+
interface RangeBehaviorConfig {
|
|
28
|
+
/**
|
|
29
|
+
* When `true`, the calendar accepts ranges with `start > end` and skips
|
|
30
|
+
* the auto-swap path (§21.5). Default `false` — backward clicks normalize.
|
|
31
|
+
*/
|
|
32
|
+
allowBackwardRange: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* When `true`, clicking the same cell as `draft.start` commits a single-day
|
|
35
|
+
* range `{ start, end: start }`. When `false`, the click is rejected with
|
|
36
|
+
* `data-state-invalid-flash`. Default `true` — selecting one day twice in
|
|
37
|
+
* range mode is the expected user gesture.
|
|
38
|
+
*/
|
|
39
|
+
allowSingleDayRange: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* When `true`, the in-flight range draft survives across view navigation
|
|
42
|
+
* (next/prev month, drill-up/down). When `false`, navigation during
|
|
43
|
+
* SELECTING discards the draft and emits `selectionCleared`. Default
|
|
44
|
+
* `true` — losing a half-finished range on navigation is unexpected.
|
|
45
|
+
*/
|
|
46
|
+
persistPartialRange: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* When `true`, a range commit that would span any disabled date in its
|
|
49
|
+
* interior is rejected with `data-state-invalid-flash` and the committed
|
|
50
|
+
* value is left unchanged. Default `false`.
|
|
51
|
+
*/
|
|
52
|
+
disableRangesCrossingDisabledDates: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Minimal contract for a parent form's "submitted" state. Both `NgForm` and
|
|
57
|
+
* `FormGroupDirective` satisfy this, so the matcher can work with either.
|
|
58
|
+
*/
|
|
59
|
+
interface TwFormSubmitted {
|
|
60
|
+
readonly submitted: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Strategy that decides when a form control should be rendered in the error
|
|
64
|
+
* state. Controls read the injected matcher (or accept a per-instance
|
|
65
|
+
* override) and combine the result with their own signals. Override at any
|
|
66
|
+
* injector level via {@link TW_ERROR_STATE_MATCHER}.
|
|
67
|
+
*/
|
|
68
|
+
interface ErrorStateMatcher {
|
|
69
|
+
/** Returns true when the control should display an error. */
|
|
70
|
+
isErrorState(control: AbstractControl | null, form: TwFormSubmitted | null): boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Default error-state strategy: errored when the control is `invalid` and
|
|
74
|
+
* either has been interacted with (`dirty` or `touched`) or its parent form
|
|
75
|
+
* has been submitted. Matches Material's default behavior.
|
|
76
|
+
*/
|
|
77
|
+
declare const defaultErrorStateMatcher: ErrorStateMatcher;
|
|
78
|
+
/**
|
|
79
|
+
* Injection token carrying the {@link ErrorStateMatcher} used by every ngx-tw
|
|
80
|
+
* form control. Defaults to {@link defaultErrorStateMatcher}; provide a
|
|
81
|
+
* different matcher at root to change global error-display policy, or at any
|
|
82
|
+
* descendant injector to scope the change.
|
|
83
|
+
*/
|
|
84
|
+
declare const TW_ERROR_STATE_MATCHER: InjectionToken<ErrorStateMatcher>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Read-only view of a sortable region's state.
|
|
88
|
+
*
|
|
89
|
+
* Components that render column headers (e.g., `<tw-table>`) consume this handle to
|
|
90
|
+
* project `aria-sort` onto the active column without taking a hard dependency on the
|
|
91
|
+
* sort implementation. The canonical provider is `SortDirective` (`[twSort]`).
|
|
92
|
+
*/
|
|
93
|
+
interface TwSortHandle {
|
|
94
|
+
/** Signal of the id of the currently active sort header, or `null` when no sort is active. */
|
|
95
|
+
readonly active: Signal<string | null>;
|
|
96
|
+
/** Signal of the active sort direction (`'asc'` / `'desc'`), or `null` when cleared. */
|
|
97
|
+
readonly direction: Signal<'asc' | 'desc' | null>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* DI token through which sort containers expose their state to consumers. Provided by
|
|
101
|
+
* `SortDirective` (`[twSort]`). Inject with `{ optional: true }` — components that need
|
|
102
|
+
* aria-sort plumbing should degrade gracefully when no sort directive is present.
|
|
103
|
+
*/
|
|
104
|
+
declare const TW_SORT_HANDLE: InjectionToken<TwSortHandle>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Connected-overlay position list for "select-like" overlays — overlays whose
|
|
108
|
+
* panel attaches directly under (or above) a trigger element and falls back to
|
|
109
|
+
* the opposite vertical side when there is not enough room. Returns four
|
|
110
|
+
* fallback positions: below-start, below-end, above-start, above-end.
|
|
111
|
+
*
|
|
112
|
+
* Used by `SelectComponent`, `ComboboxComponent`, `DatePickerComponent`, and
|
|
113
|
+
* `DateRangePickerComponent` — any overlay-bearing form control that anchors
|
|
114
|
+
* a listbox / menu / calendar panel to its trigger. The shape is identical for
|
|
115
|
+
* all four; the historical "select-like" name refers to the original consumer.
|
|
116
|
+
*
|
|
117
|
+
* @param offset Vertical offset in pixels applied between the trigger edge and
|
|
118
|
+
* the panel edge. Below-positions use `+offset`; above-positions use
|
|
119
|
+
* `-offset` so the panel pulls away from the trigger consistently.
|
|
120
|
+
*/
|
|
121
|
+
declare function buildSelectLikePositions(offset?: number): ConnectedPosition[];
|
|
122
|
+
|
|
123
|
+
/** Named scroll-strategy variants supported by select-like overlays. */
|
|
124
|
+
type SelectScrollStrategyName = 'reposition' | 'close' | 'block';
|
|
125
|
+
/**
|
|
126
|
+
* Maps a named scroll-strategy variant to the corresponding CDK
|
|
127
|
+
* `ScrollStrategy` instance. `'reposition'` is the default for select-like
|
|
128
|
+
* overlays; `'close'` dismisses the panel on scroll; `'block'` locks page
|
|
129
|
+
* scrolling while the panel is open.
|
|
130
|
+
*
|
|
131
|
+
* Used by `SelectComponent`, `ComboboxComponent`, `DatePickerComponent`, and
|
|
132
|
+
* `DateRangePickerComponent` — any overlay-bearing form control that exposes
|
|
133
|
+
* the same three-option scroll-strategy input.
|
|
134
|
+
*/
|
|
135
|
+
declare function resolveSelectScrollStrategy(name: SelectScrollStrategyName, overlay: Overlay): ScrollStrategy;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Subscribes to overlay-level `Escape` keydown events and invokes `onEscape`
|
|
139
|
+
* for each one. Returns an unsubscribe function so callers can scope teardown
|
|
140
|
+
* to the open lifecycle of the overlay (typically tied into a `Subscription`
|
|
141
|
+
* aggregate or a `takeUntilDestroyed` flow).
|
|
142
|
+
*
|
|
143
|
+
* Listens via `OverlayRef.keydownEvents()` so the handler fires for any
|
|
144
|
+
* keystroke originating inside the overlay, regardless of which element holds
|
|
145
|
+
* DOM focus — useful for select-style overlays whose search/listbox children
|
|
146
|
+
* may receive focus apart from the trigger.
|
|
147
|
+
*
|
|
148
|
+
* Callers remain responsible for calling `event.preventDefault()` /
|
|
149
|
+
* `stopPropagation()` inside `onEscape` if they want to short-circuit further
|
|
150
|
+
* key handling.
|
|
151
|
+
*/
|
|
152
|
+
declare function consumeOverlayEscape(overlayRef: OverlayRef, onEscape: (event: KeyboardEvent) => void): () => void;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Enter-animation duration for date-picker / date-range-picker overlays.
|
|
156
|
+
* Matches `theme/_base.css` `.scale-in 140ms` — the keyframe the picker
|
|
157
|
+
* overlays apply via `animate.enter="scale-in"`. The coordinator delays
|
|
158
|
+
* `opened$` emission by this duration so consumers can hook the moment the
|
|
159
|
+
* panel has fully appeared instead of the moment `open()` was called.
|
|
160
|
+
*/
|
|
161
|
+
declare const PICKER_ENTER_DURATION = 140;
|
|
162
|
+
/**
|
|
163
|
+
* Leave-animation duration for date-picker / date-range-picker overlays.
|
|
164
|
+
* Matches `theme/_base.css` `.scale-out 120ms` — the keyframe the picker
|
|
165
|
+
* overlays apply via `animate.leave="scale-out"`. The coordinator delays
|
|
166
|
+
* overlay detach by this duration so the leave animation can play through.
|
|
167
|
+
*/
|
|
168
|
+
declare const PICKER_LEAVE_DURATION = 120;
|
|
169
|
+
/** Configuration passed to {@link PickerOverlayCoordinator.open}. */
|
|
170
|
+
interface PickerOpenConfig<TOverlay> {
|
|
171
|
+
/** Element used as the connected-overlay origin (typically the picker trigger). */
|
|
172
|
+
readonly origin: ElementRef<HTMLElement>;
|
|
173
|
+
/** Component type to render inside the overlay (e.g. `DatePickerOverlayComponent`). */
|
|
174
|
+
readonly portalComponent: ComponentType<TOverlay>;
|
|
175
|
+
/** View-container that hosts the embedded view; usually the picker's `ViewContainerRef`. */
|
|
176
|
+
readonly viewContainerRef: ViewContainerRef;
|
|
177
|
+
/** Optional injector forwarded to the portal so DI tokens resolve from the picker's tree. */
|
|
178
|
+
readonly injector?: Injector;
|
|
179
|
+
/** Connected-position list — typically the result of `buildSelectLikePositions(offset)`. */
|
|
180
|
+
readonly positions: ConnectedPosition[];
|
|
181
|
+
/** CDK scroll-strategy instance for the overlay. */
|
|
182
|
+
readonly scrollStrategy: ScrollStrategy;
|
|
183
|
+
/** CSS class applied to the CDK overlay-pane element (NOT the panel root). */
|
|
184
|
+
readonly panelClass: string;
|
|
185
|
+
/** Viewport margin forwarded to the CDK position-strategy. Defaults to `8`. */
|
|
186
|
+
readonly viewportMargin?: number;
|
|
187
|
+
}
|
|
188
|
+
/** Synchronous return shape of {@link PickerOverlayCoordinator.open}. */
|
|
189
|
+
interface PickerOpenResult<TOverlay> {
|
|
190
|
+
/** The CDK `OverlayRef` driving the overlay — exposed for advanced consumers. */
|
|
191
|
+
readonly overlayRef: OverlayRef;
|
|
192
|
+
/** The Angular `ComponentRef` for the attached portal — exposed so consumers may run `detectChanges()` to flush an initial-config push synchronously. */
|
|
193
|
+
readonly componentRef: ComponentRef<TOverlay>;
|
|
194
|
+
/** The instance of the attached portal component. Equivalent to `componentRef.instance`. */
|
|
195
|
+
readonly instance: TOverlay;
|
|
196
|
+
/** Auto-generated id consumers may wire to `aria-controls` / dialog `id`. */
|
|
197
|
+
readonly panelId: string;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Coordinator that owns the CDK `OverlayRef`, focus trap, panel-id, and
|
|
201
|
+
* animation timing for an overlay-bearing form control. Consumed by
|
|
202
|
+
* `DatePickerComponent` and `DateRangePickerComponent`; both pickers register
|
|
203
|
+
* the coordinator at the component level (`providers: [PickerOverlayCoordinator]`)
|
|
204
|
+
* so each picker instance owns its own coordinator state.
|
|
205
|
+
*
|
|
206
|
+
* Per the library "no `providedIn: 'root'` for services" rule (see
|
|
207
|
+
* `.claude/CLAUDE.md` → "What NOT To Do"): the coordinator holds per-overlay
|
|
208
|
+
* `OverlayRef` / `FocusTrap` state and MUST be component-scoped.
|
|
209
|
+
*
|
|
210
|
+
* Scope of responsibility:
|
|
211
|
+
* - Create / dispose the CDK `OverlayRef`.
|
|
212
|
+
* - Attach a `ComponentPortal` and return the instance.
|
|
213
|
+
* - Set up / tear down a `FocusTrap` around the overlay element.
|
|
214
|
+
* - Emit `opened$` after the enter animation completes (closes the
|
|
215
|
+
* synchronous-emit bug previously present in both pickers).
|
|
216
|
+
* - Expose `backdropClick$` / `overlayKeydown$` / `escape$` streams scoped
|
|
217
|
+
* to the current open lifecycle.
|
|
218
|
+
* - Run a leave-animation timer with an `isAttached` guard so close races
|
|
219
|
+
* never touch a detached `OverlayRef` (mirrors the S14 command-palette
|
|
220
|
+
* pattern).
|
|
221
|
+
*
|
|
222
|
+
* Out of scope (stays in the consuming picker):
|
|
223
|
+
* - "Restore previous value on close" — semantics differ per picker.
|
|
224
|
+
* - Per-picker portal callbacks (calendar selection, action-bar buttons).
|
|
225
|
+
* - View-mode change-detection nudges (the range-picker calls
|
|
226
|
+
* `changeDetectorRef.detectChanges()` after pushing its initial overlay
|
|
227
|
+
* config; the date-picker does not).
|
|
228
|
+
*/
|
|
229
|
+
declare class PickerOverlayCoordinator {
|
|
230
|
+
private readonly overlay;
|
|
231
|
+
private readonly focusTrapFactory;
|
|
232
|
+
private readonly destroyRef;
|
|
233
|
+
private readonly idGenerator;
|
|
234
|
+
private overlayRef;
|
|
235
|
+
private focusTrap;
|
|
236
|
+
private closeTimer;
|
|
237
|
+
private openedTimer;
|
|
238
|
+
private currentPanelId;
|
|
239
|
+
private currentClose$;
|
|
240
|
+
private openedSubject;
|
|
241
|
+
private readonly attachedSignal;
|
|
242
|
+
private readonly openedSignal;
|
|
243
|
+
/** Whether the overlay is currently attached (between `open()` and detach). */
|
|
244
|
+
readonly attached: Signal<boolean>;
|
|
245
|
+
/** Whether the enter animation has completed (`opened$` has fired). */
|
|
246
|
+
readonly opened: Signal<boolean>;
|
|
247
|
+
constructor();
|
|
248
|
+
/**
|
|
249
|
+
* Creates and attaches the overlay. Returns the live overlay metadata
|
|
250
|
+
* synchronously; callers should subscribe to {@link opened$} to observe the
|
|
251
|
+
* moment the enter animation completes. Returns `null` if an overlay is
|
|
252
|
+
* already attached.
|
|
253
|
+
*/
|
|
254
|
+
open<TOverlay>(config: PickerOpenConfig<TOverlay>): PickerOpenResult<TOverlay> | null;
|
|
255
|
+
/**
|
|
256
|
+
* Starts the close sequence — destroys the focus trap immediately so focus
|
|
257
|
+
* can return to the trigger, then detaches the overlay after the leave
|
|
258
|
+
* animation runs ({@link PICKER_LEAVE_DURATION}). Invokes `onAfterClose`
|
|
259
|
+
* once the overlay is fully detached. No-op if no overlay is open or a
|
|
260
|
+
* close is already in flight.
|
|
261
|
+
*
|
|
262
|
+
* Mirrors the S14 command-palette `isAttached`-guarded close pattern:
|
|
263
|
+
* after the timer fires we re-check `attachedSignal` before touching the
|
|
264
|
+
* overlay so a race (programmatic dispose, double-close) cannot touch a
|
|
265
|
+
* destroyed instance.
|
|
266
|
+
*/
|
|
267
|
+
close(onAfterClose?: () => void): void;
|
|
268
|
+
/**
|
|
269
|
+
* Stream of overlay-level backdrop clicks for the current open lifecycle.
|
|
270
|
+
* Completes when the overlay closes.
|
|
271
|
+
*/
|
|
272
|
+
backdropClick$(): Observable<MouseEvent>;
|
|
273
|
+
/**
|
|
274
|
+
* Stream of overlay-level keydown events for the current open lifecycle.
|
|
275
|
+
* Completes when the overlay closes.
|
|
276
|
+
*/
|
|
277
|
+
overlayKeydown$(): Observable<KeyboardEvent>;
|
|
278
|
+
/**
|
|
279
|
+
* Stream filtered to `Escape` keydowns inside the overlay for the current
|
|
280
|
+
* open lifecycle. Equivalent to `overlayKeydown$().pipe(filter(e => e.key === 'Escape'))`
|
|
281
|
+
* but spelled out so consumers don't import RxJS operators just for the
|
|
282
|
+
* common case.
|
|
283
|
+
*/
|
|
284
|
+
escape$(): Observable<KeyboardEvent>;
|
|
285
|
+
/**
|
|
286
|
+
* Emits exactly once after the enter animation completes
|
|
287
|
+
* ({@link PICKER_ENTER_DURATION}ms after `open()`). Used by consumers to
|
|
288
|
+
* fire their `opened` output at the moment the overlay panel is actually
|
|
289
|
+
* visible — closes the synchronous-emit bug the pickers carried before
|
|
290
|
+
* this coordinator existed.
|
|
291
|
+
*
|
|
292
|
+
* Completes when the overlay closes.
|
|
293
|
+
*/
|
|
294
|
+
opened$(): Observable<void>;
|
|
295
|
+
/** Exposes the live `OverlayRef` for advanced consumers (e.g. width sync). */
|
|
296
|
+
ref(): OverlayRef | null;
|
|
297
|
+
/**
|
|
298
|
+
* Exposes the current panel id (auto-generated via CDK `_IdGenerator`,
|
|
299
|
+
* stable for the open lifecycle, reset to `null` on close). Neither
|
|
300
|
+
* consuming picker uses this today — both keep their own
|
|
301
|
+
* `${hostId}-dialog` id for `aria-controls` wiring — but the helper is
|
|
302
|
+
* exposed for future consumers (e.g. a picker wrapper that wants its
|
|
303
|
+
* panel id auto-managed).
|
|
304
|
+
*/
|
|
305
|
+
panelId(): string | null;
|
|
306
|
+
/**
|
|
307
|
+
* Immediately disposes the overlay and tears down the focus trap without
|
|
308
|
+
* running the leave animation. Called from {@link DestroyRef.onDestroy};
|
|
309
|
+
* consumers should NOT call this — use {@link close} for the user-visible
|
|
310
|
+
* close path.
|
|
311
|
+
*/
|
|
312
|
+
private disposeImmediate;
|
|
313
|
+
private setupFocusTrap;
|
|
314
|
+
private destroyFocusTrap;
|
|
315
|
+
private scheduleOpenedEmission;
|
|
316
|
+
private clearCloseTimer;
|
|
317
|
+
private clearOpenedTimer;
|
|
318
|
+
private assertOpen;
|
|
319
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PickerOverlayCoordinator, never>;
|
|
320
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PickerOverlayCoordinator>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Pure helpers shared by `DialogContainer` and `SheetContainer` (both live
|
|
325
|
+
* under `projects/ngx-tw/{dialog,sheet}/`) — and consumable by any future
|
|
326
|
+
* `CdkDialogContainer` subclass that needs the same plumbing.
|
|
327
|
+
*
|
|
328
|
+
* No DOM, no Angular DI. The DI-bound state lives in
|
|
329
|
+
* {@link OverlayContainerCoordinator}; this file is the data-only layer.
|
|
330
|
+
*/
|
|
331
|
+
/**
|
|
332
|
+
* Fallback padding (ms) added on top of an enter/exit animation duration when
|
|
333
|
+
* scheduling the `transitionend` fallback timer. The browser SHOULD fire
|
|
334
|
+
* `transitionend` at the configured duration, but transitions can be
|
|
335
|
+
* swallowed (focus changes during the animation, interrupted transitions,
|
|
336
|
+
* etc.) — the padding gives the browser a small grace period before our
|
|
337
|
+
* fallback runs.
|
|
338
|
+
*
|
|
339
|
+
* Both dialog and sheet containers used the same constant — extracted here so
|
|
340
|
+
* a future tweak applies to both at once.
|
|
341
|
+
*/
|
|
342
|
+
declare const OVERLAY_ANIMATION_FALLBACK_PADDING = 50;
|
|
343
|
+
/**
|
|
344
|
+
* Coerces a user-supplied animation duration to a safe positive integer, or
|
|
345
|
+
* falls back to a default if the input is `null`, `undefined`, negative, or
|
|
346
|
+
* non-finite (`NaN`, `Infinity`). Dialog and sheet containers both used this
|
|
347
|
+
* same standalone function; centralised here.
|
|
348
|
+
*/
|
|
349
|
+
declare function coerceOverlayDuration(value: number | undefined, fallback: number): number;
|
|
350
|
+
/**
|
|
351
|
+
* Merges a consumer-supplied `panelClass` (single class, list, or
|
|
352
|
+
* `undefined`) with the container's internal class string. Returns a single
|
|
353
|
+
* space-separated class string suitable for `[class]` host binding.
|
|
354
|
+
*
|
|
355
|
+
* `consumer` always wins ordering (appended after `internal`) so consumer
|
|
356
|
+
* overrides resolve correctly through `tailwind-merge` upstream.
|
|
357
|
+
*/
|
|
358
|
+
declare function mergeOverlayPanelClass(internal: string, consumer: string | readonly string[] | undefined): string;
|
|
359
|
+
/**
|
|
360
|
+
* Append-only id list with idempotent insertion, used for the
|
|
361
|
+
* `aria-describedby` queue both `DialogContainer` and `SheetContainer`
|
|
362
|
+
* maintain (the matching `aria-labelledby` queue lives in CDK's
|
|
363
|
+
* `CdkDialogContainer`).
|
|
364
|
+
*
|
|
365
|
+
* Pure data structure — no DOM, no Angular signals. Consumers wrap an
|
|
366
|
+
* instance in their own change-detection mechanism (the
|
|
367
|
+
* {@link OverlayContainerCoordinator} keeps the live snapshot in a signal so
|
|
368
|
+
* the container's `[attr.aria-describedby]` binding refreshes via OnPush
|
|
369
|
+
* without a manual `markForCheck()`).
|
|
370
|
+
*
|
|
371
|
+
* First-registered-wins semantics for `first()` mirror CDK's
|
|
372
|
+
* `_ariaLabelledByQueue[0]` host binding — describing the dialog by the
|
|
373
|
+
* earliest registered description prevents a late-mounted nested directive
|
|
374
|
+
* from silently re-aiming the description target.
|
|
375
|
+
*/
|
|
376
|
+
declare class AriaIdQueue {
|
|
377
|
+
private readonly ids;
|
|
378
|
+
/** Inserts an id at the tail. No-op if the id is already present. */
|
|
379
|
+
add(id: string): void;
|
|
380
|
+
/** Removes the given id. No-op if the id is not present. */
|
|
381
|
+
remove(id: string): void;
|
|
382
|
+
/** First registered id (or `null` if empty). Matches CDK's `_ariaLabelledByQueue[0]` semantics. */
|
|
383
|
+
first(): string | null;
|
|
384
|
+
/** Returns a fresh snapshot of all registered ids in insertion order. */
|
|
385
|
+
snapshot(): readonly string[];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** Lifecycle states an overlay container passes through. Shared by dialog and sheet. */
|
|
389
|
+
type OverlayContainerState = 'opening' | 'open' | 'closing' | 'closed';
|
|
390
|
+
/** Event emitted on every overlay-container animation-state transition. */
|
|
391
|
+
interface OverlayContainerAnimationEvent {
|
|
392
|
+
/** State that the container just transitioned into. */
|
|
393
|
+
state: OverlayContainerState;
|
|
394
|
+
/** Duration, in ms, of the transition that triggered the event. */
|
|
395
|
+
totalTime: number;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Component-scoped coordinator that owns the enter/exit animation state
|
|
399
|
+
* machine, ARIA-describedby id queue, and panel-class merge for an overlay
|
|
400
|
+
* container that subclasses `@angular/cdk/dialog`'s `CdkDialogContainer`.
|
|
401
|
+
*
|
|
402
|
+
* Consumed by `DialogContainer` and `SheetContainer`; both register the
|
|
403
|
+
* coordinator at the component level (`providers: [OverlayContainerCoordinator]`)
|
|
404
|
+
* so each container instance owns its own animation state and queue.
|
|
405
|
+
*
|
|
406
|
+
* Per the library "no `providedIn: 'root'` for services" rule (see
|
|
407
|
+
* `.claude/CLAUDE.md` → "What NOT To Do"): the coordinator holds per-overlay
|
|
408
|
+
* state (the current animation timer, the describedby queue, the lifecycle
|
|
409
|
+
* signal) and MUST be component-scoped.
|
|
410
|
+
*
|
|
411
|
+
* Scope of responsibility:
|
|
412
|
+
* - Animation state signal (`state`) and `transitionDuration` computed.
|
|
413
|
+
* - Enter/exit animation timing (`startEnterAnimation`, `startExitAnimation`)
|
|
414
|
+
* with a `transitionend`-fallback timer.
|
|
415
|
+
* - `animationStateChanged` EventEmitter forwarded to the consuming `Ref`.
|
|
416
|
+
* - ARIA-describedby id queue (the matching labelledby queue is already
|
|
417
|
+
* owned by CDK's `CdkDialogContainer._ariaLabelledByQueue`).
|
|
418
|
+
*
|
|
419
|
+
* Out of scope (stays on the container subclass):
|
|
420
|
+
* - The `CdkDialogContainer` contract — focus trap, escape key, backdrop
|
|
421
|
+
* click, overlay attach/detach. The container subclass keeps inheriting
|
|
422
|
+
* `CdkDialogContainer` directly; this coordinator layers on top.
|
|
423
|
+
* - Tailwind class resolution (`tv()` variant slots) — that's per-container.
|
|
424
|
+
* - Host bindings on the container element — that's per-container.
|
|
425
|
+
*/
|
|
426
|
+
declare class OverlayContainerCoordinator {
|
|
427
|
+
private readonly destroyRef;
|
|
428
|
+
private readonly stateSignal;
|
|
429
|
+
private readonly ariaDescribedByQueue;
|
|
430
|
+
private readonly queue;
|
|
431
|
+
private animationTimer;
|
|
432
|
+
private enterDuration;
|
|
433
|
+
private exitDuration;
|
|
434
|
+
/** Lifecycle state of the container's enter/exit animation. */
|
|
435
|
+
readonly state: Signal<OverlayContainerState>;
|
|
436
|
+
/** Live snapshot of the describedby id queue. */
|
|
437
|
+
readonly describedByIds: Signal<readonly string[]>;
|
|
438
|
+
/**
|
|
439
|
+
* Active transition duration for the current state — the enter duration for
|
|
440
|
+
* `opening` / `open`, the exit duration for `closing`, and 0 once `closed`.
|
|
441
|
+
* Drives the container's `[style.transition-duration.ms]` host binding so a
|
|
442
|
+
* one-line `data-[state]` transition rule can run with per-call timing.
|
|
443
|
+
*/
|
|
444
|
+
readonly transitionDuration: Signal<number>;
|
|
445
|
+
/**
|
|
446
|
+
* Emits whenever the animation state transitions. The container's `Ref`
|
|
447
|
+
* (`TwDialogRef` / `SheetRef`) subscribes to drive its own lifecycle
|
|
448
|
+
* (`afterOpened`, `afterClosed`, exit-animation completion).
|
|
449
|
+
*/
|
|
450
|
+
readonly animationStateChanged: EventEmitter<OverlayContainerAnimationEvent>;
|
|
451
|
+
constructor();
|
|
452
|
+
/**
|
|
453
|
+
* Records the resolved enter/exit durations for the open lifecycle.
|
|
454
|
+
* Called once from the container constructor with values coerced via
|
|
455
|
+
* `coerceOverlayDuration`. Stored on the coordinator so
|
|
456
|
+
* `transitionDuration()` and the timer-driven state transitions read from
|
|
457
|
+
* a single source.
|
|
458
|
+
*/
|
|
459
|
+
setDurations(enter: number, exit: number): void;
|
|
460
|
+
/**
|
|
461
|
+
* Drives the enter animation: emits `opening` immediately, then defers the
|
|
462
|
+
* state flip to `open` by one frame so the browser applies the initial
|
|
463
|
+
* (hidden / off-screen) styles before transitioning. If `enter` is `0`
|
|
464
|
+
* everything resolves synchronously (no animation).
|
|
465
|
+
*/
|
|
466
|
+
startEnterAnimation(): void;
|
|
467
|
+
/**
|
|
468
|
+
* Drives the exit animation: emits `closing` synchronously and schedules
|
|
469
|
+
* the `closed` emission for after the exit duration (+ a small fallback
|
|
470
|
+
* padding) elapses. The consuming `Ref` listens for the `closed` emission
|
|
471
|
+
* to detach the CDK overlay.
|
|
472
|
+
*/
|
|
473
|
+
startExitAnimation(): void;
|
|
474
|
+
/** Registers a description id with the `aria-describedby` queue. */
|
|
475
|
+
addAriaDescribedBy(id: string): void;
|
|
476
|
+
/** Removes a previously registered description id. */
|
|
477
|
+
removeAriaDescribedBy(id: string): void;
|
|
478
|
+
/** First-registered-wins resolution for the `aria-describedby` attribute. */
|
|
479
|
+
firstDescribedBy(): string | null;
|
|
480
|
+
private runAnimationTimer;
|
|
481
|
+
private clearAnimationTimer;
|
|
482
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<OverlayContainerCoordinator, never>;
|
|
483
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<OverlayContainerCoordinator>;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Visual style shared by `tw-tabs` (`TabsVariant`) and `nav[twTabNav]` (`TabNavVariant`).
|
|
488
|
+
* Kept as a string-literal union so downstream consumers can narrow when needed.
|
|
489
|
+
*/
|
|
490
|
+
type TabTriggerVariant = 'underline' | 'enclosed' | 'pill';
|
|
491
|
+
/**
|
|
492
|
+
* Trigger-only tailwind-variants config shared by tabs and tab-nav.
|
|
493
|
+
*
|
|
494
|
+
* Both components own additional component-local slots (tablist/list/panel/nav,
|
|
495
|
+
* etc.) — only the trigger shape is canonical enough to share here. The
|
|
496
|
+
* resulting class string is merged with each component's local trigger
|
|
497
|
+
* additions (e.g. tab-nav prepends `no-underline` because anchor elements need
|
|
498
|
+
* to override the default underline; tabs adds nothing extra at the base).
|
|
499
|
+
*
|
|
500
|
+
* Active and inactive trigger state is applied separately via
|
|
501
|
+
* {@link getActiveTriggerClasses} / {@link getInactiveTriggerClasses} so the
|
|
502
|
+
* `Record<TwColor, string>` lookups stay statically scannable by the Tailwind
|
|
503
|
+
* v4 content scanner.
|
|
504
|
+
*/
|
|
505
|
+
declare const tabTriggerVariants: tailwind_variants.TVReturnType<{
|
|
506
|
+
variant: {
|
|
507
|
+
underline: {
|
|
508
|
+
trigger: string;
|
|
509
|
+
};
|
|
510
|
+
enclosed: {
|
|
511
|
+
trigger: string;
|
|
512
|
+
};
|
|
513
|
+
pill: {
|
|
514
|
+
trigger: string;
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
size: {
|
|
518
|
+
xs: {
|
|
519
|
+
trigger: string;
|
|
520
|
+
};
|
|
521
|
+
sm: {
|
|
522
|
+
trigger: string;
|
|
523
|
+
};
|
|
524
|
+
md: {
|
|
525
|
+
trigger: string;
|
|
526
|
+
};
|
|
527
|
+
lg: {
|
|
528
|
+
trigger: string;
|
|
529
|
+
};
|
|
530
|
+
xl: {
|
|
531
|
+
trigger: string;
|
|
532
|
+
};
|
|
533
|
+
};
|
|
534
|
+
fitted: {
|
|
535
|
+
true: {
|
|
536
|
+
trigger: string;
|
|
537
|
+
};
|
|
538
|
+
false: {};
|
|
539
|
+
};
|
|
540
|
+
color: {
|
|
541
|
+
primary: {};
|
|
542
|
+
secondary: {};
|
|
543
|
+
accent: {};
|
|
544
|
+
neutral: {};
|
|
545
|
+
info: {};
|
|
546
|
+
success: {};
|
|
547
|
+
warning: {};
|
|
548
|
+
error: {};
|
|
549
|
+
};
|
|
550
|
+
}, {
|
|
551
|
+
trigger: string;
|
|
552
|
+
}, undefined, {
|
|
553
|
+
twMerge: true;
|
|
554
|
+
}, {
|
|
555
|
+
variant: {
|
|
556
|
+
underline: {
|
|
557
|
+
trigger: string;
|
|
558
|
+
};
|
|
559
|
+
enclosed: {
|
|
560
|
+
trigger: string;
|
|
561
|
+
};
|
|
562
|
+
pill: {
|
|
563
|
+
trigger: string;
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
size: {
|
|
567
|
+
xs: {
|
|
568
|
+
trigger: string;
|
|
569
|
+
};
|
|
570
|
+
sm: {
|
|
571
|
+
trigger: string;
|
|
572
|
+
};
|
|
573
|
+
md: {
|
|
574
|
+
trigger: string;
|
|
575
|
+
};
|
|
576
|
+
lg: {
|
|
577
|
+
trigger: string;
|
|
578
|
+
};
|
|
579
|
+
xl: {
|
|
580
|
+
trigger: string;
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
fitted: {
|
|
584
|
+
true: {
|
|
585
|
+
trigger: string;
|
|
586
|
+
};
|
|
587
|
+
false: {};
|
|
588
|
+
};
|
|
589
|
+
color: {
|
|
590
|
+
primary: {};
|
|
591
|
+
secondary: {};
|
|
592
|
+
accent: {};
|
|
593
|
+
neutral: {};
|
|
594
|
+
info: {};
|
|
595
|
+
success: {};
|
|
596
|
+
warning: {};
|
|
597
|
+
error: {};
|
|
598
|
+
};
|
|
599
|
+
}, {
|
|
600
|
+
trigger: string;
|
|
601
|
+
}, tailwind_variants.TVReturnType<{
|
|
602
|
+
variant: {
|
|
603
|
+
underline: {
|
|
604
|
+
trigger: string;
|
|
605
|
+
};
|
|
606
|
+
enclosed: {
|
|
607
|
+
trigger: string;
|
|
608
|
+
};
|
|
609
|
+
pill: {
|
|
610
|
+
trigger: string;
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
size: {
|
|
614
|
+
xs: {
|
|
615
|
+
trigger: string;
|
|
616
|
+
};
|
|
617
|
+
sm: {
|
|
618
|
+
trigger: string;
|
|
619
|
+
};
|
|
620
|
+
md: {
|
|
621
|
+
trigger: string;
|
|
622
|
+
};
|
|
623
|
+
lg: {
|
|
624
|
+
trigger: string;
|
|
625
|
+
};
|
|
626
|
+
xl: {
|
|
627
|
+
trigger: string;
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
fitted: {
|
|
631
|
+
true: {
|
|
632
|
+
trigger: string;
|
|
633
|
+
};
|
|
634
|
+
false: {};
|
|
635
|
+
};
|
|
636
|
+
color: {
|
|
637
|
+
primary: {};
|
|
638
|
+
secondary: {};
|
|
639
|
+
accent: {};
|
|
640
|
+
neutral: {};
|
|
641
|
+
info: {};
|
|
642
|
+
success: {};
|
|
643
|
+
warning: {};
|
|
644
|
+
error: {};
|
|
645
|
+
};
|
|
646
|
+
}, {
|
|
647
|
+
trigger: string;
|
|
648
|
+
}, undefined, {
|
|
649
|
+
twMerge: true;
|
|
650
|
+
}, unknown, unknown, undefined>>;
|
|
651
|
+
/** @internal Active trigger classes for horizontal underline variants, keyed by color. */
|
|
652
|
+
declare const UNDERLINE_ACTIVE_HORIZONTAL: Record<TwColor, string>;
|
|
653
|
+
/** @internal Active trigger classes for vertical underline variants, keyed by color. */
|
|
654
|
+
declare const UNDERLINE_ACTIVE_VERTICAL: Record<TwColor, string>;
|
|
655
|
+
/** @internal Active trigger classes for horizontal enclosed variants, keyed by color. */
|
|
656
|
+
declare const ENCLOSED_ACTIVE_HORIZONTAL: Record<TwColor, string>;
|
|
657
|
+
/** @internal Active trigger classes for vertical enclosed variants, keyed by color. */
|
|
658
|
+
declare const ENCLOSED_ACTIVE_VERTICAL: Record<TwColor, string>;
|
|
659
|
+
/** @internal Active trigger classes for pill variants, keyed by color. */
|
|
660
|
+
declare const PILL_ACTIVE: Record<TwColor, string>;
|
|
661
|
+
/** @internal Inactive trigger classes keyed by variant. */
|
|
662
|
+
declare const INACTIVE_TRIGGER_CLASSES: Record<TabTriggerVariant, string>;
|
|
663
|
+
/**
|
|
664
|
+
* Returns the active-state trigger class string for the given variant, color,
|
|
665
|
+
* and orientation. Tab-nav callers pass `'horizontal'` since it is horizontal-only.
|
|
666
|
+
*/
|
|
667
|
+
declare function getActiveTriggerClasses(variant: TabTriggerVariant, color: TwColor, orientation?: 'horizontal' | 'vertical'): string;
|
|
668
|
+
/** Returns the inactive-state trigger class string for the given variant. */
|
|
669
|
+
declare function getInactiveTriggerClasses(variant: TabTriggerVariant): string;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Pure helpers shared by `tw-time-picker` and `tw-calendar`'s `withTime`
|
|
673
|
+
* controls. No Angular / CDK imports — safe to drop into either package
|
|
674
|
+
* without pulling a circular dependency.
|
|
675
|
+
*/
|
|
676
|
+
/** Supported time-picker formats. */
|
|
677
|
+
type TimePickerFormat = '12h' | '24h';
|
|
678
|
+
/** Meridiem used by the 12h format. */
|
|
679
|
+
type TimePickerMeridiem = 'AM' | 'PM';
|
|
680
|
+
/** Zero-pads a non-negative integer to exactly two digits. */
|
|
681
|
+
declare function padTwo(value: number): string;
|
|
682
|
+
/** Converts a 24h hour (0–23) to its 12h display value (1–12). */
|
|
683
|
+
declare function to12h(hour24: number): number;
|
|
684
|
+
/** Builds a canonical 0–23 hour from a 12h display hour and meridiem. */
|
|
685
|
+
declare function from12h(hour12: number, meridiem: TimePickerMeridiem): number;
|
|
686
|
+
/** Maximum allowed value for a field given the picker format. */
|
|
687
|
+
declare function fieldMax(field: 'hour' | 'minute' | 'second', format: TimePickerFormat): number;
|
|
688
|
+
/** Minimum allowed value for a field given the picker format. */
|
|
689
|
+
declare function fieldMin(field: 'hour' | 'minute' | 'second', format: TimePickerFormat): number;
|
|
690
|
+
/**
|
|
691
|
+
* Buffers a typed digit onto the current field text, matching the standard
|
|
692
|
+
* two-digit time-field behaviour:
|
|
693
|
+
* - empty + 'x' → 'x'
|
|
694
|
+
* - 'x' + 'y' → 'xy' (if value stays in range)
|
|
695
|
+
* - 'xy' + 'z' → 'z' (overflow → reset)
|
|
696
|
+
* - any combo that would exceed `max` resets to the new digit alone.
|
|
697
|
+
*/
|
|
698
|
+
declare function appendDigit(current: string, digit: string, max: number): string;
|
|
699
|
+
/**
|
|
700
|
+
* Reports whether `current` + `digit` unambiguously fills the field — either
|
|
701
|
+
* because the buffer reaches two chars or because the first digit alone
|
|
702
|
+
* already excludes a valid second digit (e.g., `'6'` for minutes, `'3'` for 24h
|
|
703
|
+
* hour). Used to auto-advance focus to the next field.
|
|
704
|
+
*/
|
|
705
|
+
declare function isTerminalDigit(current: string, digit: string, max: number): boolean;
|
|
706
|
+
/**
|
|
707
|
+
* Steps a numeric value by `step`, wrapping inside `[min, max]`. Works for
|
|
708
|
+
* arbitrary step sizes; a step of 0 behaves as 1 to protect against mis-configs.
|
|
709
|
+
*/
|
|
710
|
+
declare function stepWithWrap(value: number, step: number, direction: 1 | -1, min: number, max: number): number;
|
|
711
|
+
/** Clamps a number into `[min, max]` without wrapping. */
|
|
712
|
+
declare function clamp(value: number, min: number, max: number): number;
|
|
713
|
+
/** Parses a 1- or 2-digit text field; returns `null` if empty or non-numeric. */
|
|
714
|
+
declare function parseField(text: string): number | null;
|
|
715
|
+
/** Total seconds since midnight for a (h, m, s) tuple — useful for min/max compare. */
|
|
716
|
+
declare function timeOfDaySeconds(hour: number, minute: number, second: number): number;
|
|
717
|
+
|
|
718
|
+
export { AriaIdQueue, ENCLOSED_ACTIVE_HORIZONTAL, ENCLOSED_ACTIVE_VERTICAL, INACTIVE_TRIGGER_CLASSES, OVERLAY_ANIMATION_FALLBACK_PADDING, OverlayContainerCoordinator, PICKER_ENTER_DURATION, PICKER_LEAVE_DURATION, PILL_ACTIVE, PickerOverlayCoordinator, TW_ERROR_STATE_MATCHER, TW_SORT_HANDLE, UNDERLINE_ACTIVE_HORIZONTAL, UNDERLINE_ACTIVE_VERTICAL, appendDigit, buildSelectLikePositions, clamp, coerceOverlayDuration, consumeOverlayEscape, defaultErrorStateMatcher, fieldMax, fieldMin, from12h, getActiveTriggerClasses, getInactiveTriggerClasses, isTerminalDigit, mergeOverlayPanelClass, padTwo, parseField, resolveSelectScrollStrategy, stepWithWrap, tabTriggerVariants, timeOfDaySeconds, to12h };
|
|
719
|
+
export type { ErrorStateMatcher, OverlayContainerAnimationEvent, OverlayContainerState, PickerOpenConfig, PickerOpenResult, RangeBehaviorConfig, SelectScrollStrategyName, TabTriggerVariant, TimePickerFormat, TimePickerMeridiem, TwBreakpoint, TwColor, TwFormSubmitted, TwOrientation, TwSize, TwSortHandle };
|