matcha-components 20.65.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,9 +9823,9 @@ class MatchaChipListComponent {
9815
9823
  const selectedChangeSub = chip.selectedChange.subscribe(() => {
9816
9824
  this._onChipSelectionChange(chip);
9817
9825
  });
9818
- // Listener para remoção
9826
+ // Listener para remoção de chips
9819
9827
  const removedSub = chip.removed.subscribe(() => {
9820
- this._onChipRemoved(chip, index);
9828
+ this._onChipRemoved(chip);
9821
9829
  });
9822
9830
  this._chipSubscriptions.push(selectedChangeSub, removedSub);
9823
9831
  });
@@ -9843,9 +9851,19 @@ class MatchaChipListComponent {
9843
9851
  this._updateValue();
9844
9852
  this.onTouched();
9845
9853
  }
9846
- /** Manipula a remoção de um chip */
9847
- _onChipRemoved(chip, index) {
9848
- this._updateValue();
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();
9849
9867
  }
9850
9868
  /** Atualiza o valor baseado nos chips selecionados */
9851
9869
  _updateValue() {
@@ -9958,7 +9976,7 @@ class MatchaChipListComponent {
9958
9976
  this.disabled = isDisabled;
9959
9977
  }
9960
9978
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: MatchaChipListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9961
- 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: [
9962
9980
  {
9963
9981
  provide: NG_VALUE_ACCESSOR,
9964
9982
  useExisting: forwardRef(() => MatchaChipListComponent),
@@ -9987,6 +10005,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
9987
10005
  type: Input
9988
10006
  }], change: [{
9989
10007
  type: Output
10008
+ }], removed: [{
10009
+ type: Output
9990
10010
  }], chips: [{
9991
10011
  type: ContentChildren,
9992
10012
  args: [MatchaChipComponent, { descendants: true }]
@@ -12067,7 +12087,8 @@ class MatchaComponentsModule {
12067
12087
  MatchaPageLayoutModule,
12068
12088
  MatchaDrawerModule,
12069
12089
  MatchaHighlightModule,
12070
- MatchaMaskModule], exports: [MatchaAccordionModule,
12090
+ MatchaMaskModule,
12091
+ MatchaChipModule], exports: [MatchaAccordionModule,
12071
12092
  MatchaAutocompleteModule,
12072
12093
  MatchaOptionModule,
12073
12094
  MatchaPanelModule,
@@ -12145,7 +12166,8 @@ class MatchaComponentsModule {
12145
12166
  MatchaPageLayoutModule,
12146
12167
  MatchaDrawerModule,
12147
12168
  MatchaHighlightModule,
12148
- MatchaMaskModule, MatchaAccordionModule,
12169
+ MatchaMaskModule,
12170
+ MatchaChipModule, MatchaAccordionModule,
12149
12171
  MatchaAutocompleteModule,
12150
12172
  MatchaOptionModule,
12151
12173
  MatchaPanelModule,
@@ -12229,7 +12251,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
12229
12251
  MatchaPageLayoutModule,
12230
12252
  MatchaDrawerModule,
12231
12253
  MatchaHighlightModule,
12232
- MatchaMaskModule
12254
+ MatchaMaskModule,
12255
+ MatchaChipModule
12233
12256
  ],
12234
12257
  exports: [MatchaAccordionModule,
12235
12258
  MatchaAutocompleteModule,