@patternfly/react-core 6.0.0-alpha.47 → 6.0.0-alpha.49
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/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/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/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/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/DualListSelector/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/Card/Card.d.ts +13 -5
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/Card/Card.js +7 -3
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Card/CardHeader.d.ts +3 -1
- package/dist/esm/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/esm/components/Card/CardHeader.js +10 -10
- package/dist/esm/components/Card/CardHeader.js.map +1 -1
- package/dist/esm/components/Drawer/DrawerContent.d.ts +6 -2
- package/dist/esm/components/Drawer/DrawerContent.d.ts.map +1 -1
- package/dist/esm/components/Drawer/DrawerContent.js +9 -3
- package/dist/esm/components/Drawer/DrawerContent.js.map +1 -1
- package/dist/esm/components/Page/Page.d.ts.map +1 -1
- package/dist/esm/components/Page/Page.js +6 -5
- package/dist/esm/components/Page/Page.js.map +1 -1
- package/dist/js/components/Card/Card.d.ts +13 -5
- package/dist/js/components/Card/Card.d.ts.map +1 -1
- package/dist/js/components/Card/Card.js +7 -3
- package/dist/js/components/Card/Card.js.map +1 -1
- package/dist/js/components/Card/CardHeader.d.ts +3 -1
- package/dist/js/components/Card/CardHeader.d.ts.map +1 -1
- package/dist/js/components/Card/CardHeader.js +10 -10
- package/dist/js/components/Card/CardHeader.js.map +1 -1
- package/dist/js/components/Drawer/DrawerContent.d.ts +6 -2
- package/dist/js/components/Drawer/DrawerContent.d.ts.map +1 -1
- package/dist/js/components/Drawer/DrawerContent.js +9 -3
- package/dist/js/components/Drawer/DrawerContent.js.map +1 -1
- package/dist/js/components/Page/Page.d.ts.map +1 -1
- package/dist/js/components/Page/Page.js +6 -5
- package/dist/js/components/Page/Page.js.map +1 -1
- package/dist/styles/base-no-reset.css +22 -19
- package/dist/styles/base.css +22 -19
- 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 +6 -6
- package/src/components/Card/Card.tsx +24 -7
- package/src/components/Card/CardHeader.tsx +15 -10
- package/src/components/Card/examples/Card.md +12 -9
- package/src/components/Card/examples/CardClickableSelectable.tsx +6 -6
- package/src/components/Card/examples/CardSelectable.tsx +20 -8
- package/src/components/Card/examples/CardSingleSelectable.tsx +14 -6
- package/src/components/Drawer/DrawerContent.tsx +11 -5
- package/src/components/Drawer/examples/DrawerSecondaryBackground.tsx +3 -2
- package/src/components/Page/Page.tsx +15 -13
- package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +1215 -1163
- package/src/layouts/Bullseye/examples/Bullseye.md +4 -2
- package/src/layouts/Bullseye/examples/bullseye.css +2 -3
- package/src/layouts/Flex/examples/Flex.md +1 -1
- package/src/layouts/Flex/examples/flex.css +3 -4
- package/src/layouts/Gallery/examples/Gallery.md +8 -8
- package/src/layouts/Gallery/examples/gallery.css +4 -5
- package/src/layouts/Grid/examples/Grid.md +30 -25
- package/src/layouts/Grid/examples/grid.css +2 -3
- package/src/layouts/Level/examples/Level.md +6 -3
- package/src/layouts/Level/examples/level.css +3 -4
- package/src/layouts/Split/examples/Split.md +8 -4
- package/src/layouts/Split/examples/split.css +2 -3
- package/src/layouts/Stack/examples/Stack.md +6 -3
- package/src/layouts/Stack/examples/stack.css +3 -4
package/helpers/package.json
CHANGED
|
@@ -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.0.0-alpha.
|
|
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.0.0-alpha.48","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -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.0.0-alpha.
|
|
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.0.0-alpha.48","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.0.0-alpha.
|
|
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.0.0-alpha.48","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.49",
|
|
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",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"clean:exports": "node scripts/cleanDistExports.js"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@patternfly/react-icons": "^6.0.0-alpha.
|
|
51
|
-
"@patternfly/react-styles": "^6.0.0-alpha.
|
|
52
|
-
"@patternfly/react-tokens": "^6.0.0-alpha.
|
|
50
|
+
"@patternfly/react-icons": "^6.0.0-alpha.18",
|
|
51
|
+
"@patternfly/react-styles": "^6.0.0-alpha.18",
|
|
52
|
+
"@patternfly/react-tokens": "^6.0.0-alpha.18",
|
|
53
53
|
"focus-trap": "7.5.2",
|
|
54
54
|
"react-dropzone": "^14.2.3",
|
|
55
55
|
"tslib": "^2.5.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@patternfly/patternfly": "6.0.0-alpha.
|
|
58
|
+
"@patternfly/patternfly": "6.0.0-alpha.107",
|
|
59
59
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
60
60
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
61
61
|
"@rollup/plugin-replace": "^5.0.2",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"react": "^17 || ^18",
|
|
75
75
|
"react-dom": "^17 || ^18"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "7ef53d89f6130ae4c15364059920a230c3d8d8d3"
|
|
78
78
|
}
|
|
@@ -14,13 +14,19 @@ export interface CardProps extends React.HTMLProps<HTMLElement>, OUIAProps {
|
|
|
14
14
|
component?: keyof JSX.IntrinsicElements;
|
|
15
15
|
/** Modifies the card to include compact styling. Should not be used with isLarge. */
|
|
16
16
|
isCompact?: boolean;
|
|
17
|
-
/**
|
|
17
|
+
/** Flag indicating that the card is selectable. */
|
|
18
18
|
isSelectable?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
isSelected?: boolean;
|
|
21
|
-
/** Modifies the card to include clickable styling */
|
|
19
|
+
/** Flag indicating that the card is clickable and contains some action that triggers on click. */
|
|
22
20
|
isClickable?: boolean;
|
|
23
|
-
/**
|
|
21
|
+
/** Flag indicating whether a card that is either selectable only or both clickable and selectable is
|
|
22
|
+
* currently selected and has selected styling.
|
|
23
|
+
*/
|
|
24
|
+
isSelected?: boolean;
|
|
25
|
+
/** Flag indicating whether a card that is either only clickable or that is both clickable and selectable
|
|
26
|
+
* is currently clicked and has clicked styling.
|
|
27
|
+
*/
|
|
28
|
+
isClicked?: boolean;
|
|
29
|
+
/** Flag indicating that a clickable or selectable card is disabled. */
|
|
24
30
|
isDisabled?: boolean;
|
|
25
31
|
/** Modifies the card to be large. Should not be used with isCompact. */
|
|
26
32
|
isLarge?: boolean;
|
|
@@ -43,6 +49,8 @@ interface CardContextProps {
|
|
|
43
49
|
isExpanded: boolean;
|
|
44
50
|
isClickable: boolean;
|
|
45
51
|
isSelectable: boolean;
|
|
52
|
+
isSelected: boolean;
|
|
53
|
+
isClicked: boolean;
|
|
46
54
|
isDisabled: boolean;
|
|
47
55
|
}
|
|
48
56
|
|
|
@@ -51,6 +59,8 @@ export const CardContext = React.createContext<Partial<CardContextProps>>({
|
|
|
51
59
|
isExpanded: false,
|
|
52
60
|
isClickable: false,
|
|
53
61
|
isSelectable: false,
|
|
62
|
+
isSelected: false,
|
|
63
|
+
isClicked: false,
|
|
54
64
|
isDisabled: false
|
|
55
65
|
});
|
|
56
66
|
|
|
@@ -64,6 +74,7 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
64
74
|
isClickable = false,
|
|
65
75
|
isDisabled = false,
|
|
66
76
|
isSelected = false,
|
|
77
|
+
isClicked = false,
|
|
67
78
|
isExpanded = false,
|
|
68
79
|
isLarge = false,
|
|
69
80
|
isFullHeight = false,
|
|
@@ -85,7 +96,11 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
85
96
|
|
|
86
97
|
const getSelectableModifiers = () => {
|
|
87
98
|
if (isSelectable && isClickable) {
|
|
88
|
-
return css(
|
|
99
|
+
return css(
|
|
100
|
+
styles.modifiers.selectable,
|
|
101
|
+
styles.modifiers.clickable,
|
|
102
|
+
(isSelected || isClicked) && styles.modifiers.current
|
|
103
|
+
);
|
|
89
104
|
}
|
|
90
105
|
|
|
91
106
|
if (isSelectable) {
|
|
@@ -93,7 +108,7 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
93
108
|
}
|
|
94
109
|
|
|
95
110
|
if (isClickable) {
|
|
96
|
-
return css(styles.modifiers.clickable,
|
|
111
|
+
return css(styles.modifiers.clickable, isClicked && styles.modifiers.current);
|
|
97
112
|
}
|
|
98
113
|
|
|
99
114
|
return '';
|
|
@@ -106,6 +121,8 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
106
121
|
isExpanded,
|
|
107
122
|
isClickable,
|
|
108
123
|
isSelectable,
|
|
124
|
+
isSelected,
|
|
125
|
+
isClicked,
|
|
109
126
|
isDisabled
|
|
110
127
|
}}
|
|
111
128
|
>
|
|
@@ -44,7 +44,9 @@ export interface CardHeaderSelectableActionsObject {
|
|
|
44
44
|
isExternalLink?: boolean;
|
|
45
45
|
/** Name for the input element of a clickable or selectable card. */
|
|
46
46
|
name?: string;
|
|
47
|
-
/** Flag indicating whether the selectable card input is checked
|
|
47
|
+
/** @deprecated Flag indicating whether the selectable card input is checked. We recommend using
|
|
48
|
+
* the isSelected prop on the card component instead.
|
|
49
|
+
*/
|
|
48
50
|
isChecked?: boolean;
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -79,7 +81,7 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
|
|
|
79
81
|
...props
|
|
80
82
|
}: CardHeaderProps) => (
|
|
81
83
|
<CardContext.Consumer>
|
|
82
|
-
{({ cardId, isClickable, isSelectable, isDisabled: isCardDisabled }) => {
|
|
84
|
+
{({ cardId, isClickable, isSelectable, isSelected, isClicked, isDisabled: isCardDisabled }) => {
|
|
83
85
|
const cardHeaderToggle = (
|
|
84
86
|
<div className={css(styles.cardHeaderToggle)}>
|
|
85
87
|
<Button
|
|
@@ -108,12 +110,10 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
|
|
|
108
110
|
}
|
|
109
111
|
|
|
110
112
|
const handleActionClick = (event: React.FormEvent<HTMLInputElement> | React.MouseEvent) => {
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
window.open(selectableActions.to, selectableActions.isExternalLink ? '_blank' : '_self');
|
|
116
|
-
}
|
|
113
|
+
if (selectableActions?.onClickAction) {
|
|
114
|
+
selectableActions.onClickAction(event);
|
|
115
|
+
} else if (selectableActions?.to) {
|
|
116
|
+
window.open(selectableActions.to, selectableActions.isExternalLink ? '_blank' : '_self');
|
|
117
117
|
}
|
|
118
118
|
};
|
|
119
119
|
|
|
@@ -128,12 +128,17 @@ export const CardHeader: React.FunctionComponent<CardHeaderProps> = ({
|
|
|
128
128
|
name: selectableActions.name,
|
|
129
129
|
isDisabled: isCardDisabled
|
|
130
130
|
};
|
|
131
|
+
const isSelectableInputChecked = selectableActions.isChecked ?? isSelected;
|
|
131
132
|
|
|
132
133
|
if (isClickable && !isSelectable) {
|
|
133
|
-
return {
|
|
134
|
+
return {
|
|
135
|
+
...baseProps,
|
|
136
|
+
onClick: handleActionClick,
|
|
137
|
+
isChecked: isClicked
|
|
138
|
+
};
|
|
134
139
|
}
|
|
135
140
|
if (isSelectable) {
|
|
136
|
-
return { ...baseProps, onChange: selectableActions.onChange, isChecked:
|
|
141
|
+
return { ...baseProps, onChange: selectableActions.onChange, isChecked: isSelectableInputChecked };
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
return baseProps;
|
|
@@ -115,9 +115,9 @@ A common use case of this is to set all but one body section to `isFilled={false
|
|
|
115
115
|
|
|
116
116
|
### Selectable
|
|
117
117
|
|
|
118
|
-
A card can be selected by clicking anywhere within the card.
|
|
118
|
+
A selectable card can be selected by clicking anywhere within the card.
|
|
119
119
|
|
|
120
|
-
You must avoid rendering any other interactive content within the `<Card>` when it is meant to be selectable only. Refer to our [
|
|
120
|
+
You must avoid rendering any other interactive content within the `<Card>` when it is meant to be selectable only. Refer to our [actionable and selectable example](#clickable-and-selectable-cards) if you need a card that is both selectable and has other interactive, actionable content.
|
|
121
121
|
|
|
122
122
|
```ts file='./CardSelectable.tsx'
|
|
123
123
|
|
|
@@ -125,27 +125,29 @@ You must avoid rendering any other interactive content within the `<Card>` when
|
|
|
125
125
|
|
|
126
126
|
### Single selectable
|
|
127
127
|
|
|
128
|
-
When a group of single selectable cards are related, you
|
|
128
|
+
When a group of single selectable cards are related, you must pass the same `name` property to each card's `selectableActions` property.
|
|
129
129
|
|
|
130
130
|
```ts file='./CardSingleSelectable.tsx'
|
|
131
131
|
|
|
132
132
|
```
|
|
133
133
|
|
|
134
|
-
###
|
|
134
|
+
### Actionable
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
An actionable card can perform an action or navigate to a link by clicking anywhere within the card. To open a link in a new tab or window, pass the `isExternalLink` property to `selectableActions`.
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
You can pass the `isClicked` property to `<Card>` to convey that a card is the currently clicked one, such as when clicking a card would open a [primary-detail view](/patterns/primary-detail). This must not be used simply for "selection" of a card, and you should instead use our [selectable card](#selectable) or [single selectable card](#single-selectable).
|
|
139
|
+
|
|
140
|
+
When a card is meant to be actionable only, you must avoid rendering any other interactive content within the `<Card>`, similar to selectable cards.
|
|
139
141
|
|
|
140
142
|
```ts file='./CardClickable.tsx'
|
|
141
143
|
|
|
142
144
|
```
|
|
143
145
|
|
|
144
|
-
###
|
|
146
|
+
### Actionable and selectable
|
|
145
147
|
|
|
146
|
-
A card can be selectable and have additional interactive content by passing both the `isClickable` and `isSelectable` properties to `<Card>`. The following example shows how the
|
|
148
|
+
A card can be selectable and have additional interactive content by passing both the `isClickable` and `isSelectable` properties to `<Card>`. The following example shows how the actionable functionality can be rendered anywhere within a selectable card.
|
|
147
149
|
|
|
148
|
-
When passing interactive content to
|
|
150
|
+
When passing interactive content to an actionable and selectable card that is disabled, you should also ensure the interactive content is disabled as well, if applicable.
|
|
149
151
|
|
|
150
152
|
```ts file='./CardClickableSelectable.tsx'
|
|
151
153
|
|
|
@@ -170,6 +172,7 @@ An image can be placed in the card header to show users an icon beside the expan
|
|
|
170
172
|
```
|
|
171
173
|
|
|
172
174
|
### Card with dividers
|
|
175
|
+
|
|
173
176
|
Dividers can be placed between sections of the card.
|
|
174
177
|
|
|
175
178
|
```ts file='./CardWithDividers.tsx'
|
|
@@ -5,7 +5,7 @@ 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
|
-
const [
|
|
8
|
+
const [isClicked, setIsClicked] = React.useState(false);
|
|
9
9
|
const [isSecondary, setIsSecondary] = React.useState<boolean>(false);
|
|
10
10
|
|
|
11
11
|
const id1 = 'clickable-selectable-card-input-1';
|
|
@@ -13,7 +13,7 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
13
13
|
const id3 = 'clickable-selectable-card-input-3';
|
|
14
14
|
|
|
15
15
|
const onClick = () => {
|
|
16
|
-
|
|
16
|
+
setIsClicked((prevState) => !prevState);
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const onChange = (event: React.FormEvent<HTMLInputElement>, checked: boolean) => {
|
|
@@ -52,7 +52,8 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
52
52
|
id="clickable-selectable-card-example-1"
|
|
53
53
|
isClickable
|
|
54
54
|
isSelectable
|
|
55
|
-
isSelected={
|
|
55
|
+
isSelected={isChecked1}
|
|
56
|
+
isClicked={isClicked}
|
|
56
57
|
variant={isSecondary ? 'secondary' : 'default'}
|
|
57
58
|
>
|
|
58
59
|
<CardHeader
|
|
@@ -60,7 +61,6 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
60
61
|
selectableActionId: id1,
|
|
61
62
|
selectableActionAriaLabelledby: 'clickable-selectable-card-example-1',
|
|
62
63
|
name: id1,
|
|
63
|
-
isChecked: isChecked1,
|
|
64
64
|
onChange
|
|
65
65
|
}}
|
|
66
66
|
>
|
|
@@ -76,6 +76,7 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
76
76
|
id="clickable-selectable-card-example-2"
|
|
77
77
|
isClickable
|
|
78
78
|
isSelectable
|
|
79
|
+
isSelected={isChecked2}
|
|
79
80
|
variant={isSecondary ? 'secondary' : 'default'}
|
|
80
81
|
>
|
|
81
82
|
<CardHeader
|
|
@@ -83,7 +84,6 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
83
84
|
selectableActionId: id2,
|
|
84
85
|
selectableActionAriaLabelledby: 'clickable-selectable-card-example-2',
|
|
85
86
|
name: id2,
|
|
86
|
-
isChecked: isChecked2,
|
|
87
87
|
onChange
|
|
88
88
|
}}
|
|
89
89
|
>
|
|
@@ -102,6 +102,7 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
102
102
|
isClickable
|
|
103
103
|
isSelectable
|
|
104
104
|
isDisabled
|
|
105
|
+
isSelected={isChecked3}
|
|
105
106
|
variant={isSecondary ? 'secondary' : 'default'}
|
|
106
107
|
>
|
|
107
108
|
<CardHeader
|
|
@@ -109,7 +110,6 @@ export const CardClickable: React.FunctionComponent = () => {
|
|
|
109
110
|
selectableActionId: id3,
|
|
110
111
|
selectableActionAriaLabelledby: 'clickable-selectable-card-example-3',
|
|
111
112
|
name: id3,
|
|
112
|
-
isChecked: isChecked3,
|
|
113
113
|
onChange
|
|
114
114
|
}}
|
|
115
115
|
>
|
|
@@ -34,22 +34,25 @@ export const SelectableCard: React.FunctionComponent = () => {
|
|
|
34
34
|
return (
|
|
35
35
|
<>
|
|
36
36
|
<Checkbox
|
|
37
|
-
label="
|
|
37
|
+
label="Secondary card styling"
|
|
38
38
|
isChecked={isSecondary}
|
|
39
39
|
onChange={(_event, checked) => toggleVariant(checked)}
|
|
40
|
-
aria-label="add secondary styling"
|
|
41
40
|
id="toggle-variant-selectable"
|
|
42
41
|
name="toggle-variant"
|
|
43
42
|
/>
|
|
44
43
|
<div style={{ marginTop: '15px' }}>
|
|
45
44
|
<Gallery hasGutter>
|
|
46
|
-
<Card
|
|
45
|
+
<Card
|
|
46
|
+
id="selectable-card-example-1"
|
|
47
|
+
isSelectable
|
|
48
|
+
isSelected={isChecked1}
|
|
49
|
+
variant={isSecondary ? 'secondary' : 'default'}
|
|
50
|
+
>
|
|
47
51
|
<CardHeader
|
|
48
52
|
selectableActions={{
|
|
49
53
|
selectableActionId: id1,
|
|
50
54
|
selectableActionAriaLabelledby: 'selectable-card-example-1',
|
|
51
55
|
name: id1,
|
|
52
|
-
isChecked: isChecked1,
|
|
53
56
|
onChange
|
|
54
57
|
}}
|
|
55
58
|
>
|
|
@@ -57,13 +60,17 @@ export const SelectableCard: React.FunctionComponent = () => {
|
|
|
57
60
|
</CardHeader>
|
|
58
61
|
<CardBody>This card is selectable.</CardBody>
|
|
59
62
|
</Card>
|
|
60
|
-
<Card
|
|
63
|
+
<Card
|
|
64
|
+
id="selectable-card-example-2"
|
|
65
|
+
isSelectable
|
|
66
|
+
isSelected={isChecked2}
|
|
67
|
+
variant={isSecondary ? 'secondary' : 'default'}
|
|
68
|
+
>
|
|
61
69
|
<CardHeader
|
|
62
70
|
selectableActions={{
|
|
63
71
|
selectableActionId: id2,
|
|
64
72
|
selectableActionAriaLabelledby: 'selectable-card-example-2',
|
|
65
73
|
name: id2,
|
|
66
|
-
isChecked: isChecked2,
|
|
67
74
|
onChange
|
|
68
75
|
}}
|
|
69
76
|
>
|
|
@@ -71,13 +78,18 @@ export const SelectableCard: React.FunctionComponent = () => {
|
|
|
71
78
|
</CardHeader>
|
|
72
79
|
<CardBody>This card is selectable.</CardBody>
|
|
73
80
|
</Card>
|
|
74
|
-
<Card
|
|
81
|
+
<Card
|
|
82
|
+
id="selectable-card-example-3"
|
|
83
|
+
isSelectable
|
|
84
|
+
isDisabled
|
|
85
|
+
isSelected={isChecked3}
|
|
86
|
+
variant={isSecondary ? 'secondary' : 'default'}
|
|
87
|
+
>
|
|
75
88
|
<CardHeader
|
|
76
89
|
selectableActions={{
|
|
77
90
|
selectableActionId: id3,
|
|
78
91
|
selectableActionAriaLabelledby: 'selectable-card-example-3',
|
|
79
92
|
name: id3,
|
|
80
|
-
isChecked: isChecked3,
|
|
81
93
|
onChange
|
|
82
94
|
}}
|
|
83
95
|
>
|
|
@@ -2,45 +2,53 @@ import React from 'react';
|
|
|
2
2
|
import { Card, CardHeader, CardTitle, CardBody, Gallery } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const SingleSelectableCard: React.FunctionComponent = () => {
|
|
5
|
+
const [isChecked, setIsChecked] = React.useState('');
|
|
5
6
|
const id1 = 'single-selectable-card-input-1';
|
|
6
7
|
const id2 = 'single-selectable-card-input-2';
|
|
7
8
|
const id3 = 'single-selectable-card-input-3';
|
|
8
9
|
|
|
10
|
+
const onChange = (event: React.FormEvent<HTMLInputElement>) => {
|
|
11
|
+
setIsChecked(event.currentTarget.id);
|
|
12
|
+
};
|
|
13
|
+
|
|
9
14
|
return (
|
|
10
15
|
<Gallery hasGutter>
|
|
11
|
-
<Card id="single-selectable-card-example-1" isSelectable>
|
|
16
|
+
<Card id="single-selectable-card-example-1" isSelectable isSelected={isChecked === id1}>
|
|
12
17
|
<CardHeader
|
|
13
18
|
selectableActions={{
|
|
14
19
|
selectableActionId: id1,
|
|
15
20
|
selectableActionAriaLabelledby: 'single-selectable-card-example-1',
|
|
16
21
|
name: 'single-selectable-card-example',
|
|
17
|
-
variant: 'single'
|
|
22
|
+
variant: 'single',
|
|
23
|
+
onChange
|
|
18
24
|
}}
|
|
19
25
|
>
|
|
20
26
|
<CardTitle>First card</CardTitle>
|
|
21
27
|
</CardHeader>
|
|
22
28
|
<CardBody>This card is single selectable.</CardBody>
|
|
23
29
|
</Card>
|
|
24
|
-
<Card id="single-selectable-card-example-2" isSelectable>
|
|
30
|
+
<Card id="single-selectable-card-example-2" isSelectable isSelected={isChecked === id2}>
|
|
25
31
|
<CardHeader
|
|
26
32
|
selectableActions={{
|
|
27
33
|
selectableActionId: id2,
|
|
28
34
|
selectableActionAriaLabelledby: 'single-selectable-card-example-2',
|
|
29
35
|
name: 'single-selectable-card-example',
|
|
30
|
-
variant: 'single'
|
|
36
|
+
variant: 'single',
|
|
37
|
+
onChange
|
|
31
38
|
}}
|
|
32
39
|
>
|
|
33
40
|
<CardTitle>Second card</CardTitle>
|
|
34
41
|
</CardHeader>
|
|
35
42
|
<CardBody>This card is single selectable.</CardBody>
|
|
36
43
|
</Card>
|
|
37
|
-
<Card id="single-selectable-card-example-3" isSelectable isDisabled>
|
|
44
|
+
<Card id="single-selectable-card-example-3" isSelectable isDisabled isSelected={isChecked === id3}>
|
|
38
45
|
<CardHeader
|
|
39
46
|
selectableActions={{
|
|
40
47
|
selectableActionId: id3,
|
|
41
48
|
selectableActionAriaLabelledby: 'single-selectable-card-example-3',
|
|
42
49
|
name: 'single-selectable-card-example',
|
|
43
|
-
variant: 'single'
|
|
50
|
+
variant: 'single',
|
|
51
|
+
onChange
|
|
44
52
|
}}
|
|
45
53
|
>
|
|
46
54
|
<CardTitle>Third card</CardTitle>
|
|
@@ -2,7 +2,13 @@ import * as React from 'react';
|
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Drawer/drawer';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { DrawerMain } from './DrawerMain';
|
|
5
|
-
import {
|
|
5
|
+
import { DrawerContext } from './Drawer';
|
|
6
|
+
|
|
7
|
+
export enum DrawerContentColorVariant {
|
|
8
|
+
default = 'default',
|
|
9
|
+
primary = 'primary',
|
|
10
|
+
secondary = 'secondary'
|
|
11
|
+
}
|
|
6
12
|
|
|
7
13
|
export interface DrawerContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
8
14
|
/** Additional classes added to the Drawer. */
|
|
@@ -12,14 +18,14 @@ export interface DrawerContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
12
18
|
/** Content rendered in the drawer panel. */
|
|
13
19
|
panelContent: React.ReactNode;
|
|
14
20
|
/** Color variant of the background of the drawer panel */
|
|
15
|
-
colorVariant?:
|
|
21
|
+
colorVariant?: DrawerContentColorVariant | 'default' | 'primary' | 'secondary';
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
export const DrawerContent: React.FunctionComponent<DrawerContentProps> = ({
|
|
19
25
|
className,
|
|
20
26
|
children,
|
|
21
27
|
panelContent,
|
|
22
|
-
colorVariant =
|
|
28
|
+
colorVariant = DrawerContentColorVariant.default,
|
|
23
29
|
...props
|
|
24
30
|
}: DrawerContentProps) => {
|
|
25
31
|
const { drawerContentRef } = React.useContext(DrawerContext);
|
|
@@ -29,8 +35,8 @@ export const DrawerContent: React.FunctionComponent<DrawerContentProps> = ({
|
|
|
29
35
|
<div
|
|
30
36
|
className={css(
|
|
31
37
|
styles.drawerContent,
|
|
32
|
-
colorVariant ===
|
|
33
|
-
colorVariant ===
|
|
38
|
+
colorVariant === DrawerContentColorVariant.primary && styles.modifiers.primary,
|
|
39
|
+
colorVariant === DrawerContentColorVariant.secondary && styles.modifiers.secondary,
|
|
34
40
|
className
|
|
35
41
|
)}
|
|
36
42
|
ref={drawerContentRef}
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
DrawerCloseButton,
|
|
11
11
|
DrawerSection,
|
|
12
12
|
Button,
|
|
13
|
-
DrawerColorVariant
|
|
13
|
+
DrawerColorVariant,
|
|
14
|
+
DrawerContentColorVariant
|
|
14
15
|
} from '@patternfly/react-core';
|
|
15
16
|
|
|
16
17
|
export const DrawerSecondaryBackground: React.FunctionComponent = () => {
|
|
@@ -96,7 +97,7 @@ export const DrawerSecondaryBackground: React.FunctionComponent = () => {
|
|
|
96
97
|
drawer-section
|
|
97
98
|
</DrawerSection>
|
|
98
99
|
<DrawerContent
|
|
99
|
-
colorVariant={contentSecondary ?
|
|
100
|
+
colorVariant={contentSecondary ? DrawerContentColorVariant.secondary : DrawerContentColorVariant.default}
|
|
100
101
|
panelContent={panelContent}
|
|
101
102
|
>
|
|
102
103
|
<DrawerContentBody>{drawerContent}</DrawerContentBody>
|
|
@@ -295,19 +295,21 @@ class Page extends React.Component<PageProps, PageState> {
|
|
|
295
295
|
const Component: keyof JSX.IntrinsicElements = mainComponent;
|
|
296
296
|
|
|
297
297
|
const main = (
|
|
298
|
-
<
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
298
|
+
<div className={css(styles.pageMainContainer)}>
|
|
299
|
+
<Component
|
|
300
|
+
ref={this.mainRef}
|
|
301
|
+
role={role}
|
|
302
|
+
id={mainContainerId}
|
|
303
|
+
className={css(styles.pageMain)}
|
|
304
|
+
tabIndex={mainTabIndex}
|
|
305
|
+
aria-label={mainAriaLabel}
|
|
306
|
+
>
|
|
307
|
+
{group}
|
|
308
|
+
{!isHorizontalSubnavGrouped && nav}
|
|
309
|
+
{!isBreadcrumbGrouped && crumb}
|
|
310
|
+
{children}
|
|
311
|
+
</Component>
|
|
312
|
+
</div>
|
|
311
313
|
);
|
|
312
314
|
|
|
313
315
|
const panelContent = <DrawerPanelContent>{notificationDrawer}</DrawerPanelContent>;
|