forty-cdk 0.2.0 → 0.3.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/accordion/README.md +122 -0
- package/aspect-ratio/README.md +76 -0
- package/avatar/README.md +100 -0
- package/breadcrumbs/README.md +49 -0
- package/breakpoints/README.md +81 -0
- package/button/README.md +49 -0
- package/calendar/README.md +458 -0
- package/carousel/README.md +358 -0
- package/checkbox/README.md +146 -0
- package/combobox/README.md +535 -0
- package/context-menu/README.md +139 -0
- package/date-field/README.md +184 -0
- package/date-picker/README.md +338 -0
- package/dialog/README.md +388 -0
- package/disclosure/README.md +114 -0
- package/drag-drop/README.md +359 -0
- package/drawer/README.md +560 -0
- package/dropdown-menu/README.md +176 -0
- package/fesm2022/forty-cdk-accordion.mjs +348 -0
- package/fesm2022/forty-cdk-accordion.mjs.map +1 -0
- package/fesm2022/forty-cdk-aspect-ratio.mjs +74 -0
- package/fesm2022/forty-cdk-aspect-ratio.mjs.map +1 -0
- package/fesm2022/forty-cdk-avatar.mjs +308 -0
- package/fesm2022/forty-cdk-avatar.mjs.map +1 -0
- package/fesm2022/forty-cdk-breadcrumbs.mjs +125 -0
- package/fesm2022/forty-cdk-breadcrumbs.mjs.map +1 -0
- package/fesm2022/forty-cdk-breakpoints.mjs +117 -0
- package/fesm2022/forty-cdk-breakpoints.mjs.map +1 -0
- package/fesm2022/forty-cdk-button.mjs +134 -0
- package/fesm2022/forty-cdk-button.mjs.map +1 -0
- package/fesm2022/forty-cdk-calendar.mjs +2034 -0
- package/fesm2022/forty-cdk-calendar.mjs.map +1 -0
- package/fesm2022/forty-cdk-carousel.mjs +968 -0
- package/fesm2022/forty-cdk-carousel.mjs.map +1 -0
- package/fesm2022/forty-cdk-checkbox.mjs +226 -0
- package/fesm2022/forty-cdk-checkbox.mjs.map +1 -0
- package/fesm2022/forty-cdk-combobox.mjs +2596 -0
- package/fesm2022/forty-cdk-combobox.mjs.map +1 -0
- package/fesm2022/forty-cdk-context-menu.mjs +413 -0
- package/fesm2022/forty-cdk-context-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-core.mjs +9022 -0
- package/fesm2022/forty-cdk-core.mjs.map +1 -0
- package/fesm2022/forty-cdk-date-field.mjs +744 -0
- package/fesm2022/forty-cdk-date-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-date-picker.mjs +1011 -0
- package/fesm2022/forty-cdk-date-picker.mjs.map +1 -0
- package/fesm2022/forty-cdk-dialog.mjs +707 -0
- package/fesm2022/forty-cdk-dialog.mjs.map +1 -0
- package/fesm2022/forty-cdk-disclosure.mjs +190 -0
- package/fesm2022/forty-cdk-disclosure.mjs.map +1 -0
- package/fesm2022/forty-cdk-drag-drop.mjs +1180 -0
- package/fesm2022/forty-cdk-drag-drop.mjs.map +1 -0
- package/fesm2022/forty-cdk-drawer.mjs +1641 -0
- package/fesm2022/forty-cdk-drawer.mjs.map +1 -0
- package/fesm2022/forty-cdk-dropdown-menu.mjs +350 -0
- package/fesm2022/forty-cdk-dropdown-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-field.mjs +425 -0
- package/fesm2022/forty-cdk-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-fieldset.mjs +164 -0
- package/fesm2022/forty-cdk-fieldset.mjs.map +1 -0
- package/fesm2022/forty-cdk-file-upload.mjs +221 -0
- package/fesm2022/forty-cdk-file-upload.mjs.map +1 -0
- package/fesm2022/forty-cdk-hover-card.mjs +496 -0
- package/fesm2022/forty-cdk-hover-card.mjs.map +1 -0
- package/fesm2022/forty-cdk-input.mjs +274 -0
- package/fesm2022/forty-cdk-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-internationalized-date.mjs +1 -1
- package/fesm2022/forty-cdk-internationalized-date.mjs.map +1 -1
- package/fesm2022/forty-cdk-listbox.mjs +1279 -0
- package/fesm2022/forty-cdk-listbox.mjs.map +1 -0
- package/fesm2022/forty-cdk-menu.mjs +1439 -0
- package/fesm2022/forty-cdk-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-menubar.mjs +787 -0
- package/fesm2022/forty-cdk-menubar.mjs.map +1 -0
- package/fesm2022/forty-cdk-meter.mjs +211 -0
- package/fesm2022/forty-cdk-meter.mjs.map +1 -0
- package/fesm2022/forty-cdk-navigation-menu.mjs +1145 -0
- package/fesm2022/forty-cdk-navigation-menu.mjs.map +1 -0
- package/fesm2022/forty-cdk-number-input.mjs +559 -0
- package/fesm2022/forty-cdk-number-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-otp-input.mjs +527 -0
- package/fesm2022/forty-cdk-otp-input.mjs.map +1 -0
- package/fesm2022/forty-cdk-pagination.mjs +323 -0
- package/fesm2022/forty-cdk-pagination.mjs.map +1 -0
- package/fesm2022/forty-cdk-pane-resizer.mjs +297 -0
- package/fesm2022/forty-cdk-pane-resizer.mjs.map +1 -0
- package/fesm2022/forty-cdk-popover.mjs +698 -0
- package/fesm2022/forty-cdk-popover.mjs.map +1 -0
- package/fesm2022/forty-cdk-progress.mjs +226 -0
- package/fesm2022/forty-cdk-progress.mjs.map +1 -0
- package/fesm2022/forty-cdk-radio-group.mjs +378 -0
- package/fesm2022/forty-cdk-radio-group.mjs.map +1 -0
- package/fesm2022/forty-cdk-scroll-area.mjs +640 -0
- package/fesm2022/forty-cdk-scroll-area.mjs.map +1 -0
- package/fesm2022/forty-cdk-search.mjs +205 -0
- package/fesm2022/forty-cdk-search.mjs.map +1 -0
- package/fesm2022/forty-cdk-select.mjs +1661 -0
- package/fesm2022/forty-cdk-select.mjs.map +1 -0
- package/fesm2022/forty-cdk-separator.mjs +82 -0
- package/fesm2022/forty-cdk-separator.mjs.map +1 -0
- package/fesm2022/forty-cdk-signal-forms.mjs +97 -0
- package/fesm2022/forty-cdk-signal-forms.mjs.map +1 -0
- package/fesm2022/forty-cdk-slider.mjs +803 -0
- package/fesm2022/forty-cdk-slider.mjs.map +1 -0
- package/fesm2022/forty-cdk-stepper.mjs +886 -0
- package/fesm2022/forty-cdk-stepper.mjs.map +1 -0
- package/fesm2022/forty-cdk-switch.mjs +137 -0
- package/fesm2022/forty-cdk-switch.mjs.map +1 -0
- package/fesm2022/forty-cdk-table.mjs +1518 -0
- package/fesm2022/forty-cdk-table.mjs.map +1 -0
- package/fesm2022/forty-cdk-tabs.mjs +400 -0
- package/fesm2022/forty-cdk-tabs.mjs.map +1 -0
- package/fesm2022/forty-cdk-time-field.mjs +593 -0
- package/fesm2022/forty-cdk-time-field.mjs.map +1 -0
- package/fesm2022/forty-cdk-time-picker.mjs +1013 -0
- package/fesm2022/forty-cdk-time-picker.mjs.map +1 -0
- package/fesm2022/forty-cdk-toast.mjs +1153 -0
- package/fesm2022/forty-cdk-toast.mjs.map +1 -0
- package/fesm2022/forty-cdk-toggle.mjs +516 -0
- package/fesm2022/forty-cdk-toggle.mjs.map +1 -0
- package/fesm2022/forty-cdk-toolbar.mjs +374 -0
- package/fesm2022/forty-cdk-toolbar.mjs.map +1 -0
- package/fesm2022/forty-cdk-tooltip.mjs +672 -0
- package/fesm2022/forty-cdk-tooltip.mjs.map +1 -0
- package/fesm2022/forty-cdk-tree.mjs +2007 -0
- package/fesm2022/forty-cdk-tree.mjs.map +1 -0
- package/fesm2022/forty-cdk-virtualization.mjs +1 -1
- package/fesm2022/forty-cdk-virtualization.mjs.map +1 -1
- package/fesm2022/forty-cdk.mjs +0 -43310
- package/fesm2022/forty-cdk.mjs.map +1 -1
- package/field/README.md +97 -0
- package/fieldset/README.md +86 -0
- package/file-upload/README.md +73 -0
- package/hover-card/README.md +171 -0
- package/input/README.md +156 -0
- package/listbox/README.md +424 -0
- package/menu/README.md +181 -0
- package/menubar/README.md +140 -0
- package/meter/README.md +128 -0
- package/navigation-menu/README.md +253 -0
- package/number-input/README.md +171 -0
- package/otp-input/README.md +198 -0
- package/package.json +213 -1
- package/pagination/README.md +61 -0
- package/pane-resizer/README.md +136 -0
- package/popover/README.md +262 -0
- package/progress/README.md +115 -0
- package/radio-group/README.md +129 -0
- package/scroll-area/README.md +184 -0
- package/search/README.md +42 -0
- package/select/README.md +488 -0
- package/separator/README.md +84 -0
- package/signal-forms/README.md +72 -0
- package/slider/README.md +152 -0
- package/stepper/README.md +292 -0
- package/switch/README.md +116 -0
- package/table/README.md +769 -0
- package/tabs/README.md +130 -0
- package/time-field/README.md +157 -0
- package/time-picker/README.md +172 -0
- package/toast/README.md +398 -0
- package/toggle/README.md +224 -0
- package/toolbar/README.md +109 -0
- package/tooltip/README.md +274 -0
- package/tree/README.md +708 -0
- package/types/forty-cdk-accordion.d.ts +242 -0
- package/types/forty-cdk-aspect-ratio.d.ts +59 -0
- package/types/forty-cdk-avatar.d.ts +133 -0
- package/types/forty-cdk-breadcrumbs.d.ts +92 -0
- package/types/forty-cdk-breakpoints.d.ts +141 -0
- package/types/forty-cdk-button.d.ts +80 -0
- package/types/forty-cdk-calendar.d.ts +914 -0
- package/types/forty-cdk-carousel.d.ts +530 -0
- package/types/forty-cdk-checkbox.d.ts +141 -0
- package/types/forty-cdk-combobox.d.ts +1259 -0
- package/types/forty-cdk-context-menu.d.ts +313 -0
- package/types/forty-cdk-core.d.ts +5774 -0
- package/types/forty-cdk-date-field.d.ts +307 -0
- package/types/forty-cdk-date-picker.d.ts +622 -0
- package/types/forty-cdk-dialog.d.ts +546 -0
- package/types/forty-cdk-disclosure.d.ts +127 -0
- package/types/forty-cdk-drag-drop.d.ts +456 -0
- package/types/forty-cdk-drawer.d.ts +871 -0
- package/types/forty-cdk-dropdown-menu.d.ts +242 -0
- package/types/forty-cdk-field.d.ts +236 -0
- package/types/forty-cdk-fieldset.d.ts +119 -0
- package/types/forty-cdk-file-upload.d.ts +124 -0
- package/types/forty-cdk-hover-card.d.ts +320 -0
- package/types/forty-cdk-input.d.ts +169 -0
- package/types/forty-cdk-internationalized-date.d.ts +1 -1
- package/types/forty-cdk-listbox.d.ts +513 -0
- package/types/forty-cdk-menu.d.ts +629 -0
- package/types/forty-cdk-menubar.d.ts +451 -0
- package/types/forty-cdk-meter.d.ts +122 -0
- package/types/forty-cdk-navigation-menu.d.ts +514 -0
- package/types/forty-cdk-number-input.d.ts +319 -0
- package/types/forty-cdk-otp-input.d.ts +248 -0
- package/types/forty-cdk-pagination.d.ts +214 -0
- package/types/forty-cdk-pane-resizer.d.ts +145 -0
- package/types/forty-cdk-popover.d.ts +509 -0
- package/types/forty-cdk-progress.d.ts +143 -0
- package/types/forty-cdk-radio-group.d.ts +222 -0
- package/types/forty-cdk-scroll-area.d.ts +258 -0
- package/types/forty-cdk-search.d.ts +142 -0
- package/types/forty-cdk-select.d.ts +899 -0
- package/types/forty-cdk-separator.d.ts +59 -0
- package/types/forty-cdk-signal-forms.d.ts +58 -0
- package/types/forty-cdk-slider.d.ts +379 -0
- package/types/forty-cdk-stepper.d.ts +650 -0
- package/types/forty-cdk-switch.d.ts +87 -0
- package/types/forty-cdk-table.d.ts +723 -0
- package/types/forty-cdk-tabs.d.ts +235 -0
- package/types/forty-cdk-time-field.d.ts +307 -0
- package/types/forty-cdk-time-picker.d.ts +578 -0
- package/types/forty-cdk-toast.d.ts +598 -0
- package/types/forty-cdk-toggle.d.ts +310 -0
- package/types/forty-cdk-toolbar.d.ts +217 -0
- package/types/forty-cdk-tooltip.d.ts +436 -0
- package/types/forty-cdk-tree.d.ts +688 -0
- package/types/forty-cdk.d.ts +1 -19743
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import * as forty_cdk_core from 'forty-cdk/core';
|
|
2
|
+
import { MenuOverlayHost, ForMenuContext, FloatingSide, FloatingAlign, WritingDirection, VetoableNativeEvent, VetoableEvent } from 'forty-cdk/core';
|
|
3
|
+
import * as _angular_core from '@angular/core';
|
|
4
|
+
import { Signal, Provider } from '@angular/core';
|
|
5
|
+
import { ReferenceElement } from '@floating-ui/dom';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Headless implementation of the [WAI-ARIA Menu Button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/).
|
|
9
|
+
* Apply on a wrapper that contains the trigger and the `@if`-mounted
|
|
10
|
+
* `[forMenuContent]`. The directive owns open state, ids, and the registries
|
|
11
|
+
* that wire trigger / content / items together.
|
|
12
|
+
*
|
|
13
|
+
* Mount/unmount of the visible menu is the consumer's responsibility — wrap
|
|
14
|
+
* `[forMenuContent]` with `@if (open())` so `animate.enter` / `animate.leave`
|
|
15
|
+
* fire on the natural mount cycle:
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <div forDropdownMenu [(open)]="open">
|
|
19
|
+
* <button forDropdownMenuTrigger>Options</button>
|
|
20
|
+
* @if (open()) {
|
|
21
|
+
* <div forMenuContent>…</div>
|
|
22
|
+
* }
|
|
23
|
+
* </div>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Selecting a `[forMenuItem]` closes the menu (call `event.preventDefault()`
|
|
27
|
+
* on the item's `(activate)` event to keep it open). Escape, pointer-down
|
|
28
|
+
* outside, and focus-outside also close — each emits a vetoable event.
|
|
29
|
+
*
|
|
30
|
+
* Most of the directive's body (id generation, item collection, typeahead,
|
|
31
|
+
* navigate / focus helpers, escape / outside-click veto plumbing) is owned
|
|
32
|
+
* by the shared `_internal/menu-overlay` helper. The directive contributes
|
|
33
|
+
* the inputs / outputs / model that make up the public surface, the
|
|
34
|
+
* trigger-anchored `anchor` and `dismissableExemptions`, and the
|
|
35
|
+
* `aria-haspopup="menu"` / return-focus semantics specific to the
|
|
36
|
+
* Menu Button pattern.
|
|
37
|
+
*/
|
|
38
|
+
declare class ForDropdownMenu extends MenuOverlayHost implements ForMenuContext {
|
|
39
|
+
#private;
|
|
40
|
+
/**
|
|
41
|
+
* Two-way bindable. Whether the menu is currently shown. The `model()`
|
|
42
|
+
* change emitter (`(openChange)`) fires only on internal transitions
|
|
43
|
+
* (trigger toggle, Escape, outside dismissal, item selection), never on
|
|
44
|
+
* consumer writes via `[(open)]`.
|
|
45
|
+
*/
|
|
46
|
+
readonly open: _angular_core.ModelSignal<boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Side the menu is anchored to. Defaults to `'bottom'`. Pair with
|
|
49
|
+
* `align` for the full positioning API.
|
|
50
|
+
*
|
|
51
|
+
* One of the floating-ui positioning inputs shared verbatim across the
|
|
52
|
+
* three menu roots — their non-seed defaults come from the single
|
|
53
|
+
* `MENU_POSITIONING_DEFAULTS` source and `menu-positioning-inputs.spec.ts`
|
|
54
|
+
* guards the three roots against drift.
|
|
55
|
+
*/
|
|
56
|
+
readonly side: _angular_core.InputSignal<FloatingSide | undefined>;
|
|
57
|
+
/** Alignment along the chosen `side`. Defaults to `'start'`. */
|
|
58
|
+
readonly align: _angular_core.InputSignal<FloatingAlign | undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Gap (px) between trigger and menu along the main axis. Default `4`.
|
|
61
|
+
* The default is read from
|
|
62
|
+
* `provideForDropdownMenuDefaults` for the surrounding scope.
|
|
63
|
+
*/
|
|
64
|
+
readonly sideOffset: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
65
|
+
/** Gap (px) along the cross axis. Default `0`. */
|
|
66
|
+
readonly alignOffset: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
67
|
+
/** When `true` (default), `flip` and `shift` keep the menu inside the viewport. */
|
|
68
|
+
readonly avoidCollisions: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Padding (px) applied uniformly to flip / shift / size. Default `8`.
|
|
71
|
+
* The default is read from `provideForDropdownMenuDefaults` for the
|
|
72
|
+
* surrounding scope.
|
|
73
|
+
*/
|
|
74
|
+
readonly collisionPadding: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
75
|
+
/** Padding (px) for the `arrow` middleware. Default `0`. */
|
|
76
|
+
readonly arrowPadding: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
77
|
+
/** Stickiness behaviour for `shift`. Default `'partial'`. */
|
|
78
|
+
readonly sticky: _angular_core.InputSignal<false | "partial" | "always">;
|
|
79
|
+
/** When `true`, sets `data-detached=""` while the trigger is scrolled off-screen. */
|
|
80
|
+
readonly hideWhenDetached: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
81
|
+
/**
|
|
82
|
+
* When `true` (default), the menu is clipped until floating-ui resolves
|
|
83
|
+
* its first position, preventing a flash at the viewport corner. Set to
|
|
84
|
+
* `false` so a dramatic `animate.enter` plays from its first frame.
|
|
85
|
+
*/
|
|
86
|
+
readonly clipUntilPositioned: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
87
|
+
/**
|
|
88
|
+
* When `true` (default), arrow-key navigation wraps from the last enabled
|
|
89
|
+
* item back to the first (and vice versa). When `false`, navigation stops
|
|
90
|
+
* at the ends.
|
|
91
|
+
*/
|
|
92
|
+
readonly loop: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
93
|
+
/**
|
|
94
|
+
* Writing direction. Drives ArrowLeft / ArrowRight semantics on submenu
|
|
95
|
+
* triggers and items underneath this menu (in RTL, ArrowLeft opens a submenu
|
|
96
|
+
* and ArrowRight closes it back). When unset (default `null`), the inherited
|
|
97
|
+
* ambient direction is resolved from the nearest ancestor carrying a `dir`
|
|
98
|
+
* attribute (or `<html dir>`), defaulting to `'ltr'`. An explicit `[dir]`
|
|
99
|
+
* always wins, the resolved value is reflected to the host `dir` attribute,
|
|
100
|
+
* and it is inherited by descendant submenus.
|
|
101
|
+
*/
|
|
102
|
+
readonly _dirInput: _angular_core.InputSignal<WritingDirection | null>;
|
|
103
|
+
readonly dir: _angular_core.Signal<WritingDirection>;
|
|
104
|
+
/**
|
|
105
|
+
* When true, trigger interaction is ignored and any open menu stays open
|
|
106
|
+
* until the consumer flips `open` themselves. The trigger reflects
|
|
107
|
+
* `data-disabled`; the items keep their per-item disabled semantics.
|
|
108
|
+
*/
|
|
109
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
110
|
+
/** When true (default), Escape, pointer-down outside, and focus outside close the menu. */
|
|
111
|
+
readonly dismissible: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
112
|
+
/** When true (default), focus returns to the trigger on close. */
|
|
113
|
+
readonly returnFocus: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
114
|
+
/** Manual `aria-label` on `[forMenuContent]`. Use when the trigger isn't a meaningful name. */
|
|
115
|
+
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
116
|
+
/**
|
|
117
|
+
* Fires when Escape is pressed while the menu is open, just before it
|
|
118
|
+
* closes. Call `preventDefault()` on the emitted veto to keep the menu
|
|
119
|
+
* open and suppress the Escape-driven close.
|
|
120
|
+
*/
|
|
121
|
+
readonly escapeKeyDown: _angular_core.OutputEmitterRef<VetoableNativeEvent<KeyboardEvent>>;
|
|
122
|
+
/**
|
|
123
|
+
* Fires on a pointer-down outside the menu (and outside the exempt
|
|
124
|
+
* trigger), just before it closes. Call `preventDefault()` on the veto to
|
|
125
|
+
* keep the menu open.
|
|
126
|
+
*/
|
|
127
|
+
readonly pointerDownOutside: _angular_core.OutputEmitterRef<VetoableNativeEvent<PointerEvent>>;
|
|
128
|
+
/**
|
|
129
|
+
* Fires when focus moves outside the menu, just before it closes. Call
|
|
130
|
+
* `preventDefault()` on the veto to keep the menu open.
|
|
131
|
+
*/
|
|
132
|
+
readonly focusOutside: _angular_core.OutputEmitterRef<VetoableNativeEvent<FocusEvent>>;
|
|
133
|
+
/**
|
|
134
|
+
* Composite outside-interaction channel: fires for either a
|
|
135
|
+
* pointer-down-outside or a focus-outside, just before the menu closes.
|
|
136
|
+
* Call `preventDefault()` on the veto to keep the menu open regardless of
|
|
137
|
+
* which interaction triggered it.
|
|
138
|
+
*/
|
|
139
|
+
readonly interactOutside: _angular_core.OutputEmitterRef<VetoableNativeEvent<PointerEvent | FocusEvent>>;
|
|
140
|
+
/**
|
|
141
|
+
* Fires just before the menu sends focus to its first / last enabled
|
|
142
|
+
* item on mount. Call `preventDefault()` on the emitted veto to skip
|
|
143
|
+
* the imperative focus move — useful when opening a menu from an
|
|
144
|
+
* input you want to keep focused.
|
|
145
|
+
*/
|
|
146
|
+
readonly autoFocusOnOpen: _angular_core.OutputEmitterRef<VetoableEvent>;
|
|
147
|
+
/**
|
|
148
|
+
* Fires just before focus returns to the trigger on unmount. Call
|
|
149
|
+
* `preventDefault()` on the veto to suppress the return-focus.
|
|
150
|
+
*/
|
|
151
|
+
readonly autoFocusOnClose: _angular_core.OutputEmitterRef<VetoableEvent>;
|
|
152
|
+
protected readonly _overlay: forty_cdk_core.MenuOverlay<forty_cdk_core.MenuItemHandle>;
|
|
153
|
+
readonly anchor: _angular_core.Signal<ReferenceElement | null>;
|
|
154
|
+
readonly dismissableExemptions: _angular_core.Signal<readonly HTMLElement[]>;
|
|
155
|
+
/** Top-level: no parent menu. */
|
|
156
|
+
readonly parentMenu: null;
|
|
157
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDropdownMenu, never>;
|
|
158
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDropdownMenu, "[forDropdownMenu]", ["forDropdownMenu"], { "open": { "alias": "open"; "required": false; "isSignal": true; }; "side": { "alias": "side"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "sideOffset": { "alias": "sideOffset"; "required": false; "isSignal": true; }; "alignOffset": { "alias": "alignOffset"; "required": false; "isSignal": true; }; "avoidCollisions": { "alias": "avoidCollisions"; "required": false; "isSignal": true; }; "collisionPadding": { "alias": "collisionPadding"; "required": false; "isSignal": true; }; "arrowPadding": { "alias": "arrowPadding"; "required": false; "isSignal": true; }; "sticky": { "alias": "sticky"; "required": false; "isSignal": true; }; "hideWhenDetached": { "alias": "hideWhenDetached"; "required": false; "isSignal": true; }; "clipUntilPositioned": { "alias": "clipUntilPositioned"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "_dirInput": { "alias": "dir"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "dismissible": { "alias": "dismissible"; "required": false; "isSignal": true; }; "returnFocus": { "alias": "returnFocus"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; }, { "open": "openChange"; "escapeKeyDown": "escapeKeyDown"; "pointerDownOutside": "pointerDownOutside"; "focusOutside": "focusOutside"; "interactOutside": "interactOutside"; "autoFocusOnOpen": "autoFocusOnOpen"; "autoFocusOnClose": "autoFocusOnClose"; }, never, never, true, never>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Button that toggles the dropdown menu when clicked, opens via ArrowDown
|
|
163
|
+
* (focus first item) or ArrowUp (focus last item).
|
|
164
|
+
*
|
|
165
|
+
* Apply on a `<button>` so Space / Enter dispatch native click events
|
|
166
|
+
* automatically — those open the menu via `(click)`. Wires `aria-haspopup`,
|
|
167
|
+
* `aria-expanded`, and `aria-controls` per the menu-button pattern.
|
|
168
|
+
*
|
|
169
|
+
* The trigger distinguishes pointer from keyboard activation (a `pointerdown`
|
|
170
|
+
* preceding the click marks it pointer-driven): both move focus to the first
|
|
171
|
+
* item, but only a keyboard open highlights it — a mouse-opened menu carries
|
|
172
|
+
* no `data-highlighted` until keyboard navigation.
|
|
173
|
+
*
|
|
174
|
+
* Disabling: the trigger merges its own `disabled` input OR the root's
|
|
175
|
+
* `disabled`. The native `disabled` attribute is reflected imperatively and
|
|
176
|
+
* non-destructively — the directive only removes the attribute when it set it
|
|
177
|
+
* itself, so a consumer-set `disabled` on the same button always survives an
|
|
178
|
+
* enabled menu context.
|
|
179
|
+
*
|
|
180
|
+
* The root is normally resolved via DI from the enclosing `[forDropdownMenu]`.
|
|
181
|
+
* When the trigger is declared inside an `ng-template` stamped into the root
|
|
182
|
+
* (e.g. via `ngTemplateOutlet`), DI resolves at the template's declaration
|
|
183
|
+
* site and misses the root — pass it explicitly through the selector input,
|
|
184
|
+
* `routerLink`-style: `[forDropdownMenuTrigger]="root"` with
|
|
185
|
+
* `#root="forDropdownMenu"`.
|
|
186
|
+
*/
|
|
187
|
+
declare class ForDropdownMenuTrigger {
|
|
188
|
+
#private;
|
|
189
|
+
/**
|
|
190
|
+
* Optional explicit reference to the `[forDropdownMenu]` root, named after
|
|
191
|
+
* the selector `routerLink`-style. The bare valueless attribute keeps
|
|
192
|
+
* resolving the enclosing root via DI; pass the root explicitly
|
|
193
|
+
* (`[forDropdownMenuTrigger]="root"`, with `#root="forDropdownMenu"`) when
|
|
194
|
+
* the trigger is declared in an `ng-template` stamped inside the root — DI
|
|
195
|
+
* resolves at the template's declaration site, so the enclosing root is
|
|
196
|
+
* invisible there. The empty string (what the valueless attribute yields)
|
|
197
|
+
* is treated as unset.
|
|
198
|
+
*/
|
|
199
|
+
readonly forDropdownMenuTrigger: _angular_core.InputSignal<"" | ForMenuContext>;
|
|
200
|
+
protected readonly ctx: Signal<ForMenuContext>;
|
|
201
|
+
/** Disables this trigger only, in addition to the root's `disabled`. */
|
|
202
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
203
|
+
/** Whether the trigger is disabled — its own `disabled` input OR the root's. */
|
|
204
|
+
readonly effectiveDisabled: Signal<boolean>;
|
|
205
|
+
constructor();
|
|
206
|
+
protected onPointerDown(): void;
|
|
207
|
+
protected onClick(): void;
|
|
208
|
+
protected onKeyDown(event: KeyboardEvent): void;
|
|
209
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForDropdownMenuTrigger, never>;
|
|
210
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForDropdownMenuTrigger, "[forDropdownMenuTrigger]", ["forDropdownMenuTrigger"], { "forDropdownMenuTrigger": { "alias": "forDropdownMenuTrigger"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Defaults inherited by descendant dropdown menus in the surrounding
|
|
215
|
+
* injector scope. Configure with `provideForDropdownMenuDefaults` either
|
|
216
|
+
* at the application root or in any component's `providers` array; partial
|
|
217
|
+
* overrides merge with the parent scope.
|
|
218
|
+
*/
|
|
219
|
+
interface ForDropdownMenuDefaults {
|
|
220
|
+
/**
|
|
221
|
+
* Distance (px) between the dropdown trigger and the floating content
|
|
222
|
+
* along the resolved `side` axis.
|
|
223
|
+
*/
|
|
224
|
+
sideOffset: number;
|
|
225
|
+
/**
|
|
226
|
+
* Padding (px) added to the viewport edges for collision-aware
|
|
227
|
+
* positioning. Higher values keep the floating content further from
|
|
228
|
+
* the edge when `flip` / `shift` runs.
|
|
229
|
+
*/
|
|
230
|
+
collisionPadding: number;
|
|
231
|
+
}
|
|
232
|
+
/** Token holding the resolved dropdown-menu defaults for the current scope. */
|
|
233
|
+
declare const FOR_DROPDOWN_MENU_DEFAULTS: _angular_core.InjectionToken<ForDropdownMenuDefaults>;
|
|
234
|
+
/**
|
|
235
|
+
* Configures forty-cdk dropdown-menu defaults for this injector scope.
|
|
236
|
+
* Partial overrides inherit unspecified keys from the parent scope (or
|
|
237
|
+
* library defaults at the root).
|
|
238
|
+
*/
|
|
239
|
+
declare function provideForDropdownMenuDefaults(defaults?: Partial<ForDropdownMenuDefaults>): Provider[];
|
|
240
|
+
|
|
241
|
+
export { FOR_DROPDOWN_MENU_DEFAULTS, ForDropdownMenu, ForDropdownMenuTrigger, provideForDropdownMenuDefaults };
|
|
242
|
+
export type { ForDropdownMenuDefaults };
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
|
+
import * as forty_cdk_core from 'forty-cdk/core';
|
|
4
|
+
import { ForFieldContext, FieldControlHandle } from 'forty-cdk/core';
|
|
5
|
+
export { FOR_FIELD_CONTEXT, FieldControlHandle, ForFieldContext, injectFieldWiring } from 'forty-cdk/core';
|
|
6
|
+
import { ValidationError } from '@angular/forms/signals';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Headless form-field container that wires accessible labelling, description,
|
|
10
|
+
* and error association for a single control. It renders nothing and imposes no
|
|
11
|
+
* layout: its only job is to connect a `[forLabel]`, `[forFieldDescription]`,
|
|
12
|
+
* and `[forFieldError]` to the control via `id` / `aria-labelledby` /
|
|
13
|
+
* `aria-describedby` / `aria-errormessage`, and to reflect the control's
|
|
14
|
+
* validation state as `data-*` hooks for styling.
|
|
15
|
+
*
|
|
16
|
+
* Any forty-cdk form control (every `FormValueControl` / `FormCheckboxControl`
|
|
17
|
+
* primitive) auto-associates when wrapped — no extra markup. A plain native
|
|
18
|
+
* `<input>` opts in with `[forFieldControl]`.
|
|
19
|
+
*
|
|
20
|
+
* Host reflects `data-invalid` / `data-disabled` / `data-required` /
|
|
21
|
+
* `data-touched` from the registered control.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```html
|
|
25
|
+
* <div forField>
|
|
26
|
+
* <label forLabel>Notifications</label>
|
|
27
|
+
* <button forSwitch [formField]="settings.notify"></button>
|
|
28
|
+
* <p forFieldDescription>We'll only email you about security.</p>
|
|
29
|
+
* @if (settings.notify().invalid()) {
|
|
30
|
+
* <p forFieldError #err="forFieldError">{{ err.messages().join(', ') }}</p>
|
|
31
|
+
* }
|
|
32
|
+
* </div>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare class ForField implements ForFieldContext {
|
|
36
|
+
#private;
|
|
37
|
+
/**
|
|
38
|
+
* Id assigned to the control; a label's `for` points here. Adopts a
|
|
39
|
+
* nominated control's own id (`labelledElementId`) when present so the label
|
|
40
|
+
* and the primitive's internal `aria-labelledby` resolve to the same
|
|
41
|
+
* focusable element; otherwise the field's owned/host-adopted id.
|
|
42
|
+
*/
|
|
43
|
+
readonly controlId: _angular_core.Signal<string>;
|
|
44
|
+
/** Id of the label element. */
|
|
45
|
+
readonly labelId: _angular_core.WritableSignal<string>;
|
|
46
|
+
/** Id of the description element. */
|
|
47
|
+
readonly descriptionId: _angular_core.WritableSignal<string>;
|
|
48
|
+
/** Id of the error element. */
|
|
49
|
+
readonly errorId: _angular_core.WritableSignal<string>;
|
|
50
|
+
/** The currently registered control handle, or null. */
|
|
51
|
+
readonly control: _angular_core.Signal<FieldControlHandle | null>;
|
|
52
|
+
/** Whether the registered control is currently invalid. */
|
|
53
|
+
readonly invalid: _angular_core.Signal<boolean>;
|
|
54
|
+
/** Whether the registered control is required. */
|
|
55
|
+
readonly required: _angular_core.Signal<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the field is disabled: the registered control's own disabled state
|
|
58
|
+
* OR'd with a surrounding `[forFieldset]`'s `disabled` (so a disabled group
|
|
59
|
+
* reaches custom-role controls a native `<fieldset disabled>` can't).
|
|
60
|
+
*/
|
|
61
|
+
readonly disabled: _angular_core.Signal<boolean>;
|
|
62
|
+
/** Whether the registered control has been touched. */
|
|
63
|
+
readonly touched: _angular_core.Signal<boolean>;
|
|
64
|
+
/** Resolved `aria-labelledby` for the control (label id, or null). */
|
|
65
|
+
readonly labelledBy: _angular_core.Signal<string | null>;
|
|
66
|
+
/**
|
|
67
|
+
* Resolved `aria-describedby`: the description id always, plus the error id
|
|
68
|
+
* when the control is invalid. The error id is included here (in addition to
|
|
69
|
+
* `aria-errormessage`) because assistive-tech support for `aria-errormessage`
|
|
70
|
+
* is uneven; doubling it up is the widely-used robust pattern.
|
|
71
|
+
*/
|
|
72
|
+
readonly describedBy: _angular_core.Signal<string | null>;
|
|
73
|
+
/** Resolved `aria-errormessage`: the error id when present and invalid, else null. */
|
|
74
|
+
readonly errorMessageId: _angular_core.Signal<string | null>;
|
|
75
|
+
/** Register the control whose state the field reflects. */
|
|
76
|
+
registerControl(handle: FieldControlHandle): void;
|
|
77
|
+
/** Remove a previously registered control. */
|
|
78
|
+
unregisterControl(handle: FieldControlHandle): void;
|
|
79
|
+
/**
|
|
80
|
+
* Mark the label slot present; returns an unregister callback. The field
|
|
81
|
+
* targets a single label per slot — its `labelId` / `descriptionId` /
|
|
82
|
+
* `errorId` are single ids, not id lists — so one `[forLabel]`,
|
|
83
|
+
* `[forFieldDescription]`, and `[forFieldError]` per field is the supported
|
|
84
|
+
* shape. Presence is a boolean, not a count.
|
|
85
|
+
*/
|
|
86
|
+
registerLabel(): () => void;
|
|
87
|
+
/** Mark the description slot present; returns an unregister callback. See {@link registerLabel} for the single-instance-per-slot contract. */
|
|
88
|
+
registerDescription(): () => void;
|
|
89
|
+
/** Mark the error slot present; returns an unregister callback. See {@link registerLabel} for the single-instance-per-slot contract. */
|
|
90
|
+
registerError(): () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Forward a click to the control's focusable element and focus it — matching
|
|
93
|
+
* the activation a native `<label for>` triggers via the browser, so a
|
|
94
|
+
* non-`<label>` `[forLabel]` toggles a custom-role control instead of only
|
|
95
|
+
* focusing it.
|
|
96
|
+
*/
|
|
97
|
+
clickControl(): void;
|
|
98
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForField, never>;
|
|
99
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForField, "[forField]", ["forField"], {}, {}, never, never, true, never>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Accessible label for a form control. Inside a `[forField]` it auto-wires:
|
|
104
|
+
* it adopts the field's `labelId` and registers itself so the control gains
|
|
105
|
+
* `aria-labelledby`.
|
|
106
|
+
*
|
|
107
|
+
* Click-to-activate is consistent across both host shapes: a native `<label>`
|
|
108
|
+
* emits `for` and the browser forwards the click to the control (toggling a
|
|
109
|
+
* checkbox / switch, activating a button); a non-`<label>` host has no native
|
|
110
|
+
* `for` forwarding, so the directive forwards the click itself — clicking the
|
|
111
|
+
* label activates the control either way, not just focuses it. A click that
|
|
112
|
+
* originated on the control (when the control is nested inside the label host)
|
|
113
|
+
* is not re-forwarded, so a label-wrapping layout toggles once, matching native
|
|
114
|
+
* `<label>` semantics.
|
|
115
|
+
*
|
|
116
|
+
* Usable standalone outside a field — there it is an inert
|
|
117
|
+
* marker and the consumer wires native `for` themselves.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```html
|
|
121
|
+
* <div forField>
|
|
122
|
+
* <label forLabel>Email</label>
|
|
123
|
+
* <input forFieldControl type="email" />
|
|
124
|
+
* </div>
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare class ForLabel {
|
|
128
|
+
#private;
|
|
129
|
+
protected readonly ctx: forty_cdk_core.ForFieldContext | null;
|
|
130
|
+
/** The label's id when inside a field, else null. */
|
|
131
|
+
protected readonly labelId: _angular_core.Signal<string | null>;
|
|
132
|
+
/** `for` is only meaningful on a native `<label>`; null otherwise. */
|
|
133
|
+
protected readonly forAttr: _angular_core.Signal<string | null>;
|
|
134
|
+
constructor();
|
|
135
|
+
protected onClick(event: MouseEvent): void;
|
|
136
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForLabel, never>;
|
|
137
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForLabel, "[forLabel]", ["forLabel"], {}, {}, never, never, true, never>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Supplementary description / hint for a form control. Adopts the field's
|
|
142
|
+
* `descriptionId` and registers itself so the control gains
|
|
143
|
+
* `aria-describedby`. Apply on a `<p>` / `<span>` inside a `[forField]`.
|
|
144
|
+
*/
|
|
145
|
+
declare class ForFieldDescription {
|
|
146
|
+
protected readonly ctx: forty_cdk_core.ForFieldContext;
|
|
147
|
+
constructor();
|
|
148
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForFieldDescription, never>;
|
|
149
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForFieldDescription, "[forFieldDescription]", ["forFieldDescription"], {}, {}, never, never, true, never>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Error region for a form control. Adopts the field's `errorId`, registers
|
|
154
|
+
* itself so the control gains `aria-errormessage` (and the id is folded into
|
|
155
|
+
* `aria-describedby`) while invalid, and **reads the control's Signal Forms
|
|
156
|
+
* validation errors automatically** — the consumer renders `messages()` (or
|
|
157
|
+
* the raw `errors()`) without any manual plumbing.
|
|
158
|
+
*
|
|
159
|
+
* Carries `role="alert"`. Drive its presence with `@if (err.shown())` (or the
|
|
160
|
+
* field's own `invalid()`); when unmounted the control's `aria-errormessage`
|
|
161
|
+
* drops automatically.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```html
|
|
165
|
+
* @if (err.shown()) {
|
|
166
|
+
* <p forFieldError #err="forFieldError">{{ err.messages().join(', ') }}</p>
|
|
167
|
+
* }
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
declare class ForFieldError {
|
|
171
|
+
protected readonly ctx: forty_cdk_core.ForFieldContext;
|
|
172
|
+
/** The control's current validation errors (Signal Forms). */
|
|
173
|
+
readonly errors: _angular_core.Signal<readonly ValidationError.WithOptionalFieldTree[]>;
|
|
174
|
+
/** Human-readable messages derived from {@link errors}. */
|
|
175
|
+
readonly messages: _angular_core.Signal<readonly string[]>;
|
|
176
|
+
/** Whether the control currently has at least one error. */
|
|
177
|
+
readonly hasErrors: _angular_core.Signal<boolean>;
|
|
178
|
+
/** Whether the error region should be shown (control invalid and has errors). */
|
|
179
|
+
readonly shown: _angular_core.Signal<boolean>;
|
|
180
|
+
constructor();
|
|
181
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForFieldError, never>;
|
|
182
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForFieldError, "[forFieldError]", ["forFieldError"], {}, {}, never, never, true, never>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Opt-in marker that wires a non-forty-cdk control — a native `<input>`,
|
|
187
|
+
* `<textarea>`, `<select>`, or any custom element — into its surrounding
|
|
188
|
+
* `[forField]`. forty-cdk form primitives (which extend the shared form base)
|
|
189
|
+
* auto-wire and do **not** need this; it exists for plain native controls that
|
|
190
|
+
* have no primitive of their own.
|
|
191
|
+
*
|
|
192
|
+
* Validation state is consumer-driven via the `invalid` / `required` /
|
|
193
|
+
* `disabled` / `touched` inputs (native controls have no Signal Forms errors
|
|
194
|
+
* to surface). Reflects `aria-invalid` on the host.
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```html
|
|
198
|
+
* <div forField>
|
|
199
|
+
* <label forLabel>Email</label>
|
|
200
|
+
* <input forFieldControl type="email" [invalid]="emailInvalid()" />
|
|
201
|
+
* </div>
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
declare class ForFieldControl {
|
|
205
|
+
/** Marks the control invalid — drives the field's error region and `aria-invalid`. */
|
|
206
|
+
readonly invalid: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
207
|
+
/** Marks the control required — reflected by the field as `data-required`. */
|
|
208
|
+
readonly required: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
209
|
+
/** Marks the control disabled — reflected by the field as `data-disabled`. */
|
|
210
|
+
readonly disabled: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
211
|
+
/** Marks the control touched — reflected by the field as `data-touched`. */
|
|
212
|
+
readonly touched: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
213
|
+
constructor();
|
|
214
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForFieldControl, never>;
|
|
215
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForFieldControl, "[forFieldControl]", ["forFieldControl"], { "invalid": { "alias": "invalid"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "touched": { "alias": "touched"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Defaults inherited by descendant fields in the surrounding injector scope.
|
|
220
|
+
* Configure with `provideForFieldDefaults`. The shape is a stub today —
|
|
221
|
+
* present so future per-scope tuning can land without churning the public
|
|
222
|
+
* surface.
|
|
223
|
+
*/
|
|
224
|
+
interface ForFieldDefaults {
|
|
225
|
+
}
|
|
226
|
+
/** Token holding the resolved field defaults for the current scope. */
|
|
227
|
+
declare const FOR_FIELD_DEFAULTS: _angular_core.InjectionToken<ForFieldDefaults>;
|
|
228
|
+
/**
|
|
229
|
+
* Configures forty-cdk field defaults for this injector scope. Partial
|
|
230
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
231
|
+
* defaults at the root).
|
|
232
|
+
*/
|
|
233
|
+
declare function provideForFieldDefaults(defaults?: Partial<ForFieldDefaults>): Provider[];
|
|
234
|
+
|
|
235
|
+
export { FOR_FIELD_DEFAULTS, ForField, ForFieldControl, ForFieldDescription, ForFieldError, ForLabel, provideForFieldDefaults };
|
|
236
|
+
export type { ForFieldDefaults };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { Provider } from '@angular/core';
|
|
3
|
+
import * as forty_cdk_core from 'forty-cdk/core';
|
|
4
|
+
import { ForFieldsetContext } from 'forty-cdk/core';
|
|
5
|
+
export { FOR_FIELDSET_CONTEXT, ForFieldsetContext } from 'forty-cdk/core';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Headless grouping container that gives a set of related fields a shared
|
|
9
|
+
* accessible name — the styleless counterpart to a native `<fieldset>` +
|
|
10
|
+
* `<legend>`, and the grouping companion to `ForField`.
|
|
11
|
+
*
|
|
12
|
+
* On a native `<fieldset>` it relies on the implicit grouping and emits no
|
|
13
|
+
* role; on any other element it emits `role="group"` + `aria-labelledby`
|
|
14
|
+
* pointing at the `[forFieldsetLegend]` (same host-tag detection idiom as
|
|
15
|
+
* `ForLabel`'s `<label>` check).
|
|
16
|
+
*
|
|
17
|
+
* The `disabled` input reflects `data-disabled` and is provided via context so
|
|
18
|
+
* descendant `ForField` controls OR it into their own disabled state — native
|
|
19
|
+
* `<fieldset disabled>` does not reach custom-role controls like `forSwitch`.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```html
|
|
23
|
+
* <fieldset forFieldset [disabled]="locked()">
|
|
24
|
+
* <legend forFieldsetLegend>Shipping address</legend>
|
|
25
|
+
* <div forField>
|
|
26
|
+
* <label forLabel>Street</label>
|
|
27
|
+
* <input forFieldControl />
|
|
28
|
+
* </div>
|
|
29
|
+
* </fieldset>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare class ForFieldset implements ForFieldsetContext {
|
|
33
|
+
#private;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the group is disabled, as bound by the consumer via `[disabled]`.
|
|
36
|
+
* The host reflection and descendant controls read the composed
|
|
37
|
+
* {@link disabled} signal below, which also folds in an enclosing disabled
|
|
38
|
+
* `[forFieldset]`.
|
|
39
|
+
*/
|
|
40
|
+
readonly disabledInput: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Effective disabled: the group's own `[disabled]` OR'd with an enclosing
|
|
43
|
+
* disabled `[forFieldset]`. Reflects `data-disabled`, emits the native
|
|
44
|
+
* `disabled` attribute on a `<fieldset>` (or `aria-disabled` elsewhere), and
|
|
45
|
+
* propagates to descendant controls via context — so a disabled fieldset
|
|
46
|
+
* reaches custom-role controls (`forSwitch`, `forCheckbox`, …) a native
|
|
47
|
+
* `<fieldset disabled>` can't, and nesting composes like native fieldsets
|
|
48
|
+
* (a disabled outer group cannot be re-enabled by an inner one).
|
|
49
|
+
*/
|
|
50
|
+
readonly disabled: _angular_core.Signal<boolean>;
|
|
51
|
+
/** Id of the legend element; the group's `aria-labelledby` resolves here. */
|
|
52
|
+
readonly legendId: _angular_core.WritableSignal<string>;
|
|
53
|
+
/** Whether the host element is a native `<fieldset>` (no role/labelledby needed). */
|
|
54
|
+
protected readonly isNativeFieldset: _angular_core.Signal<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Native `disabled` is reflected only on a real `<fieldset>` (where it
|
|
57
|
+
* natively disables descendant controls); a non-`<fieldset>` host advertises
|
|
58
|
+
* its disabled state via `aria-disabled` instead.
|
|
59
|
+
*/
|
|
60
|
+
protected readonly nativeDisabled: _angular_core.Signal<boolean>;
|
|
61
|
+
constructor();
|
|
62
|
+
/** `role="group"` on a non-`<fieldset>` element, else null. */
|
|
63
|
+
protected readonly roleAttr: _angular_core.Signal<"group" | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Resolved `aria-labelledby`: the legend id on a non-`<fieldset>` element when
|
|
66
|
+
* a legend is registered, else null (a native `<fieldset>`/`<legend>` groups
|
|
67
|
+
* implicitly and needs none).
|
|
68
|
+
*/
|
|
69
|
+
protected readonly labelledBy: _angular_core.Signal<string | null>;
|
|
70
|
+
/** Mark a legend present; returns an unregister callback. */
|
|
71
|
+
registerLegend(): () => void;
|
|
72
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForFieldset, never>;
|
|
73
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForFieldset, "[forFieldset]", ["forFieldset"], { "disabledInput": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Accessible group label for a `[forFieldset]`. Inside a fieldset it adopts the
|
|
78
|
+
* fieldset's `legendId` and registers itself so the group's `aria-labelledby`
|
|
79
|
+
* resolves; on a native `<fieldset>`/`<legend>` the id is harmless extra wiring
|
|
80
|
+
* (the browser groups implicitly).
|
|
81
|
+
*
|
|
82
|
+
* Usable standalone outside a fieldset — there it is an inert marker.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```html
|
|
86
|
+
* <div forFieldset>
|
|
87
|
+
* <span forFieldsetLegend>Notification preferences</span>
|
|
88
|
+
* <!-- … fields … -->
|
|
89
|
+
* </div>
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
declare class ForFieldsetLegend {
|
|
93
|
+
protected readonly ctx: forty_cdk_core.ForFieldsetContext | null;
|
|
94
|
+
/** The legend's id when inside a fieldset, else null. */
|
|
95
|
+
protected readonly legendId: _angular_core.Signal<string | null>;
|
|
96
|
+
constructor();
|
|
97
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ForFieldsetLegend, never>;
|
|
98
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ForFieldsetLegend, "[forFieldsetLegend]", ["forFieldsetLegend"], {}, {}, never, never, true, never>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Defaults inherited by descendant fieldsets in the surrounding injector scope.
|
|
103
|
+
* Configure with `provideForFieldsetDefaults`. The shape is a stub today —
|
|
104
|
+
* present so future per-scope tuning can land without churning the public
|
|
105
|
+
* surface.
|
|
106
|
+
*/
|
|
107
|
+
interface ForFieldsetDefaults {
|
|
108
|
+
}
|
|
109
|
+
/** Token holding the resolved fieldset defaults for the current scope. */
|
|
110
|
+
declare const FOR_FIELDSET_DEFAULTS: _angular_core.InjectionToken<ForFieldsetDefaults>;
|
|
111
|
+
/**
|
|
112
|
+
* Configures forty-cdk fieldset defaults for this injector scope. Partial
|
|
113
|
+
* overrides inherit unspecified keys from the parent scope (or library
|
|
114
|
+
* defaults at the root).
|
|
115
|
+
*/
|
|
116
|
+
declare function provideForFieldsetDefaults(defaults?: Partial<ForFieldsetDefaults>): Provider[];
|
|
117
|
+
|
|
118
|
+
export { FOR_FIELDSET_DEFAULTS, ForFieldset, ForFieldsetLegend, provideForFieldsetDefaults };
|
|
119
|
+
export type { ForFieldsetDefaults };
|