@patternfly/elements 2.3.1 → 2.4.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 (195) hide show
  1. package/custom-elements.json +4399 -699
  2. package/package.json +11 -1
  3. package/pf-accordion/BaseAccordion.js +155 -220
  4. package/pf-accordion/BaseAccordion.js.map +1 -1
  5. package/pf-accordion/BaseAccordionHeader.d.ts +1 -0
  6. package/pf-accordion/BaseAccordionHeader.js +69 -71
  7. package/pf-accordion/BaseAccordionHeader.js.map +1 -1
  8. package/pf-accordion/BaseAccordionPanel.js +2 -2
  9. package/pf-accordion/BaseAccordionPanel.js.map +1 -1
  10. package/pf-accordion/pf-accordion-header.js +9 -4
  11. package/pf-accordion/pf-accordion-header.js.map +1 -1
  12. package/pf-accordion/pf-accordion-panel.js +1 -1
  13. package/pf-accordion/pf-accordion-panel.js.map +1 -1
  14. package/pf-accordion/pf-accordion.js +1 -1
  15. package/pf-accordion/pf-accordion.js.map +1 -1
  16. package/pf-avatar/BaseAvatar.js +1 -1
  17. package/pf-avatar/BaseAvatar.js.map +1 -1
  18. package/pf-avatar/pf-avatar.js +1 -1
  19. package/pf-avatar/pf-avatar.js.map +1 -1
  20. package/pf-badge/BaseBadge.js +1 -1
  21. package/pf-badge/BaseBadge.js.map +1 -1
  22. package/pf-badge/pf-badge.js +1 -1
  23. package/pf-badge/pf-badge.js.map +1 -1
  24. package/pf-banner/README.md +60 -0
  25. package/pf-banner/pf-banner.css +96 -0
  26. package/pf-banner/pf-banner.d.ts +52 -0
  27. package/pf-banner/pf-banner.js +85 -0
  28. package/pf-banner/pf-banner.js.map +1 -0
  29. package/pf-button/BaseButton.js +17 -16
  30. package/pf-button/BaseButton.js.map +1 -1
  31. package/pf-button/pf-button.js +1 -1
  32. package/pf-button/pf-button.js.map +1 -1
  33. package/pf-card/BaseCard.css +2 -2
  34. package/pf-card/BaseCard.js +2 -2
  35. package/pf-card/BaseCard.js.map +1 -1
  36. package/pf-card/pf-card.css +4 -4
  37. package/pf-card/pf-card.js +2 -2
  38. package/pf-card/pf-card.js.map +1 -1
  39. package/pf-clipboard-copy/BaseClipboardCopy.js +1 -1
  40. package/pf-clipboard-copy/BaseClipboardCopy.js.map +1 -1
  41. package/pf-clipboard-copy/pf-clipboard-copy.js +36 -33
  42. package/pf-clipboard-copy/pf-clipboard-copy.js.map +1 -1
  43. package/pf-code-block/BaseCodeBlock.js +1 -1
  44. package/pf-code-block/BaseCodeBlock.js.map +1 -1
  45. package/pf-code-block/pf-code-block.js +14 -11
  46. package/pf-code-block/pf-code-block.js.map +1 -1
  47. package/pf-icon/BaseIcon.js +39 -41
  48. package/pf-icon/BaseIcon.js.map +1 -1
  49. package/pf-icon/pf-icon.js +2 -2
  50. package/pf-icon/pf-icon.js.map +1 -1
  51. package/pf-jump-links/pf-jump-links-item.js +17 -14
  52. package/pf-jump-links/pf-jump-links-item.js.map +1 -1
  53. package/pf-jump-links/pf-jump-links-list.js +1 -1
  54. package/pf-jump-links/pf-jump-links-list.js.map +1 -1
  55. package/pf-jump-links/pf-jump-links.js +37 -34
  56. package/pf-jump-links/pf-jump-links.js.map +1 -1
  57. package/pf-label/BaseLabel.js +1 -1
  58. package/pf-label/BaseLabel.js.map +1 -1
  59. package/pf-label/pf-label.js +2 -2
  60. package/pf-label/pf-label.js.map +1 -1
  61. package/pf-modal/pf-modal.js +46 -45
  62. package/pf-modal/pf-modal.js.map +1 -1
  63. package/pf-panel/pf-panel.js +7 -6
  64. package/pf-panel/pf-panel.js.map +1 -1
  65. package/pf-popover/pf-popover.d.ts +2 -2
  66. package/pf-popover/pf-popover.js +67 -55
  67. package/pf-popover/pf-popover.js.map +1 -1
  68. package/pf-progress/README.md +33 -0
  69. package/pf-progress/pf-progress.css +210 -0
  70. package/pf-progress/pf-progress.d.ts +111 -0
  71. package/pf-progress/pf-progress.js +218 -0
  72. package/pf-progress/pf-progress.js.map +1 -0
  73. package/pf-progress-stepper/pf-progress-step.js +11 -10
  74. package/pf-progress-stepper/pf-progress-step.js.map +1 -1
  75. package/pf-progress-stepper/pf-progress-stepper.js +16 -13
  76. package/pf-progress-stepper/pf-progress-stepper.js.map +1 -1
  77. package/pf-spinner/BaseSpinner.js +1 -1
  78. package/pf-spinner/BaseSpinner.js.map +1 -1
  79. package/pf-spinner/pf-spinner.js +1 -1
  80. package/pf-spinner/pf-spinner.js.map +1 -1
  81. package/pf-switch/BaseSwitch.js +44 -47
  82. package/pf-switch/BaseSwitch.js.map +1 -1
  83. package/pf-switch/pf-switch.js +1 -1
  84. package/pf-switch/pf-switch.js.map +1 -1
  85. package/pf-table/README.md +43 -0
  86. package/pf-table/pf-caption.css +9 -0
  87. package/pf-table/pf-caption.d.ts +14 -0
  88. package/pf-table/pf-caption.js +22 -0
  89. package/pf-table/pf-caption.js.map +1 -0
  90. package/pf-table/pf-table.css +223 -0
  91. package/pf-table/pf-table.d.ts +663 -0
  92. package/pf-table/pf-table.js +767 -0
  93. package/pf-table/pf-table.js.map +1 -0
  94. package/pf-table/pf-tbody.css +16 -0
  95. package/pf-table/pf-tbody.d.ts +15 -0
  96. package/pf-table/pf-tbody.js +26 -0
  97. package/pf-table/pf-tbody.js.map +1 -0
  98. package/pf-table/pf-td.css +105 -0
  99. package/pf-table/pf-td.d.ts +18 -0
  100. package/pf-table/pf-td.js +52 -0
  101. package/pf-table/pf-td.js.map +1 -0
  102. package/pf-table/pf-th.css +93 -0
  103. package/pf-table/pf-th.d.ts +27 -0
  104. package/pf-table/pf-th.js +96 -0
  105. package/pf-table/pf-th.js.map +1 -0
  106. package/pf-table/pf-thead.css +19 -0
  107. package/pf-table/pf-thead.d.ts +16 -0
  108. package/pf-table/pf-thead.js +37 -0
  109. package/pf-table/pf-thead.js.map +1 -0
  110. package/pf-table/pf-tr.css +87 -0
  111. package/pf-table/pf-tr.d.ts +34 -0
  112. package/pf-table/pf-tr.js +164 -0
  113. package/pf-table/pf-tr.js.map +1 -0
  114. package/pf-tabs/BaseTab.d.ts +3 -0
  115. package/pf-tabs/BaseTab.js +32 -31
  116. package/pf-tabs/BaseTab.js.map +1 -1
  117. package/pf-tabs/BaseTabPanel.js +11 -5
  118. package/pf-tabs/BaseTabPanel.js.map +1 -1
  119. package/pf-tabs/BaseTabs.js +116 -135
  120. package/pf-tabs/BaseTabs.js.map +1 -1
  121. package/pf-tabs/pf-tab-panel.js +1 -1
  122. package/pf-tabs/pf-tab-panel.js.map +1 -1
  123. package/pf-tabs/pf-tab.d.ts +1 -1
  124. package/pf-tabs/pf-tab.js +2 -2
  125. package/pf-tabs/pf-tab.js.map +1 -1
  126. package/pf-tabs/pf-tabs.d.ts +2 -0
  127. package/pf-tabs/pf-tabs.js +6 -2
  128. package/pf-tabs/pf-tabs.js.map +1 -1
  129. package/pf-text-input/README.md +9 -0
  130. package/pf-text-input/pf-text-input.css +261 -0
  131. package/pf-text-input/pf-text-input.d.ts +174 -0
  132. package/pf-text-input/pf-text-input.js +262 -0
  133. package/pf-text-input/pf-text-input.js.map +1 -0
  134. package/pf-tile/pf-tile.js +1 -1
  135. package/pf-tile/pf-tile.js.map +1 -1
  136. package/pf-timestamp/pf-timestamp.js +15 -10
  137. package/pf-timestamp/pf-timestamp.js.map +1 -1
  138. package/pf-tooltip/BaseTooltip.css +1 -5
  139. package/pf-tooltip/BaseTooltip.d.ts +3 -0
  140. package/pf-tooltip/BaseTooltip.js +18 -9
  141. package/pf-tooltip/BaseTooltip.js.map +1 -1
  142. package/pf-tooltip/pf-tooltip.css +66 -4
  143. package/pf-tooltip/pf-tooltip.d.ts +25 -3
  144. package/pf-tooltip/pf-tooltip.js +144 -5
  145. package/pf-tooltip/pf-tooltip.js.map +1 -1
  146. package/pfe.min.js +257 -137
  147. package/pfe.min.js.map +4 -4
  148. package/react/pf-accordion/pf-accordion-header.d.ts +3 -5
  149. package/react/pf-accordion/pf-accordion-panel.d.ts +3 -5
  150. package/react/pf-accordion/pf-accordion.d.ts +3 -5
  151. package/react/pf-avatar/pf-avatar.d.ts +3 -5
  152. package/react/pf-badge/pf-badge.d.ts +3 -5
  153. package/react/pf-banner/pf-banner.d.ts +4 -0
  154. package/react/pf-banner/pf-banner.js +10 -0
  155. package/react/pf-button/pf-button.d.ts +3 -5
  156. package/react/pf-card/pf-card.d.ts +3 -5
  157. package/react/pf-clipboard-copy/pf-clipboard-copy.d.ts +3 -5
  158. package/react/pf-code-block/pf-code-block.d.ts +3 -5
  159. package/react/pf-icon/pf-icon.d.ts +3 -5
  160. package/react/pf-jump-links/pf-jump-links-item.d.ts +3 -5
  161. package/react/pf-jump-links/pf-jump-links-list.d.ts +3 -5
  162. package/react/pf-jump-links/pf-jump-links.d.ts +3 -5
  163. package/react/pf-label/pf-label.d.ts +3 -5
  164. package/react/pf-modal/pf-modal.d.ts +3 -5
  165. package/react/pf-panel/pf-panel.d.ts +3 -5
  166. package/react/pf-popover/pf-popover.d.ts +3 -5
  167. package/react/pf-progress/pf-progress.d.ts +4 -0
  168. package/react/pf-progress/pf-progress.js +10 -0
  169. package/react/pf-progress-stepper/pf-progress-step.d.ts +3 -5
  170. package/react/pf-progress-stepper/pf-progress-stepper.d.ts +3 -5
  171. package/react/pf-spinner/pf-spinner.d.ts +3 -5
  172. package/react/pf-switch/pf-switch.d.ts +3 -5
  173. package/react/pf-table/pf-caption.d.ts +4 -0
  174. package/react/pf-table/pf-caption.js +10 -0
  175. package/react/pf-table/pf-table.d.ts +4 -0
  176. package/react/pf-table/pf-table.js +10 -0
  177. package/react/pf-table/pf-tbody.d.ts +4 -0
  178. package/react/pf-table/pf-tbody.js +10 -0
  179. package/react/pf-table/pf-td.d.ts +4 -0
  180. package/react/pf-table/pf-td.js +10 -0
  181. package/react/pf-table/pf-th.d.ts +4 -0
  182. package/react/pf-table/pf-th.js +10 -0
  183. package/react/pf-table/pf-thead.d.ts +4 -0
  184. package/react/pf-table/pf-thead.js +10 -0
  185. package/react/pf-table/pf-tr.d.ts +4 -0
  186. package/react/pf-table/pf-tr.js +10 -0
  187. package/react/pf-tabs/pf-tab-panel.d.ts +3 -5
  188. package/react/pf-tabs/pf-tab.d.ts +3 -5
  189. package/react/pf-tabs/pf-tab.js +1 -1
  190. package/react/pf-tabs/pf-tabs.d.ts +3 -5
  191. package/react/pf-text-input/pf-text-input.d.ts +4 -0
  192. package/react/pf-text-input/pf-text-input.js +10 -0
  193. package/react/pf-tile/pf-tile.d.ts +3 -5
  194. package/react/pf-timestamp/pf-timestamp.d.ts +3 -5
  195. package/react/pf-tooltip/pf-tooltip.d.ts +3 -5
@@ -1,4 +1,5 @@
1
- import { __decorate } from "tslib";
1
+ var _BaseAccordionHeader_instances, _BaseAccordionHeader_generatedHtag, _BaseAccordionHeader_logger, _BaseAccordionHeader_header, _BaseAccordionHeader_initHeader, _BaseAccordionHeader_renderHeaderContent, _BaseAccordionHeader_getOrCreateHeader, _BaseAccordionHeader_onClick;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from "tslib";
2
3
  import { LitElement, html } from 'lit';
3
4
  import { property } from 'lit/decorators/property.js';
4
5
  import { BaseAccordion } from './BaseAccordion.js';
@@ -19,50 +20,48 @@ export class AccordionHeaderChangeEvent extends ComposedEvent {
19
20
  class BaseAccordionHeader extends LitElement {
20
21
  constructor() {
21
22
  super(...arguments);
23
+ _BaseAccordionHeader_instances.add(this);
22
24
  this.expanded = false;
23
- this.#logger = new Logger(this);
25
+ _BaseAccordionHeader_generatedHtag.set(this, void 0);
26
+ _BaseAccordionHeader_logger.set(this, new Logger(this));
27
+ _BaseAccordionHeader_header.set(this, void 0);
24
28
  }
25
- static { this.styles = [style]; }
26
- static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true }; }
27
- #generatedHtag;
28
- #logger;
29
- #header;
30
29
  connectedCallback() {
31
30
  super.connectedCallback();
32
- this.addEventListener('click', this.#onClick);
31
+ this.addEventListener('click', __classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_onClick));
33
32
  this.hidden = true;
34
- this.id ||= getRandomId(this.localName);
35
- this.#initHeader();
36
- }
37
- async #initHeader() {
38
- if (this.headingText && !this.headingTag) {
39
- this.headingTag = 'h3';
40
- }
41
- this.#header = this.#getOrCreateHeader();
42
- // prevent double-logging
43
- if (this.#header !== this.#generatedHtag) {
44
- this.#generatedHtag = undefined;
45
- }
46
- do {
47
- await this.updateComplete;
48
- } while (!await this.updateComplete);
49
- // Remove the hidden attribute after upgrade
50
- this.hidden = false;
33
+ this.id || (this.id = getRandomId(this.localName));
34
+ __classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_initHeader).call(this);
51
35
  }
52
36
  render() {
53
37
  switch (this.headingTag) {
54
- case 'h1': return html `<h1 id="heading">${this.#renderHeaderContent()}</h1>`;
55
- case 'h2': return html `<h2 id="heading">${this.#renderHeaderContent()}</h2>`;
56
- case 'h3': return html `<h3 id="heading">${this.#renderHeaderContent()}</h3>`;
57
- case 'h4': return html `<h4 id="heading">${this.#renderHeaderContent()}</h4>`;
58
- case 'h5': return html `<h5 id="heading">${this.#renderHeaderContent()}</h5>`;
59
- case 'h6': return html `<h6 id="heading">${this.#renderHeaderContent()}</h6>`;
60
- default: return this.#renderHeaderContent();
38
+ case 'h1': return html `<h1 id="heading">${__classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_renderHeaderContent).call(this)}</h1>`;
39
+ case 'h2': return html `<h2 id="heading">${__classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_renderHeaderContent).call(this)}</h2>`;
40
+ case 'h3': return html `<h3 id="heading">${__classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_renderHeaderContent).call(this)}</h3>`;
41
+ case 'h4': return html `<h4 id="heading">${__classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_renderHeaderContent).call(this)}</h4>`;
42
+ case 'h5': return html `<h5 id="heading">${__classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_renderHeaderContent).call(this)}</h5>`;
43
+ case 'h6': return html `<h6 id="heading">${__classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_renderHeaderContent).call(this)}</h6>`;
44
+ default: return __classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_renderHeaderContent).call(this);
61
45
  }
62
46
  }
63
- #renderHeaderContent() {
64
- const headingText = this.headingText?.trim() ?? this.#header?.textContent?.trim();
65
- return html `
47
+ }
48
+ _BaseAccordionHeader_generatedHtag = new WeakMap(), _BaseAccordionHeader_logger = new WeakMap(), _BaseAccordionHeader_header = new WeakMap(), _BaseAccordionHeader_instances = new WeakSet(), _BaseAccordionHeader_initHeader = async function _BaseAccordionHeader_initHeader() {
49
+ if (this.headingText && !this.headingTag) {
50
+ this.headingTag = 'h3';
51
+ }
52
+ __classPrivateFieldSet(this, _BaseAccordionHeader_header, __classPrivateFieldGet(this, _BaseAccordionHeader_instances, "m", _BaseAccordionHeader_getOrCreateHeader).call(this), "f");
53
+ // prevent double-logging
54
+ if (__classPrivateFieldGet(this, _BaseAccordionHeader_header, "f") !== __classPrivateFieldGet(this, _BaseAccordionHeader_generatedHtag, "f")) {
55
+ __classPrivateFieldSet(this, _BaseAccordionHeader_generatedHtag, undefined, "f");
56
+ }
57
+ do {
58
+ await this.updateComplete;
59
+ } while (!await this.updateComplete);
60
+ // Remove the hidden attribute after upgrade
61
+ this.hidden = false;
62
+ }, _BaseAccordionHeader_renderHeaderContent = function _BaseAccordionHeader_renderHeaderContent() {
63
+ const headingText = this.headingText?.trim() ?? __classPrivateFieldGet(this, _BaseAccordionHeader_header, "f")?.textContent?.trim();
64
+ return html `
66
65
  <button id="button"
67
66
  class="toggle"
68
67
  aria-expanded="${String(!!this.expanded)}">
@@ -72,49 +71,48 @@ class BaseAccordionHeader extends LitElement {
72
71
  ${this.renderAfterButton?.()}
73
72
  </button>
74
73
  `;
74
+ }, _BaseAccordionHeader_getOrCreateHeader = function _BaseAccordionHeader_getOrCreateHeader() {
75
+ // Check if there is no nested element or nested textNodes
76
+ if (!this.firstElementChild && !this.firstChild) {
77
+ return void __classPrivateFieldGet(this, _BaseAccordionHeader_logger, "f").warn('No header content provided');
75
78
  }
76
- #getOrCreateHeader() {
77
- // Check if there is no nested element or nested textNodes
78
- if (!this.firstElementChild && !this.firstChild) {
79
- return void this.#logger.warn('No header content provided');
79
+ else if (this.firstElementChild) {
80
+ const [heading, ...otherContent] = Array.from(this.children)
81
+ .filter((x) => !x.hasAttribute('slot') && isPorHeader(x));
82
+ // If there is no content inside the slot, return empty with a warning
83
+ // else, if there is more than 1 element in the slot, capture the first h-tag
84
+ if (!heading) {
85
+ return void __classPrivateFieldGet(this, _BaseAccordionHeader_logger, "f").warn('No heading information was provided.');
80
86
  }
81
- else if (this.firstElementChild) {
82
- const [heading, ...otherContent] = Array.from(this.children)
83
- .filter((x) => !x.hasAttribute('slot') && isPorHeader(x));
84
- // If there is no content inside the slot, return empty with a warning
85
- // else, if there is more than 1 element in the slot, capture the first h-tag
86
- if (!heading) {
87
- return void this.#logger.warn('No heading information was provided.');
88
- }
89
- else if (otherContent.length) {
90
- this.#logger.warn('Heading currently only supports 1 tag; extra tags will be ignored.');
91
- }
92
- return heading;
87
+ else if (otherContent.length) {
88
+ __classPrivateFieldGet(this, _BaseAccordionHeader_logger, "f").warn('Heading currently only supports 1 tag; extra tags will be ignored.');
89
+ }
90
+ return heading;
91
+ }
92
+ else {
93
+ if (!__classPrivateFieldGet(this, _BaseAccordionHeader_generatedHtag, "f")) {
94
+ __classPrivateFieldGet(this, _BaseAccordionHeader_logger, "f").warn('Header should contain at least 1 heading tag for correct semantics.');
95
+ }
96
+ __classPrivateFieldSet(this, _BaseAccordionHeader_generatedHtag, document.createElement('h3'), "f");
97
+ // If a text node was provided but no semantics, default to an h3
98
+ // otherwise, incorrect semantics were used, create an H3 and try to capture the content
99
+ if (this.firstChild?.nodeType === Node.TEXT_NODE) {
100
+ __classPrivateFieldGet(this, _BaseAccordionHeader_generatedHtag, "f").textContent = this.firstChild.textContent;
93
101
  }
94
102
  else {
95
- if (!this.#generatedHtag) {
96
- this.#logger.warn('Header should contain at least 1 heading tag for correct semantics.');
97
- }
98
- this.#generatedHtag = document.createElement('h3');
99
- // If a text node was provided but no semantics, default to an h3
100
- // otherwise, incorrect semantics were used, create an H3 and try to capture the content
101
- if (this.firstChild?.nodeType === Node.TEXT_NODE) {
102
- this.#generatedHtag.textContent = this.firstChild.textContent;
103
- }
104
- else {
105
- this.#generatedHtag.textContent = this.textContent;
106
- }
107
- return this.#generatedHtag;
103
+ __classPrivateFieldGet(this, _BaseAccordionHeader_generatedHtag, "f").textContent = this.textContent;
108
104
  }
105
+ return __classPrivateFieldGet(this, _BaseAccordionHeader_generatedHtag, "f");
109
106
  }
110
- #onClick(event) {
111
- const expanded = !this.expanded;
112
- const acc = event.composedPath().find(BaseAccordion.isAccordion);
113
- if (acc) {
114
- this.dispatchEvent(new AccordionHeaderChangeEvent(expanded, this, acc));
115
- }
107
+ }, _BaseAccordionHeader_onClick = function _BaseAccordionHeader_onClick(event) {
108
+ const expanded = !this.expanded;
109
+ const acc = event.composedPath().find(BaseAccordion.isAccordion);
110
+ if (acc) {
111
+ this.dispatchEvent(new AccordionHeaderChangeEvent(expanded, this, acc));
116
112
  }
117
- }
113
+ };
114
+ BaseAccordionHeader.styles = [style];
115
+ BaseAccordionHeader.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
118
116
  __decorate([
119
117
  property({ type: Boolean, reflect: true })
120
118
  ], BaseAccordionHeader.prototype, "expanded", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAccordionHeader.js","sourceRoot":"","sources":["BaseAccordionHeader.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,E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jE,wFAAwF;YACxF,IAAI,IAAI,CAAC,UAAU,EAAE,QAAQ,KAAK,IAAI,CAAC,SAAS,EAAE;gBAChD,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;aAC/D;iBAAM;gBACL,IAAI,CAAC,cAAc,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;aACpD;YAED,OAAO,IAAI,CAAC,cAAc,CAAC;SAC5B;IACH,CAAC;IAED,QAAQ,CAAC,KAAiB;QACxB,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAChC,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACjE,IAAI,GAAG,EAAE;YACP,IAAI,CAAC,aAAa,CAAC,IAAI,0BAA0B,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;SACzE;IACH,CAAC;;AA5G2C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDAAkB;AAEL;IAAvD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;wDAAsB;AAEtB;IAAtD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;uDAAqB;SATvD,mBAAmB","sourcesContent":["import type { TemplateResult } from 'lit';\n\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\n\nimport { BaseAccordion } from './BaseAccordion.js';\nimport { ComposedEvent } from '@patternfly/pfe-core';\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\nimport { Logger } from '@patternfly/pfe-core/controllers/logger.js';\n\nimport style from './BaseAccordionHeader.css';\n\nconst isPorHeader =\n (el: Node): el is HTMLElement =>\n el instanceof HTMLElement && !!el.tagName.match(/P|^H[1-6]/);\n\nexport class AccordionHeaderChangeEvent extends ComposedEvent {\n constructor(\n public expanded: boolean,\n public toggle: BaseAccordionHeader,\n public accordion: BaseAccordion\n ) {\n super('change');\n }\n}\n\nexport abstract class BaseAccordionHeader extends LitElement {\n static readonly styles = [style];\n\n static override readonly shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n @property({ reflect: true, attribute: 'heading-text' }) headingText?: string;\n\n @property({ reflect: true, attribute: 'heading-tag' }) headingTag?: string;\n\n #generatedHtag?: HTMLHeadingElement;\n\n #logger = new Logger(this);\n\n #header?: HTMLElement;\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('click', this.#onClick);\n this.hidden = true;\n this.id ||= getRandomId(this.localName);\n this.#initHeader();\n }\n\n async #initHeader() {\n if (this.headingText && !this.headingTag) {\n this.headingTag = 'h3';\n }\n this.#header = this.#getOrCreateHeader();\n\n // prevent double-logging\n if (this.#header !== this.#generatedHtag) {\n this.#generatedHtag = undefined;\n }\n\n do {\n await this.updateComplete;\n } while (!await this.updateComplete);\n\n // Remove the hidden attribute after upgrade\n this.hidden = false;\n }\n\n /** Template hook: before </button> */\n renderAfterButton?(): TemplateResult;\n\n override render(): TemplateResult {\n switch (this.headingTag) {\n case 'h1': return html`<h1 id=\"heading\">${this.#renderHeaderContent()}</h1>`;\n case 'h2': return html`<h2 id=\"heading\">${this.#renderHeaderContent()}</h2>`;\n case 'h3': return html`<h3 id=\"heading\">${this.#renderHeaderContent()}</h3>`;\n case 'h4': return html`<h4 id=\"heading\">${this.#renderHeaderContent()}</h4>`;\n case 'h5': return html`<h5 id=\"heading\">${this.#renderHeaderContent()}</h5>`;\n case 'h6': return html`<h6 id=\"heading\">${this.#renderHeaderContent()}</h6>`;\n default: return this.#renderHeaderContent();\n }\n }\n\n #renderHeaderContent() {\n const headingText = this.headingText?.trim() ?? this.#header?.textContent?.trim();\n return html`\n <button id=\"button\"\n class=\"toggle\"\n aria-expanded=\"${String(!!this.expanded) as 'true' | 'false'}\">\n <span part=\"text\">${headingText ?? html`\n <slot></slot>`}\n </span>\n ${this.renderAfterButton?.()}\n </button>\n `;\n }\n\n #getOrCreateHeader(): HTMLElement | undefined {\n // Check if there is no nested element or nested textNodes\n if (!this.firstElementChild && !this.firstChild) {\n return void this.#logger.warn('No header content provided');\n } else if (this.firstElementChild) {\n const [heading, ...otherContent] = Array.from(this.children)\n .filter((x): x is HTMLElement => !x.hasAttribute('slot') && isPorHeader(x));\n\n // If there is no content inside the slot, return empty with a warning\n // else, if there is more than 1 element in the slot, capture the first h-tag\n if (!heading) {\n return void this.#logger.warn('No heading information was provided.');\n } else if (otherContent.length) {\n this.#logger.warn('Heading currently only supports 1 tag; extra tags will be ignored.');\n }\n return heading;\n } else {\n if (!this.#generatedHtag) {\n this.#logger.warn('Header should contain at least 1 heading tag for correct semantics.');\n }\n this.#generatedHtag = document.createElement('h3');\n\n // If a text node was provided but no semantics, default to an h3\n // otherwise, incorrect semantics were used, create an H3 and try to capture the content\n if (this.firstChild?.nodeType === Node.TEXT_NODE) {\n this.#generatedHtag.textContent = this.firstChild.textContent;\n } else {\n this.#generatedHtag.textContent = this.textContent;\n }\n\n return this.#generatedHtag;\n }\n }\n\n #onClick(event: MouseEvent) {\n const expanded = !this.expanded;\n const acc = event.composedPath().find(BaseAccordion.isAccordion);\n if (acc) {\n this.dispatchEvent(new AccordionHeaderChangeEvent(expanded, this, acc));\n }\n }\n}\n"]}
1
+ {"version":3,"file":"BaseAccordionHeader.js","sourceRoot":"","sources":["BaseAccordionHeader.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAs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AAA,IAAI,0CAAe,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;SAC/D;aAAM;YACL,uBAAA,IAAI,0CAAe,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;SACpD;QAED,OAAO,uBAAA,IAAI,0CAAe,CAAC;KAC5B;AACH,CAAC,uEAEQ,KAAiB;IACxB,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;IAChC,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACjE,IAAI,GAAG,EAAE;QACP,IAAI,CAAC,aAAa,CAAC,IAAI,0BAA0B,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;KACzE;AACH,CAAC;AAhHe,0BAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAER,qCAAiB,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,EAAE,cAAc,EAAE,IAAI,EAAE,AAA5D,CAA6D;AAE3D;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDAAkB;AAEL;IAAvD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;wDAAsB;AAEtB;IAAtD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;uDAAqB;SATvD,mBAAmB","sourcesContent":["import type { TemplateResult } from 'lit';\n\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\n\nimport { BaseAccordion } from './BaseAccordion.js';\nimport { ComposedEvent } from '@patternfly/pfe-core';\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\nimport { Logger } from '@patternfly/pfe-core/controllers/logger.js';\n\nimport style from './BaseAccordionHeader.css';\n\nconst isPorHeader =\n (el: Node): el is HTMLElement =>\n el instanceof HTMLElement && !!el.tagName.match(/P|^H[1-6]/);\n\nexport class AccordionHeaderChangeEvent extends ComposedEvent {\n declare target: BaseAccordionHeader;\n constructor(\n public expanded: boolean,\n public toggle: BaseAccordionHeader,\n public accordion: BaseAccordion\n ) {\n super('change');\n }\n}\n\nexport abstract class BaseAccordionHeader extends LitElement {\n static readonly styles = [style];\n\n static override readonly shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };\n\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n @property({ reflect: true, attribute: 'heading-text' }) headingText?: string;\n\n @property({ reflect: true, attribute: 'heading-tag' }) headingTag?: string;\n\n #generatedHtag?: HTMLHeadingElement;\n\n #logger = new Logger(this);\n\n #header?: HTMLElement;\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('click', this.#onClick);\n this.hidden = true;\n this.id ||= getRandomId(this.localName);\n this.#initHeader();\n }\n\n async #initHeader() {\n if (this.headingText && !this.headingTag) {\n this.headingTag = 'h3';\n }\n this.#header = this.#getOrCreateHeader();\n\n // prevent double-logging\n if (this.#header !== this.#generatedHtag) {\n this.#generatedHtag = undefined;\n }\n\n do {\n await this.updateComplete;\n } while (!await this.updateComplete);\n\n // Remove the hidden attribute after upgrade\n this.hidden = false;\n }\n\n /** Template hook: before </button> */\n renderAfterButton?(): TemplateResult;\n\n override render(): TemplateResult {\n switch (this.headingTag) {\n case 'h1': return html`<h1 id=\"heading\">${this.#renderHeaderContent()}</h1>`;\n case 'h2': return html`<h2 id=\"heading\">${this.#renderHeaderContent()}</h2>`;\n case 'h3': return html`<h3 id=\"heading\">${this.#renderHeaderContent()}</h3>`;\n case 'h4': return html`<h4 id=\"heading\">${this.#renderHeaderContent()}</h4>`;\n case 'h5': return html`<h5 id=\"heading\">${this.#renderHeaderContent()}</h5>`;\n case 'h6': return html`<h6 id=\"heading\">${this.#renderHeaderContent()}</h6>`;\n default: return this.#renderHeaderContent();\n }\n }\n\n #renderHeaderContent() {\n const headingText = this.headingText?.trim() ?? this.#header?.textContent?.trim();\n return html`\n <button id=\"button\"\n class=\"toggle\"\n aria-expanded=\"${String(!!this.expanded) as 'true' | 'false'}\">\n <span part=\"text\">${headingText ?? html`\n <slot></slot>`}\n </span>\n ${this.renderAfterButton?.()}\n </button>\n `;\n }\n\n #getOrCreateHeader(): HTMLElement | undefined {\n // Check if there is no nested element or nested textNodes\n if (!this.firstElementChild && !this.firstChild) {\n return void this.#logger.warn('No header content provided');\n } else if (this.firstElementChild) {\n const [heading, ...otherContent] = Array.from(this.children)\n .filter((x): x is HTMLElement => !x.hasAttribute('slot') && isPorHeader(x));\n\n // If there is no content inside the slot, return empty with a warning\n // else, if there is more than 1 element in the slot, capture the first h-tag\n if (!heading) {\n return void this.#logger.warn('No heading information was provided.');\n } else if (otherContent.length) {\n this.#logger.warn('Heading currently only supports 1 tag; extra tags will be ignored.');\n }\n return heading;\n } else {\n if (!this.#generatedHtag) {\n this.#logger.warn('Header should contain at least 1 heading tag for correct semantics.');\n }\n this.#generatedHtag = document.createElement('h3');\n\n // If a text node was provided but no semantics, default to an h3\n // otherwise, incorrect semantics were used, create an H3 and try to capture the content\n if (this.firstChild?.nodeType === Node.TEXT_NODE) {\n this.#generatedHtag.textContent = this.firstChild.textContent;\n } else {\n this.#generatedHtag.textContent = this.textContent;\n }\n\n return this.#generatedHtag;\n }\n }\n\n #onClick(event: MouseEvent) {\n const expanded = !this.expanded;\n const acc = event.composedPath().find(BaseAccordion.isAccordion);\n if (acc) {\n this.dispatchEvent(new AccordionHeaderChangeEvent(expanded, this, acc));\n }\n }\n}\n"]}
@@ -9,10 +9,9 @@ class BaseAccordionPanel extends LitElement {
9
9
  super(...arguments);
10
10
  this.expanded = false;
11
11
  }
12
- static { this.styles = [style]; }
13
12
  connectedCallback() {
14
13
  super.connectedCallback();
15
- this.id ||= getRandomId(this.localName);
14
+ this.id || (this.id = getRandomId(this.localName));
16
15
  this.setAttribute('role', 'region');
17
16
  }
18
17
  render() {
@@ -27,6 +26,7 @@ class BaseAccordionPanel extends LitElement {
27
26
  `;
28
27
  }
29
28
  }
29
+ BaseAccordionPanel.styles = [style];
30
30
  __decorate([
31
31
  property({ type: Boolean, reflect: true })
32
32
  ], BaseAccordionPanel.prototype, "expanded", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAccordionPanel.js","sourceRoot":"","sources":["BaseAccordionPanel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;;;AAIvE,MAAa,kBAAmB,SAAQ,UAAU;IAAlD;;QAG8C,aAAQ,GAAG,KAAK,CAAC;IAmB/D,CAAC;aArBiB,WAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;IAIjC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,KAAK,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;;;;;;;KAQV,CAAC;IACJ,CAAC;;AAlB2C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAAkB;SAHlD,kBAAkB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\n\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\n\nimport style from './BaseAccordionPanel.css';\n\nexport class BaseAccordionPanel extends LitElement {\n static readonly styles = [style];\n\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.id ||= getRandomId(this.localName);\n this.setAttribute('role', 'region');\n }\n\n override render() {\n return html`\n <div tabindex=\"-1\">\n <div id=\"container\" class=\"content\" part=\"container\">\n <div class=\"body\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"BaseAccordionPanel.js","sourceRoot":"","sources":["BaseAccordionPanel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;;;AAIvE,MAAa,kBAAmB,SAAQ,UAAU;IAAlD;;QAG8C,aAAQ,GAAG,KAAK,CAAC;IAmB/D,CAAC;IAjBC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,KAAP,IAAI,CAAC,EAAE,GAAK,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,EAAC;QACxC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;;;;;;;KAQV,CAAC;IACJ,CAAC;;AApBe,yBAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAEW;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDAAkB;SAHlD,kBAAkB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\n\nimport { getRandomId } from '@patternfly/pfe-core/functions/random.js';\n\nimport style from './BaseAccordionPanel.css';\n\nexport class BaseAccordionPanel extends LitElement {\n static readonly styles = [style];\n\n @property({ type: Boolean, reflect: true }) expanded = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.id ||= getRandomId(this.localName);\n this.setAttribute('role', 'region');\n }\n\n override render() {\n return html`\n <div tabindex=\"-1\">\n <div id=\"container\" class=\"content\" part=\"container\">\n <div class=\"body\">\n <slot></slot>\n </div>\n </div>\n </div>\n `;\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
- import { __decorate } from "tslib";
1
+ var _PfAccordionHeader_slots;
2
+ import { __classPrivateFieldGet, __decorate } from "tslib";
2
3
  import { html } from 'lit';
3
4
  import { customElement } from 'lit/decorators/custom-element.js';
4
5
  import { property } from 'lit/decorators/property.js';
@@ -78,10 +79,12 @@ import '@patternfly/elements/pf-icon/pf-icon.js';
78
79
  * {@default `0.2s ease-in 0s`}
79
80
  */
80
81
  let PfAccordionHeader = class PfAccordionHeader extends BaseAccordionHeader {
81
- static { this.styles = [...BaseAccordionHeader.styles, style]; }
82
- #slots = new SlotController(this, 'accents', null);
82
+ constructor() {
83
+ super(...arguments);
84
+ _PfAccordionHeader_slots.set(this, new SlotController(this, 'accents', null));
85
+ }
83
86
  renderAfterButton() {
84
- return html `${!this.#slots.hasSlotted('accents') ? '' : html `
87
+ return html `${!__classPrivateFieldGet(this, _PfAccordionHeader_slots, "f").hasSlotted('accents') ? '' : html `
85
88
  <span part="accents">
86
89
  <slot name="accents"></slot>
87
90
  </span>`}
@@ -93,6 +96,8 @@ let PfAccordionHeader = class PfAccordionHeader extends BaseAccordionHeader {
93
96
  `;
94
97
  }
95
98
  };
99
+ _PfAccordionHeader_slots = new WeakMap();
100
+ PfAccordionHeader.styles = [...BaseAccordionHeader.styles, style];
96
101
  __decorate([
97
102
  property({ reflect: true })
98
103
  ], PfAccordionHeader.prototype, "bordered", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"pf-accordion-header.js","sourceRoot":"","sources":["pf-accordion-header.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAErF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;;;AAI/D,OAAO,yCAAyC,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,mBAAmB;aACxC,WAAM,GAAG,CAAC,GAAG,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,AAAzC,CAA0C;IAQhE,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAEnD,iBAAiB;QACf,OAAO,IAAI,CAAA,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;;;cAGlD;;wBAEU,IAAI,CAAC,IAAI,IAAI,aAAa;uBAC3B,IAAI,CAAC,OAAO,IAAI,KAAK;;;KAGvC,CAAC;IACJ,CAAC;;AAnB4B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAA6B;AAE5B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAe;AAES;IAAnD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;kDAAkB;AAP1D,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAuB7B;SAvBY,iBAAiB","sourcesContent":["import { html } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';\n\nimport { BaseAccordionHeader } from './BaseAccordionHeader.js';\n\nimport style from './pf-accordion-header.css';\n\nimport '@patternfly/elements/pf-icon/pf-icon.js';\n\n/**\n * Accordion Header\n *\n * @csspart text - inline element containing the heading text or slotted heading content\n * @csspart accents - container for accents within the header\n * @csspart icon - caret icon\n *\n * @slot\n * We expect the light DOM of the pf-accordion-header to be a heading level tag (h1, h2, h3, h4, h5, h6)\n * @slot accents\n * These elements will appear inline with the accordion header, between the header and the chevron\n * (or after the chevron and header in disclosure mode).\n *\n * @fires {AccordionHeaderChangeEvent} change - when the open panels change\n *\n * @cssprop {<color>} --pf-c-accordion__toggle--Color\n * Sets the font color for the accordion header.\n * {@default `var(--pf-global--Color--100, #151515)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--BackgroundColor\n * Sets the background color for the accordion header toggle element.\n * {@default `transparent`}\n * @cssprop {<color>} --pf-c-accordion__toggle--after--BackgroundColor\n * Sets the background color for the after element for the accordion header toggle element.\n * {@default `transparent`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingTop\n * Sets the top padding for the accordion header.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingRight\n * Sets the right padding for the accordion header.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingBottom\n * Sets the bottom padding for the accordion header.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingLeft\n * Sets the left padding for the accordion header.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--FontSize\n * Sets the sidebar background color for the accordion header.\n * {@default `var(--pf-global--FontSize--lg, 1rem)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--FontFamily\n * Sets the font family for the accordion header.\n * {@default `var(--pf-global--FontFamily--redhat-updated--heading--sans-serif, \"RedHatDisplayUpdated\", helvetica, arial, sans-serif)`}\n * @cssprop --pf-c-accordion__toggle--FontWeight\n * Sets the font weight for the accordion header.\n * {@default `var(--pf-global--FontWeight--normal, 400)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--active--BackgroundColor\n * Sets the active backgrdound color for the accordion header.\n * {@default `var(--pf-global--BackgroundColor--200, #f0f0f0)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--active-text--Color\n * Sets the active text color for the accordion header.\n * {@default `var(--pf-global--link--Color, #0066cc)`}\n * @cssprop --pf-c-accordion__toggle--active-text--FontWeight\n * Sets the active text font weight for the accordion header.\n * {@default `var(--pf-global--FontWeight--semi-bold, 700)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--expanded--before--BackgroundColor\n * Sets the hover expanded before background color for the accordion header.\n * {@default `var(--pf-global--link--Color, #0066cc)`}\n * @cssprop --pf-c-accordion__toggle--expanded-icon--Rotate\n * Sets the expanded icon rotation degrees for the accordion header.\n * {@default `90deg`}\n * @cssprop {<length>} --pf-c-accordion__toggle-text--MaxWidth\n * Sets the max width for the text inside the accordion header.\n * {@default `calc(100% - var(--pf-global--spacer--lg, 1.5rem))`}\n * @cssprop --pf-c-accordion__toggle--before--Width\n * Sets the sidebar width for the accordion header.\n * {@default `var(--pf-global--BorderWidth--lg, 3px)`}\n * @cssprop --pf-c-accordion__toggle-icon--Transition\n * Sets the transition animation for the accordion header.\n * {@default `0.2s ease-in 0s`}\n */\n@customElement('pf-accordion-header')\nexport class PfAccordionHeader extends BaseAccordionHeader {\n static readonly styles = [...BaseAccordionHeader.styles, style];\n\n @property({ reflect: true }) bordered?: 'true' | 'false';\n\n @property({ reflect: true }) icon?: string;\n\n @property({ reflect: true, attribute: 'icon-set' }) iconSet?: string;\n\n #slots = new SlotController(this, 'accents', null);\n\n renderAfterButton() {\n return html`${!this.#slots.hasSlotted('accents') ? '' : html`\n <span part=\"accents\">\n <slot name=\"accents\"></slot>\n </span>`}\n <pf-icon part=\"icon\"\n icon=\"${this.icon ?? 'angle-right'}\"\n set=\"${this.iconSet ?? 'fas'}\"\n class=\"icon\"\n size=\"lg\"></pf-icon>\n `;\n }\n}\n\n\ndeclare global {\n interface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,UAAU,EAAE,CAAC;kDAAkB;AAP1D,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAuB7B;SAvBY,iBAAiB","sourcesContent":["import { html } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { SlotController } from '@patternfly/pfe-core/controllers/slot-controller.js';\n\nimport { BaseAccordionHeader } from './BaseAccordionHeader.js';\n\nimport style from './pf-accordion-header.css';\n\nimport '@patternfly/elements/pf-icon/pf-icon.js';\n\n/**\n * Accordion Header\n *\n * @csspart text - inline element containing the heading text or slotted heading content\n * @csspart accents - container for accents within the header\n * @csspart icon - caret icon\n *\n * @slot\n * We expect the light DOM of the pf-accordion-header to be a heading level tag (h1, h2, h3, h4, h5, h6)\n * @slot accents\n * These elements will appear inline with the accordion header, between the header and the chevron\n * (or after the chevron and header in disclosure mode).\n *\n * @fires {AccordionHeaderChangeEvent} change - when the open panels change\n *\n * @cssprop {<color>} --pf-c-accordion__toggle--Color\n * Sets the font color for the accordion header.\n * {@default `var(--pf-global--Color--100, #151515)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--BackgroundColor\n * Sets the background color for the accordion header toggle element.\n * {@default `transparent`}\n * @cssprop {<color>} --pf-c-accordion__toggle--after--BackgroundColor\n * Sets the background color for the after element for the accordion header toggle element.\n * {@default `transparent`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingTop\n * Sets the top padding for the accordion header.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingRight\n * Sets the right padding for the accordion header.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingBottom\n * Sets the bottom padding for the accordion header.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--PaddingLeft\n * Sets the left padding for the accordion header.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<length>} --pf-c-accordion__toggle--FontSize\n * Sets the sidebar background color for the accordion header.\n * {@default `var(--pf-global--FontSize--lg, 1rem)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--FontFamily\n * Sets the font family for the accordion header.\n * {@default `var(--pf-global--FontFamily--redhat-updated--heading--sans-serif, \"RedHatDisplayUpdated\", helvetica, arial, sans-serif)`}\n * @cssprop --pf-c-accordion__toggle--FontWeight\n * Sets the font weight for the accordion header.\n * {@default `var(--pf-global--FontWeight--normal, 400)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--active--BackgroundColor\n * Sets the active backgrdound color for the accordion header.\n * {@default `var(--pf-global--BackgroundColor--200, #f0f0f0)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--active-text--Color\n * Sets the active text color for the accordion header.\n * {@default `var(--pf-global--link--Color, #0066cc)`}\n * @cssprop --pf-c-accordion__toggle--active-text--FontWeight\n * Sets the active text font weight for the accordion header.\n * {@default `var(--pf-global--FontWeight--semi-bold, 700)`}\n * @cssprop {<color>} --pf-c-accordion__toggle--expanded--before--BackgroundColor\n * Sets the hover expanded before background color for the accordion header.\n * {@default `var(--pf-global--link--Color, #0066cc)`}\n * @cssprop --pf-c-accordion__toggle--expanded-icon--Rotate\n * Sets the expanded icon rotation degrees for the accordion header.\n * {@default `90deg`}\n * @cssprop {<length>} --pf-c-accordion__toggle-text--MaxWidth\n * Sets the max width for the text inside the accordion header.\n * {@default `calc(100% - var(--pf-global--spacer--lg, 1.5rem))`}\n * @cssprop --pf-c-accordion__toggle--before--Width\n * Sets the sidebar width for the accordion header.\n * {@default `var(--pf-global--BorderWidth--lg, 3px)`}\n * @cssprop --pf-c-accordion__toggle-icon--Transition\n * Sets the transition animation for the accordion header.\n * {@default `0.2s ease-in 0s`}\n */\n@customElement('pf-accordion-header')\nexport class PfAccordionHeader extends BaseAccordionHeader {\n static readonly styles = [...BaseAccordionHeader.styles, style];\n\n @property({ reflect: true }) bordered?: 'true' | 'false';\n\n @property({ reflect: true }) icon?: string;\n\n @property({ reflect: true, attribute: 'icon-set' }) iconSet?: string;\n\n #slots = new SlotController(this, 'accents', null);\n\n renderAfterButton() {\n return html`${!this.#slots.hasSlotted('accents') ? '' : html`\n <span part=\"accents\">\n <slot name=\"accents\"></slot>\n </span>`}\n <pf-icon part=\"icon\"\n icon=\"${this.icon ?? 'angle-right'}\"\n set=\"${this.iconSet ?? 'fas'}\"\n class=\"icon\"\n size=\"lg\"></pf-icon>\n `;\n }\n}\n\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-accordion-header': PfAccordionHeader;\n }\n}\n"]}
@@ -44,8 +44,8 @@ const style = css `:host{color:var(--pf-global--Color--100,#151515);background-c
44
44
  * {@default `var(--pf-global--BorderWidth--lg, 3px)`}
45
45
  */
46
46
  let PfAccordionPanel = class PfAccordionPanel extends BaseAccordionPanel {
47
- static { this.styles = [...BaseAccordionPanel.styles, style]; }
48
47
  };
48
+ PfAccordionPanel.styles = [...BaseAccordionPanel.styles, style];
49
49
  __decorate([
50
50
  property({ reflect: true })
51
51
  ], PfAccordionPanel.prototype, "bordered", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"pf-accordion-panel.js","sourceRoot":"","sources":["pf-accordion-panel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;;;AAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,kBAAkB;aACtC,WAAM,GAAG,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,AAAxC,CAAyC;;AAElC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAA6B;AAH9C,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAI5B;SAJY,gBAAgB","sourcesContent":["import { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { BaseAccordionPanel } from './BaseAccordionPanel.js';\n\nimport style from './pf-accordion-panel.css';\n\n/**\n * Accordion Panel\n *\n * @slot - Panel content\n * @cssprop {<color>} --pf-c-accordion--BackgroundColor\n * Sets the background color for the panel content.\n * {@default `var(--pf-global--BackgroundColor--light-100, #ffffff)`}\n * @cssprop {<color>} --pf-c-accordion__panel--Color\n * Sets the font color for the panel content.\n * {@default `var(--pf-global--Color--dark-200, #6a6e73)`}\n * @cssprop {<length>} --pf-c-accordion__panel--FontSize\n * Sets the font size for the panel content.\n * {@default `var(--pf-global--FontSize--sm, 0.875rem)`}\n * @cssprop {<color>} --pf-c-accordion__panel--content-body--before--BackgroundColor\n * Sets the sidebar color for the panel when the context is expanded.\n * {@default `var(--pf-global--primary-color--100, #0066cc)`}\n * @cssprop {<length>} --pf-c-accordion__panel--m-fixed--MaxHeight\n * Sets the maximum height for the panel content.\n * Will only be used if the `fixed` attribute is used.\n * {@default `9.375rem`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingTop\n * Sets the padding top for the panel content.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingRight\n * Sets the padding right for the panel content.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingBottom\n * Sets the padding bottom for the panel content.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingLeft\n * Sets the padding left for the panel content.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<color>} --pf-c-accordion__panel-body--before--BackgroundColor\n * Sets the background color for the panel content.\n * {@default `transparent`}\n * @cssprop --pf-c-accordion__panel-body--before--Width\n * Sets the before width for the panel content.\n * {@default `var(--pf-global--BorderWidth--lg, 3px)`}\n */\n@customElement('pf-accordion-panel')\nexport class PfAccordionPanel extends BaseAccordionPanel {\n static readonly styles = [...BaseAccordionPanel.styles, style];\n\n @property({ reflect: true }) bordered?: 'true' | 'false';\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-accordion-panel': PfAccordionPanel;\n }\n}\n"]}
1
+ {"version":3,"file":"pf-accordion-panel.js","sourceRoot":"","sources":["pf-accordion-panel.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;;;AAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,kBAAkB;;AACtC,uBAAM,GAAG,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,AAAxC,CAAyC;AAElC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAA6B;AAH9C,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAI5B;SAJY,gBAAgB","sourcesContent":["import { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { BaseAccordionPanel } from './BaseAccordionPanel.js';\n\nimport style from './pf-accordion-panel.css';\n\n/**\n * Accordion Panel\n *\n * @slot - Panel content\n * @cssprop {<color>} --pf-c-accordion--BackgroundColor\n * Sets the background color for the panel content.\n * {@default `var(--pf-global--BackgroundColor--light-100, #ffffff)`}\n * @cssprop {<color>} --pf-c-accordion__panel--Color\n * Sets the font color for the panel content.\n * {@default `var(--pf-global--Color--dark-200, #6a6e73)`}\n * @cssprop {<length>} --pf-c-accordion__panel--FontSize\n * Sets the font size for the panel content.\n * {@default `var(--pf-global--FontSize--sm, 0.875rem)`}\n * @cssprop {<color>} --pf-c-accordion__panel--content-body--before--BackgroundColor\n * Sets the sidebar color for the panel when the context is expanded.\n * {@default `var(--pf-global--primary-color--100, #0066cc)`}\n * @cssprop {<length>} --pf-c-accordion__panel--m-fixed--MaxHeight\n * Sets the maximum height for the panel content.\n * Will only be used if the `fixed` attribute is used.\n * {@default `9.375rem`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingTop\n * Sets the padding top for the panel content.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingRight\n * Sets the padding right for the panel content.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingBottom\n * Sets the padding bottom for the panel content.\n * {@default `var(--pf-global--spacer--sm, 0.5rem)`}\n * @cssprop {<length>} --pf-c-accordion__panel-body--PaddingLeft\n * Sets the padding left for the panel content.\n * {@default `var(--pf-global--spacer--md, 1rem)`}\n * @cssprop {<color>} --pf-c-accordion__panel-body--before--BackgroundColor\n * Sets the background color for the panel content.\n * {@default `transparent`}\n * @cssprop --pf-c-accordion__panel-body--before--Width\n * Sets the before width for the panel content.\n * {@default `var(--pf-global--BorderWidth--lg, 3px)`}\n */\n@customElement('pf-accordion-panel')\nexport class PfAccordionPanel extends BaseAccordionPanel {\n static readonly styles = [...BaseAccordionPanel.styles, style];\n\n @property({ reflect: true }) bordered?: 'true' | 'false';\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-accordion-panel': PfAccordionPanel;\n }\n}\n"]}
@@ -35,7 +35,6 @@ let PfAccordion = class PfAccordion extends BaseAccordion {
35
35
  this.large = false;
36
36
  this.fixed = false;
37
37
  }
38
- static { this.styles = [...BaseAccordion.styles, style]; }
39
38
  async firstUpdated() {
40
39
  let index = null;
41
40
  if (this.single) {
@@ -67,6 +66,7 @@ let PfAccordion = class PfAccordion extends BaseAccordion {
67
66
  await super.expand(index, parentAccordion);
68
67
  }
69
68
  };
69
+ PfAccordion.styles = [...BaseAccordion.styles, style];
70
70
  __decorate([
71
71
  property({ reflect: true, type: Boolean })
72
72
  ], PfAccordion.prototype, "single", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"pf-accordion.js","sourceRoot":"","sources":["pf-accordion.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;;;AAIxC;;;;;;;;;;;;;;;GAeG;AAEH,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,aAAa;IAA9C;;QAGE,oEAAoE;QACxB,WAAM,GAAG,KAAK,CAAC;QAE3D,oDAAoD;QACR,aAAQ,GAAG,KAAK,CAAC;QAE7D,iDAAiD;QAIL,UAAK,GAAG,KAAK,CAAC;QAEd,UAAK,GAAG,KAAK,CAAC;IAoC5D,CAAC;aAlDiB,WAAM,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,AAAnC,CAAoC;IAgB1D,KAAK,CAAC,YAAY;QAChB,IAAI,KAAK,GAAkB,IAAI,CAAC;QAChC,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC;YACrE,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,UAAU,C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AI,EAAE,CAAC;6CAAkB;AAMjB;IAH3C,QAAQ,CAAC,SAAS,YAAY;QAC7B,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC;IACD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAEd;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAf/C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAmDvB;SAnDY,WAAW","sourcesContent":["import { observed } from '@patternfly/pfe-core/decorators.js';\nimport { property } from 'lit/decorators/property.js';\nimport { customElement } from 'lit/decorators/custom-element.js';\n\nimport { BaseAccordion } from './BaseAccordion.js';\nimport { BaseAccordionHeader } from './BaseAccordionHeader.js';\n\nexport * from './pf-accordion-header.js';\nexport * from './pf-accordion-panel.js';\n\nimport style from './pf-accordion.css';\n\n/**\n * An **accordion** is an interactive container that expands and collapses to hide or reveal nested content. It takes advantage of progressive disclosure to help reduce page scrolling, by allowing users to choose whether they want to show or hide more detailed information as needed.\n *\n * @summary Toggle the visibility of sections of content\n *\n * @fires {AccordionExpandEvent} expand - when a panel expands\n * @fires {AccordionCollapseEvent} collapse - when a panel collapses\n *\n *\n * @slot\n * Place the `pf-accordion-header` and `pf-accordion-panel` elements here.\n *\n * @cssproperty {<color>} --accordion__bordered--Color\n * Color for the borders between accordion headers when using bordered or large attributes\n * {@default `var(--rh-color-black-300, #d2d2d2)`}\n */\n@customElement('pf-accordion')\nexport class PfAccordion extends BaseAccordion {\n static readonly styles = [...BaseAccordion.styles, style];\n\n /** When true, only one accordion panel may be expanded at a time */\n @property({ reflect: true, type: Boolean }) single = false;\n\n /** Whether to apply the `bordered` style variant */\n @property({ type: Boolean, reflect: true }) bordered = false;\n\n /** Whether to apply the `large` style variant */\n @observed(function largeChanged(this: PfAccordion) {\n [...this.headers, ...this.panels].forEach(el => el.toggleAttribute('large', this.large));\n })\n @property({ type: Boolean, reflect: true }) large = false;\n\n @property({ type: Boolean, reflect: true }) fixed = false;\n\n async firstUpdated() {\n let index: number | null = null;\n if (this.single) {\n const allHeaders = [...this.querySelectorAll('pf-accordion-header')];\n const lastExpanded = allHeaders.filter(x => x.hasAttribute('expanded')).pop();\n if (lastExpanded) {\n index = allHeaders.indexOf(lastExpanded);\n }\n }\n await super.firstUpdated();\n if (index !== null) {\n this.headers.forEach((_, i) => {\n this.headers.at(i)?.toggleAttribute('expanded', i === index);\n this.panels.at(i)?.toggleAttribute('expanded', i === index);\n });\n }\n }\n\n override async expand(index: number, parentAccordion?: BaseAccordion) {\n if (index === -1) {\n return;\n }\n\n const allHeaders: Array<BaseAccordionHeader> = this.headers;\n\n // Get all the headers and capture the item by index value\n if (this.single) {\n await Promise.all([\n ...allHeaders.map((header, index) => header.expanded && this.collapse(index)),\n ]);\n }\n\n await super.expand(index, parentAccordion);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-accordion': PfAccordion;\n }\n}\n"]}
1
+ {"version":3,"file":"pf-accordion.js","sourceRoot":"","sources":["pf-accordion.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;;;AAIxC;;;;;;;;;;;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GAA+B,IAAI,CAAC,OAAO,CAAC;QAE5D,0DAA0D;QAC1D,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,MAAM,OAAO,CAAC,GAAG,CAAC;gBAChB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aAC9E,CAAC,CAAC;SACJ;QAED,MAAM,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAC7C,CAAC;;AAjDe,kBAAM,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,AAAnC,CAAoC;AAGd;IAA3C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAgB;AAGf;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAkB;AAMjB;IAH3C,QAAQ,CAAC,SAAS,YAAY;QAC7B,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC;IACD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAEd;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAe;AAf/C,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAmDvB;SAnDY,WAAW","sourcesContent":["import { observed } from '@patternfly/pfe-core/decorators.js';\nimport { property } from 'lit/decorators/property.js';\nimport { customElement } from 'lit/decorators/custom-element.js';\n\nimport { BaseAccordion } from './BaseAccordion.js';\nimport { BaseAccordionHeader } from './BaseAccordionHeader.js';\n\nexport * from './pf-accordion-header.js';\nexport * from './pf-accordion-panel.js';\n\nimport style from './pf-accordion.css';\n\n/**\n * An **accordion** is an interactive container that expands and collapses to hide or reveal nested content. It takes advantage of progressive disclosure to help reduce page scrolling, by allowing users to choose whether they want to show or hide more detailed information as needed.\n *\n * @summary Toggle the visibility of sections of content\n *\n * @fires {AccordionExpandEvent} expand - when a panel expands\n * @fires {AccordionCollapseEvent} collapse - when a panel collapses\n *\n *\n * @slot\n * Place the `pf-accordion-header` and `pf-accordion-panel` elements here.\n *\n * @cssproperty {<color>} --accordion__bordered--Color\n * Color for the borders between accordion headers when using bordered or large attributes\n * {@default `var(--rh-color-black-300, #d2d2d2)`}\n */\n@customElement('pf-accordion')\nexport class PfAccordion extends BaseAccordion {\n static readonly styles = [...BaseAccordion.styles, style];\n\n /** When true, only one accordion panel may be expanded at a time */\n @property({ reflect: true, type: Boolean }) single = false;\n\n /** Whether to apply the `bordered` style variant */\n @property({ type: Boolean, reflect: true }) bordered = false;\n\n /** Whether to apply the `large` style variant */\n @observed(function largeChanged(this: PfAccordion) {\n [...this.headers, ...this.panels].forEach(el => el.toggleAttribute('large', this.large));\n })\n @property({ type: Boolean, reflect: true }) large = false;\n\n @property({ type: Boolean, reflect: true }) fixed = false;\n\n async firstUpdated() {\n let index: number | null = null;\n if (this.single) {\n const allHeaders = [...this.querySelectorAll('pf-accordion-header')];\n const lastExpanded = allHeaders.filter(x => x.hasAttribute('expanded')).pop();\n if (lastExpanded) {\n index = allHeaders.indexOf(lastExpanded);\n }\n }\n await super.firstUpdated();\n if (index !== null) {\n this.headers.forEach((_, i) => {\n this.headers.at(i)?.toggleAttribute('expanded', i === index);\n this.panels.at(i)?.toggleAttribute('expanded', i === index);\n });\n }\n }\n\n override async expand(index: number, parentAccordion?: BaseAccordion) {\n if (index === -1) {\n return;\n }\n\n const allHeaders: Array<BaseAccordionHeader> = this.headers;\n\n // Get all the headers and capture the item by index value\n if (this.single) {\n await Promise.all([\n ...allHeaders.map((header, index) => header.expanded && this.collapse(index)),\n ]);\n }\n\n await super.expand(index, parentAccordion);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-accordion': PfAccordion;\n }\n}\n"]}
@@ -25,7 +25,6 @@ class BaseAvatar extends LitElement {
25
25
  /** Whether or not the Avatar image is dark */
26
26
  this.dark = false;
27
27
  }
28
- static { this.styles = [style]; }
29
28
  render() {
30
29
  return this.src != null ? html `
31
30
  <img
@@ -47,6 +46,7 @@ class BaseAvatar extends LitElement {
47
46
  `;
48
47
  }
49
48
  }
49
+ BaseAvatar.styles = [style];
50
50
  __decorate([
51
51
  property()
52
52
  ], BaseAvatar.prototype, "src", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"BaseAvatar.js","sourceRoot":"","sources":["BaseAvatar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;;;AAItD,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAmB,aAAoB;QACrC,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QADhC,kBAAa,GAAb,aAAa,CAAO;IAEvC,CAAC;CACF;AAED;;;;;GAKG;AAEH,MAAa,UAAW,SAAQ,UAAU;IAA1C;;QAME,yCAAyC;QACZ,QAAG,GAAY,cAAc,CAAC;QAE3D,yBAAyB;QACI,SAAI,GAA8B,IAAI,CAAC;QAEpE,8CAA8C;QACF,SAAI,GAAG,KAAK,CAAC;IAsB3D,CAAC;aAlCiB,WAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;IAcjC,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;;eAEnB,IAAI,CAAC,IAAI;cACV,IAAI,CAAC,GAAG,IAAI,EAAE;iBACX,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;cAC3D,IAAI,CAAC,GAAG;KACjB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;;;;;KAKnB,CAAC,CAAC,CAAC,IAAI,CAAA;;;;;;OAML,CAAC;IACN,CAAC;;AA9BW;IAAX,QAAQ,EAAE;uCAAc;AAGI;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAA+B;AAG9B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAwC;AAGxB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAc;SAb9C,UAAU","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\n\nimport style from './BaseAvatar.css';\n\nexport class AvatarLoadEvent extends Event {\n constructor(public originalEvent: Event) {\n super('load', { bubbles: true, composed: true });\n }\n}\n\n/**\n * Avatar is an element for displaying a user's avatar image.\n *\n *\n * @summary For displaying a user's avatar image\n */\n\nexport class BaseAvatar extends LitElement {\n static readonly styles = [style];\n\n /** The URL to the user's custom avatar image. */\n @property() src?: string;\n\n /** The alt text for the avatar image. */\n @property({ reflect: true }) alt?: string = 'Avatar image';\n\n /** Size of the Avatar */\n @property({ reflect: true }) size: 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /** Whether or not the Avatar image is dark */\n @property({ type: Boolean, reflect: true }) dark = false;\n\n render() {\n return this.src != null ? html`\n <img\n size=${this.size}\n alt=${this.alt ?? ''}\n @load=\"${(e: Event) => this.dispatchEvent(new AvatarLoadEvent(e))}\"\n src=${this.src}>\n ` : this.dark ? html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" style=\"enable-background:new 0 0 36 36\" viewBox=\"0 0 36 36\">\n <style>.st1,.st2{fill-rule:evenodd;clip-rule:evenodd;fill:#6a6e73}.st2{fill:#4f5255}</style><path d=\"M0 0h36v36H0z\" style=\"fill:#212427\"/>\n <path d=\"M30.5 36c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4 1.2-3.4 2.6C6.7 27 5.8 32.2 5.4 36h25.1zM17.7 20.1c-3.5 0-6.4-2.9-6.4-6.4s2.9-6.4 6.4-6.4 6.4 2.9 6.4 6.4-2.8 6.4-6.4 6.4z\" class=\"st1\"/><path d=\"M13.3 36v-6.7c-2 .4-2.9 1.4-3.1 3.5l-.1 3.2h3.2zM22.7 36v-6.7c2 .4 2.9 1.4 3.1 3.5l.1 3.2h-3.2z\" class=\"st2\"/>\n </svg>\n ` : html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" style=\"enable-background:new 0 0 36 36\" viewBox=\"0 0 36 36\">\n <style>.st2{fill:#b8bbbe}</style><path d=\"M0 0h36v36H0z\" style=\"fill-rule:evenodd;clip-rule:evenodd;fill:#f0f0f0\"/>\n <path d=\"M17.7 20.1c-3.5 0-6.4-2.9-6.4-6.4s2.9-6.4 6.4-6.4 6.4 2.9 6.4 6.4-2.8 6.4-6.4 6.4z\" style=\"fill-rule:evenodd;clip-rule:evenodd;fill:#d2d2d2\"/><path d=\"M13.3 36v-6.7c-2 .4-2.9 1.4-3.1 3.5l-.1 3.2h3.2z\" class=\"st2\"/>\n <path d=\"m10.1 36 .1-3.2c.2-2.1 1.1-3.1 3.1-3.5V36h9.4v-6.7c2 .4 2.9 1.4 3.1 3.5l.1 3.2h4.7c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4 1.2-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AX,QAAQ,EAAE;uCAAc;AAGI;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCAA+B;AAG9B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAwC;AAGxB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAAc;SAb9C,UAAU","sourcesContent":["import { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators/property.js';\n\nimport style from './BaseAvatar.css';\n\nexport class AvatarLoadEvent extends Event {\n constructor(public originalEvent: Event) {\n super('load', { bubbles: true, composed: true });\n }\n}\n\n/**\n * Avatar is an element for displaying a user's avatar image.\n *\n *\n * @summary For displaying a user's avatar image\n */\n\nexport class BaseAvatar extends LitElement {\n static readonly styles = [style];\n\n /** The URL to the user's custom avatar image. */\n @property() src?: string;\n\n /** The alt text for the avatar image. */\n @property({ reflect: true }) alt?: string = 'Avatar image';\n\n /** Size of the Avatar */\n @property({ reflect: true }) size: 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /** Whether or not the Avatar image is dark */\n @property({ type: Boolean, reflect: true }) dark = false;\n\n render() {\n return this.src != null ? html`\n <img\n size=${this.size}\n alt=${this.alt ?? ''}\n @load=\"${(e: Event) => this.dispatchEvent(new AvatarLoadEvent(e))}\"\n src=${this.src}>\n ` : this.dark ? html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" style=\"enable-background:new 0 0 36 36\" viewBox=\"0 0 36 36\">\n <style>.st1,.st2{fill-rule:evenodd;clip-rule:evenodd;fill:#6a6e73}.st2{fill:#4f5255}</style><path d=\"M0 0h36v36H0z\" style=\"fill:#212427\"/>\n <path d=\"M30.5 36c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4 1.2-3.4 2.6C6.7 27 5.8 32.2 5.4 36h25.1zM17.7 20.1c-3.5 0-6.4-2.9-6.4-6.4s2.9-6.4 6.4-6.4 6.4 2.9 6.4 6.4-2.8 6.4-6.4 6.4z\" class=\"st1\"/><path d=\"M13.3 36v-6.7c-2 .4-2.9 1.4-3.1 3.5l-.1 3.2h3.2zM22.7 36v-6.7c2 .4 2.9 1.4 3.1 3.5l.1 3.2h-3.2z\" class=\"st2\"/>\n </svg>\n ` : html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" style=\"enable-background:new 0 0 36 36\" viewBox=\"0 0 36 36\">\n <style>.st2{fill:#b8bbbe}</style><path d=\"M0 0h36v36H0z\" style=\"fill-rule:evenodd;clip-rule:evenodd;fill:#f0f0f0\"/>\n <path d=\"M17.7 20.1c-3.5 0-6.4-2.9-6.4-6.4s2.9-6.4 6.4-6.4 6.4 2.9 6.4 6.4-2.8 6.4-6.4 6.4z\" style=\"fill-rule:evenodd;clip-rule:evenodd;fill:#d2d2d2\"/><path d=\"M13.3 36v-6.7c-2 .4-2.9 1.4-3.1 3.5l-.1 3.2h3.2z\" class=\"st2\"/>\n <path d=\"m10.1 36 .1-3.2c.2-2.1 1.1-3.1 3.1-3.5V36h9.4v-6.7c2 .4 2.9 1.4 3.1 3.5l.1 3.2h4.7c-.4-3.9-1.3-9-2.9-11-1.1-1.4-2.3-2.2-3.5-2.6s-1.8-.6-6.3-.6-6.1.7-6.1.7c-1.2.4-2.4 1.2-3.4 2.6-1.7 1.9-2.6 7.1-3 10.9h4.7z\" style=\"fill:#d2d2d2\"/><path d=\"m25.9 36-.1-3.2c-.2-2.1-1.1-3.1-3.1-3.5V36h3.2z\" class=\"st2\"/>\n </svg>\n `;\n }\n}\n"]}
@@ -15,8 +15,8 @@ let PfAvatar = class PfAvatar extends BaseAvatar {
15
15
  /** Size of the Avatar */
16
16
  this.size = 'sm';
17
17
  }
18
- static { this.styles = [style]; }
19
18
  };
19
+ PfAvatar.styles = [style];
20
20
  __decorate([
21
21
  property({ reflect: true })
22
22
  ], PfAvatar.prototype, "size", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"pf-avatar.js","sourceRoot":"","sources":["pf-avatar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;;;AAI7C;;;;GAIG;AAEH,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,UAAU;IAAxC;;QAGE,yBAAyB;QACI,SAAI,GAA8B,IAAI,CAAC;IAItE,CAAC;aAPiB,WAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;;AAGJ;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAwC;AAGvC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAA2B;AAP5C,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAQpB;SARY,QAAQ","sourcesContent":["import { property } from 'lit/decorators/property.js';\nimport { customElement } from 'lit/decorators/custom-element.js';\n\nimport { BaseAvatar } from './BaseAvatar.js';\n\nimport style from './pf-avatar.css';\n\n/**\n * An **avatar** is a visual used to represent a user. It may contain an image or a placeholder graphic.\n *\n * @summary For displaying a user's avatar image\n */\n@customElement('pf-avatar')\nexport class PfAvatar extends BaseAvatar {\n static readonly styles = [style];\n\n /** Size of the Avatar */\n @property({ reflect: true }) size: 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /** Whether to display a border around the avatar */\n @property({ reflect: true }) border?: 'light' | 'dark';\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-avatar': PfAvatar;\n }\n}\n"]}
1
+ {"version":3,"file":"pf-avatar.js","sourceRoot":"","sources":["pf-avatar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;;;AAI7C;;;;GAIG;AAEH,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,UAAU;IAAxC;;QAGE,yBAAyB;QACI,SAAI,GAA8B,IAAI,CAAC;IAItE,CAAC;;AAPiB,eAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGJ;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAwC;AAGvC;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAA2B;AAP5C,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAQpB;SARY,QAAQ","sourcesContent":["import { property } from 'lit/decorators/property.js';\nimport { customElement } from 'lit/decorators/custom-element.js';\n\nimport { BaseAvatar } from './BaseAvatar.js';\n\nimport style from './pf-avatar.css';\n\n/**\n * An **avatar** is a visual used to represent a user. It may contain an image or a placeholder graphic.\n *\n * @summary For displaying a user's avatar image\n */\n@customElement('pf-avatar')\nexport class PfAvatar extends BaseAvatar {\n static readonly styles = [style];\n\n /** Size of the Avatar */\n @property({ reflect: true }) size: 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /** Whether to display a border around the avatar */\n @property({ reflect: true }) border?: 'light' | 'dark';\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-avatar': PfAvatar;\n }\n}\n"]}
@@ -2,7 +2,6 @@ import { LitElement, html } from 'lit';
2
2
  import { css } from "lit";
3
3
  const style = css `:host{position:relative;white-space:nowrap;text-align:center;display:inline-block}`;
4
4
  class BaseBadge extends LitElement {
5
- static { this.styles = [style]; }
6
5
  render() {
7
6
  const { threshold, number, textContent } = this;
8
7
  const displayText = (threshold && number && (threshold < number)) ? `${threshold.toString()}+`
@@ -13,5 +12,6 @@ class BaseBadge extends LitElement {
13
12
  `;
14
13
  }
15
14
  }
15
+ BaseBadge.styles = [style];
16
16
  export { BaseBadge };
17
17
  //# sourceMappingURL=BaseBadge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseBadge.js","sourceRoot":"","sources":["BaseBadge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;;;AAIvC,MAAsB,SAAU,SAAQ,UAAU;aAChC,WAAM,GAAG,CAAC,KAAK,CAAC,CAAC;IAkBxB,MAAM;QACb,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAChD,MAAM,WAAW,GACb,CAAC,SAAS,IAAI,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,EAAE,GAAG;YAC5E,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACtC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC;QACtB,OAAO,IAAI,CAAA;cACD,WAAW;KACpB,CAAC;IACJ,CAAC;;SA5BmB,SAAS","sourcesContent":["import { LitElement, html } from 'lit';\n\nimport style from './BaseBadge.css';\n\nexport abstract class BaseBadge extends LitElement {\n static readonly styles = [style];\n\n abstract state?: string;\n\n /**\n * Sets a numeric value for a badge.\n *\n * You can pair it with `threshold` attribute to add a `+` sign\n * if the number exceeds the threshold value.\n */\n abstract number?: number;\n\n /**\n * Sets a threshold for the numeric value and adds `+` sign if\n * the numeric value exceeds the threshold value.\n */\n abstract threshold?: number;\n\n override render() {\n const { threshold, number, textContent } = this;\n const displayText =\n (threshold && number && (threshold < number)) ? `${threshold.toString()}+`\n : (number != null) ? number.toString()\n : textContent ?? '';\n return html`\n <span>${displayText}</span>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"BaseBadge.js","sourceRoot":"","sources":["BaseBadge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;;;AAIvC,MAAsB,SAAU,SAAQ,UAAU;IAmBvC,MAAM;QACb,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;QAChD,MAAM,WAAW,GACb,CAAC,SAAS,IAAI,MAAM,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,EAAE,GAAG;YAC5E,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACtC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC;QACtB,OAAO,IAAI,CAAA;cACD,WAAW;KACpB,CAAC;IACJ,CAAC;;AA3Be,gBAAM,GAAG,CAAC,KAAK,CAAC,CAAC;SADb,SAAS","sourcesContent":["import { LitElement, html } from 'lit';\n\nimport style from './BaseBadge.css';\n\nexport abstract class BaseBadge extends LitElement {\n static readonly styles = [style];\n\n abstract state?: string;\n\n /**\n * Sets a numeric value for a badge.\n *\n * You can pair it with `threshold` attribute to add a `+` sign\n * if the number exceeds the threshold value.\n */\n abstract number?: number;\n\n /**\n * Sets a threshold for the numeric value and adds `+` sign if\n * the numeric value exceeds the threshold value.\n */\n abstract threshold?: number;\n\n override render() {\n const { threshold, number, textContent } = this;\n const displayText =\n (threshold && number && (threshold < number)) ? `${threshold.toString()}+`\n : (number != null) ? number.toString()\n : textContent ?? '';\n return html`\n <span>${displayText}</span>\n `;\n }\n}\n"]}
@@ -28,8 +28,8 @@ const styles = css `:host{border-radius:var(--pf-c-badge--BorderRadius,var(--pf-
28
28
  * @cssprop {<color>} --pf-c-badge--m-unread--BackgroundColor {@default `#06c`}
29
29
  */
30
30
  let PfBadge = class PfBadge extends BaseBadge {
31
- static { this.styles = [...BaseBadge.styles, styles]; }
32
31
  };
32
+ PfBadge.styles = [...BaseBadge.styles, styles];
33
33
  __decorate([
34
34
  property({ reflect: true })
35
35
  ], PfBadge.prototype, "state", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"pf-badge.js","sourceRoot":"","sources":["pf-badge.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;;;AAI3C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,SAAS;aACpB,WAAM,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,AAAhC,CAAiC;;AAM1B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAA2B;AAEZ;IAA1C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAiB;AAEhB;IAA1C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAoB;AAXnD,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAYnB;SAZY,OAAO","sourcesContent":["import { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { BaseBadge } from './BaseBadge.js';\n\nimport styles from './pf-badge.css';\n\n/**\n * A **badge** is used to annotate other information like a label or an object name.\n *\n * @cssprop {<length>} --pf-c-badge--BorderRadius {@default `180em`}\n *\n * @cssprop {<length>} --pf-c-badge--MinWidth {@default `2rem`}\n *\n * @cssprop {<length>} --pf-c-badge--PaddingLeft {@default `0.5rem`}\n * @cssprop {<length>} --pf-c-badge--PaddingRight {@default `0.5rem`}\n *\n * @cssprop {<length>} --pf-c-badge--FontSize {@default `0.85em`}\n * @cssprop {<length>} --pf-c-badge--LineHeight {@default `1.5`}\n * @cssprop {<length>} --pf-c-badge--FontWeight {@default `700`}\n *\n * @cssprop {<color>} --pf-c-badge--Color {@default `#151515`}\n * @cssprop {<color>} --pf-c-badge--BackgroundColor {@default `#f0f0f0`}\n *\n * @cssprop {<color>} --pf-c-badge--m-read--Color {@default `#151515`}\n * @cssprop {<color>} --pf-c-badge--m-read--BackgroundColor {@default `#f0f0f0`}\n *\n * @cssprop {<color>} --pf-c-badge--m-unread--Color {@default `#fff`}\n * @cssprop {<color>} --pf-c-badge--m-unread--BackgroundColor {@default `#06c`}\n */\n\n\n@customElement('pf-badge')\nexport class PfBadge extends BaseBadge {\n static readonly styles = [...BaseBadge.styles, styles];\n\n /**\n * Denotes the state-of-affairs this badge represents\n * Options include read and unread\n */\n @property({ reflect: true }) state?: 'unread' | 'read';\n\n @property({ reflect: true, type: Number }) number?: number;\n\n @property({ reflect: true, type: Number }) threshold?: number;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-badge': PfBadge;\n }\n}\n"]}
1
+ {"version":3,"file":"pf-badge.js","sourceRoot":"","sources":["pf-badge.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;;;AAI3C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,SAAS;;AACpB,cAAM,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,AAAhC,CAAiC;AAM1B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAA2B;AAEZ;IAA1C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAiB;AAEhB;IAA1C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAoB;AAXnD,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAYnB;SAZY,OAAO","sourcesContent":["import { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\n\nimport { BaseBadge } from './BaseBadge.js';\n\nimport styles from './pf-badge.css';\n\n/**\n * A **badge** is used to annotate other information like a label or an object name.\n *\n * @cssprop {<length>} --pf-c-badge--BorderRadius {@default `180em`}\n *\n * @cssprop {<length>} --pf-c-badge--MinWidth {@default `2rem`}\n *\n * @cssprop {<length>} --pf-c-badge--PaddingLeft {@default `0.5rem`}\n * @cssprop {<length>} --pf-c-badge--PaddingRight {@default `0.5rem`}\n *\n * @cssprop {<length>} --pf-c-badge--FontSize {@default `0.85em`}\n * @cssprop {<length>} --pf-c-badge--LineHeight {@default `1.5`}\n * @cssprop {<length>} --pf-c-badge--FontWeight {@default `700`}\n *\n * @cssprop {<color>} --pf-c-badge--Color {@default `#151515`}\n * @cssprop {<color>} --pf-c-badge--BackgroundColor {@default `#f0f0f0`}\n *\n * @cssprop {<color>} --pf-c-badge--m-read--Color {@default `#151515`}\n * @cssprop {<color>} --pf-c-badge--m-read--BackgroundColor {@default `#f0f0f0`}\n *\n * @cssprop {<color>} --pf-c-badge--m-unread--Color {@default `#fff`}\n * @cssprop {<color>} --pf-c-badge--m-unread--BackgroundColor {@default `#06c`}\n */\n\n\n@customElement('pf-badge')\nexport class PfBadge extends BaseBadge {\n static readonly styles = [...BaseBadge.styles, styles];\n\n /**\n * Denotes the state-of-affairs this badge represents\n * Options include read and unread\n */\n @property({ reflect: true }) state?: 'unread' | 'read';\n\n @property({ reflect: true, type: Number }) number?: number;\n\n @property({ reflect: true, type: Number }) threshold?: number;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-badge': PfBadge;\n }\n}\n"]}
@@ -0,0 +1,60 @@
1
+ # Patternfly Elements Banner
2
+ A banner is a 1-line, full color, full width container that can be used to communicate short snippets of information to users. Banners are un-intrusive and non-dismissible.
3
+
4
+ Read more about Button in the [PatternFly Elements Banner documentation](https://patternflyelements.org/components/banner)
5
+
6
+ ## Installation
7
+ Load `<pf-banner>` via CDN:
8
+
9
+ ```html
10
+ <script src="https://jspm.dev/@patternfly/elements/pf-banner/pf-banner.js"></script>
11
+ ```
12
+ Or, if you are using [NPM](https://npm.im/), install it
13
+
14
+ ```bash
15
+ npm install @patternfly/elements
16
+ ```
17
+ Then once installed, import it to your application:
18
+
19
+ ```js
20
+ import '@patternfly/elements/pf-banner/pf-banner.js';
21
+ ```
22
+
23
+
24
+ ## Usage
25
+
26
+ ```html
27
+ <pf-banner>
28
+ Default banner
29
+ </pf-banner>
30
+ ```
31
+
32
+
33
+ ## Attributes
34
+
35
+ ### Variant
36
+ Banners have five different variants. The available variants are `default`, `info`, `success`, `danger`, and `warning`.
37
+
38
+ ```html
39
+ <pf-banner variant="info">
40
+ Info banner
41
+ </pf-banner>
42
+ ```
43
+
44
+ ### Icon
45
+ Banners can have an icon attribute for a shorthand to Patternfly Icons. To see available icons, visit the [Patternfly Elements Icons documentation](https://patternflyelements.com/components/icons/).
46
+
47
+ ```html
48
+ <pf-banner variant="info" icon="info">
49
+ Info banner
50
+ </pf-banner>
51
+ ```
52
+
53
+ ### Sticky
54
+ Banners can be sticky, so they stick to the top of the parent.
55
+
56
+ ```html
57
+ <pf-banner sticky>
58
+ Sticky banner
59
+ </pf-banner>
60
+ ```