forty-cdk 0.42.0 → 0.44.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/calendar/README.md +10 -6
- package/carousel/README.md +7 -6
- package/checkbox/README.md +8 -8
- package/combobox/README.md +10 -2
- package/date-field/README.md +1 -0
- package/dialog/README.md +4 -3
- package/drag-drop/README.md +13 -8
- package/drawer/README.md +42 -40
- package/fesm2022/forty-cdk-calendar.mjs +55 -24
- package/fesm2022/forty-cdk-calendar.mjs.map +1 -1
- package/fesm2022/forty-cdk-carousel.mjs +3 -4
- package/fesm2022/forty-cdk-carousel.mjs.map +1 -1
- package/fesm2022/forty-cdk-combobox.mjs +11 -1
- package/fesm2022/forty-cdk-combobox.mjs.map +1 -1
- package/fesm2022/forty-cdk-core-anchored.mjs +0 -11
- package/fesm2022/forty-cdk-core-anchored.mjs.map +1 -1
- package/fesm2022/forty-cdk-core-overlay.mjs +18 -1
- package/fesm2022/forty-cdk-core-overlay.mjs.map +1 -1
- package/fesm2022/forty-cdk-core.mjs +318 -69
- package/fesm2022/forty-cdk-core.mjs.map +1 -1
- package/fesm2022/forty-cdk-date-field.mjs +7 -2
- package/fesm2022/forty-cdk-date-field.mjs.map +1 -1
- package/fesm2022/forty-cdk-defaults.mjs +3 -1
- package/fesm2022/forty-cdk-defaults.mjs.map +1 -1
- package/fesm2022/forty-cdk-dialog.mjs +4 -1
- package/fesm2022/forty-cdk-dialog.mjs.map +1 -1
- package/fesm2022/forty-cdk-drag-drop.mjs +7 -22
- package/fesm2022/forty-cdk-drag-drop.mjs.map +1 -1
- package/fesm2022/forty-cdk-drawer.mjs +62 -14
- package/fesm2022/forty-cdk-drawer.mjs.map +1 -1
- package/fesm2022/forty-cdk-listbox.mjs +2 -3
- package/fesm2022/forty-cdk-listbox.mjs.map +1 -1
- package/fesm2022/forty-cdk-meter.mjs +9 -6
- package/fesm2022/forty-cdk-meter.mjs.map +1 -1
- package/fesm2022/forty-cdk-navigation-menu.mjs.map +1 -1
- package/fesm2022/forty-cdk-number-input.mjs +1 -1
- package/fesm2022/forty-cdk-number-input.mjs.map +1 -1
- package/fesm2022/forty-cdk-otp-input.mjs +5 -2
- package/fesm2022/forty-cdk-otp-input.mjs.map +1 -1
- package/fesm2022/forty-cdk-progress.mjs +1 -1
- package/fesm2022/forty-cdk-progress.mjs.map +1 -1
- package/fesm2022/forty-cdk-radio-group.mjs +21 -1
- package/fesm2022/forty-cdk-radio-group.mjs.map +1 -1
- package/fesm2022/forty-cdk-scroll-area.mjs +48 -25
- package/fesm2022/forty-cdk-scroll-area.mjs.map +1 -1
- package/fesm2022/forty-cdk-slider.mjs +7 -2
- package/fesm2022/forty-cdk-slider.mjs.map +1 -1
- package/fesm2022/forty-cdk-stepper.mjs +59 -27
- package/fesm2022/forty-cdk-stepper.mjs.map +1 -1
- package/fesm2022/forty-cdk-table-virtualization.mjs +76 -7
- package/fesm2022/forty-cdk-table-virtualization.mjs.map +1 -1
- package/fesm2022/forty-cdk-table.mjs +53 -25
- package/fesm2022/forty-cdk-table.mjs.map +1 -1
- package/fesm2022/forty-cdk-time-field.mjs +7 -2
- package/fesm2022/forty-cdk-time-field.mjs.map +1 -1
- package/fesm2022/forty-cdk-time-picker.mjs +39 -17
- package/fesm2022/forty-cdk-time-picker.mjs.map +1 -1
- package/fesm2022/forty-cdk-toast.mjs +12 -6
- package/fesm2022/forty-cdk-toast.mjs.map +1 -1
- package/fesm2022/forty-cdk-toggle.mjs +21 -1
- package/fesm2022/forty-cdk-toggle.mjs.map +1 -1
- package/fesm2022/forty-cdk-tree.mjs +74 -31
- package/fesm2022/forty-cdk-tree.mjs.map +1 -1
- package/fesm2022/forty-cdk-virtual-reorder.mjs +14 -2
- package/fesm2022/forty-cdk-virtual-reorder.mjs.map +1 -1
- package/fesm2022/forty-cdk-virtualization.mjs +45 -5
- package/fesm2022/forty-cdk-virtualization.mjs.map +1 -1
- package/field/README.md +1 -1
- package/input/README.md +26 -26
- package/listbox/README.md +16 -16
- package/meter/README.md +11 -11
- package/number-input/README.md +4 -4
- package/otp-input/README.md +6 -6
- package/package.json +1 -1
- package/progress/README.md +2 -2
- package/radio-group/README.md +12 -11
- package/scroll-area/README.md +8 -3
- package/select/README.md +1 -1
- package/slider/README.md +2 -0
- package/stepper/README.md +9 -6
- package/switch/README.md +11 -11
- package/table/README.md +33 -33
- package/time-field/README.md +1 -0
- package/time-picker/README.md +30 -30
- package/toast/README.md +28 -10
- package/toggle/README.md +31 -30
- package/tree/README.md +11 -6
- package/types/forty-cdk-calendar.d.ts +23 -11
- package/types/forty-cdk-combobox.d.ts +9 -1
- package/types/forty-cdk-core-overlay.d.ts +3 -1
- package/types/forty-cdk-core.d.ts +159 -10
- package/types/forty-cdk-date-field.d.ts +1 -0
- package/types/forty-cdk-defaults.d.ts +12 -0
- package/types/forty-cdk-dialog.d.ts +21 -3
- package/types/forty-cdk-drawer.d.ts +39 -17
- package/types/forty-cdk-meter.d.ts +12 -7
- package/types/forty-cdk-navigation-menu.d.ts +4 -3
- package/types/forty-cdk-otp-input.d.ts +4 -1
- package/types/forty-cdk-progress.d.ts +3 -1
- package/types/forty-cdk-radio-group.d.ts +14 -1
- package/types/forty-cdk-scroll-area.d.ts +14 -7
- package/types/forty-cdk-slider.d.ts +11 -2
- package/types/forty-cdk-stepper.d.ts +24 -19
- package/types/forty-cdk-table.d.ts +10 -7
- package/types/forty-cdk-time-field.d.ts +1 -0
- package/types/forty-cdk-time-picker.d.ts +2 -1
- package/types/forty-cdk-toast.d.ts +9 -2
- package/types/forty-cdk-toggle.d.ts +14 -1
- package/types/forty-cdk-tree.d.ts +18 -8
- package/types/forty-cdk-virtual-reorder.d.ts +2 -1
- package/types/forty-cdk-virtualization.d.ts +9 -5
- package/virtual-reorder/README.md +1 -1
- package/virtualization/README.md +4 -2
package/calendar/README.md
CHANGED
|
@@ -290,7 +290,9 @@ Set `selectionMode="range"` and bind `[(range)]` to get date-range selection. In
|
|
|
290
290
|
}
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
-
**`aria-selected`** in range mode is `"true"` across every committed-range cell (inclusive), and the grid carries `aria-multiselectable="true"`. While a new anchor is pending, `aria-selected
|
|
293
|
+
**`aria-selected`** in range mode is `"true"` across every committed-range cell (inclusive), and the grid carries `aria-multiselectable="true"`. While a new anchor is pending, the committed cells keep `aria-selected="true"`, matching `range`, which holds the previously committed range until the second click replaces it, and the anchor cell is selected too. The preview band is never selected; it is exposed only through `data-range-preview`.
|
|
294
|
+
|
|
295
|
+
**Announcements.** Setting the anchor and committing a range are each announced politely, with the dates formatted as day, month and year in the calendar's `locale`: `"Start date June 20, 2026. Choose the end date."` and `"Selected June 20, 2026 to June 24, 2026."`. A click the length limits reject announces nothing. Both strings are localizable through `provideForCalendarDefaults` (see [Scoped defaults](#scoped-defaults)).
|
|
294
296
|
|
|
295
297
|
**Scope.** Range mode is day-granular only: `granularity` / time is orthogonal and not supported alongside it.
|
|
296
298
|
|
|
@@ -403,7 +405,7 @@ The lower-level hooks (`visibleMonthNumber()`, `visibleYear()`, `monthOptions()`
|
|
|
403
405
|
|
|
404
406
|
`ForCalendar` supports two additional views (**month grid** and **year grid**) so users can jump quickly to a different month or year without paging one at a time. All three views share a single `[(view)]` model and the same `focusedDate` cursor.
|
|
405
407
|
|
|
406
|
-
The heading's `label()` follows the active view, with the same text as the view trigger: the month and year in day view, the year in month view, the block of years in year view. Every grid is named by the heading, so each one is named after the period it shows. A keyboard move or a prev / next press that changes that period announces it. Drilling down changes no value, so a `readonly` calendar still drills from a year to its months and from a month to its days.
|
|
408
|
+
The heading's `label()` follows the active view, with the same text as the view trigger: the month and year in day view, the year in month view, the block of years in year view. Every grid is named by the heading, so each one is named after the period it shows. A keyboard move or a prev / next press that changes that period announces it. Drilling down changes no value, so a `readonly` calendar still drills from a year to its months and from a month to its days. The view trigger and a drill-down move DOM focus to the active cell of the new grid; a consumer write to `[(view)]` switches the grid and leaves focus where it is.
|
|
407
409
|
|
|
408
410
|
### Pieces
|
|
409
411
|
|
|
@@ -417,10 +419,10 @@ The heading's `label()` follows the active view, with the same text as the view
|
|
|
417
419
|
|
|
418
420
|
### `view` model — `ForCalendar`
|
|
419
421
|
|
|
420
|
-
| API | Type | Description
|
|
421
|
-
| --------------- | ---------------------------------------------------- |
|
|
422
|
-
| `view` | `model<CalendarView>` (`'day' \| 'month' \| 'year'`) | Active view. Default `'day'`. `[(view)]` for two-way binding or read `cal.view()`. |
|
|
423
|
-
| `yearBlockSize` | `input<number>` | Years per year-grid page (must be a multiple of 3). Default `12`.
|
|
422
|
+
| API | Type | Description |
|
|
423
|
+
| --------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
424
|
+
| `view` | `model<CalendarView>` (`'day' \| 'month' \| 'year'`) | Active view. Default `'day'`. `[(view)]` for two-way binding or read `cal.view()`. A consumer write leaves DOM focus where it is. |
|
|
425
|
+
| `yearBlockSize` | `input<number>` | Years per year-grid page (must be a multiple of 3). Default `12`. |
|
|
424
426
|
|
|
425
427
|
### Usage
|
|
426
428
|
|
|
@@ -562,6 +564,8 @@ providers: [
|
|
|
562
564
|
|
|
563
565
|
`outsideMonthLabel` builds the `aria-label` of a padding day outside the visible month from its formatted full date (default `"<date> (outside month)"`), so assistive tech can tell it apart from the month on screen. A calendar bound to its own `[dateLabel]` formatter ignores it.
|
|
564
566
|
|
|
567
|
+
`rangeStartAnnouncement` and `rangeSelectedAnnouncement` build the polite announcements a range calendar makes when it sets its anchor and when it commits a range, from the dates already formatted as day, month and year (defaults `"Start date <start>. Choose the end date."` and `"Selected <start> to <end>."`).
|
|
568
|
+
|
|
565
569
|
## Keyboard
|
|
566
570
|
|
|
567
571
|
LTR (horizontal arrows mirror under `dir="rtl"`):
|
package/carousel/README.md
CHANGED
|
@@ -182,7 +182,7 @@ export class CarouselDefaultExample {
|
|
|
182
182
|
|
|
183
183
|
### Multiple slides per view
|
|
184
184
|
|
|
185
|
-
Set `slidesPerView` above `1` to show several slides at once. Each slide is `flex: 0 0 calc(100% / var(--for-carousel-slides-per-view))
|
|
185
|
+
Set `slidesPerView` above `1` to show several slides at once. Each slide is `flex: 0 0 calc(100% / var(--for-carousel-slides-per-view))`. Navigation still moves one slide at a time, with one indicator per slide, so the views past the last full set would show empty space. This example sets `containScroll`, which holds the track once the last full set is in view; under `loop` the clamp is off and the carousel wraps only after the last slide, so pair `slidesPerView` with `containScroll` rather than `loop` when every view has to be full. See [Contain scroll](#contain-scroll).
|
|
186
186
|
|
|
187
187
|
### Autoplay with pause control
|
|
188
188
|
|
|
@@ -346,9 +346,9 @@ so compose it **without** the `-1` factor the consumer may apply to
|
|
|
346
346
|
|
|
347
347
|
### Reduced motion
|
|
348
348
|
|
|
349
|
-
Under `prefers-reduced-motion: reduce` the
|
|
350
|
-
`--for-carousel-swipe-movement-x` / `-y`
|
|
351
|
-
|
|
349
|
+
Under `prefers-reduced-motion: reduce` the gesture stays and the motion goes, as on every swipe
|
|
350
|
+
surface in the library: the directive does **not** publish `--for-carousel-swipe-movement-x` / `-y`
|
|
351
|
+
(no live track motion), and the gesture still snaps `activeIndex` on release.
|
|
352
352
|
|
|
353
353
|
### Cross-axis / touch
|
|
354
354
|
|
|
@@ -454,8 +454,9 @@ viewport's trailing edge:
|
|
|
454
454
|
|
|
455
455
|
Every slide still has its own indicator; trailing indicators that would map to the
|
|
456
456
|
same clamped view simply share the same visual position. The clamp has no effect
|
|
457
|
-
when `
|
|
458
|
-
`
|
|
457
|
+
when `slidesPerView` is `1` (a single-view carousel never overscrolls) or when
|
|
458
|
+
`loop` is enabled: a looping carousel with `slidesPerView > 1` overscrolls into
|
|
459
|
+
the same empty space and wraps only after the last slide.
|
|
459
460
|
|
|
460
461
|
### `ForCarouselDrag` inputs
|
|
461
462
|
|
package/checkbox/README.md
CHANGED
|
@@ -159,14 +159,14 @@ export class DemoCheckout {
|
|
|
159
159
|
|
|
160
160
|
### `ForCheckbox`
|
|
161
161
|
|
|
162
|
-
| Property | Type
|
|
163
|
-
| ------------------------------------------------------------ |
|
|
164
|
-
| `checked` | `model<boolean>`
|
|
165
|
-
| `indeterminate` | `model<boolean>`
|
|
166
|
-
| `disabled` / `readonly` / `required` / `invalid` / `pending` | `input<boolean>`
|
|
167
|
-
| `name` | `input<string>`
|
|
168
|
-
| `errors` | `input<readonly
|
|
169
|
-
| `touched` | `model<boolean>`
|
|
162
|
+
| Property | Type | Description |
|
|
163
|
+
| ------------------------------------------------------------ | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
164
|
+
| `checked` | `model<boolean>` | Two-way bindable on/off. Required by `FormCheckboxControl`.<br>**Default:** `false` |
|
|
165
|
+
| `indeterminate` | `model<boolean>` | Two-way bindable. When true, `aria-checked="mixed"` regardless of `checked`. Click clears it. UI-only and not part of the form value.<br>**Default:** `false` |
|
|
166
|
+
| `disabled` / `readonly` / `required` / `invalid` / `pending` | `input<boolean>` | Reflected as the matching `aria-*` / `data-*` attributes. A disabled checkbox stays focusable (per APG), with `aria-disabled="true"` + `data-disabled` and no native `disabled`; click is a no-op.<br>**Default:** `false` |
|
|
167
|
+
| `name` | `input<string>` | Reflected on `name` (empty string omits the attribute). A native reset of the owning `<form>` restores `checked` and `indeterminate` to their first-render values. A bound `[required]` blocks native submission while unchecked, as a native required control does: an unnamed, visually hidden `<input required>` fails constraint validation, `form:invalid` matches, and when the browser reports the form, focus moves to the checkbox.<br>**Default:** `''` |
|
|
168
|
+
| `errors` | `input<readonly FieldValidationError[]>` | Validation errors fed by `[formField]`.<br>**Default:** `[]` |
|
|
169
|
+
| `touched` | `model<boolean>` | Set to `true` on activation and on blur.<br>**Default:** `false` |
|
|
170
170
|
|
|
171
171
|
| Data attribute | Values |
|
|
172
172
|
| --------------- | ------------------------------------------- |
|
package/combobox/README.md
CHANGED
|
@@ -338,7 +338,10 @@ Add two parts:
|
|
|
338
338
|
|
|
339
339
|
```html
|
|
340
340
|
<div forCombobox #combobox="forCombobox" [(value)]="value" [(query)]="query" [(open)]="open">
|
|
341
|
-
<
|
|
341
|
+
<span id="country-label">Country</span>
|
|
342
|
+
<button forComboboxTrigger aria-labelledby="country-label country-value">
|
|
343
|
+
<span id="country-value">{{ selectedLabel() }}</span>
|
|
344
|
+
</button>
|
|
342
345
|
@if (combobox.open()) {
|
|
343
346
|
<div forComboboxContent>
|
|
344
347
|
<input forComboboxInput placeholder="Search…" />
|
|
@@ -378,7 +381,10 @@ Why the list part is required, not optional: a `role="listbox"` may only own `op
|
|
|
378
381
|
</div>
|
|
379
382
|
|
|
380
383
|
<ng-template #trig let-root="root">
|
|
381
|
-
<
|
|
384
|
+
<span id="country-label">Country</span>
|
|
385
|
+
<button [forComboboxTrigger]="root" aria-labelledby="country-label country-value">
|
|
386
|
+
<span id="country-value">{{ selectedLabel() }}</span>
|
|
387
|
+
</button>
|
|
382
388
|
</ng-template>
|
|
383
389
|
```
|
|
384
390
|
|
|
@@ -846,6 +852,8 @@ Static and `@for`-rendered options share the same registry, navigation order (DO
|
|
|
846
852
|
</div>
|
|
847
853
|
```
|
|
848
854
|
|
|
855
|
+
A Signal Forms reset (`form().reset()` or `form.country().reset(value)`) rewrites `query` too, so the input never keeps text the reset value does not hold. In the editable single-select anatomy with `commitOnSelect`, the input shows the label of the selection the reset leaves, and it is empty when that selection is. In multi mode, in the picker anatomy and without `commitOnSelect`, the reset empties it.
|
|
856
|
+
|
|
849
857
|
For a legacy `<form action="…">` flow, set `[name]`, and the directive mirrors `[(value)]` into N `<input type="hidden">` siblings (one per array entry; zero when empty). String values land verbatim in the hidden input; object values default to `JSON.stringify` (override via `[itemToFormValue]`, see below). A native reset of the owning `<form>` returns `value` and `query` to what they held when the combobox first rendered, and the input shows that query again. With `[required]` bound, an empty combobox blocks native submission the way a native `<select required>` does: the directive mounts one unnamed, visually hidden `<input required tabindex="-1" aria-hidden="true">` beside the hidden inputs, so the browser's constraint validation fails and `form:invalid` matches. When the browser reports the form, focus moves to the input, or to the trigger in the picker anatomy. That input submits nothing, is skipped while the combobox is disabled, and is satisfied once a value is selected, whatever the query holds.
|
|
850
858
|
|
|
851
859
|
A single-select field is modeled as the same `readonly T[]`, kept at length ≤ 1, and bound with `[formField]` directly, so single mode needs no adapter. A `FieldTree<T | null>` cannot bind here; map to that shape at the edge that needs it. See [the selection value-type contract](../../../docs/selection-value-type-contract.md).
|
package/date-field/README.md
CHANGED
|
@@ -345,6 +345,7 @@ Composes the [WAI-ARIA Spinbutton pattern](https://www.w3.org/WAI/ARIA/apg/patte
|
|
|
345
345
|
- **Literals are `aria-hidden`** and never focusable, so assistive tech reads only the spinbutton segments.
|
|
346
346
|
- **Boolean `data-*`** on each segment, present when true and absent when false: `data-highlighted` (the roving tab stop, kept after blur), `data-placeholder` (empty), `data-disabled`, `data-readonly`.
|
|
347
347
|
- **`aria-readonly` belongs on the segments, not the group.** WAI-ARIA supports it on `role="spinbutton"` but not on `role="group"`, so each segment carries `aria-readonly="true"` while the group reflects the `data-readonly` styling hook only.
|
|
348
|
+
- **`aria-busy="true"` on the group while `pending`**, beside the `data-pending` hook, so an async validator in flight is announced as it is on the other form controls. A picker in the field anatomy passes its own `pending` to the field it adopts, so the composite carries it once, on the group.
|
|
348
349
|
- **On-screen keyboards work.** A segment of a field that is neither disabled nor read-only is a `contenteditable="plaintext-only"` editing host with `inputmode="numeric"`, so tapping it on a touch device opens the numeric keypad (the AM/PM segment opens the text keyboard). What the keyboard or an input method types goes through the [Keyboard](#keyboard) map above and is never inserted into the segment, which keeps rendering `{{ seg.text }}`.
|
|
349
350
|
|
|
350
351
|
## Styling
|
package/dialog/README.md
CHANGED
|
@@ -225,8 +225,8 @@ import {
|
|
|
225
225
|
FOR_DIALOG_CONTRACT,
|
|
226
226
|
type ForDialogContract,
|
|
227
227
|
ForDialogManager,
|
|
228
|
-
ForDialogRef,
|
|
229
228
|
injectDialogData,
|
|
229
|
+
injectDialogRef,
|
|
230
230
|
} from 'forty-cdk/dialog';
|
|
231
231
|
|
|
232
232
|
interface ConfirmData {
|
|
@@ -245,7 +245,7 @@ type ConfirmResult = 'confirm' | 'cancel';
|
|
|
245
245
|
class ConfirmDialog {
|
|
246
246
|
declare readonly [FOR_DIALOG_CONTRACT]: ForDialogContract<ConfirmData, ConfirmResult>;
|
|
247
247
|
readonly data = injectDialogData<ConfirmDialog>();
|
|
248
|
-
readonly ref =
|
|
248
|
+
readonly ref = injectDialogRef<ConfirmDialog>();
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
@Component({
|
|
@@ -265,7 +265,7 @@ export class DemoHost {
|
|
|
265
265
|
}
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
-
**Typing the payload and the result.** The `[FOR_DIALOG_CONTRACT]` member states, once, the data a dialog component reads and the result it closes with. Declare it with `declare` and no initializer, and keep it public. `open()` then infers both from the component: a `data` of any other shape fails to compile, and the returned ref is a `ForDialogRef<ConfirmResult>`. `injectDialogData<ConfirmDialog>()` reads the payload at the type the contract names, so the component and every caller share one definition. A component without the member keeps an unchecked `data` and an `unknown` result, and `injectDialogData<T>()` with a plain type still types the payload as `T`. Explicit type arguments (`open<ConfirmDialog, ConfirmResult>`) override what the contract supplies.
|
|
268
|
+
**Typing the payload and the result.** The `[FOR_DIALOG_CONTRACT]` member states, once, the data a dialog component reads and the result it closes with. Declare it with `declare` and no initializer, and keep it public. `open()` then infers both from the component: a `data` of any other shape fails to compile, and the returned ref is a `ForDialogRef<ConfirmResult>`. `injectDialogData<ConfirmDialog>()` reads the payload at the type the contract names, and `injectDialogRef<ConfirmDialog>()` hands the component its own ref typed with the declared result, so `ref.close(42)` fails to compile and the component and every caller share one definition. A `[forDialogClose]` button's `[closeWith]` is not checked against the contract, so close through that ref wherever the result type matters. A component without the member keeps an unchecked `data` and an `unknown` result, and `injectDialogData<T>()` with a plain type still types the payload as `T`. Explicit type arguments (`open<ConfirmDialog, ConfirmResult>`) override what the contract supplies.
|
|
269
269
|
|
|
270
270
|
`injectDialogData()` returns `null` too: the manager provides `null` when `open()` is called without `data`, so guard (`data?.message`) before dereferencing the payload.
|
|
271
271
|
|
|
@@ -332,6 +332,7 @@ class ScopedHost {
|
|
|
332
332
|
| `ForDialogManager` | Injectable. `open(component, config?)` returns a `ForDialogRef<R>`. `closeAll(result?)` closes every open dialog, topmost first, with reason `'programmatic'`; exit animations still play and focus ends where the bottom dialog returns it. `openCount` is a `Signal<number>` of the dialogs still open, counting a closed one until its exit animation finishes. |
|
|
333
333
|
| `ForDialogRef<R>` | `close(result?)`, `closed: Promise<{ reason: ForDialogCloseReason; result: R \| undefined }>`, `result: Signal<R \| undefined>`, `isClosed: Signal<boolean>`. |
|
|
334
334
|
| `FOR_DIALOG_DATA` | Token for the `data` payload. Inject in the opened component. |
|
|
335
|
+
| `injectDialogRef<T>()` | Typed accessor for the opened component's own `ForDialogRef`: `ForDialogRef<R>` for the result `R` the contract names when `T` is a component declaring `FOR_DIALOG_CONTRACT`, else `ForDialogRef<T>`. |
|
|
335
336
|
| `injectDialogData<T>()` | Typed accessor for `FOR_DIALOG_DATA`. Returns `T \| null` (`null` when `open()` got no `data`), or the data type the contract names when `T` is a component declaring `FOR_DIALOG_CONTRACT`. |
|
|
336
337
|
| `FOR_DIALOG_CONTRACT` | Key of the member a dialog component declares as `ForDialogContract<D, R>` so `open()` checks `data` against `D` and returns a `ForDialogRef<R>`. `ForDialogDataOf<C>` / `ForDialogResultOf<C>` read the two types off a component. |
|
|
337
338
|
|
package/drag-drop/README.md
CHANGED
|
@@ -489,10 +489,12 @@ always provided by the consumer via CSS; the library imposes none.
|
|
|
489
489
|
}
|
|
490
490
|
```
|
|
491
491
|
|
|
492
|
-
With no such CSS, `animateReorder` is a graceful no-op:
|
|
493
|
-
preview is destroyed promptly. Otherwise
|
|
494
|
-
|
|
495
|
-
`
|
|
492
|
+
With no such CSS, `animateReorder` is a graceful no-op: `data-drag-animating` clears instantly
|
|
493
|
+
and the preview is destroyed promptly. Otherwise a displaced item keeps `data-drag-animating`, and
|
|
494
|
+
the preview stays mounted, until its own `transform` transition ends, and never before that
|
|
495
|
+
transition's `transition-delay` plus duration have elapsed, wherever `transform` sits in a
|
|
496
|
+
multi-property `transition` list. A transition of another property, or one running on a
|
|
497
|
+
descendant, ends neither.
|
|
496
498
|
|
|
497
499
|
## Orientation
|
|
498
500
|
|
|
@@ -649,10 +651,13 @@ onReorder({ from, to }: ForVirtualReorderEvent): void {
|
|
|
649
651
|
```
|
|
650
652
|
|
|
651
653
|
A custom integration that cannot use either companion must supply the same three
|
|
652
|
-
mechanisms itself: map window-relative to absolute indices
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
mechanisms itself: map window-relative to absolute indices, keep the lifted row
|
|
655
|
+
mounted for the duration of the drag, and step the keyboard target over the true
|
|
656
|
+
total count. The mapping reads the absolute index of every rendered row, in DOM
|
|
657
|
+
order. `previousIndex` is the lifted row's position in that list. `currentIndex`
|
|
658
|
+
is a position in the same list with the lifted row taken out: the target is the
|
|
659
|
+
absolute index found there (one past the last entry when the row lands at the
|
|
660
|
+
end), minus one when it is greater than the lifted row's own. Miss any one of the three and the failure is silent: an index that
|
|
656
661
|
addresses the wrong row, a lifted row recycled mid-drag, or a keyboard move that
|
|
657
662
|
stops at the window edge.
|
|
658
663
|
|
package/drawer/README.md
CHANGED
|
@@ -98,11 +98,11 @@ import {
|
|
|
98
98
|
ForDrawerDescription,
|
|
99
99
|
ForDrawerHandle,
|
|
100
100
|
ForDrawerManager,
|
|
101
|
-
ForDrawerRef,
|
|
102
101
|
ForDrawerTitle,
|
|
103
102
|
FOR_DRAWER_CONTRACT,
|
|
104
103
|
type ForDrawerContract,
|
|
105
104
|
injectDrawerData,
|
|
105
|
+
injectDrawerRef,
|
|
106
106
|
} from 'forty-cdk/drawer';
|
|
107
107
|
|
|
108
108
|
interface ConfirmData {
|
|
@@ -129,14 +129,14 @@ type ConfirmResult = 'confirm' | 'cancel';
|
|
|
129
129
|
<div forDrawerHandle aria-hidden="true"></div>
|
|
130
130
|
<h2 forDrawerTitle>Delete account?</h2>
|
|
131
131
|
<p forDrawerDescription>{{ data?.message }}</p>
|
|
132
|
-
<button forDrawerClose
|
|
133
|
-
<button
|
|
132
|
+
<button forDrawerClose>Cancel</button>
|
|
133
|
+
<button type="button" (click)="ref.close('confirm')">Confirm</button>
|
|
134
134
|
`,
|
|
135
135
|
})
|
|
136
136
|
class ConfirmDrawer {
|
|
137
137
|
declare readonly [FOR_DRAWER_CONTRACT]: ForDrawerContract<ConfirmData, ConfirmResult>;
|
|
138
138
|
readonly data = injectDrawerData<ConfirmDrawer>();
|
|
139
|
-
readonly ref =
|
|
139
|
+
readonly ref = injectDrawerRef<ConfirmDrawer>();
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
@Component({
|
|
@@ -160,7 +160,7 @@ class DemoHost {
|
|
|
160
160
|
}
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
The `[FOR_DRAWER_CONTRACT]` member states, once, the data a drawer component reads and the result it closes with: `open()` infers both from the component, so a `data` of any other shape fails to compile and the ref is a `ForDrawerRef<ConfirmResult>`, and `injectDrawerData<ConfirmDrawer>()` reads the payload at that type. Declare
|
|
163
|
+
The `[FOR_DRAWER_CONTRACT]` member states, once, the data a drawer component reads and the result it closes with: `open()` infers both from the component, so a `data` of any other shape fails to compile and the ref is a `ForDrawerRef<ConfirmResult>`, and `injectDrawerData<ConfirmDrawer>()` reads the payload at that type. Declare the member with `declare`, no initializer, and keep it public. `injectDrawerRef<ConfirmDrawer>()` hands the component its own ref typed with the declared result, so `ref.close(42)` fails to compile; a `[forDrawerClose]` button's `[closeWith]` is not checked against the contract, so close through that ref wherever the result type matters. Without the member `data` is unchecked, the result is `unknown`, and `injectDrawerData<T>()` with a plain type still types the payload as `T`; explicit type arguments override the contract. `injectDrawerData()` returns `null` too, because the manager provides `null` when `open()` is called without `data`, so guard (`data?.message`) before dereferencing the payload. `await ref.closed` resolves `{ reason, result }`, whose `reason` (a `ForDrawerCloseReason`) tells apart an imperative `close()` (`'programmatic'`) from Escape / backdrop / outside / swipe / close-button dismissals.
|
|
164
164
|
|
|
165
165
|
Drawers opened by the manager share the LIFO dismissible layer with declarative ones, so Escape closes the topmost drawer first whichever API opened it. Nesting is resolved from where a drawer is declared, not from the order drawers open in: a declarative `[forDrawer]` inside a programmatic drawer's component is its child (`data-depth="1"`, and the programmatic parent reflects `data-state-nested`), but a drawer the manager opens over a declarative one is a root, so it reflects `data-depth="0"` and its declarative neighbour gets no `data-state-nested`.
|
|
166
166
|
|
|
@@ -368,34 +368,34 @@ Press the button: the manager opens the confirmation as a bottom drawer, and the
|
|
|
368
368
|
|
|
369
369
|
### `ForDrawer`
|
|
370
370
|
|
|
371
|
-
| Property | Type | Description
|
|
372
|
-
| --------------------------- | ------------------------------------------------------------------- |
|
|
373
|
-
| `side` | `'top' \| 'right' \| 'bottom' \| 'left'` | Anchored edge. Drives swipe direction and `data-side`.<br>**Default:** `'bottom'`
|
|
374
|
-
| `modal` | `boolean` | `aria-modal`, scroll lock, focus trap, inert siblings, return focus on close. Read once at mount: a change while the drawer is open takes effect on the next open.<br>**Default:** `true`
|
|
375
|
-
| `dismissible` | `boolean` | Whether Escape / backdrop / outside / swipe close. When `false`, no swipe dismisses; `snapPoints` still drag between snaps.<br>**Default:** `true`
|
|
376
|
-
| `alert` | `boolean` | `role="alertdialog"`.<br>**Default:** `false`
|
|
377
|
-
| `returnFocus` | `boolean` | Modal mode only: restore focus on close. A non-modal drawer never moves focus on close.<br>**Default:** `true`
|
|
378
|
-
| `initialFocus` | `'first' \| 'container'` | **Default:** `'first'`
|
|
379
|
-
| `ariaLabel` | `string \| null` | Use when no visible title is rendered.<br>**Default:** `null`
|
|
380
|
-
| `autoFocusOnOpen` | `(e: VetoableEvent) => void` \| `undefined` | `event.preventDefault()` skips the imperative focus move.<br>**Default:** —
|
|
381
|
-
| `autoFocusOnClose` | `(e: VetoableEvent) => void` \| `undefined` | Fires on every close path regardless of mode. In non-modal mode the directive doesn't move focus, so the veto is informational; in modal mode `event.preventDefault()` skips return-focus.<br>**Default:** —
|
|
382
|
-
| `swipeToDismiss` | `boolean` | Whether a swipe toward the anchored edge dismisses. When `false`, `snapPoints` still drag between snaps and stop at the lowest one
|
|
383
|
-
| `closeThreshold` | `number` | Fraction past which a release dismisses, measured against the full dimension without `snapPoints` and against the lowest snap's extent with them.<br>**Default:** `0.25`
|
|
384
|
-
| `handleOnly` | `boolean` | Swipe arms only on the registered `[forDrawerHandle]`.<br>**Default:** `false`
|
|
385
|
-
| `snapPoints` | `ReadonlyArray<ForDrawerSnapPoint>` | `number ∈ [0,1]` \| `'NN%'` \| `'NNpx'`. Strictly increasing.<br>**Default:** —
|
|
386
|
-
| `activeSnapPoint` | `ModelSignal<ForDrawerSnapPoint \| null>` | Two-way bindable. Initialised to `snapPoints[0]` on mount when null.<br>**Default:** `null`
|
|
387
|
-
| `fadeFromIndex` | `number` | Backdrop reflects `data-fade-from-active` once active >= this index.<br>**Default:** —
|
|
388
|
-
| `scaleBackground` | `boolean` | Asks `[forDrawerWrapper]` to scale + translate behind the drawer.<br>**Default:** `false`
|
|
389
|
-
| `setBackgroundColorOnScale` | `boolean` | Paints `<body>` to mask the gap between scaled wrapper and viewport edge.<br>**Default:** `true`
|
|
390
|
-
| `dismiss` | `OutputEmitterRef<ForDrawerCloseReason>` | Output. Wire to `(dismiss)="open.set(false)"`.<br>**Default:** —
|
|
391
|
-
| `escapeKeyDown` | `OutputEmitterRef<VetoableNativeEvent<KeyboardEvent>>` | Output. `preventDefault()` suppresses auto-close.<br>**Default:** —
|
|
392
|
-
| `pointerDownOutside` | `OutputEmitterRef<VetoableNativeEvent<PointerEvent>>` | Output. `preventDefault()` suppresses auto-close.<br>**Default:** —
|
|
393
|
-
| `focusOutside` | `OutputEmitterRef<VetoableNativeEvent<FocusEvent>>` | Output. `preventDefault()` suppresses auto-close.<br>**Default:** —
|
|
394
|
-
| `interactOutside` | `OutputEmitterRef<VetoableNativeEvent<PointerEvent \| FocusEvent>>` | Output. Composite, vetoed by either specific event.<br>**Default:** —
|
|
395
|
-
| `swipeStart` | `OutputEmitterRef<ForDrawerSwipeEvent>` | Output. Fires once on the arming pointer move; `progress` is `0`.<br>**Default:** —
|
|
396
|
-
| `swipeMove` | `OutputEmitterRef<ForDrawerSwipeEvent>` | Output. Streams `progress` ∈ [0,1] and the originating `PointerEvent`.<br>**Default:** —
|
|
397
|
-
| `swipeEnd` | `OutputEmitterRef<ForDrawerSwipeEndEvent>` | Output. `willClose`, `nextSnapPoint`. Fires once `activeSnapPoint` holds `nextSnapPoint`, and before `(dismiss)` on a dismissing release.<br>**Default:** —
|
|
398
|
-
| `swipeCancel` | `OutputEmitterRef<ForDrawerSwipeEvent>` | Output. `pointercancel` or mid-gesture direction abort; the surface springs back.<br>**Default:** —
|
|
371
|
+
| Property | Type | Description |
|
|
372
|
+
| --------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
373
|
+
| `side` | `'top' \| 'right' \| 'bottom' \| 'left'` | Anchored edge. Drives swipe direction and `data-side`.<br>**Default:** `'bottom'` |
|
|
374
|
+
| `modal` | `boolean` | `aria-modal`, scroll lock, focus trap, inert siblings, return focus on close. Read once at mount: a change while the drawer is open takes effect on the next open.<br>**Default:** `true` |
|
|
375
|
+
| `dismissible` | `boolean` | Whether Escape / backdrop / outside / swipe close. When `false`, no swipe dismisses; `snapPoints` still drag between snaps.<br>**Default:** `true` |
|
|
376
|
+
| `alert` | `boolean` | `role="alertdialog"`.<br>**Default:** `false` |
|
|
377
|
+
| `returnFocus` | `boolean` | Modal mode only: restore focus on close. A non-modal drawer never moves focus on close.<br>**Default:** `true` |
|
|
378
|
+
| `initialFocus` | `'first' \| 'container'` | **Default:** `'first'` |
|
|
379
|
+
| `ariaLabel` | `string \| null` | Use when no visible title is rendered.<br>**Default:** `null` |
|
|
380
|
+
| `autoFocusOnOpen` | `(e: VetoableEvent) => void` \| `undefined` | `event.preventDefault()` skips the imperative focus move.<br>**Default:** — |
|
|
381
|
+
| `autoFocusOnClose` | `(e: VetoableEvent) => void` \| `undefined` | Fires on every close path regardless of mode. In non-modal mode the directive doesn't move focus, so the veto is informational; in modal mode `event.preventDefault()` skips return-focus.<br>**Default:** — |
|
|
382
|
+
| `swipeToDismiss` | `boolean` | Whether a swipe toward the anchored edge dismisses. When `false`, `snapPoints` still drag between snaps and stop at the lowest one.<br>**Default:** `true` |
|
|
383
|
+
| `closeThreshold` | `number` | Fraction past which a release dismisses, measured against the full dimension without `snapPoints` and against the lowest snap's extent with them.<br>**Default:** `0.25` |
|
|
384
|
+
| `handleOnly` | `boolean` | Swipe arms only on the registered `[forDrawerHandle]`.<br>**Default:** `false` |
|
|
385
|
+
| `snapPoints` | `ReadonlyArray<ForDrawerSnapPoint>` | `number ∈ [0,1]` \| `'NN%'` \| `'NNpx'`. Strictly increasing.<br>**Default:** — |
|
|
386
|
+
| `activeSnapPoint` | `ModelSignal<ForDrawerSnapPoint \| null>` | Two-way bindable. Initialised to `snapPoints[0]` on mount when null.<br>**Default:** `null` |
|
|
387
|
+
| `fadeFromIndex` | `number` | Backdrop reflects `data-fade-from-active` once active >= this index.<br>**Default:** — |
|
|
388
|
+
| `scaleBackground` | `boolean` | Asks `[forDrawerWrapper]` to scale + translate behind the drawer.<br>**Default:** `false` |
|
|
389
|
+
| `setBackgroundColorOnScale` | `boolean` | Paints `<body>` to mask the gap between scaled wrapper and viewport edge.<br>**Default:** `true` |
|
|
390
|
+
| `dismiss` | `OutputEmitterRef<ForDrawerCloseReason>` | Output. Wire to `(dismiss)="open.set(false)"`.<br>**Default:** — |
|
|
391
|
+
| `escapeKeyDown` | `OutputEmitterRef<VetoableNativeEvent<KeyboardEvent>>` | Output. `preventDefault()` suppresses auto-close.<br>**Default:** — |
|
|
392
|
+
| `pointerDownOutside` | `OutputEmitterRef<VetoableNativeEvent<PointerEvent>>` | Output. `preventDefault()` suppresses auto-close.<br>**Default:** — |
|
|
393
|
+
| `focusOutside` | `OutputEmitterRef<VetoableNativeEvent<FocusEvent>>` | Output. `preventDefault()` suppresses auto-close.<br>**Default:** — |
|
|
394
|
+
| `interactOutside` | `OutputEmitterRef<VetoableNativeEvent<PointerEvent \| FocusEvent>>` | Output. Composite, vetoed by either specific event.<br>**Default:** — |
|
|
395
|
+
| `swipeStart` | `OutputEmitterRef<ForDrawerSwipeEvent>` | Output. Fires once on the arming pointer move; `progress` is `0`.<br>**Default:** — |
|
|
396
|
+
| `swipeMove` | `OutputEmitterRef<ForDrawerSwipeEvent>` | Output. Streams `progress` ∈ [0,1] and the originating `PointerEvent`.<br>**Default:** — |
|
|
397
|
+
| `swipeEnd` | `OutputEmitterRef<ForDrawerSwipeEndEvent>` | Output. `willClose`, `nextSnapPoint`. Fires once `activeSnapPoint` holds `nextSnapPoint`, and before `(dismiss)` on a dismissing release.<br>**Default:** — |
|
|
398
|
+
| `swipeCancel` | `OutputEmitterRef<ForDrawerSwipeEvent>` | Output. `pointercancel` or mid-gesture direction abort; the surface springs back.<br>**Default:** — |
|
|
399
399
|
|
|
400
400
|
`ForDrawerCloseReason`: `'escape' | 'backdrop' | 'pointerDownOutside' | 'focusOutside' | 'closeButton' | 'swipe' | 'programmatic'`.
|
|
401
401
|
|
|
@@ -534,7 +534,7 @@ For a seamless release, transition **both** `translate` and your snap-position p
|
|
|
534
534
|
- On touch the browser would otherwise claim the swipe as a scroll. While the drawer can arm the drag, the handle carries `touch-action: none`, and while the whole surface arms it (`handleOnly` off) the surface carries an inline `touch-action` that leaves the browser only the other axis: `pan-x` for a `top` / `bottom` drawer, `pan-y` for `left` / `right`. A scroller inside the surface keeps its own native scrolling, so your CSS needs no `touch-action` rule of its own.
|
|
535
535
|
- A surface that is itself the scroll container (`[forDrawer] { max-height: 85vh; overflow-y: auto }`) keeps touch scrolling on that axis while its content overflows it: the surface leaves that axis to the browser, so a touch drag on the content scrolls it instead of dragging the drawer. Add a `[forDrawerHandle]` to keep a touch swipe available; a mouse drag still swipes once the content is scrolled to its edge.
|
|
536
536
|
- Gestures whose press lands inside a scrollable element that hasn't reached its edge, the surface itself included, are NOT treated as swipes (the helper defers to the scroll). The edge is read in the scroller's own writing direction, with a 1 px tolerance for fractional scroll offsets.
|
|
537
|
-
- **`prefers-reduced-motion: reduce`**
|
|
537
|
+
- **`prefers-reduced-motion: reduce`** keeps the gesture and drops the motion, as every swipe surface in the library does: the drag still arms, fires `(swipeStart)` / `(swipeMove)` / `(swipeEnd)` / `(swipeCancel)` and resolves to a snap point or a dismiss on release, but `--for-drawer-swipe-movement-x` / `-y` stay at `0px` and the swipe progress (the backdrop's `--for-drawer-swipe-progress` and each event's `progress`) stays at `0`, so the surface does not follow the finger and moves to the committed snap on release.
|
|
538
538
|
|
|
539
539
|
## Scale background
|
|
540
540
|
|
|
@@ -567,6 +567,8 @@ Opt in to the "viewport recedes behind the drawer" effect: when the drawer opens
|
|
|
567
567
|
|
|
568
568
|
While the effect is active the wrapper reflects `data-state="scaled"` (and `"idle"` at rest); the drawer reflects `data-scale-background` so consumers can style the surface differently when scale is in play (e.g. larger corner radii).
|
|
569
569
|
|
|
570
|
+
The wrapper scales in and back out over the same 0.5 s transition, which the directive writes inline on it while the effect runs. On close the wrapper animates back to full size while the drawer plays its leave animation, and your own inline `transition`, `transform-origin` and `overflow` on the wrapper, and the body colour, are restored once that transition ends.
|
|
571
|
+
|
|
570
572
|
`setBackgroundColorOnScale` (default `true`) paints `<body>` with `scaleBackgroundColor` while the effect is active. Disable it (`[setBackgroundColorOnScale]="false"`) when the application shell already covers the viewport edge: a themed `<html>` / `<body>` background, a fixed root layer, or a full-bleed CSS-framework wrapper. In those flows the body-color mutation is redundant and would briefly overwrite a theme-managed value on every open / close; leaving it off keeps the consumer's own paint authoritative, the rounded gap behind the scaled wrapper composes with whatever colour they ship. The flag has no effect under `prefers-reduced-motion: reduce` (the whole effect is suppressed).
|
|
571
573
|
|
|
572
574
|
`prefers-reduced-motion: reduce` suppresses the effect entirely. Wrapper styles, body color, and `data-scale-background` are all bypassed without affecting the rest of the drawer's behaviour.
|
|
@@ -778,12 +780,12 @@ forty-cdk ships no styles: put your own class on each piece and key your CSS off
|
|
|
778
780
|
|
|
779
781
|
### CSS custom properties
|
|
780
782
|
|
|
781
|
-
| Property | Meaning
|
|
782
|
-
| ------------------------------- |
|
|
783
|
-
| `--for-drawer-swipe-movement-x` | Written on `[forDrawer]` (the surface). Live swipe displacement in CSS px along the x axis (`0px` at rest
|
|
784
|
-
| `--for-drawer-swipe-movement-y` | Written on `[forDrawer]` (the surface). Live swipe displacement in CSS px along the y axis (`0px` at rest
|
|
785
|
-
| `--for-drawer-swipe-progress` | Written on `[forDrawerBackdrop]`. Swipe progress toward the anchored edge, a unitless fraction `0` (at rest) → `1` (fully swiped off-screen, from any snap). Fade with `opacity: calc(1 - var(--for-drawer-swipe-progress, 0))`. See [Backdrop swipe-fade](#backdrop-swipe-fade-css-contract).
|
|
786
|
-
| `--for-drawer-depth` | Written on `[forDrawer]` and `[forDrawerBackdrop]`. The drawer's nesting depth as a unitless integer, `0` for a root drawer, mirroring `data-depth`. Stack a nested drawer's backdrop above its parent with `z-index: calc(1009 + var(--for-drawer-depth) * 10)`.
|
|
783
|
+
| Property | Meaning |
|
|
784
|
+
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
785
|
+
| `--for-drawer-swipe-movement-x` | Written on `[forDrawer]` (the surface). Live swipe displacement in CSS px along the x axis (`0px` at rest and under `prefers-reduced-motion: reduce`; only the dismissal axis is ever non-zero). Compose with `translate: var(--for-drawer-swipe-movement-x, 0px) var(--for-drawer-swipe-movement-y, 0px)`. See [Positioning the snaps](#positioning-the-snaps-css-contract). |
|
|
786
|
+
| `--for-drawer-swipe-movement-y` | Written on `[forDrawer]` (the surface). Live swipe displacement in CSS px along the y axis (`0px` at rest and under `prefers-reduced-motion: reduce`; only the dismissal axis is ever non-zero). Compose with `translate: var(--for-drawer-swipe-movement-x, 0px) var(--for-drawer-swipe-movement-y, 0px)`. See [Positioning the snaps](#positioning-the-snaps-css-contract). |
|
|
787
|
+
| `--for-drawer-swipe-progress` | Written on `[forDrawerBackdrop]`. Swipe progress toward the anchored edge, a unitless fraction `0` (at rest, and throughout under `prefers-reduced-motion: reduce`) → `1` (fully swiped off-screen, from any snap). Fade with `opacity: calc(1 - var(--for-drawer-swipe-progress, 0))`. See [Backdrop swipe-fade](#backdrop-swipe-fade-css-contract). |
|
|
788
|
+
| `--for-drawer-depth` | Written on `[forDrawer]` and `[forDrawerBackdrop]`. The drawer's nesting depth as a unitless integer, `0` for a root drawer, mirroring `data-depth`. Stack a nested drawer's backdrop above its parent with `z-index: calc(1009 + var(--for-drawer-depth) * 10)`. |
|
|
787
789
|
|
|
788
790
|
```css
|
|
789
791
|
.sheet[data-active-snap-point] {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { DestroyRef, Directive, ElementRef, InjectionToken, Injector, afterNextRender, booleanAttribute, computed,
|
|
2
|
+
import { DestroyRef, Directive, ElementRef, InjectionToken, Injector, afterNextRender, booleanAttribute, computed, inject, input, linkedSignal, model, numberAttribute, signal } from "@angular/core";
|
|
3
3
|
import { Collection, FOR_PICKER_SOURCE_HOST, IdGenerator, LiveAnnouncer, adoptHostId, assertInputBound, assertRootContext, clampToBounds, compareDateOf, formatLocaleDigits, hostAriaLabel, hostButtonType, hostLabelledBy, injectDateAdapter, injectReflectedDirection, injectTextDirection, isHistoryChord, isUnset, orphanContextError, registerHandle, unsetInput } from "forty-cdk/core";
|
|
4
4
|
import { FOR_CALENDAR_DEFAULTS, FOR_CALENDAR_DEFAULTS as FOR_CALENDAR_DEFAULTS$1, provideForCalendarDefaults } from "forty-cdk/defaults";
|
|
5
5
|
import { NativeDateAdapter, provideNativeDateAdapter } from "forty-cdk/date-adapter";
|
|
@@ -348,7 +348,7 @@ var CalendarNavigation = class {
|
|
|
348
348
|
this.#select(date);
|
|
349
349
|
}
|
|
350
350
|
activateDate(date) {
|
|
351
|
-
if (this.#host.disabled() || this.#select(date)) return;
|
|
351
|
+
if (this.#host.disabled() || this.#select(date) || !this.#host.bounds.contains(date)) return;
|
|
352
352
|
this.#cursor.setFocusedDay(date);
|
|
353
353
|
this.#setFocusedDate(date);
|
|
354
354
|
this.#host.focusDayCell(date);
|
|
@@ -393,10 +393,12 @@ var CalendarNavigation = class {
|
|
|
393
393
|
#select(date) {
|
|
394
394
|
if (this.#host.disabled() || this.#host.readonly() || this.#host.bounds.isUnavailable(date)) return false;
|
|
395
395
|
if (this.#host.selectionMode() === "range") {
|
|
396
|
-
|
|
396
|
+
const step = this.#host.range.select(date);
|
|
397
|
+
if (step === null) return false;
|
|
397
398
|
this.#cursor.setFocusedDay(date);
|
|
398
399
|
this.#setFocusedDate(date);
|
|
399
400
|
this.#host.focusDayCell(date);
|
|
401
|
+
this.#host.announceRangeStep(step);
|
|
400
402
|
return true;
|
|
401
403
|
}
|
|
402
404
|
this.#cursor.setFocusedDay(date);
|
|
@@ -470,8 +472,10 @@ var CalendarRangeSelection = class {
|
|
|
470
472
|
return er !== null && er.preview && this.#withinInclusive(date, er);
|
|
471
473
|
}
|
|
472
474
|
contains(date) {
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
+
const anchor = this.#anchor();
|
|
476
|
+
if (anchor !== null && this.#host.adapter.isSameDay(date, anchor)) return true;
|
|
477
|
+
const committed = this.#host.range();
|
|
478
|
+
return committed !== null && this.#withinInclusive(date, committed);
|
|
475
479
|
}
|
|
476
480
|
setHovered(date) {
|
|
477
481
|
if (!this.#host.active()) return;
|
|
@@ -485,16 +489,23 @@ var CalendarRangeSelection = class {
|
|
|
485
489
|
const anchor = this.#anchor();
|
|
486
490
|
if (anchor === null) {
|
|
487
491
|
this.#anchor.set(date);
|
|
488
|
-
return
|
|
492
|
+
return {
|
|
493
|
+
kind: "anchored",
|
|
494
|
+
anchor: date
|
|
495
|
+
};
|
|
489
496
|
}
|
|
490
497
|
const [start, end] = compareDateOf(adapter, date, anchor) < 0 ? [date, anchor] : [anchor, date];
|
|
491
|
-
if (!this.#rangeLengthSatisfied(start, end)) return
|
|
492
|
-
|
|
498
|
+
if (!this.#rangeLengthSatisfied(start, end)) return null;
|
|
499
|
+
const range = {
|
|
493
500
|
start,
|
|
494
501
|
end
|
|
495
|
-
}
|
|
502
|
+
};
|
|
503
|
+
this.#host.range.set(range);
|
|
496
504
|
this.#anchor.set(null);
|
|
497
|
-
return
|
|
505
|
+
return {
|
|
506
|
+
kind: "committed",
|
|
507
|
+
range
|
|
508
|
+
};
|
|
498
509
|
}
|
|
499
510
|
#rangeLengthSatisfied(start, end) {
|
|
500
511
|
const adapter = this.#host.adapter;
|
|
@@ -701,6 +712,7 @@ var ForCalendar = class ForCalendar {
|
|
|
701
712
|
bounds: this.#bounds,
|
|
702
713
|
range: this.#range,
|
|
703
714
|
announce: (label) => this.#announcer.announce(label, "polite"),
|
|
715
|
+
announceRangeStep: (step) => this.#announceRangeStep(step),
|
|
704
716
|
scheduleFocus: (fn) => this.#scheduleFocus(fn),
|
|
705
717
|
focusDayCell: (target) => this.#focusDayCell(target)
|
|
706
718
|
}, this.#seedDate());
|
|
@@ -761,20 +773,14 @@ var ForCalendar = class ForCalendar {
|
|
|
761
773
|
scheduleFocus: (fn) => this.#scheduleFocus(fn)
|
|
762
774
|
};
|
|
763
775
|
}
|
|
764
|
-
#viewSwitched = false;
|
|
765
|
-
#viewFocusEffect = effect(() => {
|
|
766
|
-
const view = this.view();
|
|
767
|
-
if (!this.#viewSwitched) {
|
|
768
|
-
this.#viewSwitched = true;
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
afterNextRender(() => this.#strategyFor(view).focusActive(), { injector: this.#injector });
|
|
772
|
-
}, ...ngDevMode ? [{ debugName: "#viewFocusEffect" }] : /* istanbul ignore next */ []);
|
|
773
776
|
#resolvedFirstDayOfWeek = computed(() => this.firstDayOfWeek() ?? this.adapter.getFirstDayOfWeek(), ...ngDevMode ? [{ debugName: "#resolvedFirstDayOfWeek" }] : /* istanbul ignore next */ []);
|
|
774
777
|
visibleMonth = computed(() => {
|
|
775
778
|
const focused = this.focusedDate();
|
|
776
779
|
return this.adapter.createDate(this.adapter.getYear(focused), this.adapter.getMonth(focused), 1);
|
|
777
|
-
},
|
|
780
|
+
}, {
|
|
781
|
+
...ngDevMode ? { debugName: "visibleMonth" } : /* istanbul ignore next */ {},
|
|
782
|
+
equal: (a, b) => this.adapter.isSameDay(a, b)
|
|
783
|
+
});
|
|
778
784
|
#headingId = signal(this.#idGen.next("for-calendar-heading"), ...ngDevMode ? [{ debugName: "#headingId" }] : /* istanbul ignore next */ []);
|
|
779
785
|
headingId = this.#headingId.asReadonly();
|
|
780
786
|
#headingCount = signal(0, ...ngDevMode ? [{ debugName: "#headingCount" }] : /* istanbul ignore next */ []);
|
|
@@ -855,8 +861,17 @@ var ForCalendar = class ForCalendar {
|
|
|
855
861
|
setHovered(date) {
|
|
856
862
|
this.#range.setHovered(date);
|
|
857
863
|
}
|
|
864
|
+
#today = computed(() => {
|
|
865
|
+
this.focusedDate();
|
|
866
|
+
this.value();
|
|
867
|
+
this.range();
|
|
868
|
+
return this.adapter.today();
|
|
869
|
+
}, {
|
|
870
|
+
...ngDevMode ? { debugName: "#today" } : /* istanbul ignore next */ {},
|
|
871
|
+
equal: (a, b) => this.adapter.isSameDay(a, b)
|
|
872
|
+
});
|
|
858
873
|
isToday(date) {
|
|
859
|
-
return this.adapter.isSameDay(date, this
|
|
874
|
+
return this.adapter.isSameDay(date, this.#today());
|
|
860
875
|
}
|
|
861
876
|
isFocused(date) {
|
|
862
877
|
return this.adapter.isSameDay(date, this.focusedDate());
|
|
@@ -905,17 +920,22 @@ var ForCalendar = class ForCalendar {
|
|
|
905
920
|
"year"
|
|
906
921
|
];
|
|
907
922
|
const next = order[order.indexOf(this.view()) + 1];
|
|
908
|
-
if (next) this
|
|
923
|
+
if (next) this.#switchView(next);
|
|
909
924
|
}
|
|
910
925
|
selectMonth(month) {
|
|
911
926
|
if (this.disabled() || this.isMonthDisabled(month)) return;
|
|
912
927
|
this.goToMonth(month);
|
|
913
|
-
this
|
|
928
|
+
this.#switchView("day");
|
|
914
929
|
}
|
|
915
930
|
selectYear(year) {
|
|
916
931
|
if (this.disabled() || this.isYearDisabled(year)) return;
|
|
917
932
|
this.goToYear(year);
|
|
918
|
-
this
|
|
933
|
+
this.#switchView("month");
|
|
934
|
+
}
|
|
935
|
+
#switchView(next) {
|
|
936
|
+
if (this.view() === next) return;
|
|
937
|
+
this.view.set(next);
|
|
938
|
+
this.#scheduleFocus(() => this.#strategyFor(next).focusActive());
|
|
919
939
|
}
|
|
920
940
|
pagePrevious() {
|
|
921
941
|
this.#page(-1);
|
|
@@ -962,6 +982,17 @@ var ForCalendar = class ForCalendar {
|
|
|
962
982
|
#focusDayCell(target) {
|
|
963
983
|
afterNextRender(() => this.#dayNav.focusCell(target), { injector: this.#injector });
|
|
964
984
|
}
|
|
985
|
+
#announceRangeStep(step) {
|
|
986
|
+
const message = step.kind === "anchored" ? this.#defaults.rangeStartAnnouncement(this.#formatAnnouncedDate(step.anchor)) : this.#defaults.rangeSelectedAnnouncement(this.#formatAnnouncedDate(step.range.start), this.#formatAnnouncedDate(step.range.end));
|
|
987
|
+
this.#announcer.announce(message, "polite");
|
|
988
|
+
}
|
|
989
|
+
#formatAnnouncedDate(date) {
|
|
990
|
+
return this.adapter.format(date, {
|
|
991
|
+
day: "numeric",
|
|
992
|
+
month: "long",
|
|
993
|
+
year: "numeric"
|
|
994
|
+
}, this.locale() ?? void 0);
|
|
995
|
+
}
|
|
965
996
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
966
997
|
minVersion: "12.0.0",
|
|
967
998
|
version: "22.2.4",
|