{"version":3,"file":"footnote-item.5-oQbXV4.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';\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 * 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 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 render() {\n return html`\n
  • \n
    \n \n this.focusOnPreviousItem()}\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","customElement","styles"],"mappings":";;;;;;;;;;AAoBa,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,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkCA,sBAAsB;AAEX,IADQ,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,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,aAAa;AACR,WAAA;AAAA,MACL,CAAC,KAAK,OAAO,GAAG,CAAC,CAAC,KAAK;AAAA,IAAA;AAAA,EAE3B;AAAA,EAEA,SAAS;AACA,WAAAE;AAAAA,mBACQ,KAAK,UAAU;AAAA;AAAA;AAAA;AAAA,qBAIb,MAAM,KAAK,qBAAqB;AAAA;AAAA,oBAEjC,KAAK,IAAI;AAAA,yBACJ,KAAK,aAClB,KAAK,cAAc,iBAAiB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C;AACF;AArEEC,EAAA;AAAA,EADCC,EAAS;AAAA,GAVCP,EAWX,WAAA,WAAA,CAAA;AAOAM,EAAA;AAAA,EAFCE;AAAA,EACAD,EAAS,EAAE,MAAM,QAAQ,SAAS,IAAM;AAAA,GAjB9BP,EAkBX,WAAA,MAAA,CAAA;AAQAM,EAAA;AAAA,EAFCE;AAAA,EACAD,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