@patternfly/elements 4.0.2 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/custom-elements.json +34 -1
  2. package/package.json +3 -3
  3. package/pf-accordion/pf-accordion-header.js +1 -1
  4. package/pf-accordion/pf-accordion-panel.js +1 -1
  5. package/pf-accordion/pf-accordion.js +1 -1
  6. package/pf-avatar/pf-avatar.js +1 -1
  7. package/pf-back-to-top/pf-back-to-top.js +5 -2
  8. package/pf-back-to-top/pf-back-to-top.js.map +1 -1
  9. package/pf-background-image/pf-background-image.js +1 -1
  10. package/pf-badge/pf-badge.js +1 -1
  11. package/pf-banner/pf-banner.js +1 -1
  12. package/pf-button/pf-button.js +1 -1
  13. package/pf-card/pf-card.js +1 -1
  14. package/pf-card/test/pf-card.e2e.js +20 -1
  15. package/pf-card/test/pf-card.e2e.js.map +1 -1
  16. package/pf-chip/pf-chip-group.js +1 -1
  17. package/pf-chip/pf-chip.js +1 -1
  18. package/pf-clipboard-copy/pf-clipboard-copy.js +6 -4
  19. package/pf-clipboard-copy/pf-clipboard-copy.js.map +1 -1
  20. package/pf-code-block/pf-code-block.js +1 -1
  21. package/pf-dropdown/pf-dropdown-group.js +1 -1
  22. package/pf-dropdown/pf-dropdown-item.js +1 -1
  23. package/pf-dropdown/pf-dropdown-menu.js +1 -1
  24. package/pf-dropdown/pf-dropdown.js +1 -1
  25. package/pf-icon/pf-icon.js +1 -1
  26. package/pf-jump-links/pf-jump-links-item.js +1 -1
  27. package/pf-jump-links/pf-jump-links-list.js +1 -1
  28. package/pf-jump-links/pf-jump-links.js +1 -1
  29. package/pf-label/pf-label.js +1 -1
  30. package/pf-modal/pf-modal.js +1 -1
  31. package/pf-panel/pf-panel.js +1 -1
  32. package/pf-popover/pf-popover.js +1 -1
  33. package/pf-progress/pf-progress.js +1 -1
  34. package/pf-progress-stepper/pf-progress-step.js +1 -1
  35. package/pf-progress-stepper/pf-progress-stepper.js +1 -1
  36. package/pf-select/pf-option-group.js +1 -1
  37. package/pf-select/pf-option.js +1 -1
  38. package/pf-select/pf-select.js +1 -1
  39. package/pf-spinner/pf-spinner.js +1 -1
  40. package/pf-switch/pf-switch.js +1 -1
  41. package/pf-table/context.d.ts +3 -0
  42. package/pf-table/context.js +3 -0
  43. package/pf-table/context.js.map +1 -0
  44. package/pf-table/pf-caption.js +1 -1
  45. package/pf-table/pf-table.d.ts +1 -0
  46. package/pf-table/pf-table.js +9 -3
  47. package/pf-table/pf-table.js.map +1 -1
  48. package/pf-table/pf-tbody.js +1 -1
  49. package/pf-table/pf-td.js +1 -1
  50. package/pf-table/pf-th.d.ts +1 -0
  51. package/pf-table/pf-th.js +8 -6
  52. package/pf-table/pf-th.js.map +1 -1
  53. package/pf-table/pf-thead.d.ts +1 -0
  54. package/pf-table/pf-thead.js +7 -1
  55. package/pf-table/pf-thead.js.map +1 -1
  56. package/pf-table/pf-tr.js +1 -1
  57. package/pf-tabs/pf-tab-panel.js +1 -1
  58. package/pf-tabs/pf-tab.d.ts +1 -1
  59. package/pf-tabs/pf-tab.js +4 -3
  60. package/pf-tabs/pf-tab.js.map +1 -1
  61. package/pf-tabs/pf-tabs.js +1 -1
  62. package/pf-tabs/test/pf-tabs.spec.js +9 -0
  63. package/pf-tabs/test/pf-tabs.spec.js.map +1 -1
  64. package/pf-text-area/pf-text-area.js +1 -1
  65. package/pf-text-input/pf-text-input.js +1 -1
  66. package/pf-tile/pf-tile.js +1 -1
  67. package/pf-timestamp/pf-timestamp.js +1 -1
  68. package/pf-tooltip/pf-tooltip.js +3 -3
  69. package/pf-tooltip/pf-tooltip.js.map +1 -1
  70. package/pfe.min.js +271 -271
  71. package/pfe.min.js.map +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"pf-tab.js","sourceRoot":"","sources":["pf-tab.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5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AAC,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kCACH;AAyElB;IADT,QAAQ,CAAC,QAAQ,CAAC;0CAMlB;AAGS;IADT,QAAQ,CAAC,UAAU,CAAC;4CAGpB;AA/FU,KAAK;IADjB,aAAa,CAAC,QAAQ,CAAC;GACX,KAAK","sourcesContent":["import { LitElement, html, type TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { consume } from '@lit/context';\n\nimport { observes } from '@patternfly/pfe-core/decorators.js';\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\n\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\n\nimport { TabExpandEvent, context, type PfTabsContext } from './context.js';\n\nimport styles from './pf-tab.css';\n\n/**\n * Tab\n * @slot icon\n * Can contain an `<svg>` or `<pf-icon>`\n * @slot\n * Tab title text\n * @csspart button - button element\n * @csspart icon - span container for the icon\n * @csspart text - span container for the title text\n * @cssprop {<length>} [--pf-c-tabs--m-box__item--m-current--first-child__link--before--BorderLeftWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs--m-box__item--m-current--last-child__link--before--BorderRightWidth=1px]\n * @cssprop {<color>} [--pf-c-tabs__link--BackgroundColor=#f0f0f0]\n * @cssprop {<color>} [--pf-c-tabs__link--disabled--BackgroundColor=#d2d2d2]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderTopWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderBottomWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderLeftWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderRightWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--disabled--before--BorderRightWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--after--Top=auto]\n * @cssprop {<length>} [--pf-c-tabs__link--after--Right=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--Bottom=0]\n * @cssprop {<length>} [--pf-c-tabs__link--before--Left=0]\n * @cssprop {<length>} [--pf-c-tabs__link--PaddingTop=1rem]\n * @cssprop {<length>} [--pf-c-tabs__link--PaddingBottom=1rem]\n * @cssprop {<length>} [--pf-c-tabs__link--disabled--before--BorderBottomWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--disabled--before--BorderLeftWidth=1px]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderTopColor=#d2d2d2]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderRightColor=#d2d2d2]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderBottomColor=#d2d2d2]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderLeftColor=#d2d2d2]\n * @cssprop {<length>} [--pf-c-tabs__link--FontSize=1rem]\n * @cssprop {<color>} [--pf-c-tabs__link--Color=#6a6e73]\n * @cssprop {<length>} [--pf-c-tabs__link--OutlineOffset=-0.375rem]\n * @cssprop {<color>} [--pf-c-tabs__link--after--BorderColor=#b8bbbe]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderTopWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderRightWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderBottomWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderLeftWidth=0]\n * @cssprop {<color>} [--pf-c-tabs__item--m-current__link--Color=#151515]\n * @cssprop {<color>} [--pf-c-tabs__item--m-current__link--after--BorderColor=#06c]\n * @cssprop {<length>} [--pf-c-tabs__item--m-current__link--after--BorderWidth=3px]\n * @cssprop {<length>} [--pf-c-tabs__link--child--MarginRight=1rem]\n * @fires {TabExpandEvent} expand - when a tab expands\n */\n@customElement('pf-tab')\nexport class PfTab extends LitElement {\n static readonly styles: CSSStyleSheet[] = [styles];\n\n @queryAssignedElements({ slot: 'icon', flatten: true })\n private icons!: HTMLElement[];\n\n @property({ reflect: true, type: Boolean }) active = false;\n\n @property({ reflect: true, type: Boolean }) disabled = false;\n\n @consume({ context, subscribe: true })\n @property({ attribute: false })\n private ctx?: PfTabsContext;\n\n #internals = InternalsController.of(this, { role: 'tab' });\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.id ||= getRandomId(this.localName);\n this.addEventListener('click', this.#onClick);\n this.addEventListener('keydown', this.#onKeydown);\n this.addEventListener('focus', this.#onFocus);\n }\n\n override willUpdate(): void {\n const { borderBottom, box, fill, manual, vertical } = this.ctx ?? {};\n this.toggleAttribute('fill', fill);\n this.toggleAttribute('manual', manual);\n this.toggleAttribute('vertical', vertical);\n if (box) {\n this.setAttribute('box', box);\n } else {\n this.removeAttribute('box');\n }\n if (borderBottom) {\n this.setAttribute('border-bottom', borderBottom);\n } else {\n this.removeAttribute('border-bottom');\n }\n }\n\n render(): TemplateResult<1> {\n const { active } = this;\n const { box, fill = false, vertical = false } = this.ctx ?? {};\n const light = box === 'light';\n const dark = box === 'dark';\n return html`\n <div id=\"button\"\n part=\"button\"\n class=\"${classMap({ active, box: !!box, dark, light, fill, vertical })}\">\n <slot name=\"icon\"\n part=\"icon\"\n ?hidden=\"${!this.icons.length}\"\n @slotchange=\"${() => this.requestUpdate()}\"></slot>\n <slot part=\"text\"></slot>\n </div>\n `;\n }\n\n #onClick() {\n if (!this.disabled) {\n this.#activate();\n }\n }\n\n #onKeydown(event: KeyboardEvent) {\n if (!this.disabled) {\n switch (event.key) {\n case 'Enter':\n this.#activate();\n }\n }\n }\n\n #onFocus() {\n if (!this.ctx?.manual && !this.disabled) {\n this.#activate();\n }\n }\n\n async #activate() {\n this.dispatchEvent(new TabExpandEvent(this));\n }\n\n @observes('active')\n protected activeChanged(old: boolean, active: boolean): void {\n this.#internals.ariaSelected = String(!!active);\n if (active && !old) {\n this.#activate();\n }\n }\n\n @observes('disabled')\n protected disabledChanged(): void {\n this.#internals.ariaDisabled = this.disabled ? 'true' : this.ariaDisabled ?? 'false';\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-tab': PfTab;\n }\n}\n"]}
1
+ {"version":3,"file":"pf-tab.js","sourceRoot":"","sources":["pf-tab.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAuB,MAAM,KAAK,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAE/F,OAAO,EAAE,cAAc,EAAE,OAAO,EAAsB,MAAM,cAAc,CAAC;;;AAiDpE,IAAM,KAAK,GAAX,MAAM,KAAM,SAAQ,UAAU;IAA9B;;;QAMuC,WAAM,GAAG,KAAK,CAAC;QAEf,aAAQ,GAAG,KAAK,CAAC;QAM7D,2BAAa,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAC;;IAElD,iBAAiB;QACxB,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,KAAP,IAAI,CAAC,EAAE,GAAK,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC;QACxC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,uBAAA,IAAI,wCAAS,CAAC,CAAC;QAC9C,IAAI,CAAC,gB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;AAC/C,CAAC;AAlFe,YAAM,GAAoB,CAAC,MAAM,CAAC,AAA5B,CAA6B;;AAG3C;IADP,qBAAqB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCACzB;AAEc;IAA3C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qCAAgB;AAEf;IAA3C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAAkB;AAIrD;IAFP,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;kCACH;AA0ElB;IADT,QAAQ,CAAC,QAAQ,CAAC;0CAMlB;AAGS;IADT,QAAQ,CAAC,UAAU,CAAC;4CAGpB;AAhGU,KAAK;IADjB,aAAa,CAAC,QAAQ,CAAC;GACX,KAAK","sourcesContent":["import { LitElement, html, isServer, type TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { consume } from '@lit/context';\n\nimport { observes } from '@patternfly/pfe-core/decorators.js';\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\n\nimport { InternalsController } from '@patternfly/pfe-core/controllers/internals-controller.js';\n\nimport { TabExpandEvent, context, type PfTabsContext } from './context.js';\n\nimport styles from './pf-tab.css';\n\n/**\n * Tab\n * @slot icon\n * Can contain an `<svg>` or `<pf-icon>`\n * @slot\n * Tab title text\n * @csspart button - button element\n * @csspart icon - span container for the icon\n * @csspart text - span container for the title text\n * @cssprop {<length>} [--pf-c-tabs--m-box__item--m-current--first-child__link--before--BorderLeftWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs--m-box__item--m-current--last-child__link--before--BorderRightWidth=1px]\n * @cssprop {<color>} [--pf-c-tabs__link--BackgroundColor=#f0f0f0]\n * @cssprop {<color>} [--pf-c-tabs__link--disabled--BackgroundColor=#d2d2d2]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderTopWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderBottomWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderLeftWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--before--BorderRightWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--disabled--before--BorderRightWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--after--Top=auto]\n * @cssprop {<length>} [--pf-c-tabs__link--after--Right=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--Bottom=0]\n * @cssprop {<length>} [--pf-c-tabs__link--before--Left=0]\n * @cssprop {<length>} [--pf-c-tabs__link--PaddingTop=1rem]\n * @cssprop {<length>} [--pf-c-tabs__link--PaddingBottom=1rem]\n * @cssprop {<length>} [--pf-c-tabs__link--disabled--before--BorderBottomWidth=1px]\n * @cssprop {<length>} [--pf-c-tabs__link--disabled--before--BorderLeftWidth=1px]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderTopColor=#d2d2d2]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderRightColor=#d2d2d2]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderBottomColor=#d2d2d2]\n * @cssprop {<color>} [--pf-c-tabs__link--before--BorderLeftColor=#d2d2d2]\n * @cssprop {<length>} [--pf-c-tabs__link--FontSize=1rem]\n * @cssprop {<color>} [--pf-c-tabs__link--Color=#6a6e73]\n * @cssprop {<length>} [--pf-c-tabs__link--OutlineOffset=-0.375rem]\n * @cssprop {<color>} [--pf-c-tabs__link--after--BorderColor=#b8bbbe]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderTopWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderRightWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderBottomWidth=0]\n * @cssprop {<length>} [--pf-c-tabs__link--after--BorderLeftWidth=0]\n * @cssprop {<color>} [--pf-c-tabs__item--m-current__link--Color=#151515]\n * @cssprop {<color>} [--pf-c-tabs__item--m-current__link--after--BorderColor=#06c]\n * @cssprop {<length>} [--pf-c-tabs__item--m-current__link--after--BorderWidth=3px]\n * @cssprop {<length>} [--pf-c-tabs__link--child--MarginRight=1rem]\n * @fires {TabExpandEvent} expand - when a tab expands\n */\n@customElement('pf-tab')\nexport class PfTab extends LitElement {\n static readonly styles: CSSStyleSheet[] = [styles];\n\n @queryAssignedElements({ slot: 'icon', flatten: true })\n private icons?: HTMLElement[];\n\n @property({ reflect: true, type: Boolean }) active = false;\n\n @property({ reflect: true, type: Boolean }) disabled = false;\n\n @consume({ context, subscribe: true })\n @property({ attribute: false })\n private ctx?: PfTabsContext;\n\n #internals = InternalsController.of(this, { role: 'tab' });\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.id ||= getRandomId(this.localName);\n this.addEventListener('click', this.#onClick);\n this.addEventListener('keydown', this.#onKeydown);\n this.addEventListener('focus', this.#onFocus);\n }\n\n override willUpdate(): void {\n const { borderBottom, box, fill, manual, vertical } = this.ctx ?? {};\n this.toggleAttribute('fill', fill);\n this.toggleAttribute('manual', manual);\n this.toggleAttribute('vertical', vertical);\n if (box) {\n this.setAttribute('box', box);\n } else {\n this.removeAttribute('box');\n }\n if (borderBottom) {\n this.setAttribute('border-bottom', borderBottom);\n } else {\n this.removeAttribute('border-bottom');\n }\n }\n\n render(): TemplateResult<1> {\n const { active } = this;\n const { box, fill = false, vertical = false } = this.ctx ?? {};\n const light = box === 'light';\n const dark = box === 'dark';\n const icons = isServer ? [] : this.icons;\n return html`\n <div id=\"button\"\n part=\"button\"\n class=\"${classMap({ active, box: !!box, dark, light, fill, vertical })}\">\n <slot name=\"icon\"\n part=\"icon\"\n ?hidden=\"${!icons?.length}\"\n @slotchange=\"${() => this.requestUpdate()}\"></slot>\n <slot part=\"text\"></slot>\n </div>\n `;\n }\n\n #onClick() {\n if (!this.disabled) {\n this.#activate();\n }\n }\n\n #onKeydown(event: KeyboardEvent) {\n if (!this.disabled) {\n switch (event.key) {\n case 'Enter':\n this.#activate();\n }\n }\n }\n\n #onFocus() {\n if (!this.ctx?.manual && !this.disabled) {\n this.#activate();\n }\n }\n\n async #activate() {\n this.dispatchEvent(new TabExpandEvent(this));\n }\n\n @observes('active')\n protected activeChanged(old: boolean, active: boolean): void {\n this.#internals.ariaSelected = String(!!active);\n if (active && !old) {\n this.#activate();\n }\n }\n\n @observes('disabled')\n protected disabledChanged(): void {\n this.#internals.ariaDisabled = this.disabled ? 'true' : this.ariaDisabled ?? 'false';\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-tab': PfTab;\n }\n}\n"]}
@@ -183,7 +183,7 @@ _PfTabs_onExpand = function _PfTabs_onExpand(event) {
183
183
  };
184
184
  PfTabs.styles = [styles];
185
185
  PfTabs.scrollTimeoutDelay = 150;
186
- PfTabs.version = "4.0.2";
186
+ PfTabs.version = "4.1.0";
187
187
  __decorate([
188
188
  property({ reflect: false, attribute: 'label-scroll-left' })
189
189
  ], PfTabs.prototype, "labelScrollLeft", void 0);
@@ -197,6 +197,9 @@ describe('<pf-tabs>', function () {
197
197
  expect(second).to.have.attribute('active');
198
198
  expect(third).to.not.have.attribute('active');
199
199
  });
200
+ it('should specify the selected tab to assistive technology', async function () {
201
+ expect(await a11ySnapshot()).to.axContainQuery({ role: 'tabpanel', name: 'tab-2' });
202
+ });
200
203
  });
201
204
  describe('pressing ArrowLeft', function () {
202
205
  beforeEach(async function () {
@@ -208,6 +211,9 @@ describe('<pf-tabs>', function () {
208
211
  expect(second).to.not.have.attribute('active');
209
212
  expect(third).to.have.attribute('active');
210
213
  });
214
+ it('should specify the selected tab to assistive technology', async function () {
215
+ expect(await a11ySnapshot()).to.axContainQuery({ role: 'tabpanel', name: 'tab-3' });
216
+ });
211
217
  describe('then pressing ArrowRight', function () {
212
218
  beforeEach(async function () {
213
219
  await sendKeys({ down: 'ArrowRight' });
@@ -219,6 +225,9 @@ describe('<pf-tabs>', function () {
219
225
  expect(second).to.not.have.attribute('active');
220
226
  expect(third).to.not.have.attribute('active');
221
227
  });
228
+ it('should specify the selected tab to assistive technology', async function () {
229
+ expect(await a11ySnapshot()).to.axContainQuery({ role: 'tabpanel', name: 'tab-1' });
230
+ });
222
231
  });
223
232
  });
224
233
  });
@@ -1 +1 @@
1
- {"version":3,"file":"pf-tabs.spec.js","sourceRoot":"","sources":["pf-tabs.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,2CAA2C,CAAC;AAEnD,SAAS,KAAK,CAAC,GAAW;IACxB,OAAO,KAAK;QACV,MAAM,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IACjC,CAAC,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,WAAW,EAAE;IACpB,EAAE,CAAC,2BAA2B,EAAE;QAC9B,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACtE,MAAM,CA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C,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, html, nextFrame } from '@open-wc/testing';\nimport { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';\nimport { a11ySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js';\nimport { setViewport, sendKeys } from '@web/test-runner-commands';\n\nimport { allUpdates } from '@patternfly/pfe-tools/test/utils.js';\n\nimport { PfTabs } from '../pf-tabs.js';\nimport { PfTab } from '../pf-tab.js';\nimport { PfTabPanel } from '../pf-tab-panel.js';\n\nimport '@patternfly/pfe-tools/test/stub-logger.js';\n\nfunction press(key: string) {\n return async function() {\n await sendKeys({ press: key });\n };\n}\n\ndescribe('<pf-tabs>', function() {\n it('instantiates imperatively', function() {\n expect(document.createElement('pf-tabs')).to.be.an.instanceof(PfTabs);\n expect(document.createElement('pf-tab')).to.be.an.instanceof(PfTab);\n expect(document.createElement('pf-tab-panel')).to.be.an.instanceof(PfTabPanel);\n });\n\n it('should upgrade', async function() {\n const el = await createFixture<PfTabs>(html`<pf-tabs></pf-tabs>`);\n expect(el, 'pf-tabs should be an instance of PfeTabs')\n .to.be.an.instanceOf(customElements.get('pf-tabs'))\n .and\n .to.be.an.instanceOf(PfTabs);\n });\n\n describe('with three valid tab pairs', function() {\n let element: PfTabs;\n\n const updateComplete = () => allUpdates(element);\n\n beforeEach(async function() {\n element = await createFixture<PfTabs>(html`\n <pf-tabs>\n <pf-tab slot=\"tab\">tab-1</pf-tab>\n <pf-tab-panel>panel-1</pf-tab-panel>\n <pf-tab slot=\"tab\">tab-2</pf-tab>\n <pf-tab-panel>panel-2</pf-tab-panel>\n <pf-tab slot=\"tab\">tab-3</pf-tab>\n <pf-tab-panel>panel-3</pf-tab-panel>\n </pf-tabs>\n `);\n });\n\n beforeEach(updateComplete);\n\n it('should apply aria attributes on initialization', function() {\n const tabs = element.querySelectorAll('pf-tab');\n const panels = element.querySelectorAll('pf-tab-panel');\n tabs.forEach(function(tab: Element, index: number) {\n const tabId = tab.getAttribute('id');\n const tabControls = tab.getAttribute('aria-controls');\n panels.forEach(function(panel: Element, pindex: number) {\n if (index === pindex) {\n expect(panel.getAttribute('aria-labelledby')).to.equal(tabId);\n expect(panel.id).to.equal(tabControls);\n }\n });\n });\n });\n\n describe('pressing Tab', function() {\n beforeEach(press('Tab'));\n beforeEach(updateComplete);\n beforeEach(nextFrame);\n it('should activate the first focusable tab', function() {\n expect(element.querySelector('pf-tab')).to.have.attribute('active');\n });\n\n it('should activate the first tab panel', function() {\n expect(element.querySelector('pf-tab')).to.not.have.attribute('hidden');\n });\n });\n\n describe('setting the `vertical` attribute', function() {\n beforeEach(function() {\n element.setAttribute('vertical', '');\n });\n\n beforeEach(updateComplete);\n\n it('should have vertical styles', function() {\n // WARNING: asserting on shadow root content;\n const tabs = element.shadowRoot!.querySelector('[part=\"tabs\"]')!;\n const tabsVerticalStyles = getComputedStyle(tabs).flexDirection;\n expect(tabsVerticalStyles).to.be.equal('column');\n });\n });\n\n describe('setting the second tab\\'s `active` attribute', function() {\n beforeEach(function() {\n const [, tab] = element.querySelectorAll('pf-tab');\n tab!.active = true;\n });\n\n beforeEach(updateComplete);\n beforeEach(nextFrame);\n\n it('should activate the second tab', function() {\n const [, tab] = element.querySelectorAll('pf-tab');\n expect(tab).to.have.attribute('active');\n });\n\n it('should activate its panel', function() {\n const [, tab] = element.querySelectorAll('pf-tab');\n expect(tab).to.not.have.attribute('hidden');\n });\n\n it('should deactivate previously active tab', function() {\n expect(element.querySelector('pf-tab')).to.not.have.attribute('active');\n });\n\n it('should hide previously active panel', function() {\n expect(element.querySelector('pf-tab-panel')).to.have.attribute('hidden');\n });\n });\n\n describe('setting `activeIndex` to 2', function() {\n beforeEach(function() {\n element.activeIndex = 2;\n });\n\n beforeEach(updateComplete);\n beforeEach(nextFrame);\n\n it('should activate the third tab', function() {\n const [,, tab] = element.querySelectorAll('pf-tab');\n expect(tab).to.have.attribute('active');\n });\n\n it('should activate the third panel', async function() {\n const snapshot = await a11ySnapshot();\n expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-3');\n });\n\n describe('then setting the first tab\\'s `disabled` attribute', function() {\n beforeEach(async function() {\n element.querySelector('pf-tab')!.disabled = true;\n });\n\n beforeEach(updateComplete);\n\n it('should disable the button', async function() {\n const snapshot = await a11ySnapshot();\n const disabledTab = snapshot.children?.find(x => x.role === 'tab' && x.disabled);\n expect(disabledTab).to.be.ok;\n });\n\n describe('and clicking the disabled tab', function() {\n beforeEach(async function() {\n element.querySelector('pf-tab')!.click();\n });\n\n beforeEach(updateComplete);\n\n it('should not activate', function() {\n const [first] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n });\n\n it('should present the third panel to the ax tree', async function() {\n const snapshot = await a11ySnapshot();\n expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-3');\n });\n });\n\n describe('then setting `activeIndex` to 0 (i.e. the disabled tab\\'s index)', function() {\n beforeEach(function() {\n element.activeIndex = 0;\n });\n\n beforeEach(updateComplete);\n\n it('should not activate the first tab', function() {\n expect(element.querySelector('pf-tab')).to.not.have.attribute('active');\n });\n\n it('should present the third panel to the ax tree', async function() {\n const snapshot = await a11ySnapshot();\n expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-3');\n });\n });\n });\n });\n\n describe('when viewed in a small viewport', function() {\n beforeEach(async function() {\n // this is a comically narrow viewport, but our tabs have quite short\n // labels, so viewport must be itsy-pitsy in order to cause overflow\n await setViewport({ width: 100, height: 640 });\n });\n\n beforeEach(nextFrame);\n beforeEach(nextFrame);\n beforeEach(nextFrame);\n beforeEach(updateComplete);\n\n it('should have visible scroll buttons if overflowed', function() {\n // Note: overflow buttons are not included in the accessibility tree otherwise we'd test\n // for buttons there. tabindex=\"-1\" is used on the buttons to prevent focus and was a\n // decision made to keep logical keyboard navigation order flow between tabs and panels\n // as the next overflow button exists in the DOM between the tabs container and the open panel\n // and would disrupt the expected flow. For keyboard users they are able to scroll using the\n // left and right arrows keys and do not need direct access to the overflow buttons but still\n // exist as visual cues for which direction is overflowed\n const previousTab = element.shadowRoot!.querySelector('#previousTab')!;\n const nextTab = element.shadowRoot!.querySelector('#nextTab')!;\n expect(previousTab).to.not.be.null;\n expect(nextTab).to.not.be.null;\n const prevDisplayStyle = getComputedStyle(previousTab).display;\n const nextDisplayStyle = getComputedStyle(nextTab).display;\n expect(prevDisplayStyle ).to.not.equal('none');\n expect(nextDisplayStyle).to.not.equal('none');\n });\n });\n\n describe(`when navigated by keyboard`, function() {\n describe('when focused on the first tab', function() {\n beforeEach(async function() {\n element.querySelector('pf-tab')!.focus();\n });\n\n describe('pressing ArrowRight', function() {\n beforeEach(async function() {\n await sendKeys({ down: 'ArrowRight' });\n });\n\n beforeEach(updateComplete);\n\n it('should activate the next tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n expect(second).to.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n });\n });\n\n describe('pressing ArrowLeft', function() {\n beforeEach(async function() {\n await sendKeys({ down: 'ArrowLeft' });\n });\n\n it('should activate the last tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n expect(second).to.not.have.attribute('active');\n expect(third).to.have.attribute('active');\n });\n describe('then pressing ArrowRight', function() {\n beforeEach(async function() {\n await sendKeys({ down: 'ArrowRight' });\n });\n\n beforeEach(updateComplete);\n\n it('should activate the first tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.have.attribute('active');\n expect(second).to.not.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n });\n });\n });\n });\n });\n\n describe('setting the `manual` attribute', function() {\n beforeEach(function() {\n element.setAttribute('manual', '');\n });\n\n beforeEach(updateComplete);\n\n describe('pressing Tab', function() {\n beforeEach(press('Tab'));\n describe('pressing ArrowRight key', function() {\n beforeEach(press('ArrowRight'));\n\n beforeEach(updateComplete);\n\n it('should not activate second tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.have.attribute('active');\n expect(second).to.not.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n });\n\n it('should focus the second tab', function() {\n const [, second] = element.querySelectorAll('pf-tab');\n expect(document.activeElement).to.equal(second);\n });\n\n describe('pressing enter key', function() {\n beforeEach(press('Enter'));\n\n beforeEach(updateComplete);\n\n it('should activate second tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n expect(second).to.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n expect(document.activeElement).to.equal(second);\n });\n });\n });\n });\n });\n });\n\n describe('when no active tab is given and the first tab is disabled', function() {\n let element: PfTabs;\n\n beforeEach(async function() {\n element = await createFixture<PfTabs>(html`\n <pf-tabs>\n <pf-tab id=\"tab1\" slot=\"tab\" disabled></pf-tab>\n <pf-tab id=\"tab2\" slot=\"tab\"></pf-tab>\n <pf-tab id=\"tab3\" slot=\"tab\"></pf-tab>\n <pf-tab id=\"tab4\" slot=\"tab\" disabled></pf-tab>\n <pf-tab id=\"tab5\" slot=\"tab\" aria-disabled=\"true\"></pf-tab>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n </pf-tabs>\n `);\n });\n\n it('should activate the next focusable tab', function() {\n expect(element.activeTab).to.have.id('tab2');\n });\n });\n});\n"]}
1
+ {"version":3,"file":"pf-tabs.spec.js","sourceRoot":"","sources":["pf-tabs.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,8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CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wCAAwC,EAAE;YAC3C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, html, nextFrame } from '@open-wc/testing';\nimport { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';\nimport { a11ySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js';\nimport { setViewport, sendKeys } from '@web/test-runner-commands';\n\nimport { allUpdates } from '@patternfly/pfe-tools/test/utils.js';\n\nimport { PfTabs } from '../pf-tabs.js';\nimport { PfTab } from '../pf-tab.js';\nimport { PfTabPanel } from '../pf-tab-panel.js';\n\nimport '@patternfly/pfe-tools/test/stub-logger.js';\n\nfunction press(key: string) {\n return async function() {\n await sendKeys({ press: key });\n };\n}\n\ndescribe('<pf-tabs>', function() {\n it('instantiates imperatively', function() {\n expect(document.createElement('pf-tabs')).to.be.an.instanceof(PfTabs);\n expect(document.createElement('pf-tab')).to.be.an.instanceof(PfTab);\n expect(document.createElement('pf-tab-panel')).to.be.an.instanceof(PfTabPanel);\n });\n\n it('should upgrade', async function() {\n const el = await createFixture<PfTabs>(html`<pf-tabs></pf-tabs>`);\n expect(el, 'pf-tabs should be an instance of PfeTabs')\n .to.be.an.instanceOf(customElements.get('pf-tabs'))\n .and\n .to.be.an.instanceOf(PfTabs);\n });\n\n describe('with three valid tab pairs', function() {\n let element: PfTabs;\n\n const updateComplete = () => allUpdates(element);\n\n beforeEach(async function() {\n element = await createFixture<PfTabs>(html`\n <pf-tabs>\n <pf-tab slot=\"tab\">tab-1</pf-tab>\n <pf-tab-panel>panel-1</pf-tab-panel>\n <pf-tab slot=\"tab\">tab-2</pf-tab>\n <pf-tab-panel>panel-2</pf-tab-panel>\n <pf-tab slot=\"tab\">tab-3</pf-tab>\n <pf-tab-panel>panel-3</pf-tab-panel>\n </pf-tabs>\n `);\n });\n\n beforeEach(updateComplete);\n\n it('should apply aria attributes on initialization', function() {\n const tabs = element.querySelectorAll('pf-tab');\n const panels = element.querySelectorAll('pf-tab-panel');\n tabs.forEach(function(tab: Element, index: number) {\n const tabId = tab.getAttribute('id');\n const tabControls = tab.getAttribute('aria-controls');\n panels.forEach(function(panel: Element, pindex: number) {\n if (index === pindex) {\n expect(panel.getAttribute('aria-labelledby')).to.equal(tabId);\n expect(panel.id).to.equal(tabControls);\n }\n });\n });\n });\n\n describe('pressing Tab', function() {\n beforeEach(press('Tab'));\n beforeEach(updateComplete);\n beforeEach(nextFrame);\n it('should activate the first focusable tab', function() {\n expect(element.querySelector('pf-tab')).to.have.attribute('active');\n });\n\n it('should activate the first tab panel', function() {\n expect(element.querySelector('pf-tab')).to.not.have.attribute('hidden');\n });\n });\n\n describe('setting the `vertical` attribute', function() {\n beforeEach(function() {\n element.setAttribute('vertical', '');\n });\n\n beforeEach(updateComplete);\n\n it('should have vertical styles', function() {\n // WARNING: asserting on shadow root content;\n const tabs = element.shadowRoot!.querySelector('[part=\"tabs\"]')!;\n const tabsVerticalStyles = getComputedStyle(tabs).flexDirection;\n expect(tabsVerticalStyles).to.be.equal('column');\n });\n });\n\n describe('setting the second tab\\'s `active` attribute', function() {\n beforeEach(function() {\n const [, tab] = element.querySelectorAll('pf-tab');\n tab!.active = true;\n });\n\n beforeEach(updateComplete);\n beforeEach(nextFrame);\n\n it('should activate the second tab', function() {\n const [, tab] = element.querySelectorAll('pf-tab');\n expect(tab).to.have.attribute('active');\n });\n\n it('should activate its panel', function() {\n const [, tab] = element.querySelectorAll('pf-tab');\n expect(tab).to.not.have.attribute('hidden');\n });\n\n it('should deactivate previously active tab', function() {\n expect(element.querySelector('pf-tab')).to.not.have.attribute('active');\n });\n\n it('should hide previously active panel', function() {\n expect(element.querySelector('pf-tab-panel')).to.have.attribute('hidden');\n });\n });\n\n describe('setting `activeIndex` to 2', function() {\n beforeEach(function() {\n element.activeIndex = 2;\n });\n\n beforeEach(updateComplete);\n beforeEach(nextFrame);\n\n it('should activate the third tab', function() {\n const [,, tab] = element.querySelectorAll('pf-tab');\n expect(tab).to.have.attribute('active');\n });\n\n it('should activate the third panel', async function() {\n const snapshot = await a11ySnapshot();\n expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-3');\n });\n\n describe('then setting the first tab\\'s `disabled` attribute', function() {\n beforeEach(async function() {\n element.querySelector('pf-tab')!.disabled = true;\n });\n\n beforeEach(updateComplete);\n\n it('should disable the button', async function() {\n const snapshot = await a11ySnapshot();\n const disabledTab = snapshot.children?.find(x => x.role === 'tab' && x.disabled);\n expect(disabledTab).to.be.ok;\n });\n\n describe('and clicking the disabled tab', function() {\n beforeEach(async function() {\n element.querySelector('pf-tab')!.click();\n });\n\n beforeEach(updateComplete);\n\n it('should not activate', function() {\n const [first] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n });\n\n it('should present the third panel to the ax tree', async function() {\n const snapshot = await a11ySnapshot();\n expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-3');\n });\n });\n\n describe('then setting `activeIndex` to 0 (i.e. the disabled tab\\'s index)', function() {\n beforeEach(function() {\n element.activeIndex = 0;\n });\n\n beforeEach(updateComplete);\n\n it('should not activate the first tab', function() {\n expect(element.querySelector('pf-tab')).to.not.have.attribute('active');\n });\n\n it('should present the third panel to the ax tree', async function() {\n const snapshot = await a11ySnapshot();\n expect(snapshot.children?.find(x => x.role === 'tabpanel')?.name).to.equal('tab-3');\n });\n });\n });\n });\n\n describe('when viewed in a small viewport', function() {\n beforeEach(async function() {\n // this is a comically narrow viewport, but our tabs have quite short\n // labels, so viewport must be itsy-pitsy in order to cause overflow\n await setViewport({ width: 100, height: 640 });\n });\n\n beforeEach(nextFrame);\n beforeEach(nextFrame);\n beforeEach(nextFrame);\n beforeEach(updateComplete);\n\n it('should have visible scroll buttons if overflowed', function() {\n // Note: overflow buttons are not included in the accessibility tree otherwise we'd test\n // for buttons there. tabindex=\"-1\" is used on the buttons to prevent focus and was a\n // decision made to keep logical keyboard navigation order flow between tabs and panels\n // as the next overflow button exists in the DOM between the tabs container and the open panel\n // and would disrupt the expected flow. For keyboard users they are able to scroll using the\n // left and right arrows keys and do not need direct access to the overflow buttons but still\n // exist as visual cues for which direction is overflowed\n const previousTab = element.shadowRoot!.querySelector('#previousTab')!;\n const nextTab = element.shadowRoot!.querySelector('#nextTab')!;\n expect(previousTab).to.not.be.null;\n expect(nextTab).to.not.be.null;\n const prevDisplayStyle = getComputedStyle(previousTab).display;\n const nextDisplayStyle = getComputedStyle(nextTab).display;\n expect(prevDisplayStyle ).to.not.equal('none');\n expect(nextDisplayStyle).to.not.equal('none');\n });\n });\n\n describe(`when navigated by keyboard`, function() {\n describe('when focused on the first tab', function() {\n beforeEach(async function() {\n element.querySelector('pf-tab')!.focus();\n });\n\n describe('pressing ArrowRight', function() {\n beforeEach(async function() {\n await sendKeys({ down: 'ArrowRight' });\n });\n\n beforeEach(updateComplete);\n\n it('should activate the next tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n expect(second).to.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n });\n\n it('should specify the selected tab to assistive technology', async function() {\n expect(await a11ySnapshot()).to.axContainQuery({ role: 'tabpanel', name: 'tab-2' });\n });\n });\n\n describe('pressing ArrowLeft', function() {\n beforeEach(async function() {\n await sendKeys({ down: 'ArrowLeft' });\n });\n\n it('should activate the last tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n expect(second).to.not.have.attribute('active');\n expect(third).to.have.attribute('active');\n });\n\n it('should specify the selected tab to assistive technology', async function() {\n expect(await a11ySnapshot()).to.axContainQuery({ role: 'tabpanel', name: 'tab-3' });\n });\n\n describe('then pressing ArrowRight', function() {\n beforeEach(async function() {\n await sendKeys({ down: 'ArrowRight' });\n });\n\n beforeEach(updateComplete);\n\n it('should activate the first tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.have.attribute('active');\n expect(second).to.not.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n });\n\n it('should specify the selected tab to assistive technology', async function() {\n expect(await a11ySnapshot()).to.axContainQuery({ role: 'tabpanel', name: 'tab-1' });\n });\n });\n });\n });\n });\n\n describe('setting the `manual` attribute', function() {\n beforeEach(function() {\n element.setAttribute('manual', '');\n });\n\n beforeEach(updateComplete);\n\n describe('pressing Tab', function() {\n beforeEach(press('Tab'));\n describe('pressing ArrowRight key', function() {\n beforeEach(press('ArrowRight'));\n\n beforeEach(updateComplete);\n\n it('should not activate second tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.have.attribute('active');\n expect(second).to.not.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n });\n\n it('should focus the second tab', function() {\n const [, second] = element.querySelectorAll('pf-tab');\n expect(document.activeElement).to.equal(second);\n });\n\n describe('pressing enter key', function() {\n beforeEach(press('Enter'));\n\n beforeEach(updateComplete);\n\n it('should activate second tab', function() {\n const [first, second, third] = element.querySelectorAll('pf-tab');\n expect(first).to.not.have.attribute('active');\n expect(second).to.have.attribute('active');\n expect(third).to.not.have.attribute('active');\n expect(document.activeElement).to.equal(second);\n });\n });\n });\n });\n });\n });\n\n describe('when no active tab is given and the first tab is disabled', function() {\n let element: PfTabs;\n\n beforeEach(async function() {\n element = await createFixture<PfTabs>(html`\n <pf-tabs>\n <pf-tab id=\"tab1\" slot=\"tab\" disabled></pf-tab>\n <pf-tab id=\"tab2\" slot=\"tab\"></pf-tab>\n <pf-tab id=\"tab3\" slot=\"tab\"></pf-tab>\n <pf-tab id=\"tab4\" slot=\"tab\" disabled></pf-tab>\n <pf-tab id=\"tab5\" slot=\"tab\" aria-disabled=\"true\"></pf-tab>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n <pf-tab-panel></pf-tab-panel>\n </pf-tabs>\n `);\n });\n\n it('should activate the next focusable tab', function() {\n expect(element.activeTab).to.have.id('tab2');\n });\n });\n});\n"]}
@@ -104,7 +104,7 @@ PfTextArea.shadowRootOptions = {
104
104
  ...LitElement.shadowRootOptions,
105
105
  delegatesFocus: true,
106
106
  };
107
- PfTextArea.version = "4.0.2";
107
+ PfTextArea.version = "4.1.0";
108
108
  __decorate([
109
109
  property({ reflect: true, attribute: 'accessible-label' })
110
110
  ], PfTextArea.prototype, "accessibleLabel", void 0);
@@ -123,7 +123,7 @@ PfTextInput.shadowRootOptions = {
123
123
  ...LitElement.shadowRootOptions,
124
124
  delegatesFocus: true,
125
125
  };
126
- PfTextInput.version = "4.0.2";
126
+ PfTextInput.version = "4.1.0";
127
127
  __decorate([
128
128
  property({ type: Boolean, reflect: true, attribute: 'left-truncated' })
129
129
  ], PfTextInput.prototype, "leftTruncated", void 0);
@@ -26,7 +26,7 @@ let PfTile = class PfTile extends LitElement {
26
26
  }
27
27
  };
28
28
  PfTile.styles = [styles];
29
- PfTile.version = "4.0.2";
29
+ PfTile.version = "4.1.0";
30
30
  __decorate([
31
31
  property({ reflect: true, type: Boolean })
32
32
  ], PfTile.prototype, "selected", void 0);
@@ -47,7 +47,7 @@ let PfTimestamp = class PfTimestamp extends LitElement {
47
47
  };
48
48
  _PfTimestamp_timestamp = new WeakMap();
49
49
  PfTimestamp.styles = [style];
50
- PfTimestamp.version = "4.0.2";
50
+ PfTimestamp.version = "4.1.0";
51
51
  __decorate([
52
52
  property({ reflect: true, attribute: 'date-format' })
53
53
  ], PfTimestamp.prototype, "dateFormat", void 0);
@@ -94,10 +94,10 @@ _PfTooltip_referenceTrigger = new WeakMap();
94
94
  _PfTooltip_float = new WeakMap();
95
95
  _PfTooltip_instances = new WeakSet();
96
96
  _PfTooltip_invoker_get = function _PfTooltip_invoker_get() {
97
- return this.shadowRoot?.querySelector('#invoker') ?? null;
97
+ return this.shadowRoot?.querySelector?.('#invoker') ?? null;
98
98
  };
99
99
  _PfTooltip_content_get = function _PfTooltip_content_get() {
100
- return this.shadowRoot?.querySelector('#tooltip') ?? null;
100
+ return this.shadowRoot?.querySelector?.('#tooltip') ?? null;
101
101
  };
102
102
  _PfTooltip_invokerChanged = function _PfTooltip_invokerChanged() {
103
103
  this.requestUpdate();
@@ -135,7 +135,7 @@ _PfTooltip_updateTrigger = function _PfTooltip_updateTrigger() {
135
135
  }
136
136
  };
137
137
  PfTooltip.styles = [styles];
138
- PfTooltip.version = "4.0.2";
138
+ PfTooltip.version = "4.1.0";
139
139
  __decorate([
140
140
  property()
141
141
  ], PfTooltip.prototype, "position", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"pf-tooltip.js","sourceRoot":"","sources":["pf-tooltip.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EACL,qBAAqB,GAEtB,MAAM,6DAA6D,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;;;AAI3D,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AAC9D,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AAuF/C,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;;QAGL,oE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AC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1D,CAAC;iBAAM,CAAC;gBACN,mBAAmB,EAAE,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzD,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AA/He,gBAAM,GAAoB,CAAC,MAAM,CAAC,AAA5B,CAA6B;;AAGvC;IAAX,QAAQ,EAAE;2CAA6B;AAG5B;IAAX,QAAQ,EAAE;0CAAkB;AAGsB;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;yCAAgB;AAEtD;IAAX,QAAQ,EAAE;0CAA4B;AAWpC;IAHF,QAAQ,CAAC;QACR,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,mBAAmB;KAC/B,CAAC;+CAA4B;AA2GjB;IAAZ,KAAK;qCAYL;AAEY;IAAZ,KAAK;qCAEL;AAlJU,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS","sourcesContent":["import type { PropertyValues, TemplateResult } from 'lit';\nimport { LitElement, html, isServer } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport {\n FloatingDOMController,\n type Placement,\n} from '@patternfly/pfe-core/controllers/floating-dom-controller.js';\n\nimport { bound } from '@patternfly/pfe-core/decorators/bound.js';\n\nimport { StringListConverter } from '@patternfly/pfe-core';\n\nimport styles from './pf-tooltip.css';\n\nconst EnterEvents = ['focusin', 'tap', 'click', 'mouseenter'];\nconst ExitEvents = ['focusout', 'blur', 'mouseleave'];\n\n/**\n * A **tooltip** is in-app messaging used to identify elements on a page with short,\n * clarifying text.\n * @summary Toggle the visibility of helpful or contextual information.\n * @slot\n * This slot wraps around the element that should be used to invoke the tooltip content to display.\n * Typically this would be an icon, button, or other small sized element.\n * @slot content\n * This slot renders the content that will be displayed inside of the tooltip.\n * Typically this would include a string of text without any additional elements.\n * This element is wrapped with a div inside of the component to give it the stylings and background colors.\n * @cssprop {<color>} [--pf-c-tooltip__content--BackgroundColor=#1b1d21]\n * Sets the background color for the tooltip content.\n *\n * @cssprop {<color>} [--pf-c-tooltip__content--Color=#e0e0e0]\n * Sets the font color for the tooltip content.\n *\n * @cssprop {<number>} [--pf-c-tooltip--line-height=1.5]\n * Sets the font color for the tooltip content.\n *\n * @cssprop {<length>} [--pf-c-tooltip--MaxWidth=18.75rem]\n * Maximum width for the tooltip.\n *\n * @cssprop [--pf-c-tooltip--BoxShadow=0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)]\n * Box shadow for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingTop=0.5rem]\n * Top padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingRight=0.5rem]\n * Right padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingBottom=0.5rem]\n * Bottom padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingLeft=0.5rem]\n * Left Padding for the tooltip.\n *\n * @cssprop [--pf-c-tooltip__content--FontSize=0.875rem]\n * Font size for the tooltip content.\n *\n * @cssprop {<length>} [--pf-c-tooltip__arrow--Width=0.5rem]\n * Tooltip arrow width.\n *\n * @cssprop {<length>} [--pf-c-tooltip__arrow--Height=0.5rem]\n * Tooltip arrow height.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--TranslateY=50]\n * Positions the tooltip arrow along the y axis for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--TranslateX=50]\n * Positions the tooltip arrow along the x axis for `left` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `left` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `left` positioned arrows.\n *\n */\n@customElement('pf-tooltip')\nexport class PfTooltip extends LitElement {\n static readonly styles: CSSStyleSheet[] = [styles];\n\n /** The position of the tooltip, relative to the invoking content */\n @property() position: Placement = 'top';\n\n /** Tooltip content. Overridden by the content slot */\n @property() content?: string;\n\n /** If false, prevents the tooltip from trying to remain in view by flipping itself when necessary */\n @property({ type: Boolean, attribute: 'no-flip' }) noFlip = false;\n\n @property() trigger?: string | Element;\n\n /**\n * The flip order when flip is enabled and the initial position is not possible.\n * There are 12 options: `top`, `bottom`, `left`, `right`, `top-start`, `top-end`,\n * `bottom-start`, `bottom-end`, `left-start`, `left-end`,`right-start`, `right-end`.\n * The default is [oppositePlacement], where only the opposite placement is tried.\n */\n @property({\n attribute: 'flip-behavior',\n converter: StringListConverter,\n }) flipBehavior?: Placement[];\n\n get #invoker(): HTMLSlotElement | null {\n return this.shadowRoot?.querySelector('#invoker') ?? null;\n }\n\n get #content(): HTMLElement | null {\n return this.shadowRoot?.querySelector('#tooltip') ?? null;\n }\n\n #referenceTrigger?: HTMLElement | null;\n\n #float = new FloatingDOMController(this, {\n content: (): HTMLElement | null | undefined => this.#content,\n invoker: (): HTMLElement | null | undefined => {\n if (this.#referenceTrigger) {\n return this.#referenceTrigger;\n } else if (this.#invoker instanceof HTMLSlotElement\n && this.#invoker.assignedElements().length > 0) {\n return this.#invoker.assignedElements().at(0) as HTMLElement;\n } else {\n return this.#invoker;\n }\n },\n });\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#invokerChanged();\n this.#updateTrigger();\n }\n\n /**\n * Removes event listeners from the old trigger element and attaches\n * them to the new trigger element.\n * @param changed changed properties\n */\n override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('trigger')) {\n this.#updateTrigger();\n }\n }\n\n override render(): TemplateResult<1> {\n const { alignment, anchor, open, styles } = this.#float;\n\n const blockInvoker =\n this.#invoker?.assignedElements().length === 0\n && this.#invoker?.assignedNodes().length > 0;\n const display = blockInvoker ? 'block' : 'contents';\n\n return html`\n <div id=\"container\"\n style=\"${styleMap(styles)}\"\n class=\"${classMap({ open,\n [anchor]: !!anchor,\n [alignment]: !!alignment })}\">\n <div role=\"tooltip\"\n style=\"${styleMap({ display })}\"\n aria-labelledby=\"tooltip\">\n <slot id=\"invoker\" @slotchange=\"${this.#invokerChanged}\"></slot>\n </div>\n <div aria-hidden=\"${String(!open) as 'true' | 'false'}\">\n <slot id=\"tooltip\" name=\"content\">${this.content}</slot>\n </div>\n </div>\n `;\n }\n\n /** the invoker slot should render at block level if it only has text nodes */\n #invokerChanged() {\n this.requestUpdate();\n }\n\n #getReferenceTrigger() {\n return (this.getRootNode() as Document | ShadowRoot)\n .getElementById(this.trigger?.normalize() ?? '');\n }\n\n #updateTrigger() {\n if (!isServer) {\n const oldReferenceTrigger = this.#referenceTrigger;\n this.#referenceTrigger =\n this.trigger instanceof HTMLElement ? this.trigger\n : typeof this.trigger === 'string' ? this.#getReferenceTrigger()\n : null;\n for (const evt of EnterEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.show);\n this.#referenceTrigger.addEventListener(evt, this.show);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.show);\n this.addEventListener(evt, this.show);\n }\n }\n for (const evt of ExitEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.hide);\n this.#referenceTrigger.addEventListener(evt, this.hide);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.hide);\n this.addEventListener(evt, this.hide);\n }\n }\n }\n }\n\n @bound async show(): Promise<void> {\n await this.updateComplete;\n const placement = this.position;\n const offset =\n !placement?.match(/top|bottom/) ? 15\n : { mainAxis: 15, alignmentAxis: -4 };\n await this.#float.show({\n offset,\n placement,\n flip: !this.noFlip,\n fallbackPlacements: this.flipBehavior,\n });\n }\n\n @bound async hide(): Promise<void> {\n await this.#float.hide();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-tooltip': PfTooltip;\n }\n}\n"]}
1
+ {"version":3,"file":"pf-tooltip.js","sourceRoot":"","sources":["pf-tooltip.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EACL,qBAAqB,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ACN,mBAAmB,EAAE,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzD,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;YAC7B,IAAI,uBAAA,IAAI,mCAAkB,EAAE,CAAC;gBAC3B,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzC,uBAAA,IAAI,mCAAkB,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1D,CAAC;iBAAM,CAAC;gBACN,mBAAmB,EAAE,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzD,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC;AA/He,gBAAM,GAAoB,CAAC,MAAM,CAAC,AAA5B,CAA6B;;AAGvC;IAAX,QAAQ,EAAE;2CAA6B;AAG5B;IAAX,QAAQ,EAAE;0CAAkB;AAGsB;IAAlD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;yCAAgB;AAEtD;IAAX,QAAQ,EAAE;0CAA4B;AAWpC;IAHF,QAAQ,CAAC;QACR,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,mBAAmB;KAC/B,CAAC;+CAA4B;AA2GjB;IAAZ,KAAK;qCAYL;AAEY;IAAZ,KAAK;qCAEL;AAlJU,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS","sourcesContent":["import type { PropertyValues, TemplateResult } from 'lit';\nimport { LitElement, html, isServer } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport {\n FloatingDOMController,\n type Placement,\n} from '@patternfly/pfe-core/controllers/floating-dom-controller.js';\n\nimport { bound } from '@patternfly/pfe-core/decorators/bound.js';\n\nimport { StringListConverter } from '@patternfly/pfe-core';\n\nimport styles from './pf-tooltip.css';\n\nconst EnterEvents = ['focusin', 'tap', 'click', 'mouseenter'];\nconst ExitEvents = ['focusout', 'blur', 'mouseleave'];\n\n/**\n * A **tooltip** is in-app messaging used to identify elements on a page with short,\n * clarifying text.\n * @summary Toggle the visibility of helpful or contextual information.\n * @slot\n * This slot wraps around the element that should be used to invoke the tooltip content to display.\n * Typically this would be an icon, button, or other small sized element.\n * @slot content\n * This slot renders the content that will be displayed inside of the tooltip.\n * Typically this would include a string of text without any additional elements.\n * This element is wrapped with a div inside of the component to give it the stylings and background colors.\n * @cssprop {<color>} [--pf-c-tooltip__content--BackgroundColor=#1b1d21]\n * Sets the background color for the tooltip content.\n *\n * @cssprop {<color>} [--pf-c-tooltip__content--Color=#e0e0e0]\n * Sets the font color for the tooltip content.\n *\n * @cssprop {<number>} [--pf-c-tooltip--line-height=1.5]\n * Sets the font color for the tooltip content.\n *\n * @cssprop {<length>} [--pf-c-tooltip--MaxWidth=18.75rem]\n * Maximum width for the tooltip.\n *\n * @cssprop [--pf-c-tooltip--BoxShadow=0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)]\n * Box shadow for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingTop=0.5rem]\n * Top padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingRight=0.5rem]\n * Right padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingBottom=0.5rem]\n * Bottom padding for the tooltip.\n *\n * @cssprop {<length>} [--pf-c-tooltip__content--PaddingLeft=0.5rem]\n * Left Padding for the tooltip.\n *\n * @cssprop [--pf-c-tooltip__content--FontSize=0.875rem]\n * Font size for the tooltip content.\n *\n * @cssprop {<length>} [--pf-c-tooltip__arrow--Width=0.5rem]\n * Tooltip arrow width.\n *\n * @cssprop {<length>} [--pf-c-tooltip__arrow--Height=0.5rem]\n * Tooltip arrow height.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--TranslateY=50]\n * Positions the tooltip arrow along the y axis for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-top--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `top` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-right--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `right` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateX=-50]\n * Positions the tooltip arrow along the x axis for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-bottom--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `bottom` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--TranslateX=50]\n * Positions the tooltip arrow along the x axis for `left` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--TranslateY=-50]\n * Positions the tooltip arrow along the y axis for `left` positioned arrows.\n *\n * @cssprop [--pf-c-tooltip__arrow--m-left--Rotate=45deg]\n * Rotates the tooltip arrow based on degrees of movement for `left` positioned arrows.\n *\n */\n@customElement('pf-tooltip')\nexport class PfTooltip extends LitElement {\n static readonly styles: CSSStyleSheet[] = [styles];\n\n /** The position of the tooltip, relative to the invoking content */\n @property() position: Placement = 'top';\n\n /** Tooltip content. Overridden by the content slot */\n @property() content?: string;\n\n /** If false, prevents the tooltip from trying to remain in view by flipping itself when necessary */\n @property({ type: Boolean, attribute: 'no-flip' }) noFlip = false;\n\n @property() trigger?: string | Element;\n\n /**\n * The flip order when flip is enabled and the initial position is not possible.\n * There are 12 options: `top`, `bottom`, `left`, `right`, `top-start`, `top-end`,\n * `bottom-start`, `bottom-end`, `left-start`, `left-end`,`right-start`, `right-end`.\n * The default is [oppositePlacement], where only the opposite placement is tried.\n */\n @property({\n attribute: 'flip-behavior',\n converter: StringListConverter,\n }) flipBehavior?: Placement[];\n\n get #invoker(): HTMLSlotElement | null {\n return this.shadowRoot?.querySelector?.('#invoker') ?? null;\n }\n\n get #content(): HTMLElement | null {\n return this.shadowRoot?.querySelector?.('#tooltip') ?? null;\n }\n\n #referenceTrigger?: HTMLElement | null;\n\n #float = new FloatingDOMController(this, {\n content: (): HTMLElement | null | undefined => this.#content,\n invoker: (): HTMLElement | null | undefined => {\n if (this.#referenceTrigger) {\n return this.#referenceTrigger;\n } else if (this.#invoker instanceof HTMLSlotElement\n && this.#invoker.assignedElements().length > 0) {\n return this.#invoker.assignedElements().at(0) as HTMLElement;\n } else {\n return this.#invoker;\n }\n },\n });\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#invokerChanged();\n this.#updateTrigger();\n }\n\n /**\n * Removes event listeners from the old trigger element and attaches\n * them to the new trigger element.\n * @param changed changed properties\n */\n override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('trigger')) {\n this.#updateTrigger();\n }\n }\n\n override render(): TemplateResult<1> {\n const { alignment, anchor, open, styles } = this.#float;\n\n const blockInvoker =\n this.#invoker?.assignedElements().length === 0\n && this.#invoker?.assignedNodes().length > 0;\n const display = blockInvoker ? 'block' : 'contents';\n\n return html`\n <div id=\"container\"\n style=\"${styleMap(styles)}\"\n class=\"${classMap({ open,\n [anchor]: !!anchor,\n [alignment]: !!alignment })}\">\n <div role=\"tooltip\"\n style=\"${styleMap({ display })}\"\n aria-labelledby=\"tooltip\">\n <slot id=\"invoker\" @slotchange=\"${this.#invokerChanged}\"></slot>\n </div>\n <div aria-hidden=\"${String(!open) as 'true' | 'false'}\">\n <slot id=\"tooltip\" name=\"content\">${this.content}</slot>\n </div>\n </div>\n `;\n }\n\n /** the invoker slot should render at block level if it only has text nodes */\n #invokerChanged() {\n this.requestUpdate();\n }\n\n #getReferenceTrigger() {\n return (this.getRootNode() as Document | ShadowRoot)\n .getElementById(this.trigger?.normalize() ?? '');\n }\n\n #updateTrigger() {\n if (!isServer) {\n const oldReferenceTrigger = this.#referenceTrigger;\n this.#referenceTrigger =\n this.trigger instanceof HTMLElement ? this.trigger\n : typeof this.trigger === 'string' ? this.#getReferenceTrigger()\n : null;\n for (const evt of EnterEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.show);\n this.#referenceTrigger.addEventListener(evt, this.show);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.show);\n this.addEventListener(evt, this.show);\n }\n }\n for (const evt of ExitEvents) {\n if (this.#referenceTrigger) {\n this.removeEventListener(evt, this.hide);\n this.#referenceTrigger.addEventListener(evt, this.hide);\n } else {\n oldReferenceTrigger?.removeEventListener(evt, this.hide);\n this.addEventListener(evt, this.hide);\n }\n }\n }\n }\n\n @bound async show(): Promise<void> {\n await this.updateComplete;\n const placement = this.position;\n const offset =\n !placement?.match(/top|bottom/) ? 15\n : { mainAxis: 15, alignmentAxis: -4 };\n await this.#float.show({\n offset,\n placement,\n flip: !this.noFlip,\n fallbackPlacements: this.flipBehavior,\n });\n }\n\n @bound async hide(): Promise<void> {\n await this.#float.hide();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-tooltip': PfTooltip;\n }\n}\n"]}