@joralvmel/cosmos-angular 0.2.0 → 0.4.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.
Files changed (49) hide show
  1. package/README.md +38 -0
  2. package/dist/components/badge.component.d.ts +20 -0
  3. package/dist/components/badge.component.js +46 -0
  4. package/dist/components/badge.component.js.map +1 -0
  5. package/dist/components/button.component.js +3 -3
  6. package/dist/components/calendar.component.d.ts +28 -0
  7. package/dist/components/calendar.component.js +65 -0
  8. package/dist/components/calendar.component.js.map +1 -0
  9. package/dist/components/checkbox.component.d.ts +52 -0
  10. package/dist/components/checkbox.component.js +152 -0
  11. package/dist/components/checkbox.component.js.map +1 -0
  12. package/dist/components/dialog.component.d.ts +44 -0
  13. package/dist/components/dialog.component.js +106 -0
  14. package/dist/components/dialog.component.js.map +1 -0
  15. package/dist/components/icon-button.component.d.ts +26 -0
  16. package/dist/components/icon-button.component.js +83 -0
  17. package/dist/components/icon-button.component.js.map +1 -0
  18. package/dist/components/icon.component.d.ts +6 -8
  19. package/dist/components/icon.component.js +12 -22
  20. package/dist/components/icon.component.js.map +1 -1
  21. package/dist/components/listbox.component.d.ts +41 -0
  22. package/dist/components/listbox.component.js +100 -0
  23. package/dist/components/listbox.component.js.map +1 -0
  24. package/dist/components/pagination.component.d.ts +36 -0
  25. package/dist/components/pagination.component.js +129 -0
  26. package/dist/components/pagination.component.js.map +1 -0
  27. package/dist/components/popover.component.d.ts +43 -0
  28. package/dist/components/popover.component.js +101 -0
  29. package/dist/components/popover.component.js.map +1 -0
  30. package/dist/components/radio-group.component.d.ts +49 -0
  31. package/dist/components/radio-group.component.js +146 -0
  32. package/dist/components/radio-group.component.js.map +1 -0
  33. package/dist/components/select.component.d.ts +49 -0
  34. package/dist/components/select.component.js +147 -0
  35. package/dist/components/select.component.js.map +1 -0
  36. package/dist/components/switch.component.d.ts +47 -0
  37. package/dist/components/switch.component.js +135 -0
  38. package/dist/components/switch.component.js.map +1 -0
  39. package/dist/components/text-field.component.d.ts +73 -0
  40. package/dist/components/text-field.component.js +239 -0
  41. package/dist/components/text-field.component.js.map +1 -0
  42. package/dist/components/textarea.component.d.ts +54 -0
  43. package/dist/components/textarea.component.js +168 -0
  44. package/dist/components/textarea.component.js.map +1 -0
  45. package/dist/index.d.ts +28 -2
  46. package/dist/index.js +43 -1
  47. package/dist/index.js.map +1 -1
  48. package/llms.md +520 -7
  49. package/package.json +10 -10
@@ -0,0 +1,135 @@
1
+ import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, forwardRef, Input, inject, Output, } from '@angular/core';
2
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import '@joralvmel/cosmos-elements/switch';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Angular proxy of `<cosm-switch>`. The output forwards the original DOM `CustomEvent`; Forms
7
+ * integrates through `ControlValueAccessor` with a boolean value.
8
+ *
9
+ * ```html
10
+ * <cosm-switch label="Product notifications" formControlName="notifications" />
11
+ * ```
12
+ */
13
+ export class CosmSwitchComponent {
14
+ constructor() {
15
+ /** The underlying custom element. */
16
+ this.element = inject(ElementRef).nativeElement;
17
+ this.#onChange = () => { };
18
+ this.#onTouched = () => { };
19
+ this.checkedChange = new EventEmitter();
20
+ }
21
+ #onChange;
22
+ #onTouched;
23
+ set label(value) {
24
+ this.element.label = value;
25
+ }
26
+ set labelHidden(value) {
27
+ this.element.labelHidden = value;
28
+ }
29
+ /** A direct checked input is controlled; Angular Forms writes use `writeValue`. */
30
+ set checked(value) {
31
+ if (value !== undefined)
32
+ this.element.checked = value;
33
+ this.element.checkedControlled = value !== undefined;
34
+ }
35
+ set defaultChecked(value) {
36
+ this.element.defaultChecked = value;
37
+ }
38
+ set size(value) {
39
+ if (value !== undefined)
40
+ this.element.size = value;
41
+ }
42
+ set disabled(value) {
43
+ this.element.disabled = value;
44
+ }
45
+ set invalid(value) {
46
+ this.element.invalid = value;
47
+ }
48
+ set helperText(value) {
49
+ this.element.helperText = value ?? '';
50
+ }
51
+ set name(value) {
52
+ this.element.name = value;
53
+ }
54
+ set value(value) {
55
+ if (value !== undefined)
56
+ this.element.value = value;
57
+ }
58
+ /** Re-emits the original event and feeds its proposal into Angular Forms. */
59
+ handleChange(event) {
60
+ this.checkedChange.emit(event);
61
+ this.#onChange(event.detail.checked);
62
+ }
63
+ /** Marks the control touched when it loses focus. */
64
+ markTouched() {
65
+ this.#onTouched();
66
+ }
67
+ writeValue(value) {
68
+ this.element.checked = value === true;
69
+ this.element.checkedControlled = false;
70
+ }
71
+ registerOnChange(fn) {
72
+ this.#onChange = fn;
73
+ }
74
+ registerOnTouched(fn) {
75
+ this.#onTouched = fn;
76
+ }
77
+ setDisabledState(isDisabled) {
78
+ this.element.disabled = isDisabled;
79
+ }
80
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
81
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.3.0", type: CosmSwitchComponent, isStandalone: true, selector: "cosm-switch", inputs: { label: "label", labelHidden: ["labelHidden", "labelHidden", booleanAttribute], checked: "checked", defaultChecked: ["defaultChecked", "defaultChecked", booleanAttribute], size: "size", disabled: ["disabled", "disabled", booleanAttribute], invalid: ["invalid", "invalid", booleanAttribute], helperText: "helperText", name: "name", value: "value" }, outputs: { checkedChange: "checkedChange" }, host: { listeners: { "cosm-checked-change": "handleChange($event)", "focusout": "markTouched()" } }, providers: [
82
+ {
83
+ provide: NG_VALUE_ACCESSOR,
84
+ useExisting: forwardRef(() => CosmSwitchComponent),
85
+ multi: true,
86
+ },
87
+ ], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
88
+ }
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmSwitchComponent, decorators: [{
90
+ type: Component,
91
+ args: [{
92
+ selector: 'cosm-switch',
93
+ template: '',
94
+ changeDetection: ChangeDetectionStrategy.OnPush,
95
+ providers: [
96
+ {
97
+ provide: NG_VALUE_ACCESSOR,
98
+ useExisting: forwardRef(() => CosmSwitchComponent),
99
+ multi: true,
100
+ },
101
+ ],
102
+ host: {
103
+ '(cosm-checked-change)': 'handleChange($event)',
104
+ '(focusout)': 'markTouched()',
105
+ },
106
+ }]
107
+ }], propDecorators: { label: [{
108
+ type: Input,
109
+ args: [{ required: true }]
110
+ }], labelHidden: [{
111
+ type: Input,
112
+ args: [{ transform: booleanAttribute }]
113
+ }], checked: [{
114
+ type: Input
115
+ }], defaultChecked: [{
116
+ type: Input,
117
+ args: [{ transform: booleanAttribute }]
118
+ }], size: [{
119
+ type: Input
120
+ }], disabled: [{
121
+ type: Input,
122
+ args: [{ transform: booleanAttribute }]
123
+ }], invalid: [{
124
+ type: Input,
125
+ args: [{ transform: booleanAttribute }]
126
+ }], helperText: [{
127
+ type: Input
128
+ }], name: [{
129
+ type: Input
130
+ }], value: [{
131
+ type: Input
132
+ }], checkedChange: [{
133
+ type: Output
134
+ }] } });
135
+ //# sourceMappingURL=switch.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switch.component.js","sourceRoot":"","sources":["../../src/components/switch.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAA6B,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG9E,OAAO,mCAAmC,CAAC;;AAI3C;;;;;;;GAOG;AAiBH,MAAM,OAAO,mBAAmB;IAhBhC;QAiBE,qCAAqC;QAC5B,YAAO,GAAe,MAAM,CAAyB,UAAU,CAAC,CAAC,aAAa,CAAC;QAExF,cAAS,GAA6B,GAAG,EAAE,GAAE,C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AE,oBAAoB,CAAC;4BAClD,KAAK,EAAE,IAAI;yBACZ;qBACF;oBACD,IAAI,EAAE;wBACJ,uBAAuB,EAAE,sBAAsB;wBAC/C,YAAY,EAAE,eAAe;qBAC9B;iBACF;;sBAQE,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAIrC,KAAK;;sBAIL,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAIL,MAAM"}
@@ -0,0 +1,73 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { type ControlValueAccessor } from '@angular/forms';
3
+ import type { ContractProps, TextFieldChangeDetail, TextFieldSubmitDetail, textFieldContract } from '@joralvmel/cosmos-core';
4
+ import type { CosmTextField } from '@joralvmel/cosmos-elements/text-field';
5
+ import type { IconDefinition } from '@joralvmel/cosmos-icons';
6
+ import '@joralvmel/cosmos-elements/text-field';
7
+ import * as i0 from "@angular/core";
8
+ type Props = ContractProps<typeof textFieldContract, 'angular', {
9
+ IconDefinition: IconDefinition;
10
+ }>;
11
+ /**
12
+ * Angular proxy of `<cosm-text-field>`. DOM outputs re-emit the original `CustomEvent`; Forms
13
+ * integration follows `ControlValueAccessor` (including blur-based update strategies).
14
+ *
15
+ * ```html
16
+ * <cosm-text-field label="Email" formControlName="email" />
17
+ * ```
18
+ */
19
+ export declare class CosmTextFieldComponent implements ControlValueAccessor {
20
+ #private;
21
+ /** The underlying custom element. */
22
+ readonly element: CosmTextField;
23
+ set label(value: Props['label']);
24
+ set labelHidden(value: boolean);
25
+ /** A direct value input is controlled; Angular Forms writes use `writeValue` instead. */
26
+ set value(value: Props['value']);
27
+ set defaultValue(value: Props['defaultValue']);
28
+ set type(value: Props['type']);
29
+ set variant(value: Props['variant']);
30
+ set size(value: Props['size']);
31
+ set placeholder(value: Props['placeholder']);
32
+ set helperText(value: Props['helperText']);
33
+ set errorText(value: Props['errorText']);
34
+ set invalid(value: boolean);
35
+ set required(value: boolean);
36
+ set disabled(value: boolean);
37
+ set readOnly(value: boolean);
38
+ set minLength(value: Props['minLength']);
39
+ set maxLength(value: Props['maxLength']);
40
+ set pattern(value: Props['pattern']);
41
+ set name(value: Props['name']);
42
+ set autoComplete(value: Props['autoComplete']);
43
+ set inputMode(value: Props['inputMode']);
44
+ set startIcon(value: Props['startIcon']);
45
+ set endIcon(value: Props['endIcon']);
46
+ set prefix(value: Props['prefix']);
47
+ set suffix(value: Props['suffix']);
48
+ set clearable(value: boolean);
49
+ set clearLabel(value: Props['clearLabel']);
50
+ set passwordReveal(value: boolean);
51
+ set revealPasswordLabel(value: Props['revealPasswordLabel']);
52
+ set hidePasswordLabel(value: Props['hidePasswordLabel']);
53
+ readonly valueChange: EventEmitter<CustomEvent<TextFieldChangeDetail>>;
54
+ readonly submit: EventEmitter<CustomEvent<TextFieldSubmitDetail>>;
55
+ /** Re-emits the original event and feeds its proposal into Angular Forms. */
56
+ handleChange(event: CustomEvent<TextFieldChangeDetail>): void;
57
+ /** Marks the control touched when the editable control loses focus. */
58
+ markTouched(): void;
59
+ writeValue(value: string | null | undefined): void;
60
+ registerOnChange(fn: (value: string) => void): void;
61
+ registerOnTouched(fn: () => void): void;
62
+ setDisabledState(isDisabled: boolean): void;
63
+ static ɵfac: i0.ɵɵFactoryDeclaration<CosmTextFieldComponent, never>;
64
+ static ɵcmp: i0.ɵɵComponentDeclaration<CosmTextFieldComponent, "cosm-text-field", never, { "label": { "alias": "label"; "required": true; }; "labelHidden": { "alias": "labelHidden"; "required": false; }; "value": { "alias": "value"; "required": false; }; "defaultValue": { "alias": "defaultValue"; "required": false; }; "type": { "alias": "type"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "helperText": { "alias": "helperText"; "required": false; }; "errorText": { "alias": "errorText"; "required": false; }; "invalid": { "alias": "invalid"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "minLength": { "alias": "minLength"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "pattern": { "alias": "pattern"; "required": false; }; "name": { "alias": "name"; "required": false; }; "autoComplete": { "alias": "autoComplete"; "required": false; }; "inputMode": { "alias": "inputMode"; "required": false; }; "startIcon": { "alias": "startIcon"; "required": false; }; "endIcon": { "alias": "endIcon"; "required": false; }; "prefix": { "alias": "prefix"; "required": false; }; "suffix": { "alias": "suffix"; "required": false; }; "clearable": { "alias": "clearable"; "required": false; }; "clearLabel": { "alias": "clearLabel"; "required": false; }; "passwordReveal": { "alias": "passwordReveal"; "required": false; }; "revealPasswordLabel": { "alias": "revealPasswordLabel"; "required": false; }; "hidePasswordLabel": { "alias": "hidePasswordLabel"; "required": false; }; }, { "valueChange": "valueChange"; "submit": "submit"; }, never, ["*"], true, never>;
65
+ static ngAcceptInputType_labelHidden: unknown;
66
+ static ngAcceptInputType_invalid: unknown;
67
+ static ngAcceptInputType_required: unknown;
68
+ static ngAcceptInputType_disabled: unknown;
69
+ static ngAcceptInputType_readOnly: unknown;
70
+ static ngAcceptInputType_clearable: unknown;
71
+ static ngAcceptInputType_passwordReveal: unknown;
72
+ }
73
+ export {};
@@ -0,0 +1,239 @@
1
+ import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, forwardRef, Input, inject, Output, } from '@angular/core';
2
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
3
+ import '@joralvmel/cosmos-elements/text-field';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Angular proxy of `<cosm-text-field>`. DOM outputs re-emit the original `CustomEvent`; Forms
7
+ * integration follows `ControlValueAccessor` (including blur-based update strategies).
8
+ *
9
+ * ```html
10
+ * <cosm-text-field label="Email" formControlName="email" />
11
+ * ```
12
+ */
13
+ export class CosmTextFieldComponent {
14
+ constructor() {
15
+ /** The underlying custom element. */
16
+ this.element = inject(ElementRef).nativeElement;
17
+ this.#onChange = () => { };
18
+ this.#onTouched = () => { };
19
+ this.valueChange = new EventEmitter();
20
+ this.submit = new EventEmitter();
21
+ }
22
+ #onChange;
23
+ #onTouched;
24
+ set label(value) {
25
+ this.element.label = value;
26
+ }
27
+ set labelHidden(value) {
28
+ this.element.labelHidden = value;
29
+ }
30
+ /** A direct value input is controlled; Angular Forms writes use `writeValue` instead. */
31
+ set value(value) {
32
+ this.element.valueControlled = value !== undefined;
33
+ if (value !== undefined)
34
+ this.element.value = value;
35
+ }
36
+ set defaultValue(value) {
37
+ this.element.defaultValue = value ?? '';
38
+ }
39
+ set type(value) {
40
+ if (value !== undefined)
41
+ this.element.type = value;
42
+ }
43
+ set variant(value) {
44
+ if (value !== undefined)
45
+ this.element.variant = value;
46
+ }
47
+ set size(value) {
48
+ if (value !== undefined)
49
+ this.element.size = value;
50
+ }
51
+ set placeholder(value) {
52
+ this.element.placeholder = value ?? '';
53
+ }
54
+ set helperText(value) {
55
+ this.element.helperText = value ?? '';
56
+ }
57
+ set errorText(value) {
58
+ this.element.errorText = value ?? '';
59
+ }
60
+ set invalid(value) {
61
+ this.element.invalid = value;
62
+ }
63
+ set required(value) {
64
+ this.element.required = value;
65
+ }
66
+ set disabled(value) {
67
+ this.element.disabled = value;
68
+ }
69
+ set readOnly(value) {
70
+ this.element.readOnly = value;
71
+ }
72
+ set minLength(value) {
73
+ this.element.minLength = value;
74
+ }
75
+ set maxLength(value) {
76
+ this.element.maxLength = value;
77
+ }
78
+ set pattern(value) {
79
+ this.element.pattern = value;
80
+ }
81
+ set name(value) {
82
+ this.element.name = value;
83
+ }
84
+ set autoComplete(value) {
85
+ this.element.autoComplete = value;
86
+ }
87
+ set inputMode(value) {
88
+ this.element.inputMode = value ?? '';
89
+ }
90
+ set startIcon(value) {
91
+ this.element.startIcon = value;
92
+ }
93
+ set endIcon(value) {
94
+ this.element.endIcon = value;
95
+ }
96
+ set prefix(value) {
97
+ this.element.prefix = value ?? '';
98
+ }
99
+ set suffix(value) {
100
+ this.element.suffix = value ?? '';
101
+ }
102
+ set clearable(value) {
103
+ this.element.clearable = value;
104
+ }
105
+ set clearLabel(value) {
106
+ this.element.clearLabel = value;
107
+ }
108
+ set passwordReveal(value) {
109
+ this.element.passwordReveal = value;
110
+ }
111
+ set revealPasswordLabel(value) {
112
+ this.element.revealPasswordLabel = value;
113
+ }
114
+ set hidePasswordLabel(value) {
115
+ this.element.hidePasswordLabel = value;
116
+ }
117
+ /** Re-emits the original event and feeds its proposal into Angular Forms. */
118
+ handleChange(event) {
119
+ this.valueChange.emit(event);
120
+ this.#onChange(event.detail.value);
121
+ }
122
+ /** Marks the control touched when the editable control loses focus. */
123
+ markTouched() {
124
+ this.#onTouched();
125
+ }
126
+ writeValue(value) {
127
+ // CVA owns the view draft until Angular commits it (notably for updateOn: 'blur').
128
+ this.element.valueControlled = false;
129
+ this.element.value = value ?? '';
130
+ }
131
+ registerOnChange(fn) {
132
+ this.#onChange = fn;
133
+ }
134
+ registerOnTouched(fn) {
135
+ this.#onTouched = fn;
136
+ }
137
+ setDisabledState(isDisabled) {
138
+ this.element.disabled = isDisabled;
139
+ }
140
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmTextFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
141
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.3.0", type: CosmTextFieldComponent, isStandalone: true, selector: "cosm-text-field", inputs: { label: "label", labelHidden: ["labelHidden", "labelHidden", booleanAttribute], value: "value", defaultValue: "defaultValue", type: "type", variant: "variant", size: "size", placeholder: "placeholder", helperText: "helperText", errorText: "errorText", invalid: ["invalid", "invalid", booleanAttribute], required: ["required", "required", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], readOnly: ["readOnly", "readOnly", booleanAttribute], minLength: "minLength", maxLength: "maxLength", pattern: "pattern", name: "name", autoComplete: "autoComplete", inputMode: "inputMode", startIcon: "startIcon", endIcon: "endIcon", prefix: "prefix", suffix: "suffix", clearable: ["clearable", "clearable", booleanAttribute], clearLabel: "clearLabel", passwordReveal: ["passwordReveal", "passwordReveal", booleanAttribute], revealPasswordLabel: "revealPasswordLabel", hidePasswordLabel: "hidePasswordLabel" }, outputs: { valueChange: "valueChange", submit: "submit" }, host: { listeners: { "cosm-change": "handleChange($event)", "cosm-submit": "submit.emit($event)", "focusout": "markTouched()" } }, providers: [
142
+ {
143
+ provide: NG_VALUE_ACCESSOR,
144
+ useExisting: forwardRef(() => CosmTextFieldComponent),
145
+ multi: true,
146
+ },
147
+ ], ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
148
+ }
149
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmTextFieldComponent, decorators: [{
150
+ type: Component,
151
+ args: [{
152
+ selector: 'cosm-text-field',
153
+ template: '<ng-content />',
154
+ changeDetection: ChangeDetectionStrategy.OnPush,
155
+ providers: [
156
+ {
157
+ provide: NG_VALUE_ACCESSOR,
158
+ useExisting: forwardRef(() => CosmTextFieldComponent),
159
+ multi: true,
160
+ },
161
+ ],
162
+ host: {
163
+ '(cosm-change)': 'handleChange($event)',
164
+ '(cosm-submit)': 'submit.emit($event)',
165
+ '(focusout)': 'markTouched()',
166
+ },
167
+ }]
168
+ }], propDecorators: { label: [{
169
+ type: Input,
170
+ args: [{ required: true }]
171
+ }], labelHidden: [{
172
+ type: Input,
173
+ args: [{ transform: booleanAttribute }]
174
+ }], value: [{
175
+ type: Input
176
+ }], defaultValue: [{
177
+ type: Input
178
+ }], type: [{
179
+ type: Input
180
+ }], variant: [{
181
+ type: Input
182
+ }], size: [{
183
+ type: Input
184
+ }], placeholder: [{
185
+ type: Input
186
+ }], helperText: [{
187
+ type: Input
188
+ }], errorText: [{
189
+ type: Input
190
+ }], invalid: [{
191
+ type: Input,
192
+ args: [{ transform: booleanAttribute }]
193
+ }], required: [{
194
+ type: Input,
195
+ args: [{ transform: booleanAttribute }]
196
+ }], disabled: [{
197
+ type: Input,
198
+ args: [{ transform: booleanAttribute }]
199
+ }], readOnly: [{
200
+ type: Input,
201
+ args: [{ transform: booleanAttribute }]
202
+ }], minLength: [{
203
+ type: Input
204
+ }], maxLength: [{
205
+ type: Input
206
+ }], pattern: [{
207
+ type: Input
208
+ }], name: [{
209
+ type: Input
210
+ }], autoComplete: [{
211
+ type: Input
212
+ }], inputMode: [{
213
+ type: Input
214
+ }], startIcon: [{
215
+ type: Input
216
+ }], endIcon: [{
217
+ type: Input
218
+ }], prefix: [{
219
+ type: Input
220
+ }], suffix: [{
221
+ type: Input
222
+ }], clearable: [{
223
+ type: Input,
224
+ args: [{ transform: booleanAttribute }]
225
+ }], clearLabel: [{
226
+ type: Input
227
+ }], passwordReveal: [{
228
+ type: Input,
229
+ args: [{ transform: booleanAttribute }]
230
+ }], revealPasswordLabel: [{
231
+ type: Input
232
+ }], hidePasswordLabel: [{
233
+ type: Input
234
+ }], valueChange: [{
235
+ type: Output
236
+ }], submit: [{
237
+ type: Output
238
+ }] } });
239
+ //# sourceMappingURL=text-field.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-field.component.js","sourceRoot":"","sources":["../../src/components/text-field.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EAA6B,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAS9E,OAAO,uC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Q,EAAE,IAAI,EAAE;;sBAGxB,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAIrC,KAAK;;sBAIL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,KAAK;;sBAIL,MAAM;;sBACN,MAAM"}
@@ -0,0 +1,54 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { type ControlValueAccessor } from '@angular/forms';
3
+ import type { ContractProps, TextareaChangeDetail, textareaContract } from '@joralvmel/cosmos-core';
4
+ import type { CosmTextarea } from '@joralvmel/cosmos-elements/textarea';
5
+ import '@joralvmel/cosmos-elements/textarea';
6
+ import * as i0 from "@angular/core";
7
+ type Props = ContractProps<typeof textareaContract, 'angular'>;
8
+ /**
9
+ * Angular proxy of `<cosm-textarea>`. DOM outputs re-emit the original `CustomEvent`; Forms
10
+ * integration follows `ControlValueAccessor` (including blur-based update strategies).
11
+ *
12
+ * ```html
13
+ * <cosm-textarea label="Message" formControlName="message" />
14
+ * ```
15
+ */
16
+ export declare class CosmTextareaComponent implements ControlValueAccessor {
17
+ #private;
18
+ /** The underlying custom element. */
19
+ readonly element: CosmTextarea;
20
+ set label(value: Props['label']);
21
+ set labelHidden(value: boolean);
22
+ /** A direct value input is controlled; Angular Forms writes use `writeValue` instead. */
23
+ set value(value: Props['value']);
24
+ set defaultValue(value: Props['defaultValue']);
25
+ set rows(value: Props['rows']);
26
+ set variant(value: Props['variant']);
27
+ set size(value: Props['size']);
28
+ set placeholder(value: Props['placeholder']);
29
+ set helperText(value: Props['helperText']);
30
+ set errorText(value: Props['errorText']);
31
+ set invalid(value: boolean);
32
+ set required(value: boolean);
33
+ set disabled(value: boolean);
34
+ set readOnly(value: boolean);
35
+ set maxLength(value: Props['maxLength']);
36
+ set name(value: Props['name']);
37
+ readonly valueChange: EventEmitter<CustomEvent<TextareaChangeDetail>>;
38
+ /** Re-emits the original event and feeds its proposal into Angular Forms. */
39
+ handleChange(event: CustomEvent<TextareaChangeDetail>): void;
40
+ /** Marks the control touched when the editable control loses focus. */
41
+ markTouched(): void;
42
+ writeValue(value: string | null | undefined): void;
43
+ registerOnChange(fn: (value: string) => void): void;
44
+ registerOnTouched(fn: () => void): void;
45
+ setDisabledState(isDisabled: boolean): void;
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<CosmTextareaComponent, never>;
47
+ static ɵcmp: i0.ɵɵComponentDeclaration<CosmTextareaComponent, "cosm-textarea", never, { "label": { "alias": "label"; "required": true; }; "labelHidden": { "alias": "labelHidden"; "required": false; }; "value": { "alias": "value"; "required": false; }; "defaultValue": { "alias": "defaultValue"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "helperText": { "alias": "helperText"; "required": false; }; "errorText": { "alias": "errorText"; "required": false; }; "invalid": { "alias": "invalid"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; "name": { "alias": "name"; "required": false; }; }, { "valueChange": "valueChange"; }, never, ["*"], true, never>;
48
+ static ngAcceptInputType_labelHidden: unknown;
49
+ static ngAcceptInputType_invalid: unknown;
50
+ static ngAcceptInputType_required: unknown;
51
+ static ngAcceptInputType_disabled: unknown;
52
+ static ngAcceptInputType_readOnly: unknown;
53
+ }
54
+ export {};