matcha-components 20.160.0 → 20.162.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.
@@ -372,6 +372,7 @@ class MatchaAccordionItemComponent {
372
372
  this._isOpen = false;
373
373
  this._clickableHeader = true;
374
374
  this.opened = new EventEmitter();
375
+ this.isOpenChange = new EventEmitter();
375
376
  this.toggleRequested = new EventEmitter();
376
377
  }
377
378
  set stretch(value) {
@@ -390,7 +391,12 @@ class MatchaAccordionItemComponent {
390
391
  return this._clickableHeader;
391
392
  }
392
393
  set isOpen(value) {
393
- this._isOpen = value != null && `${value}` !== 'false';
394
+ const newValue = value != null && `${value}` !== 'false';
395
+ if (this._isOpen !== newValue) {
396
+ this._isOpen = newValue;
397
+ this.isOpenChange.emit(this._isOpen);
398
+ this.opened.emit(this._isOpen);
399
+ }
394
400
  }
395
401
  get isOpen() {
396
402
  return this._isOpen;
@@ -402,20 +408,19 @@ class MatchaAccordionItemComponent {
402
408
  this.opened.emit(this.isOpen);
403
409
  }
404
410
  ngOnChanges(changes) {
405
- if (changes['isOpen']) {
406
- this.opened.emit(this.isOpen);
407
- }
411
+ // O setter já lida com a emissão de mudanças,
412
+ // mas mantemos o gancho se necessário para outros inputs no futuro.
408
413
  }
409
414
  toggleAccordion() {
410
415
  // Emite evento para o accordion pai controlar o estado
411
416
  this.toggleRequested.emit();
412
417
  }
413
418
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAccordionItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
414
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAccordionItemComponent, isStandalone: false, selector: "matcha-accordion-item", inputs: { stretch: "stretch", clickableHeader: "clickableHeader", isOpen: "isOpen" }, outputs: { opened: "opened", toggleRequested: "toggleRequested" }, host: { properties: { "class.stretch": "this.stretchClass", "class.is-open": "this.isOpenClass" } }, usesOnChanges: true, ngImport: i0, template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [""], animations: [...createAnimations] }); }
419
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAccordionItemComponent, isStandalone: false, selector: "matcha-accordion-item", inputs: { stretch: "stretch", clickableHeader: "clickableHeader", isOpen: "isOpen" }, outputs: { opened: "opened", isOpenChange: "isOpenChange", toggleRequested: "toggleRequested" }, host: { properties: { "class.stretch": "this.stretchClass", "class.is-open": "this.isOpenClass" } }, exportAs: ["matchaAccordionItem"], usesOnChanges: true, ngImport: i0, template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [""], animations: [...createAnimations] }); }
415
420
  }
416
421
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAccordionItemComponent, decorators: [{
417
422
  type: Component,
418
- args: [{ selector: 'matcha-accordion-item', standalone: false, animations: [...createAnimations], template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n" }]
423
+ args: [{ selector: 'matcha-accordion-item', standalone: false, animations: [...createAnimations], exportAs: 'matchaAccordionItem', template: "<div class=\"accordion-item flex-column overflow-hidden\">\n <div class=\"accordion-header d-flex\">\n <div class=\"d-flex accordion-header-wrapper\"\n [class.cursor-pointer]=\"clickableHeader\"\n (click)=\"clickableHeader ? toggleAccordion() : null\">\n <ng-content select=\"matcha-accordion-header\"></ng-content>\n </div>\n </div>\n <div class=\"accordion-content overflow-hidden\" [@expandCollapse]=\"isOpen ? '*' : 'void'\">\n <ng-content select=\"matcha-accordion-content\"></ng-content>\n <ng-content></ng-content>\n </div>\n</div>\n" }]
419
424
  }], propDecorators: { stretch: [{
420
425
  type: Input
421
426
  }], stretchClass: [{
@@ -430,6 +435,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
430
435
  args: ['class.is-open']
431
436
  }], opened: [{
432
437
  type: Output
438
+ }], isOpenChange: [{
439
+ type: Output
433
440
  }], toggleRequested: [{
434
441
  type: Output
435
442
  }] } });
@@ -8819,6 +8826,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
8819
8826
  }] } });
8820
8827
 
8821
8828
  class MatchaAutocompleteComponent {
8829
+ /**
8830
+ * HostBinding para adicionar classe disabled no elemento raiz do componente
8831
+ * Isso permite que o matcha-form-field detecte o estado disabled
8832
+ */
8833
+ get hostDisabledClass() {
8834
+ return this.disabled;
8835
+ }
8836
+ /**
8837
+ * HostBinding para adicionar atributo disabled no elemento raiz do componente
8838
+ * Isso permite que o matcha-form-field detecte o estado disabled
8839
+ */
8840
+ get hostDisabledAttr() {
8841
+ return this.disabled ? '' : null;
8842
+ }
8822
8843
  constructor(elRef, renderer, cdr) {
8823
8844
  this.elRef = elRef;
8824
8845
  this.renderer = renderer;
@@ -8829,6 +8850,7 @@ class MatchaAutocompleteComponent {
8829
8850
  this.placement = 'auto';
8830
8851
  this.maxHeight = 280;
8831
8852
  this.minWidth = 160;
8853
+ this.disabled = false;
8832
8854
  // Funcionalidades avançadas
8833
8855
  this.autoSelectOnBlur = false;
8834
8856
  this.displayWith = null;
@@ -8895,6 +8917,8 @@ class MatchaAutocompleteComponent {
8895
8917
  console.log('MatchaAutocomplete: Evento de seleção disparado', data);
8896
8918
  }
8897
8919
  openPanel() {
8920
+ if (this.disabled)
8921
+ return;
8898
8922
  if (!this.triggerElement) {
8899
8923
  console.log('MatchaAutocomplete: triggerElement não encontrado');
8900
8924
  return;
@@ -8925,6 +8949,8 @@ class MatchaAutocompleteComponent {
8925
8949
  this.closed.emit();
8926
8950
  }
8927
8951
  togglePanel() {
8952
+ if (this.disabled)
8953
+ return;
8928
8954
  this.open ? this.closePanel() : this.openPanel();
8929
8955
  }
8930
8956
  resetActive() {
@@ -9069,7 +9095,7 @@ class MatchaAutocompleteComponent {
9069
9095
  return null;
9070
9096
  }
9071
9097
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAutocompleteComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
9072
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAutocompleteComponent, isStandalone: false, selector: "matcha-autocomplete", inputs: { placement: "placement", maxHeight: "maxHeight", minWidth: "minWidth", autoSelectOnBlur: "autoSelectOnBlur", displayWith: "displayWith", displayProperty: "displayProperty", showClearButton: "showClearButton", clearButtonIcon: "clearButtonIcon", clearButtonAriaLabel: "clearButtonAriaLabel" }, outputs: { opened: "opened", closed: "closed", cleared: "cleared", autoSelected: "autoSelected" }, queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"matcha-autocomplete-container\">\n <matcha-panel\n #panel\n [open]=\"open\"\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [triggerElement]=\"triggerElement\"\n (opened)=\"opened.emit()\"\n (closed)=\"closed.emit()\">\n <div class=\"matcha-panel-content flex-column\">\n <ng-content></ng-content>\n </div>\n </matcha-panel>\n</div>\n", dependencies: [{ kind: "component", type: MatchaPanelComponent, selector: "matcha-panel", inputs: ["placement", "maxHeight", "minWidth", "offset", "triggerElement", "open"], outputs: ["opened", "closed"] }], encapsulation: i0.ViewEncapsulation.None }); }
9098
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAutocompleteComponent, isStandalone: false, selector: "matcha-autocomplete", inputs: { placement: "placement", maxHeight: "maxHeight", minWidth: "minWidth", disabled: "disabled", autoSelectOnBlur: "autoSelectOnBlur", displayWith: "displayWith", displayProperty: "displayProperty", showClearButton: "showClearButton", clearButtonIcon: "clearButtonIcon", clearButtonAriaLabel: "clearButtonAriaLabel" }, outputs: { opened: "opened", closed: "closed", cleared: "cleared", autoSelected: "autoSelected" }, host: { properties: { "class.matcha-autocomplete-disabled": "this.hostDisabledClass", "attr.disabled": "this.hostDisabledAttr" } }, queries: [{ propertyName: "options", predicate: MatchaOptionComponent, descendants: true }], viewQueries: [{ propertyName: "panel", first: true, predicate: MatchaPanelComponent, descendants: true }], ngImport: i0, template: "<div class=\"matcha-autocomplete-container\">\n <matcha-panel\n #panel\n [open]=\"open\"\n [placement]=\"placement\"\n [maxHeight]=\"maxHeight\"\n [minWidth]=\"minWidth\"\n [triggerElement]=\"triggerElement\"\n (opened)=\"opened.emit()\"\n (closed)=\"closed.emit()\">\n <div class=\"matcha-panel-content flex-column\">\n <ng-content></ng-content>\n </div>\n </matcha-panel>\n</div>\n", dependencies: [{ kind: "component", type: MatchaPanelComponent, selector: "matcha-panel", inputs: ["placement", "maxHeight", "minWidth", "offset", "triggerElement", "open"], outputs: ["opened", "closed"] }], encapsulation: i0.ViewEncapsulation.None }); }
9073
9099
  }
9074
9100
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAutocompleteComponent, decorators: [{
9075
9101
  type: Component,
@@ -9086,6 +9112,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
9086
9112
  type: Input
9087
9113
  }], minWidth: [{
9088
9114
  type: Input
9115
+ }], disabled: [{
9116
+ type: Input
9117
+ }], hostDisabledClass: [{
9118
+ type: HostBinding,
9119
+ args: ['class.matcha-autocomplete-disabled']
9120
+ }], hostDisabledAttr: [{
9121
+ type: HostBinding,
9122
+ args: ['attr.disabled']
9089
9123
  }], autoSelectOnBlur: [{
9090
9124
  type: Input
9091
9125
  }], displayWith: [{
@@ -12197,6 +12231,7 @@ class MatchaAutocompleteTriggerDirective {
12197
12231
  this.renderer = renderer;
12198
12232
  this.cdr = cdr;
12199
12233
  this.ngControl = ngControl;
12234
+ this.disabled = false;
12200
12235
  this.subs = new Subscription();
12201
12236
  }
12202
12237
  ngAfterViewInit() {
@@ -12340,6 +12375,8 @@ class MatchaAutocompleteTriggerDirective {
12340
12375
  this.updateClearButtonVisibility();
12341
12376
  }
12342
12377
  onClick() {
12378
+ if (this.disabled || this.panel?.disabled || this.el.nativeElement.disabled)
12379
+ return;
12343
12380
  // Abrir painel quando clicar no input
12344
12381
  this.panel.openPanel();
12345
12382
  }
@@ -12348,6 +12385,8 @@ class MatchaAutocompleteTriggerDirective {
12348
12385
  // O painel será aberto apenas quando o usuário clicar ou digitar
12349
12386
  }
12350
12387
  onInput(e) {
12388
+ if (this.disabled || this.panel?.disabled || this.el.nativeElement.disabled)
12389
+ return;
12351
12390
  // se o usuário digitar, apenas reabre painel. O filtro de opções geralmente é controlado pelo componente pai
12352
12391
  if (!this.panel.open)
12353
12392
  this.panel.openPanel();
@@ -12394,7 +12433,7 @@ class MatchaAutocompleteTriggerDirective {
12394
12433
  }
12395
12434
  }
12396
12435
  onKeydown(ev) {
12397
- if (!this.panel)
12436
+ if (!this.panel || this.disabled || this.panel.disabled || this.el.nativeElement.disabled)
12398
12437
  return;
12399
12438
  switch (ev.key) {
12400
12439
  case 'ArrowDown':
@@ -12500,7 +12539,7 @@ class MatchaAutocompleteTriggerDirective {
12500
12539
  if (!this.clearButton)
12501
12540
  return;
12502
12541
  const hasSelection = this.panel.hasSelection();
12503
- const isDisabled = this.el.nativeElement.disabled;
12542
+ const isDisabled = this.el.nativeElement.disabled || this.disabled || this.panel?.disabled;
12504
12543
  if (hasSelection && !isDisabled && this.panel.showClearButton) {
12505
12544
  this.renderer.setStyle(this.clearButton, 'display', 'block');
12506
12545
  }
@@ -12509,7 +12548,7 @@ class MatchaAutocompleteTriggerDirective {
12509
12548
  }
12510
12549
  }
12511
12550
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAutocompleteTriggerDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i2.NgControl, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
12512
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAutocompleteTriggerDirective, isStandalone: false, selector: "[matchaAutocomplete]", inputs: { panel: ["matchaAutocomplete", "panel"] }, host: { listeners: { "click": "onClick()", "focus": "onFocus()", "input": "onInput($event)", "blur": "onBlur()", "keydown": "onKeydown($event)", "document:click": "onDocClick($event)" } }, ngImport: i0 }); }
12551
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.0", type: MatchaAutocompleteTriggerDirective, isStandalone: false, selector: "[matchaAutocomplete]", inputs: { panel: ["matchaAutocomplete", "panel"], disabled: "disabled" }, host: { listeners: { "click": "onClick()", "focus": "onFocus()", "input": "onInput($event)", "blur": "onBlur()", "keydown": "onKeydown($event)", "document:click": "onDocClick($event)" } }, ngImport: i0 }); }
12513
12552
  }
12514
12553
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MatchaAutocompleteTriggerDirective, decorators: [{
12515
12554
  type: Directive,
@@ -12522,6 +12561,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
12522
12561
  }] }], propDecorators: { panel: [{
12523
12562
  type: Input,
12524
12563
  args: ['matchaAutocomplete']
12564
+ }], disabled: [{
12565
+ type: Input
12525
12566
  }], onClick: [{
12526
12567
  type: HostListener,
12527
12568
  args: ['click']