@patternfly/react-core 4.178.0 → 4.180.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 +38 -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/DualListSelector/DualListSelectorTree.d.ts +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTree.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTree.js +2 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTree.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTreeItem.d.ts +3 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTreeItem.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTreeItem.js +24 -2
- package/dist/esm/components/DualListSelector/DualListSelectorTreeItem.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/DualListSelector/DualListSelectorTree.d.ts +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorTree.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorTree.js +2 -1
- package/dist/js/components/DualListSelector/DualListSelectorTree.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorTreeItem.d.ts +3 -1
- package/dist/js/components/DualListSelector/DualListSelectorTreeItem.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorTreeItem.js +24 -3
- package/dist/js/components/DualListSelector/DualListSelectorTreeItem.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 +449 -278
- package/dist/umd/react-core.js +54 -8
- package/dist/umd/react-core.min.css +183 -12
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- 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/DualListSelector/DualListSelectorTree.tsx +4 -2
- package/src/components/DualListSelector/DualListSelectorTreeItem.tsx +32 -1
- package/src/components/DualListSelector/__tests__/__snapshots__/DualListSelector.test.tsx.snap +3 -0
- package/src/components/DualListSelector/examples/ComposableTree.tsx +345 -0
- package/src/components/DualListSelector/examples/DualListSelector.md +5 -1
- package/src/components/Toolbar/examples/Toolbar.md +1 -1
- package/src/demos/Card/Card.md +47 -23
- 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
|
|
|
@@ -37,7 +37,7 @@ export interface DualListSelectorTreeItemData {
|
|
|
37
37
|
|
|
38
38
|
export interface DualListSelectorTreeProps {
|
|
39
39
|
/** Data of the tree view */
|
|
40
|
-
data: DualListSelectorTreeItemData[];
|
|
40
|
+
data: DualListSelectorTreeItemData[] | (() => DualListSelectorTreeItemData[]);
|
|
41
41
|
/** ID of the tree view */
|
|
42
42
|
id?: string;
|
|
43
43
|
/** @hide Flag indicating if the list is nested */
|
|
@@ -64,7 +64,8 @@ export const DualListSelectorTree: React.FunctionComponent<DualListSelectorTreeP
|
|
|
64
64
|
isDisabled = false,
|
|
65
65
|
...props
|
|
66
66
|
}: DualListSelectorTreeProps) => {
|
|
67
|
-
const
|
|
67
|
+
const dataToRender = typeof data === 'function' ? data() : data;
|
|
68
|
+
const tree = dataToRender.map(item => (
|
|
68
69
|
<DualListSelectorTreeItem
|
|
69
70
|
key={item.id}
|
|
70
71
|
text={item.text}
|
|
@@ -77,6 +78,7 @@ export const DualListSelectorTree: React.FunctionComponent<DualListSelectorTreeP
|
|
|
77
78
|
badgeProps={item.badgeProps}
|
|
78
79
|
itemData={item}
|
|
79
80
|
isDisabled={isDisabled}
|
|
81
|
+
useMemo={true}
|
|
80
82
|
{...(item.children && {
|
|
81
83
|
children: (
|
|
82
84
|
<DualListSelectorTree
|