@funidata/ngx-fudis
Version:
Funidata Design System.
129 lines (128 loc) • 5.66 kB
TypeScript
import { AfterViewInit, ElementRef, OnChanges, OnDestroy, OnInit, AfterContentInit } from '@angular/core';
import { FudisGridWidth, FudisGridAlign } from '../../../types/grid';
import { FudisComponentChanges } from '../../../types/miscellaneous';
import { FudisIdService } from '../../../services/id/id.service';
import { FudisInternalErrorSummaryService } from '../../../services/form/error-summary/internal-error-summary.service';
import { FudisSelectionGroupInputSize } from '../../../types/forms';
import { FudisTranslationService } from '../../../services/translation/translation.service';
import { FudisFocusService } from '../../../services/focus/focus.service';
import { PopoverApiDirective } from '../../../directives/popover/popover-api.directive';
import * as i0 from "@angular/core";
export declare class FieldSetComponent extends PopoverApiDirective implements AfterViewInit, OnInit, OnDestroy, OnChanges, AfterContentInit {
protected _translationService: FudisTranslationService;
private _element;
private _errorSummaryService;
private _focusService;
private _idService;
constructor(_translationService: FudisTranslationService, _element: ElementRef, _errorSummaryService: FudisInternalErrorSummaryService, _focusService: FudisFocusService, _idService: FudisIdService);
/**
* Legend elementRef to trigger initialFocus
*/
private _fieldsetLegend;
/**
* Label for the Fieldset component.
*/
label: string;
/**
* Maximum width of Grid. When viewport gets narrower, grid automatically adjusts to lower sizes.
*
* - Xxl = Default value. Viewports of 1600px and larger
* - Xl = Viewports smaller than 1600px
* - Lg = Viewports smaller than 1200px
* - Md = Viewports smaller than 992px
* - Sm = Viewports smaller than 768px
* - Xs = Viewports smaller than 576px
*/
width: FudisGridWidth;
/**
* Overrides 'width' input. Used to set Checkbox Group and Radio Button Group as wide as other
* basic form components.
*/
inputSize: FudisSelectionGroupInputSize;
/**
* Alignment of Grid component inside its parent
*/
align: FudisGridAlign;
/**
* Set focus to Fieldset when it appears first time
*/
initialFocus: boolean;
/**
* Send information about current Fieldset to Error Summary Service. Error Summary Breadcrumb is
* the label of the current Fieldset and is visible in the clickable link in Error Summary.
*/
errorSummaryBreadcrumb: boolean;
/**
* Display "Required" text next to Fieldset main label.
*/
required: boolean | null;
/**
* Visual size of label legend. Default 'md' and 'sm' is similar to standard input label, used in
* e. g. RadioButtonGroup.
*/
labelSize: 'md' | 'sm';
/**
* Fieldset id. If not provided when component is initialized, generated by Id Service
*/
id: string;
/**
* Help text, aligned underneath the input.
*/
helpText: string | undefined;
/**
* Used to vertically align Legend label with similar Label elements with varying heights. By
* default `false`, but set `true` in Checkbox Group and Radio Button Group
*/
syncLegendHeight: boolean;
/**
* CSS classes for the native fieldset HTMLelement
*/
protected _classes: string[];
/**
* Used to set visible focus on if focus event comes from Error Summary link.
*/
protected _legendFocusVisible: boolean;
/**
* Has Fieldset been added to Error Summary
*/
private _fieldsetSent;
/**
* Private reference to Guidance
*/
private _fieldsetGuidance;
private _parentFormId;
/**
* To observe size changes of this Label and trigger height calculation as needed
*/
private _resizeObserver;
ngOnInit(): void;
ngAfterContentInit(): void;
ngAfterViewInit(): void;
ngOnChanges(changes: FudisComponentChanges<FieldSetComponent>): void;
ngOnDestroy(): void;
protected _handleLegendBlur(): void;
protected _handleFocus(event: FocusEvent): void;
/**
* Determines if Fieldset has CheckboxGroup or RadioButtonGroup as a parent. If so, adds Guidance
* helptext as part of the Fieldset legend element and makes it accessible for screen readers.
*/
private _hasSelectionGroupParent;
/**
* Add Fieldset label to Error Summary
*/
private _addToErrorSummary;
/**
* Remove Fieldset label from Error Summary
*/
private _removeFromErrorSummary;
/**
* Set CSS classes for native fieldset HTMLelement
*/
private _setClasses;
/**
* Add or generate id with IdService
*/
private _setFieldsetId;
static ɵfac: i0.ɵɵFactoryDeclaration<FieldSetComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<FieldSetComponent, "fudis-fieldset", never, { "label": { "alias": "label"; "required": true; }; "width": { "alias": "width"; "required": false; }; "inputSize": { "alias": "inputSize"; "required": false; }; "align": { "alias": "align"; "required": false; }; "initialFocus": { "alias": "initialFocus"; "required": false; }; "errorSummaryBreadcrumb": { "alias": "errorSummaryBreadcrumb"; "required": false; }; "required": { "alias": "required"; "required": false; }; "labelSize": { "alias": "labelSize"; "required": false; }; "id": { "alias": "id"; "required": false; }; "helpText": { "alias": "helpText"; "required": false; }; "syncLegendHeight": { "alias": "syncLegendHeight"; "required": false; }; }, {}, never, ["fudis-fieldset-actions", "fudis-fieldset-content"], false, never>;
}