@joralvmel/cosmos-angular 0.3.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.
- package/README.md +7 -4
- package/dist/components/badge.component.d.ts +20 -0
- package/dist/components/badge.component.js +46 -0
- package/dist/components/badge.component.js.map +1 -0
- package/dist/components/button.component.js +3 -3
- package/dist/components/calendar.component.d.ts +28 -0
- package/dist/components/calendar.component.js +65 -0
- package/dist/components/calendar.component.js.map +1 -0
- package/dist/components/checkbox.component.d.ts +52 -0
- package/dist/components/checkbox.component.js +152 -0
- package/dist/components/checkbox.component.js.map +1 -0
- package/dist/components/dialog.component.d.ts +44 -0
- package/dist/components/dialog.component.js +106 -0
- package/dist/components/dialog.component.js.map +1 -0
- package/dist/components/icon-button.component.js +3 -3
- package/dist/components/icon.component.d.ts +6 -8
- package/dist/components/icon.component.js +12 -22
- package/dist/components/icon.component.js.map +1 -1
- package/dist/components/listbox.component.js +3 -3
- package/dist/components/pagination.component.d.ts +36 -0
- package/dist/components/pagination.component.js +129 -0
- package/dist/components/pagination.component.js.map +1 -0
- package/dist/components/popover.component.d.ts +1 -10
- package/dist/components/popover.component.js +3 -32
- package/dist/components/popover.component.js.map +1 -1
- package/dist/components/radio-group.component.d.ts +49 -0
- package/dist/components/radio-group.component.js +146 -0
- package/dist/components/radio-group.component.js.map +1 -0
- package/dist/components/select.component.d.ts +49 -0
- package/dist/components/select.component.js +147 -0
- package/dist/components/select.component.js.map +1 -0
- package/dist/components/switch.component.d.ts +47 -0
- package/dist/components/switch.component.js +135 -0
- package/dist/components/switch.component.js.map +1 -0
- package/dist/components/text-field.component.d.ts +3 -4
- package/dist/components/text-field.component.js +9 -14
- package/dist/components/text-field.component.js.map +1 -1
- package/dist/components/textarea.component.d.ts +54 -0
- package/dist/components/textarea.component.js +168 -0
- package/dist/components/textarea.component.js.map +1 -0
- package/dist/index.d.ts +20 -2
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/llms.md +350 -20
- package/package.json +10 -10
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { type ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import type { ContractProps, SelectChangeDetail, SelectItems, SelectValue, selectContract } from '@joralvmel/cosmos-core';
|
|
4
|
+
import type { CosmSelect } from '@joralvmel/cosmos-elements/select';
|
|
5
|
+
import '@joralvmel/cosmos-elements/select';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
type Props = ContractProps<typeof selectContract, 'angular', {
|
|
8
|
+
SelectItems: SelectItems;
|
|
9
|
+
SelectValue: SelectValue;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Angular proxy of `<cosm-select>`. DOM outputs forward the original `CustomEvent`; Forms
|
|
13
|
+
* integrates through `ControlValueAccessor` with a string-or-null value.
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <cosm-select label="Fruit" [items]="fruitOptions" placeholder="Choose a fruit" formControlName="fruit" />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class CosmSelectComponent implements ControlValueAccessor {
|
|
20
|
+
#private;
|
|
21
|
+
readonly element: CosmSelect;
|
|
22
|
+
set label(value: Props['label']);
|
|
23
|
+
set items(value: Props['items']);
|
|
24
|
+
/** A direct value input is controlled; Angular Forms writes use `writeValue` instead. */
|
|
25
|
+
set value(value: Props['value']);
|
|
26
|
+
set defaultValue(value: Props['defaultValue']);
|
|
27
|
+
set placeholder(value: Props['placeholder']);
|
|
28
|
+
set variant(value: Props['variant']);
|
|
29
|
+
set size(value: Props['size']);
|
|
30
|
+
set disabled(value: boolean);
|
|
31
|
+
set required(value: boolean);
|
|
32
|
+
set invalid(value: boolean);
|
|
33
|
+
set helperText(value: Props['helperText']);
|
|
34
|
+
set errorText(value: Props['errorText']);
|
|
35
|
+
set name(value: Props['name']);
|
|
36
|
+
readonly valueChange: EventEmitter<CustomEvent<SelectChangeDetail>>;
|
|
37
|
+
handleChange(event: CustomEvent<SelectChangeDetail>): void;
|
|
38
|
+
markTouched(): void;
|
|
39
|
+
writeValue(value: string | null | undefined): void;
|
|
40
|
+
registerOnChange(fn: (value: string | null) => void): void;
|
|
41
|
+
registerOnTouched(fn: () => void): void;
|
|
42
|
+
setDisabledState(isDisabled: boolean): void;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CosmSelectComponent, never>;
|
|
44
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CosmSelectComponent, "cosm-select", never, { "label": { "alias": "label"; "required": true; }; "items": { "alias": "items"; "required": true; }; "value": { "alias": "value"; "required": false; }; "defaultValue": { "alias": "defaultValue"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": true; }; "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "invalid": { "alias": "invalid"; "required": false; }; "helperText": { "alias": "helperText"; "required": false; }; "errorText": { "alias": "errorText"; "required": false; }; "name": { "alias": "name"; "required": false; }; }, { "valueChange": "valueChange"; }, never, ["*"], true, never>;
|
|
45
|
+
static ngAcceptInputType_disabled: unknown;
|
|
46
|
+
static ngAcceptInputType_required: unknown;
|
|
47
|
+
static ngAcceptInputType_invalid: unknown;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
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/select';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Angular proxy of `<cosm-select>`. DOM outputs forward the original `CustomEvent`; Forms
|
|
7
|
+
* integrates through `ControlValueAccessor` with a string-or-null value.
|
|
8
|
+
*
|
|
9
|
+
* ```html
|
|
10
|
+
* <cosm-select label="Fruit" [items]="fruitOptions" placeholder="Choose a fruit" formControlName="fruit" />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export class CosmSelectComponent {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.element = inject(ElementRef).nativeElement;
|
|
16
|
+
this.#onChange = () => { };
|
|
17
|
+
this.#onTouched = () => { };
|
|
18
|
+
this.valueChange = new EventEmitter();
|
|
19
|
+
}
|
|
20
|
+
#onChange;
|
|
21
|
+
#onTouched;
|
|
22
|
+
set label(value) {
|
|
23
|
+
this.element.label = value;
|
|
24
|
+
}
|
|
25
|
+
set items(value) {
|
|
26
|
+
this.element.items = value;
|
|
27
|
+
}
|
|
28
|
+
/** A direct value input is controlled; Angular Forms writes use `writeValue` instead. */
|
|
29
|
+
set value(value) {
|
|
30
|
+
this.element.valueControlled = value !== undefined;
|
|
31
|
+
if (value !== undefined)
|
|
32
|
+
this.element.value = value;
|
|
33
|
+
}
|
|
34
|
+
set defaultValue(value) {
|
|
35
|
+
if (value !== undefined)
|
|
36
|
+
this.element.defaultValue = value;
|
|
37
|
+
}
|
|
38
|
+
set placeholder(value) {
|
|
39
|
+
this.element.placeholder = value;
|
|
40
|
+
}
|
|
41
|
+
set variant(value) {
|
|
42
|
+
this.element.variant = value ?? 'outlined';
|
|
43
|
+
}
|
|
44
|
+
set size(value) {
|
|
45
|
+
this.element.size = value ?? 'md';
|
|
46
|
+
}
|
|
47
|
+
set disabled(value) {
|
|
48
|
+
this.element.disabled = value;
|
|
49
|
+
}
|
|
50
|
+
set required(value) {
|
|
51
|
+
this.element.required = value;
|
|
52
|
+
}
|
|
53
|
+
set invalid(value) {
|
|
54
|
+
this.element.invalid = value;
|
|
55
|
+
}
|
|
56
|
+
set helperText(value) {
|
|
57
|
+
this.element.helperText = value ?? '';
|
|
58
|
+
}
|
|
59
|
+
set errorText(value) {
|
|
60
|
+
this.element.errorText = value ?? '';
|
|
61
|
+
}
|
|
62
|
+
set name(value) {
|
|
63
|
+
this.element.name = value;
|
|
64
|
+
}
|
|
65
|
+
handleChange(event) {
|
|
66
|
+
this.valueChange.emit(event);
|
|
67
|
+
this.#onChange(event.detail.value);
|
|
68
|
+
}
|
|
69
|
+
markTouched() {
|
|
70
|
+
this.#onTouched();
|
|
71
|
+
}
|
|
72
|
+
writeValue(value) {
|
|
73
|
+
this.element.value = value ?? null;
|
|
74
|
+
this.element.valueControlled = false;
|
|
75
|
+
}
|
|
76
|
+
registerOnChange(fn) {
|
|
77
|
+
this.#onChange = fn;
|
|
78
|
+
}
|
|
79
|
+
registerOnTouched(fn) {
|
|
80
|
+
this.#onTouched = fn;
|
|
81
|
+
}
|
|
82
|
+
setDisabledState(isDisabled) {
|
|
83
|
+
this.element.disabled = isDisabled;
|
|
84
|
+
}
|
|
85
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
86
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.3.0", type: CosmSelectComponent, isStandalone: true, selector: "cosm-select", inputs: { label: "label", items: "items", value: "value", defaultValue: "defaultValue", placeholder: "placeholder", variant: "variant", size: "size", disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute], invalid: ["invalid", "invalid", booleanAttribute], helperText: "helperText", errorText: "errorText", name: "name" }, outputs: { valueChange: "valueChange" }, host: { listeners: { "cosm-change": "handleChange($event)", "focusout": "markTouched()" } }, providers: [
|
|
87
|
+
{
|
|
88
|
+
provide: NG_VALUE_ACCESSOR,
|
|
89
|
+
useExisting: forwardRef(() => CosmSelectComponent),
|
|
90
|
+
multi: true,
|
|
91
|
+
},
|
|
92
|
+
], ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
93
|
+
}
|
|
94
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmSelectComponent, decorators: [{
|
|
95
|
+
type: Component,
|
|
96
|
+
args: [{
|
|
97
|
+
selector: 'cosm-select',
|
|
98
|
+
template: '<ng-content />',
|
|
99
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
100
|
+
providers: [
|
|
101
|
+
{
|
|
102
|
+
provide: NG_VALUE_ACCESSOR,
|
|
103
|
+
useExisting: forwardRef(() => CosmSelectComponent),
|
|
104
|
+
multi: true,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
host: {
|
|
108
|
+
'(cosm-change)': 'handleChange($event)',
|
|
109
|
+
'(focusout)': 'markTouched()',
|
|
110
|
+
},
|
|
111
|
+
}]
|
|
112
|
+
}], propDecorators: { label: [{
|
|
113
|
+
type: Input,
|
|
114
|
+
args: [{ required: true }]
|
|
115
|
+
}], items: [{
|
|
116
|
+
type: Input,
|
|
117
|
+
args: [{ required: true }]
|
|
118
|
+
}], value: [{
|
|
119
|
+
type: Input
|
|
120
|
+
}], defaultValue: [{
|
|
121
|
+
type: Input
|
|
122
|
+
}], placeholder: [{
|
|
123
|
+
type: Input,
|
|
124
|
+
args: [{ required: true }]
|
|
125
|
+
}], variant: [{
|
|
126
|
+
type: Input
|
|
127
|
+
}], size: [{
|
|
128
|
+
type: Input
|
|
129
|
+
}], disabled: [{
|
|
130
|
+
type: Input,
|
|
131
|
+
args: [{ transform: booleanAttribute }]
|
|
132
|
+
}], required: [{
|
|
133
|
+
type: Input,
|
|
134
|
+
args: [{ transform: booleanAttribute }]
|
|
135
|
+
}], invalid: [{
|
|
136
|
+
type: Input,
|
|
137
|
+
args: [{ transform: booleanAttribute }]
|
|
138
|
+
}], helperText: [{
|
|
139
|
+
type: Input
|
|
140
|
+
}], errorText: [{
|
|
141
|
+
type: Input
|
|
142
|
+
}], name: [{
|
|
143
|
+
type: Input
|
|
144
|
+
}], valueChange: [{
|
|
145
|
+
type: Output
|
|
146
|
+
}] } });
|
|
147
|
+
//# sourceMappingURL=select.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.component.js","sourceRoot":"","sources":["../../src/components/select.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,mCAAmC,CAAC;;AAQ3C;;;;;;;GAOG;AAiBH,MAAM,OAAO,mBAAmB;IAhBhC;QAiBW,YAAO,GAAe,MAAM,CAAyB,UAAU,CAAC,CAAC,aAAa,CAAC;QAExF,cAAS,GAAmC,GAAG,EAAE,GAAE,CAAC,CAAC;QACrD,eAAU,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;QA4Cf,gBAAW,GAAG,IAAI,YAAY,EAAmC,CAAC;KA2BtF;IAxEC,SAAS,CAA4C;IACrD,UAAU,CAAwB;IAElC,IAA+B,KAAK,CAAC,KAAqB;QACxD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7B,CAAC;IACD,IAA+B,KAAK,CAAC,KAAqB;QACxD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7B,CAAC;IACD,yFAAyF;IACzF,IAAa,KAAK,CAAC,KAAqB;QACtC,IAAI,CAAC,OAAO,CAAC,eAAe,GAAG,KAAK,KAAK,SAAS,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IACtD,CAAC;IACD,IAAa,YAAY,CAAC,KAA4B;QACpD,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,KAAK,CAAC;IAC7D,CAAC;IAC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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,47 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { type ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import type { SwitchCheckedChangeDetail, switchContract } from '@joralvmel/cosmos-core';
|
|
4
|
+
import type { CosmSwitch } from '@joralvmel/cosmos-elements/switch';
|
|
5
|
+
import '@joralvmel/cosmos-elements/switch';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
type Props = import('@joralvmel/cosmos-core').ContractProps<typeof switchContract, 'angular'>;
|
|
8
|
+
/**
|
|
9
|
+
* Angular proxy of `<cosm-switch>`. The output forwards the original DOM `CustomEvent`; Forms
|
|
10
|
+
* integrates through `ControlValueAccessor` with a boolean value.
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <cosm-switch label="Product notifications" formControlName="notifications" />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class CosmSwitchComponent implements ControlValueAccessor {
|
|
17
|
+
#private;
|
|
18
|
+
/** The underlying custom element. */
|
|
19
|
+
readonly element: CosmSwitch;
|
|
20
|
+
set label(value: Props['label']);
|
|
21
|
+
set labelHidden(value: boolean);
|
|
22
|
+
/** A direct checked input is controlled; Angular Forms writes use `writeValue`. */
|
|
23
|
+
set checked(value: Props['checked']);
|
|
24
|
+
set defaultChecked(value: boolean);
|
|
25
|
+
set size(value: Props['size']);
|
|
26
|
+
set disabled(value: boolean);
|
|
27
|
+
set invalid(value: boolean);
|
|
28
|
+
set helperText(value: Props['helperText']);
|
|
29
|
+
set name(value: Props['name']);
|
|
30
|
+
set value(value: Props['value']);
|
|
31
|
+
readonly checkedChange: EventEmitter<CustomEvent<SwitchCheckedChangeDetail>>;
|
|
32
|
+
/** Re-emits the original event and feeds its proposal into Angular Forms. */
|
|
33
|
+
handleChange(event: CustomEvent<SwitchCheckedChangeDetail>): void;
|
|
34
|
+
/** Marks the control touched when it loses focus. */
|
|
35
|
+
markTouched(): void;
|
|
36
|
+
writeValue(value: boolean | null | undefined): void;
|
|
37
|
+
registerOnChange(fn: (value: boolean) => void): void;
|
|
38
|
+
registerOnTouched(fn: () => void): void;
|
|
39
|
+
setDisabledState(isDisabled: boolean): void;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CosmSwitchComponent, never>;
|
|
41
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CosmSwitchComponent, "cosm-switch", never, { "label": { "alias": "label"; "required": true; }; "labelHidden": { "alias": "labelHidden"; "required": false; }; "checked": { "alias": "checked"; "required": false; }; "defaultChecked": { "alias": "defaultChecked"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "invalid": { "alias": "invalid"; "required": false; }; "helperText": { "alias": "helperText"; "required": false; }; "name": { "alias": "name"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "checkedChange": "checkedChange"; }, never, never, true, never>;
|
|
42
|
+
static ngAcceptInputType_labelHidden: unknown;
|
|
43
|
+
static ngAcceptInputType_defaultChecked: unknown;
|
|
44
|
+
static ngAcceptInputType_disabled: unknown;
|
|
45
|
+
static ngAcceptInputType_invalid: unknown;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -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":"A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mCAGhB,gBAAgB,0NAvCzB;YACT;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC;gBAClD,KAAK,EAAE,IAAI;aACZ;SACF,0BARS,EAAE;;2FAcD,mBAAmB;kBAhB/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,aAAa;oBACvB,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,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"}
|
|
@@ -29,8 +29,8 @@ export declare class CosmTextFieldComponent implements ControlValueAccessor {
|
|
|
29
29
|
set variant(value: Props['variant']);
|
|
30
30
|
set size(value: Props['size']);
|
|
31
31
|
set placeholder(value: Props['placeholder']);
|
|
32
|
-
set
|
|
33
|
-
set
|
|
32
|
+
set helperText(value: Props['helperText']);
|
|
33
|
+
set errorText(value: Props['errorText']);
|
|
34
34
|
set invalid(value: boolean);
|
|
35
35
|
set required(value: boolean);
|
|
36
36
|
set disabled(value: boolean);
|
|
@@ -43,7 +43,6 @@ export declare class CosmTextFieldComponent implements ControlValueAccessor {
|
|
|
43
43
|
set inputMode(value: Props['inputMode']);
|
|
44
44
|
set startIcon(value: Props['startIcon']);
|
|
45
45
|
set endIcon(value: Props['endIcon']);
|
|
46
|
-
set iconFocusScope(value: Props['iconFocusScope']);
|
|
47
46
|
set prefix(value: Props['prefix']);
|
|
48
47
|
set suffix(value: Props['suffix']);
|
|
49
48
|
set clearable(value: boolean);
|
|
@@ -62,7 +61,7 @@ export declare class CosmTextFieldComponent implements ControlValueAccessor {
|
|
|
62
61
|
registerOnTouched(fn: () => void): void;
|
|
63
62
|
setDisabledState(isDisabled: boolean): void;
|
|
64
63
|
static ɵfac: i0.ɵɵFactoryDeclaration<CosmTextFieldComponent, never>;
|
|
65
|
-
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; }; "
|
|
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>;
|
|
66
65
|
static ngAcceptInputType_labelHidden: unknown;
|
|
67
66
|
static ngAcceptInputType_invalid: unknown;
|
|
68
67
|
static ngAcceptInputType_required: unknown;
|
|
@@ -51,11 +51,11 @@ export class CosmTextFieldComponent {
|
|
|
51
51
|
set placeholder(value) {
|
|
52
52
|
this.element.placeholder = value ?? '';
|
|
53
53
|
}
|
|
54
|
-
set
|
|
55
|
-
this.element.
|
|
54
|
+
set helperText(value) {
|
|
55
|
+
this.element.helperText = value ?? '';
|
|
56
56
|
}
|
|
57
|
-
set
|
|
58
|
-
this.element.
|
|
57
|
+
set errorText(value) {
|
|
58
|
+
this.element.errorText = value ?? '';
|
|
59
59
|
}
|
|
60
60
|
set invalid(value) {
|
|
61
61
|
this.element.invalid = value;
|
|
@@ -93,9 +93,6 @@ export class CosmTextFieldComponent {
|
|
|
93
93
|
set endIcon(value) {
|
|
94
94
|
this.element.endIcon = value;
|
|
95
95
|
}
|
|
96
|
-
set iconFocusScope(value) {
|
|
97
|
-
this.element.iconFocusScope = value ?? 'control';
|
|
98
|
-
}
|
|
99
96
|
set prefix(value) {
|
|
100
97
|
this.element.prefix = value ?? '';
|
|
101
98
|
}
|
|
@@ -140,8 +137,8 @@ export class CosmTextFieldComponent {
|
|
|
140
137
|
setDisabledState(isDisabled) {
|
|
141
138
|
this.element.disabled = isDisabled;
|
|
142
139
|
}
|
|
143
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.
|
|
144
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.
|
|
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: [
|
|
145
142
|
{
|
|
146
143
|
provide: NG_VALUE_ACCESSOR,
|
|
147
144
|
useExisting: forwardRef(() => CosmTextFieldComponent),
|
|
@@ -149,7 +146,7 @@ export class CosmTextFieldComponent {
|
|
|
149
146
|
},
|
|
150
147
|
], ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
151
148
|
}
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.
|
|
149
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmTextFieldComponent, decorators: [{
|
|
153
150
|
type: Component,
|
|
154
151
|
args: [{
|
|
155
152
|
selector: 'cosm-text-field',
|
|
@@ -186,9 +183,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImpor
|
|
|
186
183
|
type: Input
|
|
187
184
|
}], placeholder: [{
|
|
188
185
|
type: Input
|
|
189
|
-
}],
|
|
186
|
+
}], helperText: [{
|
|
190
187
|
type: Input
|
|
191
|
-
}],
|
|
188
|
+
}], errorText: [{
|
|
192
189
|
type: Input
|
|
193
190
|
}], invalid: [{
|
|
194
191
|
type: Input,
|
|
@@ -218,8 +215,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImpor
|
|
|
218
215
|
type: Input
|
|
219
216
|
}], endIcon: [{
|
|
220
217
|
type: Input
|
|
221
|
-
}], iconFocusScope: [{
|
|
222
|
-
type: Input
|
|
223
218
|
}], prefix: [{
|
|
224
219
|
type: Input
|
|
225
220
|
}], suffix: [{
|
|
@@ -1 +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,uCAAuC,CAAC;;AAI/C;;;;;;;GAOG;AAkBH,MAAM,OAAO,sBAAsB;IAjBnC;QAkBE,qCAAqC;QAC5B,YAAO,GAAkB,MAAM,CAA4B,UAAU,CAAC,CAAC,aAAa,CAAC;QAE9F,cAAS,GAA4B,GAAG,EAAE,GAAE,CAAC,CAAC;QAC9C,eAAU,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;
|
|
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,uCAAuC,CAAC;;AAI/C;;;;;;;GAOG;AAkBH,MAAM,OAAO,sBAAsB;IAjBnC;QAkBE,qCAAqC;QAC5B,YAAO,GAAkB,MAAM,CAA4B,UAAU,CAAC,CAAC,aAAa,CAAC;QAE9F,cAAS,GAA4B,GAAG,EAAE,GAAE,CAAC,CAAC;QAC9C,eAAU,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;QA4Ff,gBAAW,GAAG,IAAI,YAAY,EAAsC,CAAC;QACrE,WAAM,GAAG,IAAI,YAAY,EAAsC,CAAC;KA8BpF;IA5HC,SAAS,CAAqC;IAC9C,UAAU,CAAwB;IAElC,IAA+B,KAAK,CAAC,KAAqB;QACxD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7B,CAAC;IACD,IAA4C,WAAW,CAAC,KAAc;QACpE,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;IACnC,CAAC;IACD,yFAAyF;IACzF,IAAa,KAAK,CAAC,KAAqB;QACtC,IAAI,CAAC,OAAO,CAAC,eAAe,GAAG,KAAK,KAAK,SAAS,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAA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
@@ -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 {};
|