matcha-components 20.66.0 → 20.67.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.
@@ -9640,6 +9640,8 @@ class MatchaChipComponent {
9640
9640
  /** Se o chip pode ser removido */
9641
9641
  this.removable = false;
9642
9642
  this._disabled = false;
9643
+ /** Valor associado ao chip */
9644
+ this.value = null;
9643
9645
  /** Evento emitido quando o chip é selecionado */
9644
9646
  this.selectedChange = new EventEmitter();
9645
9647
  /** Evento emitido quando o botão de remover é clicado */
@@ -9654,8 +9656,12 @@ class MatchaChipComponent {
9654
9656
  // Usa event delegation para capturar cliques em elementos com matchaChipRemove
9655
9657
  this._elementRef.nativeElement.addEventListener('click', (event) => {
9656
9658
  const target = event.target;
9657
- if (target && target.hasAttribute('matchaChipRemove')) {
9659
+ // Verifica se o elemento clicado tem o atributo matchaChipRemove
9660
+ // ou se é um elemento filho de um elemento com matchaChipRemove
9661
+ const removeElement = target.closest('[matchaChipRemove]');
9662
+ if (removeElement) {
9658
9663
  event.stopPropagation();
9664
+ event.preventDefault();
9659
9665
  if (this.removable && !this.disabled) {
9660
9666
  this.remove();
9661
9667
  }
@@ -9717,11 +9723,11 @@ class MatchaChipComponent {
9717
9723
  this.destroyed.emit(this);
9718
9724
  }
9719
9725
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: MatchaChipComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
9720
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.7", 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 fs-14 fw-700 lh-20 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 <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"] }] }); }
9726
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.7", 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 fs-14 fw-700 lh-20 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"] }] }); }
9721
9727
  }
9722
9728
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: MatchaChipComponent, decorators: [{
9723
9729
  type: Component,
9724
- args: [{ selector: 'matcha-chip', standalone: false, template: "<span class=\"matcha-chip-content fs-14 fw-700 lh-20 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 <matcha-icon name=\"close\" class=\"fs-14\" color=\"label\"></matcha-icon>\n </button>\n</ng-container>\n" }]
9730
+ args: [{ selector: 'matcha-chip', standalone: false, template: "<span class=\"matcha-chip-content fs-14 fw-700 lh-20 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" }]
9725
9731
  }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { color: [{
9726
9732
  type: Input
9727
9733
  }], selected: [{
@@ -9762,6 +9768,8 @@ class MatchaChipListComponent {
9762
9768
  this.orientation = 'horizontal';
9763
9769
  /** Evento emitido quando a seleção muda */
9764
9770
  this.change = new EventEmitter();
9771
+ /** Evento emitido quando um chip é removido */
9772
+ this.removed = new EventEmitter();
9765
9773
  this.chipListClass = true;
9766
9774
  this.role = 'listbox';
9767
9775
  this._chipSubscriptions = [];
@@ -9815,7 +9823,11 @@ class MatchaChipListComponent {
9815
9823
  const selectedChangeSub = chip.selectedChange.subscribe(() => {
9816
9824
  this._onChipSelectionChange(chip);
9817
9825
  });
9818
- this._chipSubscriptions.push(selectedChangeSub);
9826
+ // Listener para remoção de chips
9827
+ const removedSub = chip.removed.subscribe(() => {
9828
+ this._onChipRemoved(chip);
9829
+ });
9830
+ this._chipSubscriptions.push(selectedChangeSub, removedSub);
9819
9831
  });
9820
9832
  }
9821
9833
  /** Limpa as subscrições dos chips */
@@ -9839,6 +9851,20 @@ class MatchaChipListComponent {
9839
9851
  this._updateValue();
9840
9852
  this.onTouched();
9841
9853
  }
9854
+ /** Manipula remoção de um chip */
9855
+ _onChipRemoved(chip) {
9856
+ if (this.disabled) {
9857
+ return;
9858
+ }
9859
+ // Remove o chip da seleção se estiver selecionado
9860
+ if (chip.selected) {
9861
+ chip.selected = false;
9862
+ this._updateValue();
9863
+ }
9864
+ // Emite o evento de remoção
9865
+ this.removed.emit(chip);
9866
+ this.onTouched();
9867
+ }
9842
9868
  /** Atualiza o valor baseado nos chips selecionados */
9843
9869
  _updateValue() {
9844
9870
  if (this.multiple) {
@@ -9950,7 +9976,7 @@ class MatchaChipListComponent {
9950
9976
  this.disabled = isDisabled;
9951
9977
  }
9952
9978
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: MatchaChipListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9953
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.7", type: MatchaChipListComponent, isStandalone: false, selector: "matcha-chip-list", inputs: { multiple: "multiple", selectable: "selectable", disabled: "disabled", value: "value", orientation: "orientation" }, outputs: { change: "change" }, host: { listeners: { "keydown": "_handleKeydown($event)" }, properties: { "class.matcha-chip-list": "this.chipListClass", "class.matcha-chip-list-disabled": "this.isDisabled", "attr.role": "this.role", "attr.aria-multiselectable": "this.ariaMultiselectable", "attr.aria-disabled": "this.ariaDisabled" } }, providers: [
9979
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.7", type: MatchaChipListComponent, isStandalone: false, selector: "matcha-chip-list", inputs: { multiple: "multiple", selectable: "selectable", disabled: "disabled", value: "value", orientation: "orientation" }, outputs: { change: "change", removed: "removed" }, host: { listeners: { "keydown": "_handleKeydown($event)" }, properties: { "class.matcha-chip-list": "this.chipListClass", "class.matcha-chip-list-disabled": "this.isDisabled", "attr.role": "this.role", "attr.aria-multiselectable": "this.ariaMultiselectable", "attr.aria-disabled": "this.ariaDisabled" } }, providers: [
9954
9980
  {
9955
9981
  provide: NG_VALUE_ACCESSOR,
9956
9982
  useExisting: forwardRef(() => MatchaChipListComponent),
@@ -9979,6 +10005,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
9979
10005
  type: Input
9980
10006
  }], change: [{
9981
10007
  type: Output
10008
+ }], removed: [{
10009
+ type: Output
9982
10010
  }], chips: [{
9983
10011
  type: ContentChildren,
9984
10012
  args: [MatchaChipComponent, { descendants: true }]
@@ -12059,7 +12087,8 @@ class MatchaComponentsModule {
12059
12087
  MatchaPageLayoutModule,
12060
12088
  MatchaDrawerModule,
12061
12089
  MatchaHighlightModule,
12062
- MatchaMaskModule], exports: [MatchaAccordionModule,
12090
+ MatchaMaskModule,
12091
+ MatchaChipModule], exports: [MatchaAccordionModule,
12063
12092
  MatchaAutocompleteModule,
12064
12093
  MatchaOptionModule,
12065
12094
  MatchaPanelModule,
@@ -12137,7 +12166,8 @@ class MatchaComponentsModule {
12137
12166
  MatchaPageLayoutModule,
12138
12167
  MatchaDrawerModule,
12139
12168
  MatchaHighlightModule,
12140
- MatchaMaskModule, MatchaAccordionModule,
12169
+ MatchaMaskModule,
12170
+ MatchaChipModule, MatchaAccordionModule,
12141
12171
  MatchaAutocompleteModule,
12142
12172
  MatchaOptionModule,
12143
12173
  MatchaPanelModule,
@@ -12221,7 +12251,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
12221
12251
  MatchaPageLayoutModule,
12222
12252
  MatchaDrawerModule,
12223
12253
  MatchaHighlightModule,
12224
- MatchaMaskModule
12254
+ MatchaMaskModule,
12255
+ MatchaChipModule
12225
12256
  ],
12226
12257
  exports: [MatchaAccordionModule,
12227
12258
  MatchaAutocompleteModule,