forty-cdk 0.0.1
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 +343 -0
- package/fesm2022/forty-cdk-internationalized-date.mjs +232 -0
- package/fesm2022/forty-cdk-internationalized-date.mjs.map +1 -0
- package/fesm2022/forty-cdk.mjs +28469 -0
- package/fesm2022/forty-cdk.mjs.map +1 -0
- package/internationalized-date/README.md +23 -0
- package/package.json +65 -0
- package/types/forty-cdk-internationalized-date.d.ts +139 -0
- package/types/forty-cdk.d.ts +12895 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# forty-cdk/internationalized-date
|
|
2
|
+
|
|
3
|
+
Secondary entry point holding the [`@internationalized/date`](https://react-spectrum.adobe.com/internationalized/date/) implementations of the `DateAdapter` contract:
|
|
4
|
+
|
|
5
|
+
- `InternationalizedDateAdapter` / `provideInternationalizedDateAdapter()` — day-granular `CalendarDate`.
|
|
6
|
+
- `InternationalizedDateTimeAdapter` / `provideInternationalizedDateTimeAdapter()` — time-capable `CalendarDateTime`.
|
|
7
|
+
|
|
8
|
+
It exists so the main `forty-cdk` bundle never references `@internationalized/date`: the package is an **optional peer dependency**, required only by consumers who import this entry point. The date/time primitives themselves (`Calendar`, `DateField`, `DatePicker`, `TimeField`) depend only on the abstract `DateAdapter` from the main entry point — `provideNativeDateAdapter()` works with zero extra installs.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @internationalized/date
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
16
|
+
import { provideInternationalizedDateAdapter } from 'forty-cdk/internationalized-date';
|
|
17
|
+
|
|
18
|
+
bootstrapApplication(App, {
|
|
19
|
+
providers: [provideInternationalizedDateAdapter()],
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
See the [Calendar README](../src/lib/calendar/README.md) for the full adapter table and usage examples.
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "forty-cdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Headless / styleless UI primitives for Angular with WAI-ARIA accessibility built in.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"headless",
|
|
8
|
+
"unstyled",
|
|
9
|
+
"ui",
|
|
10
|
+
"components",
|
|
11
|
+
"primitives",
|
|
12
|
+
"accessibility",
|
|
13
|
+
"a11y",
|
|
14
|
+
"wai-aria",
|
|
15
|
+
"aria",
|
|
16
|
+
"signals",
|
|
17
|
+
"zoneless"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/tutkli/forty-cdk#readme",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/tutkli/forty-cdk/issues"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/tutkli/forty-cdk.git",
|
|
26
|
+
"directory": "projects/forty-cdk"
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"author": "tutkli (https://github.com/tutkli)",
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@angular/common": "^22.0.0",
|
|
32
|
+
"@angular/core": "^22.0.0",
|
|
33
|
+
"@angular/forms": "^22.0.0",
|
|
34
|
+
"@internationalized/date": "^3.0.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"@angular/forms": {
|
|
38
|
+
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"@internationalized/date": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@floating-ui/dom": "^1.6.0",
|
|
46
|
+
"tslib": "^2.3.0"
|
|
47
|
+
},
|
|
48
|
+
"sideEffects": false,
|
|
49
|
+
"module": "fesm2022/forty-cdk.mjs",
|
|
50
|
+
"typings": "types/forty-cdk.d.ts",
|
|
51
|
+
"exports": {
|
|
52
|
+
"./package.json": {
|
|
53
|
+
"default": "./package.json"
|
|
54
|
+
},
|
|
55
|
+
".": {
|
|
56
|
+
"types": "./types/forty-cdk.d.ts",
|
|
57
|
+
"default": "./fesm2022/forty-cdk.mjs"
|
|
58
|
+
},
|
|
59
|
+
"./internationalized-date": {
|
|
60
|
+
"types": "./types/forty-cdk-internationalized-date.d.ts",
|
|
61
|
+
"default": "./fesm2022/forty-cdk-internationalized-date.mjs"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"type": "module"
|
|
65
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
|
+
import { CalendarDate, CalendarDateTime } from '@internationalized/date';
|
|
4
|
+
import { DateAdapter } from 'forty-cdk';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* {@link DateAdapter} over `@internationalized/date`'s immutable `CalendarDate`.
|
|
8
|
+
* This is the recommended adapter: it is the same date primitive React Aria and
|
|
9
|
+
* Ark UI build on, it works in every browser today with no polyfill, and its
|
|
10
|
+
* reference-equality-on-mutation makes it signal-friendly.
|
|
11
|
+
*
|
|
12
|
+
* **Gregorian only.** `createDate` always builds a Gregorian `CalendarDate`, so
|
|
13
|
+
* the calendar grid is Gregorian regardless of the runtime locale. True
|
|
14
|
+
* non-Gregorian calendar systems are deferred to the planned Temporal adapter
|
|
15
|
+
* track (#354).
|
|
16
|
+
*
|
|
17
|
+
* Ships in the `forty-cdk/internationalized-date` secondary entry point so the
|
|
18
|
+
* main `forty-cdk` bundle never references `@internationalized/date` — the
|
|
19
|
+
* package is an **optional peer dependency**, required only by consumers who
|
|
20
|
+
* import this entry point. A consumer relying solely on
|
|
21
|
+
* `provideNativeDateAdapter()` never resolves it at all.
|
|
22
|
+
*/
|
|
23
|
+
declare class InternationalizedDateAdapter implements DateAdapter<CalendarDate> {
|
|
24
|
+
/**
|
|
25
|
+
* Today as a `CalendarDate` in the runtime time zone (`getLocalTimeZone()`).
|
|
26
|
+
* Subject to the SSR/hydration caveat on {@link DateAdapter.today}.
|
|
27
|
+
*/
|
|
28
|
+
today(): CalendarDate;
|
|
29
|
+
createDate(year: number, month: number, day: number): CalendarDate;
|
|
30
|
+
getYear(date: CalendarDate): number;
|
|
31
|
+
getMonth(date: CalendarDate): number;
|
|
32
|
+
getDate(date: CalendarDate): number;
|
|
33
|
+
getDayOfWeek(date: CalendarDate): number;
|
|
34
|
+
getDaysInMonth(date: CalendarDate): number;
|
|
35
|
+
getFirstDayOfWeek(): number;
|
|
36
|
+
addDays(date: CalendarDate, n: number): CalendarDate;
|
|
37
|
+
addMonths(date: CalendarDate, n: number): CalendarDate;
|
|
38
|
+
addYears(date: CalendarDate, n: number): CalendarDate;
|
|
39
|
+
compare(a: CalendarDate, b: CalendarDate): number;
|
|
40
|
+
isSameDay(a: CalendarDate, b: CalendarDate): boolean;
|
|
41
|
+
isValid(date: CalendarDate): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Formats through the runtime's default locale and time zone. Subject to the
|
|
44
|
+
* SSR/hydration caveat on {@link DateAdapter.format}.
|
|
45
|
+
*/
|
|
46
|
+
format(date: CalendarDate, options: Intl.DateTimeFormatOptions): string;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InternationalizedDateAdapter, never>;
|
|
48
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InternationalizedDateAdapter>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Provides the {@link InternationalizedDateAdapter} as the active
|
|
52
|
+
* {@link DateAdapter}, making `ForCalendar` operate on `CalendarDate` values
|
|
53
|
+
* from `@internationalized/date`.
|
|
54
|
+
*
|
|
55
|
+
* Requires `@internationalized/date` to be installed (optional peer
|
|
56
|
+
* dependency).
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* bootstrapApplication(App, {
|
|
61
|
+
* providers: [provideInternationalizedDateAdapter()],
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare function provideInternationalizedDateAdapter(): Provider[];
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Time-capable {@link DateAdapter} over `@internationalized/date`'s immutable
|
|
69
|
+
* `CalendarDateTime`. It mirrors {@link InternationalizedDateAdapter} for all
|
|
70
|
+
* day operations but adds a wall-clock time component (hour / minute / second),
|
|
71
|
+
* so it backs `ForTimeField` and the time granularity of the date primitives.
|
|
72
|
+
* Use it when you want the `@internationalized/date` types *and* a time.
|
|
73
|
+
*
|
|
74
|
+
* **Gregorian only.** Like {@link InternationalizedDateAdapter}, `createDate`
|
|
75
|
+
* builds a Gregorian `CalendarDateTime`; non-Gregorian calendar systems are
|
|
76
|
+
* deferred to the planned Temporal adapter track (#354).
|
|
77
|
+
*
|
|
78
|
+
* Ships in the `forty-cdk/internationalized-date` secondary entry point so the
|
|
79
|
+
* main `forty-cdk` bundle never references `@internationalized/date` — the
|
|
80
|
+
* package is an **optional peer dependency**, required only by consumers who
|
|
81
|
+
* import this entry point. A consumer relying solely on
|
|
82
|
+
* `provideNativeDateAdapter()` never resolves it at all.
|
|
83
|
+
*
|
|
84
|
+
* `compare` orders by the full date-time (day *and* time); `compareDate`
|
|
85
|
+
* ignores the time and orders by calendar day, so the calendar grid stays
|
|
86
|
+
* day-granular even when `min`/`max` carry a time.
|
|
87
|
+
*/
|
|
88
|
+
declare class InternationalizedDateTimeAdapter implements DateAdapter<CalendarDateTime> {
|
|
89
|
+
/**
|
|
90
|
+
* Today as a `CalendarDateTime` in the runtime time zone
|
|
91
|
+
* (`getLocalTimeZone()`). Subject to the SSR/hydration caveat on
|
|
92
|
+
* {@link DateAdapter.today}.
|
|
93
|
+
*/
|
|
94
|
+
today(): CalendarDateTime;
|
|
95
|
+
createDate(year: number, month: number, day: number): CalendarDateTime;
|
|
96
|
+
getYear(date: CalendarDateTime): number;
|
|
97
|
+
getMonth(date: CalendarDateTime): number;
|
|
98
|
+
getDate(date: CalendarDateTime): number;
|
|
99
|
+
getDayOfWeek(date: CalendarDateTime): number;
|
|
100
|
+
getDaysInMonth(date: CalendarDateTime): number;
|
|
101
|
+
getFirstDayOfWeek(): number;
|
|
102
|
+
addDays(date: CalendarDateTime, n: number): CalendarDateTime;
|
|
103
|
+
addMonths(date: CalendarDateTime, n: number): CalendarDateTime;
|
|
104
|
+
addYears(date: CalendarDateTime, n: number): CalendarDateTime;
|
|
105
|
+
compare(a: CalendarDateTime, b: CalendarDateTime): number;
|
|
106
|
+
compareDate(a: CalendarDateTime, b: CalendarDateTime): number;
|
|
107
|
+
isSameDay(a: CalendarDateTime, b: CalendarDateTime): boolean;
|
|
108
|
+
isValid(date: CalendarDateTime): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Formats through the runtime's default locale and time zone. Subject to the
|
|
111
|
+
* SSR/hydration caveat on {@link DateAdapter.format}.
|
|
112
|
+
*/
|
|
113
|
+
format(date: CalendarDateTime, options: Intl.DateTimeFormatOptions): string;
|
|
114
|
+
supportsTime(): boolean;
|
|
115
|
+
getHours(date: CalendarDateTime): number;
|
|
116
|
+
getMinutes(date: CalendarDateTime): number;
|
|
117
|
+
getSeconds(date: CalendarDateTime): number;
|
|
118
|
+
setTime(date: CalendarDateTime, hours: number, minutes: number, seconds: number): CalendarDateTime;
|
|
119
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<InternationalizedDateTimeAdapter, never>;
|
|
120
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<InternationalizedDateTimeAdapter>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Provides the {@link InternationalizedDateTimeAdapter} as the active
|
|
124
|
+
* {@link DateAdapter}, making the time / date-time primitives operate on
|
|
125
|
+
* `CalendarDateTime` values from `@internationalized/date`.
|
|
126
|
+
*
|
|
127
|
+
* Requires `@internationalized/date` to be installed (optional peer
|
|
128
|
+
* dependency).
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* bootstrapApplication(App, {
|
|
133
|
+
* providers: [provideInternationalizedDateTimeAdapter()],
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
declare function provideInternationalizedDateTimeAdapter(): Provider[];
|
|
138
|
+
|
|
139
|
+
export { InternationalizedDateAdapter, InternationalizedDateTimeAdapter, provideInternationalizedDateAdapter, provideInternationalizedDateTimeAdapter };
|