forked from patternfly/patternfly-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
18 changed files
with
844 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# PatternFly Elements Alert | ||
|
||
`<pf-alert>` is a web component that provides a standard alert interface for displaying important messages to users. | ||
|
||
## Installation | ||
|
||
Load `<pf-alert>` via CDN: | ||
|
||
```html | ||
<script src="https://jspm.dev/@patternfly/elements/pf-alert/pf-alert"></script> | ||
``` | ||
|
||
Or, if you are using [NPM](https://npm.im), install it | ||
|
||
```bash | ||
npm install @patternfly/elements | ||
``` | ||
|
||
Then once installed, import it to your application: | ||
|
||
```js | ||
import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
``` | ||
|
||
|
||
```html | ||
<pf-alert variant="info" header="Info alert title"></pf-alert> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> | ||
|
||
<pf-alert header="Custom icon"> | ||
<pf-icon slot="icon" set="fas" icon="users" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom info icon" variant="info"> | ||
<pf-icon slot="icon" set="fas" icon="box" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom success icon" variant="success"> | ||
<pf-icon slot="icon" set="fas" icon="database" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom warning icon" variant="warning"> | ||
<pf-icon slot="icon" set="fas" icon="server" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom danger icon" variant="danger"> | ||
<pf-icon slot="icon" set="fas" icon="laptop" loading="idle"></pf-icon> | ||
</pf-alert> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
pf-alert { | ||
padding: 0.5rem; | ||
display: block; | ||
} | ||
|
||
pf-button { | ||
display: block; | ||
padding-block: 1em; | ||
} | ||
|
||
#timeout-alerts { | ||
min-height: 200px; | ||
border: 1px solid #000; | ||
margin: 0.5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> | ||
|
||
<h2> | ||
Inline | ||
</h2> | ||
|
||
<pf-alert header="Default inline" inline></pf-alert> | ||
<pf-alert variant="info" header="Info inline" inline></pf-alert> | ||
<pf-alert variant="success" header="Success inline" inline></pf-alert> | ||
<pf-alert variant="warning" header="Warning inline" inline></pf-alert> | ||
<pf-alert variant="danger" header="Danger inline" inline></pf-alert> | ||
|
||
<h2> | ||
Inline Plain | ||
</h2> | ||
|
||
<pf-alert header="Default inline" inline plain></pf-alert> | ||
<pf-alert variant="info" header="Info inline" inline plain></pf-alert> | ||
<pf-alert variant="success" header="Success inline" inline plain></pf-alert> | ||
<pf-alert variant="warning" header="Warning inline" inline plain></pf-alert> | ||
<pf-alert variant="danger" header="Danger inline" inline plain></pf-alert> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> | ||
|
||
<pf-alert header="Default alert title"></pf-alert> | ||
<pf-alert variant="info" header="Info alert title"></pf-alert> | ||
<pf-alert variant="success" header="Success alert title"></pf-alert> | ||
<pf-alert variant="warning" header="Warning alert title"></pf-alert> | ||
<pf-alert variant="danger" header="Danger alert title"></pf-alert> | ||
|
||
<h2> | ||
Alert Variations | ||
</h2> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
<p>Success alert description. This should tell the user more information about the alert.</p> | ||
<button slot="actions">View details</button> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
<button slot="actions">View details</button> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
|
||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<button slot="actions">View details</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable></pf-alert> | ||
|
||
<h2> | ||
Default Icons | ||
</h2> | ||
|
||
<pf-alert header="Custom icon"> | ||
<pf-icon slot="icon" set="fas" icon="users" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom info icon" variant="info"> | ||
<pf-icon slot="icon" set="fas" icon="box" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom success icon" variant="success"> | ||
<pf-icon slot="icon" set="fas" icon="database" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom warning icon" variant="warning"> | ||
<pf-icon slot="icon" set="fas" icon="server" loading="idle"></pf-icon> | ||
</pf-alert> | ||
<pf-alert header="Custom danger icon" variant="danger"> | ||
<pf-icon slot="icon" set="fas" icon="laptop" loading="idle"></pf-icon> | ||
</pf-alert> | ||
|
||
<h2> | ||
Plain | ||
</h2> | ||
|
||
<pf-alert header="Default plain" plain></pf-alert> | ||
<pf-alert variant="info" header="Info plain" plain></pf-alert> | ||
<pf-alert variant="success" header="Success plain" plain dismissable> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
<pf-alert variant="warning" header="Warning plain" plain></pf-alert> | ||
<pf-alert variant="danger" header="Danger plain" plain></pf-alert> | ||
|
||
<h2> | ||
Inline | ||
</h2> | ||
|
||
<pf-alert header="Default inline" inline></pf-alert> | ||
<pf-alert variant="info" header="Info inline" inline></pf-alert> | ||
<pf-alert variant="success" header="Success inline" inline></pf-alert> | ||
<pf-alert variant="warning" header="Warning inline" inline></pf-alert> | ||
<pf-alert variant="danger" header="Danger inline" inline></pf-alert> | ||
|
||
<h2> | ||
Plain | ||
</h2> | ||
|
||
<pf-alert header="Default inline" plain></pf-alert> | ||
<pf-alert variant="info" header="Info inline" plain></pf-alert> | ||
<pf-alert variant="success" header="Success inline" plain></pf-alert> | ||
<pf-alert variant="warning" header="Warning inline" plain></pf-alert> | ||
<pf-alert variant="danger" header="Danger inline" plain></pf-alert> | ||
|
||
<h2> | ||
Inline Plain | ||
</h2> | ||
|
||
<pf-alert header="Default inline" inline plain></pf-alert> | ||
<pf-alert variant="info" header="Info inline" inline plain></pf-alert> | ||
<pf-alert variant="success" header="Success inline" inline plain></pf-alert> | ||
<pf-alert variant="warning" header="Warning inline" inline plain></pf-alert> | ||
<pf-alert variant="danger" header="Danger inline" inline plain></pf-alert> | ||
|
||
<h2> | ||
Truncated Title | ||
</h2> | ||
|
||
<pf-alert style="width:100px;" truncate-title header="It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of darkness, it was the spring of hope, it was the winter of despair."></pf-alert> | ||
|
||
<h2> | ||
Timeout | ||
</h2> | ||
|
||
<pf-button id="create-timeout-alert">Create default timeout alert</pf-button> | ||
<pf-button id="create-timeout-inline-alert">Create inline timeout alert</pf-button> | ||
|
||
<input type="range" id="timeout-range" min="0" max="10000" step="100" value="1000" /> | ||
<label for="timeout-range">Timeout: <span id="timeout-value">1000</span>ms</label> | ||
<pf-button id="create-Default-timeout-alert">Create Default timeout alert</pf-button> | ||
|
||
<section id="timeout-alerts"></section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> | ||
|
||
<pf-alert header="Default alert title"></pf-alert> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
import '@patternfly/elements/pf-button/pf-button.js'; | ||
import '@patternfly/elements/pf-icon/pf-icon.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> | ||
|
||
<h2> | ||
Plain | ||
</h2> | ||
|
||
<pf-alert header="Default plain" plain></pf-alert> | ||
<pf-alert variant="info" header="Info plain" plain></pf-alert> | ||
<pf-alert variant="success" header="Success plain" plain dismissable> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
<pf-alert variant="warning" header="Warning plain" plain></pf-alert> | ||
<pf-alert variant="danger" header="Danger plain" plain></pf-alert> | ||
|
||
<h2> | ||
Inline Plain | ||
</h2> | ||
|
||
<pf-alert header="Default inline" inline plain></pf-alert> | ||
<pf-alert variant="info" header="Info inline" inline plain></pf-alert> | ||
<pf-alert variant="success" header="Success inline" inline plain></pf-alert> | ||
<pf-alert variant="warning" header="Warning inline" inline plain></pf-alert> | ||
<pf-alert variant="danger" header="Danger inline" inline plain></pf-alert> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="timeout.js"></script> | ||
|
||
<h2> | ||
Timeout | ||
</h2> | ||
|
||
<pf-button id="create-timeout-alert">Create default timeout alert</pf-button> | ||
<pf-button id="create-timeout-inline-alert">Create inline timeout alert</pf-button> | ||
<pf-button id="create-custom-timeout-alert">Create custom timeout alert</pf-button> | ||
|
||
<input type="range" id="timeout-range" min="0" max="10000" step="100" value="1000" /> | ||
<label for="timeout-range">Timeout: <span id="timeout-value">1000</span>ms</label> | ||
<pf-button id="create-Default-timeout-alert">Create Default timeout alert</pf-button> | ||
|
||
<section id="timeout-alerts"></section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
import '@patternfly/elements/pf-button/pf-button.js'; | ||
import '@patternfly/elements/pf-icon/pf-icon.js'; | ||
|
||
const createTimeoutAlert = document.getElementById('create-timeout-alert'); | ||
const createInlintTimeoutAlert = document.getElementById('create-timeout-inline-alert'); | ||
const timeoutRange = document.getElementById('timeout-range'); | ||
const timeoutValue = document.getElementById('timeout-value'); | ||
const createCustomTimeoutAlert = document.getElementById('create-custom-timeout-alert'); | ||
const timeoutAlertsSection = document.getElementById('timeout-alerts'); | ||
|
||
createTimeoutAlert.addEventListener('click', () => { | ||
const pfeAlert = document.createElement('pf-alert'); | ||
pfeAlert.header = 'Default Timeout Alert 8000ms'; | ||
pfeAlert.timeout = true; | ||
timeoutAlertsSection.appendChild(pfeAlert); | ||
}); | ||
|
||
createInlintTimeoutAlert.addEventListener('click', () => { | ||
const pfeAlert = document.createElement('pf-alert'); | ||
pfeAlert.header = 'Inline Timeout Alert 8000ms'; | ||
pfeAlert.timeout = true; | ||
timeoutAlertsSection.appendChild(pfeAlert); | ||
}); | ||
|
||
createCustomTimeoutAlert.addEventListener('click', () => { | ||
const pfeAlert = document.createElement('pf-alert'); | ||
pfeAlert.header = `Custom Timeout Alert ${timeoutRange.value}ms`; | ||
pfeAlert.timeout = timeoutRange.value; | ||
timeoutAlertsSection.appendChild(pfeAlert); | ||
}); | ||
|
||
timeoutRange.addEventListener('change', () => { | ||
timeoutValue.innerText = timeoutRange.value; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> | ||
|
||
<h2> | ||
Truncated Title | ||
</h2> | ||
|
||
<pf-alert style="width:100px;" truncate-title header="It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of darkness, it was the spring of hope, it was the winter of despair."></pf-alert> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<link rel="stylesheet" href="demo.css"><script type="module" src="pf-alert.js"></script> | ||
|
||
<pf-alert header="Default alert title"></pf-alert> | ||
<pf-alert variant="info" header="Info alert title"></pf-alert> | ||
<pf-alert variant="success" header="Success alert title"></pf-alert> | ||
<pf-alert variant="warning" header="Warning alert title"></pf-alert> | ||
<pf-alert variant="danger" header="Danger alert title"></pf-alert> | ||
|
||
<h2> | ||
Alert Variations | ||
</h2> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
<p>Success alert description. This should tell the user more information about the alert.</p> | ||
<button slot="actions">View details</button> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
<button slot="actions">View details</button> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable> | ||
|
||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<p>Success alert description. This should tell the user more information about the alert. <a href="#">This is a link.</a></p> | ||
<button slot="actions">View details</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
<button slot="actions">Ignore</button> | ||
</pf-alert> | ||
|
||
<pf-alert header="Success alert title" variant="success" dismissable></pf-alert> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{% renderOverview %} | ||
<pf-alert></pf-alert> | ||
{% endrenderOverview %} | ||
|
||
{% band header="Usage" %}{% endband %} | ||
|
||
{% renderSlots %}{% endrenderSlots %} | ||
|
||
{% renderAttributes %}{% endrenderAttributes %} | ||
|
||
{% renderMethods %}{% endrenderMethods %} | ||
|
||
{% renderEvents %}{% endrenderEvents %} | ||
|
||
{% renderCssCustomProperties %}{% endrenderCssCustomProperties %} | ||
|
||
{% renderCssParts %}{% endrenderCssParts %} |
Oops, something went wrong.