{"version":3,"file":"bloomreach-brie-button-group.mjs","sources":["../../../../projects/brie/button-group/components/button-group.component.ts","../../../../projects/brie/button-group/components/button-group.component.html","../../../../projects/brie/button-group/button-group.module.ts","../../../../projects/brie/button-group/models/button-group.ts","../../../../projects/brie/button-group/public-api.ts","../../../../projects/brie/button-group/bloomreach-brie-button-group.ts"],"sourcesContent":["/*\n * Copyright 2025-2026 Bloomreach. All rights reserved. (https://www.bloomreach.com/)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *  https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Component, Input, ChangeDetectionStrategy } from '@angular/core';\nimport { BrieFormValidationService } from '@bloomreach/brie/form';\nimport { BrieIconModule, BrieIconSize } from '@bloomreach/brie/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatMenuModule, MatMenuTrigger } from '@angular/material/menu';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { MatButtonModule } from '@angular/material/button';\nimport { CommonModule } from '@angular/common';\nimport { AbstractControl } from '@angular/forms';\nimport { BrieButton, BrieButtonGroupActions } from '../models/button-group';\n\n@Component({\n  selector: 'brie-button-group',\n  templateUrl: './button-group.component.html',\n  styleUrls: ['./button-group.component.scss'],\n  changeDetection: ChangeDetectionStrategy.Eager,\n  imports: [\n    CommonModule,\n    MatButtonModule,\n    MatDividerModule,\n    MatMenuModule,\n    MatTooltipModule,\n    BrieIconModule,\n  ],\n\n})\nexport class BrieButtonGroupComponent {\n  @Input() actions: BrieButtonGroupActions;\n\n  constructor(private readonly validationService: BrieFormValidationService) {}\n\n  get BrieIconSize(): typeof BrieIconSize {\n    return BrieIconSize;\n  }\n\n  onButtonClick(button: BrieButton, event: MouseEvent, menuTrigger?: MatMenuTrigger): void {\n    if (button.menu) {\n      menuTrigger?.openMenu();\n      return;\n    }\n\n    if (button.validateBeforeAction && button.validateForm) {\n      const form = this.resolveValidateForm(button.validateForm);\n      if (!form) {\n        return;\n      }\n\n      const result = this.validationService.showValidationErrors(\n        form,\n        button.validateFormOptions ?? {},\n      );\n\n      if (result.valid) {\n        button.action?.(event);\n      }\n\n      return;\n    }\n\n    button.action?.(event);\n  }\n\n  private resolveValidateForm(\n    validateForm: AbstractControl | (() => AbstractControl | undefined),\n  ): AbstractControl | undefined {\n    return typeof validateForm === 'function' ? validateForm() : validateForm;\n  }\n}\n","<!--\n  Copyright 2022-2023 Bloomreach. All rights reserved. (https://www.bloomreach.com/)\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n   https://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n  -->\n\n<ng-container *ngFor=\"let group of actions; last as isLast\">\n  <div class=\"brie-button-group\">\n    <ng-container *ngFor=\"let button of group\" [ngSwitch]=\"button.type\">\n      <div class=\"brie-button-container\">\n        <button *ngSwitchCase=\"'stroked'\"\n                mat-stroked-button\n                disableRipple\n                [attr.id]=\"button.id\"\n                [attr.data-qid]=\"button.id\"\n                class=\"brie-button-stroked\"\n                (click)=\"onButtonClick(button, $event, menuTrigger)\"\n                [color]=\"button.color\"\n                [disabled]=\"button.isDisabled && button.isDisabled()\"\n                matTooltip=\"{{ button.tooltip }}\">\n          <ng-container *ngTemplateOutlet=\"buttonCaptionTemplate;context:{$implicit: button}\"></ng-container>\n        </button>\n\n        <button *ngSwitchCase=\"'flat'\"\n                mat-flat-button\n                disableRipple\n                [attr.id]=\"button.id\"\n                [attr.data-qid]=\"button.id\"\n                class=\"brie-button-flat\"\n                (click)=\"onButtonClick(button, $event, menuTrigger)\"\n                [color]=\"button.color\"\n                [disabled]=\"button.isDisabled && button.isDisabled()\"\n                matTooltip=\"{{ button.tooltip }}\">\n          <ng-container *ngTemplateOutlet=\"buttonCaptionTemplate;context:{$implicit: button}\"></ng-container>\n        </button>\n\n        <button *ngSwitchCase=\"'icon'\"\n                mat-icon-button\n                [attr.id]=\"button.id\"\n                class=\"brie-button-icon\"\n                [attr.data-qid]=\"button.id\"\n                (click)=\"onButtonClick(button, $event, menuTrigger)\"\n                [color]=\"button.color\"\n                [disabled]=\"button.isDisabled && button.isDisabled()\"\n                matTooltip=\"{{ button.tooltip }}\"\n                disableRipple>\n          <ng-container *ngTemplateOutlet=\"buttonCaptionTemplate;context:{$implicit: button}\"></ng-container>\n        </button>\n\n        <button *ngSwitchDefault\n                mat-button\n                disableRipple\n                [attr.id]=\"button.id\"\n                [attr.data-qid]=\"button.id\"\n                class=\"brie-button-default\"\n                (click)=\"onButtonClick(button, $event, menuTrigger)\"\n                [color]=\"button.color\"\n                [disabled]=\"button.isDisabled && button.isDisabled()\"\n                matTooltip=\"{{ button.tooltip }}\">\n          <ng-container *ngTemplateOutlet=\"buttonCaptionTemplate;context:{$implicit: button}\"></ng-container>\n        </button>\n\n        <div #menuTrigger=\"matMenuTrigger\" [matMenuTriggerFor]=\"buttonMenu\">\n          <mat-menu #buttonMenu=\"matMenu\" class=\"brie-button-menu\">\n            <button *ngFor=\"let menuItem of button.menu\"\n                    mat-menu-item\n                    [attr.id]=\"menuItem.id\"\n                    [attr.data-qid]=\"menuItem.id\"\n                    class=\"brie-button-menu-item\"\n                    (click)=\"menuItem.action()\">\n              {{ menuItem.text }}\n            </button>\n          </mat-menu>\n        </div>\n      </div>\n    </ng-container>\n  </div>\n\n  <mat-divider *ngIf=\"!isLast\" [vertical]=\"true\"></mat-divider>\n</ng-container>\n\n<ng-template #buttonCaptionTemplate let-button>\n  <brie-icon *ngIf=\"button.icon\"\n             [name]=\"button.icon.name\"\n             [fontSet]=\"button.icon.fontSet\"\n             [size]=\"BrieIconSize.SM\"></brie-icon>\n  <span *ngIf=\"button.text\">{{ button.text }}</span>\n</ng-template>\n","/*\n * Copyright 2025-2026 Bloomreach. All rights reserved. (https://www.bloomreach.com/)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *  https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { BrieIconModule } from '@bloomreach/brie/icon';\n\nimport { BrieButtonGroupComponent } from './components/button-group.component';\n\n@NgModule({\n  imports: [\n    CommonModule,\n    BrieIconModule,\n    MatButtonModule,\n    MatDividerModule,\n    MatMenuModule,\n    MatTooltipModule,\n    BrieButtonGroupComponent,\n  ],\n  exports: [\n    BrieButtonGroupComponent,\n  ],\n})\nexport class BrieButtonGroupModule { }\n","/*\n * Copyright 2025-2026 Bloomreach. All rights reserved. (https://www.bloomreach.com/)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *  https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AbstractControl } from '@angular/forms';\nimport { BrieFormValidationOptions } from '@bloomreach/brie/form';\n\nexport type BrieButtonGroupActions = BrieButton[][];\n\nexport interface BrieButton {\n  id: string;\n  type: BrieButtonType;\n  text?: string;\n  action?: (event: MouseEvent) => void;\n  icon?: {\n    name: string;\n    fontSet?: string;\n  };\n  color?: BrieThemeColor;\n  isDisabled?: () => boolean;\n  tooltip?: string;\n  menu?: {\n    id: string;\n    text: string;\n    action: () => void;\n  }[];\n  /** Form to validate. Static control or getter for lazy resolution. */\n  validateForm?: AbstractControl | (() => AbstractControl | undefined);\n  /** Options passed to BrieFormValidationService.showValidationErrors. */\n  validateFormOptions?: BrieFormValidationOptions;\n  /**\n   * When true, run showValidationErrors before action.\n   * action is called only if form.valid after validation.\n   * Default: false (no validation — current behavior).\n   */\n  validateBeforeAction?: boolean;\n}\n\nexport enum BrieButtonType {\n  Basic = 'basic',\n  Stroked = 'stroked',\n  Flat = 'flat',\n  Icon = 'icon',\n}\n\nexport enum BrieThemeColor {\n  Primary = 'primary',\n  Accent = 'accent',\n  Warn = 'warn',\n}\n","/*\n * Copyright 2025-2026 Bloomreach. All rights reserved. (https://www.bloomreach.com/)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *  https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './button-group.module';\nexport * from './components/button-group.component';\nexport * from './models/button-group';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;MA4BU,wBAAwB,CAAA;AAGnC,IAAA,WAAA,CAA6B,iBAA4C,EAAA;QAA5C,IAAA,CAAA,iBAAiB,GAAjB,iBAAiB;IAA8B;AA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