@patternfly/react-core 6.4.1-prerelease.7 → 6.4.1-prerelease.9

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.
Files changed (136) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  21. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  22. package/dist/dynamic/components/Content/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/Drawer/package.json +1 -1
  28. package/dist/dynamic/components/Dropdown/package.json +1 -1
  29. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  30. package/dist/dynamic/components/EmptyState/package.json +1 -1
  31. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  32. package/dist/dynamic/components/FileUpload/package.json +1 -1
  33. package/dist/dynamic/components/Form/package.json +1 -1
  34. package/dist/dynamic/components/FormSelect/package.json +1 -1
  35. package/dist/dynamic/components/HelperText/package.json +1 -1
  36. package/dist/dynamic/components/Hint/package.json +1 -1
  37. package/dist/dynamic/components/Icon/package.json +1 -1
  38. package/dist/dynamic/components/InputGroup/package.json +1 -1
  39. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  40. package/dist/dynamic/components/Label/package.json +1 -1
  41. package/dist/dynamic/components/List/package.json +1 -1
  42. package/dist/dynamic/components/LoginPage/package.json +1 -1
  43. package/dist/dynamic/components/Masthead/package.json +1 -1
  44. package/dist/dynamic/components/Menu/package.json +1 -1
  45. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  46. package/dist/dynamic/components/Modal/package.json +1 -1
  47. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  48. package/dist/dynamic/components/Nav/package.json +1 -1
  49. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  50. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  51. package/dist/dynamic/components/NumberInput/package.json +1 -1
  52. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  53. package/dist/dynamic/components/Page/package.json +1 -1
  54. package/dist/dynamic/components/Pagination/package.json +1 -1
  55. package/dist/dynamic/components/Panel/package.json +1 -1
  56. package/dist/dynamic/components/Popover/package.json +1 -1
  57. package/dist/dynamic/components/Progress/package.json +1 -1
  58. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  59. package/dist/dynamic/components/Radio/package.json +1 -1
  60. package/dist/dynamic/components/SearchInput/package.json +1 -1
  61. package/dist/dynamic/components/Select/package.json +1 -1
  62. package/dist/dynamic/components/Sidebar/package.json +1 -1
  63. package/dist/dynamic/components/SimpleList/package.json +1 -1
  64. package/dist/dynamic/components/Skeleton/package.json +1 -1
  65. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  66. package/dist/dynamic/components/Slider/package.json +1 -1
  67. package/dist/dynamic/components/Spinner/package.json +1 -1
  68. package/dist/dynamic/components/Switch/package.json +1 -1
  69. package/dist/dynamic/components/Tabs/package.json +1 -1
  70. package/dist/dynamic/components/TextArea/package.json +1 -1
  71. package/dist/dynamic/components/TextInput/package.json +1 -1
  72. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  73. package/dist/dynamic/components/TimePicker/package.json +1 -1
  74. package/dist/dynamic/components/Timestamp/package.json +1 -1
  75. package/dist/dynamic/components/Title/package.json +1 -1
  76. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  77. package/dist/dynamic/components/Toolbar/package.json +1 -1
  78. package/dist/dynamic/components/Tooltip/package.json +1 -1
  79. package/dist/dynamic/components/TreeView/package.json +1 -1
  80. package/dist/dynamic/components/Truncate/package.json +1 -1
  81. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  82. package/dist/dynamic/components/Wizard/package.json +1 -1
  83. package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
  84. package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
  85. package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/package.json +1 -1
  90. package/dist/dynamic/helpers/AnimationsProvider/AnimationsProvider/package.json +1 -1
  91. package/dist/dynamic/helpers/AnimationsProvider/package.json +1 -1
  92. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  93. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  94. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  95. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  96. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  97. package/dist/dynamic/helpers/constants/package.json +1 -1
  98. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  99. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  100. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  101. package/dist/dynamic/helpers/package.json +1 -1
  102. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  103. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  104. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  105. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  106. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  107. package/dist/dynamic/helpers/util/package.json +1 -1
  108. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  109. package/dist/dynamic/layouts/Flex/package.json +1 -1
  110. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  111. package/dist/dynamic/layouts/Grid/package.json +1 -1
  112. package/dist/dynamic/layouts/Level/package.json +1 -1
  113. package/dist/dynamic/layouts/Split/package.json +1 -1
  114. package/dist/dynamic/layouts/Stack/package.json +1 -1
  115. package/dist/dynamic/styles/package.json +1 -1
  116. package/dist/umd/assets/{output-C9d8Dkf1.css → output-CJfbZNQh.css} +16481 -16481
  117. package/helpers/package.json +1 -1
  118. package/layouts/package.json +1 -1
  119. package/next/package.json +1 -1
  120. package/package.json +2 -2
  121. package/src/components/Alert/examples/Alert.md +26 -275
  122. package/src/components/Alert/examples/AlertCustomIcons.tsx +17 -0
  123. package/src/components/Alert/examples/AlertExpandable.tsx +36 -0
  124. package/src/components/Alert/examples/AlertInlineVariants.tsx +12 -0
  125. package/src/components/Alert/examples/AlertInlineVariations.tsx +45 -0
  126. package/src/components/Alert/examples/AlertPlainInlineVariants.tsx +12 -0
  127. package/src/components/Alert/examples/AlertPlainInlineVariations.tsx +7 -0
  128. package/src/components/Alert/examples/AlertStaticLiveRegion.tsx +29 -0
  129. package/src/components/Alert/examples/AlertTimeout.tsx +45 -0
  130. package/src/components/Alert/examples/AlertTruncated.tsx +28 -0
  131. package/src/components/Alert/examples/AlertVariants.tsx +12 -0
  132. package/src/components/Alert/examples/AlertVariations.tsx +43 -0
  133. package/src/demos/Button/Button.md +19 -0
  134. package/src/demos/{Button.md → Button/examples/ButtonProgress.tsx} +1 -19
  135. package/src/demos/PasswordGenerator/PasswordGenerator.md +16 -0
  136. package/src/demos/{PasswordGenerator.md → PasswordGenerator/examples/PasswordGenerator.tsx} +3 -19
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.4.1-prerelease.6","private":true}
1
+ {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.4.1-prerelease.8","private":true}
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.4.1-prerelease.6","private":true}
1
+ {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.4.1-prerelease.8","private":true}
package/next/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.4.1-prerelease.6","private":true}
1
+ {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.4.1-prerelease.8","private":true}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "6.4.1-prerelease.7",
3
+ "version": "6.4.1-prerelease.9",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -63,5 +63,5 @@
63
63
  "react": "^17 || ^18 || ^19",
64
64
  "react-dom": "^17 || ^18 || ^19"
65
65
  },
66
- "gitHead": "2be14960edd09e98cd2176f7715473c14be77162"
66
+ "gitHead": "985efafb947f9159883ef65eacb2a9af85d45473"
67
67
  }
@@ -33,17 +33,8 @@ PatternFly supports several alert variants for different scenarios. Each variant
33
33
  | Warning | Use to indicate that a non-critical error has occurred |
34
34
  | Danger | Use to indicate that a critical or blocking error has occurred |
35
35
 
36
- ```ts
37
- import { Fragment } from 'react';
38
- import { Alert } from '@patternfly/react-core';
39
-
40
- <Fragment>
41
- <Alert title="Custom alert title" ouiaId="CustomAlert" />
42
- <Alert variant="info" title="Info alert title" ouiaId="InfoAlert" />
43
- <Alert variant="success" title="Success alert title" ouiaId="SuccessAlert" />
44
- <Alert variant="warning" title="Warning alert title" ouiaId="WarningAlert" />
45
- <Alert variant="danger" title="Danger alert title" ouiaId="DangerAlert" />
46
- </Fragment>;
36
+ ```ts file = "AlertVariants.tsx"
37
+
47
38
  ```
48
39
 
49
40
  ### Alert variations
@@ -60,99 +51,16 @@ PatternFly supports several properties and variations that can be used to add ex
60
51
  - 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`.
61
52
  - 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`.
62
53
 
63
- ```ts
64
- import { Fragment } from 'react';
65
- import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
66
-
67
- <Fragment>
68
- <Alert
69
- variant="success"
70
- title="Success alert title"
71
- actionLinks={
72
- <Fragment>
73
- <AlertActionLink component="a" href="#">
74
- View details
75
- </AlertActionLink>
76
- <AlertActionLink // eslint-disable-next-line no-console
77
- onClick={() => console.log('Clicked on Ignore')}
78
- >
79
- Ignore
80
- </AlertActionLink>
81
- </Fragment>
82
- }
83
- >
84
- <p>Success alert description. This should tell the user more information about the alert.</p>
85
- </Alert>
86
- <Alert variant="success" title="Success alert title">
87
- <p>
88
- Success alert description. This should tell the user more information about the alert.{' '}
89
- <a href="#">This is a link.</a>
90
- </p>
91
- </Alert>
92
- <Alert
93
- variant="success"
94
- title="Success alert title"
95
- // eslint-disable-next-line no-console
96
- actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
97
- >
98
- <p>Short alert description.</p>
99
- </Alert>
100
- <Alert variant="success" title="div success alert title" component="div" />
101
- <Alert variant="success" title="h6 Success alert title" component="h6">
102
- <p>Short alert description.</p>
103
- </Alert>
104
- </Fragment>;
54
+ ```ts file = "AlertVariations.tsx"
55
+
105
56
  ```
106
57
 
107
58
  ### Alert timeout
108
59
 
109
60
  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.
110
61
 
111
- ```ts
112
- import { Fragment, useState } from 'react';
113
- import { Alert, AlertActionLink, AlertGroup, Button } from '@patternfly/react-core';
114
-
115
- const AlertTimeout: React.FunctionComponent = () => {
116
- const [alerts, setAlerts] = useState<React.ReactNode[]>([]);
117
- const [newAlertKey, setNewAlertKey] = useState<number>(0);
118
-
119
- const onClick = () => {
120
- const timeout = 8000;
121
- setNewAlertKey((key) => key + 1);
122
- setAlerts((prevAlerts) => {
123
- return [
124
- <Alert
125
- title="Default timeout Alert"
126
- timeout={timeout}
127
- actionLinks={
128
- <Fragment>
129
- <AlertActionLink component="a" href="#">
130
- View details
131
- </AlertActionLink>
132
- <AlertActionLink // eslint-disable-next-line no-console
133
- onClick={() => console.log('Clicked on Ignore')}
134
- >
135
- Ignore
136
- </AlertActionLink>
137
- </Fragment>
138
- }
139
- key={newAlertKey}
140
- >
141
- This alert will dismiss after {`${timeout / 1000} seconds`}
142
- </Alert>, ...prevAlerts
143
- ];
144
- });
145
- };
146
-
147
- return (
148
- <Fragment>
149
- <Button variant="secondary" onClick={onClick}>
150
- Add alert
151
- </Button>
152
- <AlertGroup hasAnimations isLiveRegion>{alerts}</AlertGroup>
153
- </Fragment>
154
- );
155
- };
62
+ ```ts file = "AlertTimeout.tsx"
63
+
156
64
  ```
157
65
 
158
66
  ### Expandable alerts
@@ -163,188 +71,56 @@ It is not recommended to use an expandable alert with a `timeout` in a [toast al
163
71
 
164
72
  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.
165
73
 
166
- ```ts
167
- import { Fragment } from 'react';
168
- import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
169
-
170
- <Fragment>
171
- <Alert
172
- isExpandable
173
- variant="success"
174
- title="Success alert title"
175
- // eslint-disable-next-line no-console
176
- actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
177
- >
178
- <p>Success alert description. This should tell the user more information about the alert.</p>
179
- </Alert>
180
- <Alert
181
- isExpandable
182
- isInline
183
- variant="success"
184
- title="Success alert title"
185
- actionLinks={
186
- <Fragment>
187
- <AlertActionLink component="a" href="#">
188
- View details
189
- </AlertActionLink>
190
- <AlertActionLink // eslint-disable-next-line no-console
191
- onClick={() => console.log('Clicked on Ignore')}
192
- >
193
- Ignore
194
- </AlertActionLink>
195
- </Fragment>
196
- }
197
- >
198
- <p>Success alert description. This should tell the user more information about the alert.</p>
199
- </Alert>
200
- </Fragment>;
74
+ ```ts file = "AlertExpandable.tsx"
75
+
201
76
  ```
202
77
 
203
78
  ### Truncated alerts
204
79
 
205
80
  Use the `truncateTitle` property to shorten a long `title`. Set `truncateTitle` equal to a number (passed in as `{n}`) to reduce the number of lines of text in the alert's `title`. Users may hover over or tab to a truncated `title` to see the full message in a tooltip.
206
81
 
207
- ```ts
208
- import { Fragment } from 'react';
209
- import { Alert } from '@patternfly/react-core';
210
-
211
- <Fragment>
212
- <Alert
213
- variant="info"
214
- truncateTitle={1}
215
- title={`
216
- 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.
217
- `}
218
- />
219
- <Alert
220
- variant="warning"
221
- truncateTitle={2}
222
- title={`
223
- 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.
224
- `}
225
- />
226
- <Alert
227
- variant="danger"
228
- truncateTitle={3}
229
- title={`
230
- 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.
231
- `}
232
- />
233
- </Fragment>;
82
+ ```ts file = "AlertTruncated.tsx"
83
+
234
84
  ```
235
85
 
236
86
  ### Custom icons
237
87
 
238
88
  Use the `customIcon` property to replace a default alert icon with a custom icon.
239
89
 
240
- ```ts
241
- import { Fragment } from 'react';
242
- import { Alert } from '@patternfly/react-core';
243
- import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon';
244
- import BoxIcon from '@patternfly/react-icons/dist/esm/icons/box-icon';
245
- import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
246
- import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
247
- import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
90
+ ```ts file = "AlertCustomIcons.tsx"
248
91
 
249
- <Fragment>
250
- <Alert customIcon={<UsersIcon />} title="Default alert title" />
251
- <Alert customIcon={<BoxIcon />} variant="info" title="Info alert title" />
252
- <Alert customIcon={<DatabaseIcon />} variant="success" title="Success alert title" />
253
- <Alert customIcon={<ServerIcon />} variant="warning" title="Warning alert title" />
254
- <Alert customIcon={<LaptopIcon />} variant="danger" title="Danger alert title" />
255
- </Fragment>;
256
92
  ```
257
93
 
258
94
  ### Inline alerts variants
259
95
 
260
96
  Use inline alerts to display an alert inline with content. All alert variants may use the `isInline` property to position alerts in content-heavy areas, such as within forms, wizards, or drawers.
261
97
 
262
- ```ts
263
- import { Fragment } from 'react';
264
- import { Alert } from '@patternfly/react-core';
265
- <Fragment>
266
- <Alert variant="custom" isInline title="Custom inline alert title" />
267
- <Alert variant="info" isInline title="Info inline alert title" />
268
- <Alert variant="success" isInline title="Success inline alert title" />
269
- <Alert variant="warning" isInline title="Warning inline alert title" />
270
- <Alert variant="danger" isInline title="Danger inline alert title" />
271
- </Fragment>;
98
+ ```ts file = "AlertInlineVariants.tsx"
99
+
272
100
  ```
273
101
 
274
102
  ### Inline alert variations
275
103
 
276
104
  All general alert variations can use the `isInline` property to apply inline styling.
277
105
 
278
- ```ts
279
- import { Fragment } from 'react';
280
- import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
281
- <Fragment>
282
- <Alert
283
- isInline
284
- variant="success"
285
- title="Success alert title"
286
- actionLinks={
287
- <Fragment>
288
- <AlertActionLink component="a" href="#">
289
- View details
290
- </AlertActionLink>
291
- <AlertActionLink // eslint-disable-next-line no-console
292
- onClick={() => console.log('Clicked on Ignore')}
293
- >
294
- Ignore
295
- </AlertActionLink>
296
- </Fragment>
297
- }
298
- >
299
- <p>Success alert description. This should tell the user more information about the alert.</p>
300
- </Alert>
301
- <Alert isInline variant="success" title="Success alert title">
302
- <p>
303
- Success alert description. This should tell the user more information about the alert.{' '}
304
- <a href="#">This is a link.</a>
305
- </p>
306
- </Alert>
307
- <Alert
308
- isInline
309
- variant="success"
310
- title="Success alert title"
311
- // eslint-disable-next-line no-console
312
- actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
313
- >
314
- <p>Short alert description.</p>
315
- </Alert>
316
- <Alert isInline variant="success" title="div success alert title" component="div" />
317
- <Alert isInline variant="success" title="h6 Success alert title" component="h6">
318
- <p>Short alert description.</p>
319
- </Alert>
320
- </Fragment>;
106
+ ```ts file = "AlertInlineVariations.tsx"
107
+
321
108
  ```
322
109
 
323
110
  ### Plain inline alert variants
324
111
 
325
112
  Use the `isPlain` property to make any inline alert plain. Plain styling removes the colored background but keeps colored text and icons.
326
113
 
327
- ```ts
328
- import { Fragment } from 'react';
329
- import { Alert } from '@patternfly/react-core';
330
- <Fragment>
331
- <Alert variant="custom" isInline isPlain title="Custom inline alert title" />
332
- <Alert variant="info" isInline isPlain title="Info inline alert title" />
333
- <Alert variant="success" isInline isPlain title="Success inline alert title" />
334
- <Alert variant="warning" isInline isPlain title="Warning inline alert title" />
335
- <Alert variant="danger" isInline isPlain title="Danger inline alert title" />
336
- </Fragment>;
114
+ ```ts file = "AlertPlainInlineVariants.tsx"
115
+
337
116
  ```
338
117
 
339
118
  ### Plain inline alert variations
340
119
 
341
120
  It is not recommended to use a plain inline alert with `actionClose` nor `actionLinks` because these alerts are non-dismissible and should persist until the error or action related to the alert is resolved.
342
121
 
343
- ```ts
344
- import { Alert } from '@patternfly/react-core';
345
- <Alert isInline isPlain variant="success" title="Success alert title">
346
- <p>Success alert description. This should tell the user more information about the alert.</p>
347
- </Alert>;
122
+ ```ts file = "AlertPlainInlineVariations.tsx"
123
+
348
124
  ```
349
125
 
350
126
  ### Static live region alerts
@@ -353,33 +129,8 @@ Live region alerts allow you to expose dynamic content changes in a way that can
353
129
 
354
130
  By default, `isLiveRegion`alerts are static.
355
131
 
356
- ```ts
357
- import { Fragment } from 'react';
358
- import { Alert, AlertActionCloseButton } from '@patternfly/react-core';
359
-
360
- <Fragment>
361
- <Alert
362
- isLiveRegion
363
- variant="info"
364
- title="Default live region configuration"
365
- // eslint-disable-next-line no-console
366
- actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
367
- >
368
- This alert uses the recommended <code>isLiveRegion</code> prop to automatically set ARIA attributes and CSS classes.
369
- </Alert>
370
- <Alert
371
- aria-live="assertive"
372
- aria-relevant="additions text"
373
- aria-atomic="true"
374
- variant="info"
375
- title="Customized live region"
376
- // eslint-disable-next-line no-console
377
- actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
378
- >
379
- You can alternatively omit the <code>isLiveRegion</code> prop to specify ARIA attributes and CSS manually on the
380
- containing element.
381
- </Alert>
382
- </Fragment>;
132
+ ```ts file = "AlertStaticLiveRegion.tsx"
133
+
383
134
  ```
384
135
 
385
136
  ### Dynamic live region alerts
@@ -418,7 +169,7 @@ Dynamic alerts that are generated after the page initially loads must be appende
418
169
 
419
170
  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.
420
171
 
421
- ```ts file="./AlertGroupStatic.tsx"
172
+ ```ts file="AlertGroupStatic.tsx"
422
173
 
423
174
  ```
424
175
 
@@ -428,7 +179,7 @@ Toast alert groups are created by passing in the `isToast` and `isLiveRegion` pr
428
179
 
429
180
  Click the buttons in the example below to add alerts to a toast group.
430
181
 
431
- ```ts file="./AlertGroupToast.tsx"
182
+ ```ts file="AlertGroupToast.tsx"
432
183
 
433
184
  ```
434
185
 
@@ -452,7 +203,7 @@ The following example shows how alerts can be triggered by an asynchronous event
452
203
 
453
204
  See the [alert accessibility tab](/components/alert/accessibility) for more information on customizing this behavior.
454
205
 
455
- ```ts file="./AlertGroupAsync.tsx"
206
+ ```ts file="AlertGroupAsync.tsx"
456
207
 
457
208
  ```
458
209
 
@@ -460,7 +211,7 @@ See the [alert accessibility tab](/components/alert/accessibility) for more info
460
211
 
461
212
  Click the buttons in the example below to add dynamic alerts to a group.
462
213
 
463
- ```ts file="./AlertGroupSingularDynamic.tsx"
214
+ ```ts file="AlertGroupSingularDynamic.tsx"
464
215
 
465
216
  ```
466
217
 
@@ -476,6 +227,6 @@ In the following example, there can be a maximum of 4 alerts shown at once.
476
227
 
477
228
  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.
478
229
 
479
- ```ts file="./AlertGroupMultipleDynamic.tsx"
230
+ ```ts file="AlertGroupMultipleDynamic.tsx"
480
231
 
481
232
  ```
@@ -0,0 +1,17 @@
1
+ import { Fragment } from 'react';
2
+ import { Alert } from '@patternfly/react-core';
3
+ import UsersIcon from '@patternfly/react-icons/dist/esm/icons/users-icon';
4
+ import BoxIcon from '@patternfly/react-icons/dist/esm/icons/box-icon';
5
+ import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
6
+ import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
7
+ import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
8
+
9
+ export const AlertCustomIcons: React.FunctionComponent = () => (
10
+ <Fragment>
11
+ <Alert customIcon={<UsersIcon />} title="Default alert title" />
12
+ <Alert customIcon={<BoxIcon />} variant="info" title="Info alert title" />
13
+ <Alert customIcon={<DatabaseIcon />} variant="success" title="Success alert title" />
14
+ <Alert customIcon={<ServerIcon />} variant="warning" title="Warning alert title" />
15
+ <Alert customIcon={<LaptopIcon />} variant="danger" title="Danger alert title" />
16
+ </Fragment>
17
+ );
@@ -0,0 +1,36 @@
1
+ import { Fragment } from 'react';
2
+ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
3
+
4
+ export const AlertExpandable: React.FunctionComponent = () => (
5
+ <Fragment>
6
+ <Alert
7
+ isExpandable
8
+ variant="success"
9
+ title="Success alert title"
10
+ // eslint-disable-next-line no-console
11
+ actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
12
+ >
13
+ <p>Success alert description. This should tell the user more information about the alert.</p>
14
+ </Alert>
15
+ <Alert
16
+ isExpandable
17
+ isInline
18
+ variant="success"
19
+ title="Success alert title"
20
+ actionLinks={
21
+ <Fragment>
22
+ <AlertActionLink component="a" href="#">
23
+ View details
24
+ </AlertActionLink>
25
+ <AlertActionLink // eslint-disable-next-line no-console
26
+ onClick={() => console.log('Clicked on Ignore')}
27
+ >
28
+ Ignore
29
+ </AlertActionLink>
30
+ </Fragment>
31
+ }
32
+ >
33
+ <p>Success alert description. This should tell the user more information about the alert.</p>
34
+ </Alert>
35
+ </Fragment>
36
+ );
@@ -0,0 +1,12 @@
1
+ import { Fragment } from 'react';
2
+ import { Alert } from '@patternfly/react-core';
3
+
4
+ export const AlertInlineVariants: React.FunctionComponent = () => (
5
+ <Fragment>
6
+ <Alert variant="custom" isInline title="Custom inline alert title" />
7
+ <Alert variant="info" isInline title="Info inline alert title" />
8
+ <Alert variant="success" isInline title="Success inline alert title" />
9
+ <Alert variant="warning" isInline title="Warning inline alert title" />
10
+ <Alert variant="danger" isInline title="Danger inline alert title" />
11
+ </Fragment>
12
+ );
@@ -0,0 +1,45 @@
1
+ import { Fragment } from 'react';
2
+ import { Alert, AlertActionCloseButton, AlertActionLink } from '@patternfly/react-core';
3
+
4
+ export const AlertInlineVariations: React.FunctionComponent = () => (
5
+ <Fragment>
6
+ <Alert
7
+ isInline
8
+ variant="success"
9
+ title="Success alert title"
10
+ actionLinks={
11
+ <Fragment>
12
+ <AlertActionLink component="a" href="#">
13
+ View details
14
+ </AlertActionLink>
15
+ <AlertActionLink // eslint-disable-next-line no-console
16
+ onClick={() => console.log('Clicked on Ignore')}
17
+ >
18
+ Ignore
19
+ </AlertActionLink>
20
+ </Fragment>
21
+ }
22
+ >
23
+ <p>Success alert description. This should tell the user more information about the alert.</p>
24
+ </Alert>
25
+ <Alert isInline variant="success" title="Success alert title">
26
+ <p>
27
+ Success alert description. This should tell the user more information about the alert.{' '}
28
+ <a href="#">This is a link.</a>
29
+ </p>
30
+ </Alert>
31
+ <Alert
32
+ isInline
33
+ variant="success"
34
+ title="Success alert title"
35
+ // eslint-disable-next-line no-console
36
+ actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
37
+ >
38
+ <p>Short alert description.</p>
39
+ </Alert>
40
+ <Alert isInline variant="success" title="div success alert title" component="div" />
41
+ <Alert isInline variant="success" title="h6 Success alert title" component="h6">
42
+ <p>Short alert description.</p>
43
+ </Alert>
44
+ </Fragment>
45
+ );
@@ -0,0 +1,12 @@
1
+ import { Fragment } from 'react';
2
+ import { Alert } from '@patternfly/react-core';
3
+
4
+ export const AlertPlainInlineVariants: React.FunctionComponent = () => (
5
+ <Fragment>
6
+ <Alert variant="custom" isInline isPlain title="Custom inline alert title" />
7
+ <Alert variant="info" isInline isPlain title="Info inline alert title" />
8
+ <Alert variant="success" isInline isPlain title="Success inline alert title" />
9
+ <Alert variant="warning" isInline isPlain title="Warning inline alert title" />
10
+ <Alert variant="danger" isInline isPlain title="Danger inline alert title" />
11
+ </Fragment>
12
+ );
@@ -0,0 +1,7 @@
1
+ import { Alert } from '@patternfly/react-core';
2
+
3
+ export const AlertPlainInlineVariations: React.FunctionComponent = () => (
4
+ <Alert isInline isPlain variant="success" title="Success alert title">
5
+ <p>Success alert description. This should tell the user more information about the alert.</p>
6
+ </Alert>
7
+ );
@@ -0,0 +1,29 @@
1
+ import { Fragment } from 'react';
2
+ import { Alert, AlertActionCloseButton } from '@patternfly/react-core';
3
+
4
+ export const AlertStaticLiveRegion: React.FunctionComponent = () => (
5
+ <Fragment>
6
+ <Alert
7
+ isLiveRegion
8
+ variant="info"
9
+ title="Default live region configuration"
10
+ // eslint-disable-next-line no-console
11
+ actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
12
+ >
13
+ This alert uses the recommended <code>isLiveRegion</code> prop to automatically set ARIA attributes and CSS
14
+ classes.
15
+ </Alert>
16
+ <Alert
17
+ aria-live="assertive"
18
+ aria-relevant="additions text"
19
+ aria-atomic="true"
20
+ variant="info"
21
+ title="Customized live region"
22
+ // eslint-disable-next-line no-console
23
+ actionClose={<AlertActionCloseButton onClose={() => console.log('Clicked the close button')} />}
24
+ >
25
+ You can alternatively omit the <code>isLiveRegion</code> prop to specify ARIA attributes and CSS manually on the
26
+ containing element.
27
+ </Alert>
28
+ </Fragment>
29
+ );
@@ -0,0 +1,45 @@
1
+ import { Fragment, useState } from 'react';
2
+ import { Alert, AlertActionLink, AlertGroup, Button } from '@patternfly/react-core';
3
+
4
+ export const AlertTimeout: React.FunctionComponent = () => {
5
+ const [alerts, setAlerts] = useState<React.ReactNode[]>([]);
6
+ const [newAlertKey, setNewAlertKey] = useState<number>(0);
7
+
8
+ const onClick = () => {
9
+ const timeout = 8000;
10
+ setNewAlertKey((key) => key + 1);
11
+ setAlerts((prevAlerts) => [
12
+ <Alert
13
+ title="Default timeout Alert"
14
+ timeout={timeout}
15
+ actionLinks={
16
+ <Fragment>
17
+ <AlertActionLink component="a" href="#">
18
+ View details
19
+ </AlertActionLink>
20
+ <AlertActionLink // eslint-disable-next-line no-console
21
+ onClick={() => console.log('Clicked on Ignore')}
22
+ >
23
+ Ignore
24
+ </AlertActionLink>
25
+ </Fragment>
26
+ }
27
+ key={newAlertKey}
28
+ >
29
+ This alert will dismiss after {`${timeout / 1000} seconds`}
30
+ </Alert>,
31
+ ...prevAlerts
32
+ ]);
33
+ };
34
+
35
+ return (
36
+ <Fragment>
37
+ <Button variant="secondary" onClick={onClick}>
38
+ Add alert
39
+ </Button>
40
+ <AlertGroup hasAnimations isLiveRegion>
41
+ {alerts}
42
+ </AlertGroup>
43
+ </Fragment>
44
+ );
45
+ };