import * as _angular_core from '@angular/core'; import { InjectionToken, Signal, Provider } from '@angular/core'; import { FormValueControl } from '@angular/forms/signals'; import { TextValueControlBase } from 'forty-cdk/core'; import * as forty_cdk_search from 'forty-cdk/search'; /** * The coordination surface a `[forSearch]` exposes to its siblings. The * companion `[forSearchClear]` button reads it (through the group) to drive its * self-hide logic, reflect its disabled state, and clear / refocus the field on * activation. */ interface ForSearchContext { /** Current text value; `''` while the field is empty. */ readonly value: Signal; /** * The field's effective disabled — its own `disabled` input OR'd with a * surrounding disabled `[forFieldset]`. The clear button reads this so a * disabled fieldset also disables clearing. */ readonly effectiveDisabled: Signal; /** Whether the field is read-only. */ readonly readonly: Signal; /** Resets the value to `''`. No-op while disabled or read-only. */ clear(): void; /** Moves focus back to the native input element. */ focusInput(): void; } /** * The single coordination surface `[forSearchGroup]` exposes. A `[forSearch]` * nested under the group registers itself, and the companion `[forSearchClear]` * button reads the registered field through `field()` to clear / refocus it and * reflect its empty / disabled state. Coordination flows through this registry — * not the DOM — because the focusable searchbox lives on a void `` that * can't contain the sibling button as a descendant. */ interface ForSearchGroupContext { /** The registered search field, or `null` while none is mounted. */ readonly field: Signal; /** Register the search field the group coordinates. */ register(field: ForSearchContext): void; /** Remove a previously registered search field. */ unregister(field: ForSearchContext): void; } /** * Injection token for the `[forSearchGroup]` coordination surface. The search * field joins it via `register`; the clear button reads the registered field * through `field()`. */ declare const FOR_SEARCH_GROUP: InjectionToken; /** * Resolve the surrounding `[forSearchGroup]`, or throw a descriptive error. The * clear button is only meaningful inside a `[forSearchGroup]` that wraps a * `[forSearch]`. */ declare function injectSearchGroup(piece: string): ForSearchGroupContext; /** * Headless `role="searchbox"` text input implementing Angular's * `FormValueControl` from `@angular/forms/signals`, so it auto-wires * with `[formField]` and auto-associates inside a `[forField]` (label / * description / error) with no extra markup. Reuses the exact form-value * wiring of `[forInput]` — same IME handling, same value mirror, same * validation reflection. * * Apply on a native ``. The element keeps its own `type`, caret, IME * composition, and native form submission — the directive only bridges the * value to a signal, reflects validation state, and emits `role="searchbox"`. * * For an inline clear-button affordance that hides itself while the value is * empty, wrap the field and a `[forSearchClear]` in a `[forSearchGroup]`: the * void `` can't contain the button as a descendant, so they coordinate * through the group registry rather than the DOM. * * `Escape` clears a non-empty value, matching the native * `` affordance. The key is consumed * (`preventDefault()` + `stopPropagation()`) only when it actually clears: * when the field is already empty — or disabled / read-only, where clearing is * a no-op — `Escape` is left untouched so an enclosing overlay (Dialog, * Popover, Combobox content) still receives its own dismissal. Set * `[clearOnEscape]="false"` to opt out entirely, so the first `Escape` reaches * the enclosing layer even with a non-empty query — the command-palette shape, * where the search box is the overlay's only content. * * @example * ```html *
* * *
* * *
* * *
* ``` */ declare class ForSearch extends TextValueControlBase implements FormValueControl, ForSearchContext { #private; /** * Whether `Escape` clears a non-empty value before propagating. Defaults to * `true`, the native `` affordance. Set it to `false` * for a command palette, where the search box is the enclosing overlay's only * content and one `Escape` should dismiss it rather than clear the query * first: the directive then neither acts on nor consumes the key, so the * enclosing dismissible layer sees it on the first press. */ readonly clearOnEscape: _angular_core.InputSignalWithTransform; constructor(); /** * Resets the value to `''`. No-op while the field is disabled or read-only — * the guard lives here, so every caller (the `[forSearchClear]` button, the * `Escape` key, a programmatic call, or the `[forSearchGroup]` context) gets * the same behaviour. */ clear(): void; /** * Moves focus to the native input element. Called by `[forSearchClear]` * after clearing so the user can continue typing without chasing the caret. */ focusInput(): void; /** Clears a non-empty value on `Escape`, consuming the key only when it does. */ protected onKeyDown(event: KeyboardEvent): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Optional clear button for `[forSearch]`. Apply on a ` * * ``` */ declare class ForSearchClear { #private; protected readonly buttonType: _angular_core.Signal; protected readonly group: forty_cdk_search.ForSearchGroupContext; /** * Accessible name for the clear button, exposed as `aria-label`. Defaults to * the scope's `clearAriaLabel` (`'Clear'` unless overridden via * `provideForSearchDefaults`); set `[ariaLabel]` to override per-instance, or * `null` to drop the attribute. */ readonly ariaLabel: _angular_core.InputSignal; protected readonly resolvedAriaLabel: _angular_core.Signal; /** `true` while there is text to clear; drives the self-hide logic. */ protected readonly hasContent: _angular_core.Signal; /** * Disabled when the search field is absent, disabled, or read-only — the * clear action is unavailable in those states. */ protected readonly isDisabled: _angular_core.Signal; constructor(); protected onClick(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Optional coordination wrapper for a `[forSearch]` and its companion * `[forSearchClear]` button. It renders nothing and imposes no role or layout — * its only job is to bridge the button to the search field. * * It is required _only_ when you use the clear button: a `` is a void * element and can't contain the button as a DOM descendant, so the button can't * inject the field's context directly. The group registers the `[forSearch]` * beneath it and exposes it via `field()`, which the button reads. A standalone * `[forSearch]` (keyboard / `[(value)]` only) needs no group. * * @example * ```html *
* * *
* ``` */ declare class ForSearchGroup implements ForSearchGroupContext { #private; /** The registered search field, or `null` while none is mounted. */ readonly field: Signal; /** Register the search field the group coordinates. */ register(field: ForSearchContext): void; /** Remove a previously registered search field. */ unregister(field: ForSearchContext): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Exact public names of every `ForSearch` input, its models included. Spread it into the * `inputs` array of a `hostDirectives` entry so a wrapper component re-exposes the * primitive's full surface — the Signal Forms members `[formField]` binds among them — * without hand-maintaining the list. Always spread into an inline object literal as shown * below: the literal is what keeps the entry statically analyzable for consumers compiling * against the published package. An anti-drift spec fails when this list no longer matches * the directive's actual API. See `docs/wrapping-form-primitives.md` for both supported * wrapping patterns. * * @example * ```ts * @Component({ * selector: 'input[mySearch]', * template: '', * hostDirectives: [ * { * directive: ForSearch, * inputs: [...FOR_SEARCH_HOST_DIRECTIVE_INPUTS], * outputs: [...FOR_SEARCH_HOST_DIRECTIVE_OUTPUTS], * }, * ], * }) * export class MySearch {} * ``` */ declare const FOR_SEARCH_HOST_DIRECTIVE_INPUTS: readonly ["value", "clearOnEscape", "dirty", "disabled", "errors", "invalid", "name", "pending", "readonly", "required", "touched"]; /** * Exact public names of every `ForSearch` output, the Signal Forms `touch` output * included. Spread it into the `outputs` array of the same `hostDirectives` entry as * {@link FOR_SEARCH_HOST_DIRECTIVE_INPUTS}. */ declare const FOR_SEARCH_HOST_DIRECTIVE_OUTPUTS: readonly ["valueChange", "touchedChange", "touch"]; /** * Defaults inherited by descendant search fields in the surrounding injector * scope. Configure with `provideForSearchDefaults` either at the application * root or in any component's `providers` array; partial overrides merge with * the parent scope. */ interface ForSearchDefaults { /** * Accessible name for the clear button (`[forSearchClear]`), for clear * buttons that don't set `[ariaLabel]` locally. Localize it here to * translate every search clear button in the scope. */ clearAriaLabel: string; } /** Token holding the resolved search defaults for the current scope. */ declare const FOR_SEARCH_DEFAULTS: _angular_core.InjectionToken; /** * Configures forty-cdk search defaults for this injector scope. Partial * overrides inherit unspecified keys from the parent scope (or library * defaults at the root). */ declare function provideForSearchDefaults(defaults?: Partial): Provider[]; export { FOR_SEARCH_DEFAULTS, FOR_SEARCH_GROUP, FOR_SEARCH_HOST_DIRECTIVE_INPUTS, FOR_SEARCH_HOST_DIRECTIVE_OUTPUTS, ForSearch, ForSearchClear, ForSearchGroup, injectSearchGroup, provideForSearchDefaults }; export type { ForSearchContext, ForSearchDefaults, ForSearchGroupContext };