@joralvmel/cosmos-angular 0.2.0 → 0.3.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 +35 -0
- package/dist/components/button.component.js +3 -3
- 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.js +3 -3
- 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/popover.component.d.ts +52 -0
- package/dist/components/popover.component.js +130 -0
- package/dist/components/popover.component.js.map +1 -0
- package/dist/components/text-field.component.d.ts +74 -0
- package/dist/components/text-field.component.js +244 -0
- package/dist/components/text-field.component.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/llms.md +183 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -20,6 +20,41 @@ export class ToolbarComponent {
|
|
|
20
20
|
|
|
21
21
|
`COSMOS_COMPONENTS` contains every component for `imports: [...COSMOS_COMPONENTS]`.
|
|
22
22
|
|
|
23
|
+
Text fields integrate with Angular Forms through `ControlValueAccessor`; there is no primitive
|
|
24
|
+
`[(value)]` promise:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { Component } from '@angular/core';
|
|
28
|
+
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
29
|
+
import { CosmTextFieldComponent } from '@joralvmel/cosmos-angular';
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
selector: 'app-email',
|
|
33
|
+
imports: [ReactiveFormsModule, CosmTextFieldComponent],
|
|
34
|
+
template: `
|
|
35
|
+
<cosm-text-field
|
|
36
|
+
label="Email"
|
|
37
|
+
type="email"
|
|
38
|
+
clearable
|
|
39
|
+
clearLabel="Clear email"
|
|
40
|
+
[formControl]="email"
|
|
41
|
+
/>
|
|
42
|
+
`,
|
|
43
|
+
})
|
|
44
|
+
export class EmailComponent {
|
|
45
|
+
readonly email = new FormControl('', { nonNullable: true, updateOn: 'blur' });
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`(valueChange)` and `(submit)` re-emit the original DOM `CustomEvent`; use `$event.detail.value`.
|
|
50
|
+
Reactive Forms handles programmatic writes, touched/disabled state, reset and the configured
|
|
51
|
+
`updateOn` strategy.
|
|
52
|
+
|
|
53
|
+
Text fields also forward `iconFocusScope` (`control` by default, or `input`) for optional decorative
|
|
54
|
+
icon focus colors. Use CSS classes or Angular style bindings with
|
|
55
|
+
`--cosm-text-field-start-icon-color`, `--cosm-text-field-start-icon-focus-color`, and the matching
|
|
56
|
+
`end-icon` hooks. Normal/focus colors are independent per side and do not recolor affixes or actions.
|
|
57
|
+
|
|
23
58
|
## License
|
|
24
59
|
|
|
25
60
|
MIT
|
|
@@ -39,10 +39,10 @@ export class CosmButtonComponent {
|
|
|
39
39
|
set label(value) {
|
|
40
40
|
this.element.label = value;
|
|
41
41
|
}
|
|
42
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.
|
|
43
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.
|
|
42
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
43
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.6", type: CosmButtonComponent, isStandalone: true, selector: "cosm-button", inputs: { variant: "variant", tone: "tone", size: "size", disabled: ["disabled", "disabled", booleanAttribute], loading: ["loading", "loading", booleanAttribute], fullWidth: ["fullWidth", "fullWidth", booleanAttribute], type: "type", label: "label" }, outputs: { press: "press" }, host: { listeners: { "cosm-press": "press.emit($event)" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
44
44
|
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmButtonComponent, decorators: [{
|
|
46
46
|
type: Component,
|
|
47
47
|
args: [{
|
|
48
48
|
selector: 'cosm-button',
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import type { ContractProps, IconButtonPressedChangeDetail, iconButtonContract } from '@joralvmel/cosmos-core';
|
|
3
|
+
import type { CosmIconButton } from '@joralvmel/cosmos-elements/icon-button';
|
|
4
|
+
import '@joralvmel/cosmos-elements/icon-button';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
type Props = ContractProps<typeof iconButtonContract, 'angular'>;
|
|
7
|
+
/** Angular proxy; outputs forward the original DOM CustomEvents. */
|
|
8
|
+
export declare class CosmIconButtonComponent {
|
|
9
|
+
readonly element: CosmIconButton;
|
|
10
|
+
set label(value: string);
|
|
11
|
+
set mode(value: Props['mode']);
|
|
12
|
+
set variant(value: Props['variant']);
|
|
13
|
+
set tone(value: Props['tone']);
|
|
14
|
+
set size(value: Props['size']);
|
|
15
|
+
set type(value: Props['type']);
|
|
16
|
+
set disabled(value: boolean);
|
|
17
|
+
set defaultPressed(value: boolean);
|
|
18
|
+
set pressed(value: Props['pressed'] | string);
|
|
19
|
+
readonly press: EventEmitter<CustomEvent<import("@joralvmel/cosmos-core").ButtonPressDetail>>;
|
|
20
|
+
readonly pressedChange: EventEmitter<CustomEvent<IconButtonPressedChangeDetail>>;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CosmIconButtonComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CosmIconButtonComponent, "cosm-icon-button", never, { "label": { "alias": "label"; "required": true; }; "mode": { "alias": "mode"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "tone": { "alias": "tone"; "required": false; }; "size": { "alias": "size"; "required": false; }; "type": { "alias": "type"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "defaultPressed": { "alias": "defaultPressed"; "required": false; }; "pressed": { "alias": "pressed"; "required": false; }; }, { "press": "press"; "pressedChange": "pressedChange"; }, never, ["*"], true, never>;
|
|
23
|
+
static ngAcceptInputType_disabled: unknown;
|
|
24
|
+
static ngAcceptInputType_defaultPressed: unknown;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, inject, Output, } from '@angular/core';
|
|
2
|
+
import '@joralvmel/cosmos-elements/icon-button';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/** Angular proxy; outputs forward the original DOM CustomEvents. */
|
|
5
|
+
export class CosmIconButtonComponent {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.element = inject(ElementRef).nativeElement;
|
|
8
|
+
this.press = new EventEmitter();
|
|
9
|
+
this.pressedChange = new EventEmitter();
|
|
10
|
+
}
|
|
11
|
+
set label(value) {
|
|
12
|
+
this.element.label = value;
|
|
13
|
+
}
|
|
14
|
+
set mode(value) {
|
|
15
|
+
if (value !== undefined)
|
|
16
|
+
this.element.mode = value;
|
|
17
|
+
}
|
|
18
|
+
set variant(value) {
|
|
19
|
+
if (value !== undefined)
|
|
20
|
+
this.element.variant = value;
|
|
21
|
+
}
|
|
22
|
+
set tone(value) {
|
|
23
|
+
if (value !== undefined)
|
|
24
|
+
this.element.tone = value;
|
|
25
|
+
}
|
|
26
|
+
set size(value) {
|
|
27
|
+
if (value !== undefined)
|
|
28
|
+
this.element.size = value;
|
|
29
|
+
}
|
|
30
|
+
set type(value) {
|
|
31
|
+
if (value !== undefined)
|
|
32
|
+
this.element.type = value;
|
|
33
|
+
}
|
|
34
|
+
set disabled(value) {
|
|
35
|
+
this.element.disabled = value;
|
|
36
|
+
}
|
|
37
|
+
set defaultPressed(value) {
|
|
38
|
+
this.element.defaultPressed = value;
|
|
39
|
+
}
|
|
40
|
+
set pressed(value) {
|
|
41
|
+
this.element.pressed = value === undefined ? undefined : booleanAttribute(value);
|
|
42
|
+
}
|
|
43
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmIconButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
44
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.6", type: CosmIconButtonComponent, isStandalone: true, selector: "cosm-icon-button", inputs: { label: "label", mode: "mode", variant: "variant", tone: "tone", size: "size", type: "type", disabled: ["disabled", "disabled", booleanAttribute], defaultPressed: ["defaultPressed", "defaultPressed", booleanAttribute], pressed: "pressed" }, outputs: { press: "press", pressedChange: "pressedChange" }, host: { listeners: { "cosm-press": "press.emit($event)", "cosm-pressed-change": "pressedChange.emit($event)" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
45
|
+
}
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmIconButtonComponent, decorators: [{
|
|
47
|
+
type: Component,
|
|
48
|
+
args: [{
|
|
49
|
+
selector: 'cosm-icon-button',
|
|
50
|
+
template: '<ng-content />',
|
|
51
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
52
|
+
host: {
|
|
53
|
+
'(cosm-press)': 'press.emit($event)',
|
|
54
|
+
'(cosm-pressed-change)': 'pressedChange.emit($event)',
|
|
55
|
+
},
|
|
56
|
+
}]
|
|
57
|
+
}], propDecorators: { label: [{
|
|
58
|
+
type: Input,
|
|
59
|
+
args: [{ required: true }]
|
|
60
|
+
}], mode: [{
|
|
61
|
+
type: Input
|
|
62
|
+
}], variant: [{
|
|
63
|
+
type: Input
|
|
64
|
+
}], tone: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], size: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}], type: [{
|
|
69
|
+
type: Input
|
|
70
|
+
}], disabled: [{
|
|
71
|
+
type: Input,
|
|
72
|
+
args: [{ transform: booleanAttribute }]
|
|
73
|
+
}], defaultPressed: [{
|
|
74
|
+
type: Input,
|
|
75
|
+
args: [{ transform: booleanAttribute }]
|
|
76
|
+
}], pressed: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}], press: [{
|
|
79
|
+
type: Output
|
|
80
|
+
}], pressedChange: [{
|
|
81
|
+
type: Output
|
|
82
|
+
}] } });
|
|
83
|
+
//# sourceMappingURL=icon-button.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-button.component.js","sourceRoot":"","sources":["../../src/components/icon-button.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;AAQvB,OAAO,wCAAwC,CAAC;;AAIhD,oEAAoE;AAUpE,MAAM,OAAO,uBAAuB;IATpC;QAUW,YAAO,GAAmB,MAAM,CAA6B,UAAU,CAAC,CAAC,aAAa,CAAC;QA8B7E,UAAK,GAAG,IAAI,YAAY,EAAsC,CAAC;QAC/D,kBAAa,GAAG,IAAI,YAAY,EAA8C,CAAC;KACnG;IA9BC,IAA+B,KAAK,CAAC,KAAa;QAChD,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAC7B,CAAC;IACD,IAAa,IAAI,CAAC,KAAoB;QACpC,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;IACrD,CAAC;IACD,IAAa,OAAO,CAAC,KAAuB;Q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AGL,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;;sBAIL,MAAM;;sBACN,MAAM"}
|
|
@@ -33,10 +33,10 @@ export class CosmIconComponent {
|
|
|
33
33
|
set decorative(value) {
|
|
34
34
|
this.element.decorative = value;
|
|
35
35
|
}
|
|
36
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.
|
|
37
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.
|
|
36
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
37
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.6", type: CosmIconComponent, isStandalone: true, selector: "cosm-icon", inputs: { icon: "icon", size: "size", stroke: "stroke", fill: "fill", strokeWidth: "strokeWidth", label: "label", decorative: ["decorative", "decorative", booleanAttribute] }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
38
38
|
}
|
|
39
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmIconComponent, decorators: [{
|
|
40
40
|
type: Component,
|
|
41
41
|
args: [{
|
|
42
42
|
selector: 'cosm-icon',
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import type { ContractProps, ListboxItem, ListboxSelectionChangeDetail } from '@joralvmel/cosmos-core';
|
|
3
|
+
import type { CosmListbox } from '@joralvmel/cosmos-elements/listbox';
|
|
4
|
+
import type { IconDefinition } from '@joralvmel/cosmos-icons';
|
|
5
|
+
import '@joralvmel/cosmos-elements/listbox';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
type Props = ContractProps<typeof import('@joralvmel/cosmos-core').listboxContract, 'angular', {
|
|
8
|
+
ListboxItems: readonly ListboxItem<IconDefinition>[];
|
|
9
|
+
ListboxValues: readonly string[];
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Angular proxy of `<cosm-listbox>`. Selection behavior remains in Lit; the output re-emits the
|
|
13
|
+
* original DOM `CustomEvent`. A bound `selectedValues` input, including an empty array, is controlled.
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* <cosm-listbox label="Choose fruit" [items]="items" (selectionChange)="onSelectionChange($event)" />
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare class CosmListboxComponent {
|
|
20
|
+
/** The underlying custom element. */
|
|
21
|
+
readonly element: CosmListbox;
|
|
22
|
+
set label(value: Props['label']);
|
|
23
|
+
set labelHidden(value: boolean);
|
|
24
|
+
set items(value: Props['items']);
|
|
25
|
+
set selectionMode(value: Props['selectionMode']);
|
|
26
|
+
/** A bound input is controlled even when its value is `[]`. */
|
|
27
|
+
set selectedValues(value: Props['selectedValues']);
|
|
28
|
+
set defaultSelectedValues(value: Props['defaultSelectedValues']);
|
|
29
|
+
set variant(value: Props['variant']);
|
|
30
|
+
set size(value: Props['size']);
|
|
31
|
+
set disabled(value: boolean);
|
|
32
|
+
set readOnly(value: boolean);
|
|
33
|
+
set locale(value: Props['locale']);
|
|
34
|
+
readonly selectionChange: EventEmitter<CustomEvent<ListboxSelectionChangeDetail>>;
|
|
35
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CosmListboxComponent, never>;
|
|
36
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CosmListboxComponent, "cosm-listbox", never, { "label": { "alias": "label"; "required": true; }; "labelHidden": { "alias": "labelHidden"; "required": false; }; "items": { "alias": "items"; "required": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; }; "selectedValues": { "alias": "selectedValues"; "required": false; }; "defaultSelectedValues": { "alias": "defaultSelectedValues"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, ["*"], true, never>;
|
|
37
|
+
static ngAcceptInputType_labelHidden: unknown;
|
|
38
|
+
static ngAcceptInputType_disabled: unknown;
|
|
39
|
+
static ngAcceptInputType_readOnly: unknown;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, inject, Output, } from '@angular/core';
|
|
2
|
+
import '@joralvmel/cosmos-elements/listbox';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Angular proxy of `<cosm-listbox>`. Selection behavior remains in Lit; the output re-emits the
|
|
6
|
+
* original DOM `CustomEvent`. A bound `selectedValues` input, including an empty array, is controlled.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <cosm-listbox label="Choose fruit" [items]="items" (selectionChange)="onSelectionChange($event)" />
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export class CosmListboxComponent {
|
|
13
|
+
constructor() {
|
|
14
|
+
/** The underlying custom element. */
|
|
15
|
+
this.element = inject(ElementRef).nativeElement;
|
|
16
|
+
this.selectionChange = new EventEmitter();
|
|
17
|
+
}
|
|
18
|
+
set label(value) {
|
|
19
|
+
this.element.label = value;
|
|
20
|
+
}
|
|
21
|
+
set labelHidden(value) {
|
|
22
|
+
this.element.labelHidden = value;
|
|
23
|
+
}
|
|
24
|
+
set items(value) {
|
|
25
|
+
this.element.items = value;
|
|
26
|
+
}
|
|
27
|
+
set selectionMode(value) {
|
|
28
|
+
if (value !== undefined)
|
|
29
|
+
this.element.selectionMode = value;
|
|
30
|
+
}
|
|
31
|
+
/** A bound input is controlled even when its value is `[]`. */
|
|
32
|
+
set selectedValues(value) {
|
|
33
|
+
this.element.selectedValues = value;
|
|
34
|
+
this.element.selectedValuesControlled = true;
|
|
35
|
+
}
|
|
36
|
+
set defaultSelectedValues(value) {
|
|
37
|
+
if (value !== undefined)
|
|
38
|
+
this.element.defaultSelectedValues = value;
|
|
39
|
+
}
|
|
40
|
+
set variant(value) {
|
|
41
|
+
if (value !== undefined)
|
|
42
|
+
this.element.variant = value;
|
|
43
|
+
}
|
|
44
|
+
set size(value) {
|
|
45
|
+
if (value !== undefined)
|
|
46
|
+
this.element.size = value;
|
|
47
|
+
}
|
|
48
|
+
set disabled(value) {
|
|
49
|
+
this.element.disabled = value;
|
|
50
|
+
}
|
|
51
|
+
set readOnly(value) {
|
|
52
|
+
this.element.readOnly = value;
|
|
53
|
+
}
|
|
54
|
+
set locale(value) {
|
|
55
|
+
this.element.locale = value;
|
|
56
|
+
}
|
|
57
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmListboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
58
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.6", type: CosmListboxComponent, isStandalone: true, selector: "cosm-listbox", inputs: { label: "label", labelHidden: ["labelHidden", "labelHidden", booleanAttribute], items: "items", selectionMode: "selectionMode", selectedValues: "selectedValues", defaultSelectedValues: "defaultSelectedValues", variant: "variant", size: "size", disabled: ["disabled", "disabled", booleanAttribute], readOnly: ["readOnly", "readOnly", booleanAttribute], locale: "locale" }, outputs: { selectionChange: "selectionChange" }, host: { listeners: { "cosm-selection-change": "selectionChange.emit($event)" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
59
|
+
}
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmListboxComponent, decorators: [{
|
|
61
|
+
type: Component,
|
|
62
|
+
args: [{
|
|
63
|
+
selector: 'cosm-listbox',
|
|
64
|
+
template: '<ng-content />',
|
|
65
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
66
|
+
host: {
|
|
67
|
+
'(cosm-selection-change)': 'selectionChange.emit($event)',
|
|
68
|
+
},
|
|
69
|
+
}]
|
|
70
|
+
}], propDecorators: { label: [{
|
|
71
|
+
type: Input,
|
|
72
|
+
args: [{ required: true }]
|
|
73
|
+
}], labelHidden: [{
|
|
74
|
+
type: Input,
|
|
75
|
+
args: [{ transform: booleanAttribute }]
|
|
76
|
+
}], items: [{
|
|
77
|
+
type: Input,
|
|
78
|
+
args: [{ required: true }]
|
|
79
|
+
}], selectionMode: [{
|
|
80
|
+
type: Input
|
|
81
|
+
}], selectedValues: [{
|
|
82
|
+
type: Input
|
|
83
|
+
}], defaultSelectedValues: [{
|
|
84
|
+
type: Input
|
|
85
|
+
}], variant: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], size: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}], disabled: [{
|
|
90
|
+
type: Input,
|
|
91
|
+
args: [{ transform: booleanAttribute }]
|
|
92
|
+
}], readOnly: [{
|
|
93
|
+
type: Input,
|
|
94
|
+
args: [{ transform: booleanAttribute }]
|
|
95
|
+
}], locale: [{
|
|
96
|
+
type: Input
|
|
97
|
+
}], selectionChange: [{
|
|
98
|
+
type: Output
|
|
99
|
+
}] } });
|
|
100
|
+
//# sourceMappingURL=listbox.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listbox.component.js","sourceRoot":"","sources":["../../src/components/listbox.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAA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AE,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;IACrD,CAAC;IACD,IAA4C,QAAQ,CAAC,KAAc;QACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;IAChC,CAAC;IACD,IAA4C,QAAQ,CAAC,KAAc;QACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;IAChC,CAAC;IACD,IAAa,MAAM,CAAC,KAAsB;QACxC,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;IAC9B,CAAC;8GAtCU,oBAAoB;kGAApB,oBAAoB,sHAOX,gBAAgB,0MAuBhB,gBAAgB,sCAGhB,gBAAgB,kLAvC1B,gBAAgB;;2FAMf,oBAAoB;kBARhC,SAAS;mBAAC;oBACT,QAAQ,EAAE,cAAc;oBACxB,QAAQ,EAAE,gBAAgB;oBAC1B,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,IAAI,EAAE;wBACJ,yBAAyB,EAAE,8BAA8B;qBAC1D;iBACF;;sBAKE,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAGxB,KAAK;;sBAIL,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;;sBAIL,MAAM"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import type { ContractProps, PopoverOpenChangeDetail, popoverContract } from '@joralvmel/cosmos-core';
|
|
3
|
+
import type { CosmPopover } from '@joralvmel/cosmos-elements/popover';
|
|
4
|
+
import '@joralvmel/cosmos-elements/popover';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
type Props = ContractProps<typeof popoverContract, 'angular'>;
|
|
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 declare class CosmPopoverComponent {
|
|
19
|
+
/** The underlying custom element and imperative `requestClose()` handle. */
|
|
20
|
+
readonly element: CosmPopover;
|
|
21
|
+
set open(value: boolean | undefined);
|
|
22
|
+
set defaultOpen(value: boolean);
|
|
23
|
+
set triggerMode(value: Props['triggerMode']);
|
|
24
|
+
set closable(value: boolean);
|
|
25
|
+
set closeLabel(value: string);
|
|
26
|
+
set gap(value: number);
|
|
27
|
+
set arrow(value: boolean);
|
|
28
|
+
set closeOnEscape(value: boolean);
|
|
29
|
+
set closeOnOutsidePress(value: boolean);
|
|
30
|
+
set initialFocus(value: boolean);
|
|
31
|
+
set restoreFocus(value: boolean);
|
|
32
|
+
set side(value: Props['side']);
|
|
33
|
+
set align(value: Props['align']);
|
|
34
|
+
set flip(value: boolean);
|
|
35
|
+
set shift(value: boolean);
|
|
36
|
+
readonly openChange: EventEmitter<CustomEvent<PopoverOpenChangeDetail>>;
|
|
37
|
+
/** Proposes an action close only while the panel is open. */
|
|
38
|
+
requestClose(): void;
|
|
39
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CosmPopoverComponent, never>;
|
|
40
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CosmPopoverComponent, "cosm-popover", never, { "open": { "alias": "open"; "required": false; }; "defaultOpen": { "alias": "defaultOpen"; "required": false; }; "triggerMode": { "alias": "triggerMode"; "required": false; }; "closable": { "alias": "closable"; "required": false; }; "closeLabel": { "alias": "closeLabel"; "required": false; }; "gap": { "alias": "gap"; "required": false; }; "arrow": { "alias": "arrow"; "required": false; }; "closeOnEscape": { "alias": "closeOnEscape"; "required": false; }; "closeOnOutsidePress": { "alias": "closeOnOutsidePress"; "required": false; }; "initialFocus": { "alias": "initialFocus"; "required": false; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; }; "side": { "alias": "side"; "required": false; }; "align": { "alias": "align"; "required": false; }; "flip": { "alias": "flip"; "required": false; }; "shift": { "alias": "shift"; "required": false; }; }, { "openChange": "openChange"; }, never, ["*"], true, never>;
|
|
41
|
+
static ngAcceptInputType_open: unknown;
|
|
42
|
+
static ngAcceptInputType_defaultOpen: unknown;
|
|
43
|
+
static ngAcceptInputType_closable: unknown;
|
|
44
|
+
static ngAcceptInputType_arrow: unknown;
|
|
45
|
+
static ngAcceptInputType_closeOnEscape: unknown;
|
|
46
|
+
static ngAcceptInputType_closeOnOutsidePress: unknown;
|
|
47
|
+
static ngAcceptInputType_initialFocus: unknown;
|
|
48
|
+
static ngAcceptInputType_restoreFocus: unknown;
|
|
49
|
+
static ngAcceptInputType_flip: unknown;
|
|
50
|
+
static ngAcceptInputType_shift: unknown;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
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 gap(value) {
|
|
41
|
+
this.element.gap = value;
|
|
42
|
+
}
|
|
43
|
+
set arrow(value) {
|
|
44
|
+
this.element.arrow = value;
|
|
45
|
+
}
|
|
46
|
+
set closeOnEscape(value) {
|
|
47
|
+
this.element.closeOnEscape = value;
|
|
48
|
+
}
|
|
49
|
+
set closeOnOutsidePress(value) {
|
|
50
|
+
this.element.closeOnOutsidePress = value;
|
|
51
|
+
}
|
|
52
|
+
set initialFocus(value) {
|
|
53
|
+
this.element.initialFocus = value;
|
|
54
|
+
}
|
|
55
|
+
set restoreFocus(value) {
|
|
56
|
+
this.element.restoreFocus = value;
|
|
57
|
+
}
|
|
58
|
+
set side(value) {
|
|
59
|
+
if (value !== undefined)
|
|
60
|
+
this.element.side = value;
|
|
61
|
+
}
|
|
62
|
+
set align(value) {
|
|
63
|
+
if (value !== undefined)
|
|
64
|
+
this.element.align = value;
|
|
65
|
+
}
|
|
66
|
+
set flip(value) {
|
|
67
|
+
this.element.flip = value;
|
|
68
|
+
}
|
|
69
|
+
set shift(value) {
|
|
70
|
+
this.element.shift = value;
|
|
71
|
+
}
|
|
72
|
+
/** Proposes an action close only while the panel is open. */
|
|
73
|
+
requestClose() {
|
|
74
|
+
this.element.requestClose();
|
|
75
|
+
}
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmPopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
77
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.6", type: CosmPopoverComponent, isStandalone: true, selector: "cosm-popover", inputs: { open: ["open", "open", optionalBooleanAttribute], defaultOpen: ["defaultOpen", "defaultOpen", booleanAttribute], triggerMode: "triggerMode", closable: ["closable", "closable", booleanAttribute], closeLabel: "closeLabel", gap: "gap", arrow: ["arrow", "arrow", booleanAttribute], closeOnEscape: ["closeOnEscape", "closeOnEscape", booleanAttribute], closeOnOutsidePress: ["closeOnOutsidePress", "closeOnOutsidePress", booleanAttribute], initialFocus: ["initialFocus", "initialFocus", booleanAttribute], restoreFocus: ["restoreFocus", "restoreFocus", booleanAttribute], side: "side", align: "align", flip: ["flip", "flip", booleanAttribute], shift: ["shift", "shift", booleanAttribute] }, outputs: { openChange: "openChange" }, host: { listeners: { "cosm-open-change": "openChange.emit($event)" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
78
|
+
}
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmPopoverComponent, decorators: [{
|
|
80
|
+
type: Component,
|
|
81
|
+
args: [{
|
|
82
|
+
selector: 'cosm-popover',
|
|
83
|
+
template: '<ng-content />',
|
|
84
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
85
|
+
host: { '(cosm-open-change)': 'openChange.emit($event)' },
|
|
86
|
+
}]
|
|
87
|
+
}], propDecorators: { open: [{
|
|
88
|
+
type: Input,
|
|
89
|
+
args: [{ transform: optionalBooleanAttribute }]
|
|
90
|
+
}], defaultOpen: [{
|
|
91
|
+
type: Input,
|
|
92
|
+
args: [{ transform: booleanAttribute }]
|
|
93
|
+
}], triggerMode: [{
|
|
94
|
+
type: Input
|
|
95
|
+
}], closable: [{
|
|
96
|
+
type: Input,
|
|
97
|
+
args: [{ transform: booleanAttribute }]
|
|
98
|
+
}], closeLabel: [{
|
|
99
|
+
type: Input
|
|
100
|
+
}], gap: [{
|
|
101
|
+
type: Input
|
|
102
|
+
}], arrow: [{
|
|
103
|
+
type: Input,
|
|
104
|
+
args: [{ transform: booleanAttribute }]
|
|
105
|
+
}], closeOnEscape: [{
|
|
106
|
+
type: Input,
|
|
107
|
+
args: [{ transform: booleanAttribute }]
|
|
108
|
+
}], closeOnOutsidePress: [{
|
|
109
|
+
type: Input,
|
|
110
|
+
args: [{ transform: booleanAttribute }]
|
|
111
|
+
}], initialFocus: [{
|
|
112
|
+
type: Input,
|
|
113
|
+
args: [{ transform: booleanAttribute }]
|
|
114
|
+
}], restoreFocus: [{
|
|
115
|
+
type: Input,
|
|
116
|
+
args: [{ transform: booleanAttribute }]
|
|
117
|
+
}], side: [{
|
|
118
|
+
type: Input
|
|
119
|
+
}], align: [{
|
|
120
|
+
type: Input
|
|
121
|
+
}], flip: [{
|
|
122
|
+
type: Input,
|
|
123
|
+
args: [{ transform: booleanAttribute }]
|
|
124
|
+
}], shift: [{
|
|
125
|
+
type: Input,
|
|
126
|
+
args: [{ transform: booleanAttribute }]
|
|
127
|
+
}], openChange: [{
|
|
128
|
+
type: Output
|
|
129
|
+
}] } });
|
|
130
|
+
//# 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;IAC9C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED;;;;;;;;;;GAUG;AAOH,MAAM,OAAO,oBAAoB;IANjC;QAOE,4EAA4E;QACnE,YAAO,GAAgB,MAAM,CAA0B,UAAU,CAAC,CAAC,aAAa,CAAC;QAgDvE,eAAU,GAAG,IAAI,YAAY,EAAwC,CAAC;KAM1F;IApDC,IAAoD,IAAI,CAAC,KAA0B;QACjF,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;IAC5B,CAAC;IACD,IAA4C,WAAW,CAAC,KAAc;QACpE,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;IACnC,CAAC;IACD,IAAa,WAAW,CAAC,KAA2B;QAClD,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;IAC5D,CAAC;IACD,IAA4C,QAAQ,CAAC,KAAc;QACjE,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC;IAChC,CAAC;IACD,IAAa,UAAU,CAAC,KAAa;QACnC,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;IAClC,CAAC;IACD,IAAa,GAAG,CAAC,KAAa;QAC5B,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC;IAC3B,CAAC;IACD,IAA4C,KAAK,CAAC,KAAc;QAC9D,IAAI,CAAC,OAAO,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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;;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;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;;sBAGL,KAAK;;sBAGL,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAGrC,KAAK;uBAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE;;sBAIrC,MAAM"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 helpText(value: Props['helpText']);
|
|
33
|
+
set error(value: Props['error']);
|
|
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 iconFocusScope(value: Props['iconFocusScope']);
|
|
47
|
+
set prefix(value: Props['prefix']);
|
|
48
|
+
set suffix(value: Props['suffix']);
|
|
49
|
+
set clearable(value: boolean);
|
|
50
|
+
set clearLabel(value: Props['clearLabel']);
|
|
51
|
+
set passwordReveal(value: boolean);
|
|
52
|
+
set revealPasswordLabel(value: Props['revealPasswordLabel']);
|
|
53
|
+
set hidePasswordLabel(value: Props['hidePasswordLabel']);
|
|
54
|
+
readonly valueChange: EventEmitter<CustomEvent<TextFieldChangeDetail>>;
|
|
55
|
+
readonly submit: EventEmitter<CustomEvent<TextFieldSubmitDetail>>;
|
|
56
|
+
/** Re-emits the original event and feeds its proposal into Angular Forms. */
|
|
57
|
+
handleChange(event: CustomEvent<TextFieldChangeDetail>): void;
|
|
58
|
+
/** Marks the control touched when the editable control loses focus. */
|
|
59
|
+
markTouched(): void;
|
|
60
|
+
writeValue(value: string | null | undefined): void;
|
|
61
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
62
|
+
registerOnTouched(fn: () => void): void;
|
|
63
|
+
setDisabledState(isDisabled: boolean): void;
|
|
64
|
+
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; }; "helpText": { "alias": "helpText"; "required": false; }; "error": { "alias": "error"; "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; }; "iconFocusScope": { "alias": "iconFocusScope"; "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
|
+
static ngAcceptInputType_labelHidden: unknown;
|
|
67
|
+
static ngAcceptInputType_invalid: unknown;
|
|
68
|
+
static ngAcceptInputType_required: unknown;
|
|
69
|
+
static ngAcceptInputType_disabled: unknown;
|
|
70
|
+
static ngAcceptInputType_readOnly: unknown;
|
|
71
|
+
static ngAcceptInputType_clearable: unknown;
|
|
72
|
+
static ngAcceptInputType_passwordReveal: unknown;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
@@ -0,0 +1,244 @@
|
|
|
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 helpText(value) {
|
|
55
|
+
this.element.helpText = value ?? '';
|
|
56
|
+
}
|
|
57
|
+
set error(value) {
|
|
58
|
+
this.element.error = 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 iconFocusScope(value) {
|
|
97
|
+
this.element.iconFocusScope = value ?? 'control';
|
|
98
|
+
}
|
|
99
|
+
set prefix(value) {
|
|
100
|
+
this.element.prefix = value ?? '';
|
|
101
|
+
}
|
|
102
|
+
set suffix(value) {
|
|
103
|
+
this.element.suffix = value ?? '';
|
|
104
|
+
}
|
|
105
|
+
set clearable(value) {
|
|
106
|
+
this.element.clearable = value;
|
|
107
|
+
}
|
|
108
|
+
set clearLabel(value) {
|
|
109
|
+
this.element.clearLabel = value;
|
|
110
|
+
}
|
|
111
|
+
set passwordReveal(value) {
|
|
112
|
+
this.element.passwordReveal = value;
|
|
113
|
+
}
|
|
114
|
+
set revealPasswordLabel(value) {
|
|
115
|
+
this.element.revealPasswordLabel = value;
|
|
116
|
+
}
|
|
117
|
+
set hidePasswordLabel(value) {
|
|
118
|
+
this.element.hidePasswordLabel = value;
|
|
119
|
+
}
|
|
120
|
+
/** Re-emits the original event and feeds its proposal into Angular Forms. */
|
|
121
|
+
handleChange(event) {
|
|
122
|
+
this.valueChange.emit(event);
|
|
123
|
+
this.#onChange(event.detail.value);
|
|
124
|
+
}
|
|
125
|
+
/** Marks the control touched when the editable control loses focus. */
|
|
126
|
+
markTouched() {
|
|
127
|
+
this.#onTouched();
|
|
128
|
+
}
|
|
129
|
+
writeValue(value) {
|
|
130
|
+
// CVA owns the view draft until Angular commits it (notably for updateOn: 'blur').
|
|
131
|
+
this.element.valueControlled = false;
|
|
132
|
+
this.element.value = value ?? '';
|
|
133
|
+
}
|
|
134
|
+
registerOnChange(fn) {
|
|
135
|
+
this.#onChange = fn;
|
|
136
|
+
}
|
|
137
|
+
registerOnTouched(fn) {
|
|
138
|
+
this.#onTouched = fn;
|
|
139
|
+
}
|
|
140
|
+
setDisabledState(isDisabled) {
|
|
141
|
+
this.element.disabled = isDisabled;
|
|
142
|
+
}
|
|
143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmTextFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
144
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.6", 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", helpText: "helpText", error: "error", 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", iconFocusScope: "iconFocusScope", 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
|
+
{
|
|
146
|
+
provide: NG_VALUE_ACCESSOR,
|
|
147
|
+
useExisting: forwardRef(() => CosmTextFieldComponent),
|
|
148
|
+
multi: true,
|
|
149
|
+
},
|
|
150
|
+
], ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
151
|
+
}
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: CosmTextFieldComponent, decorators: [{
|
|
153
|
+
type: Component,
|
|
154
|
+
args: [{
|
|
155
|
+
selector: 'cosm-text-field',
|
|
156
|
+
template: '<ng-content />',
|
|
157
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
158
|
+
providers: [
|
|
159
|
+
{
|
|
160
|
+
provide: NG_VALUE_ACCESSOR,
|
|
161
|
+
useExisting: forwardRef(() => CosmTextFieldComponent),
|
|
162
|
+
multi: true,
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
host: {
|
|
166
|
+
'(cosm-change)': 'handleChange($event)',
|
|
167
|
+
'(cosm-submit)': 'submit.emit($event)',
|
|
168
|
+
'(focusout)': 'markTouched()',
|
|
169
|
+
},
|
|
170
|
+
}]
|
|
171
|
+
}], propDecorators: { label: [{
|
|
172
|
+
type: Input,
|
|
173
|
+
args: [{ required: true }]
|
|
174
|
+
}], labelHidden: [{
|
|
175
|
+
type: Input,
|
|
176
|
+
args: [{ transform: booleanAttribute }]
|
|
177
|
+
}], value: [{
|
|
178
|
+
type: Input
|
|
179
|
+
}], defaultValue: [{
|
|
180
|
+
type: Input
|
|
181
|
+
}], type: [{
|
|
182
|
+
type: Input
|
|
183
|
+
}], variant: [{
|
|
184
|
+
type: Input
|
|
185
|
+
}], size: [{
|
|
186
|
+
type: Input
|
|
187
|
+
}], placeholder: [{
|
|
188
|
+
type: Input
|
|
189
|
+
}], helpText: [{
|
|
190
|
+
type: Input
|
|
191
|
+
}], error: [{
|
|
192
|
+
type: Input
|
|
193
|
+
}], invalid: [{
|
|
194
|
+
type: Input,
|
|
195
|
+
args: [{ transform: booleanAttribute }]
|
|
196
|
+
}], required: [{
|
|
197
|
+
type: Input,
|
|
198
|
+
args: [{ transform: booleanAttribute }]
|
|
199
|
+
}], disabled: [{
|
|
200
|
+
type: Input,
|
|
201
|
+
args: [{ transform: booleanAttribute }]
|
|
202
|
+
}], readOnly: [{
|
|
203
|
+
type: Input,
|
|
204
|
+
args: [{ transform: booleanAttribute }]
|
|
205
|
+
}], minLength: [{
|
|
206
|
+
type: Input
|
|
207
|
+
}], maxLength: [{
|
|
208
|
+
type: Input
|
|
209
|
+
}], pattern: [{
|
|
210
|
+
type: Input
|
|
211
|
+
}], name: [{
|
|
212
|
+
type: Input
|
|
213
|
+
}], autoComplete: [{
|
|
214
|
+
type: Input
|
|
215
|
+
}], inputMode: [{
|
|
216
|
+
type: Input
|
|
217
|
+
}], startIcon: [{
|
|
218
|
+
type: Input
|
|
219
|
+
}], endIcon: [{
|
|
220
|
+
type: Input
|
|
221
|
+
}], iconFocusScope: [{
|
|
222
|
+
type: Input
|
|
223
|
+
}], prefix: [{
|
|
224
|
+
type: Input
|
|
225
|
+
}], suffix: [{
|
|
226
|
+
type: Input
|
|
227
|
+
}], clearable: [{
|
|
228
|
+
type: Input,
|
|
229
|
+
args: [{ transform: booleanAttribute }]
|
|
230
|
+
}], clearLabel: [{
|
|
231
|
+
type: Input
|
|
232
|
+
}], passwordReveal: [{
|
|
233
|
+
type: Input,
|
|
234
|
+
args: [{ transform: booleanAttribute }]
|
|
235
|
+
}], revealPasswordLabel: [{
|
|
236
|
+
type: Input
|
|
237
|
+
}], hidePasswordLabel: [{
|
|
238
|
+
type: Input
|
|
239
|
+
}], valueChange: [{
|
|
240
|
+
type: Output
|
|
241
|
+
}], submit: [{
|
|
242
|
+
type: Output
|
|
243
|
+
}] } });
|
|
244
|
+
//# 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,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;QA+Ff,gBAAW,GAAG,IAAI,YAAY,EAAsC,CAAC;QACrE,WAAM,GAAG,IAAI,YAAY,EAAsC,CAAC;KA8BpF;IA/HC,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,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IACtD,CAAC;IACD,IAAa,YAAY,CAAC,KAA4B;QACpD,IAAI,CAAC,OAAO,CAAC,YAAY,GAAG,KAAK,IAAI,EAAE,CAAC;IAC1C,CAAC;IACD,IAAa,IAAI,CAAC,KAA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-
|
|
1
|
+
import { CosmIconButtonComponent } from './components/icon-button.component.js';
|
|
2
|
+
import { CosmListboxComponent } from './components/listbox.component.js';
|
|
3
|
+
import { CosmPopoverComponent } from './components/popover.component.js';
|
|
4
|
+
import { CosmTextFieldComponent } from './components/text-field.component.js';
|
|
5
|
+
export type { ButtonPressDetail, ListboxSelectionChangeDetail, PressSource, TextFieldChangeDetail, TextFieldSubmitDetail, } from '@joralvmel/cosmos-core';
|
|
2
6
|
export { CosmButtonComponent } from './components/button.component.js';
|
|
3
7
|
export { CosmIconComponent } from './components/icon.component.js';
|
|
4
8
|
import { CosmButtonComponent } from './components/button.component.js';
|
|
5
9
|
import { CosmIconComponent } from './components/icon.component.js';
|
|
6
10
|
/** Every Cosmos Angular component, for `imports: [...COSMOS_COMPONENTS]`. */
|
|
7
|
-
export declare const COSMOS_COMPONENTS: readonly [typeof CosmButtonComponent, typeof CosmIconComponent];
|
|
11
|
+
export declare const COSMOS_COMPONENTS: readonly [typeof CosmButtonComponent, typeof CosmIconComponent, typeof CosmTextFieldComponent, typeof CosmIconButtonComponent, typeof CosmPopoverComponent, typeof CosmListboxComponent];
|
|
12
|
+
export { CosmIconButtonComponent } from './components/icon-button.component.js';
|
|
13
|
+
export { CosmListboxComponent } from './components/listbox.component.js';
|
|
14
|
+
export { CosmPopoverComponent } from './components/popover.component.js';
|
|
15
|
+
export { CosmTextFieldComponent } from './components/text-field.component.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
import { CosmIconButtonComponent } from './components/icon-button.component.js';
|
|
2
|
+
import { CosmListboxComponent } from './components/listbox.component.js';
|
|
3
|
+
import { CosmPopoverComponent } from './components/popover.component.js';
|
|
4
|
+
import { CosmTextFieldComponent } from './components/text-field.component.js';
|
|
1
5
|
export { CosmButtonComponent } from './components/button.component.js';
|
|
2
6
|
export { CosmIconComponent } from './components/icon.component.js';
|
|
3
7
|
import { CosmButtonComponent } from './components/button.component.js';
|
|
4
8
|
import { CosmIconComponent } from './components/icon.component.js';
|
|
5
9
|
/** Every Cosmos Angular component, for `imports: [...COSMOS_COMPONENTS]`. */
|
|
6
|
-
export const COSMOS_COMPONENTS = [
|
|
10
|
+
export const COSMOS_COMPONENTS = [
|
|
11
|
+
CosmButtonComponent,
|
|
12
|
+
CosmIconComponent,
|
|
13
|
+
CosmTextFieldComponent,
|
|
14
|
+
CosmIconButtonComponent,
|
|
15
|
+
CosmPopoverComponent,
|
|
16
|
+
CosmListboxComponent,
|
|
17
|
+
];
|
|
18
|
+
export { CosmIconButtonComponent } from './components/icon-button.component.js';
|
|
19
|
+
export { CosmListboxComponent } from './components/listbox.component.js';
|
|
20
|
+
export { CosmPopoverComponent } from './components/popover.component.js';
|
|
21
|
+
export { CosmTextFieldComponent } from './components/text-field.component.js';
|
|
7
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAS9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,mBAAmB;IACnB,iBAAiB;IACjB,sBAAsB;IACtB,uBAAuB;IACvB,oBAAoB;IACpB,oBAAoB;CACZ,CAAC;AACX,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC"}
|
package/llms.md
CHANGED
|
@@ -110,6 +110,189 @@ export class ExampleComponent {
|
|
|
110
110
|
readonly house = house;
|
|
111
111
|
}
|
|
112
112
|
```
|
|
113
|
+
### `CosmTextFieldComponent` (`<cosm-text-field>`)
|
|
114
|
+
|
|
115
|
+
Accepts a single line of text with an accessible label, optional help and error text, and native form validation on the web.
|
|
116
|
+
|
|
117
|
+
| Prop | Type | Default | Description |
|
|
118
|
+
| --- | --- | --- | --- |
|
|
119
|
+
| `label` | string | Required | Accessible name for the editable control. It is rendered above the control unless visually hidden. |
|
|
120
|
+
| `labelHidden` | boolean | `false` | Visually hides the label while keeping it available to assistive technology. |
|
|
121
|
+
| `value` | string | — | Current text. When bound, edits are proposals and the component waits for the owner to supply the accepted value. |
|
|
122
|
+
| `defaultValue` | string | `` | Initial value for autonomous use. Web form reset restores this value; it does not control subsequent edits. |
|
|
123
|
+
| `type` | 'text' \| 'email' \| 'password' \| 'tel' \| 'url' \| 'search' | `text` | Single-line input type. Native maps it to supported keyboard, autofill and secure-entry behavior. |
|
|
124
|
+
| `variant` | 'outlined' \| 'filled' | `outlined` | Visual treatment of the editable control. |
|
|
125
|
+
| `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size or a positive finite minimum editable-control height in CSS pixels on web and logical units on native. |
|
|
126
|
+
| `placeholder` | string | — | Short input hint; it never replaces the accessible label. |
|
|
127
|
+
| `helpText` | string | — | Optional supporting text associated with the editable control. |
|
|
128
|
+
| `error` | string | — | Optional externally supplied error text associated with the editable control. |
|
|
129
|
+
| `invalid` | boolean | `false` | External invalid state, independent of browser constraints or consumer business validation. |
|
|
130
|
+
| `required` | boolean | `false` | Exposes required semantics. On web, participates in native HTML constraint validation. |
|
|
131
|
+
| `disabled` | boolean | `false` | Disables editing and interaction. On web, follows disabled fieldsets and excludes the value from form submission. |
|
|
132
|
+
| `readOnly` | boolean | `false` | Prevents editing while remaining focusable and form-submittable on web; distinct from disabled. |
|
|
133
|
+
| `minLength` | number | — | Minimum number of characters. Web uses native HTML validity; native business validation remains the consumer’s responsibility. |
|
|
134
|
+
| `maxLength` | number | — | Maximum number of characters. Web uses native HTML validity and native applies supported input limits. |
|
|
135
|
+
| `pattern` | string | — | Web-only HTML pattern constraint. Native does not emulate HTML regular-expression validation. |
|
|
136
|
+
| `name` | string | — | Form field name on web. React Native has no HTML form association or name-based submission. |
|
|
137
|
+
| `autoComplete` | string | — | Consumer-provided completion/autofill hint, mapped to attributes supported by each platform. |
|
|
138
|
+
| `inputMode` | 'none' \| 'text' \| 'decimal' \| 'numeric' \| 'tel' \| 'search' \| 'email' \| 'url' | — | Input or keyboard hint (none, text, decimal, numeric, tel, search, email or url); it does not add numeric or multiline field behavior. |
|
|
139
|
+
| `startIcon` | IconDefinition | — | Optional structured decorative icon before the editable text. |
|
|
140
|
+
| `endIcon` | IconDefinition | — | Optional structured decorative icon after the editable text. |
|
|
141
|
+
| `iconFocusScope` | 'control' \| 'input' | `control` | When configured icon focus colors apply: control includes the input and clear/reveal buttons; input includes only the editable input. Does not change icons without a focus-color override. |
|
|
142
|
+
| `prefix` | string | — | Optional non-interactive text decoration before the editable text. |
|
|
143
|
+
| `suffix` | string | — | Optional non-interactive text decoration after the editable text. |
|
|
144
|
+
| `clearable` | boolean | `false` | Shows a clear action for non-empty editable fields. Supply clearLabel when enabled. |
|
|
145
|
+
| `clearLabel` | string | — | Consumer-supplied localized accessible name for the clear action. |
|
|
146
|
+
| `passwordReveal` | boolean | `false` | Opts into a reveal action for password fields. Supply both revealPasswordLabel and hidePasswordLabel when enabled. |
|
|
147
|
+
| `revealPasswordLabel` | string | — | Consumer-supplied localized accessible name while the password is concealed. |
|
|
148
|
+
| `hidePasswordLabel` | string | — | Consumer-supplied localized accessible name while the password is revealed. |
|
|
149
|
+
|
|
150
|
+
Events: `(valueChange)` → `TextFieldChangeDetail`, `(submit)` → `TextFieldSubmitDetail`.
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
import { Component } from '@angular/core';
|
|
154
|
+
import { CosmTextFieldComponent } from '@joralvmel/cosmos-angular';
|
|
155
|
+
import { search } from '@joralvmel/cosmos-icons/search';
|
|
156
|
+
import type { TextFieldChangeDetail, TextFieldSubmitDetail } from '@joralvmel/cosmos-core';
|
|
157
|
+
|
|
158
|
+
@Component({
|
|
159
|
+
selector: 'app-example',
|
|
160
|
+
imports: [CosmTextFieldComponent],
|
|
161
|
+
template: `<cosm-text-field label="TextField" [startIcon]="search" [endIcon]="search" (valueChange)="onValueChange($event.detail)" (submit)="onSubmit($event.detail)"></cosm-text-field>`,
|
|
162
|
+
})
|
|
163
|
+
export class ExampleComponent {
|
|
164
|
+
readonly search = search;
|
|
165
|
+
onValueChange(detail: TextFieldChangeDetail) {
|
|
166
|
+
console.log(detail);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
onSubmit(detail: TextFieldSubmitDetail) {
|
|
170
|
+
console.log(detail);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
### `CosmIconButtonComponent` (`<cosm-icon-button>`)
|
|
175
|
+
|
|
176
|
+
Activates an action or toggles a boolean state using a labeled icon.
|
|
177
|
+
|
|
178
|
+
| Prop | Type | Default | Description |
|
|
179
|
+
| --- | --- | --- | --- |
|
|
180
|
+
| `label` | string | Required | Required localized accessible name. Missing, empty or whitespace-only labels are rejected. |
|
|
181
|
+
| `mode` | 'action' \| 'toggle' | `action` | Action activates without toggle state; toggle exposes and changes pressed state. |
|
|
182
|
+
| `variant` | 'solid' \| 'soft' \| 'outline' \| 'ghost' | `solid` | Visual emphasis, from highest (solid) to lowest (ghost). |
|
|
183
|
+
| `tone` | 'primary' \| 'neutral' \| 'danger' | `primary` | Color role. Use danger for destructive actions. |
|
|
184
|
+
| `size` | 'sm' \| 'md' \| 'lg' | `md` | Size of the square visual control. |
|
|
185
|
+
| `disabled` | boolean | `false` | Prevents activation and removes the web button from the tab order. |
|
|
186
|
+
| `type` | 'button' \| 'submit' \| 'reset' | `button` | Native web button form behavior. |
|
|
187
|
+
| `pressed` | boolean | `false` | Toggle state. If supplied, including false, activation proposes changes without committing them until the owner updates this prop. |
|
|
188
|
+
| `defaultPressed` | boolean | `false` | Initial toggle state when pressed is not supplied; it does not control later changes. |
|
|
189
|
+
|
|
190
|
+
Events: `(press)` → `IconButtonPressDetail`, `(pressedChange)` → `IconButtonPressedChangeDetail`.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { heart } from '@joralvmel/cosmos-icons/heart';
|
|
194
|
+
import { Component } from '@angular/core';
|
|
195
|
+
import { CosmIconButtonComponent, CosmIconComponent } from '@joralvmel/cosmos-angular';
|
|
196
|
+
import type { IconButtonPressDetail, IconButtonPressedChangeDetail } from '@joralvmel/cosmos-core';
|
|
197
|
+
|
|
198
|
+
@Component({
|
|
199
|
+
selector: 'app-example',
|
|
200
|
+
imports: [CosmIconButtonComponent, CosmIconComponent],
|
|
201
|
+
template: `<cosm-icon-button label="IconButton" (press)="onPress($event.detail)" (pressedChange)="onPressedChange($event.detail)"><cosm-icon [icon]="heart"></cosm-icon></cosm-icon-button>`,
|
|
202
|
+
})
|
|
203
|
+
export class ExampleComponent {
|
|
204
|
+
readonly heart = heart;
|
|
205
|
+
onPress(detail: IconButtonPressDetail) {
|
|
206
|
+
console.log(detail);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
onPressedChange(detail: IconButtonPressedChangeDetail) {
|
|
210
|
+
console.log(detail);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
### `CosmPopoverComponent` (`<cosm-popover>`)
|
|
215
|
+
|
|
216
|
+
Non-modal content anchored to a consumer trigger, with cancelable close requests and no imposed panel semantics.
|
|
217
|
+
|
|
218
|
+
| Prop | Type | Default | Description |
|
|
219
|
+
| --- | --- | --- | --- |
|
|
220
|
+
| `open` | boolean | `false` | Committed visibility. Supplying this prop, including false, controls state; its metadata default does not establish a binding. |
|
|
221
|
+
| `defaultOpen` | boolean | `false` | Initial autonomous visibility only; ignored when open is supplied. Later updates do not reset state. |
|
|
222
|
+
| `triggerMode` | 'press' \| 'hover' | `press` | Hover adds pointer and keyboard-focus opening on web and React Native Web, while keeping press activation. Android/iOS use press. Does not change panel semantics. |
|
|
223
|
+
| `closable` | boolean | `false` | Shows a built-in IconButton with an X. Requests a cancelable close with reason close-button. |
|
|
224
|
+
| `closeLabel` | string | `Close` | Localized accessible name of the close button. Must be non-empty when closable is true. |
|
|
225
|
+
| `gap` | number | `8` | Non-negative finite distance from trigger to panel, or to the arrow tip. CSS pixels on web, logical units on native. Viewport/safe-area collision handling takes priority. |
|
|
226
|
+
| `arrow` | boolean | `false` | Shows a decorative triangular pointer (16 wide, 8 deep), following the actual side, panel background and border. Hidden if it cannot point to the trigger without crossing a corner or viewport edge. |
|
|
227
|
+
| `closeOnEscape` | boolean | `true` | Requests closure on unhandled Escape on web and React Native Web. Native Android and iOS hardware Escape is not supported. |
|
|
228
|
+
| `closeOnOutsidePress` | boolean | `true` | Requests closure on an outside press without preventing its interaction or restoring trigger focus. |
|
|
229
|
+
| `initialFocus` | boolean | `false` | On committed opening (including initially open), focus the first focusable panel descendant, falling back to the panel without adding semantics. False leaves focus unchanged. Native moves accessible/input focus where supported. |
|
|
230
|
+
| `restoreFocus` | boolean | `true` | After committed trigger, Escape, action or Back closure, restore focus only if still inside the panel and the trigger is connected and focusable. Never steal outside focus, restore after outside press, or restore for unsolicited prop closure. |
|
|
231
|
+
| `side` | 'top' \| 'right' \| 'bottom' \| 'left' | `bottom` | Requested physical side; actual placement may flip. Recompute for trigger/panel size, viewport/safe-area, scrolling and orientation changes. |
|
|
232
|
+
| `align` | 'start' \| 'center' \| 'end' | `center` | Cross-axis alignment. On top/bottom, start/end follow inline direction (RTL reverses them); on left/right they mean top/bottom. |
|
|
233
|
+
| `flip` | boolean | `true` | Try the opposite side when the requested side overflows the available viewport/safe area; flip only if it reduces main-axis overflow. Ties keep the requested side. Runs before shift. |
|
|
234
|
+
| `shift` | boolean | `true` | After flip, translate within available viewport/safe-area bounds to reduce overflow. Constrain oversized panels to that region regardless of collision flags; flags never change requested props. |
|
|
235
|
+
|
|
236
|
+
Events: `(openChange)` → `PopoverOpenChangeDetail`.
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
import { Component } from '@angular/core';
|
|
240
|
+
import { CosmPopoverComponent, CosmIconButtonComponent, CosmIconComponent } from '@joralvmel/cosmos-angular';
|
|
241
|
+
import { info } from '@joralvmel/cosmos-icons/info';
|
|
242
|
+
import type { PopoverOpenChangeDetail } from '@joralvmel/cosmos-core';
|
|
243
|
+
|
|
244
|
+
@Component({
|
|
245
|
+
selector: 'app-example',
|
|
246
|
+
imports: [CosmPopoverComponent, CosmIconButtonComponent, CosmIconComponent],
|
|
247
|
+
template: `<cosm-popover (openChange)="onOpenChange($event.detail)"><cosm-icon-button slot="trigger" label="Details" variant="ghost" tone="neutral"><cosm-icon [icon]="info" /></cosm-icon-button>Popover</cosm-popover>`,
|
|
248
|
+
})
|
|
249
|
+
export class ExampleComponent {
|
|
250
|
+
readonly info = info;
|
|
251
|
+
onOpenChange(detail: PopoverOpenChangeDetail) {
|
|
252
|
+
console.log(detail);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
### `CosmListboxComponent` (`<cosm-listbox>`)
|
|
257
|
+
|
|
258
|
+
Selects one or more values from a named vertical collection, with groups, descriptions, icons and independent keyboard focus.
|
|
259
|
+
|
|
260
|
+
| Prop | Type | Default | Description |
|
|
261
|
+
| --- | --- | --- | --- |
|
|
262
|
+
| `label` | string | Required | Required nonempty accessible label, visible unless labelHidden is true. |
|
|
263
|
+
| `labelHidden` | boolean | `false` | Visually hides the label without removing its accessible name. |
|
|
264
|
+
| `items` | ListboxItems | Required | Readonly collection of options or named groups. Options have globally unique nonempty value and label strings, optional description, decorative IconDefinition and disabled. Groups have a nonempty label and options array. |
|
|
265
|
+
| `selectionMode` | 'single' \| 'multiple' | `single` | Single permits at most one selected value; multiple toggles each activation. |
|
|
266
|
+
| `selectedValues` | ListboxValues | — | Controlled selected values, including an empty array. Activation only proposes changes until the owner updates this prop. Missing collection values are retained, not automatically selected or removed. |
|
|
267
|
+
| `defaultSelectedValues` | ListboxValues | — | Initial autonomous selected values (empty by default). Later changes do not reset selection. |
|
|
268
|
+
| `variant` | 'plain' \| 'outlined' | `plain` | Plain composes inside a panel; outlined adds a standalone container boundary. |
|
|
269
|
+
| `size` | 'sm' \| 'md' \| 'lg' \| number | `md` | Semantic size or a positive finite minimum option height in CSS pixels/native logical units. Content may grow; native touch targets remain at least 44. |
|
|
270
|
+
| `disabled` | boolean | `false` | Prevents interaction and removes the list from keyboard navigation. |
|
|
271
|
+
| `readOnly` | boolean | `false` | Allows exploring options without proposing or committing selection changes. |
|
|
272
|
+
| `locale` | string | — | BCP 47 locale for typeahead. Web inherits the nearest language; native uses the runtime locale when omitted. Invalid locale identifiers are rejected. |
|
|
273
|
+
|
|
274
|
+
Events: `(selectionChange)` → `ListboxSelectionChangeDetail`.
|
|
275
|
+
|
|
276
|
+
```ts
|
|
277
|
+
import { Component } from '@angular/core';
|
|
278
|
+
import { CosmListboxComponent } from '@joralvmel/cosmos-angular';
|
|
279
|
+
const grouped = [{"label":"Fruit","options":[{"value":"apple","label":"Apple"},{"value":"cherry","label":"Cherry","description":"Seasonal"}]},{"label":"Vegetables","options":[{"value":"carrot","label":"Carrot"},{"value":"broccoli","label":"Broccoli","disabled":true}]}] as const;
|
|
280
|
+
const empty = [] as const;
|
|
281
|
+
import type { ListboxSelectionChangeDetail } from '@joralvmel/cosmos-core';
|
|
282
|
+
|
|
283
|
+
@Component({
|
|
284
|
+
selector: 'app-example',
|
|
285
|
+
imports: [CosmListboxComponent],
|
|
286
|
+
template: `<cosm-listbox label="Listbox" [items]="grouped" [defaultSelectedValues]="empty" (selectionChange)="onSelectionChange($event.detail)"></cosm-listbox>`,
|
|
287
|
+
})
|
|
288
|
+
export class ExampleComponent {
|
|
289
|
+
readonly grouped = grouped;
|
|
290
|
+
readonly empty = empty;
|
|
291
|
+
onSelectionChange(detail: ListboxSelectionChangeDetail) {
|
|
292
|
+
console.log(detail);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
113
296
|
|
|
114
297
|
## Themes
|
|
115
298
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joralvmel/cosmos-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Angular standalone components and forms integration for the Cosmos UI Web Components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@joralvmel/cosmos-core": "^0.
|
|
46
|
-
"@joralvmel/cosmos-elements": "^0.
|
|
45
|
+
"@joralvmel/cosmos-core": "^0.3.0",
|
|
46
|
+
"@joralvmel/cosmos-elements": "^0.3.0",
|
|
47
47
|
"@joralvmel/cosmos-icons": "^0.2.0",
|
|
48
48
|
"tslib": "^2.9.1"
|
|
49
49
|
},
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"@angular/forms": ">=21.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@angular/common": "^22.2.
|
|
55
|
+
"@angular/common": "^22.2.6",
|
|
56
56
|
"@angular/compiler": "^22.2.5",
|
|
57
|
-
"@angular/compiler-cli": "^22.2.
|
|
57
|
+
"@angular/compiler-cli": "^22.2.6",
|
|
58
58
|
"@angular/core": "^22.2.5",
|
|
59
|
-
"@angular/forms": "^22.2.
|
|
59
|
+
"@angular/forms": "^22.2.6",
|
|
60
60
|
"@angular/platform-browser": "^22.2.5",
|
|
61
61
|
"rxjs": "^7.8.2"
|
|
62
62
|
}
|