@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,200 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { DateAdapter, TwDateNameStyle } from '@cdevhub/ngx-tw/calendar';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { EnvironmentProviders } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Display-format descriptor used by `LuxonDateAdapter.format()` and
|
|
8
|
+
* `LuxonDateAdapter.parse()`.
|
|
9
|
+
*
|
|
10
|
+
* Two shapes are supported:
|
|
11
|
+
* - `{ format: 'yyyy-LL-dd' }` — a Luxon `toFormat`/`fromFormat` token string.
|
|
12
|
+
* - `{ preset: DateTime.DATE_FULL }` — a Luxon preset (an `Intl.DateTimeFormatOptions` bag).
|
|
13
|
+
*
|
|
14
|
+
* If both are provided, `format` (the explicit token) wins.
|
|
15
|
+
*/
|
|
16
|
+
interface TwLuxonDateFormat {
|
|
17
|
+
/** Luxon token string consumed by `DateTime#toFormat` / `DateTime.fromFormat`. */
|
|
18
|
+
readonly format?: string;
|
|
19
|
+
/** Luxon preset (e.g. `DateTime.DATE_FULL`) consumed by `DateTime#toLocaleString`. */
|
|
20
|
+
readonly preset?: Intl.DateTimeFormatOptions;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Luxon-backed `DateAdapter`. Honors the calendar's `TZ_OVERRIDE` injection
|
|
24
|
+
* token so `today()` resolves against the consumer-configured timezone, and
|
|
25
|
+
* implements the §20.2 TZ-aware virtuals (`getTimezone`, `withTimezone`,
|
|
26
|
+
* `isDST`, `resolveAmbiguous`).
|
|
27
|
+
*
|
|
28
|
+
* `create()` accepts **1-based** months (matching the abstract contract and
|
|
29
|
+
* Luxon's `DateTime.fromObject({ month })` convention), while `getMonth()`
|
|
30
|
+
* returns **0-based** months (also per the abstract contract — see
|
|
31
|
+
* `NativeDateAdapter`).
|
|
32
|
+
*/
|
|
33
|
+
declare class LuxonDateAdapter extends DateAdapter<DateTime> {
|
|
34
|
+
/**
|
|
35
|
+
* Optional per-instance timezone override (§4.3, §7.4). Resolved lazily so
|
|
36
|
+
* the constructor stays SSR-safe — Luxon's default zone reads from the host
|
|
37
|
+
* environment which we want to defer until first use.
|
|
38
|
+
*/
|
|
39
|
+
private readonly _tzOverride;
|
|
40
|
+
/**
|
|
41
|
+
* Locale is resolved lazily on first read so the constructor stays
|
|
42
|
+
* SSR-safe (no `navigator` access at class-construction time — §31.1).
|
|
43
|
+
*/
|
|
44
|
+
private _locale;
|
|
45
|
+
private get locale();
|
|
46
|
+
/**
|
|
47
|
+
* Returns the configured timezone for new dates. Precedence: per-instance
|
|
48
|
+
* `TZ_OVERRIDE` → Luxon's `Settings.defaultZone` → `'local'`.
|
|
49
|
+
*/
|
|
50
|
+
private get zone();
|
|
51
|
+
/** Builds a `DateTime` in the adapter's configured zone + locale. */
|
|
52
|
+
private inZone;
|
|
53
|
+
today(): DateTime;
|
|
54
|
+
/**
|
|
55
|
+
* Constructs a `DateTime`. **`month` is 1-based** — `create(2026, 1, 1)`
|
|
56
|
+
* yields January 1, 2026 at 00:00 in the adapter's configured zone.
|
|
57
|
+
*/
|
|
58
|
+
create(year: number, month: number, day: number): DateTime;
|
|
59
|
+
clone(date: DateTime): DateTime;
|
|
60
|
+
setLocale(locale: string): void;
|
|
61
|
+
getLocale(): string;
|
|
62
|
+
getYear(date: DateTime): number;
|
|
63
|
+
/**
|
|
64
|
+
* Returns the **0-based** month (0 = January, 11 = December) to match the
|
|
65
|
+
* abstract `DateAdapter` contract and the `NativeDateAdapter`. Luxon's
|
|
66
|
+
* `DateTime.month` is 1-based, so we subtract one.
|
|
67
|
+
*/
|
|
68
|
+
getMonth(date: DateTime): number;
|
|
69
|
+
getDate(date: DateTime): number;
|
|
70
|
+
/**
|
|
71
|
+
* Day of week mapped to the Sunday-based scheme used by the abstract
|
|
72
|
+
* contract: `0 = Sunday`, `6 = Saturday`. Luxon's `weekday` is
|
|
73
|
+
* `1 = Monday … 7 = Sunday`, so Sunday gets re-anchored to `0`.
|
|
74
|
+
*/
|
|
75
|
+
getDayOfWeek(date: DateTime): number;
|
|
76
|
+
getNumDaysInMonth(date: DateTime): number;
|
|
77
|
+
getHours(date: DateTime): number;
|
|
78
|
+
getMinutes(date: DateTime): number;
|
|
79
|
+
getSeconds(date: DateTime): number;
|
|
80
|
+
withTime(date: DateTime, hours: number, minutes: number, seconds: number): DateTime;
|
|
81
|
+
/**
|
|
82
|
+
* Locale-aware first day of week (§19.2). Mirrors `NativeDateAdapter` —
|
|
83
|
+
* derives from `Intl.Locale.getWeekInfo()` when available, falling back to
|
|
84
|
+
* Monday (`1`) when the locale is unknown to ICU. ICU/CLDR returns
|
|
85
|
+
* `1=Monday … 7=Sunday`; we normalize to the project's `0=Sunday … 6=Saturday`
|
|
86
|
+
* convention so both adapters report identical values for identical locales.
|
|
87
|
+
*/
|
|
88
|
+
getFirstDayOfWeek(): number;
|
|
89
|
+
getMonthNames(style: TwDateNameStyle): string[];
|
|
90
|
+
/**
|
|
91
|
+
* Day-of-week names starting at Sunday. Luxon's `Info.weekdays` starts at
|
|
92
|
+
* Monday, so the array is rotated to put Sunday first to match the abstract
|
|
93
|
+
* contract (and the native adapter).
|
|
94
|
+
*/
|
|
95
|
+
getDayOfWeekNames(style: TwDateNameStyle): string[];
|
|
96
|
+
getDateNames(_style?: TwDateNameStyle): string[];
|
|
97
|
+
getYearName(date: DateTime): string;
|
|
98
|
+
/**
|
|
99
|
+
* Formats a date for display.
|
|
100
|
+
*
|
|
101
|
+
* Accepts either a Luxon token string (e.g. `'yyyy-LL-dd'`), a
|
|
102
|
+
* {@link TwLuxonDateFormat} descriptor, or a Luxon preset bag
|
|
103
|
+
* (`Intl.DateTimeFormatOptions`). When no format is supplied the
|
|
104
|
+
* adapter falls back to a locale-aware medium date.
|
|
105
|
+
*/
|
|
106
|
+
format(date: DateTime, displayFormat: unknown): string;
|
|
107
|
+
addYears(date: DateTime, years: number): DateTime;
|
|
108
|
+
addMonths(date: DateTime, months: number): DateTime;
|
|
109
|
+
addDays(date: DateTime, days: number): DateTime;
|
|
110
|
+
addHours(date: DateTime, hours: number): DateTime;
|
|
111
|
+
addMinutes(date: DateTime, minutes: number): DateTime;
|
|
112
|
+
compare(first: DateTime, second: DateTime): number;
|
|
113
|
+
sameDate(first: DateTime | null | undefined, second: DateTime | null | undefined): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Start-of-day normalization in the adapter's zone. Luxon's `startOf('day')`
|
|
116
|
+
* is DST-aware — on spring-forward days it returns the wall-clock instant the
|
|
117
|
+
* zone considers the first valid moment of the day.
|
|
118
|
+
*/
|
|
119
|
+
startOfDay(date: DateTime): DateTime;
|
|
120
|
+
isValid(date: DateTime): boolean;
|
|
121
|
+
/** Returns Luxon's invalid sentinel (an invalid `DateTime`). */
|
|
122
|
+
invalid(): DateTime;
|
|
123
|
+
/**
|
|
124
|
+
* Parses a value into a `DateTime`. Accepts:
|
|
125
|
+
* - `DateTime` (cloned),
|
|
126
|
+
* - JS `Date` (re-anchored to the adapter's zone + locale),
|
|
127
|
+
* - number (epoch milliseconds),
|
|
128
|
+
* - string — when `parseFormat` is a Luxon token, uses `fromFormat`;
|
|
129
|
+
* otherwise parses strict ISO 8601 only.
|
|
130
|
+
*
|
|
131
|
+
* The free-form-string path is intentionally narrow: SQL and RFC 2822
|
|
132
|
+
* fallbacks were dropped so the Luxon adapter's acceptance surface matches
|
|
133
|
+
* `NativeDateAdapter.parse()` (which only accepts strings parseable by
|
|
134
|
+
* `new Date(value)`). Callers that need bespoke string formats should pass
|
|
135
|
+
* an explicit `parseFormat` token.
|
|
136
|
+
*
|
|
137
|
+
* Returns `null` on empty input or unrecognised value types, mirroring the
|
|
138
|
+
* native adapter's contract.
|
|
139
|
+
*/
|
|
140
|
+
parse(value: unknown, parseFormat?: unknown): DateTime | null;
|
|
141
|
+
/**
|
|
142
|
+
* Coerce an incoming form value. Returns `null` for empty input, an invalid
|
|
143
|
+
* `DateTime` sentinel for malformed input (so validators can flag it), and a
|
|
144
|
+
* cloned valid `DateTime` otherwise.
|
|
145
|
+
*/
|
|
146
|
+
deserialize(value: unknown): DateTime | null;
|
|
147
|
+
/**
|
|
148
|
+
* ISO 8601 date serialization (`YYYY-MM-DD`). Calendar dates have no
|
|
149
|
+
* time component — `toIso` returns just the date portion.
|
|
150
|
+
*/
|
|
151
|
+
toIso(date: DateTime): string;
|
|
152
|
+
/**
|
|
153
|
+
* Parses an ISO-8601 string to a `DateTime`. Overrides the base
|
|
154
|
+
* implementation to use Luxon's optimised `fromISO` parser.
|
|
155
|
+
*/
|
|
156
|
+
fromIso(iso: string): DateTime | null;
|
|
157
|
+
/** Returns the adapter's configured IANA zone name (e.g. `'America/New_York'`). */
|
|
158
|
+
getTimezone(): string;
|
|
159
|
+
/** Returns a copy of `date` reinterpreted in `tz`. */
|
|
160
|
+
withTimezone(date: DateTime, tz: string): DateTime;
|
|
161
|
+
/** Whether `date` is currently observing daylight-saving time in its zone. */
|
|
162
|
+
isDST(date: DateTime): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Resolves an ambiguous wall-clock time during DST fall-back. On fall-back
|
|
165
|
+
* days a single wall-clock hour repeats — e.g. 2024-11-03 01:30 in
|
|
166
|
+
* `America/New_York` happens once at offset -04:00 (EDT) and again at
|
|
167
|
+
* offset -05:00 (EST). Luxon's `DateTime.fromObject({...}, { zone })` always
|
|
168
|
+
* returns the **earlier** of the two candidates, so we reconstruct the
|
|
169
|
+
* "later" occurrence explicitly: rebuild the candidate at the date's
|
|
170
|
+
* wall-clock fields (anchoring it on the earlier occurrence) and add one
|
|
171
|
+
* hour to land on the same wall-clock's second occurrence in the
|
|
172
|
+
* post-fall-back offset.
|
|
173
|
+
*
|
|
174
|
+
* Non-ambiguous wall-clocks return unchanged for both `prefer` values:
|
|
175
|
+
* after `plus({ hour: 1 })` the wall-clock hour increments (no DST
|
|
176
|
+
* repetition), so the candidate is rejected and we return `date` as-is.
|
|
177
|
+
*/
|
|
178
|
+
resolveAmbiguous(date: DateTime, prefer: 'earlier' | 'later'): DateTime;
|
|
179
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LuxonDateAdapter, never>;
|
|
180
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LuxonDateAdapter>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Provides {@link LuxonDateAdapter} as the calendar's `DateAdapter`.
|
|
185
|
+
*
|
|
186
|
+
* Wire at app or route level so the adapter stays constant for the
|
|
187
|
+
* component's lifetime (§11.7 of the calendar spec):
|
|
188
|
+
*
|
|
189
|
+
* ```ts
|
|
190
|
+
* import { provideLuxonDateAdapter } from '@cdevhub/ngx-tw/calendar/luxon';
|
|
191
|
+
*
|
|
192
|
+
* bootstrapApplication(AppComponent, {
|
|
193
|
+
* providers: [provideLuxonDateAdapter()],
|
|
194
|
+
* });
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
declare function provideLuxonDateAdapter(): EnvironmentProviders;
|
|
198
|
+
|
|
199
|
+
export { LuxonDateAdapter, provideLuxonDateAdapter };
|
|
200
|
+
export type { TwLuxonDateFormat };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ComponentHarness, BaseHarnessFilters, HarnessPredicate } from '@angular/cdk/testing';
|
|
2
|
+
|
|
3
|
+
/** Filters accepted by `CalendarCellHarness.with`. */
|
|
4
|
+
interface CalendarCellHarnessFilters extends BaseHarnessFilters {
|
|
5
|
+
/** Match by the cell's visible display text (`1`, `Apr`, `2026`, etc.). */
|
|
6
|
+
text?: string | RegExp;
|
|
7
|
+
/** Match selected / unselected cells. */
|
|
8
|
+
selected?: boolean;
|
|
9
|
+
/** Match disabled / enabled cells. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Harness for interacting with a single calendar cell in tests. */
|
|
13
|
+
declare class CalendarCellHarness extends ComponentHarness {
|
|
14
|
+
static hostSelector: string;
|
|
15
|
+
private readonly button;
|
|
16
|
+
/** Predicate for `locatorFor` / `locatorForAll`. */
|
|
17
|
+
static with(options?: CalendarCellHarnessFilters): HarnessPredicate<CalendarCellHarness>;
|
|
18
|
+
/** The cell's rendered text, trimmed. */
|
|
19
|
+
getText(): Promise<string>;
|
|
20
|
+
/** The cell's `aria-label`. */
|
|
21
|
+
getAriaLabel(): Promise<string | null>;
|
|
22
|
+
/** Whether the cell carries `aria-selected="true"`. */
|
|
23
|
+
isSelected(): Promise<boolean>;
|
|
24
|
+
/** Whether the cell is disabled — true if the button has `disabled` or carries `aria-disabled="true"`. */
|
|
25
|
+
isDisabled(): Promise<boolean>;
|
|
26
|
+
/** Whether the cell represents today's date (`aria-current="date"`). */
|
|
27
|
+
isToday(): Promise<boolean>;
|
|
28
|
+
/** Click the cell. */
|
|
29
|
+
select(): Promise<void>;
|
|
30
|
+
/** Dispatches `mouseenter` and `mousemove` on the cell to drive range-hover preview. */
|
|
31
|
+
hover(): Promise<void>;
|
|
32
|
+
/** Programmatically focus the cell. */
|
|
33
|
+
focus(): Promise<void>;
|
|
34
|
+
/** Whether the cell's button is the active document element. */
|
|
35
|
+
isFocused(): Promise<boolean>;
|
|
36
|
+
/** Dispatches a `keydown` for `key` on the cell button (e.g. `'ArrowRight'`, `'Enter'`, `' '`, `'PageUp'`). */
|
|
37
|
+
pressKey(key: string, modifiers?: {
|
|
38
|
+
shift?: boolean;
|
|
39
|
+
meta?: boolean;
|
|
40
|
+
ctrl?: boolean;
|
|
41
|
+
alt?: boolean;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The available calendar views, mirrored so consumers don't have to import from the library's main entry point. */
|
|
46
|
+
type CalendarHarnessView = 'day' | 'month' | 'year';
|
|
47
|
+
/** Filters accepted by `CalendarHarness.with`. */
|
|
48
|
+
type CalendarHarnessFilters = BaseHarnessFilters;
|
|
49
|
+
/** Harness for interacting with a `<tw-calendar>` in tests. */
|
|
50
|
+
declare class CalendarHarness extends ComponentHarness {
|
|
51
|
+
static hostSelector: string;
|
|
52
|
+
private readonly headerNavButtons;
|
|
53
|
+
private readonly grid;
|
|
54
|
+
/** Predicate for `locatorFor` / `locatorForAll`. */
|
|
55
|
+
static with(options?: CalendarHarnessFilters): HarnessPredicate<CalendarHarness>;
|
|
56
|
+
/** The header period label (e.g. `"October 2026"`, `"2026"`, `"2024 – 2047"`). */
|
|
57
|
+
getPeriodLabel(): Promise<string>;
|
|
58
|
+
/** Click the previous-page nav button. */
|
|
59
|
+
goToPreviousPage(): Promise<void>;
|
|
60
|
+
/** Click the next-page nav button. */
|
|
61
|
+
goToNextPage(): Promise<void>;
|
|
62
|
+
/** Whether the previous nav button is disabled. */
|
|
63
|
+
isPreviousDisabled(): Promise<boolean>;
|
|
64
|
+
/** Whether the next nav button is disabled. */
|
|
65
|
+
isNextDisabled(): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Click the period label button to move up one view (`day` → `month` → `year`).
|
|
68
|
+
* Accepts an optional `target` to call it multiple times until the current view matches.
|
|
69
|
+
*/
|
|
70
|
+
switchView(target?: CalendarHarnessView): Promise<void>;
|
|
71
|
+
/** Identify the currently rendered view by inspecting which view component is present. */
|
|
72
|
+
getCurrentView(): Promise<CalendarHarnessView>;
|
|
73
|
+
/** All cell harnesses in the currently rendered view. */
|
|
74
|
+
getCells(filters?: CalendarCellHarnessFilters): Promise<CalendarCellHarness[]>;
|
|
75
|
+
/** Click the cell whose text matches exactly. Throws if no match. */
|
|
76
|
+
selectCell(text: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Selects a date range by clicking the cell whose text matches `start`, then
|
|
79
|
+
* the cell whose text matches `end`. Caller is responsible for ensuring the
|
|
80
|
+
* calendar is in `mode: 'range'` and that both cells are visible in the
|
|
81
|
+
* current view.
|
|
82
|
+
*/
|
|
83
|
+
selectRange(start: string, end: string): Promise<void>;
|
|
84
|
+
/** Hovers the cell whose text matches `text` (dispatches `mouseenter` + `mousemove`). Throws if no match. */
|
|
85
|
+
hoverCell(text: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Dispatches a `keydown` for `key` on the currently focused cell — falls back
|
|
88
|
+
* to the calendar grid host when no cell owns focus. Supports `'ArrowLeft'`,
|
|
89
|
+
* `'ArrowRight'`, `'ArrowUp'`, `'ArrowDown'`, `'Home'`, `'End'`, `'PageUp'`,
|
|
90
|
+
* `'PageDown'`, `'Enter'`, and `' '` (Space).
|
|
91
|
+
*/
|
|
92
|
+
pressKey(key: string, modifiers?: {
|
|
93
|
+
shift?: boolean;
|
|
94
|
+
meta?: boolean;
|
|
95
|
+
ctrl?: boolean;
|
|
96
|
+
alt?: boolean;
|
|
97
|
+
}): Promise<void>;
|
|
98
|
+
/** All cells currently rendered with `aria-selected="true"`. */
|
|
99
|
+
getSelectedCells(): Promise<CalendarCellHarness[]>;
|
|
100
|
+
/** The cell representing today, or `null` if not visible in the current view. */
|
|
101
|
+
getTodayCell(): Promise<CalendarCellHarness | null>;
|
|
102
|
+
/** All disabled cells in the current view. */
|
|
103
|
+
getDisabledCells(): Promise<CalendarCellHarness[]>;
|
|
104
|
+
/** Whether the calendar host carries `aria-disabled="true"`. */
|
|
105
|
+
isDisabled(): Promise<boolean>;
|
|
106
|
+
/** @internal Returns the header buttons in [prev, period, next] order. */
|
|
107
|
+
private orderedHeaderButtons;
|
|
108
|
+
/** @internal Resolves the first cell whose text matches `text`. Throws if no match. */
|
|
109
|
+
private findCellByText;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { CalendarCellHarness, CalendarHarness };
|
|
113
|
+
export type { CalendarCellHarnessFilters, CalendarHarnessFilters, CalendarHarnessView };
|