{"version":3,"sources":["components/modal/modal-footer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAuB,UAAU,EAAE,MAAM,aAAa,CAAC;AAM9D;;;GAGG;AACH,cACM,aAAc,SAAQ,UAAU;IACpC;;OAEG;IACH,OAAO,CAAC,sBAAsB,CAAS;IAEvC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IASzB,MAAM;IAaN;;OAEG;IACH,MAAM,KAAK,eAAe,WAEzB;IAED,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,aAAa,CAAC","file":"modal-footer.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2021\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { html, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport styles from './modal.scss';\n\nconst { prefix } = settings;\n\n/**\n * Modal footer.\n * @element bx-modal-footer\n */\n@customElement(`${prefix}-modal-footer`)\nclass BXModalFooter extends LitElement {\n  /**\n   * `true` if this modal footer has more than two buttons.\n   */\n  private _hasMoreThanTwoButtons = false;\n\n  /**\n   * Handles `slotchange` event.\n   */\n  private _handleSlotChange(event: Event) {\n    const { selectorButtons } = this.constructor as typeof BXModalFooter;\n    this._hasMoreThanTwoButtons =\n      (event.target as HTMLSlotElement)\n        .assignedNodes()\n        .filter(node => node.nodeType === Node.ELEMENT_NODE && (node as Element).matches(selectorButtons)).length > 2;\n    this.requestUpdate();\n  }\n\n  render() {\n    const { _hasMoreThanTwoButtons: hasMoreThanTwoButtons, _handleSlotChange: handleSlotChange } = this;\n    const classes = classMap({\n      [`${prefix}--modal-footer`]: true,\n      [`${prefix}--modal-footer--three-button`]: hasMoreThanTwoButtons,\n    });\n    return html`\n      <div class=\"${classes}\">\n        <slot @slotchange=\"${handleSlotChange}\"></slot>\n      </div>\n    `;\n  }\n\n  /**\n   * A selector that selects the child buttons.\n   */\n  static get selectorButtons() {\n    return `${prefix}-btn,${prefix}-modal-footer-button`;\n  }\n\n  static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default BXModalFooter;\n"]}