matcha-components 19.51.0 → 19.52.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.
|
@@ -212,20 +212,27 @@ class MatchaButtonItemComponent {
|
|
|
212
212
|
onClick() {
|
|
213
213
|
this.selected.emit();
|
|
214
214
|
}
|
|
215
|
-
setActiveState(isActive,
|
|
215
|
+
setActiveState(isActive, inactiveColor, inactiveType) {
|
|
216
216
|
this.active = isActive;
|
|
217
|
-
const color = isActive ?
|
|
218
|
-
const type = isActive ?
|
|
219
|
-
// Aplica a cor correta ao botão interno
|
|
220
|
-
|
|
217
|
+
const color = isActive ? '' : inactiveColor;
|
|
218
|
+
const type = isActive ? '' : inactiveType;
|
|
219
|
+
// Aplica a cor correta ao botão interno
|
|
220
|
+
if (isActive) {
|
|
221
|
+
this.renderer.setAttribute(this.innerButton.nativeElement, 'active-item', 'true');
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
this.renderer.removeAttribute(this.innerButton.nativeElement, 'active-item');
|
|
225
|
+
}
|
|
226
|
+
// inactiveType - pode ser 'basic', 'outline', 'alpha' ou 'pill'
|
|
227
|
+
// Se o tipo for 'basic', 'outline', 'alpha' ou 'pill', aplica o tipo correto
|
|
221
228
|
// Limpa todos os tipos anteriores
|
|
222
|
-
['basic', 'outline', 'alpha', 'pill'].forEach(attr => {
|
|
223
|
-
|
|
224
|
-
});
|
|
229
|
+
// ['basic', 'outline', 'alpha', 'pill'].forEach(attr => {
|
|
230
|
+
// this.renderer.setAttribute(this.innerButton.nativeElement, attr, 'false');
|
|
231
|
+
// });
|
|
225
232
|
// Aplica o tipo correto ao botão interno se houver algum
|
|
226
|
-
if (type) {
|
|
227
|
-
|
|
228
|
-
}
|
|
233
|
+
// if (type) {
|
|
234
|
+
// this.renderer.setAttribute(this.innerButton.nativeElement, type, 'true');
|
|
235
|
+
// }
|
|
229
236
|
}
|
|
230
237
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: MatchaButtonItemComponent, deps: [{ token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
231
238
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: MatchaButtonItemComponent, isStandalone: false, selector: "matcha-button-item", inputs: { active: "active" }, outputs: { selected: "selected" }, queries: [{ propertyName: "innerButton", first: true, predicate: MatchaButtonComponent, descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<ng-content></ng-content>\n", styles: [""] }); }
|
|
@@ -246,9 +253,7 @@ class MatchaButtonGroupComponent {
|
|
|
246
253
|
constructor() {
|
|
247
254
|
this._multiple = false;
|
|
248
255
|
this._disabled = false;
|
|
249
|
-
this.activeColor = 'blue';
|
|
250
256
|
this.inactiveColor = 'disabled';
|
|
251
|
-
this.activeType = '';
|
|
252
257
|
this.inactiveType = 'basic';
|
|
253
258
|
this._gap = 16;
|
|
254
259
|
}
|
|
@@ -278,22 +283,22 @@ class MatchaButtonGroupComponent {
|
|
|
278
283
|
this.buttonItems.forEach((item, index) => {
|
|
279
284
|
const isFirst = index === 0;
|
|
280
285
|
// Opcionalmente, primeiro botão pode iniciar ativo por padrão
|
|
281
|
-
item.setActiveState(isFirst, this.
|
|
286
|
+
item.setActiveState(isFirst, this.inactiveColor, this.inactiveType);
|
|
282
287
|
item.selected.subscribe(() => this.onItemSelected(item));
|
|
283
288
|
});
|
|
284
289
|
}
|
|
285
290
|
onItemSelected(selectedItem) {
|
|
286
291
|
if (this.multiple) {
|
|
287
|
-
selectedItem.setActiveState(!selectedItem.active, this.
|
|
292
|
+
selectedItem.setActiveState(!selectedItem.active, this.inactiveColor, this.inactiveType);
|
|
288
293
|
}
|
|
289
294
|
else {
|
|
290
295
|
this.buttonItems.forEach(item => {
|
|
291
|
-
item.setActiveState(item === selectedItem, this.
|
|
296
|
+
item.setActiveState(item === selectedItem, this.inactiveColor, this.inactiveType);
|
|
292
297
|
});
|
|
293
298
|
}
|
|
294
299
|
}
|
|
295
300
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: MatchaButtonGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
296
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: MatchaButtonGroupComponent, isStandalone: false, selector: "matcha-button-group", inputs: { multiple: "multiple", disabled: "disabled",
|
|
301
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: MatchaButtonGroupComponent, isStandalone: false, selector: "matcha-button-group", inputs: { multiple: "multiple", disabled: "disabled", inactiveColor: "inactiveColor", inactiveType: "inactiveType", gap: "gap" }, host: { properties: { "attr.disabled": "this.isDisabled" } }, queries: [{ propertyName: "buttonItems", predicate: MatchaButtonItemComponent }], ngImport: i0, template: "<div class=\"button-group d-flex flex-wrap\" [ngClass]=\"gapClass\" role=\"group\"><ng-content></ng-content></div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
297
302
|
}
|
|
298
303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: MatchaButtonGroupComponent, decorators: [{
|
|
299
304
|
type: Component,
|
|
@@ -305,12 +310,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
|
|
|
305
310
|
}], isDisabled: [{
|
|
306
311
|
type: HostBinding,
|
|
307
312
|
args: ['attr.disabled']
|
|
308
|
-
}], activeColor: [{
|
|
309
|
-
type: Input
|
|
310
313
|
}], inactiveColor: [{
|
|
311
314
|
type: Input
|
|
312
|
-
}], activeType: [{
|
|
313
|
-
type: Input
|
|
314
315
|
}], inactiveType: [{
|
|
315
316
|
type: Input
|
|
316
317
|
}], gap: [{
|