@patternfly/react-core 5.2.0-prerelease.6 → 5.2.0-prerelease.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/Chip/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/DragDrop/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/Text/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/Tile/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/favorites/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/Alert/examples/Alert.md +142 -103
- package/src/components/Button/examples/Button.md +1 -1
- package/src/demos/CardDemos.md +16 -2933
- package/src/demos/{Card/Card.md → CardView/CardView.md} +1 -1
- package/src/demos/{Card → CardView}/examples/CardView.tsx +1 -1
- package/src/demos/PrimaryDetail.md +2 -2
- package/src/demos/examples/Card/CardAggregateStatus.tsx +249 -0
- package/src/demos/examples/Card/CardDetails.tsx +95 -0
- package/src/demos/examples/Card/CardEventsView.tsx +154 -0
- package/src/demos/examples/Card/CardHorizontalGrid.tsx +240 -0
- package/src/demos/examples/Card/CardHorizontalSplit.tsx +30 -0
- package/src/demos/examples/Card/CardLogView.tsx +118 -0
- package/src/demos/examples/Card/CardNested.tsx +532 -0
- package/src/demos/examples/Card/CardStatus.tsx +262 -0
- package/src/demos/examples/Card/CardStatusTabbed.tsx +113 -0
- package/src/demos/examples/Card/CardTrendDemo1.tsx +106 -0
- package/src/demos/examples/Card/CardTrendDemo2.tsx +76 -0
- package/src/demos/examples/Card/CardUtilizationDemo1.tsx +109 -0
- package/src/demos/examples/Card/CardUtilizationDemo2.tsx +103 -0
- package/src/demos/examples/Card/CardUtilizationDemo3.tsx +174 -0
- package/src/demos/examples/Card/CardUtilizationDemo4.tsx +50 -0
- package/src/demos/examples/Card/CardWithAccordion.tsx +514 -0
- /package/src/demos/{Card/examples/CardData.jsx → CardView/examples/CardViewData.jsx} +0 -0
|
@@ -14,7 +14,7 @@ import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
|
|
|
14
14
|
import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
|
|
15
15
|
import buttonStyles from '@patternfly/react-styles/css/components/Button/button';
|
|
16
16
|
|
|
17
|
-
## Alert examples
|
|
17
|
+
## Alert examples
|
|
18
18
|
|
|
19
19
|
### Alert variants
|
|
20
20
|
|
|
@@ -38,22 +38,23 @@ import { Alert } from '@patternfly/react-core';
|
|
|
38
38
|
<Alert variant="success" title="Success alert title" ouiaId="SuccessAlert" />
|
|
39
39
|
<Alert variant="warning" title="Warning alert title" ouiaId="WarningAlert" />
|
|
40
40
|
<Alert variant="danger" title="Danger alert title" ouiaId="DangerAlert" />
|
|
41
|
-
</React.Fragment
|
|
41
|
+
</React.Fragment>;
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### Alert variations
|
|
45
45
|
|
|
46
|
-
PatternFly supports several properties and variations that can be used to add extra content to an alert.
|
|
46
|
+
PatternFly supports several properties and variations that can be used to add extra content to an alert.
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
- As demonstrated in the 1st variation below, use the `actionLinks` property to add one or more `<AlertActionLink>` components that place links beneath the alert message. You must pass in `href` and `component="a"` properties to have an `<AlertActionLink>` act as a proper link, rather than as a button.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
- As demonstrated in the 2nd variation below, use a native HTML `<a>` element to add links within an alert message.
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
- As demonstrated in the 3rd variation below, use the `actionClose` property to add an `<AlertActionCloseButton>` component, which can be used to manage and customize alert dismissals.
|
|
53
|
+
|
|
54
|
+
- As demonstrated in the 4th and 5th variations below, use the `component` property to set the element for an alert title.
|
|
55
|
+
- If there is not a description passed via `children` prop, then the `component` prop should be set to a non-heading element such as a `span` or `div`.
|
|
56
|
+
- If there is a description passed via `children` prop, then the `component` prop should be a heading element. Headings should be ordered by their level and heading levels should not be skipped. For example, a heading of an `h2` level should not be followed directly by an `h4`.
|
|
53
57
|
|
|
54
|
-
* As demonstrated in the 5th and 6th variations below, use the `component` property to set the element for an alert title.
|
|
55
|
-
* If the `description` prop is not passed in, then the `component` prop should be set to a non-heading element such as a `span` or `div`.
|
|
56
|
-
* If the `description` prop is passed in, then the `component` prop should be a heading element. Headings should be ordered by their level and heading levels should not be skipped. For example, a heading of an `h2` level should not be followed directly by an `h4`.
|
|
57
58
|
```ts
|
|
58
59
|
import React from 'react';
|
|
59
60
|
import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
|
|
@@ -62,17 +63,22 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
62
63
|
<Alert
|
|
63
64
|
variant="success"
|
|
64
65
|
title="Success alert title"
|
|
65
|
-
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
66
66
|
actionLinks={
|
|
67
67
|
<React.Fragment>
|
|
68
|
-
<AlertActionLink
|
|
69
|
-
|
|
68
|
+
<AlertActionLink component="a" href="#">
|
|
69
|
+
View details
|
|
70
|
+
</AlertActionLink>
|
|
71
|
+
<AlertActionLink // eslint-disable-next-line no-console
|
|
72
|
+
onClick={() => console.log('Clicked on Ignore')}
|
|
73
|
+
>
|
|
74
|
+
Ignore
|
|
75
|
+
</AlertActionLink>
|
|
70
76
|
</React.Fragment>
|
|
71
77
|
}
|
|
72
78
|
>
|
|
73
79
|
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
74
80
|
</Alert>
|
|
75
|
-
<Alert variant="success" title="Success alert title"
|
|
81
|
+
<Alert variant="success" title="Success alert title">
|
|
76
82
|
<p>
|
|
77
83
|
Success alert description. This should tell the user more information about the alert.{' '}
|
|
78
84
|
<a href="#">This is a link.</a>
|
|
@@ -81,21 +87,18 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
81
87
|
<Alert
|
|
82
88
|
variant="success"
|
|
83
89
|
title="Success alert title"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
</React.Fragment>
|
|
90
|
-
}
|
|
91
|
-
/>
|
|
92
|
-
<Alert variant="success" title="Success alert title" actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />} />
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
91
|
+
actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
|
|
92
|
+
>
|
|
93
|
+
<p>Short alert description.</p>
|
|
94
|
+
</Alert>
|
|
93
95
|
<Alert variant="success" title="div success alert title" component="div" />
|
|
94
|
-
<Alert variant="success" title="h6 Success alert title" component="h6"
|
|
95
|
-
<p>Short alert description
|
|
96
|
+
<Alert variant="success" title="h6 Success alert title" component="h6">
|
|
97
|
+
<p>Short alert description.</p>
|
|
96
98
|
</Alert>
|
|
97
|
-
|
|
99
|
+
</React.Fragment>;
|
|
98
100
|
```
|
|
101
|
+
|
|
99
102
|
### Alert timeout
|
|
100
103
|
|
|
101
104
|
Use the `timeout` property to automatically dismiss an alert after a period of time. If set to `true`, the `timeout` will be 8000 milliseconds. Provide a specific value to dismiss the alert after a different number of milliseconds.
|
|
@@ -106,29 +109,46 @@ import { Alert, AlertActionLink, AlertGroup, Button } from '@patternfly/react-co
|
|
|
106
109
|
|
|
107
110
|
const AlertTimeout: React.FunctionComponent = () => {
|
|
108
111
|
const [alerts, setAlerts] = React.useState<React.ReactNode[]>([]);
|
|
112
|
+
const [newAlertKey, setNewAlertKey] = React.useState<number>(0);
|
|
113
|
+
|
|
109
114
|
const onClick = () => {
|
|
110
115
|
const timeout = 8000;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
setNewAlertKey((key) => key + 1);
|
|
117
|
+
setAlerts((prevAlerts) => {
|
|
118
|
+
return [
|
|
119
|
+
...prevAlerts,
|
|
120
|
+
<Alert
|
|
121
|
+
title="Default timeout Alert"
|
|
122
|
+
timeout={timeout}
|
|
123
|
+
actionLinks={
|
|
124
|
+
<React.Fragment>
|
|
125
|
+
<AlertActionLink component="a" href="#">
|
|
126
|
+
View details
|
|
127
|
+
</AlertActionLink>
|
|
128
|
+
<AlertActionLink // eslint-disable-next-line no-console
|
|
129
|
+
onClick={() => console.log('Clicked on Ignore')}
|
|
130
|
+
>
|
|
131
|
+
Ignore
|
|
132
|
+
</AlertActionLink>
|
|
133
|
+
</React.Fragment>
|
|
134
|
+
}
|
|
135
|
+
key={newAlertKey}
|
|
136
|
+
>
|
|
119
137
|
This alert will dismiss after {`${timeout / 1000} seconds`}
|
|
120
138
|
</Alert>
|
|
121
|
-
]
|
|
139
|
+
];
|
|
122
140
|
});
|
|
123
|
-
}
|
|
141
|
+
};
|
|
124
142
|
|
|
125
143
|
return (
|
|
126
144
|
<React.Fragment>
|
|
127
|
-
<Button variant="secondary" onClick={onClick}>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
145
|
+
<Button variant="secondary" onClick={onClick}>
|
|
146
|
+
Add alert
|
|
147
|
+
</Button>
|
|
148
|
+
<Button variant="secondary" onClick={() => setAlerts([])}>
|
|
149
|
+
Remove all alerts
|
|
150
|
+
</Button>
|
|
151
|
+
<AlertGroup isLiveRegion>{alerts}</AlertGroup>
|
|
132
152
|
</React.Fragment>
|
|
133
153
|
);
|
|
134
154
|
};
|
|
@@ -138,7 +158,7 @@ const AlertTimeout: React.FunctionComponent = () => {
|
|
|
138
158
|
|
|
139
159
|
An alert can contain additional, hidden information that is made visible when users click a caret icon. This information can be expanded and collapsed each time the icon is clicked.
|
|
140
160
|
|
|
141
|
-
It is not recommended to use an expandable alert with a `timeout` in a [toast alert group](/components/alert#toast-alert-group) because the alert could timeout before users have time to interact with and view the entire alert.
|
|
161
|
+
It is not recommended to use an expandable alert with a `timeout` in a [toast alert group](/components/alert#toast-alert-group) because the alert could timeout before users have time to interact with and view the entire alert.
|
|
142
162
|
|
|
143
163
|
See the [toast alert considerations](/components/alert/accessibility#toast-alerts) section of the alert accessibility documentation to understand the accessibility risks associated with using toast alerts.
|
|
144
164
|
|
|
@@ -151,13 +171,8 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
151
171
|
isExpandable
|
|
152
172
|
variant="success"
|
|
153
173
|
title="Success alert title"
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
<React.Fragment>
|
|
157
|
-
<AlertActionLink onClick={() => alert('Clicked on View details')}>View details</AlertActionLink>
|
|
158
|
-
<AlertActionLink onClick={() => alert('Clicked on Ignore')}>Ignore</AlertActionLink>
|
|
159
|
-
</React.Fragment>
|
|
160
|
-
}
|
|
174
|
+
// eslint-disable-next-line no-console
|
|
175
|
+
actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
|
|
161
176
|
>
|
|
162
177
|
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
163
178
|
</Alert>
|
|
@@ -166,17 +181,22 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
166
181
|
isInline
|
|
167
182
|
variant="success"
|
|
168
183
|
title="Success alert title"
|
|
169
|
-
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
170
184
|
actionLinks={
|
|
171
185
|
<React.Fragment>
|
|
172
|
-
<AlertActionLink
|
|
173
|
-
|
|
186
|
+
<AlertActionLink component="a" href="#">
|
|
187
|
+
View details
|
|
188
|
+
</AlertActionLink>
|
|
189
|
+
<AlertActionLink // eslint-disable-next-line no-console
|
|
190
|
+
onClick={() => console.log('Clicked on Ignore')}
|
|
191
|
+
>
|
|
192
|
+
Ignore
|
|
193
|
+
</AlertActionLink>
|
|
174
194
|
</React.Fragment>
|
|
175
|
-
}
|
|
195
|
+
}
|
|
176
196
|
>
|
|
177
197
|
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
178
198
|
</Alert>
|
|
179
|
-
</React.Fragment
|
|
199
|
+
</React.Fragment>;
|
|
180
200
|
```
|
|
181
201
|
|
|
182
202
|
### Truncated alerts
|
|
@@ -188,16 +208,28 @@ import React from 'react';
|
|
|
188
208
|
import { Alert } from '@patternfly/react-core';
|
|
189
209
|
|
|
190
210
|
<React.Fragment>
|
|
191
|
-
<Alert
|
|
211
|
+
<Alert
|
|
212
|
+
variant="info"
|
|
213
|
+
truncateTitle={1}
|
|
214
|
+
title={`
|
|
192
215
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
193
|
-
`}
|
|
194
|
-
|
|
216
|
+
`}
|
|
217
|
+
/>
|
|
218
|
+
<Alert
|
|
219
|
+
variant="warning"
|
|
220
|
+
truncateTitle={2}
|
|
221
|
+
title={`
|
|
195
222
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
196
|
-
`}
|
|
197
|
-
|
|
223
|
+
`}
|
|
224
|
+
/>
|
|
225
|
+
<Alert
|
|
226
|
+
variant="danger"
|
|
227
|
+
truncateTitle={3}
|
|
228
|
+
title={`
|
|
198
229
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pellentesque neque cursus enim fringilla tincidunt. Proin lobortis aliquam dictum. Nam vel ullamcorper nulla, nec blandit dolor. Vivamus pellentesque neque justo, nec accumsan nulla rhoncus id. Suspendisse mollis, tortor quis faucibus volutpat, sem leo fringilla turpis, ac lacinia augue metus in nulla. Cras vestibulum lacinia orci. Pellentesque sodales consequat interdum. Sed porttitor tincidunt metus nec iaculis. Pellentesque non commodo justo. Morbi feugiat rhoncus neque, vitae facilisis diam aliquam nec. Sed dapibus vitae quam at tristique. Nunc vel commodo mi. Mauris et rhoncus leo.
|
|
199
|
-
`}
|
|
200
|
-
|
|
230
|
+
`}
|
|
231
|
+
/>
|
|
232
|
+
</React.Fragment>;
|
|
201
233
|
```
|
|
202
234
|
|
|
203
235
|
### Custom icons
|
|
@@ -219,7 +251,7 @@ import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
|
|
|
219
251
|
<Alert customIcon={<DatabaseIcon />} variant="success" title="Success alert title" />
|
|
220
252
|
<Alert customIcon={<ServerIcon />} variant="warning" title="Warning alert title" />
|
|
221
253
|
<Alert customIcon={<LaptopIcon />} variant="danger" title="Danger alert title" />
|
|
222
|
-
</React.Fragment
|
|
254
|
+
</React.Fragment>;
|
|
223
255
|
```
|
|
224
256
|
|
|
225
257
|
### Inline alerts variants
|
|
@@ -235,8 +267,9 @@ import { Alert } from '@patternfly/react-core';
|
|
|
235
267
|
<Alert variant="success" isInline title="Success inline alert title" />
|
|
236
268
|
<Alert variant="warning" isInline title="Warning inline alert title" />
|
|
237
269
|
<Alert variant="danger" isInline title="Danger inline alert title" />
|
|
238
|
-
</React.Fragment
|
|
270
|
+
</React.Fragment>;
|
|
239
271
|
```
|
|
272
|
+
|
|
240
273
|
### Inline alert variations
|
|
241
274
|
|
|
242
275
|
All general alert variations can use the `isInline` property to apply inline styling.
|
|
@@ -249,17 +282,22 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
249
282
|
isInline
|
|
250
283
|
variant="success"
|
|
251
284
|
title="Success alert title"
|
|
252
|
-
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
253
285
|
actionLinks={
|
|
254
286
|
<React.Fragment>
|
|
255
|
-
<AlertActionLink
|
|
256
|
-
|
|
287
|
+
<AlertActionLink component="a" href="#">
|
|
288
|
+
View details
|
|
289
|
+
</AlertActionLink>
|
|
290
|
+
<AlertActionLink // eslint-disable-next-line no-console
|
|
291
|
+
onClick={() => console.log('Clicked on Ignore')}
|
|
292
|
+
>
|
|
293
|
+
Ignore
|
|
294
|
+
</AlertActionLink>
|
|
257
295
|
</React.Fragment>
|
|
258
296
|
}
|
|
259
297
|
>
|
|
260
298
|
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
261
299
|
</Alert>
|
|
262
|
-
<Alert isInline variant="success" title="Success alert title"
|
|
300
|
+
<Alert isInline variant="success" title="Success alert title">
|
|
263
301
|
<p>
|
|
264
302
|
Success alert description. This should tell the user more information about the alert.{' '}
|
|
265
303
|
<a href="#">This is a link.</a>
|
|
@@ -269,22 +307,16 @@ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/reac
|
|
|
269
307
|
isInline
|
|
270
308
|
variant="success"
|
|
271
309
|
title="Success alert title"
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
variant="success"
|
|
283
|
-
title="Success alert title"
|
|
284
|
-
actionClose={<AlertActionCloseButton onClose={() => alert('Clicked the close button')} />}
|
|
285
|
-
/>
|
|
286
|
-
<Alert isInline variant="success" title="Success alert title" />
|
|
287
|
-
</React.Fragment>
|
|
310
|
+
// eslint-disable-next-line no-console
|
|
311
|
+
actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
|
|
312
|
+
>
|
|
313
|
+
<p>Short alert description.</p>
|
|
314
|
+
</Alert>
|
|
315
|
+
<Alert isInline variant="success" title="div success alert title" component="div" />
|
|
316
|
+
<Alert isInline variant="success" title="h6 Success alert title" component="h6">
|
|
317
|
+
<p>Short alert description.</p>
|
|
318
|
+
</Alert>
|
|
319
|
+
</React.Fragment>;
|
|
288
320
|
```
|
|
289
321
|
|
|
290
322
|
### Plain inline alert variants
|
|
@@ -300,7 +332,7 @@ import { Alert } from '@patternfly/react-core';
|
|
|
300
332
|
<Alert variant="success" isInline isPlain title="Success inline alert title" />
|
|
301
333
|
<Alert variant="warning" isInline isPlain title="Warning inline alert title" />
|
|
302
334
|
<Alert variant="danger" isInline isPlain title="Danger inline alert title" />
|
|
303
|
-
</React.Fragment
|
|
335
|
+
</React.Fragment>;
|
|
304
336
|
```
|
|
305
337
|
|
|
306
338
|
### Plain inline alert variations
|
|
@@ -309,15 +341,10 @@ It is not recommended to use a plain inline alert with `actionClose` nor `action
|
|
|
309
341
|
|
|
310
342
|
```ts
|
|
311
343
|
import React from 'react';
|
|
312
|
-
import { Alert
|
|
313
|
-
<Alert
|
|
314
|
-
isInline
|
|
315
|
-
isPlain
|
|
316
|
-
variant="success"
|
|
317
|
-
title="Success alert title"
|
|
318
|
-
>
|
|
344
|
+
import { Alert } from '@patternfly/react-core';
|
|
345
|
+
<Alert isInline isPlain variant="success" title="Success alert title">
|
|
319
346
|
<p>Success alert description. This should tell the user more information about the alert.</p>
|
|
320
|
-
</Alert
|
|
347
|
+
</Alert>;
|
|
321
348
|
```
|
|
322
349
|
|
|
323
350
|
### Static live region alerts
|
|
@@ -335,7 +362,8 @@ import { Alert, AlertActionCloseButton } from '@patternfly/react-core';
|
|
|
335
362
|
isLiveRegion
|
|
336
363
|
variant="info"
|
|
337
364
|
title="Default live region configuration"
|
|
338
|
-
|
|
365
|
+
// eslint-disable-next-line no-console
|
|
366
|
+
actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
|
|
339
367
|
>
|
|
340
368
|
This alert uses the recommended <code>isLiveRegion</code> prop to automatically set ARIA attributes and CSS classes.
|
|
341
369
|
</Alert>
|
|
@@ -345,12 +373,13 @@ import { Alert, AlertActionCloseButton } from '@patternfly/react-core';
|
|
|
345
373
|
aria-atomic="true"
|
|
346
374
|
variant="info"
|
|
347
375
|
title="Customized live region"
|
|
348
|
-
|
|
376
|
+
// eslint-disable-next-line no-console
|
|
377
|
+
actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
|
|
349
378
|
>
|
|
350
|
-
You can alternatively omit the <code>isLiveRegion</code> prop to specify ARIA attributes and CSS manually on
|
|
351
|
-
|
|
379
|
+
You can alternatively omit the <code>isLiveRegion</code> prop to specify ARIA attributes and CSS manually on the
|
|
380
|
+
containing element.
|
|
352
381
|
</Alert>
|
|
353
|
-
</React.Fragment
|
|
382
|
+
</React.Fragment>;
|
|
354
383
|
```
|
|
355
384
|
|
|
356
385
|
### Dynamic live region alerts
|
|
@@ -358,19 +387,22 @@ import { Alert, AlertActionCloseButton } from '@patternfly/react-core';
|
|
|
358
387
|
Alerts that are asynchronously appended into dynamic [alert groups](/components/alert/#alert-group-examples) via the `isLiveRegion` property will be announced to assistive technology the moment the change happens, following the strategy used for `aria-atomic`, which defaults to false. This means only changes of type "addition" will be announced.
|
|
359
388
|
|
|
360
389
|
```ts file="AlertDynamicLiveRegion.tsx"
|
|
390
|
+
|
|
361
391
|
```
|
|
362
392
|
|
|
363
|
-
### Asynchronous live region alerts
|
|
393
|
+
### Asynchronous live region alerts
|
|
394
|
+
|
|
395
|
+
This example shows how an alert could be triggered by an asynchronous event in the application. Note that you can customize how the alert will be announced to assistive technology. See the [alert accessibility](/components/alert/accessibility/) for more information.
|
|
364
396
|
|
|
365
|
-
This example shows how an alert could be triggered by an asynchronous event in the application. Note that you can customize how the alert will be announced to assistive technology. See the [https://www.patternfly.org/v4/components/alert/accessibility](alert accessibility) for more information.
|
|
366
397
|
```ts file="AlertAsyncLiveRegion.tsx"
|
|
398
|
+
|
|
367
399
|
```
|
|
368
400
|
|
|
369
401
|
## Alert group examples
|
|
370
402
|
|
|
371
403
|
An alert group stacks and positions 2 or more alerts in a live region, either in a layer over the main content of a page or inline with the page content. Alert groups should always rank alerts by age, stacking new alerts on top of old ones as they surface.
|
|
372
404
|
|
|
373
|
-
### Alert group variants
|
|
405
|
+
### Alert group variants
|
|
374
406
|
|
|
375
407
|
Alert groups can be one of the following variants:
|
|
376
408
|
|
|
@@ -387,15 +419,17 @@ Dynamic alerts that are generated after the page initially loads must be appende
|
|
|
387
419
|
All alert group variants may combine multiple [alert variants](/components/alert) For example, the following static inline alert group includes one "success" alert and one "info" alert.
|
|
388
420
|
|
|
389
421
|
```ts file="./AlertGroupStatic.tsx"
|
|
422
|
+
|
|
390
423
|
```
|
|
391
424
|
|
|
392
425
|
### Toast alert group
|
|
393
426
|
|
|
394
|
-
Toast alert groups are created by passing in the `isToast` and `isLiveRegion` properties.
|
|
427
|
+
Toast alert groups are created by passing in the `isToast` and `isLiveRegion` properties.
|
|
395
428
|
|
|
396
429
|
Click the buttons in the example below to add alerts to a toast group.
|
|
397
430
|
|
|
398
431
|
```ts file="./AlertGroupToast.tsx"
|
|
432
|
+
|
|
399
433
|
```
|
|
400
434
|
|
|
401
435
|
### Toast alert group with overflow capture
|
|
@@ -404,11 +438,12 @@ Users will see an overflow message once a predefined number of alerts are displa
|
|
|
404
438
|
|
|
405
439
|
In the following example, an overflow message will appear when more than 4 alerts would be shown. When a 5th alert would appear, an overflow message is shown instead.
|
|
406
440
|
|
|
407
|
-
When an overflow message appears in an `AlertGroup` using the `isLiveRegion` property, the "view 1 more alert" text label will be announced, but the alert message will not.
|
|
441
|
+
When an overflow message appears in an `AlertGroup` using the `isLiveRegion` property, the "view 1 more alert" text label will be announced, but the alert message will not.
|
|
408
442
|
|
|
409
|
-
Users navigating via keyboard or another assistive technology will need a way to navigate to and reveal hidden alerts before they disappear. Alternatively, there should be a place where notifications or alerts are collected to be viewed or read later.
|
|
443
|
+
Users navigating via keyboard or another assistive technology will need a way to navigate to and reveal hidden alerts before they disappear. Alternatively, there should be a place where notifications or alerts are collected to be viewed or read later.
|
|
410
444
|
|
|
411
445
|
```ts file="AlertGroupToastOverflowCapture.tsx"
|
|
446
|
+
|
|
412
447
|
```
|
|
413
448
|
|
|
414
449
|
### Asynchronous alert groups
|
|
@@ -418,6 +453,7 @@ The following example shows how alerts can be triggered by an asynchronous event
|
|
|
418
453
|
See the [alert accessibility tab](/components/alert/accessibility) for more information on customizing this behavior.
|
|
419
454
|
|
|
420
455
|
```ts file="./AlertGroupAsync.tsx"
|
|
456
|
+
|
|
421
457
|
```
|
|
422
458
|
|
|
423
459
|
### Dynamic alert groups
|
|
@@ -425,13 +461,15 @@ See the [alert accessibility tab](/components/alert/accessibility) for more info
|
|
|
425
461
|
Click the buttons in the example below to add dynamic alerts to a group.
|
|
426
462
|
|
|
427
463
|
```ts file="./AlertGroupSingularDynamic.tsx"
|
|
464
|
+
|
|
428
465
|
```
|
|
429
466
|
|
|
430
467
|
### Dynamic alert group with overflow message
|
|
431
468
|
|
|
432
|
-
In the following example, there can be a maximum of 4 alerts shown at once.
|
|
469
|
+
In the following example, there can be a maximum of 4 alerts shown at once.
|
|
433
470
|
|
|
434
471
|
```ts file="AlertGroupSingularDynamicOverflow.tsx"
|
|
472
|
+
|
|
435
473
|
```
|
|
436
474
|
|
|
437
475
|
### Multiple dynamic alert groups
|
|
@@ -439,4 +477,5 @@ In the following example, there can be a maximum of 4 alerts shown at once.
|
|
|
439
477
|
You may add multiple alerts to an alert group at once. Click the "add alert collection" button in the example below to add a batch of 3 toast alerts to a group.
|
|
440
478
|
|
|
441
479
|
```ts file="./AlertGroupMultipleDynamic.tsx"
|
|
480
|
+
|
|
442
481
|
```
|
|
@@ -32,7 +32,7 @@ PatternFly supports several button styling variants to be used in different scen
|
|
|
32
32
|
| Warning | Warning buttons may be used for actions that change an important setting or behavior, but not in a destructive or irreversible way. |
|
|
33
33
|
| Link | Links are labeled, but have no background or border. Use for actions that require less emphasis, actions that navigate users to another page within the same window, and/or actions that navigate to external pages in a new window. Links may be placed inline with text using the `isInline` property.|
|
|
34
34
|
| Plain | Plain buttons have no styling and are intended to be labeled with icons. |
|
|
35
|
-
| Control | Control buttons can be labeled with text or icons. Primarily intended to be paired with other controls in an [input group](
|
|
35
|
+
| Control | Control buttons can be labeled with text or icons. Primarily intended to be paired with other controls in an [input group](/components/input-group). |
|
|
36
36
|
|
|
37
37
|
### Disabled buttons
|
|
38
38
|
|