@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
@@ -0,0 +1,406 @@
1
+ var _PfAlert_instances, _PfAlert_timeoutId, _PfAlert_renderDefaultTitle, _PfAlert_onCloseClick, _PfAlert_onToggleClick;
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet, __decorate } from "tslib";
3
+ import { LitElement, html } from 'lit';
4
+ import { customElement } from 'lit/decorators/custom-element.js';
5
+ import { property } from 'lit/decorators/property.js';
6
+ import { classMap } from 'lit/directives/class-map.js';
7
+ import { ifDefined } from 'lit/directives/if-defined.js';
8
+ import { observes } from '@patternfly/pfe-core/decorators.js';
9
+ import '@patternfly/elements/pf-icon/pf-icon.js';
10
+ import '@patternfly/elements/pf-button/pf-button.js';
11
+ import { css } from "lit";
12
+ const styles = css `[hidden] {
13
+ display: none !important;
14
+ }
15
+
16
+ :host {
17
+ \t--pf-c-alert--BoxShadow: var(--pf-global--BoxShadow--lg, 0 0.5rem 1rem 0 rgba(3, 3, 3, 0.16), 0 0 0.375rem 0 rgba(3, 3, 3, 0.08));
18
+ \t--pf-c-alert--BackgroundColor: var(--pf-global--BackgroundColor--100, #fff);
19
+ \t--pf-c-alert--GridTemplateColumns: max-content 1fr max-content;
20
+ \t--pf-c-alert--GridTemplateAreas: "icon title close" ". description description" ". action action";
21
+ \t--pf-c-alert--BorderTopWidth: var(--pf-global--BorderWidth--md, 2px);
22
+ \t--pf-c-alert--BorderTopColor: var(--pf-global--default-color--200, #009596);
23
+ \t--pf-c-alert--PaddingTop: var(--pf-global--spacer--md, 1rem);
24
+ \t--pf-c-alert--PaddingRight: var(--pf-global--spacer--md, 1rem);
25
+ \t--pf-c-alert--PaddingBottom: var(--pf-global--spacer--md, 1rem);
26
+ \t--pf-c-alert--PaddingLeft: var(--pf-global--spacer--md, 1rem);
27
+ \t--pf-c-alert__FontSize: var(--pf-global--FontSize--sm, 0.875rem);
28
+ \t--pf-c-alert__toggle--MarginTop: calc(-1 * var(--pf-global--spacer--form-element, 0.375rem) - 0.0625rem);
29
+ \t--pf-c-alert__toggle--MarginBottom: calc(-1 * var(--pf-global--spacer--form-element, 0.375rem));
30
+ \t--pf-c-alert__toggle--MarginLeft: calc(-1 * var(--pf-global--spacer--md, 1rem));
31
+ \t--pf-c-alert__toggle-icon--Rotate: 0;
32
+ \t--pf-c-alert__toggle-icon--Transition: var(--pf-global--Transition, all 250ms cubic-bezier(0.42, 0, 0.58, 1));
33
+ \t--pf-c-alert__icon--Color: var(--pf-global--default-color--200, #009596);
34
+ \t--pf-c-alert__icon--MarginTop: 0.0625rem;
35
+ \t--pf-c-alert__icon--MarginRight: var(--pf-global--spacer--sm, 0.5rem);
36
+ \t--pf-c-alert__icon--FontSize: var(--pf-global--icon--FontSize--md, 1.125rem);
37
+ \t--pf-c-alert__title--FontWeight: var(--pf-global--FontWeight--bold, 700);
38
+ \t--pf-c-alert__title--Color: var(--pf-global--default-color--300, #003737);
39
+ \t--pf-c-alert__title--max-lines: 1;
40
+ \t--pf-c-alert__action--MarginTop: calc(var(--pf-global--spacer--form-element, 0.375rem) * -1);
41
+ \t--pf-c-alert__action--MarginBottom: calc(var(--pf-global--spacer--form-element, 0.375rem) * -1);
42
+ \t--pf-c-alert__action--TranslateY: 0.125rem;
43
+ \t--pf-c-alert__action--MarginRight: calc(var(--pf-global--spacer--sm, 0.5rem) * -1);
44
+ \t--pf-c-alert__description--PaddingTop: var(--pf-global--spacer--xs, 0.25rem);
45
+ \t--pf-c-alert__action-group--PaddingTop-base: var(--pf-global--spacer--xs, 0.25rem);
46
+ \t--pf-c-alert__action-group--PaddingTop: var(--pf-c-alert__action-group--PaddingTop-base);
47
+ \t--pf-c-alert__description--action-group--PaddingTop-base: var(--pf-global--spacer--md, 1rem);
48
+ \t--pf-c-alert__description--action-group--PaddingTop: var(--pf-c-alert__description--action-group--PaddingTop-base);
49
+ \t--pf-c-alert__action-group__c-button--not-last-child--MarginRight: var(--pf-global--spacer--lg, 1.5rem);
50
+ \t--pf-c-alert--m-success--BorderTopColor: var(--pf-global--success-color--100, #3e8635);
51
+ \t--pf-c-alert--m-success__icon--Color: var(--pf-global--success-color--100, #3e8635);
52
+ \t--pf-c-alert--m-success__title--Color: var(--pf-global--success-color--200, #1e4f18);
53
+ \t--pf-c-alert--m-danger--BorderTopColor: var(--pf-global--danger-color--100, #c9190b);
54
+ \t--pf-c-alert--m-danger__icon--Color: var(--pf-global--danger-color--100, #c9190b);
55
+ \t--pf-c-alert--m-danger__title--Color: var(--pf-global--danger-color--200, #a30000);
56
+ \t--pf-c-alert--m-warning--BorderTopColor: var(--pf-global--warning-color--100, #f0ab00);
57
+ \t--pf-c-alert--m-warning__icon--Color: var(--pf-global--warning-color--100, #f0ab00);
58
+ \t--pf-c-alert--m-warning__title--Color: var(--pf-global--warning-color--200, #795600);
59
+ \t--pf-c-alert--m-info--BorderTopColor: var(--pf-global--info-color--100, #2b9af3);
60
+ \t--pf-c-alert--m-info__icon--Color: var(--pf-global--info-color--100, #2b9af3);
61
+ \t--pf-c-alert--m-info__title--Color: var(--pf-global--info-color--200, #002952);
62
+ \t--pf-c-alert--m-inline--BoxShadow: none;
63
+ \t--pf-c-alert--m-inline--BackgroundColor: var(--pf-global--palette--cyan-50, #f2f9f9);
64
+ \t--pf-c-alert--m-inline--m-success--BackgroundColor: var(--pf-global--palette--green-50, #f3faf2);
65
+ \t--pf-c-alert--m-inline--m-danger--BackgroundColor: var(--pf-global--palette--red-50, #faeae8);
66
+ \t--pf-c-alert--m-inline--m-warning--BackgroundColor: var(--pf-global--palette--gold-50, #fdf7e7);
67
+ \t--pf-c-alert--m-inline--m-info--BackgroundColor: var(--pf-global--palette--blue-50, #e7f1fa);
68
+ \t--pf-c-alert--m-inline--m-plain--BorderTopWidth: 0;
69
+ \t--pf-c-alert--m-inline--m-plain--BackgroundColor: transparent;
70
+ \t--pf-c-alert--m-inline--m-plain--PaddingTop: 0;
71
+ \t--pf-c-alert--m-inline--m-plain--PaddingRight: 0;
72
+ \t--pf-c-alert--m-inline--m-plain--PaddingBottom: 0;
73
+ \t--pf-c-alert--m-inline--m-plain--PaddingLeft: 0;
74
+ \t--pf-c-alert--m-expandable--GridTemplateColumns: auto max-content 1fr max-content;
75
+ \t--pf-c-alert--m-expandable--GridTemplateAreas: "toggle icon title close" ". . description description" ". . action action";
76
+ \t--pf-c-alert--m-expandable__description--action-group--PaddingTop: var(--pf-c-alert__action-group--PaddingTop-base);
77
+ \t--pf-c-alert--m-expanded__toggle-icon--Rotate: 90deg;
78
+ \t--pf-c-alert--m-expanded__description--action-group--PaddingTop: var(--pf-c-alert__description--action-group--PaddingTop-base);
79
+ \tcolor: var(--pf-global--Color--100, #151515);
80
+ \tposition: relative;
81
+ \tdisplay: grid;
82
+ \tpadding: var(--pf-c-alert--PaddingTop) var(--pf-c-alert--PaddingRight) var(--pf-c-alert--PaddingBottom) var(--pf-c-alert--PaddingLeft);
83
+ \tfont-size: var(--pf-c-alert__FontSize);
84
+ \tbackground-color: var(--pf-c-alert--BackgroundColor);
85
+ \tborder-top: var(--pf-c-alert--BorderTopWidth) solid var(--pf-c-alert--BorderTopColor);
86
+ \tbox-shadow: var(--pf-c-alert--BoxShadow);
87
+ \tgrid-template-columns: var(--pf-c-alert--GridTemplateColumns);
88
+ \tgrid-template-areas: var(--pf-c-alert--GridTemplateAreas);
89
+ }
90
+
91
+ :host([variant="success"]) {
92
+ --pf-c-alert--BorderTopColor: var(--pf-c-alert--m-success--BorderTopColor);
93
+ --pf-c-alert__icon--Color: var(--pf-c-alert--m-success__icon--Color);
94
+ --pf-c-alert__title--Color: var(--pf-c-alert--m-success__title--Color);
95
+ --pf-c-alert--m-inline--BackgroundColor: var(--pf-c-alert--m-inline--m-success--BackgroundColor);
96
+ }
97
+
98
+ :host([variant="danger"]) {
99
+ --pf-c-alert--BorderTopColor: var(--pf-c-alert--m-danger--BorderTopColor);
100
+ --pf-c-alert__icon--Color: var(--pf-c-alert--m-danger__icon--Color);
101
+ --pf-c-alert__title--Color: var(--pf-c-alert--m-danger__title--Color);
102
+ --pf-c-alert--m-inline--BackgroundColor: var(--pf-c-alert--m-inline--m-danger--BackgroundColor);
103
+ }
104
+
105
+ :host([variant="warning"]) {
106
+ --pf-c-alert--BorderTopColor: var(--pf-c-alert--m-warning--BorderTopColor);
107
+ --pf-c-alert__icon--Color: var(--pf-c-alert--m-warning__icon--Color);
108
+ --pf-c-alert__title--Color: var(--pf-c-alert--m-warning__title--Color);
109
+ --pf-c-alert--m-inline--BackgroundColor: var(--pf-c-alert--m-inline--m-warning--BackgroundColor);
110
+ }
111
+
112
+ :host([variant="info"]) {
113
+ --pf-c-alert--BorderTopColor: var(--pf-c-alert--m-info--BorderTopColor);
114
+ --pf-c-alert__icon--Color: var(--pf-c-alert--m-info__icon--Color);
115
+ --pf-c-alert__title--Color: var(--pf-c-alert--m-info__title--Color);
116
+ --pf-c-alert--m-inline--BackgroundColor: var(--pf-c-alert--m-inline--m-info--BackgroundColor);
117
+ }
118
+
119
+ :host([inline]) {
120
+ --pf-c-alert--BoxShadow: var(--pf-c-alert--m-inline--BoxShadow);
121
+ --pf-c-alert--BackgroundColor: var(--pf-c-alert--m-inline--BackgroundColor);
122
+ }
123
+
124
+ :host([plain]) {
125
+ --pf-c-alert--BorderTopWidth: var(--pf-c-alert--m-inline--m-plain--BorderTopWidth);
126
+ --pf-c-alert--BackgroundColor: var(--pf-c-alert--m-inline--m-plain--BackgroundColor);
127
+ --pf-c-alert--PaddingTop: var(--pf-c-alert--m-inline--m-plain--PaddingTop);
128
+ --pf-c-alert--PaddingRight: var(--pf-c-alert--m-inline--m-plain--PaddingRight);
129
+ --pf-c-alert--PaddingBottom: var(--pf-c-alert--m-inline--m-plain--PaddingBottom);
130
+ --pf-c-alert--PaddingLeft: var(--pf-c-alert--m-inline--m-plain--PaddingLeft);
131
+ }
132
+
133
+ :host([expandable]) {
134
+ --pf-c-alert--GridTemplateColumns: var(--pf-c-alert--m-expandable--GridTemplateColumns);
135
+ --pf-c-alert--GridTemplateAreas: var(--pf-c-alert--m-expandable--GridTemplateAreas);
136
+ --pf-c-alert__description--action-group--PaddingTop: var(--pf-c-alert--m-expandable__description--action-group--PaddingTop);
137
+ }
138
+
139
+ :host([expanded]) {
140
+ --pf-c-alert__toggle-icon--Rotate: var(--pf-c-alert--m-expanded__toggle-icon--Rotate);
141
+ --pf-c-alert__description--action-group--PaddingTop: var(--pf-c-alert--m-expanded__description--action-group--PaddingTop);
142
+ }
143
+
144
+ #toggle {
145
+ margin-top: var(--pf-c-alert__toggle--MarginTop);
146
+ margin-bottom: var(--pf-c-alert__toggle--MarginBottom);
147
+ margin-left: var(--pf-c-alert__toggle--MarginLeft);
148
+ }
149
+
150
+ #icon {
151
+ grid-area: icon;
152
+ display: flex;
153
+ margin-top: var(--pf-c-alert__icon--MarginTop);
154
+ margin-right: var(--pf-c-alert__icon--MarginRight);
155
+ font-size: var(--pf-c-alert__icon--FontSize);
156
+ --pf-icon--size: var(--pf-c-alert__icon--FontSize);
157
+ color: var(--pf-c-alert__icon--Color);
158
+ pf-icon,
159
+ ::slotted(pf-icon) {
160
+ translate: 0 0.125em;
161
+ }
162
+ }
163
+
164
+ #title {
165
+ grid-area: title;
166
+ font-weight: var(--pf-c-alert__title--FontWeight);
167
+ color: var(--pf-c-alert__title--Color);
168
+ word-break: break-word;
169
+ ::slotted(*) {
170
+ color: inherit;
171
+ font-weight: inherit;
172
+ }
173
+ :is(h1,h2,h3,h4,h5,h6),
174
+ ::slotted(:is(h1,h2,h3,h4,h5,h6)) {
175
+ margin-block: 0 !important;
176
+ }
177
+ }
178
+
179
+ #close {
180
+ grid-area: close;
181
+ }
182
+
183
+ #description {
184
+ grid-area: description;
185
+ padding-top: var(--pf-c-alert__description--PaddingTop);
186
+ word-break: break-word;
187
+ }
188
+
189
+ #actions {
190
+ grid-area: action;
191
+ --pf-c-alert__action-group--PaddingTop: var(--pf-c-alert__description--action-group--PaddingTop);
192
+
193
+ & ::slotted(a) {
194
+ text-decoration: none;
195
+ color: #06c;
196
+ margin-inline-end: 1rem;
197
+ }
198
+
199
+ & ::slotted(a:hover),
200
+ & ::slotted(a:focus),
201
+ & ::slotted(a:active) {
202
+ color: #004080;
203
+ }
204
+ }
205
+ `;
206
+ const VariantIconMap = new Map(Object.entries({
207
+ info: 'info-circle',
208
+ success: 'check-circle',
209
+ warning: 'exclamation-triangle',
210
+ danger: 'exclamation-circle',
211
+ neutral: 'bell',
212
+ }));
213
+ export class PfAlertCloseEvent extends Event {
214
+ constructor(reason = 'closed') {
215
+ super('close', { bubbles: true, cancelable: true });
216
+ this.reason = reason;
217
+ }
218
+ }
219
+ let PfAlert = class PfAlert extends LitElement {
220
+ constructor() {
221
+ super(...arguments);
222
+ _PfAlert_instances.add(this);
223
+ /**
224
+ * Use the `timeout` property to automatically dismiss an alert after a period
225
+ * of time. If set to `true`, the timeout will be 8000 milliseconds. Provide a
226
+ * specific value to dismiss the alert after a different number of
227
+ * milliseconds.
228
+ */
229
+ this.timeout = 0;
230
+ /**
231
+ * PatternFly supports several alert variants for different scenarios.
232
+ * Each variant has an associated status icon, background, and alert title
233
+ * coded to communicate the severity of an alert. Use the variant property to
234
+ * apply the following styling options. If no variant is specified, then the
235
+ * variant will be set to "default".
236
+ *
237
+ * - **Default** - Use for generic messages with no associated severity
238
+ * - **Info** - Use for general informational messages
239
+ * - **Success** - Use to indicate that a task or process has been completed successfully
240
+ * - **Warning** - Use to indicate that a non-critical error has occurred
241
+ * - **Danger** - Use to indicate that a critical or blocking error has occurred
242
+ */
243
+ this.variant = 'neutral';
244
+ /**
245
+ * Use inline alerts to display an alert inline with content. All alert
246
+ * variants may use the `inline` attribute to position alerts in content-heavy
247
+ * areas, such as within forms, wizards, or drawers.
248
+ */
249
+ this.inline = false;
250
+ /**
251
+ * Use the `plain` attribute to make any inline alert plain. Plain styling
252
+ * removes the colored background but keeps colored text and icons.
253
+ */
254
+ this.plain = false;
255
+ /**
256
+ * An alert can contain additional, hidden information that is made visible
257
+ * when users click a caret icon. This information can be expanded and
258
+ * collapsed each time the icon is clicked.
259
+ *
260
+ * It is not recommended to use an expandable alert with a timeout in a toast
261
+ * alert group because the alert could timeout before users have time to
262
+ * interact with and view the entire alert.
263
+ *
264
+ * See the toast alert considerations section of the alert accessibility
265
+ * documentation to understand the accessibility risks associated with using
266
+ * toast alerts.
267
+ */
268
+ this.expandable = false;
269
+ /**
270
+ * True when an expandable alert is expanded
271
+ */
272
+ this.expanded = false;
273
+ /**
274
+ * When true, the alert displays a close button
275
+ * Clicking the close button removes the alert
276
+ */
277
+ this.dismissable = false;
278
+ _PfAlert_timeoutId.set(this, void 0);
279
+ }
280
+ disconnectedCallback() {
281
+ super.disconnectedCallback();
282
+ clearTimeout(__classPrivateFieldGet(this, _PfAlert_timeoutId, "f"));
283
+ }
284
+ render() {
285
+ const { expandable, expanded, variant } = this;
286
+ const icon = this.icon ?? VariantIconMap.get(variant);
287
+ return html `
288
+ <pf-button id="toggle"
289
+ plain
290
+ ?hidden="${!expandable}"
291
+ icon="${expandable ? 'angle-down' : 'angle-right'}"
292
+ icon-set="fas"
293
+ @click="${__classPrivateFieldGet(this, _PfAlert_instances, "m", _PfAlert_onToggleClick)}"
294
+ aria-controls="${ifDefined(expandable ? 'description' : undefined)}"
295
+ aria-expanded="${ifDefined(expandable ? String(expanded) : undefined)}"
296
+ aria-label="${expanded ? 'Collapse Alert' : 'Expand Alert'}">
297
+ </pf-button>
298
+
299
+ <div id="icon">
300
+ <slot name="icon">
301
+ <pf-icon icon="${icon}"></pf-icon>
302
+ </slot>
303
+ </div>
304
+
305
+ <div id="title">
306
+ <slot name="title">${__classPrivateFieldGet(this, _PfAlert_instances, "m", _PfAlert_renderDefaultTitle).call(this)}</slot>
307
+ </div>
308
+
309
+ <div id="description"
310
+ ?hidden="${expandable && !expanded}">
311
+ <slot></slot>
312
+ </div>
313
+
314
+ <div id="actions">
315
+ <slot name="actions"></slot>
316
+ </div>
317
+
318
+ <pf-button id="close"
319
+ plain
320
+ icon="close"
321
+ icon-set="patternfly"
322
+ ?hidden="${!this.dismissable}"
323
+ @click="${__classPrivateFieldGet(this, _PfAlert_instances, "m", _PfAlert_onCloseClick)}">
324
+ </pf-button>
325
+ `;
326
+ }
327
+ timeoutChanged() {
328
+ clearTimeout(__classPrivateFieldGet(this, _PfAlert_timeoutId, "f"));
329
+ let { timeout } = this;
330
+ if (timeout === true) {
331
+ timeout = 8000;
332
+ }
333
+ if (timeout > 0) {
334
+ __classPrivateFieldSet(this, _PfAlert_timeoutId, setTimeout(() => {
335
+ if (this.isConnected && this.dispatchEvent(new PfAlertCloseEvent('timeout'))) {
336
+ this.remove();
337
+ }
338
+ }, timeout), "f");
339
+ }
340
+ }
341
+ };
342
+ _PfAlert_timeoutId = new WeakMap();
343
+ _PfAlert_instances = new WeakSet();
344
+ _PfAlert_renderDefaultTitle = function _PfAlert_renderDefaultTitle() {
345
+ if (!this.titleText) {
346
+ return '';
347
+ }
348
+ switch (this.titleLevel ?? 3) {
349
+ case 1: return html `<h1>${this.titleText}</h1>`;
350
+ case 2: return html `<h2>${this.titleText}</h2>`;
351
+ case 4: return html `<h4>${this.titleText}</h4>`;
352
+ case 5: return html `<h5>${this.titleText}</h5>`;
353
+ case 6: return html `<h6>${this.titleText}</h6>`;
354
+ case 3:
355
+ default: return html `<h3>${this.titleText}</h3>`;
356
+ }
357
+ };
358
+ _PfAlert_onCloseClick = function _PfAlert_onCloseClick() {
359
+ if (this.isConnected && this.dispatchEvent(new PfAlertCloseEvent())) {
360
+ clearTimeout(__classPrivateFieldGet(this, _PfAlert_timeoutId, "f"));
361
+ this.remove();
362
+ }
363
+ };
364
+ _PfAlert_onToggleClick = function _PfAlert_onToggleClick() {
365
+ this.expanded = !this.expanded;
366
+ };
367
+ PfAlert.styles = [styles];
368
+ PfAlert.version = "4.3.0";
369
+ __decorate([
370
+ property({ type: Number })
371
+ ], PfAlert.prototype, "timeout", void 0);
372
+ __decorate([
373
+ property({ reflect: true })
374
+ ], PfAlert.prototype, "variant", void 0);
375
+ __decorate([
376
+ property()
377
+ ], PfAlert.prototype, "icon", void 0);
378
+ __decorate([
379
+ property({ attribute: 'title-text', reflect: true })
380
+ ], PfAlert.prototype, "titleText", void 0);
381
+ __decorate([
382
+ property({ attribute: 'title-level', reflect: true })
383
+ ], PfAlert.prototype, "titleLevel", void 0);
384
+ __decorate([
385
+ property({ type: Boolean, reflect: true })
386
+ ], PfAlert.prototype, "inline", void 0);
387
+ __decorate([
388
+ property({ type: Boolean, reflect: true })
389
+ ], PfAlert.prototype, "plain", void 0);
390
+ __decorate([
391
+ property({ reflect: true, type: Boolean })
392
+ ], PfAlert.prototype, "expandable", void 0);
393
+ __decorate([
394
+ property({ reflect: true, type: Boolean })
395
+ ], PfAlert.prototype, "expanded", void 0);
396
+ __decorate([
397
+ property({ reflect: true, type: Boolean })
398
+ ], PfAlert.prototype, "dismissable", void 0);
399
+ __decorate([
400
+ observes('timeout')
401
+ ], PfAlert.prototype, "timeoutChanged", null);
402
+ PfAlert = __decorate([
403
+ customElement('pf-alert')
404
+ ], PfAlert);
405
+ export { PfAlert };
406
+ //# sourceMappingURL=pf-alert.js.map
@@ -0,0 +1 @@
1
+ {"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plateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\n\nimport { observes } from '@patternfly/pfe-core/decorators.js';\n\nimport '@patternfly/elements/pf-icon/pf-icon.js';\nimport '@patternfly/elements/pf-button/pf-button.js';\n\nimport styles from './pf-alert.css';\n\nconst VariantIconMap = new Map(Object.entries({\n info: 'info-circle',\n success: 'check-circle',\n warning: 'exclamation-triangle',\n danger: 'exclamation-circle',\n neutral: 'bell',\n}));\n\nexport class PfAlertCloseEvent extends Event {\n constructor(public reason: 'closed' | 'timeout' = 'closed') {\n super('close', { bubbles: true, cancelable: true });\n }\n}\n\n/**\n * An **alert** is a notification that provides brief information to the user\n * without blocking their workflow.\n *\n * @fires close - When an alert is closed e.g. when close button is clicked or when the alert times\n * out. Cancel the event to prevent the alert from being removed.\n */\n@customElement('pf-alert')\nexport class PfAlert extends LitElement {\n static readonly styles: CSSStyleSheet[] = [styles];\n\n /**\n * Use the `timeout` property to automatically dismiss an alert after a period\n * of time. If set to `true`, the timeout will be 8000 milliseconds. Provide a\n * specific value to dismiss the alert after a different number of\n * milliseconds.\n */\n @property({ type: Number }) timeout: number | true = 0;\n\n /**\n * PatternFly supports several alert variants for different scenarios.\n * Each variant has an associated status icon, background, and alert title\n * coded to communicate the severity of an alert. Use the variant property to\n * apply the following styling options. If no variant is specified, then the\n * variant will be set to \"default\".\n *\n * - **Default** - Use for generic messages with no associated severity\n * - **Info** - Use for general informational messages\n * - **Success** - Use to indicate that a task or process has been completed successfully\n * - **Warning** - Use to indicate that a non-critical error has occurred\n * - **Danger** - Use to indicate that a critical or blocking error has occurred\n */\n @property({ reflect: true })\n variant:\n | 'warning'\n | 'custom'\n | 'neutral'\n | 'info'\n | 'success'\n | 'danger' = 'neutral';\n\n /**\n * Use the `icon` attribute to replace a default alert icon with a custom icon.\n * The `icon` attribute is overridden by the `icon` slot.\n */\n @property() icon?: string;\n\n /**\n * The title of the alert. Overridden by the title slot.\n */\n @property({ attribute: 'title-text', reflect: true }) titleText?: string;\n\n /**\n * The heading level of the alert's title. Overridden by the title slot.\n * Default: 3\n */\n @property({ attribute: 'title-level', reflect: true }) titleLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n\n /**\n * Use inline alerts to display an alert inline with content. All alert\n * variants may use the `inline` attribute to position alerts in content-heavy\n * areas, such as within forms, wizards, or drawers.\n */\n @property({ type: Boolean, reflect: true }) inline = false;\n\n /**\n * Use the `plain` attribute to make any inline alert plain. Plain styling\n * removes the colored background but keeps colored text and icons.\n */\n @property({ type: Boolean, reflect: true }) plain = false;\n\n /**\n * An alert can contain additional, hidden information that is made visible\n * when users click a caret icon. This information can be expanded and\n * collapsed each time the icon is clicked.\n *\n * It is not recommended to use an expandable alert with a timeout in a toast\n * alert group because the alert could timeout before users have time to\n * interact with and view the entire alert.\n *\n * See the toast alert considerations section of the alert accessibility\n * documentation to understand the accessibility risks associated with using\n * toast alerts.\n */\n @property({ reflect: true, type: Boolean }) expandable = false;\n\n /**\n * True when an expandable alert is expanded\n */\n @property({ reflect: true, type: Boolean }) expanded = false;\n\n /**\n * When true, the alert displays a close button\n * Clicking the close button removes the alert\n */\n @property({ reflect: true, type: Boolean }) dismissable = false;\n\n #timeoutId?: number;\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearTimeout(this.#timeoutId);\n }\n\n override render(): TemplateResult<1> {\n const { expandable, expanded, variant } = this;\n const icon = this.icon ?? VariantIconMap.get(variant);\n return html`\n <pf-button id=\"toggle\"\n plain\n ?hidden=\"${!expandable}\"\n icon=\"${expandable ? 'angle-down' : 'angle-right'}\"\n icon-set=\"fas\"\n @click=\"${this.#onToggleClick}\"\n aria-controls=\"${ifDefined(expandable ? 'description' : undefined)}\"\n aria-expanded=\"${ifDefined(expandable ? String(expanded) : undefined)}\"\n aria-label=\"${expanded ? 'Collapse Alert' : 'Expand Alert'}\">\n </pf-button>\n\n <div id=\"icon\">\n <slot name=\"icon\">\n <pf-icon icon=\"${icon}\"></pf-icon>\n </slot>\n </div>\n\n <div id=\"title\">\n <slot name=\"title\">${this.#renderDefaultTitle()}</slot>\n </div>\n\n <div id=\"description\"\n ?hidden=\"${expandable && !expanded}\">\n <slot></slot>\n </div>\n\n <div id=\"actions\">\n <slot name=\"actions\"></slot>\n </div>\n\n <pf-button id=\"close\"\n plain\n icon=\"close\"\n icon-set=\"patternfly\"\n ?hidden=\"${!this.dismissable}\"\n @click=\"${this.#onCloseClick}\">\n </pf-button>\n `;\n }\n\n @observes('timeout')\n protected timeoutChanged(): void {\n clearTimeout(this.#timeoutId);\n let { timeout } = this;\n if (timeout === true) {\n timeout = 8000;\n }\n if (timeout > 0) {\n this.#timeoutId = setTimeout(() => {\n if (this.isConnected && this.dispatchEvent(new PfAlertCloseEvent('timeout'))) {\n this.remove();\n }\n }, timeout) as unknown as number;\n }\n }\n\n #renderDefaultTitle() {\n if (!this.titleText) {\n return '';\n }\n switch (this.titleLevel ?? 3) {\n case 1: return html`<h1>${this.titleText}</h1>`;\n case 2: return html`<h2>${this.titleText}</h2>`;\n case 4: return html`<h4>${this.titleText}</h4>`;\n case 5: return html`<h5>${this.titleText}</h5>`;\n case 6: return html`<h6>${this.titleText}</h6>`;\n case 3:\n default: return html`<h3>${this.titleText}</h3>`;\n }\n }\n\n #onCloseClick() {\n if (this.isConnected && this.dispatchEvent(new PfAlertCloseEvent())) {\n clearTimeout(this.#timeoutId);\n this.remove();\n }\n }\n\n #onToggleClick() {\n this.expanded = !this.expanded;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'pf-alert': PfAlert;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ import { test, expect } from '@playwright/test';
2
+ test.describe('pf-alert E2E Tests', () => {
3
+ test.beforeEach(async ({ page }) => {
4
+ await page.setContent(`
5
+ <pf-alert variant="info" onClose>
6
+ <span slot="title">Alert Title</span>
7
+ <span>Alert description</span>
8
+ </pf-alert>
9
+ `);
10
+ });
11
+ test('should render title and description', async ({ page }) => {
12
+ const title = page.locator('pf-alert >>> #title-area slot[name="title"]');
13
+ const desc = page.locator('pf-alert >>> #description slot');
14
+ await expect(title).toHaveText('Alert Title');
15
+ await expect(desc).toHaveText('Alert description');
16
+ });
17
+ test('close button removes alert', async ({ page }) => {
18
+ await page.locator('pf-alert >>> #close-button').click();
19
+ const alert = page.locator('pf-alert');
20
+ await expect(alert).toHaveCount(0);
21
+ });
22
+ test('toggle button expands/collapses content', async ({ page }) => {
23
+ await page.setContent(`
24
+ <pf-alert isExpandable>
25
+ <span slot="isExpandable">Extra content</span>
26
+ </pf-alert>
27
+ `);
28
+ const toggle = page.locator('pf-alert >>> #toggle-button');
29
+ await toggle.click();
30
+ const expandedContent = page.locator('pf-alert >>> #expandable-description');
31
+ await expect(expandedContent).toBeVisible();
32
+ });
33
+ test('keyboard navigation works', async ({ page }) => {
34
+ const btn = page.locator('pf-alert >>> #close-button');
35
+ await btn.focus();
36
+ await page.keyboard.press('Enter');
37
+ const alert = page.locator('pf-alert');
38
+ await expect(alert).toHaveCount(0);
39
+ });
40
+ test('accessibility checks', async ({ page }) => {
41
+ const container = page.locator('pf-alert >>> #container');
42
+ await expect(container).toHaveAttribute('role', 'alert'); // אם הוספת role
43
+ });
44
+ });
45
+ //# sourceMappingURL=pf-alert.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pf-alert.e2e.js","sourceRoot":"","sources":["pf-alert.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEhD,IAAI,CAAC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IACvC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjC,MAAM,IAAI,CAAC,UAAU,CAAC;;;;;KAKrB,CAAC,CA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AC,OAAO,CAAC,4BAA4B,CAAC,CAAC;QACvD,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACvC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,sBAAsB,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAC1D,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { test, expect } from '@playwright/test';\n\ntest.describe('pf-alert E2E Tests', () => {\n test.beforeEach(async ({ page }) => {\n await page.setContent(`\n <pf-alert variant=\"info\" onClose>\n <span slot=\"title\">Alert Title</span>\n <span>Alert description</span>\n </pf-alert>\n `);\n });\n\n test('should render title and description', async ({ page }) => {\n const title = page.locator('pf-alert >>> #title-area slot[name=\"title\"]');\n const desc = page.locator('pf-alert >>> #description slot');\n await expect(title).toHaveText('Alert Title');\n await expect(desc).toHaveText('Alert description');\n });\n\n test('close button removes alert', async ({ page }) => {\n await page.locator('pf-alert >>> #close-button').click();\n const alert = page.locator('pf-alert');\n await expect(alert).toHaveCount(0);\n });\n\n test('toggle button expands/collapses content', async ({ page }) => {\n await page.setContent(`\n <pf-alert isExpandable>\n <span slot=\"isExpandable\">Extra content</span>\n </pf-alert>\n `);\n const toggle = page.locator('pf-alert >>> #toggle-button');\n await toggle.click();\n const expandedContent = page.locator('pf-alert >>> #expandable-description');\n await expect(expandedContent).toBeVisible();\n });\n\n test('keyboard navigation works', async ({ page }) => {\n const btn = page.locator('pf-alert >>> #close-button');\n await btn.focus();\n await page.keyboard.press('Enter');\n const alert = page.locator('pf-alert');\n await expect(alert).toHaveCount(0);\n });\n\n test('accessibility checks', async ({ page }) => {\n const container = page.locator('pf-alert >>> #container');\n await expect(container).toHaveAttribute('role', 'alert'); // אם הוספת role\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ import '../pf-alert.js';
@@ -0,0 +1,42 @@
1
+ import { html, fixture, expect } from '@open-wc/testing';
2
+ import '../pf-alert.js';
3
+ describe('pf-alert Unit Tests', () => {
4
+ it('should create the component', async () => {
5
+ const el = await fixture(html `<pf-alert></pf-alert>`);
6
+ expect(el).to.exist;
7
+ expect(el.variant).to.equal('neutral');
8
+ });
9
+ it('should render a title slot', async () => {
10
+ const el = await fixture(html `
11
+ <pf-alert><span slot="title">My Title</span></pf-alert>
12
+ `);
13
+ const titleSlot = el.shadowRoot.querySelector('#title slot[name="title"]');
14
+ expect(titleSlot).to.exist;
15
+ });
16
+ it('close button should appear when dismissable=true', async () => {
17
+ const el = await fixture(html `<pf-alert .dismissable=${true}></pf-alert>`);
18
+ const btn = el.shadowRoot.querySelector('#close');
19
+ expect(btn.hasAttribute('hidden')).to.be.false;
20
+ });
21
+ it('should remove itself after timeout', async () => {
22
+ const el = await fixture(html `<pf-alert .timeout=${50}></pf-alert>`);
23
+ const removed = new Promise(resolve => el.addEventListener('close', () => resolve()));
24
+ await removed;
25
+ expect(document.body.contains(el)).to.be.false;
26
+ });
27
+ it('should toggle expanded when toggle button clicked', async () => {
28
+ const el = await fixture(html `
29
+ <pf-alert expandable><span>Content</span></pf-alert>
30
+ `);
31
+ await el.updateComplete;
32
+ const toggle = el.shadowRoot.querySelector('#toggle');
33
+ const initial = el.expanded;
34
+ toggle.click();
35
+ await el.updateComplete;
36
+ expect(el.expanded).to.equal(!initial);
37
+ toggle.click();
38
+ await el.updateComplete;
39
+ expect(el.expanded).to.equal(initial);
40
+ });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,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAA,sBAAsB,EAAE,cAAc,CAAC,CAAC;QACrE,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC5F,MAAM,OAAO,CAAC;QACd,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;QACjE,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,IAAI,CAAA;;KAE5B,CAAQ,CAAC;QACV,MAAM,EAAE,CAAC,cAAc,CAAC;QACxB,MAAM,MAAM,GAAG,EAAE,CAAC,UAAW,CAAC,aAAa,CAAC,SAAS,CAAgB,CAAC;QACtE,MAAM,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC5B,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,EAAE,CAAC,cAAc,CAAC;QACxB,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,EAAE,CAAC,cAAc,CAAC;QACxB,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\nimport '../pf-alert.js';\n\ndescribe('pf-alert Unit Tests', () => {\n it('should create the component', async () => {\n const el = await fixture(html`<pf-alert></pf-alert>`) as any;\n expect(el).to.exist;\n expect(el.variant).to.equal('neutral');\n });\n\n it('should render a title slot', async () => {\n const el = await fixture(html`\n <pf-alert><span slot=\"title\">My Title</span></pf-alert>\n `);\n const titleSlot = el.shadowRoot!.querySelector('#title slot[name=\"title\"]');\n expect(titleSlot).to.exist;\n });\n\n it('close button should appear when dismissable=true', async () => {\n const el = await fixture(html`<pf-alert .dismissable=${true}></pf-alert>`);\n const btn = el.shadowRoot!.querySelector('#close')!;\n expect(btn.hasAttribute('hidden')).to.be.false;\n });\n\n it('should remove itself after timeout', async () => {\n const el = await fixture(html`<pf-alert .timeout=${50}></pf-alert>`);\n const removed = new Promise<void>(resolve => el.addEventListener('close', () => resolve()));\n await removed;\n expect(document.body.contains(el)).to.be.false;\n });\n\n it('should toggle expanded when toggle button clicked', async () => {\n const el = await fixture(html`\n <pf-alert expandable><span>Content</span></pf-alert>\n `) as any;\n await el.updateComplete;\n const toggle = el.shadowRoot!.querySelector('#toggle') as HTMLElement;\n const initial = el.expanded;\n toggle.click();\n await el.updateComplete;\n expect(el.expanded).to.equal(!initial);\n toggle.click();\n await el.updateComplete;\n expect(el.expanded).to.equal(initial);\n });\n});\n"]}
@@ -129,7 +129,7 @@ _PfAvatar_onLoad = function _PfAvatar_onLoad(event) {
129
129
  this.dispatchEvent(new PfAvatarLoadEvent(event));
130
130
  };
131
131
  PfAvatar.styles = [style];
132
- PfAvatar.version = "4.2.0";
132
+ PfAvatar.version = "4.3.0";
133
133
  __decorate([
134
134
  property()
135
135
  ], PfAvatar.prototype, "src", void 0);
@@ -234,7 +234,7 @@ _PfBackToTop_addScrollListener = function _PfBackToTop_addScrollListener() {
234
234
  __classPrivateFieldGet(this, _PfBackToTop_toggleVisibility, "f").call(this);
235
235
  };
236
236
  PfBackToTop.styles = [styles];
237
- PfBackToTop.version = "4.2.0";
237
+ PfBackToTop.version = "4.3.0";
238
238
  __decorate([
239
239
  property({ reflect: true })
240
240
  ], PfBackToTop.prototype, "icon", void 0);
@@ -131,8 +131,8 @@ describe('<pf-back-to-top>', function () {
131
131
  </div>
132
132
  `);
133
133
  element = container.querySelector('pf-back-to-top');
134
- snapshot = await a11ySnapshot();
135
134
  await allUpdates(element);
135
+ snapshot = await a11ySnapshot({ selector: 'pf-back-to-top' });
136
136
  });
137
137
  it('should be hidden on init', function () {
138
138
  const { children } = snapshot;
@@ -142,12 +142,13 @@ describe('<pf-back-to-top>', function () {
142
142
  beforeEach(async function () {
143
143
  const scrollableElement = document.querySelector('#top');
144
144
  scrollableElement.scrollTo({ top: 401, behavior: 'instant' });
145
+ scrollableElement.dispatchEvent(new Event('scroll'));
145
146
  await nextFrame();
146
147
  await allUpdates(element);
147
148
  snapshot = await a11ySnapshot();
148
149
  });
149
150
  it('should be visible', function () {
150
- expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
151
+ expect(snapshot.children?.at(0)?.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
151
152
  });
152
153
  });
153
154
  });