@patternfly/elements
Version:
PatternFly Elements
1 lines • 3.45 kB
Source Map (JSON)
{"version":3,"file":"pf-jump-links-item.js","sourceRoot":"","sources":["pf-jump-links-item.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;;;AAI/F,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAWhE,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;;QAQL,mCAAmC;QACS,WAAM,GAAG,KAAK,CAAC;QAK3D,qCAAa,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAC;;IAEhE,MAAM;QACJ,OAAO,IAAI,CAAA;iBACE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;mBAClB,uBAAA,IAAI,4DAAS;mBACb,uBAAA,IAAI,4DAAS;;;;KAI3B,CAAC;IACJ,CAAC;IAGS,aAAa;QACrB,uBAAA,IAAI,kCAAW,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;IAChE,CAAC;;;;;IAGC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC7D,CAAC;;IAGC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5D,CAAC;AArCe,sBAAM,GAAoB,CAAC,KAAK,CAAC,AAA3B,CAA4B;AAEzB,iCAAiB,GAAmB;IAC3D,GAAG,UAAU,CAAC,iBAAiB;IAC/B,cAAc,EAAE,IAAI;CACrB,AAHyC,CAGxC;;AAG0C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAgB;AAG9B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAe;AAgBjC;IADT,QAAQ,CAAC,QAAQ,CAAC;oDAGlB;AA9BU,eAAe;IAD3B,aAAa,CAAC,oBAAoB,CAAC;GACvB,eAAe","sourcesContent":["import { html, LitElement, type TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\n\nimport style from './pf-jump-links-item.css';\n\nimport { observes } from '@patternfly/pfe-core/decorators/observes.js';\n\n/**\n * @cssprop --pf-c-jump-links__link--PaddingTop -- padding around the link\n * @cssprop --pf-c-jump-links__link--PaddingRight\n * @cssprop --pf-c-jump-links__link--PaddingBottom\n * @cssprop --pf-c-jump-links__link--PaddingLeft\n * @cssprop --pf-c-jump-links__link--OutlineOffset\n * @cssprop --pf-c-jump-links__link-text--Color\n */\n@customElement('pf-jump-links-item')\nexport class PfJumpLinksItem extends LitElement {\n static readonly styles: CSSStyleSheet[] = [style];\n\n static override readonly shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n /** Whether this item is active. */\n @property({ type: Boolean, reflect: true }) active = false;\n\n /** hypertext reference for this link */\n @property({ reflect: true }) href?: string;\n\n #internals = InternalsController.of(this, { role: 'listitem' });\n\n render(): TemplateResult<1> {\n return html`\n <a href=\"${ifDefined(this.href)}\"\n @focus=\"${this.#onFocus}\"\n @click=\"${this.#onClick}\">\n <slot></slot>\n </a>\n <slot name=\"subsection\"></slot>\n `;\n }\n\n @observes('active')\n protected activeChanged(): void {\n this.#internals.ariaCurrent = this.active ? 'location' : null;\n }\n\n #onClick() {\n this.dispatchEvent(new Event('select', { bubbles: true }));\n }\n\n #onFocus() {\n this.dispatchEvent(new Event('focus', { bubbles: true }));\n }\n}\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-jump-links-item': PfJumpLinksItem;\n }\n}\n"]}