Skip to content

Commit b9e3ed7

Browse files
committed
Merge branch 'staging/charmander' into docs/card-headings
2 parents c714f36 + 1407fdc commit b9e3ed7

File tree

159 files changed

+6555
-562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+6555
-562
lines changed

.changeset/calm-fireants-kneel.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
5+
✨ Added <rh-health-index>
6+
7+
Health index grades the health or security level of something.
8+
9+
```html
10+
<rh-health-index grade="A">A</rh-health-index>
11+
```

.changeset/eighty-peas-joke.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": patch
3+
---
4+
5+
`<rh-tile>`: corrected border color token

.changeset/few-buckets-cross.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
"@rhds/elements": patch
3+
---
4+
`<rh-cta>`: lazy-load the icon component dependency

.changeset/forty-seals-develop.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": patch
3+
---
4+
5+
`<rh-tag>`: update green border color

.changeset/good-planets-yell.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
5+
`<rh-cta>`: Changed focus states to mimic hover states + an additonal outline.

.changeset/mighty-vans-dress.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
"@rhds/elements": major
3+
---
4+
`<rh-cta>`: Removed previously-deprecated `color-palette` attribute

.changeset/mighty-vans-skate.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": major
3+
---
4+
`<rh-cta>`: Deprecated `rhCta.cta` public property. This will be removed in the
5+
next major version.

.changeset/nice-kangaroos-kiss.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
5+
`<rh-pagination>`: Added dark color palette

.changeset/rh-cta-lightdom-shim.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
5+
`<rh-cta>`: Added `rh-cta-lightdom-shim.css` as an optional file to help reduce layout shift before element is defined, where declarative shadow DOM is not an option.

.changeset/shaky-yaks-win.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
`<rh-cta>`: added `href` attribute. When set, do not slot an anchor or button,
5+
instead, slot in the link text.
6+
7+
These two are equivalent:
8+
9+
```html
10+
<rh-cta>
11+
<a href="/elements">Elements</a>
12+
</rh-cta>
13+
```
14+
15+
```html
16+
<rh-cta href="/elements">Elements</rh-cta>
17+
```

.changeset/small-turtles-visit.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
`<rh-card>`: Added CSS custom properties for card headings:
5+
6+
- `--rh-card-heading-font-family`
7+
- `--rh-card-heading-font-size`
8+
- `--rh-card-heading-font-weight`

.changeset/tiny-melons-help.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rhds/elements": patch
3+
---
4+
5+
Fixed the headline, title, body text, and footer font-sizes to match the Tile specs for both the default and compact variants

.changeset/wet-readers-shine.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
`<rh-cta>`: added `icon-set` attribute to better control icon loading
5+
6+
```html
7+
<rh-cta icon="success" icon-set="custom">...</rh-cta>
8+
```

.changeset/wild-steaks-play.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@rhds/elements": minor
3+
---
4+
5+
✨ Added `<rh-switch>`
6+
7+
A switch toggles the state of a setting (between on and off). Switches and checkboxes can often be used interchangeably, but the switch provides a more explicit, visible representation on a setting.
8+
9+
html```
10+
<rh-switch id="a" checked></rh-switch>
11+
<label for="a">
12+
<span data-state="on">Message when on</span>
13+
<span data-state="off" hidden>Message when off</span>
14+
</label>
15+
```

docs/_data/relatedItems.yaml

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ rh-footer:
4141
- rh-popover
4242
- rh-tooltip
4343
- rh-site-status
44+
rh-health-index:
45+
- rh-avatar
46+
- rh-badge
47+
- rh-tag
4448
rh-jump-links:
4549
- rh-pagination
4650
- rh-progress-steps
@@ -82,6 +86,9 @@ rh-subnav:
8286
- rh-navigation
8387
- rh-navigation-secondary
8488
- skip-navigation
89+
rh-switch:
90+
- rh-button
91+
- form
8592
rh-table:
8693
- rh-code-block
8794
rh-tabs:

docs/_data/repoStatus.yaml

+24-1
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,24 @@
148148
libraries:
149149
- name: Figma library
150150
status: Ready
151-
152151
- name: RH Elements
153152
status: Ready
154153
- name: WebRH
155154
status: Ready
156155
- name: Documentation
157156
status: Ready
157+
- name: "Health Index"
158+
type: "Element"
159+
overallStatus: "Available"
160+
libraries:
161+
- name: Figma library
162+
status: Ready
163+
- name: RH Elements
164+
status: Ready
165+
- name: WebRH
166+
status: Planned
167+
- name: Documentation
168+
status: Ready
158169
- name: "Jumplinks"
159170
type: "Element"
160171
overallStatus: "Available"
@@ -275,6 +286,18 @@
275286
status: Ready
276287
- name: Documentation
277288
status: Ready
289+
- name: "Switch"
290+
type: "Element"
291+
overallStatus: "New"
292+
libraries:
293+
- name: Figma library
294+
status: Ready
295+
- name: RH Elements
296+
status: Ready
297+
- name: WebRH
298+
status: Planned
299+
- name: Documentation
300+
status: Ready
278301
- name: "Table"
279302
type: "Element"
280303
overallStatus: "New"

docs/_includes/layout-base.njk

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{%- set extraPageClasses = bodyClasses or "" -%}
2+
{%- if title -%}
3+
{% set extraPageClasses = extraPageClasses + ' page-' + title | slug -%}
4+
{%- endif -%}
5+
<!doctype html>
6+
<html class="no-js" lang="">
7+
<head>
8+
<meta charset="utf-8">
9+
<meta http-equiv="x-ua-compatible" content="ie=edge">
10+
<title>{{ data.title or title }} | Red Hat design system</title>
11+
<meta name="viewport" content="width=device-width, initial-scale=1">
12+
<link rel="shortcut icon" type="image/svg+xml" sizes="any" href="{{ '/assets/logo-red-hat.svg' | url }}">
13+
14+
<meta property="og:title" content="Red Hat design system">
15+
<meta property="og:site_name" content="Red Hat design system">
16+
<meta property="og:url" content="ux.redhat.com">
17+
<meta property="og:description" content="This is Red Hat's design system. Using Red Hat brand standards and PatternFly as our foundational design language, we enable designers and developers to concurrently build branded experiences across redhat.com, Red Hat Customer Portal, and beyond.">
18+
<meta property="og:type" content="website">
19+
<meta property="og:image" content="https://ux.redhat.com/assets/opengraph.png">
20+
21+
<meta name="pfe-auto-reveal" content="true">
22+
23+
<link rel="stylesheet" href="{{ '/assets/redhat/redhat-theme/4/advanced-theme.css' | url }}">
24+
<link rel="stylesheet" href="{{ '/assets/redhat/redhat-font/2/webfonts/red-hat-font.css' | url }}" media="all">
25+
26+
<link rel="stylesheet" href="{{ '/assets/prism.css' | url }}" >
27+
<link rel="stylesheet" href="{{ '/assets/rhds.min.css' | url }}">
28+
<link rel="stylesheet" href="{{ '/assets/packages/@rhds/elements/elements/rh-footer/rh-footer-lightdom.css' | url }}">
29+
<link rel="stylesheet" href="{{ '/assets/packages/@rhds/elements/elements/rh-cta/rh-cta-lightdom-shim.css' | url }}">
30+
<link rel="stylesheet" href="{{ '/assets/packages/@rhds/elements/elements/rh-subnav/rh-subnav-lightdom.css' | url }}">
31+
32+
{% sassFile false %}
33+
{% for stylesheet in stylesheets %}
34+
<link rel="stylesheet" href="{{ stylesheet | url }}">
35+
{% endfor %}
36+
37+
<noscript>
38+
<link type="text/css" href="{{ '/assets/pfe--noscript.min.css' | url }}">
39+
</noscript>
40+
41+
<script type="importmap">{{ importMap | dump | safe }}</script>
42+
<script async src="https://ga.jspm.io/npm:es-module-shims@1.8.0/dist/es-module-shims.js"></script>
43+
{% for tag in importElements %}
44+
<script type="module">
45+
import '@rhds/elements/{{tag}}/{{tag}}.js';
46+
</script>
47+
{% endfor %}
48+
<script type="module">
49+
// As soon as the DOM is ready, toggle JS class
50+
document.documentElement.classList.remove('no-js');
51+
document.documentElement.classList.add('js');
52+
</script>
53+
<script type="module" src="{{ '/assets/copy-permalink.js' | url }}"></script>
54+
<script type="module">
55+
import { PfIcon } from '@patternfly/elements/pf-icon/pf-icon.js';
56+
PfIcon.getIconUrl = (set, icon) =>
57+
new URL(`/assets/packages/@patternfly/elements/pf-icon/icons/${set}/${icon}.js`, location.origin);
58+
</script>
59+
<script type="module">
60+
if (!('shadowRootMode' in HTMLTemplateElement.prototype)) { import('/assets/dsd-polyfill.js'); }
61+
</script>
62+
</head>
63+
<body id="top" class="page {{ extraPageClasses }}" unresolved>
64+
<div class="body-inner">
65+
{{ content | safe }}
66+
</div>
67+
</body>
68+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [SC 1.1.1 Non-text content](https://www.w3.org/WAI/WCAG21/Understanding/non-text-content.html) (Level A)

docs/_plugins/rhds.cjs

+26-13
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ const RHDSAlphabetizeTagsPlugin = require('./alphabetize-tags.cjs');
1111
const RHDSShortcodesPlugin = require('./shortcodes.cjs');
1212
const { parse } = require('async-csv');
1313

14-
/** @typedef {object} EleventyTransformContext */
14+
/**
15+
* @typedef {object} EleventyTransformContext the `this` binding for transform functions
16+
* @property {string} outputPath the path the page will be written to
17+
* @property {string} inputPath the path to the page's input file (e.g. template or paginator)
18+
*/
1519

1620
/**
1721
* Replace paths in demo files from the dev SPA's format to 11ty's format
1822
* @this {EleventyTransformContext}
19-
* @param {string} content
23+
* @param {string} content the HTML content to replace
2024
*/
2125
function demoPaths(content) {
2226
const { outputPath, inputPath } = this;
@@ -42,18 +46,23 @@ function demoPaths(content) {
4246
}
4347

4448
// Rewrite DEMO lightdom css relative URLs
45-
const LIGHTDOM_HREF_RE = /href="\.(?<pathname>.*-lightdom\.css)"/g;
49+
const LIGHTDOM_HREF_RE = /href="\.(?<pathname>.*-lightdom.*\.css)"/g;
4650
const LIGHTDOM_PATH_RE = /href="\.(.*)"/;
4751

4852
/**
49-
* @param {string | number | Date} dateStr
53+
* @param {string | number | Date} dateStr iso date string
54+
* @param {Intl.DateTimeFormatOptions} options date format options
5055
*/
5156
function prettyDate(dateStr, options = {}) {
5257
const { dateStyle = 'medium' } = options;
5358
return new Intl.DateTimeFormat('en-US', { dateStyle })
5459
.format(new Date(dateStr));
5560
}
5661

62+
/**
63+
* @param {string} tagName e.g. pf-jazz-hands
64+
* @param {import("@patternfly/pfe-tools/config.js").PfeConfig} config pfe tools repo config
65+
*/
5766
function getTagNameSlug(tagName, config) {
5867
const name = config?.aliases?.[tagName] ?? tagName.replace(`${config?.tagPrefix ?? 'rh'}-`, '');
5968
return slugify(name, {
@@ -90,7 +99,7 @@ function getFilesToCopy() {
9099
.filter(ent => ent.isDirectory())
91100
.map(ent => ent.name);
92101

93-
/** @type{import('@patternfly/pfe-tools/config.js').PfeConfig}*/
102+
/** @type {import('@patternfly/pfe-tools/config.js').PfeConfig} */
94103
const config = require('../../.pfe.config.json');
95104

96105
// Copy all component and core files to _site
@@ -103,6 +112,10 @@ function getFilesToCopy() {
103112
}));
104113
}
105114

115+
/**
116+
* @param {{ slug: number; }} a first
117+
* @param {{ slug: number; }} b next
118+
*/
106119
function alphabeticallyBySlug(a, b) {
107120
return (
108121
a.slug < b.slug ? -1
@@ -111,7 +124,7 @@ function alphabeticallyBySlug(a, b) {
111124
);
112125
}
113126

114-
/** @param {import('@11ty/eleventy/src/UserConfig')} eleventyConfig */
127+
/** @param {import('@11ty/eleventy/src/UserConfig')} eleventyConfig user config */
115128
module.exports = function(eleventyConfig, { tagsToAlphabetize }) {
116129
eleventyConfig.addDataExtension('yml, yaml', contents => yaml.load(contents));
117130

@@ -145,7 +158,7 @@ module.exports = function(eleventyConfig, { tagsToAlphabetize }) {
145158
const { pfeconfig } = eleventyConfig?.globalData ?? {};
146159
const { aliases } = pfeconfig;
147160

148-
if (inputPath === './docs/elements/demos.html' ) {
161+
if (inputPath === './docs/elements/demo.html' ) {
149162
const tagNameMatch = outputPath.match(/\/elements\/(?<tagName>[-\w]+)\/demo\//);
150163
if (tagNameMatch) {
151164
const { tagName } = tagNameMatch.groups;
@@ -158,17 +171,17 @@ module.exports = function(eleventyConfig, { tagsToAlphabetize }) {
158171

159172
// does the tagName exist in the aliases object?
160173
const key = Object.keys(modifiedAliases).find(key => modifiedAliases[key] === tagName);
161-
162-
const prefixedTagName = `${pfeconfig?.tagPrefix}-${tagName}`;
174+
const { deslugify } = await import('@patternfly/pfe-tools/config.js');
175+
const prefixedTagName = deslugify(tagName, path.join(__dirname, '../..'));
163176
const redirect = { new: key ?? prefixedTagName, old: tagName };
164177
const matches = content.match(LIGHTDOM_HREF_RE);
165178
if (matches) {
166179
for (const match of matches) {
167180
const [, path] = match.match(LIGHTDOM_PATH_RE) ?? [];
168181
const { pathname } = new URL(path, `file:///${outputPath}`);
169-
content = content.replace(`.${path}`, pathname
170-
.replace(`/_site/elements/${redirect.old}/`, `/assets/packages/@rhds/elements/elements/${redirect.new}/`)
171-
.replace('/demo/', '/'));
182+
const filename = pathname.split('/').pop();
183+
const replacement = `/assets/packages/@rhds/elements/elements/${prefixedTagName}/${filename}`;
184+
content = content.replace(`.${path}`, replacement);
172185
}
173186
}
174187
}
@@ -189,7 +202,7 @@ module.exports = function(eleventyConfig, { tagsToAlphabetize }) {
189202
* NB: since the data for this shortcode is no a POJO,
190203
* but a DocsPage instance, 11ty assigns it to this.ctx._
191204
* @see https://github.com/11ty/eleventy/blob/bf7c0c0cce1b2cb01561f57fdd33db001df4cb7e/src/Plugins/RenderPlugin.js#L89-L93
192-
* @type {import('@patternfly/pfe-tools/11ty/DocsPage').DocsPage}
205+
* @type {import('@patternfly/pfe-tools/11ty/DocsPage.js').DocsPage}
193206
*/
194207
const docsPage = this.ctx._;
195208
return docsPage.description;

0 commit comments

Comments
 (0)