@patternfly/react-core 4.176.0 → 4.179.1
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 +49 -0
- package/dist/esm/components/Card/Card.d.ts +5 -7
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/Card/Card.js +14 -2
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/DragDrop/Droppable.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/Droppable.js +5 -1
- package/dist/esm/components/DragDrop/Droppable.js.map +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts +3 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.js +4 -4
- package/dist/esm/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/esm/components/Dropdown/Toggle.d.ts +3 -1
- package/dist/esm/components/Dropdown/Toggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Toggle.js +8 -3
- package/dist/esm/components/Dropdown/Toggle.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +2 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/Popover/Popover.d.ts.map +1 -1
- package/dist/esm/components/Popover/Popover.js +2 -22
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/js/components/Card/Card.d.ts +5 -7
- package/dist/js/components/Card/Card.d.ts.map +1 -1
- package/dist/js/components/Card/Card.js +14 -2
- package/dist/js/components/Card/Card.js.map +1 -1
- package/dist/js/components/DragDrop/Droppable.d.ts.map +1 -1
- package/dist/js/components/DragDrop/Droppable.js +5 -1
- package/dist/js/components/DragDrop/Droppable.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts +3 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.js +4 -4
- package/dist/js/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/js/components/Dropdown/Toggle.d.ts +3 -1
- package/dist/js/components/Dropdown/Toggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Toggle.js +8 -3
- package/dist/js/components/Dropdown/Toggle.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +2 -1
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/Popover/Popover.d.ts.map +1 -1
- package/dist/js/components/Popover/Popover.js +2 -22
- package/dist/js/components/Popover/Popover.js.map +1 -1
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-Black.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-BlackItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-Bold.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-BoldItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-Italic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-Light.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-LightItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-Medium.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-MediumItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplay-updated-Regular.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplayVF-updated-Italic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatDisplay/RedHatDisplayVF-updated.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-Bold.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-BoldItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-Italic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-Light.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-LightItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-Medium.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-MediumItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMono-updated-Regular.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMonoVF-updated-Italic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatMono/RedHatMonoVF-updated.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-Bold.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-BoldItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-Italic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-Light.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-LightItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-Medium.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-MediumItalic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatText-updated-Regular.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatTextVF-updated-Italic.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/RedHatText/RedHatTextVF-updated.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/modified/RedHatDisplayVF-updated-ItalicModified.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/modified/RedHatDisplayVFModified-updated.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/modified/RedHatTextVF-updated-ItalicModified.woff2 +0 -0
- package/dist/styles/assets/fonts/RedHatFont-updated/modified/RedHatTextVFModified-updated.woff2 +0 -0
- package/dist/styles/base-no-reset.css +121 -0
- package/dist/styles/base.css +121 -15
- package/dist/umd/react-core.css +183 -12
- package/dist/umd/react-core.js +44 -35
- package/dist/umd/react-core.min.css +4004 -3833
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Alert/examples/Alert.md +201 -382
- package/src/components/Alert/examples/AlertAsyncLiveRegion.tsx +61 -0
- package/src/components/Alert/examples/AlertDynamicLiveRegion.tsx +61 -0
- package/src/components/ApplicationLauncher/__tests__/__snapshots__/ApplicationLauncher.test.tsx.snap +6 -0
- package/src/components/Card/Card.tsx +23 -17
- package/src/components/Card/__tests__/Card.test.tsx +8 -14
- package/src/components/Card/__tests__/__snapshots__/Card.test.tsx.snap +2 -12
- package/src/components/Card/examples/Card.md +230 -264
- package/src/components/DragDrop/Droppable.tsx +5 -1
- package/src/components/DragDrop/examples/DragDrop.md +2 -0
- package/src/components/Dropdown/DropdownToggle.tsx +6 -1
- package/src/components/Dropdown/Toggle.tsx +11 -1
- package/src/components/Dropdown/__tests__/DropdownToggle.test.tsx +51 -0
- package/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +8 -0
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +346 -4
- package/src/components/Dropdown/__tests__/__snapshots__/Toggle.test.tsx.snap +1 -0
- package/src/components/Dropdown/examples/Dropdown.md +160 -91
- package/src/components/MenuToggle/MenuToggle.tsx +5 -2
- package/src/components/MenuToggle/__tests__/MenuToggle.test.tsx +5 -0
- package/src/components/MenuToggle/__tests__/__snapshots__/MenuToggle.test.tsx.snap +59 -0
- package/src/components/MenuToggle/examples/MenuToggle.md +60 -67
- package/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap +7 -0
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +15 -0
- package/src/components/Popover/Popover.tsx +1 -19
- package/src/components/Popover/__tests__/Generated/__snapshots__/Popover.test.tsx.snap +0 -1
- package/src/components/Popover/__tests__/__snapshots__/Popover.test.tsx.snap +0 -4
- package/src/demos/Card/Card.md +47 -23
- package/src/demos/CardDemos.md +65 -91
- package/src/demos/Tabs/NestedTabsDemo.js +151 -0
- package/src/demos/Tabs.md +4 -0
- package/src/demos/TextInputGroupDemo.md +8 -246
- package/src/demos/examples/TextInputGroup/AttributeValueFiltering.js +250 -0
- package/src/demos/examples/TextInputGroup/AutoCompleteSearch.js +230 -0
|
@@ -13,7 +13,7 @@ import pfLogoSmall from './pf-logo-small.svg';
|
|
|
13
13
|
|
|
14
14
|
### Basic
|
|
15
15
|
|
|
16
|
-
```
|
|
16
|
+
```ts
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
|
|
19
19
|
|
|
@@ -26,12 +26,12 @@ import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
|
|
|
26
26
|
|
|
27
27
|
### Modifiers
|
|
28
28
|
|
|
29
|
-
```
|
|
29
|
+
```ts
|
|
30
30
|
import React from 'react';
|
|
31
31
|
import { Card, CardTitle, CardBody, CardFooter, Checkbox } from '@patternfly/react-core';
|
|
32
32
|
|
|
33
|
-
CardModifiers = () => {
|
|
34
|
-
const mods = ['
|
|
33
|
+
const CardModifiers: React.FunctionComponent = () => {
|
|
34
|
+
const mods = ['isCompact', 'isFlat', 'isRounded', 'isLarge', 'isFullHeight', 'isPlain'];
|
|
35
35
|
const [modifiers, setModifiers] = React.useState({});
|
|
36
36
|
|
|
37
37
|
return (
|
|
@@ -64,7 +64,7 @@ CardModifiers = () => {
|
|
|
64
64
|
|
|
65
65
|
### With image and actions
|
|
66
66
|
|
|
67
|
-
```
|
|
67
|
+
```ts
|
|
68
68
|
import React from 'react';
|
|
69
69
|
import {
|
|
70
70
|
Brand,
|
|
@@ -83,104 +83,86 @@ import {
|
|
|
83
83
|
} from '@patternfly/react-core';
|
|
84
84
|
import pfLogo from './pfLogo.svg';
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
86
|
+
const KebabDropdown: React.FunctionComponent = () => {
|
|
87
|
+
const [isOpen, setIsOpen] = React.useState<boolean>(false);
|
|
88
|
+
const [check1, setCheck1] = React.useState<boolean>(false);
|
|
89
|
+
const [hasNoOffset, setHasNoOffset] = React.useState<boolean>(false);
|
|
90
|
+
|
|
91
|
+
const onSelect = () => {
|
|
92
|
+
setIsOpen(!isOpen)
|
|
93
|
+
};
|
|
94
|
+
const onClick = (checked: boolean) => {
|
|
95
|
+
setCheck1(checked);
|
|
96
|
+
};
|
|
97
|
+
const toggleOffset = (checked: boolean) => {
|
|
98
|
+
setHasNoOffset(checked);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const dropdownItems = [
|
|
102
|
+
<DropdownItem key="link">Link</DropdownItem>,
|
|
103
|
+
<DropdownItem key="action" component="button">
|
|
104
|
+
Action
|
|
105
|
+
</DropdownItem>,
|
|
106
|
+
<DropdownItem key="disabled link" isDisabled>
|
|
107
|
+
Disabled Link
|
|
108
|
+
</DropdownItem>,
|
|
109
|
+
<DropdownItem key="disabled action" isDisabled component="button">
|
|
110
|
+
Disabled Action
|
|
111
|
+
</DropdownItem>,
|
|
112
|
+
<DropdownSeparator key="separator" />,
|
|
113
|
+
<DropdownItem key="separated link">Separated Link</DropdownItem>,
|
|
114
|
+
<DropdownItem key="separated action" component="button">
|
|
115
|
+
Separated Action
|
|
116
|
+
</DropdownItem>
|
|
117
|
+
];
|
|
116
118
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
/>
|
|
159
|
-
</CardActions>
|
|
160
|
-
</CardHeader>
|
|
161
|
-
<CardTitle>Header</CardTitle>
|
|
162
|
-
<CardBody>Body</CardBody>
|
|
163
|
-
<CardFooter>Footer</CardFooter>
|
|
164
|
-
</Card>
|
|
165
|
-
<div style={{ marginTop: '20px' }}>
|
|
166
|
-
<Checkbox
|
|
167
|
-
label="actions hasNoOffset"
|
|
168
|
-
isChecked={this.state.hasNoOffset}
|
|
169
|
-
onChange={this.toggleOffset}
|
|
170
|
-
aria-label="remove actions offset"
|
|
171
|
-
id="toggle-actions-offset"
|
|
172
|
-
name="toggle-actions-offset"
|
|
173
|
-
/>
|
|
174
|
-
</div>
|
|
175
|
-
</>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
119
|
+
return (
|
|
120
|
+
<>
|
|
121
|
+
<Card>
|
|
122
|
+
<CardHeader>
|
|
123
|
+
<CardHeaderMain>
|
|
124
|
+
<Brand src={pfLogo} alt="PatternFly logo" style={{ height: '50px' }} />
|
|
125
|
+
</CardHeaderMain>
|
|
126
|
+
<CardActions hasNoOffset={hasNoOffset}>
|
|
127
|
+
<Dropdown
|
|
128
|
+
onSelect={onSelect}
|
|
129
|
+
toggle={<KebabToggle onToggle={setIsOpen} />}
|
|
130
|
+
isOpen={isOpen}
|
|
131
|
+
isPlain
|
|
132
|
+
dropdownItems={dropdownItems}
|
|
133
|
+
position={'right'}
|
|
134
|
+
/>
|
|
135
|
+
<Checkbox
|
|
136
|
+
isChecked={check1}
|
|
137
|
+
onChange={onClick}
|
|
138
|
+
aria-label="card checkbox example"
|
|
139
|
+
id="check-1"
|
|
140
|
+
name="check1"
|
|
141
|
+
/>
|
|
142
|
+
</CardActions>
|
|
143
|
+
</CardHeader>
|
|
144
|
+
<CardTitle>Header</CardTitle>
|
|
145
|
+
<CardBody>Body</CardBody>
|
|
146
|
+
<CardFooter>Footer</CardFooter>
|
|
147
|
+
</Card>
|
|
148
|
+
<div style={{ marginTop: '20px' }}>
|
|
149
|
+
<Checkbox
|
|
150
|
+
label="actions hasNoOffset"
|
|
151
|
+
isChecked={hasNoOffset}
|
|
152
|
+
onChange={toggleOffset}
|
|
153
|
+
aria-label="remove actions offset"
|
|
154
|
+
id="toggle-actions-offset"
|
|
155
|
+
name="toggle-actions-offset"
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
178
160
|
}
|
|
179
161
|
```
|
|
180
162
|
|
|
181
163
|
### Card header in card head
|
|
182
164
|
|
|
183
|
-
```
|
|
165
|
+
```ts
|
|
184
166
|
import React from 'react';
|
|
185
167
|
import {
|
|
186
168
|
Card,
|
|
@@ -196,79 +178,63 @@ import {
|
|
|
196
178
|
KebabToggle
|
|
197
179
|
} from '@patternfly/react-core';
|
|
198
180
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
181
|
+
const KebabDropdown: React.FunctionComponent = () => {
|
|
182
|
+
const [isOpen, setIsOpen] = React.useState<boolean>(false);
|
|
183
|
+
const [check1, setCheck1] = React.useState<boolean>(false);
|
|
184
|
+
|
|
185
|
+
const onSelect = () => {
|
|
186
|
+
setIsOpen(!isOpen)
|
|
187
|
+
};
|
|
188
|
+
const onClick = (checked: boolean) => {
|
|
189
|
+
setCheck1(checked);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const dropdownItems = [
|
|
193
|
+
<DropdownItem key="link">Link</DropdownItem>,
|
|
194
|
+
<DropdownItem key="action" component="button">
|
|
195
|
+
Action
|
|
196
|
+
</DropdownItem>,
|
|
197
|
+
<DropdownItem key="disabled link" isDisabled>
|
|
198
|
+
Disabled Link
|
|
199
|
+
</DropdownItem>,
|
|
200
|
+
<DropdownItem key="disabled action" isDisabled component="button">
|
|
201
|
+
Disabled Action
|
|
202
|
+
</DropdownItem>,
|
|
203
|
+
<DropdownSeparator key="separator" />,
|
|
204
|
+
<DropdownItem key="separated link">Separated Link</DropdownItem>,
|
|
205
|
+
<DropdownItem key="separated action" component="button">
|
|
206
|
+
Separated Action
|
|
207
|
+
</DropdownItem>
|
|
208
|
+
];
|
|
223
209
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
dropdownItems={dropdownItems}
|
|
253
|
-
position={'right'}
|
|
254
|
-
/>
|
|
255
|
-
<Checkbox
|
|
256
|
-
isChecked={this.state.check1}
|
|
257
|
-
onChange={this.onClick}
|
|
258
|
-
aria-label="card checkbox example"
|
|
259
|
-
id="check-2"
|
|
260
|
-
name="check2"
|
|
261
|
-
/>
|
|
262
|
-
</CardActions>
|
|
263
|
-
<CardTitle>
|
|
264
|
-
This is a really really really really really really really really really really long header
|
|
265
|
-
</CardTitle>
|
|
266
|
-
</CardHeader>
|
|
267
|
-
<CardBody>Body</CardBody>
|
|
268
|
-
<CardFooter>Footer</CardFooter>
|
|
269
|
-
</Card>
|
|
270
|
-
);
|
|
271
|
-
}
|
|
210
|
+
return (
|
|
211
|
+
<Card>
|
|
212
|
+
<CardHeader>
|
|
213
|
+
<CardActions>
|
|
214
|
+
<Dropdown
|
|
215
|
+
onSelect={onSelect}
|
|
216
|
+
toggle={<KebabToggle onToggle={setIsOpen} />}
|
|
217
|
+
isOpen={isOpen}
|
|
218
|
+
isPlain
|
|
219
|
+
dropdownItems={dropdownItems}
|
|
220
|
+
position={'right'}
|
|
221
|
+
/>
|
|
222
|
+
<Checkbox
|
|
223
|
+
isChecked={check1}
|
|
224
|
+
onChange={onClick}
|
|
225
|
+
aria-label="card checkbox example"
|
|
226
|
+
id="check-2"
|
|
227
|
+
name="check2"
|
|
228
|
+
/>
|
|
229
|
+
</CardActions>
|
|
230
|
+
<CardTitle>
|
|
231
|
+
This is a really really really really really really really really really really long header
|
|
232
|
+
</CardTitle>
|
|
233
|
+
</CardHeader>
|
|
234
|
+
<CardBody>Body</CardBody>
|
|
235
|
+
<CardFooter>Footer</CardFooter>
|
|
236
|
+
</Card>
|
|
237
|
+
);
|
|
272
238
|
}
|
|
273
239
|
```
|
|
274
240
|
|
|
@@ -445,7 +411,7 @@ import { Card, CardTitle, CardBody, CardFooter } from '@patternfly/react-core';
|
|
|
445
411
|
|
|
446
412
|
### Selectable and selected
|
|
447
413
|
|
|
448
|
-
```
|
|
414
|
+
```ts
|
|
449
415
|
import React from 'react';
|
|
450
416
|
import {
|
|
451
417
|
Card,
|
|
@@ -459,100 +425,100 @@ import {
|
|
|
459
425
|
KebabToggle
|
|
460
426
|
} from '@patternfly/react-core';
|
|
461
427
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
<
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
<
|
|
543
|
-
<
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
428
|
+
const SelectableCard: React.FunctionComponent = () => {
|
|
429
|
+
const [selected, setSelected] = React.useState<string>('');
|
|
430
|
+
const [isKebabOpen, setIsKebabOpen] = React.useState<boolean>(false);
|
|
431
|
+
|
|
432
|
+
const onKeyDown = (event: React.KeyboardEvent) => {
|
|
433
|
+
if (event.target !== event.currentTarget) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if ([' ', 'Enter'].includes(event.key)) {
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
const newSelected = event.currentTarget.id === selected ? null : event.currentTarget.id;
|
|
439
|
+
setSelected(newSelected);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
const onClick = (event: React.MouseEvent) => {
|
|
444
|
+
const newSelected = event.currentTarget.id === selected ? null : event.currentTarget.id;
|
|
445
|
+
setSelected(newSelected);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
const onToggle = (isOpen: boolean, event: MouseEvent | TouchEvent | KeyboardEvent | React.KeyboardEvent<any> | React.MouseEvent<HTMLButtonElement>) => {
|
|
449
|
+
event.stopPropagation();
|
|
450
|
+
setIsKebabOpen(isOpen);
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
const onSelect = (event: React.SyntheticEvent<HTMLDivElement>) => {
|
|
454
|
+
event.stopPropagation();
|
|
455
|
+
setIsKebabOpen(false);
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
const dropdownItems = [
|
|
459
|
+
<DropdownItem key="link">Link</DropdownItem>,
|
|
460
|
+
<DropdownItem key="action" component="button">
|
|
461
|
+
Action
|
|
462
|
+
</DropdownItem>,
|
|
463
|
+
<DropdownItem key="disabled link" isDisabled>
|
|
464
|
+
Disabled Link
|
|
465
|
+
</DropdownItem>,
|
|
466
|
+
<DropdownItem key="disabled action" isDisabled component="button">
|
|
467
|
+
Disabled Action
|
|
468
|
+
</DropdownItem>,
|
|
469
|
+
<DropdownSeparator key="separator" />,
|
|
470
|
+
<DropdownItem key="separated link">Separated Link</DropdownItem>,
|
|
471
|
+
<DropdownItem key="separated action" component="button">
|
|
472
|
+
Separated Action
|
|
473
|
+
</DropdownItem>
|
|
474
|
+
];
|
|
475
|
+
|
|
476
|
+
return (
|
|
477
|
+
<React.Fragment>
|
|
478
|
+
<Card
|
|
479
|
+
id="first-card"
|
|
480
|
+
onKeyDown={onKeyDown}
|
|
481
|
+
onClick={onClick}
|
|
482
|
+
isSelectableRaised
|
|
483
|
+
isSelected={selected === 'first-card'}
|
|
484
|
+
>
|
|
485
|
+
<CardHeader>
|
|
486
|
+
<CardActions>
|
|
487
|
+
<Dropdown
|
|
488
|
+
onSelect={onSelect}
|
|
489
|
+
toggle={<KebabToggle onToggle={onToggle} />}
|
|
490
|
+
isOpen={isKebabOpen}
|
|
491
|
+
isPlain
|
|
492
|
+
dropdownItems={dropdownItems}
|
|
493
|
+
position={'right'}
|
|
494
|
+
/>
|
|
495
|
+
</CardActions>
|
|
496
|
+
</CardHeader>
|
|
497
|
+
<CardTitle>First card</CardTitle>
|
|
498
|
+
<CardBody>This is a selectable card. Click me to select me. Click again to deselect me.</CardBody>
|
|
499
|
+
</Card>
|
|
500
|
+
<br />
|
|
501
|
+
<Card
|
|
502
|
+
id="second-card"
|
|
503
|
+
onKeyDown={onKeyDown}
|
|
504
|
+
onClick={onClick}
|
|
505
|
+
isSelectableRaised
|
|
506
|
+
isSelected={selected === 'second-card'}
|
|
507
|
+
>
|
|
508
|
+
<CardTitle>Second card</CardTitle>
|
|
509
|
+
<CardBody>This is a selectable card. Click me to select me. Click again to deselect me.</CardBody>
|
|
510
|
+
</Card>
|
|
511
|
+
<br />
|
|
512
|
+
<Card
|
|
513
|
+
id="third-card"
|
|
514
|
+
isSelectableRaised
|
|
515
|
+
isDisabledRaised
|
|
516
|
+
>
|
|
517
|
+
<CardTitle>Third card</CardTitle>
|
|
518
|
+
<CardBody>This is a raised but disabled card.</CardBody>
|
|
519
|
+
</Card>
|
|
520
|
+
</React.Fragment>
|
|
521
|
+
);
|
|
556
522
|
}
|
|
557
523
|
```
|
|
558
524
|
|
|
@@ -27,7 +27,11 @@ export const Droppable: React.FunctionComponent<DroppableProps> = ({
|
|
|
27
27
|
const childProps = {
|
|
28
28
|
'data-pf-droppable': zone,
|
|
29
29
|
'data-pf-droppableid': droppableId,
|
|
30
|
-
|
|
30
|
+
// if has no wrapper is set, don't overwrite children className with the className prop
|
|
31
|
+
className:
|
|
32
|
+
hasNoWrapper && React.Children.count(children) === 1
|
|
33
|
+
? css(styles.droppable, className, (children as React.ReactElement).props.className)
|
|
34
|
+
: css(styles.droppable, className),
|
|
31
35
|
...props
|
|
32
36
|
};
|
|
33
37
|
|
|
@@ -27,8 +27,10 @@ export interface DropdownToggleProps extends React.HTMLProps<HTMLButtonElement>,
|
|
|
27
27
|
isPlain?: boolean;
|
|
28
28
|
/** Whether or not the <div> has a disabled state */
|
|
29
29
|
isDisabled?: boolean;
|
|
30
|
-
/** Whether or not the dropdown toggle button should have primary button styling */
|
|
30
|
+
/** @deprecated Use `toggleVariant` instead. Whether or not the dropdown toggle button should have primary button styling */
|
|
31
31
|
isPrimary?: boolean;
|
|
32
|
+
/** Alternate styles for the dropdown toggle button */
|
|
33
|
+
toggleVariant?: 'primary' | 'secondary' | 'default';
|
|
32
34
|
/** An image to display within the dropdown toggle, appearing before any component children */
|
|
33
35
|
icon?: React.ReactNode;
|
|
34
36
|
/** The icon to display for the toggle, appearing after any component children. Defaults to CaretDownIcon. Set to null to not show an icon. */
|
|
@@ -57,6 +59,7 @@ export const DropdownToggle: React.FunctionComponent<DropdownToggleProps> = ({
|
|
|
57
59
|
isDisabled = false,
|
|
58
60
|
isPlain = false,
|
|
59
61
|
isPrimary = false,
|
|
62
|
+
toggleVariant = 'default',
|
|
60
63
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
61
64
|
isActive = false,
|
|
62
65
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -87,6 +90,7 @@ export const DropdownToggle: React.FunctionComponent<DropdownToggleProps> = ({
|
|
|
87
90
|
isDisabled={isDisabled}
|
|
88
91
|
isPlain={isPlain}
|
|
89
92
|
isPrimary={isPrimary}
|
|
93
|
+
toggleVariant={toggleVariant}
|
|
90
94
|
onToggle={onToggle}
|
|
91
95
|
aria-haspopup={ariaHasPopup}
|
|
92
96
|
{...ouiaProps}
|
|
@@ -111,6 +115,7 @@ export const DropdownToggle: React.FunctionComponent<DropdownToggleProps> = ({
|
|
|
111
115
|
styles.dropdownToggle,
|
|
112
116
|
styles.modifiers.splitButton,
|
|
113
117
|
splitButtonVariant === 'action' && styles.modifiers.action,
|
|
118
|
+
(toggleVariant === 'primary' || isPrimary) && splitButtonVariant === 'action' && styles.modifiers.primary,
|
|
114
119
|
isDisabled && styles.modifiers.disabled
|
|
115
120
|
)}
|
|
116
121
|
>
|
|
@@ -33,16 +33,24 @@ export interface ToggleProps {
|
|
|
33
33
|
isDisabled?: boolean;
|
|
34
34
|
/** Display the toggle with no border or background */
|
|
35
35
|
isPlain?: boolean;
|
|
36
|
-
/** Display the toggle with a primary button style */
|
|
36
|
+
/** @deprecated Use `toggleVariant` instead. Display the toggle with a primary button style */
|
|
37
37
|
isPrimary?: boolean;
|
|
38
38
|
/** Style the toggle as a child of a split button */
|
|
39
39
|
isSplitButton?: boolean;
|
|
40
|
+
/** Alternate styles for the dropdown toggle button */
|
|
41
|
+
toggleVariant?: 'primary' | 'secondary' | 'default';
|
|
40
42
|
/** Flag for aria popup */
|
|
41
43
|
'aria-haspopup'?: boolean | 'listbox' | 'menu' | 'dialog' | 'grid' | 'tree';
|
|
42
44
|
/** Allows selecting toggle to select parent */
|
|
43
45
|
bubbleEvent?: boolean;
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
const buttonVariantStyles = {
|
|
49
|
+
default: '',
|
|
50
|
+
primary: styles.modifiers.primary,
|
|
51
|
+
secondary: styles.modifiers.secondary
|
|
52
|
+
};
|
|
53
|
+
|
|
46
54
|
export class Toggle extends React.Component<ToggleProps> {
|
|
47
55
|
static displayName = 'Toggle';
|
|
48
56
|
private buttonRef = React.createRef<HTMLButtonElement>();
|
|
@@ -129,6 +137,7 @@ export class Toggle extends React.Component<ToggleProps> {
|
|
|
129
137
|
isPlain,
|
|
130
138
|
isPrimary,
|
|
131
139
|
isSplitButton,
|
|
140
|
+
toggleVariant,
|
|
132
141
|
onToggle,
|
|
133
142
|
'aria-haspopup': ariaHasPopup,
|
|
134
143
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -154,6 +163,7 @@ export class Toggle extends React.Component<ToggleProps> {
|
|
|
154
163
|
isActive && styles.modifiers.active,
|
|
155
164
|
isPlain && styles.modifiers.plain,
|
|
156
165
|
isPrimary && styles.modifiers.primary,
|
|
166
|
+
buttonVariantStyles[toggleVariant],
|
|
157
167
|
className
|
|
158
168
|
)}
|
|
159
169
|
type={type || 'button'}
|