{"version":3,"file":"footnote-item.BoQuIvi_.js","sources":["../../../../../packages/web-components/src/lib/components/footnote-item/footnote-item.ts"],"sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { pdsCustomElement as customElement } from '../../decorators/pds-custom-element';\nimport { PdsElement } from '../PdsElement';\nimport styles from './footnote-item.scss?inline';\nimport '../link/link';\nimport { required } from '../../decorators/required';\nimport { requiredSlot } from '../../decorators/requiredSlot';\n\n/**\n * @summary A footnote item is an item in the footnotes list.\n * It requires an id and href to properly link to a piece of content.\n *\n * @slot default Required: The footnote text\n */\n@customElement('pds-footnote-item', {\n category: 'component',\n type: 'component',\n state: 'stable',\n styles,\n})\nexport class PdsFootnoteItem extends PdsElement {\n connectedCallback() {\n super.connectedCallback();\n this.initLocalization();\n }\n\n /**\n * Style variant\n * - **default** renders the standard footnote-item used for footnotes\n */\n @property()\n variant: 'default';\n\n /**\n * - id for footnote item. This is a **required** property.\n */\n @required\n @property({ type: String, reflect: true })\n id: string;\n\n /**\n * Required\n * - href for footnote item. This is a **required** property.\n */\n @required\n @property({ type: String })\n href: string = '';\n\n @property({ type: String })\n ariaLabel: string;\n\n /**\n * When leaving the footnote item, remove the tabindex so it is no longer focusable and\n * preserves the correct focus order\n */\n handleBlur() {\n this.removeAttribute('tabindex');\n }\n\n /**\n * Focuses on previous item\n * For all `pds-link` components in the light DOM, match the footnote\n * item href and pds-link id.\n * If they match, focus on the `pds-c-link`. Set timeout is\n * needed to occur slightly after the link click\n */\n focusOnPreviousItem() {\n this.handleBlur();\n const allLinks = document.querySelectorAll('pds-footnote-link');\n allLinks.forEach((element) => {\n if (this.href === `#${element.id}`) {\n setTimeout(() => {\n /* Optional chaining prevents ability to get full jest coverage - https://github.com/istanbuljs/istanbuljs/issues/516 */\n /* istanbul ignore next */\n element.shadowRoot\n ?.querySelector('.pds-c-footnote-link')\n ?.focus();\n }, 1);\n }\n });\n }\n\n /**\n * @internal\n */\n get classNames() {\n return {\n [this.variant]: !!this.variant,\n };\n }\n\n @requiredSlot(['default'])\n render() {\n return html`\n
  • \n
    \n \n this.focusOnPreviousItem()}\n @blur=${this.handleBlur}\n class=\"pds-c-footnote-item--backlink\"\n href=\"${this.href}\"\n ariaLabel=\"${this.ariaLabel ||\n this.translateText('back-to-content')}\"\n target=\"_self\"\n >↩\n
    \n
  • \n `;\n }\n}\n"],"names":["PdsFootnoteItem","PdsElement","element","_b","_a","html","__decorateClass","property","required","requiredSlot","customElement","styles"],"mappings":";;;;;;;;;;;AAqBa,IAAAA,IAAN,cAA8BC,EAAW;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA,GA0BU,KAAA,OAAA;AAAA,EAAA;AAAA,EAzBf,oBAAoB;AAClB,UAAM,kBAAkB,GACxB,KAAK,iBAAiB;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgCxB,aAAa;AACX,SAAK,gBAAgB,UAAU;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjC,sBAAsB;AACpB,SAAK,WAAW,GACC,SAAS,iBAAiB,mBAAmB,EACrD,QAAQ,CAACC,MAAY;AAC5B,MAAI,KAAK,SAAS,IAAIA,EAAQ,EAAE,MAC9B,WAAW,MAAM;;AAGf,SAAAC,KAAAC,IAAAF,EAAQ,eAAR,gBAAAE,EACI,cAAiC,4BADrC,QAAAD,EAEI;AAAA,SACH,CAAC;AAAA,IACN,CACD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMH,IAAI,aAAa;AACR,WAAA;AAAA,MACL,CAAC,KAAK,OAAO,GAAG,CAAC,CAAC,KAAK;AAAA,IACzB;AAAA,EAAA;AAAA,EAIF,SAAS;AACA,WAAAE;AAAAA,mBACQ,KAAK,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,qBAKb,MAAM,KAAK,oBAAqB,CAAA;AAAA,oBACjC,KAAK,UAAU;AAAA;AAAA,oBAEf,KAAK,IAAI;AAAA,yBACJ,KAA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