@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.
- package/README.md +38 -0
- 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.d.ts +26 -0
- package/dist/components/icon-button.component.js +83 -0
- package/dist/components/icon-button.component.js.map +1 -0
- 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.d.ts +41 -0
- package/dist/components/listbox.component.js +100 -0
- package/dist/components/listbox.component.js.map +1 -0
- 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 +43 -0
- package/dist/components/popover.component.js +101 -0
- package/dist/components/popover.component.js.map +1 -0
- 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 +73 -0
- package/dist/components/text-field.component.js +239 -0
- package/dist/components/text-field.component.js.map +1 -0
- 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 +28 -2
- package/dist/index.js +43 -1
- package/dist/index.js.map +1 -1
- package/llms.md +520 -7
- package/package.json +10 -10
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, inject, Output, } from '@angular/core';
|
|
2
|
+
import '@joralvmel/cosmos-elements/popover';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
function optionalBooleanAttribute(value) {
|
|
5
|
+
return value === undefined ? undefined : booleanAttribute(value);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Angular proxy of `<cosm-popover>`. Inputs are forwarded to the element and `(openChange)`
|
|
9
|
+
* re-emits the original cancelable DOM `CustomEvent`.
|
|
10
|
+
*
|
|
11
|
+
* ```html
|
|
12
|
+
* <cosm-popover [open]="isOpen" (openChange)="onOpenChange($event)">
|
|
13
|
+
* <button slot="trigger">Show details</button>
|
|
14
|
+
* <p>Consumer-owned content and semantics.</p>
|
|
15
|
+
* </cosm-popover>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export class CosmPopoverComponent {
|
|
19
|
+
constructor() {
|
|
20
|
+
/** The underlying custom element and imperative `requestClose()` handle. */
|
|
21
|
+
this.element = inject(ElementRef).nativeElement;
|
|
22
|
+
this.openChange = new EventEmitter();
|
|
23
|
+
}
|
|
24
|
+
set open(value) {
|
|
25
|
+
this.element.open = value;
|
|
26
|
+
}
|
|
27
|
+
set defaultOpen(value) {
|
|
28
|
+
this.element.defaultOpen = value;
|
|
29
|
+
}
|
|
30
|
+
set triggerMode(value) {
|
|
31
|
+
if (value !== undefined)
|
|
32
|
+
this.element.triggerMode = value;
|
|
33
|
+
}
|
|
34
|
+
set closable(value) {
|
|
35
|
+
this.element.closable = value;
|
|
36
|
+
}
|
|
37
|
+
set closeLabel(value) {
|
|
38
|
+
this.element.closeLabel = value;
|
|
39
|
+
}
|
|
40
|
+
set arrow(value) {
|
|
41
|
+
this.element.arrow = value;
|
|
42
|
+
}
|
|
43
|
+
set closeOnEscape(value) {
|
|
44
|
+
this.element.closeOnEscape = value;
|
|
45
|
+
}
|
|
46
|
+
set closeOnOutsidePress(value) {
|
|
47
|
+
this.element.closeOnOutsidePress = value;
|
|
48
|
+
}
|
|
49
|
+
set side(value) {
|
|
50
|
+
if (value !== undefined)
|
|
51
|
+
this.element.side = value;
|
|
52
|
+
}
|
|
53
|
+
set align(value) {
|
|
54
|
+
if (value !== undefined)
|
|
55
|
+
this.element.align = value;
|
|
56
|
+
}
|
|
57
|
+
/** Proposes an action close only while the panel is open. */
|
|
58
|
+
requestClose() {
|
|
59
|
+
this.element.requestClose();
|
|
60
|
+
}
|
|
61
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
62
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.3.0", type: CosmPopoverComponent, isStandalone: true, selector: "cosm-popover", inputs: { open: ["open", "open", optionalBooleanAttribute], defaultOpen: ["defaultOpen", "defaultOpen", booleanAttribute], triggerMode: "triggerMode", closable: ["closable", "closable", booleanAttribute], closeLabel: "closeLabel", arrow: ["arrow", "arrow", booleanAttribute], closeOnEscape: ["closeOnEscape", "closeOnEscape", booleanAttribute], closeOnOutsidePress: ["closeOnOutsidePress", "closeOnOutsidePress", booleanAttribute], side: "side", align: "align" }, outputs: { openChange: "openChange" }, host: { listeners: { "cosm-open-change": "openChange.emit($event)" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
63
|
+
}
|
|
64
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmPopoverComponent, decorators: [{
|
|
65
|
+
type: Component,
|
|
66
|
+
args: [{
|
|
67
|
+
selector: 'cosm-popover',
|
|
68
|
+
template: '<ng-content />',
|
|
69
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
70
|
+
host: { '(cosm-open-change)': 'openChange.emit($event)' },
|
|
71
|
+
}]
|
|
72
|
+
}], propDecorators: { open: [{
|
|
73
|
+
type: Input,
|
|
74
|
+
args: [{ transform: optionalBooleanAttribute }]
|
|
75
|
+
}], defaultOpen: [{
|
|
76
|
+
type: Input,
|
|
77
|
+
args: [{ transform: booleanAttribute }]
|
|
78
|
+
}], triggerMode: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}], closable: [{
|
|
81
|
+
type: Input,
|
|
82
|
+
args: [{ transform: booleanAttribute }]
|
|
83
|
+
}], closeLabel: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}], arrow: [{
|
|
86
|
+
type: Input,
|
|
87
|
+
args: [{ transform: booleanAttribute }]
|
|
88
|
+
}], closeOnEscape: [{
|
|
89
|
+
type: Input,
|
|
90
|
+
args: [{ transform: booleanAttribute }]
|
|
91
|
+
}], closeOnOutsidePress: [{
|
|
92
|
+
type: Input,
|
|
93
|
+
args: [{ transform: booleanAttribute }]
|
|
94
|
+
}], side: [{
|
|
95
|
+
type: Input
|
|
96
|
+
}], align: [{
|
|
97
|
+
type: Input
|
|
98
|
+
}], openChange: [{
|
|
99
|
+
type: Output
|
|
100
|
+
}] } });
|
|
101
|
+
//# sourceMappingURL=popover.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.component.js","sourceRoot":"","sources":["../../src/components/popover.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAC;AAOvB,OAAO,oCAAoC,CAAC;;AAI5C,SAAS,wBAAwB,CAAC,KAAc;IAC9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,CAAC;IACD,IAAa,KAAK,CAAC,KAAqB;QACtC,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IACtD,CAAC;IAID,6DAA6D;IAC7D,YAAY;QACV,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IAC9B,CAAC;8GAxCU,oBAAoB;kGAApB,oBAAoB,iFArBxB,wBAAwB,+CA4BX,gBAAgB,kEAMhB,gBAAgB,uDAMhB,gBAAgB,qDAGhB,gBAAgB,uEAGhB,gBAAgB,0KA7B1B,gBAAgB;;2FAIf,oBAAoB;kBANhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,cAAc;oBACxB,QAAQ,EAAE,gBAAgB;oBAC1B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,IAAI,EAAE,EAAE,oBAAoB,EAAE,yBAAyB,EAAE;iBAC1D;;sBAKE,KAAK;uBAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE;;sBAG7C,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,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;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,KAAK;;sBAIL,MAAM"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { type ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import type { ContractProps, RadioGroupChangeDetail, RadioGroupReferences, radioGroupContract } from '@joralvmel/cosmos-core';
|
|
4
|
+
import type { CosmRadioGroup } from '@joralvmel/cosmos-elements/radio-group';
|
|
5
|
+
import '@joralvmel/cosmos-elements/radio-group';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
type Props = ContractProps<typeof radioGroupContract, 'angular', RadioGroupReferences>;
|
|
8
|
+
/**
|
|
9
|
+
* Angular proxy of `<cosm-radio-group>`. DOM outputs forward the original `CustomEvent`; Forms
|
|
10
|
+
* integrates through `ControlValueAccessor` with a string-or-null value.
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <cosm-radio-group
|
|
14
|
+
* label="Contact method"
|
|
15
|
+
* [options]="contactMethods"
|
|
16
|
+
* formControlName="contactMethod"
|
|
17
|
+
* />
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class CosmRadioGroupComponent implements ControlValueAccessor {
|
|
21
|
+
#private;
|
|
22
|
+
readonly element: CosmRadioGroup;
|
|
23
|
+
set label(value: Props['label']);
|
|
24
|
+
set options(value: Props['options']);
|
|
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 orientation(value: Props['orientation']);
|
|
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<RadioGroupChangeDetail>>;
|
|
37
|
+
handleChange(event: CustomEvent<RadioGroupChangeDetail>): 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<CosmRadioGroupComponent, never>;
|
|
44
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CosmRadioGroupComponent, "cosm-radio-group", never, { "label": { "alias": "label"; "required": true; }; "options": { "alias": "options"; "required": true; }; "value": { "alias": "value"; "required": false; }; "defaultValue": { "alias": "defaultValue"; "required": false; }; "orientation": { "alias": "orientation"; "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,146 @@
|
|
|
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/radio-group';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Angular proxy of `<cosm-radio-group>`. DOM outputs forward the original `CustomEvent`; Forms
|
|
7
|
+
* integrates through `ControlValueAccessor` with a string-or-null value.
|
|
8
|
+
*
|
|
9
|
+
* ```html
|
|
10
|
+
* <cosm-radio-group
|
|
11
|
+
* label="Contact method"
|
|
12
|
+
* [options]="contactMethods"
|
|
13
|
+
* formControlName="contactMethod"
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export class CosmRadioGroupComponent {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.element = inject(ElementRef).nativeElement;
|
|
20
|
+
this.#onChange = () => { };
|
|
21
|
+
this.#onTouched = () => { };
|
|
22
|
+
this.valueChange = new EventEmitter();
|
|
23
|
+
}
|
|
24
|
+
#onChange;
|
|
25
|
+
#onTouched;
|
|
26
|
+
set label(value) {
|
|
27
|
+
this.element.label = value;
|
|
28
|
+
}
|
|
29
|
+
set options(value) {
|
|
30
|
+
this.element.options = value;
|
|
31
|
+
}
|
|
32
|
+
/** A direct value input is controlled; Angular Forms writes use `writeValue` instead. */
|
|
33
|
+
set value(value) {
|
|
34
|
+
this.element.valueControlled = value !== undefined;
|
|
35
|
+
if (value !== undefined)
|
|
36
|
+
this.element.value = value;
|
|
37
|
+
}
|
|
38
|
+
set defaultValue(value) {
|
|
39
|
+
if (value !== undefined)
|
|
40
|
+
this.element.defaultValue = value;
|
|
41
|
+
}
|
|
42
|
+
set orientation(value) {
|
|
43
|
+
if (value !== undefined)
|
|
44
|
+
this.element.orientation = value;
|
|
45
|
+
}
|
|
46
|
+
set size(value) {
|
|
47
|
+
this.element.size = value ?? 'md';
|
|
48
|
+
}
|
|
49
|
+
set disabled(value) {
|
|
50
|
+
this.element.disabled = value;
|
|
51
|
+
}
|
|
52
|
+
set required(value) {
|
|
53
|
+
this.element.required = value;
|
|
54
|
+
}
|
|
55
|
+
set invalid(value) {
|
|
56
|
+
this.element.invalid = value;
|
|
57
|
+
}
|
|
58
|
+
set helperText(value) {
|
|
59
|
+
this.element.helperText = value ?? '';
|
|
60
|
+
}
|
|
61
|
+
set errorText(value) {
|
|
62
|
+
this.element.errorText = value ?? '';
|
|
63
|
+
}
|
|
64
|
+
set name(value) {
|
|
65
|
+
this.element.name = value;
|
|
66
|
+
}
|
|
67
|
+
handleChange(event) {
|
|
68
|
+
this.valueChange.emit(event);
|
|
69
|
+
this.#onChange(event.detail.value);
|
|
70
|
+
}
|
|
71
|
+
markTouched() {
|
|
72
|
+
this.#onTouched();
|
|
73
|
+
}
|
|
74
|
+
writeValue(value) {
|
|
75
|
+
this.element.value = value ?? null;
|
|
76
|
+
this.element.valueControlled = false;
|
|
77
|
+
}
|
|
78
|
+
registerOnChange(fn) {
|
|
79
|
+
this.#onChange = fn;
|
|
80
|
+
}
|
|
81
|
+
registerOnTouched(fn) {
|
|
82
|
+
this.#onTouched = fn;
|
|
83
|
+
}
|
|
84
|
+
setDisabledState(isDisabled) {
|
|
85
|
+
this.element.disabled = isDisabled;
|
|
86
|
+
}
|
|
87
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmRadioGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
88
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.3.0", type: CosmRadioGroupComponent, isStandalone: true, selector: "cosm-radio-group", inputs: { label: "label", options: "options", value: "value", defaultValue: "defaultValue", orientation: "orientation", 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: [
|
|
89
|
+
{
|
|
90
|
+
provide: NG_VALUE_ACCESSOR,
|
|
91
|
+
useExisting: forwardRef(() => CosmRadioGroupComponent),
|
|
92
|
+
multi: true,
|
|
93
|
+
},
|
|
94
|
+
], ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
95
|
+
}
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.0", ngImport: i0, type: CosmRadioGroupComponent, decorators: [{
|
|
97
|
+
type: Component,
|
|
98
|
+
args: [{
|
|
99
|
+
selector: 'cosm-radio-group',
|
|
100
|
+
template: '<ng-content />',
|
|
101
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
102
|
+
providers: [
|
|
103
|
+
{
|
|
104
|
+
provide: NG_VALUE_ACCESSOR,
|
|
105
|
+
useExisting: forwardRef(() => CosmRadioGroupComponent),
|
|
106
|
+
multi: true,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
host: {
|
|
110
|
+
'(cosm-change)': 'handleChange($event)',
|
|
111
|
+
'(focusout)': 'markTouched()',
|
|
112
|
+
},
|
|
113
|
+
}]
|
|
114
|
+
}], propDecorators: { label: [{
|
|
115
|
+
type: Input,
|
|
116
|
+
args: [{ required: true }]
|
|
117
|
+
}], options: [{
|
|
118
|
+
type: Input,
|
|
119
|
+
args: [{ required: true }]
|
|
120
|
+
}], value: [{
|
|
121
|
+
type: Input
|
|
122
|
+
}], defaultValue: [{
|
|
123
|
+
type: Input
|
|
124
|
+
}], orientation: [{
|
|
125
|
+
type: Input
|
|
126
|
+
}], size: [{
|
|
127
|
+
type: Input
|
|
128
|
+
}], disabled: [{
|
|
129
|
+
type: Input,
|
|
130
|
+
args: [{ transform: booleanAttribute }]
|
|
131
|
+
}], required: [{
|
|
132
|
+
type: Input,
|
|
133
|
+
args: [{ transform: booleanAttribute }]
|
|
134
|
+
}], invalid: [{
|
|
135
|
+
type: Input,
|
|
136
|
+
args: [{ transform: booleanAttribute }]
|
|
137
|
+
}], helperText: [{
|
|
138
|
+
type: Input
|
|
139
|
+
}], errorText: [{
|
|
140
|
+
type: Input
|
|
141
|
+
}], name: [{
|
|
142
|
+
type: Input
|
|
143
|
+
}], valueChange: [{
|
|
144
|
+
type: Output
|
|
145
|
+
}] } });
|
|
146
|
+
//# sourceMappingURL=radio-group.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group.component.js","sourceRoot":"","sources":["../../src/components/radio-group.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,gBA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A5CzB;YACT;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC;gBACtD,KAAK,EAAE,IAAI;aACZ;SACF,0BARS,gBAAgB;;2FAcf,uBAAuB;kBAhBnC,SAAS;mBAAC;oBACT,QAAQ,EAAE,kBAAkB;oBAC5B,QAAQ,EAAE,gBAAgB;oBAC1B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,wBAAwB,CAAC;4BACtD,KAAK,EAAE,IAAI;yBACZ;qBACF;oBACD,IAAI,EAAE;wBACJ,eAAe,EAAE,sBAAsB;wBACvC,YAAY,EAAE,eAAe;qBAC9B;iBACF;;sBAOE,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAIxB,KAAK;;sBAIL,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;;sBAGL,KAAK;;sBAGL,KAAK;;sBAIL,MAAM"}
|
|
@@ -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,g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AAmB;kGAAnB,mBAAmB,wOA6BV,gBAAgB,sCAGhB,gBAAgB,mCAGhB,gBAAgB,sNA/CzB;YACT;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC;gBAClD,KAAK,EAAE,IAAI;aACZ;SACF,0BARS,gBAAgB;;2FAcf,mBAAmB;kBAhB/B,SAAS;mBAAC;oBACT,QAAQ,EAAE,aAAa;oBACvB,QAAQ,EAAE,gBAAgB;oBAC1B,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,eAAe,EAAE,sBAAsB;wBACvC,YAAY,EAAE,eAAe;qBAC9B;iBACF;;sBAOE,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAIxB,KAAK;;sBAIL,KAAK;;sBAGL,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB,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;;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 {};
|