@patternfly/react-core 6.0.0-alpha.4 → 6.0.0-alpha.6
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 +104 -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/Chip/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/DragDrop/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/ContextSelector/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/package.json +1 -1
- package/dist/esm/components/Avatar/Avatar.d.ts +0 -2
- package/dist/esm/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/esm/components/Avatar/Avatar.js +2 -2
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Banner/Banner.d.ts +16 -3
- package/dist/esm/components/Banner/Banner.d.ts.map +1 -1
- package/dist/esm/components/Banner/Banner.js +10 -2
- package/dist/esm/components/Banner/Banner.js.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts +0 -2
- package/dist/esm/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/esm/components/ExpandableSection/ExpandableSection.js +3 -6
- package/dist/esm/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/esm/components/Menu/MenuItem.d.ts +2 -0
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +3 -2
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.d.ts +2 -2
- package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +1 -1
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/js/components/Avatar/Avatar.d.ts +0 -2
- package/dist/js/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/js/components/Avatar/Avatar.js +2 -2
- package/dist/js/components/Avatar/Avatar.js.map +1 -1
- package/dist/js/components/Banner/Banner.d.ts +16 -3
- package/dist/js/components/Banner/Banner.d.ts.map +1 -1
- package/dist/js/components/Banner/Banner.js +10 -2
- package/dist/js/components/Banner/Banner.js.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts +0 -2
- package/dist/js/components/ExpandableSection/ExpandableSection.d.ts.map +1 -1
- package/dist/js/components/ExpandableSection/ExpandableSection.js +3 -6
- package/dist/js/components/ExpandableSection/ExpandableSection.js.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +2 -0
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.js +3 -2
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/Pagination/Pagination.d.ts +2 -2
- package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/js/components/Pagination/Pagination.js +1 -1
- package/dist/js/components/Pagination/Pagination.js.map +1 -1
- package/dist/js/components/Popover/Popover.js +1 -1
- package/dist/js/components/Popover/Popover.js.map +1 -1
- package/dist/styles/assets/images/PF-HorizontalLogo-Color.svg +29 -0
- package/dist/styles/assets/images/PF-HorizontalLogo-Reverse.svg +28 -0
- package/dist/styles/assets/images/PF-IconLogo-color.svg +17 -0
- package/dist/styles/base-no-reset.css +859 -849
- package/dist/styles/base.css +861 -850
- 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/Avatar/Avatar.tsx +1 -15
- package/src/components/Avatar/__tests__/Avatar.test.tsx +7 -4
- package/src/components/Avatar/examples/Avatar.md +4 -2
- package/src/components/Banner/Banner.tsx +41 -18
- package/src/components/Banner/__tests__/Banner.test.tsx +56 -11
- package/src/components/Banner/examples/Banner.md +4 -2
- package/src/components/Banner/examples/BannerBasic.tsx +12 -4
- package/src/components/Banner/examples/BannerStatus.tsx +13 -13
- package/src/components/ExpandableSection/ExpandableSection.tsx +0 -6
- package/src/components/Menu/MenuItem.tsx +5 -1
- package/src/components/Pagination/Pagination.tsx +2 -3
- package/src/components/Pagination/__tests__/Pagination.test.tsx +1 -1
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +174 -93
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Select/examples/Select.md +49 -9
- package/src/demos/DataList/examples/DataListExpandableControlInToolbar.tsx +397 -0
- package/src/demos/DataListDemo.md +1 -407
- package/src/demos/examples/AlertGroup/AlertGroupToastWithNotificationDrawer.tsx +3 -3
|
@@ -415,7 +415,7 @@ export const Popover: React.FunctionComponent<PopoverProps> = ({
|
|
|
415
415
|
ref={popoverRef}
|
|
416
416
|
active={focusTrapActive}
|
|
417
417
|
focusTrapOptions={{
|
|
418
|
-
returnFocusOnDeactivate:
|
|
418
|
+
returnFocusOnDeactivate: propWithFocusTrap !== false,
|
|
419
419
|
clickOutsideDeactivates: true,
|
|
420
420
|
// FocusTrap's initialFocus can accept false as a value to prevent initial focus.
|
|
421
421
|
// We want to prevent this in case false is ever passed in.
|
|
@@ -13,72 +13,112 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
|
13
13
|
|
|
14
14
|
## Examples
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Select builds off of the menu component suite to adapt commonly used properties and functions to create a select menu. See the [menu documentation](/components/menus/menu) for a full list of properties that may be used to further customize a select menu. View the [custom menu examples](/components/menus/custom-menus) to see examples of fully functional select menus.
|
|
17
17
|
|
|
18
|
-
### Single
|
|
18
|
+
### Single select
|
|
19
|
+
To let users select a single item from a list, use a single select menu.
|
|
20
|
+
|
|
21
|
+
You can add multiple `<SelectOption>` components to build out a list of menu items. For each select option, pass a relevant option label to the `value` property.
|
|
22
|
+
|
|
23
|
+
To disable the select menu toggle, use the `isDisabled` property. In the following example, select the checkbox to observe this behavior.
|
|
19
24
|
|
|
20
25
|
```ts file="./SelectBasic.tsx"
|
|
21
26
|
|
|
22
27
|
```
|
|
23
28
|
|
|
24
|
-
###
|
|
29
|
+
### Select option variants
|
|
30
|
+
|
|
31
|
+
The following example showcases different option variants and customizations that are commonly used in a select menu.
|
|
32
|
+
|
|
33
|
+
To create these variants, you can pass different properties into a `<SelectOption>` component.
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
This example provides examples of:
|
|
36
|
+
|
|
37
|
+
- An option with a description, which is created by using the `description` property.
|
|
38
|
+
- An option with a link, which is created by passing a URL into the `to` property. For external links, use the `isExternalLink` property so that the option is styled with an outbound link icon.
|
|
39
|
+
- An option with an icon, which is created by using the `icon` property.
|
|
40
|
+
- An option that is disabled by using the `isDisabled` property.
|
|
27
41
|
|
|
28
42
|
```ts file="./SelectOptionVariations.tsx"
|
|
29
43
|
|
|
30
44
|
```
|
|
31
45
|
|
|
32
|
-
###
|
|
46
|
+
### With grouped items
|
|
47
|
+
To group related select options together, use 1 or more `<SelectGroup>` components and title each group using the `label` property.
|
|
33
48
|
|
|
34
49
|
```ts file="./SelectGrouped.tsx"
|
|
35
50
|
|
|
36
51
|
```
|
|
37
52
|
|
|
38
|
-
### Checkbox
|
|
53
|
+
### Checkbox select
|
|
54
|
+
To let users select multiple list options via checkbox input, use a checkbox select.
|
|
55
|
+
|
|
56
|
+
To create a checkbox select, pass `role="menu"` to the `<Select>`, and `hasCheckbox` into each `<SelectOption>` component. To indicate that an option is selected, use the `isSelected` property.
|
|
57
|
+
|
|
58
|
+
By default, the menu toggle will display a badge to indicate the number of items that a user has selected.
|
|
39
59
|
|
|
40
60
|
```ts file="./SelectCheckbox.tsx"
|
|
41
61
|
|
|
42
62
|
```
|
|
43
63
|
|
|
44
64
|
### Typeahead
|
|
65
|
+
Typeahead is a select variant that replaces the typical button toggle for opening the select menu with a text input and button toggle combo. As a user enters characters into the text input, the menu options will be filtered to match.
|
|
66
|
+
|
|
67
|
+
To make a typeahead, pass `variant=typeahead` into the `<MenuToggle>` component and link an `onClick` function to the `<TextInputGroupMain>` component.
|
|
45
68
|
|
|
46
69
|
```ts file="./SelectTypeahead.tsx"
|
|
47
70
|
|
|
48
71
|
```
|
|
49
72
|
|
|
50
73
|
### Typeahead with create option
|
|
74
|
+
If a user enters a value into a typeahead select menu that does not exist, you can allow them to create an option of that value.
|
|
75
|
+
|
|
76
|
+
To enable the creation ability, pass a predetermined `value` into a `<SelectOption>` component. You can use the `placeholder` property to change the default text shown in the text input.
|
|
77
|
+
|
|
78
|
+
The following example outlines the code implementation required to create a working typeahead menu that allows for creation.
|
|
51
79
|
|
|
52
80
|
```ts file="./SelectTypeaheadCreatable.tsx"
|
|
53
81
|
|
|
54
82
|
```
|
|
55
83
|
|
|
56
84
|
### Multiple typeahead with chips
|
|
85
|
+
A multiple typeahead can be used to allow users to select multiple options from a list. Additionally, you can render a chip group to be placed in the select toggle.
|
|
86
|
+
|
|
87
|
+
When more items than the allowed limit are selected, overflowing items will be hidden under a "more" button. The following example hides items after more than 3 are selected. To show hidden items, select the “more” button. Select "show less" to hide extra items again.
|
|
57
88
|
|
|
58
89
|
```ts file="./SelectMultiTypeahead.tsx"
|
|
59
90
|
|
|
60
91
|
```
|
|
61
92
|
|
|
62
93
|
### Multiple typeahead with create option
|
|
94
|
+
If the text that is entered into a typeahead doesn't match a menu item, users can choose to create a new option that matches the text input. You can also combine this create functionality with a chip group to display created items as chips."
|
|
63
95
|
|
|
64
96
|
```ts file="./SelectMultiTypeaheadCreatable.tsx"
|
|
65
97
|
|
|
66
98
|
```
|
|
67
99
|
|
|
68
100
|
### Multiple typeahead with checkboxes
|
|
101
|
+
By default, a multiple typeahead select allows you to select multiple menu items, placing a checkmark beside selected items. Like basic checkbox select menus, you can add checkboxes to your menu items. This approach may be more accurate and comprehensive for more complex menu scenarios like filtering.
|
|
69
102
|
|
|
70
103
|
```ts file="./SelectMultiTypeaheadCheckbox.tsx"
|
|
71
104
|
|
|
72
105
|
```
|
|
73
106
|
|
|
74
|
-
###
|
|
107
|
+
### With view more
|
|
108
|
+
|
|
109
|
+
To reduce the processing load for long select lists, you can add a "View more" action to load additional items.
|
|
110
|
+
|
|
111
|
+
The following example shows 3 items before the "View more" link, but you can adjust the number of visible items for your use case.
|
|
75
112
|
|
|
76
113
|
```ts file="./SelectViewMore.tsx"
|
|
77
114
|
|
|
78
115
|
```
|
|
79
116
|
|
|
80
|
-
###
|
|
117
|
+
### With a footer
|
|
118
|
+
|
|
119
|
+
You can add a `<MenuFooter>` component to a select menu to hold additional actions that users can take on menu items, through elements such as link buttons. A footer will be placed beneath a divider at the end of the select menu.
|
|
120
|
+
|
|
81
121
|
|
|
82
122
|
```ts file="./SelectFooter.tsx"
|
|
83
123
|
|
|
84
|
-
```
|
|
124
|
+
```
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
DataList,
|
|
5
|
+
DataListItem,
|
|
6
|
+
DataListItemRow,
|
|
7
|
+
DataListCell,
|
|
8
|
+
DataListAction,
|
|
9
|
+
DataListToggle,
|
|
10
|
+
DataListContent,
|
|
11
|
+
DataListItemCells,
|
|
12
|
+
Dropdown,
|
|
13
|
+
DropdownItem,
|
|
14
|
+
DropdownList,
|
|
15
|
+
MenuToggle,
|
|
16
|
+
MenuToggleElement,
|
|
17
|
+
Toolbar,
|
|
18
|
+
ToolbarGroup,
|
|
19
|
+
ToolbarItem,
|
|
20
|
+
ToolbarExpandIconWrapper,
|
|
21
|
+
ToolbarContent,
|
|
22
|
+
SearchInput,
|
|
23
|
+
Tooltip,
|
|
24
|
+
Icon,
|
|
25
|
+
PageSection,
|
|
26
|
+
PageSectionVariants,
|
|
27
|
+
Text,
|
|
28
|
+
TextContent
|
|
29
|
+
} from '@patternfly/react-core';
|
|
30
|
+
|
|
31
|
+
import { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrapper';
|
|
32
|
+
|
|
33
|
+
import CodeBranchIcon from '@patternfly/react-icons/dist/esm/icons/code-branch-icon';
|
|
34
|
+
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
35
|
+
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
36
|
+
|
|
37
|
+
export const DataListExpandableControlInToolbar: React.FunctionComponent = () => {
|
|
38
|
+
const [expanded, setExpanded] = React.useState(['ex-toggle1', 'ex-toggle3']);
|
|
39
|
+
const [isOpen1, setIsOpen1] = React.useState(false);
|
|
40
|
+
const [isOpen2, setIsOpen2] = React.useState(false);
|
|
41
|
+
const [isOpen3, setIsOpen3] = React.useState(false);
|
|
42
|
+
const [allExpanded, setAllExpanded] = React.useState(false);
|
|
43
|
+
|
|
44
|
+
const onToggleAll = () => {
|
|
45
|
+
setAllExpanded((prevAllExpanded) => !prevAllExpanded);
|
|
46
|
+
|
|
47
|
+
if (!allExpanded) {
|
|
48
|
+
setExpanded(['ex-toggle1', 'ex-toggle2', 'ex-toggle3']);
|
|
49
|
+
} else {
|
|
50
|
+
setExpanded([]);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const onToggle1 = () => {
|
|
55
|
+
setIsOpen1(!isOpen1);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const onToggle2 = () => {
|
|
59
|
+
setIsOpen2(!isOpen2);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onToggle3 = () => {
|
|
63
|
+
setIsOpen3(!isOpen3);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const onSelect1 = () => {
|
|
67
|
+
setIsOpen1(false);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const onSelect2 = () => {
|
|
71
|
+
setIsOpen2(false);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const onSelect3 = () => {
|
|
75
|
+
setIsOpen3(false);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const renderToolbar = () => (
|
|
79
|
+
<React.Fragment>
|
|
80
|
+
<Toolbar>
|
|
81
|
+
<ToolbarContent>
|
|
82
|
+
<ToolbarGroup>
|
|
83
|
+
<ToolbarItem variant="expand-all" isAllExpanded={allExpanded}>
|
|
84
|
+
<Tooltip
|
|
85
|
+
position="right"
|
|
86
|
+
content={
|
|
87
|
+
<div>
|
|
88
|
+
{allExpanded && 'Collapse all rows'}
|
|
89
|
+
{!allExpanded && 'Expand all rows'}
|
|
90
|
+
</div>
|
|
91
|
+
}
|
|
92
|
+
>
|
|
93
|
+
<Button
|
|
94
|
+
onClick={onToggleAll}
|
|
95
|
+
variant="plain"
|
|
96
|
+
aria-label={allExpanded ? 'Collapse all rows' : 'Expand all rows'}
|
|
97
|
+
>
|
|
98
|
+
<Icon shouldMirrorRTL>
|
|
99
|
+
<ToolbarExpandIconWrapper>
|
|
100
|
+
<AngleRightIcon />
|
|
101
|
+
</ToolbarExpandIconWrapper>
|
|
102
|
+
</Icon>
|
|
103
|
+
</Button>
|
|
104
|
+
</Tooltip>
|
|
105
|
+
</ToolbarItem>
|
|
106
|
+
<ToolbarItem>
|
|
107
|
+
<SearchInput aria-label="search input example" />
|
|
108
|
+
</ToolbarItem>
|
|
109
|
+
<ToolbarItem>
|
|
110
|
+
<Button variant="secondary">Action</Button>
|
|
111
|
+
</ToolbarItem>
|
|
112
|
+
<ToolbarItem variant="separator" />
|
|
113
|
+
<ToolbarItem>
|
|
114
|
+
<Button variant="primary">Action</Button>
|
|
115
|
+
</ToolbarItem>
|
|
116
|
+
</ToolbarGroup>
|
|
117
|
+
</ToolbarContent>
|
|
118
|
+
</Toolbar>
|
|
119
|
+
</React.Fragment>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const toggle = (id: string) => {
|
|
123
|
+
const index = expanded.indexOf(id);
|
|
124
|
+
const newExpanded =
|
|
125
|
+
index >= 0 ? [...expanded.slice(0, index), ...expanded.slice(index + 1, expanded.length)] : [...expanded, id];
|
|
126
|
+
setExpanded(newExpanded);
|
|
127
|
+
if (newExpanded.length === 3) {
|
|
128
|
+
setAllExpanded(true);
|
|
129
|
+
} else if (newExpanded.length === 0) {
|
|
130
|
+
setAllExpanded(false);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<React.Fragment>
|
|
136
|
+
<DashboardWrapper mainContainerId="main-content-datalist-view-default-nav" breadcrumb={null}>
|
|
137
|
+
<PageSection variant={PageSectionVariants.light}>
|
|
138
|
+
<TextContent>
|
|
139
|
+
<Text component="h1">Projects</Text>
|
|
140
|
+
<Text component="p">This is a demo that showcases PatternFly Data List</Text>
|
|
141
|
+
</TextContent>
|
|
142
|
+
</PageSection>
|
|
143
|
+
<PageSection isFilled>
|
|
144
|
+
{renderToolbar()}
|
|
145
|
+
|
|
146
|
+
<DataList aria-label="Expandable data list example">
|
|
147
|
+
<DataListItem aria-labelledby="ex-item1" isExpanded={expanded.includes('ex-toggle1')}>
|
|
148
|
+
<DataListItemRow>
|
|
149
|
+
<DataListToggle
|
|
150
|
+
onClick={() => toggle('ex-toggle1')}
|
|
151
|
+
isExpanded={expanded.includes('ex-toggle1')}
|
|
152
|
+
id="ex-toggle1"
|
|
153
|
+
aria-controls="ex-expand1"
|
|
154
|
+
/>
|
|
155
|
+
<DataListItemCells
|
|
156
|
+
dataListCells={[
|
|
157
|
+
<DataListCell isIcon key="icon">
|
|
158
|
+
<CodeBranchIcon />
|
|
159
|
+
</DataListCell>,
|
|
160
|
+
<DataListCell key="primary content">
|
|
161
|
+
<div id="ex-item1">Primary content</div>
|
|
162
|
+
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </span>
|
|
163
|
+
<a href="#">Link</a>
|
|
164
|
+
</DataListCell>,
|
|
165
|
+
<DataListCell key="secondary content">
|
|
166
|
+
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
|
|
167
|
+
</DataListCell>,
|
|
168
|
+
<DataListCell key="secondary content 2">
|
|
169
|
+
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
|
|
170
|
+
</DataListCell>
|
|
171
|
+
]}
|
|
172
|
+
/>
|
|
173
|
+
<DataListAction
|
|
174
|
+
aria-labelledby="ex-item1 ex-action1"
|
|
175
|
+
id="ex-action1"
|
|
176
|
+
aria-label="Actions"
|
|
177
|
+
isPlainButtonAction
|
|
178
|
+
>
|
|
179
|
+
<Dropdown
|
|
180
|
+
isOpen={isOpen1}
|
|
181
|
+
onSelect={onSelect1}
|
|
182
|
+
popperProps={{ position: 'right' }}
|
|
183
|
+
onOpenChange={(isOpen: boolean) => setIsOpen1(isOpen)}
|
|
184
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
185
|
+
<MenuToggle
|
|
186
|
+
ref={toggleRef}
|
|
187
|
+
onClick={onToggle1}
|
|
188
|
+
isExpanded={isOpen1}
|
|
189
|
+
variant="plain"
|
|
190
|
+
aria-label="Primary content kebab toggle"
|
|
191
|
+
>
|
|
192
|
+
<EllipsisVIcon aria-hidden="true" />
|
|
193
|
+
</MenuToggle>
|
|
194
|
+
)}
|
|
195
|
+
>
|
|
196
|
+
<DropdownList>
|
|
197
|
+
<DropdownItem value={0} key="action1">
|
|
198
|
+
Action
|
|
199
|
+
</DropdownItem>
|
|
200
|
+
<DropdownItem
|
|
201
|
+
value={1}
|
|
202
|
+
key="link1"
|
|
203
|
+
to="#default-link2"
|
|
204
|
+
// Prevent the default onClick functionality for example purposes
|
|
205
|
+
onClick={(ev: React.MouseEvent) => ev.preventDefault()}
|
|
206
|
+
>
|
|
207
|
+
Link
|
|
208
|
+
</DropdownItem>
|
|
209
|
+
<DropdownItem value={2} isDisabled key="disabled action1">
|
|
210
|
+
Disabled Action
|
|
211
|
+
</DropdownItem>
|
|
212
|
+
<DropdownItem value={3} isDisabled key="disabled link1" to="#default-link4">
|
|
213
|
+
Disabled Link
|
|
214
|
+
</DropdownItem>
|
|
215
|
+
</DropdownList>
|
|
216
|
+
</Dropdown>
|
|
217
|
+
</DataListAction>
|
|
218
|
+
</DataListItemRow>
|
|
219
|
+
<DataListContent
|
|
220
|
+
aria-label="Primary Content Details"
|
|
221
|
+
id="ex-expand1"
|
|
222
|
+
isHidden={!expanded.includes('ex-toggle1')}
|
|
223
|
+
>
|
|
224
|
+
<p>
|
|
225
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
|
|
226
|
+
et dolore magna aliqua.
|
|
227
|
+
</p>
|
|
228
|
+
</DataListContent>
|
|
229
|
+
</DataListItem>
|
|
230
|
+
<DataListItem aria-labelledby="ex-item2" isExpanded={expanded.includes('ex-toggle2')}>
|
|
231
|
+
<DataListItemRow>
|
|
232
|
+
<DataListToggle
|
|
233
|
+
onClick={() => toggle('ex-toggle2')}
|
|
234
|
+
isExpanded={expanded.includes('ex-toggle2')}
|
|
235
|
+
id="ex-toggle2"
|
|
236
|
+
aria-controls="ex-expand2"
|
|
237
|
+
/>
|
|
238
|
+
<DataListItemCells
|
|
239
|
+
dataListCells={[
|
|
240
|
+
<DataListCell isIcon key="icon">
|
|
241
|
+
<CodeBranchIcon />
|
|
242
|
+
</DataListCell>,
|
|
243
|
+
<DataListCell key="secondary content">
|
|
244
|
+
<div id="ex-item2">Secondary content</div>
|
|
245
|
+
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
|
|
246
|
+
</DataListCell>,
|
|
247
|
+
<DataListCell key="secondary content 2">
|
|
248
|
+
<span>Lorem ipsum dolor sit amet.</span>
|
|
249
|
+
</DataListCell>,
|
|
250
|
+
<DataListCell key="secondary content3">
|
|
251
|
+
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
|
|
252
|
+
</DataListCell>
|
|
253
|
+
]}
|
|
254
|
+
/>
|
|
255
|
+
<DataListAction
|
|
256
|
+
aria-labelledby="ex-item2 ex-action2"
|
|
257
|
+
id="ex-action2"
|
|
258
|
+
aria-label="Actions"
|
|
259
|
+
isPlainButtonAction
|
|
260
|
+
>
|
|
261
|
+
<Dropdown
|
|
262
|
+
isOpen={isOpen2}
|
|
263
|
+
onSelect={onSelect2}
|
|
264
|
+
popperProps={{ position: 'right' }}
|
|
265
|
+
onOpenChange={(isOpen: boolean) => setIsOpen2(isOpen)}
|
|
266
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
267
|
+
<MenuToggle
|
|
268
|
+
ref={toggleRef}
|
|
269
|
+
onClick={onToggle2}
|
|
270
|
+
isExpanded={isOpen2}
|
|
271
|
+
variant="plain"
|
|
272
|
+
aria-label="Secondary content kebab toggle"
|
|
273
|
+
>
|
|
274
|
+
<EllipsisVIcon aria-hidden="true" />
|
|
275
|
+
</MenuToggle>
|
|
276
|
+
)}
|
|
277
|
+
>
|
|
278
|
+
<DropdownList>
|
|
279
|
+
<DropdownItem value={0} key="action2">
|
|
280
|
+
Action
|
|
281
|
+
</DropdownItem>
|
|
282
|
+
<DropdownItem
|
|
283
|
+
value={1}
|
|
284
|
+
key="link2"
|
|
285
|
+
to="#default-link2"
|
|
286
|
+
// Prevent the default onClick functionality for example purposes
|
|
287
|
+
onClick={(ev: React.MouseEvent) => ev.preventDefault()}
|
|
288
|
+
>
|
|
289
|
+
Link
|
|
290
|
+
</DropdownItem>
|
|
291
|
+
<DropdownItem value={2} isDisabled key="disabled action2">
|
|
292
|
+
Disabled Action
|
|
293
|
+
</DropdownItem>
|
|
294
|
+
<DropdownItem value={3} isDisabled key="disabled link2" to="#default-link4">
|
|
295
|
+
Disabled Link
|
|
296
|
+
</DropdownItem>
|
|
297
|
+
</DropdownList>
|
|
298
|
+
</Dropdown>
|
|
299
|
+
</DataListAction>
|
|
300
|
+
</DataListItemRow>
|
|
301
|
+
<DataListContent
|
|
302
|
+
aria-label="Primary Content Details"
|
|
303
|
+
id="ex-expand2"
|
|
304
|
+
isHidden={!expanded.includes('ex-toggle2')}
|
|
305
|
+
>
|
|
306
|
+
<p>
|
|
307
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
|
|
308
|
+
et dolore magna aliqua.
|
|
309
|
+
</p>
|
|
310
|
+
</DataListContent>
|
|
311
|
+
</DataListItem>
|
|
312
|
+
<DataListItem aria-labelledby="ex-item3" isExpanded={expanded.includes('ex-toggle3')}>
|
|
313
|
+
<DataListItemRow>
|
|
314
|
+
<DataListToggle
|
|
315
|
+
onClick={() => toggle('ex-toggle3')}
|
|
316
|
+
isExpanded={expanded.includes('ex-toggle3')}
|
|
317
|
+
id="ex-toggle3"
|
|
318
|
+
aria-controls="ex-expand3"
|
|
319
|
+
/>
|
|
320
|
+
<DataListItemCells
|
|
321
|
+
dataListCells={[
|
|
322
|
+
<DataListCell isIcon key="icon">
|
|
323
|
+
<CodeBranchIcon />
|
|
324
|
+
</DataListCell>,
|
|
325
|
+
<DataListCell key="tertiary content">
|
|
326
|
+
<div id="ex-item3">Tertiary content</div>
|
|
327
|
+
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
|
|
328
|
+
</DataListCell>,
|
|
329
|
+
<DataListCell key="secondary content">
|
|
330
|
+
<span>Lorem ipsum dolor sit amet.</span>
|
|
331
|
+
</DataListCell>,
|
|
332
|
+
<DataListCell key="secondary content 2">
|
|
333
|
+
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
|
|
334
|
+
</DataListCell>
|
|
335
|
+
]}
|
|
336
|
+
/>
|
|
337
|
+
<DataListAction
|
|
338
|
+
aria-labelledby="ex-item3 ex-action3"
|
|
339
|
+
id="ex-action3"
|
|
340
|
+
aria-label="Actions"
|
|
341
|
+
isPlainButtonAction
|
|
342
|
+
>
|
|
343
|
+
<Dropdown
|
|
344
|
+
isOpen={isOpen3}
|
|
345
|
+
onSelect={onSelect3}
|
|
346
|
+
popperProps={{ position: 'right' }}
|
|
347
|
+
onOpenChange={(isOpen: boolean) => setIsOpen3(isOpen)}
|
|
348
|
+
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
|
|
349
|
+
<MenuToggle
|
|
350
|
+
ref={toggleRef}
|
|
351
|
+
onClick={onToggle3}
|
|
352
|
+
isExpanded={isOpen3}
|
|
353
|
+
variant="plain"
|
|
354
|
+
aria-label="Tertiary content kebab toggle"
|
|
355
|
+
>
|
|
356
|
+
<EllipsisVIcon aria-hidden="true" />
|
|
357
|
+
</MenuToggle>
|
|
358
|
+
)}
|
|
359
|
+
>
|
|
360
|
+
<DropdownList>
|
|
361
|
+
<DropdownItem value={0} key="action3">
|
|
362
|
+
Action
|
|
363
|
+
</DropdownItem>
|
|
364
|
+
<DropdownItem
|
|
365
|
+
value={1}
|
|
366
|
+
key="link3"
|
|
367
|
+
to="#default-link2"
|
|
368
|
+
// Prevent the default onClick functionality for example purposes
|
|
369
|
+
onClick={(ev: React.MouseEvent) => ev.preventDefault()}
|
|
370
|
+
>
|
|
371
|
+
Link
|
|
372
|
+
</DropdownItem>
|
|
373
|
+
<DropdownItem value={2} isDisabled key="disabled action3">
|
|
374
|
+
Disabled Action
|
|
375
|
+
</DropdownItem>
|
|
376
|
+
<DropdownItem value={3} isDisabled key="disabled link3" to="#default-link4">
|
|
377
|
+
Disabled Link
|
|
378
|
+
</DropdownItem>
|
|
379
|
+
</DropdownList>
|
|
380
|
+
</Dropdown>
|
|
381
|
+
</DataListAction>
|
|
382
|
+
</DataListItemRow>
|
|
383
|
+
<DataListContent
|
|
384
|
+
aria-label="Primary Content Details"
|
|
385
|
+
id="ex-expand3"
|
|
386
|
+
isHidden={!expanded.includes('ex-toggle3')}
|
|
387
|
+
hasNoPadding
|
|
388
|
+
>
|
|
389
|
+
This expanded section has no padding.
|
|
390
|
+
</DataListContent>
|
|
391
|
+
</DataListItem>
|
|
392
|
+
</DataList>
|
|
393
|
+
</PageSection>
|
|
394
|
+
</DashboardWrapper>
|
|
395
|
+
</React.Fragment>
|
|
396
|
+
);
|
|
397
|
+
};
|