@compsych-ui-components/angular 7.0.26 → 7.0.31

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.
@@ -0,0 +1,120 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { SafeHtml } from '@angular/platform-browser';
3
+ import { ControlValueAccessor, NgControl } from '@angular/forms';
4
+ import { ListboxValueChangeEvent } from '@angular/cdk/listbox';
5
+ import { ConnectedPosition } from '@angular/cdk/overlay';
6
+ import { DropdownOption, DropdownSize } from './dropdown-types';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * A labelled single-select dropdown built on the CDK Listbox (`@angular/cdk/listbox`)
10
+ * and CDK Overlay. The trigger renders the closed field (label, placeholder/selected
11
+ * value and chevron); the options open in an overlay panel with full keyboard support
12
+ * (arrow keys, Home/End, typeahead) provided by the CDK listbox.
13
+ *
14
+ * Implements `ControlValueAccessor` so it works with both reactive forms
15
+ * (`formControlName`, `[formControl]`) and template-driven forms (`ngModel`). The error
16
+ * visual state is driven automatically by the bound `FormControl`'s validity once the
17
+ * field has been touched, and can also be set explicitly via the `error` input.
18
+ */
19
+ export declare class DropdownComponent implements ControlValueAccessor {
20
+ private readonly _autoId;
21
+ private readonly cdr;
22
+ private readonly sanitizer;
23
+ private _onChange;
24
+ private _onTouched;
25
+ /** Injected when the component is used inside a reactive or template-driven form. */
26
+ protected readonly ngControl: NgControl | null;
27
+ constructor();
28
+ private triggerBtn?;
29
+ private listboxEl?;
30
+ /** Label displayed above the trigger. */
31
+ label: string;
32
+ /** Text shown in the trigger when no option is selected. */
33
+ placeholder: string;
34
+ /** Currently selected value. When used in a form, the form controls the value. */
35
+ value: string;
36
+ /** Selectable options rendered in the overlay panel. */
37
+ options: DropdownOption[];
38
+ /** Size variant — controls height, padding, and font size. Defaults to `'medium'`. */
39
+ size: DropdownSize;
40
+ /** Native `id` attribute for the trigger. Auto-generated if omitted. */
41
+ id?: string;
42
+ /**
43
+ * Id(s) of external elements that describe the field, space-separated.
44
+ * Forwarded to `aria-describedby` on the trigger.
45
+ */
46
+ ariaDescribedBy?: string;
47
+ /** Text displayed below the trigger. Shown in red when in error state. */
48
+ supportingText: string;
49
+ /**
50
+ * Static error text shown in red when in error state. Used when the dropdown is
51
+ * outside a form (with `[error]="true"`). When inside a form, prefer `errorMessages`.
52
+ */
53
+ errorMessage: string;
54
+ /**
55
+ * Map of Angular validator error keys to display strings. The component reads
56
+ * `ngControl.errors` to determine which validator failed and shows the matching
57
+ * message in red below the trigger. Example: `{ required: 'Please choose an option' }`
58
+ */
59
+ errorMessages: Record<string, string>;
60
+ /**
61
+ * Adds a blue asterisk after the label. When used in a form, this is set
62
+ * automatically if the bound `FormControl` has `Validators.required`.
63
+ * Supports boolean coercion.
64
+ */
65
+ required: boolean;
66
+ /**
67
+ * Applies the error visual state (red border) explicitly. When used in a form,
68
+ * the error state is driven automatically from the `FormControl`'s validity once
69
+ * the field is touched — this input is only needed outside of forms. Supports boolean coercion.
70
+ */
71
+ error: boolean;
72
+ /** Disables the dropdown. When used in a form, also responds to `FormControl.disable()`. Supports boolean coercion. */
73
+ disabled: boolean;
74
+ /** Visually hides the label while keeping it accessible to screen readers. Supports boolean coercion. */
75
+ hideLabel: boolean;
76
+ /** Emits the newly selected value whenever the user picks an option. */
77
+ readonly valueChange: EventEmitter<string>;
78
+ /** Emitted when the overlay panel opens. */
79
+ readonly opened: EventEmitter<void>;
80
+ /** Emitted when the overlay panel closes. */
81
+ readonly closed: EventEmitter<void>;
82
+ protected readonly chevronSvg: SafeHtml;
83
+ protected readonly checkSvg: SafeHtml;
84
+ protected isOpen: boolean;
85
+ protected overlayWidth: number;
86
+ protected readonly overlayPositions: ConnectedPosition[];
87
+ private buildIconSvg;
88
+ get triggerId(): string;
89
+ get labelId(): string;
90
+ get listboxId(): string;
91
+ get selectedOption(): DropdownOption | undefined;
92
+ /** Value array bound to the CDK listbox (single-select, so 0 or 1 entry). */
93
+ get listboxValue(): readonly string[];
94
+ /** True when the bound FormControl is invalid and touched, or when `error` is explicitly set. */
95
+ get hasError(): boolean;
96
+ /** True when `required` is set explicitly, or when the bound FormControl has Validators.required. */
97
+ get isRequired(): boolean;
98
+ private get activeErrorMessage();
99
+ get displayedSupportingText(): string;
100
+ get describedBy(): string | null;
101
+ get wrapperClasses(): string;
102
+ protected toggle(): void;
103
+ protected open(): void;
104
+ protected close(refocus?: boolean): void;
105
+ protected onPanelAttach(): void;
106
+ protected onTriggerKeydown(event: KeyboardEvent): void;
107
+ protected onListboxKeydown(event: KeyboardEvent): void;
108
+ protected onListboxValueChange(event: ListboxValueChangeEvent<string>): void;
109
+ writeValue(value: string | null): void;
110
+ registerOnChange(fn: (value: string) => void): void;
111
+ registerOnTouched(fn: () => void): void;
112
+ /** Called by Angular when the bound FormControl is programmatically disabled or enabled. */
113
+ setDisabledState(isDisabled: boolean): void;
114
+ static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, never>;
115
+ static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "compsych-dropdown", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "value": { "alias": "value"; "required": false; }; "options": { "alias": "options"; "required": false; }; "size": { "alias": "size"; "required": false; }; "id": { "alias": "id"; "required": false; }; "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; }; "supportingText": { "alias": "supportingText"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "errorMessages": { "alias": "errorMessages"; "required": false; }; "required": { "alias": "required"; "required": false; }; "error": { "alias": "error"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hideLabel": { "alias": "hideLabel"; "required": false; }; }, { "valueChange": "valueChange"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
116
+ static ngAcceptInputType_required: unknown;
117
+ static ngAcceptInputType_error: unknown;
118
+ static ngAcceptInputType_disabled: unknown;
119
+ static ngAcceptInputType_hideLabel: unknown;
120
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compsych-ui-components/angular",
3
- "version": "7.0.26",
3
+ "version": "7.0.31",
4
4
  "description": "Angular UI components for compsych",
5
5
  "publishConfig": {
6
6
  "access": "public",