@patternfly/react-core 4.221.14 → 4.221.15

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/esm/components/DualListSelector/DualListSelector.d.ts +4 -0
  3. package/dist/esm/components/DualListSelector/DualListSelector.d.ts.map +1 -1
  4. package/dist/esm/components/DualListSelector/DualListSelector.js +13 -2
  5. package/dist/esm/components/DualListSelector/DualListSelector.js.map +1 -1
  6. package/dist/js/components/DualListSelector/DualListSelector.d.ts +4 -0
  7. package/dist/js/components/DualListSelector/DualListSelector.d.ts.map +1 -1
  8. package/dist/js/components/DualListSelector/DualListSelector.js +13 -2
  9. package/dist/js/components/DualListSelector/DualListSelector.js.map +1 -1
  10. package/dist/umd/react-core.js +13 -2
  11. package/dist/umd/react-core.min.js +1 -1
  12. package/package.json +5 -5
  13. package/src/components/DualListSelector/DualListSelector.tsx +14 -2
  14. package/src/components/DualListSelector/examples/DualListSelector.md +38 -767
  15. package/src/components/DualListSelector/examples/DualListSelectorBasic.tsx +26 -0
  16. package/src/components/DualListSelector/examples/DualListSelectorBasicSearch.tsx +27 -0
  17. package/src/components/DualListSelector/examples/DualListSelectorBasicTooltips.tsx +34 -0
  18. package/src/components/DualListSelector/examples/DualListSelectorComplexOptionsActions.tsx +146 -0
  19. package/src/components/DualListSelector/examples/DualListSelectorComposable.tsx +214 -0
  20. package/src/components/DualListSelector/examples/DualListSelectorComposableDragDrop.tsx +190 -0
  21. package/src/components/DualListSelector/examples/{ComposableTree.tsx → DualListSelectorComposableTree.tsx} +3 -3
  22. package/src/components/DualListSelector/examples/DualListSelectorTree.tsx +91 -0
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import { DualListSelector } from '@patternfly/react-core';
3
+
4
+ export const DualListSelectorTree: React.FunctionComponent = () => {
5
+ const [availableOptions, setAvailableOptions] = React.useState<React.ReactNode[]>([
6
+ {
7
+ id: 'F1',
8
+ text: 'Folder 1',
9
+ isChecked: false,
10
+ checkProps: { 'aria-label': 'Folder 1' },
11
+ hasBadge: true,
12
+ badgeProps: { isRead: true },
13
+ children: [
14
+ { id: 'O1', text: 'Option 1', isChecked: false, checkProps: { 'aria-label': 'Option 1' } },
15
+ {
16
+ id: 'F1A',
17
+ text: 'Folder 1A',
18
+ isChecked: false,
19
+ checkProps: { 'aria-label': 'Folder 1A' },
20
+ children: [
21
+ { id: 'O2', text: 'Option 2', isChecked: false, checkProps: { 'aria-label': 'Option 2' } },
22
+ { id: 'O3', text: 'Option 3', isChecked: false, checkProps: { 'aria-label': 'Option 3' } }
23
+ ]
24
+ },
25
+ { id: 'O4', text: 'Option 4', isChecked: false, checkProps: { 'aria-label': 'Option 4' } }
26
+ ]
27
+ },
28
+ { id: 'O5', text: 'Option 5', isChecked: false, checkProps: { 'aria-label': 'Option 5' } },
29
+ {
30
+ id: 'F2',
31
+ text: 'Folder 2',
32
+ isChecked: false,
33
+ checkProps: { 'aria-label': 'Folder 2' },
34
+ children: [
35
+ { id: 'O6', text: 'Option 6', isChecked: false, checkProps: { 'aria-label': 'Option 6' } },
36
+ { id: 'O7', text: 'Option 5', isChecked: false, checkProps: { 'aria-label': 'Option 5 duplicate' } }
37
+ ]
38
+ }
39
+ ]);
40
+
41
+ const [chosenOptions, setChosenOptions] = React.useState<React.ReactNode[]>([
42
+ {
43
+ id: 'CF1',
44
+ text: 'Chosen Folder 1',
45
+ isChecked: false,
46
+ checkProps: { 'aria-label': 'Chosen Folder 1' },
47
+ hasBadge: true,
48
+ badgeProps: { isRead: true },
49
+ children: [
50
+ { id: 'CO1', text: 'Chosen Option 1', isChecked: false, checkProps: { 'aria-label': 'Chosen Option 1' } },
51
+ {
52
+ id: 'CF1A',
53
+ text: 'Chosen Folder 1A',
54
+ isChecked: false,
55
+ checkProps: { 'aria-label': 'Chosen Folder 1A' },
56
+ children: [
57
+ {
58
+ id: 'CO2',
59
+ text: 'Chosen Option 2',
60
+ isChecked: false,
61
+ checkProps: { 'aria-label': 'Chosen Option 2' }
62
+ },
63
+ {
64
+ id: 'CO3',
65
+ text: 'Chosen Option 3',
66
+ isChecked: false,
67
+ checkProps: { 'aria-label': 'Chosen Option 3' }
68
+ }
69
+ ]
70
+ },
71
+ { id: 'CO4', text: 'Chosen Option 4', isChecked: false, checkProps: { 'aria-label': 'Chosen Option 4' } }
72
+ ]
73
+ }
74
+ ]);
75
+
76
+ const onListChange = (newAvailableOptions: React.ReactNode[], newChosenOptions: React.ReactNode[]) => {
77
+ setAvailableOptions(newAvailableOptions.sort());
78
+ setChosenOptions(newChosenOptions.sort());
79
+ };
80
+
81
+ return (
82
+ <DualListSelector
83
+ isSearchable
84
+ isTree
85
+ availableOptions={availableOptions}
86
+ chosenOptions={chosenOptions}
87
+ onListChange={onListChange}
88
+ id="dual-list-selector-tree"
89
+ />
90
+ );
91
+ };