@patternfly/react-core 5.2.0-prerelease.19 → 5.2.0-prerelease.20
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 +6 -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/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/demos/RTL/RTL.md +31 -0
- package/src/demos/RTL/examples/PaginatedTable.css +7 -0
- package/src/demos/RTL/examples/PaginatedTable.jsx +507 -0
- package/src/demos/RTL/examples/translations.en.json +67 -0
- package/src/demos/RTL/examples/translations.he.json +82 -0
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Avatar,
|
|
5
|
+
Brand,
|
|
6
|
+
Breadcrumb,
|
|
7
|
+
BreadcrumbItem,
|
|
8
|
+
Button,
|
|
9
|
+
ButtonVariant,
|
|
10
|
+
Card,
|
|
11
|
+
Divider,
|
|
12
|
+
Dropdown,
|
|
13
|
+
DropdownGroup,
|
|
14
|
+
DropdownItem,
|
|
15
|
+
DropdownList,
|
|
16
|
+
Icon,
|
|
17
|
+
Label,
|
|
18
|
+
Masthead,
|
|
19
|
+
MastheadBrand,
|
|
20
|
+
MastheadContent,
|
|
21
|
+
MastheadMain,
|
|
22
|
+
MastheadToggle,
|
|
23
|
+
MenuToggle,
|
|
24
|
+
Nav,
|
|
25
|
+
NavItem,
|
|
26
|
+
NavList,
|
|
27
|
+
Page,
|
|
28
|
+
PageBreadcrumb,
|
|
29
|
+
PageSection,
|
|
30
|
+
PageSidebar,
|
|
31
|
+
PageSidebarBody,
|
|
32
|
+
PageToggleButton,
|
|
33
|
+
Pagination,
|
|
34
|
+
PaginationVariant,
|
|
35
|
+
Text,
|
|
36
|
+
TextContent,
|
|
37
|
+
TextVariants,
|
|
38
|
+
Toolbar,
|
|
39
|
+
ToolbarContent,
|
|
40
|
+
ToolbarGroup,
|
|
41
|
+
ToolbarItem,
|
|
42
|
+
Truncate
|
|
43
|
+
} from '@patternfly/react-core';
|
|
44
|
+
|
|
45
|
+
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';
|
|
46
|
+
import translationsEn from './examples/translations.en.json';
|
|
47
|
+
import translationsHe from './examples/translations.he.json';
|
|
48
|
+
import AlignRightIcon from '@patternfly/react-icons/dist/esm/icons/align-right-icon';
|
|
49
|
+
import ToolsIcon from '@patternfly/react-icons/dist/esm/icons/tools-icon';
|
|
50
|
+
import ClockIcon from '@patternfly/react-icons/dist/esm/icons/clock-icon';
|
|
51
|
+
import WalkingIcon from '@patternfly/react-icons/dist/esm/icons/walking-icon';
|
|
52
|
+
import pfLogo from '@patternfly/react-core/src/demos/assets/pf-logo.svg';
|
|
53
|
+
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
54
|
+
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
55
|
+
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
56
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
57
|
+
import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
|
|
58
|
+
import HandPaperIcon from '@patternfly/react-icons/dist/esm/icons/hand-paper-icon';
|
|
59
|
+
import imgAvatar from '@patternfly/react-core/src/components/assets/avatarImg.svg';
|
|
60
|
+
|
|
61
|
+
export const PaginatedTableAction = () => {
|
|
62
|
+
const [translation, setTranslation] = React.useState(translationsEn);
|
|
63
|
+
const [page, setPage] = React.useState(1);
|
|
64
|
+
const [perPage, setPerPage] = React.useState(10);
|
|
65
|
+
|
|
66
|
+
const columns = [
|
|
67
|
+
translation.table.columns.servers,
|
|
68
|
+
translation.table.columns.status,
|
|
69
|
+
translation.table.columns.location,
|
|
70
|
+
translation.table.columns.modified,
|
|
71
|
+
translation.table.columns.url
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
const numRows = 25;
|
|
75
|
+
const getRandomInteger = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
|
|
76
|
+
const createRows = () => {
|
|
77
|
+
const rows = [];
|
|
78
|
+
for (let i = 0; i < numRows; i++) {
|
|
79
|
+
const num = i + 1;
|
|
80
|
+
const rowObj = {
|
|
81
|
+
name: translation.table.rows.node + num,
|
|
82
|
+
status: [
|
|
83
|
+
translation.table.rows.status.stopped,
|
|
84
|
+
translation.table.rows.status.running,
|
|
85
|
+
translation.table.rows.status.down,
|
|
86
|
+
translation.table.rows.status.needsMaintenance
|
|
87
|
+
][getRandomInteger(0, 3)],
|
|
88
|
+
location: [
|
|
89
|
+
translation.table.rows.locations.raleigh,
|
|
90
|
+
translation.table.rows.locations.boston,
|
|
91
|
+
translation.table.rows.locations.atlanta,
|
|
92
|
+
translation.table.rows.locations.sanFrancisco
|
|
93
|
+
][getRandomInteger(0, 3)],
|
|
94
|
+
lastModified: [
|
|
95
|
+
translation.table.rows.lastModified.oneHr,
|
|
96
|
+
translation.table.rows.lastModified.threeHrs,
|
|
97
|
+
translation.table.rows.lastModified.fiveHrs,
|
|
98
|
+
translation.table.rows.lastModified.sevenMins,
|
|
99
|
+
translation.table.rows.lastModified.fortyTwoMins,
|
|
100
|
+
translation.table.rows.lastModified.twoDays,
|
|
101
|
+
translation.table.rows.lastModified.oneMonth
|
|
102
|
+
][getRandomInteger(0, 6)],
|
|
103
|
+
url: 'http://www.redhat.com/en/office-locations/node' + num
|
|
104
|
+
};
|
|
105
|
+
rows.push(rowObj);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return rows;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const rows = createRows();
|
|
112
|
+
const [managedRows, setManagedRows] = React.useState(rows);
|
|
113
|
+
const [paginatedRows, setPaginatedRows] = React.useState(rows.slice(0, 10));
|
|
114
|
+
const [isDirRTL, setIsDirRTL] = React.useState(false);
|
|
115
|
+
|
|
116
|
+
const capitalize = (input) => input[0].toUpperCase() + input.substring(1);
|
|
117
|
+
|
|
118
|
+
const switchTranslation = () => {
|
|
119
|
+
setIsDirRTL((prevIsDirRTL) => !prevIsDirRTL);
|
|
120
|
+
setTranslation((prevTranslation) => (prevTranslation === translationsEn ? translationsHe : translationsEn));
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
React.useEffect(() => {
|
|
124
|
+
const newRows = createRows();
|
|
125
|
+
setManagedRows(newRows);
|
|
126
|
+
setPaginatedRows(newRows.slice((page - 1) * perPage, page * perPage));
|
|
127
|
+
}, [translation]);
|
|
128
|
+
|
|
129
|
+
React.useEffect(() => {
|
|
130
|
+
const html = document.querySelector('html');
|
|
131
|
+
html.dir = isDirRTL ? 'rtl' : 'ltr';
|
|
132
|
+
}, [isDirRTL]);
|
|
133
|
+
|
|
134
|
+
// Pagination logic
|
|
135
|
+
|
|
136
|
+
const handleSetPage = (_evt, newPage, _perPage, startIdx, endIdx) => {
|
|
137
|
+
setPaginatedRows(managedRows.slice(startIdx, endIdx));
|
|
138
|
+
setPage(newPage);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const handlePerPageSelect = (_evt, newPerPage, _newPage, startIdx, endIdx) => {
|
|
142
|
+
setPaginatedRows(managedRows.slice(startIdx, endIdx));
|
|
143
|
+
setPerPage(newPerPage);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const renderPagination = (variant) => {
|
|
147
|
+
const { pagination } = translation;
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Pagination
|
|
151
|
+
itemCount={managedRows.length}
|
|
152
|
+
page={page}
|
|
153
|
+
perPage={perPage}
|
|
154
|
+
onSetPage={handleSetPage}
|
|
155
|
+
onPerPageSelect={handlePerPageSelect}
|
|
156
|
+
variant={variant}
|
|
157
|
+
titles={{
|
|
158
|
+
paginationAriaLabel: pagination?.[`${variant}VariantAriaLabel`] || `${variant} pagination`,
|
|
159
|
+
ofWord: pagination?.ofWord,
|
|
160
|
+
items: pagination?.items,
|
|
161
|
+
perPageSuffix: pagination?.perPageSuffix,
|
|
162
|
+
toNextPageAriaLabel: pagination?.toNextPageAriaLabel,
|
|
163
|
+
toPreviousPageAriaLabel: pagination?.toPreviousPageAriaLabel,
|
|
164
|
+
toFirstPageAriaLabel: pagination?.toFirstPageAriaLabel,
|
|
165
|
+
toLastPageAriaLabel: pagination?.perPageSuffix,
|
|
166
|
+
currPageAriaLabel: pagination?.currPageAriaLabel
|
|
167
|
+
}}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const breadcrumbItems = {
|
|
173
|
+
home: {
|
|
174
|
+
url: '#home'
|
|
175
|
+
},
|
|
176
|
+
category: {
|
|
177
|
+
url: '#category'
|
|
178
|
+
},
|
|
179
|
+
subCategory: {
|
|
180
|
+
url: 'sub-category'
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const renderLabel = (labelText) => {
|
|
185
|
+
switch (labelText) {
|
|
186
|
+
case 'Running':
|
|
187
|
+
case 'רץ':
|
|
188
|
+
return (
|
|
189
|
+
<Label
|
|
190
|
+
color="green"
|
|
191
|
+
icon={
|
|
192
|
+
<Icon shouldMirrorRTL>
|
|
193
|
+
<WalkingIcon />
|
|
194
|
+
</Icon>
|
|
195
|
+
}
|
|
196
|
+
>
|
|
197
|
+
{translation.table.rows.status.running}
|
|
198
|
+
</Label>
|
|
199
|
+
);
|
|
200
|
+
case 'Stopped':
|
|
201
|
+
case 'עצר':
|
|
202
|
+
return (
|
|
203
|
+
<Label
|
|
204
|
+
icon={
|
|
205
|
+
<Icon shouldMirrorRTL>
|
|
206
|
+
<HandPaperIcon />
|
|
207
|
+
</Icon>
|
|
208
|
+
}
|
|
209
|
+
color="red"
|
|
210
|
+
>
|
|
211
|
+
{translation.table.rows.status.stopped}
|
|
212
|
+
</Label>
|
|
213
|
+
);
|
|
214
|
+
case 'Needs maintenance':
|
|
215
|
+
case 'זקוק לתחזוקה':
|
|
216
|
+
return (
|
|
217
|
+
<Label icon={<ToolsIcon />} color="blue">
|
|
218
|
+
{translation.table.rows.status.needsMaintenance}
|
|
219
|
+
</Label>
|
|
220
|
+
);
|
|
221
|
+
case 'Down':
|
|
222
|
+
case 'מטה':
|
|
223
|
+
return (
|
|
224
|
+
<Label icon={<ClockIcon />} color="orange">
|
|
225
|
+
{translation.table.rows.status.down}
|
|
226
|
+
</Label>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const toolbarItems = (
|
|
232
|
+
<React.Fragment>
|
|
233
|
+
<Toolbar id="rtl-paginated-table">
|
|
234
|
+
<ToolbarContent>
|
|
235
|
+
<ToolbarItem>
|
|
236
|
+
<Button
|
|
237
|
+
variant="primary"
|
|
238
|
+
icon={
|
|
239
|
+
<Icon shouldMirrorRTL>
|
|
240
|
+
<AlignRightIcon />
|
|
241
|
+
</Icon>
|
|
242
|
+
}
|
|
243
|
+
iconPosition="end"
|
|
244
|
+
onClick={switchTranslation}
|
|
245
|
+
>
|
|
246
|
+
{translation.switchBtn}
|
|
247
|
+
</Button>
|
|
248
|
+
</ToolbarItem>
|
|
249
|
+
<ToolbarItem variant="pagination">{renderPagination(PaginationVariant.top)}</ToolbarItem>
|
|
250
|
+
</ToolbarContent>
|
|
251
|
+
</Toolbar>
|
|
252
|
+
</React.Fragment>
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
const pageNav = (
|
|
256
|
+
<Nav aria-label={translation.nav.ariaLabel || undefined}>
|
|
257
|
+
<NavList>
|
|
258
|
+
<NavItem itemId={0} isActive to="#system-panel">
|
|
259
|
+
{translation.nav.systemPanel}
|
|
260
|
+
</NavItem>
|
|
261
|
+
<NavItem itemId={1} to="#policy">
|
|
262
|
+
{translation.nav.policy}
|
|
263
|
+
</NavItem>
|
|
264
|
+
<NavItem itemId={2} to="#auth">
|
|
265
|
+
{translation.nav.authentication}
|
|
266
|
+
</NavItem>
|
|
267
|
+
<NavItem itemId={3} to="#network">
|
|
268
|
+
{translation.nav.networkServices}
|
|
269
|
+
</NavItem>
|
|
270
|
+
<NavItem itemId={4} to="#server">
|
|
271
|
+
{translation.nav.server}
|
|
272
|
+
</NavItem>
|
|
273
|
+
</NavList>
|
|
274
|
+
</Nav>
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
const sidebar = (
|
|
278
|
+
<PageSidebar>
|
|
279
|
+
<PageSidebarBody>{pageNav}</PageSidebarBody>
|
|
280
|
+
</PageSidebar>
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
|
|
284
|
+
const [isKebabDropdownOpen, setIsKebabDropdownOpen] = React.useState(false);
|
|
285
|
+
const [isFullKebabDropdownOpen, setIsFullKebabDropdownOpen] = React.useState(false);
|
|
286
|
+
|
|
287
|
+
const kebabDropdownItems = (
|
|
288
|
+
<>
|
|
289
|
+
<DropdownItem icon={<CogIcon />}>{translation.kebabDropdown.settings}</DropdownItem>
|
|
290
|
+
<DropdownItem icon={<HelpIcon />}>{translation.kebabDropdown.help}</DropdownItem>
|
|
291
|
+
</>
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
const userDropdownItems = (
|
|
295
|
+
<>
|
|
296
|
+
<DropdownItem key="group 2 profile">{translation.userDropdown.myProfile}</DropdownItem>
|
|
297
|
+
<DropdownItem key="group 2 user">{translation.userDropdown.userManagement}</DropdownItem>
|
|
298
|
+
<DropdownItem key="group 2 logout">{translation.userDropdown.logout}</DropdownItem>
|
|
299
|
+
</>
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
const onDropdownToggle = () => {
|
|
303
|
+
setIsDropdownOpen(!isDropdownOpen);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const onDropdownSelect = () => {
|
|
307
|
+
setIsDropdownOpen(false);
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
const onKebabDropdownToggle = () => {
|
|
311
|
+
setIsKebabDropdownOpen(!isKebabDropdownOpen);
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const onKebabDropdownSelect = () => {
|
|
315
|
+
setIsKebabDropdownOpen(false);
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
const onFullKebabToggle = () => {
|
|
319
|
+
setIsFullKebabDropdownOpen(!isFullKebabDropdownOpen);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
const onFullKebabSelect = () => {
|
|
323
|
+
setIsFullKebabDropdownOpen(false);
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
const masthead = (
|
|
327
|
+
<Masthead>
|
|
328
|
+
<MastheadToggle>
|
|
329
|
+
<PageToggleButton variant="plain" aria-label={translation.mastheadToggleAriaLabel}>
|
|
330
|
+
<BarsIcon />
|
|
331
|
+
</PageToggleButton>
|
|
332
|
+
</MastheadToggle>
|
|
333
|
+
<MastheadMain>
|
|
334
|
+
<MastheadBrand dir="ltr">
|
|
335
|
+
<Brand src={pfLogo} alt="PatternFly" heights={{ default: '36px' }} />
|
|
336
|
+
{translation.brandLanguage && <span className="brand-language">{translation.brandLanguage}</span>}
|
|
337
|
+
</MastheadBrand>
|
|
338
|
+
</MastheadMain>
|
|
339
|
+
<MastheadContent>
|
|
340
|
+
<Toolbar id="toolbar" isFullHeight isStatic>
|
|
341
|
+
<ToolbarContent>
|
|
342
|
+
<ToolbarGroup
|
|
343
|
+
variant="icon-button-group"
|
|
344
|
+
align={{ default: 'alignRight' }}
|
|
345
|
+
spacer={{ default: 'spacerNone', md: 'spacerMd' }}
|
|
346
|
+
>
|
|
347
|
+
<ToolbarGroup variant="icon-button-group" visibility={{ default: 'hidden', lg: 'visible' }}>
|
|
348
|
+
<ToolbarItem>
|
|
349
|
+
<Button
|
|
350
|
+
aria-label={translation.kebabDropdown.settings}
|
|
351
|
+
variant={ButtonVariant.plain}
|
|
352
|
+
icon={<CogIcon />}
|
|
353
|
+
/>
|
|
354
|
+
</ToolbarItem>
|
|
355
|
+
<ToolbarItem>
|
|
356
|
+
<Button
|
|
357
|
+
aria-label={translation.kebabDropdown.help}
|
|
358
|
+
variant={ButtonVariant.plain}
|
|
359
|
+
icon={<QuestionCircleIcon />}
|
|
360
|
+
/>
|
|
361
|
+
</ToolbarItem>
|
|
362
|
+
</ToolbarGroup>
|
|
363
|
+
<ToolbarItem visibility={{ default: 'hidden', md: 'visible', lg: 'hidden' }}>
|
|
364
|
+
<Dropdown
|
|
365
|
+
isOpen={isKebabDropdownOpen}
|
|
366
|
+
onSelect={onKebabDropdownSelect}
|
|
367
|
+
onOpenChange={setIsKebabDropdownOpen}
|
|
368
|
+
popperProps={{ position: 'right' }}
|
|
369
|
+
toggle={(toggleRef) => (
|
|
370
|
+
<MenuToggle
|
|
371
|
+
ref={toggleRef}
|
|
372
|
+
isExpanded={isKebabDropdownOpen}
|
|
373
|
+
onClick={onKebabDropdownToggle}
|
|
374
|
+
variant="plain"
|
|
375
|
+
aria-label={translation.kebabDropdown.settingsAndHelp}
|
|
376
|
+
>
|
|
377
|
+
<EllipsisVIcon aria-hidden="true" />
|
|
378
|
+
</MenuToggle>
|
|
379
|
+
)}
|
|
380
|
+
>
|
|
381
|
+
<DropdownList>{kebabDropdownItems}</DropdownList>
|
|
382
|
+
</Dropdown>
|
|
383
|
+
</ToolbarItem>
|
|
384
|
+
<ToolbarItem visibility={{ md: 'hidden' }}>
|
|
385
|
+
<Dropdown
|
|
386
|
+
isOpen={isFullKebabDropdownOpen}
|
|
387
|
+
onSelect={onFullKebabSelect}
|
|
388
|
+
onOpenChange={setIsFullKebabDropdownOpen}
|
|
389
|
+
popperProps={{ position: 'right' }}
|
|
390
|
+
toggle={(toggleRef) => (
|
|
391
|
+
<MenuToggle
|
|
392
|
+
ref={toggleRef}
|
|
393
|
+
isExpanded={isFullKebabDropdownOpen}
|
|
394
|
+
onClick={onFullKebabToggle}
|
|
395
|
+
variant="plain"
|
|
396
|
+
aria-label={translation.kebabAndUserDropdown.toolbarMenuAriaLabel}
|
|
397
|
+
>
|
|
398
|
+
<EllipsisVIcon aria-hidden="true" />
|
|
399
|
+
</MenuToggle>
|
|
400
|
+
)}
|
|
401
|
+
>
|
|
402
|
+
<DropdownGroup key="group 2" aria-label={translation.kebabAndUserDropdown.groupAriaLabel}>
|
|
403
|
+
<DropdownList>{userDropdownItems}</DropdownList>
|
|
404
|
+
</DropdownGroup>
|
|
405
|
+
<Divider />
|
|
406
|
+
<DropdownList>{kebabDropdownItems}</DropdownList>
|
|
407
|
+
</Dropdown>
|
|
408
|
+
</ToolbarItem>
|
|
409
|
+
</ToolbarGroup>
|
|
410
|
+
<ToolbarItem visibility={{ default: 'hidden', md: 'visible' }}>
|
|
411
|
+
<Dropdown
|
|
412
|
+
isOpen={isDropdownOpen}
|
|
413
|
+
onSelect={onDropdownSelect}
|
|
414
|
+
onOpenChange={setIsDropdownOpen}
|
|
415
|
+
popperProps={{ position: 'right' }}
|
|
416
|
+
toggle={(toggleRef) => (
|
|
417
|
+
<MenuToggle
|
|
418
|
+
ref={toggleRef}
|
|
419
|
+
isExpanded={isDropdownOpen}
|
|
420
|
+
onClick={onDropdownToggle}
|
|
421
|
+
icon={<Avatar src={imgAvatar} alt="" />}
|
|
422
|
+
isFullHeight
|
|
423
|
+
>
|
|
424
|
+
{translation.username}
|
|
425
|
+
</MenuToggle>
|
|
426
|
+
)}
|
|
427
|
+
>
|
|
428
|
+
<DropdownList>{userDropdownItems}</DropdownList>
|
|
429
|
+
</Dropdown>
|
|
430
|
+
</ToolbarItem>
|
|
431
|
+
</ToolbarContent>
|
|
432
|
+
</Toolbar>
|
|
433
|
+
</MastheadContent>
|
|
434
|
+
</Masthead>
|
|
435
|
+
);
|
|
436
|
+
|
|
437
|
+
return (
|
|
438
|
+
<React.Fragment>
|
|
439
|
+
<Page sidebar={sidebar} header={masthead} isManagedSidebar>
|
|
440
|
+
<PageBreadcrumb>
|
|
441
|
+
<Breadcrumb aria-label={translation.breadcrumbs.ariaLabel || undefined}>
|
|
442
|
+
{Object.keys(breadcrumbItems).map((key, idx, arr) => (
|
|
443
|
+
<BreadcrumbItem key={idx} isActive={arr.length - 1 === idx} to={`${breadcrumbItems[key].url}`}>
|
|
444
|
+
{translation.breadcrumbs[key]}
|
|
445
|
+
{breadcrumbItems.length}
|
|
446
|
+
</BreadcrumbItem>
|
|
447
|
+
))}
|
|
448
|
+
</Breadcrumb>
|
|
449
|
+
</PageBreadcrumb>
|
|
450
|
+
<PageSection variant="light">
|
|
451
|
+
<TextContent>
|
|
452
|
+
<Text component={TextVariants.h1}>{translation.title}</Text>
|
|
453
|
+
<Text component={TextVariants.p}>{translation.body}</Text>
|
|
454
|
+
</TextContent>
|
|
455
|
+
</PageSection>
|
|
456
|
+
<PageSection>
|
|
457
|
+
<Card>
|
|
458
|
+
{toolbarItems}
|
|
459
|
+
<Table variant="compact" aria-label={translation.table.ariaLabel}>
|
|
460
|
+
<Thead>
|
|
461
|
+
<Tr>
|
|
462
|
+
{columns.map((column, columnIndex) => (
|
|
463
|
+
<Th key={columnIndex}>{column}</Th>
|
|
464
|
+
))}
|
|
465
|
+
</Tr>
|
|
466
|
+
</Thead>
|
|
467
|
+
<Tbody>
|
|
468
|
+
{paginatedRows.map((row, rowIndex) => (
|
|
469
|
+
<Tr key={rowIndex}>
|
|
470
|
+
<>
|
|
471
|
+
{Object.entries(row).map(([key, value]) => {
|
|
472
|
+
if (key === 'status') {
|
|
473
|
+
return (
|
|
474
|
+
<Td key={key} width={15} dataLabel="Status">
|
|
475
|
+
{renderLabel(value)}
|
|
476
|
+
</Td>
|
|
477
|
+
);
|
|
478
|
+
} else if (key === 'url') {
|
|
479
|
+
return (
|
|
480
|
+
// Passing dir="rtl" forces truncation at the start of the URL,
|
|
481
|
+
// resulting in the unique portion being visible regardless of language
|
|
482
|
+
<Td key={key} dataLabel="URL" width={15}>
|
|
483
|
+
<a href="#">
|
|
484
|
+
<Truncate content={row.url} position={isDirRTL ? 'end' : 'start'} />
|
|
485
|
+
</a>
|
|
486
|
+
</Td>
|
|
487
|
+
);
|
|
488
|
+
} else {
|
|
489
|
+
return (
|
|
490
|
+
<Td key={key} dataLabel={key === 'lastModified' ? 'Last modified' : capitalize(key)}>
|
|
491
|
+
{value}
|
|
492
|
+
</Td>
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
})}
|
|
496
|
+
</>
|
|
497
|
+
</Tr>
|
|
498
|
+
))}
|
|
499
|
+
</Tbody>
|
|
500
|
+
</Table>
|
|
501
|
+
{renderPagination(PaginationVariant.bottom)}
|
|
502
|
+
</Card>
|
|
503
|
+
</PageSection>
|
|
504
|
+
</Page>
|
|
505
|
+
</React.Fragment>
|
|
506
|
+
);
|
|
507
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Main title",
|
|
3
|
+
"username": "John Doe",
|
|
4
|
+
"body": "This is a full page demo.",
|
|
5
|
+
"mastheadToggleAriaLabel": "Global navigation",
|
|
6
|
+
"kebabDropdown": {
|
|
7
|
+
"settings": "Settings",
|
|
8
|
+
"help": "Help",
|
|
9
|
+
"settingsAndHelp": "Settings and help"
|
|
10
|
+
},
|
|
11
|
+
"userDropdown": {
|
|
12
|
+
"myProfile": "My profile",
|
|
13
|
+
"userManagement": "User management",
|
|
14
|
+
"logout": "Log out"
|
|
15
|
+
},
|
|
16
|
+
"kebabAndUserDropdown": {
|
|
17
|
+
"toolbarMenuAriaLabel": "Toolbar menu",
|
|
18
|
+
"groupAriaLabel": "User actions"
|
|
19
|
+
},
|
|
20
|
+
"breadcrumbs": {
|
|
21
|
+
"home": "Home",
|
|
22
|
+
"category": "Category",
|
|
23
|
+
"subCategory": "Sub category"
|
|
24
|
+
},
|
|
25
|
+
"nav": {
|
|
26
|
+
"systemPanel": "System panel",
|
|
27
|
+
"policy": "Policy",
|
|
28
|
+
"authentication": "Authentication",
|
|
29
|
+
"networkServices": "Network services",
|
|
30
|
+
"server": "Server"
|
|
31
|
+
},
|
|
32
|
+
"switchBtn": "Switch to Hebrew",
|
|
33
|
+
"table": {
|
|
34
|
+
"ariaLabel": "Right to left demo table",
|
|
35
|
+
"columns": {
|
|
36
|
+
"servers": "Servers",
|
|
37
|
+
"status": "Status",
|
|
38
|
+
"location": "Location",
|
|
39
|
+
"modified": "Last modified",
|
|
40
|
+
"url": "URL"
|
|
41
|
+
},
|
|
42
|
+
"rows": {
|
|
43
|
+
"node": "Node",
|
|
44
|
+
"status": {
|
|
45
|
+
"stopped": "Stopped",
|
|
46
|
+
"running": "Running",
|
|
47
|
+
"down": "Down",
|
|
48
|
+
"needsMaintenance": "Needs maintenance"
|
|
49
|
+
},
|
|
50
|
+
"locations": {
|
|
51
|
+
"raleigh": "Raleigh",
|
|
52
|
+
"boston": "Boston",
|
|
53
|
+
"atlanta": "Atlanta",
|
|
54
|
+
"sanFrancisco": "San Francisco"
|
|
55
|
+
},
|
|
56
|
+
"lastModified": {
|
|
57
|
+
"oneHr": "1 hour ago",
|
|
58
|
+
"threeHrs": "3 hours ago",
|
|
59
|
+
"fiveHrs": "5 hours ago",
|
|
60
|
+
"sevenMins": "7 minutes ago",
|
|
61
|
+
"fortyTwoMins": "42 minutes ago",
|
|
62
|
+
"twoDays": "2 days ago",
|
|
63
|
+
"oneMonth": "1 month ago"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "כותרת ראשית",
|
|
3
|
+
"username": "פלוני אלמוני",
|
|
4
|
+
"brandLanguage": "עִברִית",
|
|
5
|
+
"body": "זוהי הדגמה של עמוד שלם.",
|
|
6
|
+
"mastheadToggleAriaLabel": "ניווט גלובלי",
|
|
7
|
+
"kebabDropdown": {
|
|
8
|
+
"settings": "הגדרות",
|
|
9
|
+
"help": "עֶזרָה",
|
|
10
|
+
"settingsAndHelp": "הגדרות ועזרה"
|
|
11
|
+
},
|
|
12
|
+
"userDropdown": {
|
|
13
|
+
"myProfile": "הפרופיל שלי",
|
|
14
|
+
"userManagement": "ניהול משתמשים",
|
|
15
|
+
"logout": "להתנתק"
|
|
16
|
+
},
|
|
17
|
+
"kebabAndUserDropdown": {
|
|
18
|
+
"toolbarMenuAriaLabel": "תפריט סרגל הכלים",
|
|
19
|
+
"groupAriaLabel": "פעולות משתמש"
|
|
20
|
+
},
|
|
21
|
+
"breadcrumbs": {
|
|
22
|
+
"home": "בית",
|
|
23
|
+
"category": "קטגוריה",
|
|
24
|
+
"subCategory": "קטגוריית משנה",
|
|
25
|
+
"ariaLabel": "פירורי לחם"
|
|
26
|
+
},
|
|
27
|
+
"pagination": {
|
|
28
|
+
"ofWord": "שֶׁל",
|
|
29
|
+
"items": "פריטים",
|
|
30
|
+
"perPageSuffix": "לכל עמוד",
|
|
31
|
+
"toNextPageAriaLabel": "עבור לדף הבא",
|
|
32
|
+
"toPreviousPageAriaLabel": "תחזור לדף הקודם",
|
|
33
|
+
"toFirstPageAriaLabel": "עבור לעמוד הראשון",
|
|
34
|
+
"toLastPageAriaLabel": "עבור לדף האחרון",
|
|
35
|
+
"currPageAriaLabel": "העמוד הנוכחי",
|
|
36
|
+
"topVariantAriaLabel": "עימוד עליון",
|
|
37
|
+
"bottomVariantAriaLabel": "עימוד תחתון"
|
|
38
|
+
},
|
|
39
|
+
"nav": {
|
|
40
|
+
"systemPanel": "פאנל מערכת",
|
|
41
|
+
"policy": "מְדִינִיוּת",
|
|
42
|
+
"authentication": "אימות",
|
|
43
|
+
"networkServices": "שירותי רשת",
|
|
44
|
+
"server": "שרת",
|
|
45
|
+
"ariaLabel": "גלוֹבָּלִי"
|
|
46
|
+
},
|
|
47
|
+
"switchBtn": "Switch to English",
|
|
48
|
+
"table": {
|
|
49
|
+
"ariaLabel": "טבלת הדגמה מימין לשמאל",
|
|
50
|
+
"columns": {
|
|
51
|
+
"servers": "שרתים",
|
|
52
|
+
"status": "סטָטוּס",
|
|
53
|
+
"location": "מקום",
|
|
54
|
+
"modified": "עודכן לאחרונה",
|
|
55
|
+
"url": "כתובת אתר"
|
|
56
|
+
},
|
|
57
|
+
"rows": {
|
|
58
|
+
"node": "נקודת קצה",
|
|
59
|
+
"status": {
|
|
60
|
+
"stopped": "עצר",
|
|
61
|
+
"running": "רץ",
|
|
62
|
+
"down": "מטה",
|
|
63
|
+
"needsMaintenance": "זקוק לתחזוקה"
|
|
64
|
+
},
|
|
65
|
+
"locations": {
|
|
66
|
+
"raleigh": "Raleigh",
|
|
67
|
+
"boston": "Boston",
|
|
68
|
+
"atlanta": "Atlanta",
|
|
69
|
+
"sanFrancisco": "San Francisco"
|
|
70
|
+
},
|
|
71
|
+
"lastModified": {
|
|
72
|
+
"oneHr": "לפני שעה",
|
|
73
|
+
"threeHrs": "לפני 3 שעות",
|
|
74
|
+
"fiveHrs": "לפני 5 שעות",
|
|
75
|
+
"sevenMins": "לפני 7 דקות",
|
|
76
|
+
"fortyTwoMins": "לפני 42 דקות",
|
|
77
|
+
"twoDays": "לפני יומיים",
|
|
78
|
+
"oneMonth": "לפני חודש"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|