@patternfly/elements 4.2.0 → 4.3.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 (88) hide show
  1. package/custom-elements.json +2556 -1279
  2. package/package.json +13 -7
  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-alert/pf-alert.css +193 -0
  7. package/pf-alert/pf-alert.d.ts +95 -0
  8. package/pf-alert/pf-alert.js +406 -0
  9. package/pf-alert/pf-alert.js.map +1 -0
  10. package/pf-alert/test/pf-alert.e2e.d.ts +1 -0
  11. package/pf-alert/test/pf-alert.e2e.js +45 -0
  12. package/pf-alert/test/pf-alert.e2e.js.map +1 -0
  13. package/pf-alert/test/pf-alert.spec.d.ts +1 -0
  14. package/pf-alert/test/pf-alert.spec.js +42 -0
  15. package/pf-alert/test/pf-alert.spec.js.map +1 -0
  16. package/pf-avatar/pf-avatar.js +1 -1
  17. package/pf-back-to-top/pf-back-to-top.js +1 -1
  18. package/pf-back-to-top/test/pf-back-to-top.spec.js +3 -2
  19. package/pf-back-to-top/test/pf-back-to-top.spec.js.map +1 -1
  20. package/pf-background-image/pf-background-image.js +1 -1
  21. package/pf-badge/pf-badge.js +1 -1
  22. package/pf-banner/pf-banner.js +1 -1
  23. package/pf-button/pf-button.js +1 -1
  24. package/pf-card/pf-card.js +1 -1
  25. package/pf-chip/pf-chip-group.js +1 -1
  26. package/pf-chip/pf-chip.js +1 -1
  27. package/pf-clipboard-copy/pf-clipboard-copy.js +1 -1
  28. package/pf-code-block/pf-code-block.js +1 -1
  29. package/pf-dropdown/pf-dropdown-group.js +1 -1
  30. package/pf-dropdown/pf-dropdown-item.js +1 -1
  31. package/pf-dropdown/pf-dropdown-menu.js +1 -1
  32. package/pf-dropdown/pf-dropdown.css +8 -1
  33. package/pf-dropdown/pf-dropdown.js +9 -2
  34. package/pf-dropdown/pf-dropdown.js.map +1 -1
  35. package/pf-helper-text/pf-helper-text.css +35 -0
  36. package/pf-helper-text/pf-helper-text.d.ts +41 -0
  37. package/pf-helper-text/pf-helper-text.js +107 -0
  38. package/pf-helper-text/pf-helper-text.js.map +1 -0
  39. package/pf-helper-text/test/pf-helper-text.e2e.d.ts +1 -0
  40. package/pf-helper-text/test/pf-helper-text.e2e.js +23 -0
  41. package/pf-helper-text/test/pf-helper-text.e2e.js.map +1 -0
  42. package/pf-helper-text/test/pf-helper-text.spec.d.ts +1 -0
  43. package/pf-helper-text/test/pf-helper-text.spec.js +57 -0
  44. package/pf-helper-text/test/pf-helper-text.spec.js.map +1 -0
  45. package/pf-hint/pf-hint.css +120 -0
  46. package/pf-hint/pf-hint.d.ts +19 -0
  47. package/pf-hint/pf-hint.js +180 -0
  48. package/pf-hint/pf-hint.js.map +1 -0
  49. package/pf-hint/test/pf-hint.e2e.d.ts +1 -0
  50. package/pf-hint/test/pf-hint.e2e.js +23 -0
  51. package/pf-hint/test/pf-hint.e2e.js.map +1 -0
  52. package/pf-hint/test/pf-hint.spec.d.ts +1 -0
  53. package/pf-hint/test/pf-hint.spec.js +87 -0
  54. package/pf-hint/test/pf-hint.spec.js.map +1 -0
  55. package/pf-icon/pf-icon.js +1 -1
  56. package/pf-jump-links/pf-jump-links-item.js +1 -1
  57. package/pf-jump-links/pf-jump-links-list.js +1 -1
  58. package/pf-jump-links/pf-jump-links.js +1 -1
  59. package/pf-label/pf-label.js +1 -1
  60. package/pf-modal/pf-modal.d.ts +1 -1
  61. package/pf-modal/pf-modal.js +1 -1
  62. package/pf-modal/pf-modal.js.map +1 -1
  63. package/pf-panel/pf-panel.js +1 -1
  64. package/pf-popover/pf-popover.js +1 -1
  65. package/pf-progress/pf-progress.js +1 -1
  66. package/pf-progress-stepper/pf-progress-step.js +1 -1
  67. package/pf-progress-stepper/pf-progress-stepper.js +1 -1
  68. package/pf-search-input/pf-search-input.js +1 -1
  69. package/pf-select/pf-option-group.js +1 -1
  70. package/pf-select/pf-option.js +1 -1
  71. package/pf-select/pf-select.js +1 -1
  72. package/pf-spinner/pf-spinner.js +1 -1
  73. package/pf-switch/pf-switch.js +1 -1
  74. package/pf-table/pf-caption.js +1 -1
  75. package/pf-table/pf-table.js +1 -1
  76. package/pf-table/pf-tbody.js +1 -1
  77. package/pf-table/pf-td.js +1 -1
  78. package/pf-table/pf-th.js +1 -1
  79. package/pf-table/pf-thead.js +1 -1
  80. package/pf-table/pf-tr.js +1 -1
  81. package/pf-tabs/pf-tab-panel.js +1 -1
  82. package/pf-tabs/pf-tab.js +1 -1
  83. package/pf-tabs/pf-tabs.js +1 -1
  84. package/pf-text-area/pf-text-area.js +1 -1
  85. package/pf-text-input/pf-text-input.js +1 -1
  86. package/pf-tile/pf-tile.js +1 -1
  87. package/pf-timestamp/pf-timestamp.js +1 -1
  88. package/pf-tooltip/pf-tooltip.js +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pf-modal.js","sourceRoot":"","sources":["pf-modal.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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L;AAoBM;IAAN,KAAK;qCAEL;AAQM;IAAN,KAAK;mCAEL;AAEM;IAAN,KAAK;wCAGL;AASM;IAAN,KAAK;oCAML;AA3QU,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO","sourcesContent":["import { LitElement, html, type TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { ComposedEvent } from '@patternfly/pfe-core';\nimport { bound, initializer, observes } from '@patternfly/pfe-core/decorators.js';\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\n\nimport { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';\n\nimport style from './pf-modal.css';\n\nexport class ModalCancelEvent extends ComposedEvent {\n constructor() {\n super('cancel');\n }\n}\n\nexport class ModalCloseEvent extends ComposedEvent {\n constructor() {\n super('close');\n }\n}\n\nexport class ModalOpenEvent extends ComposedEvent {\n constructor(\n /** The trigger element which triggered the modal to open */\n public trigger: HTMLElement | null\n ) {\n super('open');\n }\n}\n\n/**\n * A **modal** displays important information to a user without requiring them to navigate\n * to a new page.\n * @summary Displays information or helps a user focus on a task\n * @alias Modal\n * @fires {ModalOpenEvent} open - Fires when a user clicks on the trigger or manually opens a modal.\n * @fires {ModalCloseEvent} close - Fires when either a user clicks on either the close button or the overlay or manually closes a modal.\n */\n@customElement('pf-modal')\nexport class PfModal extends LitElement implements HTMLDialogElement {\n static override readonly shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n static readonly styles: CSSStyleSheet[] = [style];\n\n /** Should the dialog close when user clicks outside the dialog? */\n protected static closeOnOutsideClick = false;\n\n /**\n * The `variant` controls the width of the modal.\n * There are three options: `small`, `medium` and `large`. The default is `large`.\n */\n @property({ reflect: true }) variant?: 'small' | 'medium' | 'large';\n\n /**\n * `position=\"top\"` aligns the dialog with the top of the page\n */\n @property({ reflect: true }) position?: 'top';\n\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** Optional ID of the trigger element */\n @property() trigger?: string;\n\n /** @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue */\n public returnValue = '';\n\n @query('#overlay') private overlay?: HTMLElement | null;\n @query('#dialog') private dialog?: HTMLElement | null;\n @query('#close-button') private closeButton?: HTMLElement | null;\n\n #headerId = getRandomId();\n #triggerElement: HTMLElement | null = null;\n #header: HTMLElement | null = null;\n #body: Element[] = [];\n #headings: Element[] = [];\n #cancelling = false;\n\n #slots = new SlotController(this, null, 'header', 'description', 'footer');\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('keydown', this.onKeydown);\n this.addEventListener('click', this.onClick);\n }\n\n render(): TemplateResult<1> {\n const headerId = (this.#header || this.#headings.length) ? this.#headerId : undefined;\n const headerLabel = this.#triggerElement ? this.#triggerElement.innerText : undefined;\n const hasHeader = this.#slots.hasSlotted('header');\n const hasDescription = this.#slots.hasSlotted('description');\n const hasFooter = this.#slots.hasSlotted('footer');\n\n return html`\n <section ?hidden=${!this.open}>\n <!-- summary: The modal overlay which lies under the dialog and above the page body -->\n <div id=\"overlay\" part=\"overlay\" ?hidden=${!this.open}></div>\n <!-- summary: The dialog element -->\n <div id=\"dialog\"\n part=\"dialog\"\n tabindex=\"0\"\n role=\"dialog\"\n aria-labelledby=${ifDefined(headerId)}\n aria-label=${ifDefined(headerLabel)}\n ?hidden=\"${!this.open}\">\n <div id=\"container\">\n <!-- summary: The container for the dialog content -->\n <div id=\"content\" part=\"content\" class=${classMap({ hasHeader, hasDescription, hasFooter })}>\n <!-- summary: The container for the optional dialog header -->\n <header part=\"header\">\n <!-- summary: Heading tag\n description: |\n The header is an optional slot that appears at the top of the modal window.\n It should be a heading tag (h2-h6). -->\n <slot name=\"header\"></slot>\n <!-- summary: The container for the optional dialog description in the header -->\n <div part=\"description\" ?hidden=${!hasDescription}>\n <slot name=\"description\"></slot>\n </div>\n </header>\n <!--\n summary: Modal dialog content\n description: |\n The default slot can contain any type of content. When the header is not present,\n this unnamed slot appear at the top of the modal window (to the left of the close\n button). Otherwise it will appear beneath the header. -->\n <slot></slot>\n <!-- summary: Actions footer container -->\n <footer ?hidden=${!hasFooter} part=\"footer\">\n <!-- summary: Optional footer content. Good place to put action buttons. -->\n <slot name=\"footer\"></slot>\n </footer>\n </div>\n <!-- summary: The modal's close button -->\n <button id=\"close-button\"\n part=\"close-button\"\n aria-label=\"Close dialog\"\n @keydown=${this.onKeydown}\n @click=${this.close}>\n <svg fill=\"currentColor\" viewBox=\"0 0 352 512\">\n <path d=\"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z\"></path>\n </svg>\n </button>\n </div>\n </div>\n </section>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this.removeEventListener('keydown', this.onKeydown);\n\n this.#triggerElement?.removeEventListener('click', this.onTriggerClick);\n }\n\n @initializer()\n protected async _init(): Promise<void> {\n await this.updateComplete;\n this.#header = this.querySelector(`[slot$=\"header\"]`);\n this.#body = [...this.querySelectorAll(`*:not([slot])`)];\n this.#headings = this.#body.filter(el => el.tagName.slice(0, 1) === 'H');\n\n if (this.#triggerElement) {\n this.#triggerElement.addEventListener('click', this.onTriggerClick);\n this.removeAttribute('hidden');\n }\n\n if (this.#header) {\n this.#header.id = this.#headerId;\n } else if (this.#headings.length > 0) {\n // Get the first heading in the modal if it exists\n this.#headings[0].id = this.#headerId;\n }\n }\n\n @observes('open')\n protected async openChanged(oldValue?: boolean, newValue?: boolean): Promise<void> {\n // loosening types to prevent running these effects in unexpected circumstances\n // eslint-disable-next-line eqeqeq\n if (oldValue == null || newValue == null || oldValue == newValue) {\n return;\n } else if (this.open) {\n // This prevents background scroll\n document.body.style.overflow = 'hidden';\n await this.updateComplete;\n // Set the focus to the container\n this.dialog?.focus();\n this.dispatchEvent(new ModalOpenEvent(this.#triggerElement));\n } else {\n // Return scrollability\n document.body.style.overflow = 'auto';\n\n await this.updateComplete;\n\n if (this.#triggerElement) {\n this.#triggerElement.focus();\n }\n\n this.dispatchEvent(this.#cancelling ? new ModalCancelEvent() : new ModalCloseEvent());\n }\n }\n\n @observes('trigger')\n protected triggerChanged(): void {\n if (this.trigger) {\n this.#triggerElement = (this.getRootNode() as Document | ShadowRoot)\n .getElementById(this.trigger);\n this.#triggerElement?.addEventListener('click', this.onTriggerClick);\n }\n }\n\n @bound private onTriggerClick(event: MouseEvent) {\n event.preventDefault();\n // TODO: in non-modal case, toggle the dialog\n this.showModal();\n }\n\n @bound private onClick(event: MouseEvent) {\n const { open, overlay, dialog } = this;\n if (open) {\n const path = event.composedPath();\n const { closeOnOutsideClick } = this.constructor as typeof PfModal;\n\n if (closeOnOutsideClick && path.includes(overlay!) && !path.includes(dialog!)) {\n event.preventDefault();\n this.cancel();\n }\n }\n }\n\n @bound private onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'Tab':\n if (event.target === this.closeButton) {\n event.preventDefault();\n this.dialog?.focus();\n }\n return;\n case 'Escape':\n case 'Esc':\n event.preventDefault();\n this.cancel();\n return;\n case 'Enter':\n if (event.target === this.#triggerElement) {\n event.preventDefault();\n this.showModal();\n }\n return;\n }\n }\n\n private async cancel() {\n this.#cancelling = true;\n this.open = false;\n await this.updateComplete;\n this.#cancelling = false;\n }\n\n setTrigger(element: HTMLElement): void {\n this.#triggerElement = element;\n this.#triggerElement.addEventListener('click', this.onTriggerClick);\n }\n\n /**\n * Manually toggles the modal.\n * ```js\n * modal.toggle();\n * ```\n */\n @bound toggle(): void {\n this.open = !this.open;\n }\n\n /**\n * Manually opens the modal.\n * ```js\n * modal.open();\n * ```\n */\n @bound show(): void {\n this.open = true;\n }\n\n @bound showModal(): void {\n // TODO: non-modal mode\n this.show();\n }\n\n /**\n * Manually closes the modal.\n * ```js\n * modal.close();\n * ```\n * @param returnValue dialog return value\n */\n @bound close(returnValue?: string): void {\n if (typeof returnValue === 'string') {\n this.returnValue = returnValue;\n }\n\n this.open = false;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-modal': PfModal;\n }\n}\n"]}
1
+ {"version":3,"file":"pf-modal.js","sourceRoot":"","sources":["pf-modal.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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sourcesContent":["import { LitElement, html, type TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { query } from 'lit/decorators/query.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport { ComposedEvent } from '@patternfly/pfe-core';\nimport { bound, initializer, observes } from '@patternfly/pfe-core/decorators.js';\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\n\nimport { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';\n\nimport style from './pf-modal.css';\n\nexport class ModalCancelEvent extends ComposedEvent {\n constructor() {\n super('cancel');\n }\n}\n\nexport class ModalCloseEvent extends ComposedEvent {\n constructor() {\n super('close');\n }\n}\n\nexport class ModalOpenEvent extends ComposedEvent {\n constructor(\n /** The trigger element which triggered the modal to open */\n public trigger: HTMLElement | null\n ) {\n super('open');\n }\n}\n\n/**\n * A **modal** displays important information to a user without requiring them to navigate\n * to a new page.\n * @summary Displays information or helps a user focus on a task\n * @alias Modal\n * @fires {ModalOpenEvent} open - Fires when a user clicks on the trigger or manually opens a modal.\n * @fires {ModalCloseEvent} close - Fires when either a user clicks on either the close button or the overlay or manually closes a modal.\n */\n@customElement('pf-modal')\nexport class PfModal extends LitElement {\n static override readonly shadowRootOptions: ShadowRootInit = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n static readonly styles: CSSStyleSheet[] = [style];\n\n /** Should the dialog close when user clicks outside the dialog? */\n protected static closeOnOutsideClick = false;\n\n /**\n * The `variant` controls the width of the modal.\n * There are three options: `small`, `medium` and `large`. The default is `large`.\n */\n @property({ reflect: true }) variant?: 'small' | 'medium' | 'large';\n\n /**\n * `position=\"top\"` aligns the dialog with the top of the page\n */\n @property({ reflect: true }) position?: 'top';\n\n @property({ type: Boolean, reflect: true }) open = false;\n\n /** Optional ID of the trigger element */\n @property() trigger?: string;\n\n /** @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/returnValue */\n public returnValue = '';\n\n @query('#overlay') private overlay?: HTMLElement | null;\n @query('#dialog') private dialog?: HTMLElement | null;\n @query('#close-button') private closeButton?: HTMLElement | null;\n\n #headerId = getRandomId();\n #triggerElement: HTMLElement | null = null;\n #header: HTMLElement | null = null;\n #body: Element[] = [];\n #headings: Element[] = [];\n #cancelling = false;\n\n #slots = new SlotController(this, null, 'header', 'description', 'footer');\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('keydown', this.onKeydown);\n this.addEventListener('click', this.onClick);\n }\n\n render(): TemplateResult<1> {\n const headerId = (this.#header || this.#headings.length) ? this.#headerId : undefined;\n const headerLabel = this.#triggerElement ? this.#triggerElement.innerText : undefined;\n const hasHeader = this.#slots.hasSlotted('header');\n const hasDescription = this.#slots.hasSlotted('description');\n const hasFooter = this.#slots.hasSlotted('footer');\n\n return html`\n <section ?hidden=${!this.open}>\n <!-- summary: The modal overlay which lies under the dialog and above the page body -->\n <div id=\"overlay\" part=\"overlay\" ?hidden=${!this.open}></div>\n <!-- summary: The dialog element -->\n <div id=\"dialog\"\n part=\"dialog\"\n tabindex=\"0\"\n role=\"dialog\"\n aria-labelledby=${ifDefined(headerId)}\n aria-label=${ifDefined(headerLabel)}\n ?hidden=\"${!this.open}\">\n <div id=\"container\">\n <!-- summary: The container for the dialog content -->\n <div id=\"content\" part=\"content\" class=${classMap({ hasHeader, hasDescription, hasFooter })}>\n <!-- summary: The container for the optional dialog header -->\n <header part=\"header\">\n <!-- summary: Heading tag\n description: |\n The header is an optional slot that appears at the top of the modal window.\n It should be a heading tag (h2-h6). -->\n <slot name=\"header\"></slot>\n <!-- summary: The container for the optional dialog description in the header -->\n <div part=\"description\" ?hidden=${!hasDescription}>\n <slot name=\"description\"></slot>\n </div>\n </header>\n <!--\n summary: Modal dialog content\n description: |\n The default slot can contain any type of content. When the header is not present,\n this unnamed slot appear at the top of the modal window (to the left of the close\n button). Otherwise it will appear beneath the header. -->\n <slot></slot>\n <!-- summary: Actions footer container -->\n <footer ?hidden=${!hasFooter} part=\"footer\">\n <!-- summary: Optional footer content. Good place to put action buttons. -->\n <slot name=\"footer\"></slot>\n </footer>\n </div>\n <!-- summary: The modal's close button -->\n <button id=\"close-button\"\n part=\"close-button\"\n aria-label=\"Close dialog\"\n @keydown=${this.onKeydown}\n @click=${this.close}>\n <svg fill=\"currentColor\" viewBox=\"0 0 352 512\">\n <path d=\"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z\"></path>\n </svg>\n </button>\n </div>\n </div>\n </section>\n `;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this.removeEventListener('keydown', this.onKeydown);\n\n this.#triggerElement?.removeEventListener('click', this.onTriggerClick);\n }\n\n @initializer()\n protected async _init(): Promise<void> {\n await this.updateComplete;\n this.#header = this.querySelector(`[slot$=\"header\"]`);\n this.#body = [...this.querySelectorAll(`*:not([slot])`)];\n this.#headings = this.#body.filter(el => el.tagName.slice(0, 1) === 'H');\n\n if (this.#triggerElement) {\n this.#triggerElement.addEventListener('click', this.onTriggerClick);\n this.removeAttribute('hidden');\n }\n\n if (this.#header) {\n this.#header.id = this.#headerId;\n } else if (this.#headings.length > 0) {\n // Get the first heading in the modal if it exists\n this.#headings[0].id = this.#headerId;\n }\n }\n\n @observes('open')\n protected async openChanged(oldValue?: boolean, newValue?: boolean): Promise<void> {\n // loosening types to prevent running these effects in unexpected circumstances\n // eslint-disable-next-line eqeqeq\n if (oldValue == null || newValue == null || oldValue == newValue) {\n return;\n } else if (this.open) {\n // This prevents background scroll\n document.body.style.overflow = 'hidden';\n await this.updateComplete;\n // Set the focus to the container\n this.dialog?.focus();\n this.dispatchEvent(new ModalOpenEvent(this.#triggerElement));\n } else {\n // Return scrollability\n document.body.style.overflow = 'auto';\n\n await this.updateComplete;\n\n if (this.#triggerElement) {\n this.#triggerElement.focus();\n }\n\n this.dispatchEvent(this.#cancelling ? new ModalCancelEvent() : new ModalCloseEvent());\n }\n }\n\n @observes('trigger')\n protected triggerChanged(): void {\n if (this.trigger) {\n this.#triggerElement = (this.getRootNode() as Document | ShadowRoot)\n .getElementById(this.trigger);\n this.#triggerElement?.addEventListener('click', this.onTriggerClick);\n }\n }\n\n @bound private onTriggerClick(event: MouseEvent) {\n event.preventDefault();\n // TODO: in non-modal case, toggle the dialog\n this.showModal();\n }\n\n @bound private onClick(event: MouseEvent) {\n const { open, overlay, dialog } = this;\n if (open) {\n const path = event.composedPath();\n const { closeOnOutsideClick } = this.constructor as typeof PfModal;\n\n if (closeOnOutsideClick && path.includes(overlay!) && !path.includes(dialog!)) {\n event.preventDefault();\n this.cancel();\n }\n }\n }\n\n @bound private onKeydown(event: KeyboardEvent) {\n switch (event.key) {\n case 'Tab':\n if (event.target === this.closeButton) {\n event.preventDefault();\n this.dialog?.focus();\n }\n return;\n case 'Escape':\n case 'Esc':\n event.preventDefault();\n this.cancel();\n return;\n case 'Enter':\n if (event.target === this.#triggerElement) {\n event.preventDefault();\n this.showModal();\n }\n return;\n }\n }\n\n private async cancel() {\n this.#cancelling = true;\n this.open = false;\n await this.updateComplete;\n this.#cancelling = false;\n }\n\n setTrigger(element: HTMLElement): void {\n this.#triggerElement = element;\n this.#triggerElement.addEventListener('click', this.onTriggerClick);\n }\n\n /**\n * Manually toggles the modal.\n * ```js\n * modal.toggle();\n * ```\n */\n @bound toggle(): void {\n this.open = !this.open;\n }\n\n /**\n * Manually opens the modal.\n * ```js\n * modal.open();\n * ```\n */\n @bound show(): void {\n this.open = true;\n }\n\n @bound showModal(): void {\n // TODO: non-modal mode\n this.show();\n }\n\n /**\n * Manually closes the modal.\n * ```js\n * modal.close();\n * ```\n * @param returnValue dialog return value\n */\n @bound close(returnValue?: string): void {\n if (typeof returnValue === 'string') {\n this.returnValue = returnValue;\n }\n\n this.open = false;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-modal': PfModal;\n }\n}\n"]}
@@ -231,7 +231,7 @@ let PfPanel = class PfPanel extends LitElement {
231
231
  };
232
232
  _PfPanel_slots = new WeakMap();
233
233
  PfPanel.styles = [styles];
234
- PfPanel.version = "4.2.0";
234
+ PfPanel.version = "4.3.0";
235
235
  __decorate([
236
236
  property({ type: Boolean, reflect: true })
237
237
  ], PfPanel.prototype, "scrollable", void 0);
@@ -508,7 +508,7 @@ PfPopover.alertIcons = new Map(Object.entries({
508
508
  });
509
509
  }
510
510
  })();
511
- PfPopover.version = "4.2.0";
511
+ PfPopover.version = "4.3.0";
512
512
  __decorate([
513
513
  property({ reflect: true })
514
514
  ], PfPopover.prototype, "position", void 0);
@@ -330,7 +330,7 @@ _PfProgress_icon_get = function _PfProgress_icon_get() {
330
330
  return ICONS.get(this.variant ?? '')?.icon;
331
331
  };
332
332
  PfProgress.styles = [styles];
333
- PfProgress.version = "4.2.0";
333
+ PfProgress.version = "4.3.0";
334
334
  __decorate([
335
335
  property({ reflect: true, type: Number })
336
336
  ], PfProgress.prototype, "value", void 0);
@@ -177,7 +177,7 @@ _PfProgressStep_slots = new WeakMap();
177
177
  _PfProgressStep_internals = new WeakMap();
178
178
  PfProgressStep.parentTagName = 'pf-progress-stepper';
179
179
  PfProgressStep.styles = [style];
180
- PfProgressStep.version = "4.2.0";
180
+ PfProgressStep.version = "4.3.0";
181
181
  __decorate([
182
182
  property()
183
183
  ], PfProgressStep.prototype, "description", void 0);
@@ -376,7 +376,7 @@ _PfProgressStepper_onMutation = function _PfProgressStepper_onMutation() {
376
376
  PfProgressStepper.childTagName = 'pf-progress-step';
377
377
  PfProgressStepper.styles = [style];
378
378
  PfProgressStepper.formAssociated = true;
379
- PfProgressStepper.version = "4.2.0";
379
+ PfProgressStepper.version = "4.3.0";
380
380
  __decorate([
381
381
  property({ type: Boolean, reflect: true })
382
382
  ], PfProgressStepper.prototype, "vertical", void 0);
@@ -580,7 +580,7 @@ PfSearchInput.shadowRootOptions = {
580
580
  ...LitElement.shadowRootOptions,
581
581
  delegatesFocus: true,
582
582
  };
583
- PfSearchInput.version = "4.2.0";
583
+ PfSearchInput.version = "4.3.0";
584
584
  __decorate([
585
585
  property({ attribute: 'accessible-label' })
586
586
  ], PfSearchInput.prototype, "accessibleLabel", void 0);
@@ -55,7 +55,7 @@ let PfOptionGroup = class PfOptionGroup extends LitElement {
55
55
  };
56
56
  _PfOptionGroup_internals = new WeakMap();
57
57
  PfOptionGroup.styles = [styles];
58
- PfOptionGroup.version = "4.2.0";
58
+ PfOptionGroup.version = "4.3.0";
59
59
  __decorate([
60
60
  property()
61
61
  ], PfOptionGroup.prototype, "label", void 0);
@@ -182,7 +182,7 @@ let PfOption = class PfOption extends LitElement {
182
182
  _PfOption_value = new WeakMap();
183
183
  _PfOption_internals = new WeakMap();
184
184
  PfOption.styles = [styles];
185
- PfOption.version = "4.2.0";
185
+ PfOption.version = "4.3.0";
186
186
  __decorate([
187
187
  property({ type: Boolean, reflect: true })
188
188
  ], PfOption.prototype, "disabled", void 0);
@@ -838,7 +838,7 @@ PfSelect.shadowRootOptions = {
838
838
  ...LitElement.shadowRootOptions,
839
839
  delegatesFocus: true,
840
840
  };
841
- PfSelect.version = "4.2.0";
841
+ PfSelect.version = "4.3.0";
842
842
  __decorate([
843
843
  property()
844
844
  ], PfSelect.prototype, "variant", void 0);
@@ -125,7 +125,7 @@ let PfSpinner = class PfSpinner extends LitElement {
125
125
  };
126
126
  _PfSpinner_internals = new WeakMap();
127
127
  PfSpinner.styles = [styles];
128
- PfSpinner.version = "4.2.0";
128
+ PfSpinner.version = "4.3.0";
129
129
  __decorate([
130
130
  property({ reflect: true })
131
131
  ], PfSpinner.prototype, "size", void 0);
@@ -256,7 +256,7 @@ _PfSwitch_updateLabels = function _PfSwitch_updateLabels() {
256
256
  };
257
257
  PfSwitch.styles = [styles];
258
258
  PfSwitch.formAssociated = true;
259
- PfSwitch.version = "4.2.0";
259
+ PfSwitch.version = "4.3.0";
260
260
  __decorate([
261
261
  property({ reflect: true })
262
262
  ], PfSwitch.prototype, "label", void 0);
@@ -19,7 +19,7 @@ let PfCaption = class PfCaption extends LitElement {
19
19
  }
20
20
  };
21
21
  PfCaption.styles = [styles];
22
- PfCaption.version = "4.2.0";
22
+ PfCaption.version = "4.3.0";
23
23
  PfCaption = __decorate([
24
24
  customElement('pf-caption')
25
25
  ], PfCaption);
@@ -554,7 +554,7 @@ _PfTable_performSort = function _PfTable_performSort(header, direction) {
554
554
  }
555
555
  };
556
556
  PfTable.styles = [styles];
557
- PfTable.version = "4.2.0";
557
+ PfTable.version = "4.3.0";
558
558
  __decorate([
559
559
  state()
560
560
  ], PfTable.prototype, "columns", void 0);
@@ -31,7 +31,7 @@ let PfTbody = class PfTbody extends LitElement {
31
31
  }
32
32
  };
33
33
  PfTbody.styles = [styles];
34
- PfTbody.version = "4.2.0";
34
+ PfTbody.version = "4.3.0";
35
35
  PfTbody = __decorate([
36
36
  customElement('pf-tbody')
37
37
  ], PfTbody);
package/pf-table/pf-td.js CHANGED
@@ -140,7 +140,7 @@ _PfTd_onClick = function _PfTd_onClick() {
140
140
  this.dispatchEvent(event);
141
141
  };
142
142
  PfTd.styles = [styles];
143
- PfTd.version = "4.2.0";
143
+ PfTd.version = "4.3.0";
144
144
  __decorate([
145
145
  property({ attribute: 'compound-expand' })
146
146
  ], PfTd.prototype, "compoundExpand", void 0);
package/pf-table/pf-th.js CHANGED
@@ -162,7 +162,7 @@ _PfTh_onClick = function _PfTh_onClick() {
162
162
  }
163
163
  };
164
164
  PfTh.styles = [styles];
165
- PfTh.version = "4.2.0";
165
+ PfTh.version = "4.3.0";
166
166
  __decorate([
167
167
  property({ type: Boolean, reflect: true })
168
168
  ], PfTh.prototype, "sortable", void 0);
@@ -47,7 +47,7 @@ _PfThead_onSlotchange = function _PfThead_onSlotchange() {
47
47
  }
48
48
  };
49
49
  PfThead.styles = [styles];
50
- PfThead.version = "4.2.0";
50
+ PfThead.version = "4.3.0";
51
51
  __decorate([
52
52
  provide({ context: thRoleContext })
53
53
  ], PfThead.prototype, "thRowContext", void 0);
package/pf-table/pf-tr.js CHANGED
@@ -225,7 +225,7 @@ _PfTr_onClick = function _PfTr_onClick() {
225
225
  this.dispatchEvent(new RequestExpandEvent());
226
226
  };
227
227
  PfTr.styles = [styles];
228
- PfTr.version = "4.2.0";
228
+ PfTr.version = "4.3.0";
229
229
  __decorate([
230
230
  property({
231
231
  reflect: true,
@@ -56,7 +56,7 @@ let PfTabPanel = class PfTabPanel extends LitElement {
56
56
  }
57
57
  };
58
58
  PfTabPanel.styles = [styles];
59
- PfTabPanel.version = "4.2.0";
59
+ PfTabPanel.version = "4.3.0";
60
60
  __decorate([
61
61
  consume({ context, subscribe: true }),
62
62
  state()
package/pf-tabs/pf-tab.js CHANGED
@@ -326,7 +326,7 @@ _PfTab_activate = async function _PfTab_activate() {
326
326
  this.dispatchEvent(new TabExpandEvent(this));
327
327
  };
328
328
  PfTab.styles = [styles];
329
- PfTab.version = "4.2.0";
329
+ PfTab.version = "4.3.0";
330
330
  __decorate([
331
331
  queryAssignedElements({ slot: 'icon', flatten: true })
332
332
  ], PfTab.prototype, "icons", void 0);
@@ -488,7 +488,7 @@ _PfTabs_onExpand = function _PfTabs_onExpand(event) {
488
488
  };
489
489
  PfTabs.styles = [styles];
490
490
  PfTabs.scrollTimeoutDelay = 150;
491
- PfTabs.version = "4.2.0";
491
+ PfTabs.version = "4.3.0";
492
492
  __decorate([
493
493
  property({ reflect: false, attribute: 'label-scroll-left' })
494
494
  ], PfTabs.prototype, "labelScrollLeft", void 0);
@@ -422,7 +422,7 @@ PfTextArea.shadowRootOptions = {
422
422
  ...LitElement.shadowRootOptions,
423
423
  delegatesFocus: true,
424
424
  };
425
- PfTextArea.version = "4.2.0";
425
+ PfTextArea.version = "4.3.0";
426
426
  __decorate([
427
427
  property({ reflect: true, attribute: 'accessible-label' })
428
428
  ], PfTextArea.prototype, "accessibleLabel", void 0);
@@ -516,7 +516,7 @@ PfTextInput.shadowRootOptions = {
516
516
  ...LitElement.shadowRootOptions,
517
517
  delegatesFocus: true,
518
518
  };
519
- PfTextInput.version = "4.2.0";
519
+ PfTextInput.version = "4.3.0";
520
520
  __decorate([
521
521
  property({ type: Boolean, reflect: true, attribute: 'left-truncated' })
522
522
  ], PfTextInput.prototype, "leftTruncated", void 0);
@@ -180,7 +180,7 @@ let PfTile = class PfTile extends LitElement {
180
180
  }
181
181
  };
182
182
  PfTile.styles = [styles];
183
- PfTile.version = "4.2.0";
183
+ PfTile.version = "4.3.0";
184
184
  __decorate([
185
185
  property({ reflect: true, type: Boolean })
186
186
  ], PfTile.prototype, "selected", void 0);
@@ -55,7 +55,7 @@ let PfTimestamp = class PfTimestamp extends LitElement {
55
55
  };
56
56
  _PfTimestamp_timestamp = new WeakMap();
57
57
  PfTimestamp.styles = [style];
58
- PfTimestamp.version = "4.2.0";
58
+ PfTimestamp.version = "4.3.0";
59
59
  __decorate([
60
60
  property({ reflect: true, attribute: 'date-format' })
61
61
  ], PfTimestamp.prototype, "dateFormat", void 0);
@@ -245,7 +245,7 @@ _PfTooltip_updateTrigger = function _PfTooltip_updateTrigger() {
245
245
  }
246
246
  };
247
247
  PfTooltip.styles = [styles];
248
- PfTooltip.version = "4.2.0";
248
+ PfTooltip.version = "4.3.0";
249
249
  __decorate([
250
250
  property()
251
251
  ], PfTooltip.prototype, "position", void 0);