matcha-components 20.273.0 → 20.275.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/fesm2022/matcha-components.mjs +40 -51
- package/fesm2022/matcha-components.mjs.map +1 -1
- package/index.d.ts +11 -21
- package/package.json +1 -1
|
@@ -3055,7 +3055,7 @@ class MatchaButtonComponent {
|
|
|
3055
3055
|
}
|
|
3056
3056
|
}
|
|
3057
3057
|
setGap() {
|
|
3058
|
-
this._renderer.addClass(this._elementRef.nativeElement, `px-${this.gap}`);
|
|
3058
|
+
this._renderer.addClass(this._elementRef.nativeElement, `px-${this.gap}--force`);
|
|
3059
3059
|
this._renderer.addClass(this._elementRef.nativeElement, `gap-${this.gap}`);
|
|
3060
3060
|
this._config.gap = this.gap;
|
|
3061
3061
|
}
|
|
@@ -14074,63 +14074,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
14074
14074
|
|
|
14075
14075
|
class MatchaChipComponent {
|
|
14076
14076
|
get hostClasses() {
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
this.
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
get
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14077
|
+
const classes = ['matcha-chip'];
|
|
14078
|
+
if (this._removable)
|
|
14079
|
+
classes.push('matcha-chip-removable');
|
|
14080
|
+
if (this._selected)
|
|
14081
|
+
classes.push('matcha-chip-selected');
|
|
14082
|
+
if (this._selectable)
|
|
14083
|
+
classes.push('matcha-chip-selectable');
|
|
14084
|
+
if (this._disabled)
|
|
14085
|
+
classes.push('matcha-chip-disabled');
|
|
14086
|
+
return classes.join(' ');
|
|
14087
|
+
}
|
|
14088
|
+
get selected() { return this._selected; }
|
|
14089
|
+
set selected(v) {
|
|
14090
|
+
const coerced = v === 'false' ? false : !!v;
|
|
14091
|
+
if (this._selected !== coerced) {
|
|
14092
|
+
this._selected = coerced;
|
|
14093
|
+
this.selectedChange.emit(this._selected);
|
|
14094
|
+
}
|
|
14095
|
+
}
|
|
14096
|
+
get selectable() { return this._selectable; }
|
|
14097
|
+
set selectable(v) { this._selectable = v === 'false' ? false : !!v; }
|
|
14098
|
+
get removable() { return this._removable; }
|
|
14099
|
+
set removable(v) { this._removable = v === 'false' ? false : !!v; }
|
|
14100
|
+
get disabled() { return this._disabled; }
|
|
14101
|
+
set disabled(v) { this._disabled = v === 'false' ? false : !!v; }
|
|
14094
14102
|
constructor(_elementRef) {
|
|
14095
14103
|
this._elementRef = _elementRef;
|
|
14096
|
-
/** Cor do chip (primary, accent, warn) */
|
|
14097
14104
|
this.color = 'default';
|
|
14098
14105
|
this._selected = false;
|
|
14099
|
-
|
|
14100
|
-
this.
|
|
14101
|
-
/** Se o chip pode ser removido */
|
|
14102
|
-
this.removable = false;
|
|
14106
|
+
this._selectable = false;
|
|
14107
|
+
this._removable = false;
|
|
14103
14108
|
this._disabled = false;
|
|
14104
|
-
/** Valor associado ao chip */
|
|
14105
14109
|
this.value = null;
|
|
14106
|
-
/** Evento emitido quando o chip é selecionado */
|
|
14107
14110
|
this.selectedChange = new EventEmitter();
|
|
14108
|
-
/** Evento emitido quando o botão de remover é clicado */
|
|
14109
14111
|
this.removed = new EventEmitter();
|
|
14110
|
-
/** Evento emitido quando o chip é destruído */
|
|
14111
14112
|
this.destroyed = new EventEmitter();
|
|
14112
14113
|
this._hasCustomRemoveIcon = false;
|
|
14113
14114
|
}
|
|
14114
14115
|
ngOnInit() {
|
|
14115
|
-
|
|
14116
|
-
element.classList.add('matcha-chip', 'radius-full', 'd-flex', 'align-items-center', 'gap-8', 'px-14', 'py-10', 'h-20');
|
|
14117
|
-
// Verifica conteúdo projetado antes do template renderizar o botão padrão
|
|
14118
|
-
this._hasCustomRemoveIcon = element.querySelector('[matchaChipRemove]') !== null;
|
|
14116
|
+
this._hasCustomRemoveIcon = this._elementRef.nativeElement.querySelector('[matchaChipRemove]') !== null;
|
|
14119
14117
|
}
|
|
14120
14118
|
ngAfterViewInit() {
|
|
14121
14119
|
this._setupChipRemoveDirective();
|
|
14122
14120
|
}
|
|
14123
14121
|
_setupChipRemoveDirective() {
|
|
14124
|
-
// Usa event delegation para capturar cliques em elementos com matchaChipRemove
|
|
14125
14122
|
this._elementRef.nativeElement.addEventListener('click', (event) => {
|
|
14126
14123
|
const target = event.target;
|
|
14127
|
-
// Verifica se o elemento clicado tem o atributo matchaChipRemove
|
|
14128
|
-
// ou se é um elemento filho de um elemento com matchaChipRemove
|
|
14129
14124
|
const removeElement = target.closest('[matchaChipRemove]');
|
|
14130
14125
|
if (removeElement) {
|
|
14131
14126
|
event.stopPropagation();
|
|
14132
14127
|
event.preventDefault();
|
|
14133
|
-
if (this.
|
|
14128
|
+
if (this._removable && !this._disabled) {
|
|
14134
14129
|
this.remove();
|
|
14135
14130
|
}
|
|
14136
14131
|
}
|
|
@@ -14139,51 +14134,45 @@ class MatchaChipComponent {
|
|
|
14139
14134
|
hasCustomRemoveIcon() {
|
|
14140
14135
|
return this._elementRef.nativeElement.querySelector('[matchaChipRemove]') !== null;
|
|
14141
14136
|
}
|
|
14142
|
-
/** Manipula o clique no chip */
|
|
14143
14137
|
_handleClick(event) {
|
|
14144
|
-
if (this.
|
|
14138
|
+
if (this._disabled) {
|
|
14145
14139
|
event.preventDefault();
|
|
14146
14140
|
return;
|
|
14147
14141
|
}
|
|
14148
|
-
if (this.
|
|
14142
|
+
if (this._selectable) {
|
|
14149
14143
|
this.toggleSelected();
|
|
14150
14144
|
}
|
|
14151
14145
|
}
|
|
14152
|
-
/** Manipula o evento de teclado */
|
|
14153
14146
|
_handleKeydown(event) {
|
|
14154
|
-
if (this.
|
|
14147
|
+
if (this._disabled)
|
|
14155
14148
|
return;
|
|
14156
|
-
}
|
|
14157
14149
|
switch (event.key) {
|
|
14158
14150
|
case 'Delete':
|
|
14159
14151
|
case 'Backspace':
|
|
14160
|
-
if (this.
|
|
14152
|
+
if (this._removable) {
|
|
14161
14153
|
this.remove();
|
|
14162
14154
|
event.preventDefault();
|
|
14163
14155
|
}
|
|
14164
14156
|
break;
|
|
14165
14157
|
case ' ':
|
|
14166
14158
|
case 'Enter':
|
|
14167
|
-
if (this.
|
|
14159
|
+
if (this._selectable) {
|
|
14168
14160
|
this.toggleSelected();
|
|
14169
14161
|
event.preventDefault();
|
|
14170
14162
|
}
|
|
14171
14163
|
break;
|
|
14172
14164
|
}
|
|
14173
14165
|
}
|
|
14174
|
-
/** Alterna o estado de seleção do chip */
|
|
14175
14166
|
toggleSelected() {
|
|
14176
|
-
if (this.
|
|
14177
|
-
this.selected = !this.
|
|
14167
|
+
if (this._selectable && !this._disabled) {
|
|
14168
|
+
this.selected = !this._selected;
|
|
14178
14169
|
}
|
|
14179
14170
|
}
|
|
14180
|
-
/** Remove o chip */
|
|
14181
14171
|
remove() {
|
|
14182
|
-
if (this.
|
|
14172
|
+
if (this._removable && !this._disabled) {
|
|
14183
14173
|
this.removed.emit(this);
|
|
14184
14174
|
}
|
|
14185
14175
|
}
|
|
14186
|
-
/** Foco no elemento do chip */
|
|
14187
14176
|
focus() {
|
|
14188
14177
|
this._elementRef.nativeElement.focus();
|
|
14189
14178
|
}
|
|
@@ -14191,11 +14180,11 @@ class MatchaChipComponent {
|
|
|
14191
14180
|
this.destroyed.emit(this);
|
|
14192
14181
|
}
|
|
14193
14182
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaChipComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14194
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaChipComponent, isStandalone: false, selector: "matcha-chip", inputs: { color: "color", selected: "selected", selectable: "selectable", removable: "removable", disabled: "disabled", value: "value" }, outputs: { selectedChange: "selectedChange", removed: "removed", destroyed: "destroyed" }, host: { listeners: { "click": "_handleClick($event)", "keydown": "_handleKeydown($event)" }, properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<span class=\"matcha-chip-content color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable && !_hasCustomRemoveIcon\">\n <matcha-divider direction=\"vertical\" gap=\"0\"></matcha-divider>\n <button \n type=\"button\"\n class=\"matcha-chip-remove d-flex align-items-center justify-content-center w-20 h-20 min-w-20 radius-full cursor-pointer border-0 background-transparent p-0 m-0\"\n [disabled]=\"disabled\"\n (click)=\"remove(); $event.stopPropagation()\"\n tabindex=\"-1\"\n aria-label=\"Remove\"\n matchaChipRemove>\n <matcha-icon name=\"close\" class=\"fs-14\" color=\"label\"></matcha-icon>\n </button>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatchaDividerComponent, selector: "matcha-divider", inputs: ["gap", "gap-sm", "gap-md", "gap-lg", "gap-xl", "direction"] }, { kind: "component", type: MatchaIconComponent, selector: "matcha-icon", inputs: ["name", "size", "color", "class", "loading"] }] }); }
|
|
14183
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaChipComponent, isStandalone: false, selector: "matcha-chip", inputs: { color: "color", selected: "selected", selectable: "selectable", removable: "removable", disabled: "disabled", value: "value" }, outputs: { selectedChange: "selectedChange", removed: "removed", destroyed: "destroyed" }, host: { listeners: { "click": "_handleClick($event)", "keydown": "_handleKeydown($event)" }, properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<span class=\"matcha-chip-content color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable && !_hasCustomRemoveIcon\">\n <matcha-divider direction=\"vertical\" gap=\"0\" class=\"py-8\"></matcha-divider>\n <button \n type=\"button\"\n class=\"matcha-chip-remove d-flex align-items-center justify-content-center w-20 h-20 min-w-20 radius-full cursor-pointer border-0 background-transparent p-0 m-0\"\n [disabled]=\"disabled\"\n (click)=\"remove(); $event.stopPropagation()\"\n tabindex=\"-1\"\n aria-label=\"Remove\"\n matchaChipRemove>\n <matcha-icon name=\"close\" class=\"fs-14\" color=\"label\"></matcha-icon>\n </button>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: MatchaDividerComponent, selector: "matcha-divider", inputs: ["gap", "gap-sm", "gap-md", "gap-lg", "gap-xl", "direction"] }, { kind: "component", type: MatchaIconComponent, selector: "matcha-icon", inputs: ["name", "size", "color", "class", "loading"] }] }); }
|
|
14195
14184
|
}
|
|
14196
14185
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaChipComponent, decorators: [{
|
|
14197
14186
|
type: Component,
|
|
14198
|
-
args: [{ selector: 'matcha-chip', standalone: false, template: "<span class=\"matcha-chip-content color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable && !_hasCustomRemoveIcon\">\n <matcha-divider direction=\"vertical\" gap=\"0\"></matcha-divider>\n <button \n type=\"button\"\n class=\"matcha-chip-remove d-flex align-items-center justify-content-center w-20 h-20 min-w-20 radius-full cursor-pointer border-0 background-transparent p-0 m-0\"\n [disabled]=\"disabled\"\n (click)=\"remove(); $event.stopPropagation()\"\n tabindex=\"-1\"\n aria-label=\"Remove\"\n matchaChipRemove>\n <matcha-icon name=\"close\" class=\"fs-14\" color=\"label\"></matcha-icon>\n </button>\n</ng-container>\n" }]
|
|
14187
|
+
args: [{ selector: 'matcha-chip', standalone: false, template: "<span class=\"matcha-chip-content color-label\">\n <ng-content></ng-content>\n</span>\n<ng-container *ngIf=\"removable && !_hasCustomRemoveIcon\">\n <matcha-divider direction=\"vertical\" gap=\"0\" class=\"py-8\"></matcha-divider>\n <button \n type=\"button\"\n class=\"matcha-chip-remove d-flex align-items-center justify-content-center w-20 h-20 min-w-20 radius-full cursor-pointer border-0 background-transparent p-0 m-0\"\n [disabled]=\"disabled\"\n (click)=\"remove(); $event.stopPropagation()\"\n tabindex=\"-1\"\n aria-label=\"Remove\"\n matchaChipRemove>\n <matcha-icon name=\"close\" class=\"fs-14\" color=\"label\"></matcha-icon>\n </button>\n</ng-container>\n" }]
|
|
14199
14188
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { hostClasses: [{
|
|
14200
14189
|
type: HostBinding,
|
|
14201
14190
|
args: ['class']
|