{"version":3,"sources":["components/inline-loading/inline-loading.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAOxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAIhC;;;GAGG;AACH,cACM,eAAgB,SAAQ,UAAU;IACtC;;OAEG;IACH,OAAO,CAAC,WAAW;IAuBnB;;OAEG;IAEH,MAAM,uBAA+B;IAErC,iBAAiB;IAOjB,MAAM;IAWN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,eAAe,CAAC","file":"inline-loading.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 { html, property, customElement, LitElement } from 'lit-element';\nimport { classMap } from 'lit-html/directives/class-map';\nimport CheckmarkFilled16 from '@carbon/icons/lib/checkmark--filled/16';\nimport ErrorFilled16 from '@carbon/icons/lib/error--filled/16';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport LOADING_TYPE from '../loading/types';\nimport getLoadingIcon from '../loading/loading-icon';\nimport { INLINE_LOADING_STATE } from './defs';\nimport styles from './inline-loading.scss';\n\nexport { INLINE_LOADING_STATE };\n\nconst { prefix } = settings;\n\n/**\n * Lnline loading spinner.\n * @element bx-inline-loading\n */\n@customElement(`${prefix}-inline-loading`)\nclass BXInlineLoading extends LitElement {\n  /**\n   * @returns The template for the status icon.\n   */\n  private _renderIcon() {\n    const { status } = this;\n    if (status === INLINE_LOADING_STATE.ERROR) {\n      return ErrorFilled16({\n        class: `${prefix}--inline-loading--error`,\n      });\n    }\n    if (status === INLINE_LOADING_STATE.FINISHED) {\n      return CheckmarkFilled16({\n        class: `${prefix}--inline-loading__checkmark-container ${prefix}--inline-loading__svg`,\n      });\n    }\n    if (status === INLINE_LOADING_STATE.INACTIVE || status === INLINE_LOADING_STATE.ACTIVE) {\n      const classes = classMap({\n        [`${prefix}--loading`]: true,\n        [`${prefix}--loading--small`]: true,\n        [`${prefix}--loading--stop`]: status === INLINE_LOADING_STATE.INACTIVE,\n      });\n      return html` <div class=\"${classes}\">${getLoadingIcon({ type: LOADING_TYPE.SMALL })}</div> `;\n    }\n    return undefined;\n  }\n\n  /**\n   * The loading status.\n   */\n  @property({ reflect: true })\n  status = INLINE_LOADING_STATE.ACTIVE;\n\n  connectedCallback() {\n    if (!this.hasAttribute('aria-live')) {\n      this.setAttribute('aria-live', 'assertive');\n    }\n    super.connectedCallback();\n  }\n\n  render() {\n    const statusIconResult = this._renderIcon();\n    const statusIconWrapperResult = !statusIconResult\n      ? undefined\n      : html` <div class=\"${prefix}--inline-loading__animation\">${statusIconResult}</div> `;\n    return html`\n      ${statusIconWrapperResult}\n      <p class=\"${prefix}--inline-loading__text\"><slot></slot></p>\n    `;\n  }\n\n  static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default BXInlineLoading;\n"]}