@patternfly/react-core 6.2.0-prerelease.1 → 6.2.0-prerelease.11

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 (172) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  21. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  22. package/dist/dynamic/components/Content/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/Drawer/package.json +1 -1
  28. package/dist/dynamic/components/Dropdown/package.json +1 -1
  29. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  30. package/dist/dynamic/components/EmptyState/package.json +1 -1
  31. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  32. package/dist/dynamic/components/FileUpload/package.json +1 -1
  33. package/dist/dynamic/components/Form/package.json +1 -1
  34. package/dist/dynamic/components/FormSelect/package.json +1 -1
  35. package/dist/dynamic/components/HelperText/package.json +1 -1
  36. package/dist/dynamic/components/Hint/package.json +1 -1
  37. package/dist/dynamic/components/Icon/package.json +1 -1
  38. package/dist/dynamic/components/InputGroup/package.json +1 -1
  39. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  40. package/dist/dynamic/components/Label/package.json +1 -1
  41. package/dist/dynamic/components/List/package.json +1 -1
  42. package/dist/dynamic/components/LoginPage/package.json +1 -1
  43. package/dist/dynamic/components/Masthead/package.json +1 -1
  44. package/dist/dynamic/components/Menu/package.json +1 -1
  45. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  46. package/dist/dynamic/components/Modal/package.json +1 -1
  47. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  48. package/dist/dynamic/components/Nav/package.json +1 -1
  49. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  50. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  51. package/dist/dynamic/components/NumberInput/package.json +1 -1
  52. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  53. package/dist/dynamic/components/Page/package.json +1 -1
  54. package/dist/dynamic/components/Pagination/package.json +1 -1
  55. package/dist/dynamic/components/Panel/package.json +1 -1
  56. package/dist/dynamic/components/Popover/package.json +1 -1
  57. package/dist/dynamic/components/Progress/package.json +1 -1
  58. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  59. package/dist/dynamic/components/Radio/package.json +1 -1
  60. package/dist/dynamic/components/SearchInput/package.json +1 -1
  61. package/dist/dynamic/components/Select/package.json +1 -1
  62. package/dist/dynamic/components/Sidebar/package.json +1 -1
  63. package/dist/dynamic/components/SimpleList/package.json +1 -1
  64. package/dist/dynamic/components/Skeleton/package.json +1 -1
  65. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  66. package/dist/dynamic/components/Slider/package.json +1 -1
  67. package/dist/dynamic/components/Spinner/package.json +1 -1
  68. package/dist/dynamic/components/Switch/package.json +1 -1
  69. package/dist/dynamic/components/Tabs/package.json +1 -1
  70. package/dist/dynamic/components/TextArea/package.json +1 -1
  71. package/dist/dynamic/components/TextInput/package.json +1 -1
  72. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  73. package/dist/dynamic/components/TimePicker/package.json +1 -1
  74. package/dist/dynamic/components/Timestamp/package.json +1 -1
  75. package/dist/dynamic/components/Title/package.json +1 -1
  76. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  77. package/dist/dynamic/components/Toolbar/package.json +1 -1
  78. package/dist/dynamic/components/Tooltip/package.json +1 -1
  79. package/dist/dynamic/components/TreeView/package.json +1 -1
  80. package/dist/dynamic/components/Truncate/package.json +1 -1
  81. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  82. package/dist/dynamic/components/Wizard/package.json +1 -1
  83. package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
  84. package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
  85. package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/package.json +1 -1
  90. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  91. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  92. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  93. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  94. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  95. package/dist/dynamic/helpers/constants/package.json +1 -1
  96. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  97. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  98. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  99. package/dist/dynamic/helpers/package.json +1 -1
  100. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  101. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  102. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  103. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  104. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  105. package/dist/dynamic/helpers/util/package.json +1 -1
  106. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  107. package/dist/dynamic/layouts/Flex/package.json +1 -1
  108. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  109. package/dist/dynamic/layouts/Grid/package.json +1 -1
  110. package/dist/dynamic/layouts/Level/package.json +1 -1
  111. package/dist/dynamic/layouts/Split/package.json +1 -1
  112. package/dist/dynamic/layouts/Stack/package.json +1 -1
  113. package/dist/dynamic/styles/package.json +1 -1
  114. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +1 -1
  115. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  116. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +4 -2
  117. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  118. package/dist/esm/components/FileUpload/FileUploadField.d.ts +2 -0
  119. package/dist/esm/components/FileUpload/FileUploadField.d.ts.map +1 -1
  120. package/dist/esm/components/FileUpload/FileUploadField.js +2 -2
  121. package/dist/esm/components/FileUpload/FileUploadField.js.map +1 -1
  122. package/dist/esm/components/TextArea/TextArea.d.ts +3 -2
  123. package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
  124. package/dist/esm/components/TextArea/TextArea.js +5 -2
  125. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  126. package/dist/esm/components/Truncate/Truncate.d.ts.map +1 -1
  127. package/dist/esm/components/Truncate/Truncate.js +5 -7
  128. package/dist/esm/components/Truncate/Truncate.js.map +1 -1
  129. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +1 -1
  130. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  131. package/dist/js/components/ClipboardCopy/ClipboardCopy.js +4 -2
  132. package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  133. package/dist/js/components/FileUpload/FileUploadField.d.ts +2 -0
  134. package/dist/js/components/FileUpload/FileUploadField.d.ts.map +1 -1
  135. package/dist/js/components/FileUpload/FileUploadField.js +2 -2
  136. package/dist/js/components/FileUpload/FileUploadField.js.map +1 -1
  137. package/dist/js/components/TextArea/TextArea.d.ts +3 -2
  138. package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
  139. package/dist/js/components/TextArea/TextArea.js +5 -2
  140. package/dist/js/components/TextArea/TextArea.js.map +1 -1
  141. package/dist/js/components/Truncate/Truncate.d.ts.map +1 -1
  142. package/dist/js/components/Truncate/Truncate.js +5 -7
  143. package/dist/js/components/Truncate/Truncate.js.map +1 -1
  144. package/dist/umd/assets/{output-BwnR4NQh.css → output-DYYMgGsx.css} +18811 -18811
  145. package/dist/umd/react-core.min.js +2 -2
  146. package/helpers/package.json +1 -1
  147. package/layouts/package.json +1 -1
  148. package/next/package.json +1 -1
  149. package/package.json +8 -8
  150. package/src/components/ClipboardCopy/ClipboardCopy.tsx +5 -3
  151. package/src/components/ClipboardCopy/__tests__/ClipboardCopy.test.tsx +15 -0
  152. package/src/components/ClipboardCopy/__tests__/__snapshots__/ClipboardCopy.test.tsx.snap +1 -1
  153. package/src/components/FileUpload/FileUploadField.tsx +4 -1
  154. package/src/components/FileUpload/__tests__/FileUploadField.test.tsx +15 -1
  155. package/src/components/FileUpload/examples/FileUploadCustomUpload.tsx +8 -0
  156. package/src/components/TextArea/TextArea.tsx +8 -7
  157. package/src/components/TextArea/__tests__/TextArea.test.tsx +18 -0
  158. package/src/components/TextArea/examples/TextArea.md +6 -0
  159. package/src/components/TextArea/examples/TextAreaResizableNone.tsx +14 -0
  160. package/src/components/Toolbar/examples/Toolbar.md +8 -8
  161. package/src/components/TreeView/examples/TreeView.md +7 -1
  162. package/src/components/TreeView/examples/TreeViewWithIconPerItem.tsx +64 -0
  163. package/src/components/Truncate/Truncate.tsx +17 -14
  164. package/src/components/Truncate/__tests__/Truncate.test.tsx +17 -1
  165. package/src/demos/DataList/examples/DataListActionable.tsx +134 -0
  166. package/src/demos/DataListDemo.md +5 -0
  167. package/src/demos/DescriptionList/DescriptionList.md +7 -1
  168. package/src/demos/DescriptionList/examples/DescriptionListInDrawer.tsx +162 -0
  169. package/src/demos/Skeleton.md +13 -0
  170. package/src/demos/examples/Skeleton/SkeletonCard.tsx +40 -0
  171. package/src/components/DataList/examples/DataListDraggable.tsx +0 -108
  172. package/src/components/DualListSelector/examples/DualListSelectorDragDrop.tsx +0 -177
@@ -0,0 +1,134 @@
1
+ import React from 'react';
2
+ import {
3
+ Button,
4
+ Content,
5
+ DataList,
6
+ DataListItem,
7
+ DataListCell,
8
+ DataListItemRow,
9
+ DataListItemCells,
10
+ DataListAction,
11
+ Dropdown,
12
+ DropdownList,
13
+ DropdownItem,
14
+ MenuToggle,
15
+ MenuToggleElement,
16
+ PageSection,
17
+ Title
18
+ } from '@patternfly/react-core';
19
+ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
20
+ import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
21
+
22
+ export const DataListActionable: React.FunctionComponent = () => {
23
+ const [isOpen, setIsOpen] = React.useState(false);
24
+ const [isDeleted, setIsDeleted] = React.useState(false);
25
+
26
+ const onToggle = () => {
27
+ setIsOpen(!isOpen);
28
+ };
29
+
30
+ const onSelect = () => {
31
+ setIsOpen(!isOpen);
32
+ };
33
+
34
+ return (
35
+ <DashboardWrapper mainContainerId="main-content-datalist-view-actions" breadcrumb={null}>
36
+ <PageSection>
37
+ <Content>
38
+ <Title headingLevel="h1">Projects</Title>
39
+ <Content component="p">This is a demo that showcases PatternFly Data List</Content>
40
+ </Content>
41
+ </PageSection>
42
+ <PageSection>
43
+ <DataList aria-label="single action data list example ">
44
+ {!isDeleted && (
45
+ <DataListItem aria-labelledby="single-action-item1">
46
+ <DataListItemRow>
47
+ <DataListItemCells
48
+ dataListCells={[
49
+ <DataListCell key="primary content">
50
+ <span id="single-action-item1">Single actionable Primary content</span>
51
+ </DataListCell>,
52
+ <DataListCell key="secondary content">Single actionable Secondary content</DataListCell>
53
+ ]}
54
+ />
55
+ <DataListAction
56
+ aria-labelledby="single-action-item1 single-action-action1"
57
+ id="single-action-action1"
58
+ aria-label="Actions"
59
+ >
60
+ <Button
61
+ onClick={() => {
62
+ if (confirm('Are you sure?')) {
63
+ setIsDeleted(true);
64
+ }
65
+ }}
66
+ variant="primary"
67
+ key="delete-action"
68
+ >
69
+ Delete
70
+ </Button>
71
+ </DataListAction>
72
+ </DataListItemRow>
73
+ </DataListItem>
74
+ )}
75
+ <DataListItem aria-labelledby="multi-actions-item1">
76
+ <DataListItemRow>
77
+ <DataListItemCells
78
+ dataListCells={[
79
+ <DataListCell key="primary content">
80
+ <span id="multi-actions-item1">Multi actions Primary content</span>
81
+ </DataListCell>,
82
+ <DataListCell key="secondary content">Multi actions Secondary content</DataListCell>
83
+ ]}
84
+ />
85
+ <DataListAction
86
+ aria-labelledby="multi-actions-item1 multi-actions-action1"
87
+ id="multi-actions-action1"
88
+ aria-label="Actions"
89
+ >
90
+ <Dropdown
91
+ popperProps={{ position: 'right' }}
92
+ onSelect={onSelect}
93
+ toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
94
+ <MenuToggle
95
+ ref={toggleRef}
96
+ isExpanded={isOpen}
97
+ onClick={onToggle}
98
+ variant="plain"
99
+ aria-label="Data list with actions example kebab toggle"
100
+ >
101
+ <EllipsisVIcon aria-hidden="true" />
102
+ </MenuToggle>
103
+ )}
104
+ isOpen={isOpen}
105
+ onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
106
+ >
107
+ <DropdownList>
108
+ <DropdownItem key="action">Action</DropdownItem>
109
+ {/* Prevent default onClick functionality for example
110
+ purposes */}
111
+ <DropdownItem key="link" to="#" onClick={(event: any) => event.preventDefault()}>
112
+ Link
113
+ </DropdownItem>
114
+ <DropdownItem key="disabled action" isDisabled>
115
+ Disabled Action
116
+ </DropdownItem>
117
+ <DropdownItem
118
+ key="disabled link"
119
+ isDisabled
120
+ to="#"
121
+ onClick={(event: any) => event.preventDefault()}
122
+ >
123
+ Disabled Link
124
+ </DropdownItem>
125
+ </DropdownList>
126
+ </Dropdown>
127
+ </DataListAction>
128
+ </DataListItemRow>
129
+ </DataListItem>
130
+ </DataList>
131
+ </PageSection>
132
+ </DashboardWrapper>
133
+ );
134
+ };
@@ -30,6 +30,11 @@ import { rows } from '@patternfly/react-core/dist/esm/demos/sampleData';
30
30
  ```js file="./DataList/examples/DataListExpandableControlInToolbar.tsx" isFullscreen
31
31
  ```
32
32
 
33
+ ### Actionable
34
+
35
+ ```js file="./DataList/examples/DataListActionable.tsx" isFullscreen
36
+ ```
37
+
33
38
  ### Static bottom pagination
34
39
 
35
40
  ```js file="./DataList/examples/DataListStaticBottomPagination.tsx" isFullscreen
@@ -4,6 +4,7 @@ section: components
4
4
  ---
5
5
 
6
6
  import CheckCircleIcon from '@patternfly/react-icons/dist/esm/icons/check-circle-icon';
7
+ import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
7
8
  import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
8
9
 
9
10
  ## Demos
@@ -11,4 +12,9 @@ import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/Dashboard
11
12
  ### Basic
12
13
 
13
14
  ```js file='./examples/DescriptionListBasic.tsx' isFullscreen
14
- ```
15
+ ```
16
+
17
+ ### In drawer
18
+
19
+ ```js file='./examples/DescriptionListInDrawer.tsx' isFullscreen
20
+ ```
@@ -0,0 +1,162 @@
1
+ import React from 'react';
2
+ import {
3
+ Gallery,
4
+ Content,
5
+ PageSection,
6
+ GalleryItem,
7
+ Card,
8
+ CardBody,
9
+ DrawerHead,
10
+ DrawerActions,
11
+ DrawerCloseButton,
12
+ DrawerPanelBody,
13
+ DescriptionList,
14
+ DescriptionListTerm,
15
+ DescriptionListGroup,
16
+ DescriptionListDescription,
17
+ Button,
18
+ Title
19
+ } from '@patternfly/react-core';
20
+ import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
21
+ import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
22
+
23
+ export const DescriptionListInDrawer: React.FunctionComponent = () => {
24
+ const drawerRef = React.useRef<HTMLDivElement>(null);
25
+ const btnRef = React.useRef<HTMLDivElement>(null);
26
+ const [isExpanded, setIsExpanded] = React.useState(true);
27
+
28
+ const onExpand = () => {
29
+ drawerRef.current && drawerRef.current.focus();
30
+ };
31
+
32
+ const onCloseClick = () => {
33
+ setIsExpanded(false);
34
+ btnRef.current && btnRef.current.focus();
35
+ };
36
+
37
+ const onToggleDrawer = () => {
38
+ setIsExpanded((prevIsExpanded) => !prevIsExpanded);
39
+ };
40
+
41
+ const panelContent = (
42
+ <>
43
+ <DrawerHead>
44
+ <Title headingLevel="h2">
45
+ <span ref={drawerRef} tabIndex={isExpanded ? 0 : -1}>
46
+ test
47
+ </span>
48
+ </Title>
49
+ <DrawerActions>
50
+ <DrawerCloseButton onClick={onCloseClick} />
51
+ </DrawerActions>
52
+ </DrawerHead>
53
+ <DrawerPanelBody>
54
+ <DescriptionList isFillColumns columnModifier={{ default: '2Col', lg: '2Col' }}>
55
+ <DescriptionListGroup>
56
+ <DescriptionListTerm>Name</DescriptionListTerm>
57
+ <DescriptionListDescription>test</DescriptionListDescription>
58
+ </DescriptionListGroup>
59
+ <DescriptionListGroup>
60
+ <DescriptionListTerm>Namespace</DescriptionListTerm>
61
+ <DescriptionListDescription>
62
+ <a href="#">mary-test</a>
63
+ </DescriptionListDescription>
64
+ </DescriptionListGroup>
65
+ <DescriptionListGroup>
66
+ <DescriptionListTerm>Labels</DescriptionListTerm>
67
+ <DescriptionListDescription>app=test</DescriptionListDescription>
68
+ </DescriptionListGroup>
69
+ <DescriptionListGroup>
70
+ <DescriptionListTerm>Pod selector</DescriptionListTerm>
71
+ <DescriptionListDescription>Node selector is not available at this time</DescriptionListDescription>
72
+ </DescriptionListGroup>
73
+ <DescriptionListGroup>
74
+ <DescriptionListTerm>Tolerations</DescriptionListTerm>
75
+ <DescriptionListDescription>No tolerations</DescriptionListDescription>
76
+ </DescriptionListGroup>
77
+ <DescriptionListGroup>
78
+ <DescriptionListTerm>Annotations</DescriptionListTerm>
79
+ <DescriptionListDescription>No annotaions</DescriptionListDescription>
80
+ </DescriptionListGroup>
81
+ <DescriptionListGroup>
82
+ <DescriptionListTerm>Status</DescriptionListTerm>
83
+ <DescriptionListDescription>Active</DescriptionListDescription>
84
+ </DescriptionListGroup>
85
+ <DescriptionListGroup>
86
+ <DescriptionListTerm>Created at:</DescriptionListTerm>
87
+ <DescriptionListDescription>3 minutes agot</DescriptionListDescription>
88
+ </DescriptionListGroup>
89
+ <DescriptionListGroup>
90
+ <DescriptionListTerm>Pod selector</DescriptionListTerm>
91
+ <DescriptionListDescription>
92
+ <Button variant="link" isInline icon={<PlusCircleIcon />}>
93
+ app=MyApp
94
+ </Button>
95
+ </DescriptionListDescription>
96
+ </DescriptionListGroup>
97
+ <DescriptionListGroup>
98
+ <DescriptionListTerm>Session affinity</DescriptionListTerm>
99
+ <DescriptionListDescription>None</DescriptionListDescription>
100
+ </DescriptionListGroup>
101
+ <DescriptionListGroup>
102
+ <DescriptionListTerm>Latest version</DescriptionListTerm>
103
+ <DescriptionListDescription>1.0</DescriptionListDescription>
104
+ </DescriptionListGroup>
105
+ <DescriptionListGroup>
106
+ <DescriptionListTerm>Update strategy</DescriptionListTerm>
107
+ <DescriptionListDescription>Rolling</DescriptionListDescription>
108
+ </DescriptionListGroup>
109
+ <DescriptionListGroup>
110
+ <DescriptionListTerm>Timeout</DescriptionListTerm>
111
+ <DescriptionListDescription>600 seconds</DescriptionListDescription>
112
+ </DescriptionListGroup>
113
+ <DescriptionListGroup>
114
+ <DescriptionListTerm>Max available</DescriptionListTerm>
115
+ <DescriptionListDescription>25% of 1 pod</DescriptionListDescription>
116
+ </DescriptionListGroup>
117
+ <DescriptionListGroup>
118
+ <DescriptionListTerm>Max surge</DescriptionListTerm>
119
+ <DescriptionListDescription>25% greater than 1 pod</DescriptionListDescription>
120
+ </DescriptionListGroup>
121
+ </DescriptionList>
122
+ </DrawerPanelBody>
123
+ </>
124
+ );
125
+
126
+ const drawerContent = (
127
+ <Gallery hasGutter>
128
+ <GalleryItem key={0}>
129
+ <Card>
130
+ <CardBody>
131
+ <Button variant="link" isInline onClick={onToggleDrawer} ref={btnRef}>
132
+ {`${isExpanded ? 'Close' : 'Open'} drawer`}
133
+ </Button>
134
+ </CardBody>
135
+ </Card>
136
+ </GalleryItem>
137
+ {Array.from({ length: 30 }).map((_value, index) => (
138
+ <GalleryItem key={index + 1}>
139
+ <Card>
140
+ <CardBody>{`Card-${index + 1}`}</CardBody>
141
+ </Card>
142
+ </GalleryItem>
143
+ ))}
144
+ </Gallery>
145
+ );
146
+
147
+ return (
148
+ <DashboardWrapper
149
+ notificationDrawer={panelContent}
150
+ isNotificationDrawerExpanded={isExpanded}
151
+ onNotificationDrawerExpand={onExpand}
152
+ >
153
+ <PageSection>
154
+ <Content>
155
+ <Content component="h1">Main title</Content>
156
+ <Content component="p">This is a full page demo.</Content>
157
+ </Content>
158
+ </PageSection>
159
+ <PageSection>{drawerContent}</PageSection>
160
+ </DashboardWrapper>
161
+ );
162
+ };
@@ -0,0 +1,13 @@
1
+ ---
2
+ id: Skeleton
3
+ section: components
4
+ ---
5
+ import { DashboardWrapper } from '@patternfly/react-core/dist/js/demos/DashboardWrapper';
6
+
7
+ ## Demos
8
+
9
+ ### Skeleton card
10
+
11
+ ```ts file='./examples/Skeleton/SkeletonCard.tsx' isFullscreen
12
+
13
+ ```
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { Gallery, Flex, PageSection, Content, Card, CardBody, Skeleton } from '@patternfly/react-core';
3
+ import { DashboardWrapper } from '@patternfly/react-core/src/demos/DashboardWrapper';
4
+
5
+ export const SkeletonCard: React.FunctionComponent = () => {
6
+ const card = (index: number) => (
7
+ <Card key={index} isCompact>
8
+ <CardBody>
9
+ <Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
10
+ <Skeleton screenreaderText="Loading content" />
11
+ <Skeleton width="66%" screenreaderText="Loaded 66% of content" />
12
+ <Skeleton width="25%" screenreaderText="Loaded 25% of content" />
13
+ <Skeleton width="50%" screenreaderText="Loaded 50% of content" />
14
+ </Flex>
15
+ </CardBody>
16
+ <CardBody>
17
+ <Skeleton shape="square" width="75%" screenreaderText="Loading medium square contents" />
18
+ </CardBody>
19
+ <CardBody>
20
+ <Flex direction={{ default: 'column' }} spacer={{ default: 'spacerMd' }}>
21
+ <Skeleton screenreaderText="Loading content" />
22
+ <Skeleton width="25%" screenreaderText="Loaded 25% of content" />
23
+ <Skeleton width="75%" screenreaderText="Loaded 75% of content" />
24
+ <Skeleton width="50%" screenreaderText="Loaded 50% of content" />
25
+ </Flex>
26
+ </CardBody>
27
+ </Card>
28
+ );
29
+ return (
30
+ <DashboardWrapper isBreadcrumbWidthLimited>
31
+ <PageSection isWidthLimited>
32
+ <Content component="h1">Main title</Content>
33
+ <Content component="p">This is a full page demo.</Content>
34
+ </PageSection>
35
+ <PageSection>
36
+ <Gallery hasGutter>{Array.from({ length: 7 }).map((_value, index) => card(index))}</Gallery>
37
+ </PageSection>
38
+ </DashboardWrapper>
39
+ );
40
+ };
@@ -1,108 +0,0 @@
1
- import React from 'react';
2
- import {
3
- DataList,
4
- DataListItem,
5
- DataListCell,
6
- DataListItemRow,
7
- DataListCheck,
8
- DataListControl,
9
- DataListDragButton,
10
- DataListItemCells,
11
- getUniqueId
12
- } from '@patternfly/react-core';
13
- import { DragDrop, Draggable, Droppable } from '@patternfly/react-core/deprecated';
14
-
15
- interface ItemType {
16
- id: string;
17
- content: string;
18
- }
19
-
20
- const getItems = (count: number) =>
21
- Array.from({ length: count }, (_, idx) => idx).map((idx) => ({
22
- id: `draggable-item-${idx}`,
23
- content: `item ${idx} `.repeat(idx === 4 ? 20 : 1)
24
- }));
25
-
26
- const reorder = (list: ItemType[], startIndex: number, endIndex: number) => {
27
- const result = list;
28
- const [removed] = result.splice(startIndex, 1);
29
- result.splice(endIndex, 0, removed);
30
- return result;
31
- };
32
-
33
- export const DataListDraggable: React.FunctionComponent = () => {
34
- const [items, setItems] = React.useState(getItems(10));
35
- const [liveText, setLiveText] = React.useState('');
36
-
37
- function onDrag(source) {
38
- setLiveText(`Started dragging ${items[source.index].content}`);
39
- // Return true to allow drag
40
- return true;
41
- }
42
-
43
- function onDragMove(source, dest) {
44
- const newText = dest ? `Move ${items[source.index].content} to ${items[dest.index].content}` : 'Invalid drop zone';
45
- if (newText !== liveText) {
46
- setLiveText(newText);
47
- }
48
- }
49
-
50
- function onDrop(source, dest) {
51
- if (dest) {
52
- const newItems = reorder(items, source.index, dest.index);
53
- setItems(newItems);
54
-
55
- setLiveText('Dragging finished.');
56
- return true; // Signal that this is a valid drop and not to animate the item returning home.
57
- } else {
58
- setLiveText('Dragging cancelled. List unchanged.');
59
- }
60
- }
61
-
62
- const uniqueId = getUniqueId();
63
-
64
- return (
65
- <DragDrop onDrag={onDrag} onDragMove={onDragMove} onDrop={onDrop}>
66
- <Droppable hasNoWrapper>
67
- <DataList aria-label="draggable data list example" isCompact>
68
- {items.map(({ id, content }) => (
69
- <Draggable key={id} hasNoWrapper>
70
- <DataListItem aria-labelledby={`draggable-${id}`} ref={React.createRef()}>
71
- <DataListItemRow>
72
- <DataListControl>
73
- <DataListDragButton
74
- aria-label="Reorder"
75
- aria-labelledby={`draggable-${id}`}
76
- aria-describedby={`description-${uniqueId}`}
77
- aria-pressed="false"
78
- />
79
- <DataListCheck
80
- id={`check-draggable-${id}`}
81
- aria-labelledby={`draggable-${id}`}
82
- name={id}
83
- otherControls
84
- />
85
- </DataListControl>
86
- <DataListItemCells
87
- dataListCells={[
88
- <DataListCell key={id}>
89
- <span id={`draggable-${id}`}>{content}</span>
90
- </DataListCell>
91
- ]}
92
- />
93
- </DataListItemRow>
94
- </DataListItem>
95
- </Draggable>
96
- ))}
97
- </DataList>
98
- </Droppable>
99
- <div className="pf-v6-screen-reader" aria-live="assertive">
100
- {liveText}
101
- </div>
102
- <div className="pf-v6-screen-reader" id={`description-${uniqueId}`}>
103
- Press space or enter to begin dragging, and use the arrow keys to navigate up or down. Press enter to confirm
104
- the drag, or any other key to cancel the drag operation.
105
- </div>
106
- </DragDrop>
107
- );
108
- };
@@ -1,177 +0,0 @@
1
- import React from 'react';
2
- import {
3
- DualListSelector,
4
- DualListSelectorPane,
5
- DualListSelectorList,
6
- DualListSelectorListItem,
7
- DualListSelectorControlsWrapper,
8
- DualListSelectorControl
9
- } from '@patternfly/react-core';
10
- import { DragDrop, Draggable, Droppable, DraggableItemPosition } from '@patternfly/react-core/deprecated';
11
- import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-left-icon';
12
- import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
13
- import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
14
- import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
15
-
16
- export const DualListSelectorComposableDragDrop: React.FunctionComponent = () => {
17
- const [ignoreNextOptionSelect, setIgnoreNextOptionSelect] = React.useState(false);
18
- const [availableOptions, setAvailableOptions] = React.useState([
19
- { text: 'Apple', selected: false, isVisible: true },
20
- { text: 'Banana', selected: false, isVisible: true },
21
- { text: 'Pineapple', selected: false, isVisible: true }
22
- ]);
23
- const [chosenOptions, setChosenOptions] = React.useState([
24
- { text: 'Orange', selected: false, isVisible: true },
25
- { text: 'Grape', selected: false, isVisible: true },
26
- { text: 'Peach', selected: false, isVisible: true },
27
- { text: 'Strawberry', selected: false, isVisible: true }
28
- ]);
29
-
30
- const moveSelected = (fromAvailable: boolean) => {
31
- const sourceOptions = fromAvailable ? availableOptions : chosenOptions;
32
- const destinationOptions = fromAvailable ? chosenOptions : availableOptions;
33
- for (let i = 0; i < sourceOptions.length; i++) {
34
- const option = sourceOptions[i];
35
- if (option.selected && option.isVisible) {
36
- sourceOptions.splice(i, 1);
37
- destinationOptions.push(option);
38
- option.selected = false;
39
- i--;
40
- }
41
- }
42
- if (fromAvailable) {
43
- setAvailableOptions([...sourceOptions]);
44
- setChosenOptions([...destinationOptions]);
45
- } else {
46
- setChosenOptions([...sourceOptions]);
47
- setAvailableOptions([...destinationOptions]);
48
- }
49
- };
50
-
51
- const moveAll = (fromAvailable: boolean) => {
52
- if (fromAvailable) {
53
- setChosenOptions([...availableOptions.filter((option) => option.isVisible), ...chosenOptions]);
54
- setAvailableOptions([...availableOptions.filter((option) => !option.isVisible)]);
55
- } else {
56
- setAvailableOptions([...chosenOptions.filter((option) => option.isVisible), ...availableOptions]);
57
- setChosenOptions([...chosenOptions.filter((option) => !option.isVisible)]);
58
- }
59
- };
60
-
61
- const onOptionSelect = (
62
- event: React.MouseEvent | React.ChangeEvent | React.KeyboardEvent,
63
- index: number,
64
- isChosen: boolean
65
- ) => {
66
- if (ignoreNextOptionSelect) {
67
- setIgnoreNextOptionSelect(false);
68
- return;
69
- }
70
- if (isChosen) {
71
- const newChosen = [...chosenOptions];
72
- newChosen[index].selected = !chosenOptions[index].selected;
73
- setChosenOptions(newChosen);
74
- } else {
75
- const newAvailable = [...availableOptions];
76
- newAvailable[index].selected = !availableOptions[index].selected;
77
- setAvailableOptions(newAvailable);
78
- }
79
- };
80
-
81
- const onDrop = (source: DraggableItemPosition, dest: DraggableItemPosition | undefined) => {
82
- if (dest) {
83
- const newList = [...chosenOptions];
84
- const [removed] = newList.splice(source.index, 1);
85
- newList.splice(dest.index, 0, removed);
86
- setChosenOptions(newList);
87
- return true;
88
- }
89
- return false;
90
- };
91
-
92
- return (
93
- <DualListSelector>
94
- <DualListSelectorPane
95
- title="Available"
96
- status={`${availableOptions.filter((option) => option.selected && option.isVisible).length} of ${
97
- availableOptions.filter((option) => option.isVisible).length
98
- } options selected`}
99
- >
100
- <DualListSelectorList>
101
- {availableOptions.map((option, index) =>
102
- option.isVisible ? (
103
- <DualListSelectorListItem
104
- key={index}
105
- isSelected={option.selected}
106
- id={`composable-drag-drop-available-option-${index}`}
107
- onOptionSelect={(e) => onOptionSelect(e, index, false)}
108
- >
109
- {option.text}
110
- </DualListSelectorListItem>
111
- ) : null
112
- )}
113
- </DualListSelectorList>
114
- </DualListSelectorPane>
115
- <DualListSelectorControlsWrapper>
116
- <DualListSelectorControl
117
- isDisabled={!availableOptions.some((option) => option.selected)}
118
- onClick={() => moveSelected(true)}
119
- aria-label="Add selected"
120
- icon={<AngleRightIcon />}
121
- />
122
- <DualListSelectorControl
123
- isDisabled={availableOptions.length === 0}
124
- onClick={() => moveAll(true)}
125
- aria-label="Add all"
126
- icon={<AngleDoubleRightIcon />}
127
- />
128
- <DualListSelectorControl
129
- isDisabled={chosenOptions.length === 0}
130
- onClick={() => moveAll(false)}
131
- aria-label="Remove all"
132
- icon={<AngleDoubleLeftIcon />}
133
- />
134
- <DualListSelectorControl
135
- onClick={() => moveSelected(false)}
136
- isDisabled={!chosenOptions.some((option) => option.selected)}
137
- aria-label="Remove selected"
138
- icon={<AngleLeftIcon />}
139
- />
140
- </DualListSelectorControlsWrapper>
141
- <DragDrop
142
- onDrag={() => {
143
- setIgnoreNextOptionSelect(true);
144
- return true;
145
- }}
146
- onDrop={onDrop}
147
- >
148
- <DualListSelectorPane
149
- title="Chosen"
150
- status={`${chosenOptions.filter((option) => option.selected && option.isVisible).length} of ${
151
- chosenOptions.filter((option) => option.isVisible).length
152
- } options selected`}
153
- isChosen
154
- >
155
- <Droppable hasNoWrapper>
156
- <DualListSelectorList>
157
- {chosenOptions.map((option, index) =>
158
- option.isVisible ? (
159
- <Draggable key={index} hasNoWrapper>
160
- <DualListSelectorListItem
161
- isSelected={option.selected}
162
- id={`composable-drag-drop-chosen-option-${index}`}
163
- onOptionSelect={(e) => onOptionSelect(e, index, true)}
164
- isDraggable
165
- >
166
- {option.text}
167
- </DualListSelectorListItem>
168
- </Draggable>
169
- ) : null
170
- )}
171
- </DualListSelectorList>
172
- </Droppable>
173
- </DualListSelectorPane>
174
- </DragDrop>
175
- </DualListSelector>
176
- );
177
- };