@patternfly/react-core 4.222.1 → 4.222.4
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 +24 -0
- package/dist/esm/components/AboutModal/AboutModal.d.ts +1 -1
- package/dist/esm/components/AboutModal/AboutModal.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.js +6 -5
- package/dist/esm/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorPane.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorPane.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/Modal/Modal.d.ts +1 -1
- package/dist/esm/components/Modal/Modal.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/esm/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/js/components/AboutModal/AboutModal.d.ts +1 -1
- package/dist/js/components/AboutModal/AboutModal.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.js +6 -5
- package/dist/js/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorPane.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorPane.js.map +1 -1
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/Modal/Modal.d.ts +1 -1
- package/dist/js/components/Modal/Modal.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +2 -1
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.d.ts.map +1 -1
- package/dist/js/components/Toolbar/ToolbarToggleGroup.js.map +1 -1
- package/dist/umd/react-core.css +1 -5
- package/dist/umd/react-core.js +8 -6
- package/dist/umd/react-core.min.css +1 -5
- package/package.json +6 -6
- package/src/components/AboutModal/AboutModal.tsx +1 -1
- package/src/components/DualListSelector/DualListSelector.tsx +57 -37
- package/src/components/DualListSelector/DualListSelectorPane.tsx +10 -8
- package/src/components/InputGroup/examples/InputGroup.md +5 -237
- package/src/components/InputGroup/examples/InputGroupBasic.tsx +31 -0
- package/src/components/InputGroup/examples/InputGroupWithDropdown.tsx +43 -0
- package/src/components/InputGroup/examples/InputGroupWithPopover.tsx +33 -0
- package/src/components/InputGroup/examples/InputGroupWithSiblings.tsx +32 -0
- package/src/components/InputGroup/examples/InputGroupWithTextarea.tsx +13 -0
- package/src/components/Label/examples/Label.md +5 -399
- package/src/components/Label/examples/LabelCompact.tsx +27 -0
- package/src/components/Label/examples/LabelFilled.tsx +167 -0
- package/src/components/Label/examples/LabelOutline.tsx +188 -0
- package/src/components/Label/examples/LabelRouterLink.tsx +20 -0
- package/src/components/Menu/MenuItem.tsx +1 -1
- package/src/components/MenuToggle/MenuToggle.tsx +1 -1
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/components/Select/Select.tsx +6 -3
- package/src/components/Toolbar/ToolbarToggleGroup.tsx +4 -1
- package/src/demos/Wizard/WizardDemo.md +66 -121
package/dist/umd/react-core.css
CHANGED
|
@@ -11978,10 +11978,6 @@ ul.pf-c-list {
|
|
|
11978
11978
|
--pf-c-menu--m-nav__list-item--first-child--c-menu--Top: 0;
|
|
11979
11979
|
}
|
|
11980
11980
|
|
|
11981
|
-
.pf-c-menu .pf-c-menu__content {
|
|
11982
|
-
overflow: visible hidden;
|
|
11983
|
-
}
|
|
11984
|
-
|
|
11985
11981
|
.pf-c-menu .pf-c-menu__content .pf-c-menu .pf-c-menu__content {
|
|
11986
11982
|
overflow: visible;
|
|
11987
11983
|
}
|
|
@@ -12024,7 +12020,7 @@ ul.pf-c-list {
|
|
|
12024
12020
|
|
|
12025
12021
|
.pf-c-menu.pf-m-drilldown > .pf-c-menu__content {
|
|
12026
12022
|
flex-grow: 1;
|
|
12027
|
-
overflow
|
|
12023
|
+
overflow: hidden;
|
|
12028
12024
|
transition: var(--pf-c-menu--m-drilldown__content--Transition);
|
|
12029
12025
|
}
|
|
12030
12026
|
|
package/dist/umd/react-core.js
CHANGED
|
@@ -7632,7 +7632,8 @@
|
|
|
7632
7632
|
typeaheadFilteredChildren =
|
|
7633
7633
|
typeaheadInputValue.toString() !== ''
|
|
7634
7634
|
? React__namespace.Children.map(children, group => {
|
|
7635
|
-
if (React__namespace.isValidElement(group) &&
|
|
7635
|
+
if (React__namespace.isValidElement(group) &&
|
|
7636
|
+
group.type === SelectGroup) {
|
|
7636
7637
|
const filteredGroupChildren = React__namespace.Children.toArray(group.props.children).filter(childFilter);
|
|
7637
7638
|
if (filteredGroupChildren.length > 0) {
|
|
7638
7639
|
return React__namespace.cloneElement(group, {
|
|
@@ -11654,18 +11655,19 @@
|
|
|
11654
11655
|
const { availableOptions, chosenOptions, chosenOptionsSelected, availableOptionsSelected, chosenTreeOptionsChecked, availableTreeOptionsChecked } = this.state;
|
|
11655
11656
|
const availableOptionsStatusToDisplay = availableOptionsStatus ||
|
|
11656
11657
|
(isTree
|
|
11657
|
-
? `${filterFolders(availableOptions, availableTreeOptionsChecked)
|
|
11658
|
+
? `${filterFolders(availableOptions, availableTreeOptionsChecked)
|
|
11659
|
+
.length} of ${flattenTree(availableOptions).length} items selected`
|
|
11658
11660
|
: `${availableOptionsSelected.length} of ${availableOptions.length} items selected`);
|
|
11659
11661
|
const chosenOptionsStatusToDisplay = chosenOptionsStatus ||
|
|
11660
11662
|
(isTree
|
|
11661
11663
|
? `${filterFolders(chosenOptions, chosenTreeOptionsChecked).length} of ${flattenTree(chosenOptions).length} items selected`
|
|
11662
11664
|
: `${chosenOptionsSelected.length} of ${chosenOptions.length} items selected`);
|
|
11663
|
-
const available = isTree
|
|
11665
|
+
const available = (isTree
|
|
11664
11666
|
? availableOptions.map(item => this.mapChecked(item, false))
|
|
11665
|
-
: availableOptions;
|
|
11666
|
-
const chosen = isTree
|
|
11667
|
+
: availableOptions);
|
|
11668
|
+
const chosen = (isTree
|
|
11667
11669
|
? chosenOptions.map(item => this.mapChecked(item, true))
|
|
11668
|
-
: chosenOptions;
|
|
11670
|
+
: chosenOptions);
|
|
11669
11671
|
return (React__namespace.createElement(DualListSelectorContext.Provider, { value: { isTree } },
|
|
11670
11672
|
React__namespace.createElement("div", Object.assign({ className: css(styles$L.dualListSelector, className), id: id }, props), children === '' ? (React__namespace.createElement(React__namespace.Fragment, null,
|
|
11671
11673
|
React__namespace.createElement(DualListSelectorPane, { isSearchable: isSearchable, onFilterUpdate: this.onFilterUpdate, searchInputAriaLabel: availableOptionsSearchAriaLabel, filterOption: filterOption, onSearchInputChanged: onAvailableOptionsSearchInputChanged, status: availableOptionsStatusToDisplay, title: availableOptionsTitle, options: available, selectedOptions: isTree ? availableTreeOptionsChecked : availableOptionsSelected, onOptionSelect: this.onOptionSelect, onOptionCheck: (e, isChecked, itemData) => this.onTreeOptionCheck(e, isChecked, itemData, false), actions: availableOptionsActions, id: `${id}-available-pane`, isDisabled: isDisabled }),
|
|
@@ -11978,10 +11978,6 @@ ul.pf-c-list {
|
|
|
11978
11978
|
--pf-c-menu--m-nav__list-item--first-child--c-menu--Top: 0;
|
|
11979
11979
|
}
|
|
11980
11980
|
|
|
11981
|
-
.pf-c-menu .pf-c-menu__content {
|
|
11982
|
-
overflow: visible hidden;
|
|
11983
|
-
}
|
|
11984
|
-
|
|
11985
11981
|
.pf-c-menu .pf-c-menu__content .pf-c-menu .pf-c-menu__content {
|
|
11986
11982
|
overflow: visible;
|
|
11987
11983
|
}
|
|
@@ -12024,7 +12020,7 @@ ul.pf-c-list {
|
|
|
12024
12020
|
|
|
12025
12021
|
.pf-c-menu.pf-m-drilldown > .pf-c-menu__content {
|
|
12026
12022
|
flex-grow: 1;
|
|
12027
|
-
overflow
|
|
12023
|
+
overflow: hidden;
|
|
12028
12024
|
transition: var(--pf-c-menu--m-drilldown__content--Transition);
|
|
12029
12025
|
}
|
|
12030
12026
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.222.
|
|
3
|
+
"version": "4.222.4",
|
|
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",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.73.
|
|
38
|
-
"@patternfly/react-styles": "^4.72.
|
|
39
|
-
"@patternfly/react-tokens": "^4.74.
|
|
37
|
+
"@patternfly/react-icons": "^4.73.4",
|
|
38
|
+
"@patternfly/react-styles": "^4.72.4",
|
|
39
|
+
"@patternfly/react-tokens": "^4.74.4",
|
|
40
40
|
"focus-trap": "6.9.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.196.
|
|
46
|
+
"@patternfly/patternfly": "4.196.8",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "308f2c66a19104f4a1b0f56da3b4df95d7a2d919"
|
|
64
64
|
}
|
|
@@ -134,10 +134,10 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
134
134
|
private removeAllButtonRef = React.createRef<HTMLButtonElement>();
|
|
135
135
|
static defaultProps: PickOptional<DualListSelectorProps> = {
|
|
136
136
|
children: '',
|
|
137
|
-
availableOptions: []
|
|
137
|
+
availableOptions: [],
|
|
138
138
|
availableOptionsTitle: 'Available options',
|
|
139
139
|
availableOptionsSearchAriaLabel: 'Available search input',
|
|
140
|
-
chosenOptions: []
|
|
140
|
+
chosenOptions: [],
|
|
141
141
|
chosenOptionsTitle: 'Chosen options',
|
|
142
142
|
chosenOptionsSearchAriaLabel: 'Chosen search input',
|
|
143
143
|
id: getUniqueId('dual-list-selector'),
|
|
@@ -177,11 +177,11 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
177
177
|
constructor(props: DualListSelectorProps) {
|
|
178
178
|
super(props);
|
|
179
179
|
this.state = {
|
|
180
|
-
availableOptions: [...this.props.availableOptions],
|
|
180
|
+
availableOptions: [...this.props.availableOptions] as React.ReactNode[],
|
|
181
181
|
availableOptionsSelected: [],
|
|
182
182
|
availableFilteredOptions: null,
|
|
183
183
|
availableTreeFilteredOptions: null,
|
|
184
|
-
chosenOptions: [...this.props.chosenOptions],
|
|
184
|
+
chosenOptions: [...this.props.chosenOptions] as React.ReactNode[],
|
|
185
185
|
chosenOptionsSelected: [],
|
|
186
186
|
chosenFilteredOptions: null,
|
|
187
187
|
chosenTreeFilteredOptions: null,
|
|
@@ -208,8 +208,8 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
208
208
|
JSON.stringify(this.state.chosenOptions, this.replacer)
|
|
209
209
|
) {
|
|
210
210
|
this.setState({
|
|
211
|
-
availableOptions: [...this.props.availableOptions],
|
|
212
|
-
chosenOptions: [...this.props.chosenOptions]
|
|
211
|
+
availableOptions: [...this.props.availableOptions] as React.ReactNode[],
|
|
212
|
+
chosenOptions: [...this.props.chosenOptions] as React.ReactNode[]
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
}
|
|
@@ -226,7 +226,9 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
226
226
|
}
|
|
227
227
|
if (isTree) {
|
|
228
228
|
this.setState({
|
|
229
|
-
availableTreeFilteredOptions: flattenTreeWithFolders(
|
|
229
|
+
availableTreeFilteredOptions: flattenTreeWithFolders(
|
|
230
|
+
(newFilteredOptions as unknown) as DualListSelectorTreeItemData[]
|
|
231
|
+
)
|
|
230
232
|
});
|
|
231
233
|
} else {
|
|
232
234
|
this.setState({
|
|
@@ -243,7 +245,9 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
243
245
|
}
|
|
244
246
|
if (isTree) {
|
|
245
247
|
this.setState({
|
|
246
|
-
chosenTreeFilteredOptions: flattenTreeWithFolders(
|
|
248
|
+
chosenTreeFilteredOptions: flattenTreeWithFolders(
|
|
249
|
+
(newFilteredOptions as unknown) as DualListSelectorTreeItemData[]
|
|
250
|
+
)
|
|
247
251
|
});
|
|
248
252
|
} else {
|
|
249
253
|
this.setState({
|
|
@@ -283,16 +287,20 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
283
287
|
this.setState(prevState => {
|
|
284
288
|
const movedOptions =
|
|
285
289
|
prevState.availableTreeFilteredOptions ||
|
|
286
|
-
flattenTreeWithFolders(prevState.availableOptions as DualListSelectorTreeItemData[]);
|
|
290
|
+
flattenTreeWithFolders((prevState.availableOptions as unknown) as DualListSelectorTreeItemData[]);
|
|
287
291
|
const newAvailable = prevState.availableOptions
|
|
288
292
|
.map(opt => Object.assign({}, opt))
|
|
289
|
-
.filter(item =>
|
|
293
|
+
.filter(item =>
|
|
294
|
+
filterRestTreeItems((item as unknown) as DualListSelectorTreeItemData, movedOptions)
|
|
295
|
+
) as React.ReactNode[];
|
|
290
296
|
|
|
291
|
-
const currChosen = flattenTree(prevState.chosenOptions as DualListSelectorTreeItemData[]);
|
|
297
|
+
const currChosen = flattenTree((prevState.chosenOptions as unknown) as DualListSelectorTreeItemData[]);
|
|
292
298
|
const nextChosenOptions = currChosen.concat(movedOptions);
|
|
293
299
|
const newChosen = this.createMergedCopy()
|
|
294
300
|
.map(opt => Object.assign({}, opt))
|
|
295
|
-
.filter(item =>
|
|
301
|
+
.filter(item =>
|
|
302
|
+
filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextChosenOptions)
|
|
303
|
+
) as React.ReactNode[];
|
|
296
304
|
|
|
297
305
|
this.props.addAll && this.props.addAll(newAvailable, newChosen);
|
|
298
306
|
this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
|
@@ -339,15 +347,17 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
339
347
|
const newAvailable = prevState.availableOptions
|
|
340
348
|
.map(opt => Object.assign({}, opt))
|
|
341
349
|
.filter(item =>
|
|
342
|
-
filterRestTreeItems(item as DualListSelectorTreeItemData, prevState.availableTreeOptionsChecked)
|
|
350
|
+
filterRestTreeItems((item as unknown) as DualListSelectorTreeItemData, prevState.availableTreeOptionsChecked)
|
|
343
351
|
);
|
|
344
352
|
|
|
345
353
|
// Get next chosen options from current + new nodes and remap from base
|
|
346
|
-
const currChosen = flattenTree(prevState.chosenOptions as DualListSelectorTreeItemData[]);
|
|
354
|
+
const currChosen = flattenTree((prevState.chosenOptions as unknown) as DualListSelectorTreeItemData[]);
|
|
347
355
|
const nextChosenOptions = currChosen.concat(prevState.availableTreeOptionsChecked);
|
|
348
356
|
const newChosen = this.createMergedCopy()
|
|
349
357
|
.map(opt => Object.assign({}, opt))
|
|
350
|
-
.filter(item =>
|
|
358
|
+
.filter(item =>
|
|
359
|
+
filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextChosenOptions)
|
|
360
|
+
) as React.ReactNode[];
|
|
351
361
|
|
|
352
362
|
this.props.addSelected && this.props.addSelected(newAvailable, newChosen);
|
|
353
363
|
this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
|
@@ -391,16 +401,18 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
391
401
|
this.setState(prevState => {
|
|
392
402
|
const movedOptions =
|
|
393
403
|
prevState.chosenTreeFilteredOptions ||
|
|
394
|
-
flattenTreeWithFolders(prevState.chosenOptions as DualListSelectorTreeItemData[]);
|
|
404
|
+
flattenTreeWithFolders((prevState.chosenOptions as unknown) as DualListSelectorTreeItemData[]);
|
|
395
405
|
|
|
396
406
|
const newChosen = prevState.chosenOptions
|
|
397
407
|
.map(opt => Object.assign({}, opt))
|
|
398
|
-
.filter(item => filterRestTreeItems(item as DualListSelectorTreeItemData, movedOptions));
|
|
399
|
-
const currAvailable = flattenTree(prevState.availableOptions as DualListSelectorTreeItemData[]);
|
|
408
|
+
.filter(item => filterRestTreeItems((item as unknown) as DualListSelectorTreeItemData, movedOptions));
|
|
409
|
+
const currAvailable = flattenTree((prevState.availableOptions as unknown) as DualListSelectorTreeItemData[]);
|
|
400
410
|
const nextAvailableOptions = currAvailable.concat(movedOptions);
|
|
401
411
|
const newAvailable = this.createMergedCopy()
|
|
402
412
|
.map(opt => Object.assign({}, opt))
|
|
403
|
-
.filter(item =>
|
|
413
|
+
.filter(item =>
|
|
414
|
+
filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextAvailableOptions)
|
|
415
|
+
) as React.ReactNode[];
|
|
404
416
|
|
|
405
417
|
this.props.removeAll && this.props.removeAll(newAvailable, newChosen);
|
|
406
418
|
this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
|
@@ -444,14 +456,18 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
444
456
|
// Remove selected chosen nodes from current chosen nodes
|
|
445
457
|
const newChosen = prevState.chosenOptions
|
|
446
458
|
.map(opt => Object.assign({}, opt))
|
|
447
|
-
.filter(item =>
|
|
459
|
+
.filter(item =>
|
|
460
|
+
filterRestTreeItems((item as unknown) as DualListSelectorTreeItemData, prevState.chosenTreeOptionsChecked)
|
|
461
|
+
);
|
|
448
462
|
|
|
449
463
|
// Get next chosen options from current and remap from base
|
|
450
|
-
const currAvailable = flattenTree(prevState.availableOptions as DualListSelectorTreeItemData[]);
|
|
464
|
+
const currAvailable = flattenTree((prevState.availableOptions as unknown) as DualListSelectorTreeItemData[]);
|
|
451
465
|
const nextAvailableOptions = currAvailable.concat(prevState.chosenTreeOptionsChecked);
|
|
452
466
|
const newAvailable = this.createMergedCopy()
|
|
453
467
|
.map(opt => Object.assign({}, opt))
|
|
454
|
-
.filter(item =>
|
|
468
|
+
.filter(item =>
|
|
469
|
+
filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, nextAvailableOptions)
|
|
470
|
+
) as React.ReactNode[];
|
|
455
471
|
|
|
456
472
|
this.props.removeSelected && this.props.removeSelected(newAvailable, newChosen);
|
|
457
473
|
this.props.onListChange && this.props.onListChange(newAvailable, newChosen);
|
|
@@ -542,7 +558,7 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
542
558
|
panelOptions = chosenOptions
|
|
543
559
|
.map(opt => Object.assign({}, opt))
|
|
544
560
|
.filter(item =>
|
|
545
|
-
filterTreeItemsWithoutFolders(item as DualListSelectorTreeItemData, chosenTreeFilteredOptions)
|
|
561
|
+
filterTreeItemsWithoutFolders((item as unknown) as DualListSelectorTreeItemData, chosenTreeFilteredOptions)
|
|
546
562
|
);
|
|
547
563
|
} else {
|
|
548
564
|
panelOptions = chosenOptions;
|
|
@@ -552,7 +568,10 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
552
568
|
panelOptions = availableOptions
|
|
553
569
|
.map(opt => Object.assign({}, opt))
|
|
554
570
|
.filter(item =>
|
|
555
|
-
filterTreeItemsWithoutFolders(
|
|
571
|
+
filterTreeItemsWithoutFolders(
|
|
572
|
+
(item as unknown) as DualListSelectorTreeItemData,
|
|
573
|
+
availableTreeFilteredOptions
|
|
574
|
+
)
|
|
556
575
|
);
|
|
557
576
|
} else {
|
|
558
577
|
panelOptions = availableOptions;
|
|
@@ -560,8 +579,8 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
560
579
|
}
|
|
561
580
|
const checkedOptionTree = panelOptions
|
|
562
581
|
.map(opt => Object.assign({}, opt))
|
|
563
|
-
.filter(item => filterTreeItems(item as DualListSelectorTreeItemData, [itemData.id]));
|
|
564
|
-
const flatTree = flattenTreeWithFolders(checkedOptionTree as DualListSelectorTreeItemData[]);
|
|
582
|
+
.filter(item => filterTreeItems((item as unknown) as DualListSelectorTreeItemData, [itemData.id]));
|
|
583
|
+
const flatTree = flattenTreeWithFolders((checkedOptionTree as unknown) as DualListSelectorTreeItemData[]);
|
|
565
584
|
|
|
566
585
|
const prevChecked = isChosen ? this.state.chosenTreeOptionsChecked : this.state.availableTreeOptionsChecked;
|
|
567
586
|
let updatedChecked = [] as string[];
|
|
@@ -638,23 +657,24 @@ export class DualListSelector extends React.Component<DualListSelectorProps, Dua
|
|
|
638
657
|
availableOptionsStatus ||
|
|
639
658
|
(isTree
|
|
640
659
|
? `${
|
|
641
|
-
filterFolders(availableOptions as DualListSelectorTreeItemData[], availableTreeOptionsChecked)
|
|
642
|
-
|
|
660
|
+
filterFolders((availableOptions as unknown) as DualListSelectorTreeItemData[], availableTreeOptionsChecked)
|
|
661
|
+
.length
|
|
662
|
+
} of ${flattenTree((availableOptions as unknown) as DualListSelectorTreeItemData[]).length} items selected`
|
|
643
663
|
: `${availableOptionsSelected.length} of ${availableOptions.length} items selected`);
|
|
644
664
|
const chosenOptionsStatusToDisplay =
|
|
645
665
|
chosenOptionsStatus ||
|
|
646
666
|
(isTree
|
|
647
|
-
? `${
|
|
648
|
-
|
|
649
|
-
} items selected`
|
|
667
|
+
? `${
|
|
668
|
+
filterFolders((chosenOptions as unknown) as DualListSelectorTreeItemData[], chosenTreeOptionsChecked).length
|
|
669
|
+
} of ${flattenTree((chosenOptions as unknown) as DualListSelectorTreeItemData[]).length} items selected`
|
|
650
670
|
: `${chosenOptionsSelected.length} of ${chosenOptions.length} items selected`);
|
|
651
671
|
|
|
652
|
-
const available = isTree
|
|
653
|
-
? availableOptions.map(item => this.mapChecked(item as DualListSelectorTreeItemData, false))
|
|
654
|
-
: availableOptions;
|
|
655
|
-
const chosen = isTree
|
|
656
|
-
? chosenOptions.map(item => this.mapChecked(item as DualListSelectorTreeItemData, true))
|
|
657
|
-
: chosenOptions;
|
|
672
|
+
const available = (isTree
|
|
673
|
+
? availableOptions.map(item => this.mapChecked((item as unknown) as DualListSelectorTreeItemData, false))
|
|
674
|
+
: availableOptions) as React.ReactNode[];
|
|
675
|
+
const chosen = (isTree
|
|
676
|
+
? chosenOptions.map(item => this.mapChecked((item as unknown) as DualListSelectorTreeItemData, true))
|
|
677
|
+
: chosenOptions) as React.ReactNode[];
|
|
658
678
|
|
|
659
679
|
return (
|
|
660
680
|
<DualListSelectorContext.Provider value={{ isTree }}>
|
|
@@ -70,7 +70,7 @@ export const DualListSelectorPane: React.FunctionComponent<DualListSelectorPaneP
|
|
|
70
70
|
onOptionSelect,
|
|
71
71
|
onOptionCheck,
|
|
72
72
|
title = '',
|
|
73
|
-
options = []
|
|
73
|
+
options = [],
|
|
74
74
|
selectedOptions = [],
|
|
75
75
|
isSearchable = false,
|
|
76
76
|
searchInputAriaLabel = '',
|
|
@@ -87,11 +87,11 @@ export const DualListSelectorPane: React.FunctionComponent<DualListSelectorPaneP
|
|
|
87
87
|
// only called when search input is dynamically built
|
|
88
88
|
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
89
89
|
const newValue = e.target.value;
|
|
90
|
-
let filtered;
|
|
90
|
+
let filtered: React.ReactNode[];
|
|
91
91
|
if (isTree) {
|
|
92
|
-
filtered =
|
|
92
|
+
filtered = options
|
|
93
93
|
.map(opt => Object.assign({}, opt))
|
|
94
|
-
.filter(item => filterInput(item as DualListSelectorTreeItemData, newValue));
|
|
94
|
+
.filter(item => filterInput((item as unknown) as DualListSelectorTreeItemData, newValue));
|
|
95
95
|
} else {
|
|
96
96
|
filtered = options.filter(option => {
|
|
97
97
|
if (displayOption(option)) {
|
|
@@ -110,7 +110,7 @@ export const DualListSelectorPane: React.FunctionComponent<DualListSelectorPaneP
|
|
|
110
110
|
// only called when options are passed via options prop and isTree === true
|
|
111
111
|
const filterInput = (item: DualListSelectorTreeItemData, input: string): boolean => {
|
|
112
112
|
if (filterOption) {
|
|
113
|
-
return filterOption(item, input);
|
|
113
|
+
return filterOption((item as unknown) as React.ReactNode, input);
|
|
114
114
|
} else {
|
|
115
115
|
if (item.text.toLowerCase().includes(input.toLowerCase()) || input === '') {
|
|
116
116
|
return true;
|
|
@@ -200,10 +200,12 @@ export const DualListSelectorPane: React.FunctionComponent<DualListSelectorPaneP
|
|
|
200
200
|
<DualListSelectorTree
|
|
201
201
|
data={
|
|
202
202
|
isSearchable
|
|
203
|
-
? (options
|
|
203
|
+
? ((options
|
|
204
204
|
.map(opt => Object.assign({}, opt))
|
|
205
|
-
.filter(item =>
|
|
206
|
-
|
|
205
|
+
.filter(item =>
|
|
206
|
+
filterInput((item as unknown) as DualListSelectorTreeItemData, input)
|
|
207
|
+
) as unknown) as DualListSelectorTreeItemData[])
|
|
208
|
+
: ((options as unknown) as DualListSelectorTreeItemData[])
|
|
207
209
|
}
|
|
208
210
|
onOptionCheck={onOptionCheck}
|
|
209
211
|
id={`${id}-tree`}
|
|
@@ -8,256 +8,24 @@ import AtIcon from '@patternfly/react-icons/dist/esm/icons/at-icon';
|
|
|
8
8
|
import DollarSignIcon from '@patternfly/react-icons/dist/esm/icons/dollar-sign-icon';
|
|
9
9
|
import CalendarAltIcon from '@patternfly/react-icons/dist/esm/icons/calendar-alt-icon';
|
|
10
10
|
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
11
|
-
import {
|
|
12
|
-
Button,
|
|
13
|
-
ButtonVariant,
|
|
14
|
-
TextArea,
|
|
15
|
-
InputGroup,
|
|
16
|
-
InputGroupText,
|
|
17
|
-
TextInput,
|
|
18
|
-
Dropdown,
|
|
19
|
-
DropdownToggle,
|
|
20
|
-
DropdownItem,
|
|
21
|
-
Popover,
|
|
22
|
-
PopoverPosition
|
|
23
|
-
} from '@patternfly/react-core';
|
|
24
11
|
|
|
25
12
|
## Examples
|
|
26
13
|
### Basic
|
|
27
|
-
```
|
|
28
|
-
import React from 'react';
|
|
29
|
-
import AtIcon from '@patternfly/react-icons/dist/esm/icons/at-icon';
|
|
30
|
-
import {
|
|
31
|
-
Button,
|
|
32
|
-
InputGroup,
|
|
33
|
-
InputGroupText,
|
|
34
|
-
InputGroupTextVariant,
|
|
35
|
-
TextInput,
|
|
36
|
-
ValidatedOptions
|
|
37
|
-
} from '@patternfly/react-core';
|
|
38
|
-
|
|
39
|
-
class SimpleInputGroups extends React.Component {
|
|
40
|
-
constructor(props) {
|
|
41
|
-
super(props);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
render() {
|
|
45
|
-
return (
|
|
46
|
-
<React.Fragment>
|
|
47
|
-
<InputGroup>
|
|
48
|
-
<TextInput id="textInput6" type="email" aria-label="email input field" />
|
|
49
|
-
<InputGroupText id="email-example">@example.com</InputGroupText>
|
|
50
|
-
</InputGroup>
|
|
51
|
-
<br />
|
|
52
|
-
<InputGroup>
|
|
53
|
-
<InputGroupText id="username">
|
|
54
|
-
<AtIcon />
|
|
55
|
-
</InputGroupText>
|
|
56
|
-
<TextInput validated={ValidatedOptions.error} id="textInput7" type="email" aria-label="Error state username example" />
|
|
57
|
-
</InputGroup>
|
|
58
|
-
<br />
|
|
59
|
-
<InputGroup>
|
|
60
|
-
<TextInput name="textIndex12" id="textInput12" type="text" aria-label="percentage" />
|
|
61
|
-
<InputGroupText id="plain-example" variant={InputGroupTextVariant.plain}>%</InputGroupText>
|
|
62
|
-
</InputGroup>
|
|
63
|
-
</React.Fragment>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
14
|
+
```ts file='./InputGroupBasic.tsx'
|
|
67
15
|
```
|
|
68
16
|
|
|
69
17
|
### With textarea
|
|
70
|
-
```
|
|
71
|
-
import React from 'react';
|
|
72
|
-
import {
|
|
73
|
-
Button,
|
|
74
|
-
TextArea,
|
|
75
|
-
InputGroup
|
|
76
|
-
} from '@patternfly/react-core';
|
|
77
|
-
|
|
78
|
-
class SimpleInputGroups extends React.Component {
|
|
79
|
-
constructor(props) {
|
|
80
|
-
super(props);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
render() {
|
|
84
|
-
return (
|
|
85
|
-
<React.Fragment>
|
|
86
|
-
<InputGroup>
|
|
87
|
-
<TextArea name="textarea2" id="textarea2" aria-label="textarea with button" />
|
|
88
|
-
<Button id="textAreaButton2" variant="control">
|
|
89
|
-
Button
|
|
90
|
-
</Button>
|
|
91
|
-
</InputGroup>
|
|
92
|
-
</React.Fragment>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
18
|
+
```ts file='./InputGroupWithTextarea.tsx'
|
|
96
19
|
```
|
|
97
20
|
|
|
98
21
|
### With dropdown
|
|
99
|
-
```
|
|
100
|
-
import React from 'react';
|
|
101
|
-
import {
|
|
102
|
-
Button,
|
|
103
|
-
InputGroup,
|
|
104
|
-
TextInput,
|
|
105
|
-
Dropdown,
|
|
106
|
-
DropdownToggle,
|
|
107
|
-
DropdownItem
|
|
108
|
-
} from '@patternfly/react-core';
|
|
109
|
-
|
|
110
|
-
class SimpleInputGroups extends React.Component {
|
|
111
|
-
constructor(props) {
|
|
112
|
-
super(props);
|
|
113
|
-
this.state = {
|
|
114
|
-
isOpen: false,
|
|
115
|
-
selected: ''
|
|
116
|
-
};
|
|
117
|
-
this.onToggle = isOpen => {
|
|
118
|
-
this.setState({
|
|
119
|
-
isOpen
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
this.onSelect = event => {
|
|
123
|
-
this.setState({
|
|
124
|
-
isOpen: false,
|
|
125
|
-
selected: event.currentTarget.value
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
render() {
|
|
131
|
-
return (
|
|
132
|
-
<React.Fragment>
|
|
133
|
-
<InputGroup>
|
|
134
|
-
<Dropdown
|
|
135
|
-
onSelect={this.onSelect}
|
|
136
|
-
toggle={
|
|
137
|
-
<DropdownToggle onToggle={this.onToggle}>
|
|
138
|
-
{this.state.selected ? this.state.selected : 'Dropdown'}
|
|
139
|
-
</DropdownToggle>
|
|
140
|
-
}
|
|
141
|
-
isOpen={this.state.isOpen}
|
|
142
|
-
dropdownItems={[
|
|
143
|
-
<DropdownItem key="opt-1" value="Option 1" component="button">
|
|
144
|
-
Option 1
|
|
145
|
-
</DropdownItem>,
|
|
146
|
-
<DropdownItem key="opt-2" value="Option 2" component="button">
|
|
147
|
-
Option 2
|
|
148
|
-
</DropdownItem>,
|
|
149
|
-
<DropdownItem key="opt-3" value="Option 3" component="button">
|
|
150
|
-
Option 3
|
|
151
|
-
</DropdownItem>
|
|
152
|
-
]}
|
|
153
|
-
/>
|
|
154
|
-
<TextInput id="textInput3" aria-label="input with dropdown and button" />
|
|
155
|
-
<Button id="inputDropdownButton1" variant="control">Button</Button>
|
|
156
|
-
</InputGroup>
|
|
157
|
-
</React.Fragment>
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
22
|
+
```ts file='./InputGroupWithDropdown.tsx'
|
|
161
23
|
```
|
|
162
24
|
|
|
163
25
|
### With popover
|
|
164
|
-
```
|
|
165
|
-
import React from 'react';
|
|
166
|
-
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
167
|
-
import {
|
|
168
|
-
Button,
|
|
169
|
-
InputGroup,
|
|
170
|
-
TextInput,
|
|
171
|
-
Popover,
|
|
172
|
-
PopoverPosition
|
|
173
|
-
} from '@patternfly/react-core';
|
|
174
|
-
|
|
175
|
-
class SimpleInputGroups extends React.Component {
|
|
176
|
-
constructor(props) {
|
|
177
|
-
super(props);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
render() {
|
|
181
|
-
return (
|
|
182
|
-
<React.Fragment>
|
|
183
|
-
<InputGroup>
|
|
184
|
-
<TextInput name="textInput10" id="textInput10" type="text" aria-label="input example with popover" />
|
|
185
|
-
<Popover
|
|
186
|
-
aria-label="popover example"
|
|
187
|
-
position={PopoverPosition.top}
|
|
188
|
-
bodyContent="This field is an example of an input group with a popover."
|
|
189
|
-
>
|
|
190
|
-
<Button variant="control" aria-label="popover for input">
|
|
191
|
-
<QuestionCircleIcon />
|
|
192
|
-
</Button>
|
|
193
|
-
</Popover>
|
|
194
|
-
</InputGroup>
|
|
195
|
-
<br />
|
|
196
|
-
<InputGroup>
|
|
197
|
-
<TextInput name="textInput12" id="textInput12" type="text" aria-label="input example with popover" />
|
|
198
|
-
<Popover
|
|
199
|
-
aria-label="popover example"
|
|
200
|
-
position={PopoverPosition.top}
|
|
201
|
-
bodyContent="This field is an example of an input group with a popover."
|
|
202
|
-
>
|
|
203
|
-
<Button variant="plain" aria-label="Popover for input">
|
|
204
|
-
<QuestionCircleIcon />
|
|
205
|
-
</Button>
|
|
206
|
-
</Popover>
|
|
207
|
-
</InputGroup>
|
|
208
|
-
</React.Fragment>
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
26
|
+
```ts file ='./InputGroupWithPopover.tsx'
|
|
212
27
|
```
|
|
213
28
|
|
|
214
|
-
|
|
215
29
|
### With multiple group siblings
|
|
216
|
-
```
|
|
217
|
-
import React from 'react';
|
|
218
|
-
import DollarSignIcon from '@patternfly/react-icons/dist/esm/icons/dollar-sign-icon';
|
|
219
|
-
import {
|
|
220
|
-
Button,
|
|
221
|
-
TextArea,
|
|
222
|
-
InputGroup,
|
|
223
|
-
InputGroupText,
|
|
224
|
-
TextInput
|
|
225
|
-
} from '@patternfly/react-core';
|
|
226
|
-
|
|
227
|
-
class SimpleInputGroups extends React.Component {
|
|
228
|
-
constructor(props) {
|
|
229
|
-
super(props);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
render() {
|
|
233
|
-
return (
|
|
234
|
-
<React.Fragment>
|
|
235
|
-
<InputGroup>
|
|
236
|
-
<Button id="textAreaButton1" variant="control">
|
|
237
|
-
Button
|
|
238
|
-
</Button>
|
|
239
|
-
<TextArea name="textarea1" id="textarea1" aria-label="textarea with buttons" />
|
|
240
|
-
<Button variant="control">Button</Button>
|
|
241
|
-
</InputGroup>
|
|
242
|
-
<br />
|
|
243
|
-
<InputGroup>
|
|
244
|
-
<Button id="textAreaButton3" variant="control">
|
|
245
|
-
Button
|
|
246
|
-
</Button>
|
|
247
|
-
<Button variant="control">Button</Button>
|
|
248
|
-
<TextArea name="textarea3" id="textarea3" aria-label="textarea with 3 buttons" />
|
|
249
|
-
<Button variant="control">Button</Button>
|
|
250
|
-
</InputGroup>
|
|
251
|
-
<br />
|
|
252
|
-
<InputGroup>
|
|
253
|
-
<InputGroupText>
|
|
254
|
-
<DollarSignIcon />
|
|
255
|
-
</InputGroupText>
|
|
256
|
-
<TextInput id="textInput5" type="number" aria-label="Dollar amount input example" />
|
|
257
|
-
<InputGroupText>.00</InputGroupText>
|
|
258
|
-
</InputGroup>
|
|
259
|
-
</React.Fragment>
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
30
|
+
```ts file='./InputGroupWithSiblings.tsx'
|
|
263
31
|
```
|