-
Notifications
You must be signed in to change notification settings - Fork 106
pf-alert new elment #2948
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
Closed
Closed
pf-alert new elment #2948
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7bea58a
feat(alert): add pf-alert component and update package/config
chubara62372 a6e20b9
chore(alert): add all remaining files
chubara62372 8bb0ac6
feat(elements): add pf-alert demo and test HTML files
chubara62372 db736b4
feat(elements): update pf-alert demo and test HTML files
chubara62372 7722061
feat(alert): initial implementation of pf-alert element
chubara62372 16741e5
feat(alert): add basic pf-alert functionality
chubara62372 5a84bea
feat(alert): pf-alert Shalavi Latest
chubara62372 27c4841
fix(alert): changes in the colors and size of the icons in the design
chubara62372 8fb4191
feat(alert): save work
chubara62372 3277792
fix(alert): fix pf-alert component
chubara62372 6ee9d73
feat(alert): change x and arrow color on click in the expandable page
chubara62372 fb532a7
feat(alert): add change-set
chubara62372 40b3206
feat(alert): changes after pull request
chubara62372 5b992f2
feat(alert): work in progress on pf-alert
chubara62372 d7ab2fb
feat(alert): changing font size,
chubara62372 d447769
chore: add changeset--no-verify
chubara62372 47b2233
chore(monitor): update monitor and arrange ESLINT permissions + merge
chubara62372 4e6075b
chore(monitor):MD design
chubara62372 757a104
feat(alert): restore files and apply renaming
chubara62372 0d204d6
chore(monitor)npm ci
chubara62372 d3459ba
chore(monitor)tests
chubara62372 67ce074
chore(monitor)Creating a description list element
chubara62372 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
chubara62372 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,14 @@ | ||
|
|
||
| --- | ||
| "@patternfly/elements": minor | ||
| --- | ||
|
|
||
| :sparkles: Added `<pf-alert>` | ||
|
|
||
| An alert is a banner used to notify a user about a change in status or communicate other information. It can be created programmatically or declared in markup. | ||
|
|
||
| ```html | ||
| <pf-alert state="success"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| </pf-alert> | ||
| ``` |
This file contains hidden or 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
chubara62372 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,78 @@ | ||
| # pf-alert | ||
|
|
||
| The `pf-alert` web component displays PatternFly-styled alerts. It can be used inline in pages or as a toast notification. Alerts support several visual states (for example: `info`, `success`, `warning`, `danger`), an optional header slot, body content, and an `actions` slot for interactive controls. | ||
|
|
||
| ## Installation | ||
|
|
||
| Import the element in your page or application as an ES module: | ||
|
|
||
| ```html | ||
| <script type="module"> | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| </script> | ||
| ``` | ||
|
|
||
| ## Basic usage | ||
|
|
||
| Inline alert example: | ||
|
|
||
| ```html | ||
| <pf-alert state="success"> | ||
| <h3 slot="header">Success</h3> | ||
| The operation completed successfully. | ||
| <div slot="actions"> | ||
| <pf-button variant="link">Details</pf-button> | ||
| </div> | ||
| </pf-alert> | ||
| ``` | ||
|
|
||
| Toast usage (static helper): | ||
|
|
||
| ```html | ||
| <script type="module"> | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
|
|
||
| // Show a simple toast notification | ||
| PfAlert.toast({ message: 'Saved', heading: 'Success', state: 'success' }); | ||
| </script> | ||
| ``` | ||
|
|
||
| ## API | ||
|
|
||
| ### Attributes / Properties | ||
| - `state` (string) — Visual state of the alert. Common values: `neutral`, `info`, `success`, `warning`, `danger`, `custom`, `cogear`. Default: `neutral`. | ||
| - `variant` (string) — Visual variant: `inline`, `toast`, or `alternate`. | ||
| - `dismissable` (boolean) — When true, a close control is shown and the alert will emit a close event when dismissed. | ||
|
|
||
| > See `elements/pf-alert/pf-alert.ts` for exact property types, defaults, and any additional options. | ||
|
|
||
| ### Slots | ||
| - `header` — Slot for the heading (typically an `<h3>`). | ||
| - default (unnamed) — Main body/content of the alert. | ||
| - `actions` — Buttons or links for user actions (e.g. `<pf-button slot="actions">`). | ||
|
|
||
| ### Events | ||
| - `close` (AlertCloseEvent) — Fired when the alert is closed (either via UI or programmatically). The event contains the action (e.g. `'close'`, `'dismiss'`, or `'confirm'`). Check the component source for exact payload. | ||
|
|
||
| ### Methods | ||
| - `static toast(options)` — Static helper to show a toast notification. Options typically include `message`, `heading`, `state`, `persistent`, and `actions`. | ||
|
|
||
| ## Styling | ||
|
|
||
| The component exposes CSS parts and custom properties for styling. Typical part(s): `::part(container)` for the main container. See the component stylesheet (`pf-alert.css`) for a list of CSS custom properties (colors, spacing, durations) you can override. | ||
|
|
||
| ## Accessibility | ||
|
|
||
| - Toasts use `role="status"` and `aria-live="polite"` to announce messages to assistive technologies. Inline alerts should be used in-context with appropriate semantic markup. | ||
|
|
||
| ## Notes & tips | ||
|
|
||
| - Use the `actions` slot to add interactive elements and listen for their events on the page. | ||
| - For persistent toasts set the `persistent` option when calling `PfAlert.toast(...)`. | ||
| - If you need the exact event names/shape or CSS variables, I can extract and add them from the component source. | ||
|
|
||
| --- | ||
| If you want, I can also: | ||
| - Add a short section listing every CSS custom property the component exposes. | ||
| - Add a copyable example showing how to listen for the alert `close` event. | ||
| - Add a brief section demonstrating integration in React or Angular. |
This file contains hidden or 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,38 @@ | ||
| <div class="demo-description"> | ||
| <section class="alerts-page"> | ||
| <pf-alert class="a" state="cogear"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| </pf-alert> | ||
| <pf-alert class="b" state="cogear"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| </pf-alert> | ||
| </section> | ||
| </div> | ||
|
|
||
| <style> | ||
| .alerts-page pf-alert::part(container) { | ||
| padding-top: 1rem; | ||
| padding-right: 1rem; | ||
| padding-bottom: 1rem; | ||
| padding-left: 1rem; | ||
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); | ||
|
|
||
| } | ||
|
|
||
| pf-alert.a::part(container) { | ||
| background-color: #fff; | ||
| } | ||
|
|
||
| pf-alert.b::part(container) { | ||
| background-color: #f3faf2; | ||
| } | ||
|
|
||
| .demo-description { | ||
| padding: 1cm; | ||
| /* Maintain a distance of one centimeter on all sides */ | ||
| } | ||
| </style> | ||
| <script type="module"> | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> |
This file contains hidden or 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,50 @@ | ||
| <div class="demo-description"> | ||
| <section class="alerts-page demo-with-arrows"> | ||
| <pf-alert class="white-alerts-page" state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| <pf-button slot="actions" variant="link" data-action="dismiss">View details</pf-button> | ||
| <pf-button slot="actions" variant="link" data-action="confirm">lgnore</pf-button> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert class="white-alerts-page" state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title (expanded)</h3> | ||
| <p>Success alert description. This should tell the user more information about the alert.</p> | ||
| <pf-button slot="actions" variant="link" data-action="dismiss">View details</pf-button> | ||
| <pf-button slot="actions" variant="link" data-action="confirm">lgnore</pf-button> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| <pf-button slot="actions" variant="link" data-action="dismiss">View details</pf-button> | ||
| <pf-button slot="actions" variant="link" data-action="confirm">lgnore</pf-button> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title (expanded)</h3> | ||
| <p>Success alert description. This should tell the user more information about the alert.</p> | ||
| <pf-button slot="actions" variant="link" data-action="dismiss">View details</pf-button> | ||
| <pf-button slot="actions" variant="link" data-action="confirm">lgnore</pf-button> | ||
| </pf-alert> | ||
| </section> | ||
| </div> | ||
| <style> | ||
| pf-alert.white-alerts-page::part(container) { | ||
| background-color: #fff; | ||
| } | ||
|
|
||
| .alerts-page pf-alert::part(container) { | ||
| padding-top: 1rem; | ||
| padding-right: 1rem; | ||
| padding-bottom: 1rem; | ||
| padding-left: 1rem; | ||
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); | ||
| } | ||
| .demo-description{ | ||
| padding: 1cm; | ||
| } | ||
| </style> | ||
|
|
||
| <script type="module"> | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> |
chubara62372 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,51 @@ | ||
| <div class="demo-description"> | ||
| <section class="alerts-page"> | ||
| <pf-alert class="white-alerts-page" state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| <p>Success alert description. This should tell the user more information about the alert.</p> | ||
| <pf-button slot="actions" variant="link" data-action="dismiss">View details</pf-button> | ||
| <pf-button slot="actions" variant="link" data-action="confirm">lgnore</pf-button> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert class="white-alerts-page" state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| <p>Success alert description. This should tell the user more information about the alert. | ||
| <pf-button slot="actions" variant="link" style="text-decoration:none; color:#06c; font-size:0.875rem;">This is | ||
| a link.</pf-button> | ||
| </p> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| <pf-button slot="actions" variant="link" data-action="dismiss">View details</pf-button> | ||
| <pf-button slot="actions" variant="link" data-action="confirm">lgnore</pf-button> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="success" dismissable data-on-close="prevent-default"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| </pf-alert> | ||
| </section> | ||
| </div> | ||
|
|
||
| <style> | ||
| .white-alerts-page pf-alert::part(container) { | ||
| background-color: var(--pf-global--BackgroundColor--100); | ||
| } | ||
|
|
||
| .alerts-page pf-alert::part(container) { | ||
| padding-top: 1rem; | ||
| padding-right: 1rem; | ||
| padding-bottom: 1rem; | ||
| padding-left: 1rem; | ||
| box-shadow: 0 4px 12px #fff; | ||
| } | ||
|
|
||
| .demo-description { | ||
| padding: 1cm; | ||
| } | ||
| </style> | ||
|
|
||
| <script type="module"> | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> |
This file contains hidden or 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,30 @@ | ||
| <div class="demo-description"> | ||
| <section class="alerts-page"> | ||
| <pf-alert state="Success"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| </pf-alert> | ||
| </section> | ||
| </div> | ||
|
|
||
| <style> | ||
| .alerts-page pf-alert::part(container) { | ||
| background-color: #fff; | ||
| border-top-color: transparent; | ||
| padding-top: 1rem; | ||
| padding-right: 1rem; | ||
| padding-bottom: 1rem; | ||
| padding-left: 1rem; | ||
| box-shadow: 0 4px 12px #fff; | ||
| } | ||
|
|
||
| .demo-description { | ||
| padding: 1cm; | ||
| } | ||
| </style> | ||
| <script type="module"> | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> | ||
|
|
||
|
|
||
|
|
This file contains hidden or 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,46 @@ | ||
| <div class="demo-description"> | ||
|
|
||
| <section class="white-alerts-page"> | ||
| <pf-alert state="custom"> | ||
| <h3 slot="header">Default alert title</h3> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="info"> | ||
| <h3 slot="header">Info alert title</h3> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="success"> | ||
| <h3 slot="header">Success alert title</h3> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="warning"> | ||
| <h3 slot="header">Warning alert title</h3> | ||
| </pf-alert> | ||
|
|
||
| <pf-alert state="danger"> | ||
| <h3 slot="header">Danger alert title</h3> | ||
| </pf-alert> | ||
| </section> | ||
| </div> | ||
|
|
||
|
|
||
|
|
||
| <style> | ||
| .white-alerts-page pf-alert::part(container) { | ||
| background-color: #fff; | ||
| padding-top: 1rem; | ||
| padding-right: 1rem; | ||
| padding-bottom: 1rem; | ||
| padding-left: 1rem; | ||
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25); | ||
|
|
||
| } | ||
| .demo-description{ | ||
| padding: 1cm; | ||
| } | ||
| </style> | ||
|
|
||
| <script type="module"> | ||
| import '@patternfly/elements/pf-alert/pf-alert.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.