Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(health-index): Adding rh-health-index element #1549

Merged
merged 39 commits into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
88c37e4
Adding rh-health-index element
markcaron May 2, 2024
6947d5d
fix(health-index): lint, change prop to grade
markcaron May 2, 2024
57cb589
fix(health-index): eslint
markcaron May 2, 2024
5df12e0
fix(health-index): correct class name
markcaron May 2, 2024
c3ae3ce
fix(health-index): correct class name
markcaron May 2, 2024
77a46e1
fix(health-index) code docs and screenshot
markcaron May 2, 2024
4bb5592
docs(health-index): add overview
markcaron May 2, 2024
e4bc33a
Merge branch 'staging/charmander' into feat/health-index
adamjohnson May 9, 2024
5828f21
Merge branch 'staging/charmander' into feat/health-index
adamjohnson May 13, 2024
f8b577c
Update elements/rh-health-index/demo/color-context.html
markcaron Jun 6, 2024
9f3106d
fix(health-index): added changeset, a11y test, changed template, read…
markcaron Jun 6, 2024
7cd4b97
Merge branch 'feat/health-index' of github.com:RedHat-UX/red-hat-desi…
markcaron Jun 6, 2024
6ebc9ce
fix(health-index): Adding/fixing a11y tests
markcaron Jun 6, 2024
0c5ee90
chore(health-index): linting
markcaron Jun 6, 2024
44fec15
chore(health-index): linting again
markcaron Jun 6, 2024
18700c9
refactor(health-index): fix colors, refactor CSS vars
markcaron Jun 10, 2024
d31bdaf
perf(health-index): reduce bundle and DOM size
bennypowers Jun 11, 2024
e09b8d8
fix(health-index): colours and linting
bennypowers Jun 11, 2024
5f342c5
Merge branch 'staging/charmander' into feat/health-index
bennypowers Jun 11, 2024
4aed0f6
feat(health-index): meter role
bennypowers Jun 13, 2024
c6f9571
Merge branch 'staging/charmander' into feat/health-index
bennypowers Jun 13, 2024
495ab43
Merge branch 'staging/charmander' into feat/health-index
bennypowers Jun 16, 2024
e02d5bd
fix(health-index): voiceover
bennypowers Jun 17, 2024
210d5b0
docs(health-index): format demos
bennypowers Jun 17, 2024
637f545
fix(health-index): screen readers
bennypowers Jun 17, 2024
b6629fd
fix(health-index): role
bennypowers Jun 17, 2024
2a76da0
docs(health-index): sr demos
bennypowers Jun 17, 2024
87e0b3f
perf: remove superfluous attribute prop
bennypowers Jun 18, 2024
9306ae5
Merge branch 'staging/charmander' into feat/health-index
bennypowers Jun 18, 2024
dae4ef6
docs: update .changeset/calm-fireants-kneel.md
bennypowers Jun 18, 2024
db0a328
docs(health-index): correct shortcodes for code page
zeroedin Jun 18, 2024
800b934
docs(health-index): adding images
markcaron Jun 18, 2024
be52271
chore: remove errant commite files
zeroedin Jun 18, 2024
278b2aa
docs(health-index): adding repoStatus, relateItems, and style docs
markcaron Jun 18, 2024
94208a2
Merge branch 'feat/health-index' of github.com:RedHat-UX/red-hat-desi…
markcaron Jun 18, 2024
1ea86dd
Merge branch 'staging/charmander' into feat/health-index
bennypowers Jun 19, 2024
94a1bf5
feat(health-index): adding and updating docs pages, adding a11y guide…
markcaron Jun 20, 2024
3853713
Merge branch 'staging/charmander' into feat/health-index
bennypowers Jun 21, 2024
21cc979
docs(health-index): role info
bennypowers Jun 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/calm-fireants-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@rhds/elements": minor
---

✨ Added <rh-health-index>

Health index grades the health or security level of something.

```html
<rh-health-index grade="A">A</rh-health-index>
bennypowers marked this conversation as resolved.
Show resolved Hide resolved
```
4 changes: 4 additions & 0 deletions docs/_data/relatedItems.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ rh-footer:
- rh-popover
- rh-tooltip
- rh-site-status
rh-health-index:
- rh-avatar
- rh-badge
- rh-tag
rh-jump-links:
- rh-pagination
- rh-progress-steps
Expand Down
13 changes: 12 additions & 1 deletion docs/_data/repoStatus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,24 @@
libraries:
- name: Figma library
status: Ready

- name: RH Elements
status: Ready
- name: WebRH
status: Ready
- name: Documentation
status: Ready
- name: "Health Index"
type: "Element"
overallStatus: "Available"
libraries:
- name: Figma library
status: Ready
- name: RH Elements
status: Ready
- name: WebRH
status: Planned
- name: Documentation
status: Ready
- name: "Jumplinks"
type: "Element"
overallStatus: "Available"
Expand Down
37 changes: 37 additions & 0 deletions elements/rh-health-index/README.md
adamjohnson marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Health Index
Health index grades the health or security level of something.

## Usage
Use the Health Index element to display a health or security grade (A–F) of something.

At a minimum an `rh-health-index` element should have a `grade=""` attribute with a value of A–F along with a matching grade letter in the slot.

### Default
```html
<rh-health-index grade="A">A</rh-health-index>
```

### Sizes

- Small = `sm`
- Default (i.e., Medium) = `md`
- Large = `lg`
- Extra Large = `xl`

#### Small

```html
<rh-health-index size="sm" grade="A">A</rh-health-index>
```

#### Large

```html
<rh-health-index size="lg" grade="A">A</rh-health-index>
```

#### Extra Large

```html
<rh-health-index size="xl" grade="A">A</rh-health-index>
```
73 changes: 73 additions & 0 deletions elements/rh-health-index/demo/color-context.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<rh-context-demo>
<ul class="demo">
<li>
<h2>SM</h2>
<div><rh-health-index grade="A" size="sm">A</rh-health-index></div>
<div><rh-health-index grade="B" size="sm">B</rh-health-index></div>
<div><rh-health-index grade="C" size="sm">C</rh-health-index></div>
<div><rh-health-index grade="D" size="sm">D</rh-health-index></div>
<div><rh-health-index grade="E" size="sm">E</rh-health-index></div>
<div><rh-health-index grade="F" size="sm">F</rh-health-index></div>
</li>
<li>
<h2>Default</h2>
<div><rh-health-index grade="A">A</rh-health-index></div>
<div><rh-health-index grade="B">B</rh-health-index></div>
<div><rh-health-index grade="C">C</rh-health-index></div>
<div><rh-health-index grade="D">D</rh-health-index></div>
<div><rh-health-index grade="E">E</rh-health-index></div>
<div><rh-health-index grade="F">F</rh-health-index></div>
</li>

<li>
<h2>LG</h2>
<div><rh-health-index grade="A" size="lg">A</rh-health-index></div>
<div><rh-health-index grade="B" size="lg">B</rh-health-index></div>
<div><rh-health-index grade="C" size="lg">C</rh-health-index></div>
<div><rh-health-index grade="D" size="lg">D</rh-health-index></div>
<div><rh-health-index grade="E" size="lg">E</rh-health-index></div>
<div><rh-health-index grade="F" size="lg">F</rh-health-index></div>
</li>

<li>
<h2>XL</h2>
<div><rh-health-index grade="A" size="xl">A</rh-health-index></div>
<div><rh-health-index grade="B" size="xl">B</rh-health-index></div>
<div><rh-health-index grade="C" size="xl">C</rh-health-index></div>
<div><rh-health-index grade="D" size="xl">D</rh-health-index></div>
<div><rh-health-index grade="E" size="xl">E</rh-health-index></div>
<div><rh-health-index grade="F" size="xl">F</rh-health-index></div>
</li>
</ul>
</rh-context-demo>

<script type="module">
import '@rhds/elements/lib/elements/rh-context-demo/rh-context-demo.js';
import '@rhds/elements/rh-surface/rh-surface.js';
import '@rhds/elements/rh-health-index/rh-health-index.js';
</script>

<style>
.demo {
margin: 2rem;
padding: 0;
list-style: none;
width: 800px;
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 2rem;
& h2 {
font-size: var(--rh-font-size-body-text-lg, 1.125rem);
}

& li {
margin: 0;
padding: 0;
}

& rh-surface,
& div {
margin-block-end: 1rem;
}
}
</style>
6 changes: 6 additions & 0 deletions elements/rh-health-index/demo/rh-health-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<rh-health-index grade="C"
size="lg">C</rh-health-index>

<script type="module">
import '@rhds/elements/rh-health-index/rh-health-index.js';
</script>
61 changes: 61 additions & 0 deletions elements/rh-health-index/demo/screen-readers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<section>
<h2>&lt;rh-health-index> element</h2>
<rh-health-index grade="A" size="sm">A</rh-health-index>
<rh-health-index grade="B" size="sm">B</rh-health-index>
<rh-health-index grade="C" size="sm">C</rh-health-index>
<rh-health-index grade="D" size="md">D</rh-health-index>
<rh-health-index grade="E" size="lg">E</rh-health-index>
<rh-health-index grade="F" size="xl">F</rh-health-index>
</section>

<section>
<h2>ARIA attrs for <abbr title="localization">l10n</abbr></h2>
<rh-health-index grade="A"
aria-label="בריאות מדורג מדרגות א עד ו"
aria-valuetext="דרגה א"
size="sm">A</rh-health-index>
</section>

<section>
<h2>Native &gt;meter> element</h2>
<meter min="1" max="6" value="1" aria-valuetext="Grade A" aria-label="Health graded A to F"></meter>
<meter min="1" max="6" value="2" aria-valuetext="Grade B" aria-label="Health graded A to F"></meter>
<meter min="1" max="6" value="3" aria-valuetext="Grade C" aria-label="Health graded A to F"></meter>
<meter min="1" max="6" value="4" aria-valuetext="Grade D" aria-label="Health graded A to F"></meter>
<meter min="1" max="6" value="5" aria-valuetext="Grade E" aria-label="Health graded A to F"></meter>
<meter min="1" max="6" value="6" aria-valuetext="Grade F" aria-label="Health graded A to F"></meter>
</section>

<section>
<h2>ARIA-attributes &gt;meter> element</h2>
<div role="meter" aria-valuemin="1" aria-valuemax="6" aria-valuenow="1" aria-valuetext="Grade A" aria-label="Health graded A to F">A</div>
<div role="meter" aria-valuemin="1" aria-valuemax="6" aria-valuenow="1" aria-valuetext="Grade B" aria-label="Health graded A to F">B</div>
<div role="meter" aria-valuemin="1" aria-valuemax="6" aria-valuenow="1" aria-valuetext="Grade C" aria-label="Health graded A to F">C</div>
<div role="meter" aria-valuemin="1" aria-valuemax="6" aria-valuenow="1" aria-valuetext="Grade D" aria-label="Health graded A to F">D</div>
<div role="meter" aria-valuemin="1" aria-valuemax="6" aria-valuenow="1" aria-valuetext="Grade E" aria-label="Health graded A to F">E</div>
<div role="meter" aria-valuemin="1" aria-valuemax="6" aria-valuenow="1" aria-valuetext="Grade F" aria-label="Health graded A to F">F</div>
</section>

<script type="module">
import '@rhds/elements/rh-health-index/rh-health-index.js';
</script>

<style>
section {
display: flex;
flex-flow: column;
gap: var(--rh-space-lg, 16px);
}
div[role="meter"] {
display: block;
height: 2em;
width: 5em;
background: linear-gradient(90deg, blue, red);
&::after {
color: white;
content: attr(aria-valuetext);
}
}
</style>


69 changes: 69 additions & 0 deletions elements/rh-health-index/demo/variants.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<ul class="demo">
<li>
<h2>SM</h2>
<rh-health-index grade="A" size="sm">A</rh-health-index>
<rh-health-index grade="B" size="sm">B</rh-health-index>
<rh-health-index grade="C" size="sm">C</rh-health-index>
<rh-health-index grade="D" size="sm">D</rh-health-index>
<rh-health-index grade="E" size="sm">E</rh-health-index>
<rh-health-index grade="F" size="sm">F</rh-health-index>
</li>

<li>
<h2>Default</h2>
<rh-health-index grade="A">A</rh-health-index>
<rh-health-index grade="B">B</rh-health-index>
<rh-health-index grade="C">C</rh-health-index>
<rh-health-index grade="D">D</rh-health-index>
<rh-health-index grade="E">E</rh-health-index>
<rh-health-index grade="F">F</rh-health-index>
</li>

<li>
<h2>LG</h2>
<rh-health-index grade="A" size="lg">A</rh-health-index>
<rh-health-index grade="B" size="lg">B</rh-health-index>
<rh-health-index grade="C" size="lg">C</rh-health-index>
<rh-health-index grade="D" size="lg">D</rh-health-index>
<rh-health-index grade="E" size="lg">E</rh-health-index>
<rh-health-index grade="F" size="lg">F</rh-health-index>
</li>

<li>
<h2>XL</h2>
<rh-health-index grade="A" size="xl">A</rh-health-index>
<rh-health-index grade="B" size="xl">B</rh-health-index>
<rh-health-index grade="C" size="xl">C</rh-health-index>
<rh-health-index grade="D" size="xl">D</rh-health-index>
<rh-health-index grade="E" size="xl">E</rh-health-index>
<rh-health-index grade="F" size="xl">F</rh-health-index>
</li>
</ul>

<script type="module">
import '@rhds/elements/rh-health-index/rh-health-index.js';
</script>

<style>
.demo {
margin: 2rem;
padding: 0;
list-style: none;
width: 800px;
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 2rem;
& h2 {
font-size: var(--rh-font-size-body-text-lg, 1.125rem);
}
& li {
display: flex;
flex-flow: column;
gap: var(--rh-space-lg, 16px);
margin: 0;
padding: 0;
}
}
</style>


35 changes: 35 additions & 0 deletions elements/rh-health-index/docs/00-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## Overview

{{ tagName | getElementDescription }}

<uxdot-example width-adjustment="752px">
<img src="{{ './overview.png' | url }}" alt="Four health index components. One is green with letter grade A, one is yellow with letter grade C, one is orange with letter grade D, and one is red with letter grade F.">
</uxdot-example>


{% repoStatusList %}

## Sample element

<rh-health-index grade="A">A</rh-health-index>


## Demos

View a live version of this component and see how it can be customized.

{% playground tagName=tagName %}{% endplayground %}

<rh-cta><a href="{{ './demo/' | url }}">Full screen demo</a></rh-cta>


## When to use

- When you need to use severity to communicate the health of something
- When you need to communicate how secure or vulnerable something is
- When you need to measure how current or out of date something is



{% repoStatusChecklist %}

Loading
Loading