@patternfly/react-core 6.0.0-alpha.30 → 6.0.0-alpha.32
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 +12 -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/Modal/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/esm/components/ActionList/ActionList.js +1 -1
- package/dist/esm/components/ActionList/ActionList.js.map +1 -1
- package/dist/esm/components/ActionList/ActionListGroup.d.ts +2 -0
- package/dist/esm/components/ActionList/ActionListGroup.d.ts.map +1 -1
- package/dist/esm/components/ActionList/ActionListGroup.js +2 -2
- package/dist/esm/components/ActionList/ActionListGroup.js.map +1 -1
- package/dist/esm/components/ActionList/ActionListItem.js +1 -1
- package/dist/esm/components/ActionList/ActionListItem.js.map +1 -1
- package/dist/esm/components/Card/Card.d.ts +2 -16
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/Card/Card.js +3 -45
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +2 -5
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Card/CardTitle.d.ts.map +1 -1
- package/dist/esm/components/Card/CardTitle.js +1 -5
- package/dist/esm/components/Card/CardTitle.js.map +1 -1
- package/dist/js/components/ActionList/ActionList.js +1 -1
- package/dist/js/components/ActionList/ActionList.js.map +1 -1
- package/dist/js/components/ActionList/ActionListGroup.d.ts +2 -0
- package/dist/js/components/ActionList/ActionListGroup.d.ts.map +1 -1
- package/dist/js/components/ActionList/ActionListGroup.js +2 -2
- package/dist/js/components/ActionList/ActionListGroup.js.map +1 -1
- package/dist/js/components/ActionList/ActionListItem.js +1 -1
- package/dist/js/components/ActionList/ActionListItem.js.map +1 -1
- package/dist/js/components/Card/Card.d.ts +2 -16
- package/dist/js/components/Card/Card.d.ts.map +1 -1
- package/dist/js/components/Card/Card.js +3 -45
- package/dist/js/components/Card/Card.js.map +1 -1
- package/dist/js/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/js/components/Card/CardHeader.js +2 -5
- package/dist/js/components/Card/CardHeader.js.map +1 -1
- package/dist/js/components/Card/CardTitle.d.ts.map +1 -1
- package/dist/js/components/Card/CardTitle.js +1 -5
- package/dist/js/components/Card/CardTitle.js.map +1 -1
- package/dist/umd/react-core.min.js +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/ActionList/ActionList.tsx +1 -1
- package/src/components/ActionList/ActionListGroup.tsx +5 -2
- package/src/components/ActionList/ActionListItem.tsx +1 -1
- package/src/components/ActionList/__tests__/ActionListGroup.test.tsx +8 -2
- package/src/components/ActionList/examples/ActionListSingleGroup.tsx +45 -40
- package/src/components/ActionList/examples/ActionListWithCancelButton.tsx +12 -10
- package/src/components/ActionList/examples/ActionListWithIcons.tsx +44 -13
- package/src/components/Card/Card.tsx +6 -82
- package/src/components/Card/CardHeader.tsx +2 -6
- package/src/components/Card/CardTitle.tsx +1 -7
- package/src/components/Card/__tests__/Card.test.tsx +5 -123
- package/src/components/Card/__tests__/CardTitle.test.tsx +0 -13
- package/src/components/Card/examples/Card.md +17 -34
- package/src/components/Card/examples/CardClickable.tsx +62 -44
- package/src/components/Card/examples/CardClickableSelectable.tsx +93 -59
- package/src/components/Card/examples/CardExpandableWithIcon.tsx +1 -1
- package/src/components/Card/examples/CardSecondary.tsx +10 -0
- package/src/components/Card/examples/CardSelectable.tsx +62 -45
- package/src/components/Card/examples/CardSingleSelectable.tsx +3 -3
- package/src/components/Card/examples/CardWithDividers.tsx +14 -0
- package/src/components/Card/examples/CardWithImageAndActions.tsx +18 -18
- package/src/components/Card/examples/CardWithModifiers.tsx +0 -1
- package/src/demos/examples/Card/CardHorizontalSplit.tsx +1 -1
- package/src/demos/examples/Tabs/NestedUnindentedTabs.tsx +3 -3
- package/src/components/Card/examples/CardDeprecatedSelectable.tsx +0 -127
- package/src/components/Card/examples/CardDeprecatedSelectableA11yHighlight.tsx +0 -61
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { CardTitle } from '../CardTitle';
|
|
4
|
-
import { CardContext } from '../Card';
|
|
5
4
|
|
|
6
5
|
describe('CardTitle', () => {
|
|
7
6
|
test('renders with PatternFly Core styles', () => {
|
|
@@ -20,16 +19,4 @@ describe('CardTitle', () => {
|
|
|
20
19
|
render(<CardTitle data-testid={testId} />);
|
|
21
20
|
expect(screen.getByTestId(testId)).toBeInTheDocument();
|
|
22
21
|
});
|
|
23
|
-
|
|
24
|
-
test('calls the registerTitleId function provided by the CardContext with the generated title id', () => {
|
|
25
|
-
const mockRegisterTitleId = jest.fn();
|
|
26
|
-
|
|
27
|
-
render(
|
|
28
|
-
<CardContext.Provider value={{ cardId: 'card', registerTitleId: mockRegisterTitleId }}>
|
|
29
|
-
<CardTitle>text</CardTitle>
|
|
30
|
-
</CardContext.Provider>
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
expect(mockRegisterTitleId).toHaveBeenCalledWith('card-title');
|
|
34
|
-
});
|
|
35
22
|
});
|
|
@@ -16,8 +16,8 @@ propComponents:
|
|
|
16
16
|
ouia: true
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
import pfLogo from '../../assets/
|
|
20
|
-
import pfLogoSmall from '../../assets/
|
|
19
|
+
import pfLogo from '../../assets/PF-HorizontalLogo-Color.svg';
|
|
20
|
+
import pfLogoSmall from '../../assets/PF-IconLogo.svg';
|
|
21
21
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
22
22
|
|
|
23
23
|
## Examples
|
|
@@ -30,6 +30,14 @@ Basic cards typically have a `<CardTitle>`, `<CardBody>` and `<CardFooter>`. You
|
|
|
30
30
|
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
### Secondary cards
|
|
34
|
+
|
|
35
|
+
You can apply secondary background color styling to a card by setting the `variant` property to `secondary`.
|
|
36
|
+
|
|
37
|
+
```ts file='./CardSecondary.tsx'
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
33
41
|
### Modifiers
|
|
34
42
|
|
|
35
43
|
You can further modify the styling of the card's content by using the properties outlined below. In this example, you can enable each modifier by selecting its respective checkbox.
|
|
@@ -43,8 +51,6 @@ Most modifiers can be used in combination with each other, except for `isCompact
|
|
|
43
51
|
| Modifier | Description |
|
|
44
52
|
| ------------ | ------------------------------------------------------------------------------------ |
|
|
45
53
|
| isCompact | Modifies the card to include compact styling. Should not be used with isLarge. |
|
|
46
|
-
| isFlat | Modifies the card to include flat styling. |
|
|
47
|
-
| isRounded | Modifies the card to include rounded border styling. |
|
|
48
54
|
| isLarge | Modifies the card to be large. Should not be used with isCompact. |
|
|
49
55
|
| isFullHeight | Modifies the card so that it fills the total available height of its container. |
|
|
50
56
|
| isPlain | Modifies the card to include plain styling, which removes the border and background. |
|
|
@@ -145,36 +151,6 @@ When passing interactive content to a clickable and selectable card that is disa
|
|
|
145
151
|
|
|
146
152
|
```
|
|
147
153
|
|
|
148
|
-
### Selectable cards (deprecated)
|
|
149
|
-
|
|
150
|
-
The following example shows a deprecated implementation of selectable cards. This example uses the `isSelectable` property instead of `isSelectableRaised`, which is the current recommendation for implementation. `isSelectable` applies selectable styling, but does not apply raised styling on hover and selection as `isSelectableRaised` does.
|
|
151
|
-
|
|
152
|
-
A `tabIndex={0}` is also manually passed to allow the card to be focused and clicked via keyboard.
|
|
153
|
-
|
|
154
|
-
```ts file='./CardDeprecatedSelectable.tsx' isDeprecated
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### Selectable card accessibility features (deprecated)
|
|
159
|
-
|
|
160
|
-
Note: the following example uses deprecated properties. We recommend using the new `selectableActions` property for the `CardHeader` instead.
|
|
161
|
-
|
|
162
|
-
The following cards demonstrate how the `hasSelectableInput` and `onSelectableInputChange` properties improve accessibility for selectable cards.
|
|
163
|
-
|
|
164
|
-
The first card sets `hasSelectableInput` to true, which renders a checkbox input that is only visible to, and navigable by, screen readers. This input communicates to assistive technology users that a card is selectable, and if so, also communicates the current selection state.
|
|
165
|
-
|
|
166
|
-
By default, this input will have an aria-label that corresponds to the `<CardTitle>`. If this isn't defined, then you must pass a custom aria-label using the `selectableInputAriaLabel` property.
|
|
167
|
-
|
|
168
|
-
The first card passes an onChange callback to `onSelectableInputChange` to enable the selection/deselection of the associated card via checkbox input.
|
|
169
|
-
|
|
170
|
-
The second card does not set `hasSelectableInput` to true, so neither the input nor the selection state is communicated to users of assistive technologies.
|
|
171
|
-
|
|
172
|
-
We recommend navigating this example using a screen reader to best understand both cards.
|
|
173
|
-
|
|
174
|
-
```ts file='./CardDeprecatedSelectableA11yHighlight.tsx' isDeprecated
|
|
175
|
-
|
|
176
|
-
```
|
|
177
|
-
|
|
178
154
|
### Expandable cards
|
|
179
155
|
|
|
180
156
|
A card can be made expandable using the `isExpanded` property. In the collapsed state, only the card header is shown, and the user can click the caret to view the rest of the card content.
|
|
@@ -192,3 +168,10 @@ An image can be placed in the card header to show users an icon beside the expan
|
|
|
192
168
|
```ts file='./CardExpandableWithIcon.tsx'
|
|
193
169
|
|
|
194
170
|
```
|
|
171
|
+
|
|
172
|
+
### Card with dividers
|
|
173
|
+
Dividers can be placed between sections of the card.
|
|
174
|
+
|
|
175
|
+
```ts file='./CardWithDividers.tsx'
|
|
176
|
+
|
|
177
|
+
```
|
|
@@ -1,54 +1,72 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Card, CardHeader, CardTitle, CardBody } from '@patternfly/react-core';
|
|
2
|
+
import { Card, CardHeader, CardTitle, CardBody, Checkbox, Gallery } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const CardClickable: React.FunctionComponent = () => {
|
|
5
|
+
const [isSecondary, setIsSecondary] = React.useState<boolean>(false);
|
|
6
|
+
|
|
5
7
|
const id1 = 'clickable-card-input-1';
|
|
6
8
|
const id2 = 'clickable-card-input-2';
|
|
7
9
|
const id3 = 'clickable-card-input-3';
|
|
8
10
|
|
|
11
|
+
const toggleVariant = (checked: boolean) => {
|
|
12
|
+
setIsSecondary(checked);
|
|
13
|
+
};
|
|
14
|
+
|
|
9
15
|
return (
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
16
|
+
<>
|
|
17
|
+
<Checkbox
|
|
18
|
+
label="secondary styling"
|
|
19
|
+
isChecked={isSecondary}
|
|
20
|
+
onChange={(_event, checked) => toggleVariant(checked)}
|
|
21
|
+
aria-label="add secondary styling"
|
|
22
|
+
id="toggle-variant-clickable"
|
|
23
|
+
name="toggle-variant"
|
|
24
|
+
/>
|
|
25
|
+
<div style={{ marginTop: '15px' }}>
|
|
26
|
+
<Gallery hasGutter>
|
|
27
|
+
<Card id="clickable-card-example-1" isClickable variant={isSecondary ? 'secondary' : 'default'}>
|
|
28
|
+
<CardHeader
|
|
29
|
+
selectableActions={{
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
onClickAction: () => console.log(`${id1} clicked`),
|
|
32
|
+
selectableActionId: id1,
|
|
33
|
+
selectableActionAriaLabelledby: 'clickable-card-example-1',
|
|
34
|
+
name: 'clickable-card-example'
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
<CardTitle>First card</CardTitle>
|
|
38
|
+
</CardHeader>
|
|
39
|
+
<CardBody>This card performs an action on click.</CardBody>
|
|
40
|
+
</Card>
|
|
41
|
+
<Card id="clickable-card-example-2" isClickable variant={isSecondary ? 'secondary' : 'default'}>
|
|
42
|
+
<CardHeader
|
|
43
|
+
selectableActions={{
|
|
44
|
+
to: '#',
|
|
45
|
+
selectableActionId: id2,
|
|
46
|
+
selectableActionAriaLabelledby: 'clickable-card-example-2',
|
|
47
|
+
name: 'clickable-card-example'
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<CardTitle>Second card</CardTitle>
|
|
51
|
+
</CardHeader>
|
|
52
|
+
<CardBody>This card can navigate to a link on click.</CardBody>
|
|
53
|
+
</Card>
|
|
54
|
+
<Card id="clickable-card-example-3" isClickable isDisabled variant={isSecondary ? 'secondary' : 'default'}>
|
|
55
|
+
<CardHeader
|
|
56
|
+
selectableActions={{
|
|
57
|
+
// eslint-disable-next-line no-console
|
|
58
|
+
onClickAction: () => console.log(`${id3} clicked`),
|
|
59
|
+
selectableActionId: id3,
|
|
60
|
+
selectableActionAriaLabelledby: 'clickable-card-example-3',
|
|
61
|
+
name: 'clickable-card-example'
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
<CardTitle>Third card</CardTitle>
|
|
65
|
+
</CardHeader>
|
|
66
|
+
<CardBody>This card is clickable but disabled.</CardBody>
|
|
67
|
+
</Card>
|
|
68
|
+
</Gallery>
|
|
69
|
+
</div>
|
|
70
|
+
</>
|
|
53
71
|
);
|
|
54
72
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Card, CardHeader, CardTitle, CardBody, Button } from '@patternfly/react-core';
|
|
2
|
+
import { Card, CardHeader, CardTitle, CardBody, Button, Checkbox, Gallery } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const CardClickable: React.FunctionComponent = () => {
|
|
5
5
|
const [isChecked1, setIsChecked1] = React.useState(false);
|
|
6
6
|
const [isChecked2, setIsChecked2] = React.useState(false);
|
|
7
7
|
const [isChecked3, setIsChecked3] = React.useState(false);
|
|
8
8
|
const [isSelected1, setIsSelected1] = React.useState(false);
|
|
9
|
+
const [isSecondary, setIsSecondary] = React.useState<boolean>(false);
|
|
9
10
|
|
|
10
11
|
const id1 = 'clickable-selectable-card-input-1';
|
|
11
12
|
const id2 = 'clickable-selectable-card-input-2';
|
|
@@ -31,64 +32,97 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
const toggleVariant = (checked: boolean) => {
|
|
36
|
+
setIsSecondary(checked);
|
|
37
|
+
};
|
|
38
|
+
|
|
34
39
|
return (
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
40
|
+
<>
|
|
41
|
+
<Checkbox
|
|
42
|
+
label="secondary styling"
|
|
43
|
+
isChecked={isSecondary}
|
|
44
|
+
onChange={(_event, checked) => toggleVariant(checked)}
|
|
45
|
+
aria-label="add secondary styling"
|
|
46
|
+
id="toggle-variant-clickable-selectable"
|
|
47
|
+
name="toggle-variant"
|
|
48
|
+
/>
|
|
49
|
+
<div style={{ marginTop: '15px' }}>
|
|
50
|
+
<Gallery hasGutter>
|
|
51
|
+
<Card
|
|
52
|
+
id="clickable-selectable-card-example-1"
|
|
53
|
+
isClickable
|
|
54
|
+
isSelectable
|
|
55
|
+
isSelected={isSelected1}
|
|
56
|
+
variant={isSecondary ? 'secondary' : 'default'}
|
|
57
|
+
>
|
|
58
|
+
<CardHeader
|
|
59
|
+
selectableActions={{
|
|
60
|
+
selectableActionId: id1,
|
|
61
|
+
selectableActionAriaLabelledby: 'clickable-selectable-card-example-1',
|
|
62
|
+
name: id1,
|
|
63
|
+
isChecked: isChecked1,
|
|
64
|
+
onChange
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<CardTitle>
|
|
68
|
+
<Button variant="link" isInline onClick={onClick}>
|
|
69
|
+
First card
|
|
70
|
+
</Button>
|
|
71
|
+
</CardTitle>
|
|
72
|
+
</CardHeader>
|
|
73
|
+
<CardBody>This card performs an action upon clicking the card title and is selectable.</CardBody>
|
|
74
|
+
</Card>
|
|
75
|
+
<Card
|
|
76
|
+
id="clickable-selectable-card-example-2"
|
|
77
|
+
isClickable
|
|
78
|
+
isSelectable
|
|
79
|
+
variant={isSecondary ? 'secondary' : 'default'}
|
|
80
|
+
>
|
|
81
|
+
<CardHeader
|
|
82
|
+
selectableActions={{
|
|
83
|
+
selectableActionId: id2,
|
|
84
|
+
selectableActionAriaLabelledby: 'clickable-selectable-card-example-2',
|
|
85
|
+
name: id2,
|
|
86
|
+
isChecked: isChecked2,
|
|
87
|
+
onChange
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<CardTitle>Second Card</CardTitle>
|
|
91
|
+
</CardHeader>
|
|
92
|
+
<CardBody>
|
|
93
|
+
This card is selectable and has a link in the card body that navigates to{' '}
|
|
94
|
+
<Button variant="link" isInline component="a" href="#">
|
|
95
|
+
Patternfly
|
|
96
|
+
</Button>
|
|
97
|
+
.
|
|
98
|
+
</CardBody>
|
|
99
|
+
</Card>
|
|
100
|
+
<Card
|
|
101
|
+
id="clickable-selectable-card-example-3"
|
|
102
|
+
isClickable
|
|
103
|
+
isSelectable
|
|
104
|
+
isDisabled
|
|
105
|
+
variant={isSecondary ? 'secondary' : 'default'}
|
|
106
|
+
>
|
|
107
|
+
<CardHeader
|
|
108
|
+
selectableActions={{
|
|
109
|
+
selectableActionId: id3,
|
|
110
|
+
selectableActionAriaLabelledby: 'clickable-selectable-card-example-3',
|
|
111
|
+
name: id3,
|
|
112
|
+
isChecked: isChecked3,
|
|
113
|
+
onChange
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
<CardTitle>
|
|
117
|
+
<Button isDisabled variant="link" isInline component="a" href="https://www.patternfly.org/">
|
|
118
|
+
Third card
|
|
119
|
+
</Button>
|
|
120
|
+
</CardTitle>
|
|
121
|
+
</CardHeader>
|
|
122
|
+
<CardBody>This card is clickable and selectable, but disabled.</CardBody>
|
|
123
|
+
</Card>
|
|
124
|
+
</Gallery>
|
|
125
|
+
</div>
|
|
126
|
+
</>
|
|
93
127
|
);
|
|
94
128
|
};
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
MenuToggle,
|
|
14
14
|
MenuToggleElement
|
|
15
15
|
} from '@patternfly/react-core';
|
|
16
|
-
import pfLogoSmall from '../../
|
|
16
|
+
import pfLogoSmall from '../../PF-IconLogo.svg';
|
|
17
17
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
18
18
|
|
|
19
19
|
export const CardExpandableWithIcon: React.FunctionComponent = () => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const CardSecondary: React.FunctionComponent = () => (
|
|
5
|
+
<Card ouiaId="SecondaryCard" variant="secondary">
|
|
6
|
+
<CardTitle>Title</CardTitle>
|
|
7
|
+
<CardBody>Body</CardBody>
|
|
8
|
+
<CardFooter>Footer</CardFooter>
|
|
9
|
+
</Card>
|
|
10
|
+
);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Card, CardHeader, CardTitle, CardBody } from '@patternfly/react-core';
|
|
2
|
+
import { Card, CardHeader, CardTitle, CardBody, Checkbox, Gallery } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const SelectableCard: React.FunctionComponent = () => {
|
|
5
5
|
const [isChecked1, setIsChecked1] = React.useState(false);
|
|
6
6
|
const [isChecked2, setIsChecked2] = React.useState(false);
|
|
7
7
|
const [isChecked3, setIsChecked3] = React.useState(false);
|
|
8
|
+
const [isSecondary, setIsSecondary] = React.useState<boolean>(false);
|
|
8
9
|
|
|
9
10
|
const id1 = 'selectable-card-input-1';
|
|
10
11
|
const id2 = 'selectable-card-input-2';
|
|
@@ -26,50 +27,66 @@ export const SelectableCard: React.FunctionComponent = () => {
|
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
const toggleVariant = (checked: boolean) => {
|
|
31
|
+
setIsSecondary(checked);
|
|
32
|
+
};
|
|
33
|
+
|
|
29
34
|
return (
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
35
|
+
<>
|
|
36
|
+
<Checkbox
|
|
37
|
+
label="secondary styling"
|
|
38
|
+
isChecked={isSecondary}
|
|
39
|
+
onChange={(_event, checked) => toggleVariant(checked)}
|
|
40
|
+
aria-label="add secondary styling"
|
|
41
|
+
id="toggle-variant-selectable"
|
|
42
|
+
name="toggle-variant"
|
|
43
|
+
/>
|
|
44
|
+
<div style={{ marginTop: '15px' }}>
|
|
45
|
+
<Gallery hasGutter>
|
|
46
|
+
<Card id="selectable-card-example-1" isSelectable variant={isSecondary ? 'secondary' : 'default'}>
|
|
47
|
+
<CardHeader
|
|
48
|
+
selectableActions={{
|
|
49
|
+
selectableActionId: id1,
|
|
50
|
+
selectableActionAriaLabelledby: 'selectable-card-example-1',
|
|
51
|
+
name: id1,
|
|
52
|
+
isChecked: isChecked1,
|
|
53
|
+
onChange
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<CardTitle>First card</CardTitle>
|
|
57
|
+
</CardHeader>
|
|
58
|
+
<CardBody>This card is selectable.</CardBody>
|
|
59
|
+
</Card>
|
|
60
|
+
<Card id="selectable-card-example-2" isSelectable variant={isSecondary ? 'secondary' : 'default'}>
|
|
61
|
+
<CardHeader
|
|
62
|
+
selectableActions={{
|
|
63
|
+
selectableActionId: id2,
|
|
64
|
+
selectableActionAriaLabelledby: 'selectable-card-example-2',
|
|
65
|
+
name: id2,
|
|
66
|
+
isChecked: isChecked2,
|
|
67
|
+
onChange
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<CardTitle>Second card</CardTitle>
|
|
71
|
+
</CardHeader>
|
|
72
|
+
<CardBody>This card is selectable.</CardBody>
|
|
73
|
+
</Card>
|
|
74
|
+
<Card id="selectable-card-example-3" isSelectable isDisabled variant={isSecondary ? 'secondary' : 'default'}>
|
|
75
|
+
<CardHeader
|
|
76
|
+
selectableActions={{
|
|
77
|
+
selectableActionId: id3,
|
|
78
|
+
selectableActionAriaLabelledby: 'selectable-card-example-3',
|
|
79
|
+
name: id3,
|
|
80
|
+
isChecked: isChecked3,
|
|
81
|
+
onChange
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<CardTitle>Third card</CardTitle>
|
|
85
|
+
</CardHeader>
|
|
86
|
+
<CardBody>This card is selectable but disabled.</CardBody>
|
|
87
|
+
</Card>
|
|
88
|
+
</Gallery>
|
|
89
|
+
</div>
|
|
90
|
+
</>
|
|
74
91
|
);
|
|
75
92
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Card, CardHeader, CardTitle, CardBody } from '@patternfly/react-core';
|
|
2
|
+
import { Card, CardHeader, CardTitle, CardBody, Gallery } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const SingleSelectableCard: React.FunctionComponent = () => {
|
|
5
5
|
const id1 = 'single-selectable-card-input-1';
|
|
@@ -7,7 +7,7 @@ export const SingleSelectableCard: React.FunctionComponent = () => {
|
|
|
7
7
|
const id3 = 'single-selectable-card-input-3';
|
|
8
8
|
|
|
9
9
|
return (
|
|
10
|
-
<
|
|
10
|
+
<Gallery hasGutter>
|
|
11
11
|
<Card id="single-selectable-card-example-1" isSelectable>
|
|
12
12
|
<CardHeader
|
|
13
13
|
selectableActions={{
|
|
@@ -47,6 +47,6 @@ export const SingleSelectableCard: React.FunctionComponent = () => {
|
|
|
47
47
|
</CardHeader>
|
|
48
48
|
<CardBody>This card is single selectable but disabled.</CardBody>
|
|
49
49
|
</Card>
|
|
50
|
-
</
|
|
50
|
+
</Gallery>
|
|
51
51
|
);
|
|
52
52
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card, CardTitle, CardBody, CardFooter, Divider } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const CardWithDividers: React.FunctionComponent = () => (
|
|
5
|
+
<Card ouiaId="CardWithDividers">
|
|
6
|
+
<CardTitle>Title</CardTitle>
|
|
7
|
+
<Divider />
|
|
8
|
+
<CardBody>Body</CardBody>
|
|
9
|
+
<Divider />
|
|
10
|
+
<CardBody>Body</CardBody>
|
|
11
|
+
<Divider />
|
|
12
|
+
<CardFooter>Footer</CardFooter>
|
|
13
|
+
</Card>
|
|
14
|
+
);
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
Divider
|
|
16
16
|
} from '@patternfly/react-core';
|
|
17
17
|
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
18
|
-
import pfLogo from '../../assets/
|
|
18
|
+
import pfLogo from '../../assets/PF-HorizontalLogo-Color.svg';
|
|
19
19
|
|
|
20
20
|
export const CardWithImageAndActions: React.FunctionComponent = () => {
|
|
21
21
|
const [isOpen, setIsOpen] = React.useState<boolean>(false);
|
|
@@ -85,23 +85,23 @@ export const CardWithImageAndActions: React.FunctionComponent = () => {
|
|
|
85
85
|
|
|
86
86
|
return (
|
|
87
87
|
<>
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
<div style={{ marginTop: '
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
<Checkbox
|
|
89
|
+
label="actions hasNoOffset"
|
|
90
|
+
isChecked={hasNoOffset}
|
|
91
|
+
onChange={(_event, checked) => toggleOffset(checked)}
|
|
92
|
+
aria-label="remove actions offset"
|
|
93
|
+
id="toggle-actions-offset"
|
|
94
|
+
name="toggle-actions-offset"
|
|
95
|
+
/>
|
|
96
|
+
<div style={{ marginTop: '15px' }}>
|
|
97
|
+
<Card>
|
|
98
|
+
<CardHeader actions={{ actions: headerActions, hasNoOffset }}>
|
|
99
|
+
<Brand src={pfLogo} alt="PatternFly logo" style={{ width: '300px' }} />
|
|
100
|
+
</CardHeader>
|
|
101
|
+
<CardTitle>Title</CardTitle>
|
|
102
|
+
<CardBody>Body</CardBody>
|
|
103
|
+
<CardFooter>Footer</CardFooter>
|
|
104
|
+
</Card>
|
|
105
105
|
</div>
|
|
106
106
|
</>
|
|
107
107
|
);
|
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import { Card, CardTitle, CardBody, CardFooter, Checkbox } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const CardWithModifiers: React.FunctionComponent = () => {
|
|
5
|
-
// TODO: Update with issue #9991 removed isFlat and isRounded
|
|
6
5
|
const mods = ['isCompact', 'isLarge', 'isFullHeight', 'isPlain'];
|
|
7
6
|
const [modifiers, setModifiers] = React.useState({});
|
|
8
7
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Card, CardTitle, CardBody, CardFooter, Grid, GridItem, Button } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const CardHorizontalSplitDemo: React.FunctionComponent = () => (
|
|
5
|
-
<Card id="card-demo-horizontal-split-example"
|
|
5
|
+
<Card id="card-demo-horizontal-split-example">
|
|
6
6
|
<Grid md={6}>
|
|
7
7
|
<GridItem
|
|
8
8
|
style={{
|