@patternfly/react-core 4.225.7 → 4.225.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +6 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +6 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/styles/base-no-reset.css +1 -0
- package/dist/styles/base.css +1 -0
- package/dist/umd/react-core.css +22036 -22017
- package/dist/umd/react-core.js +9 -1
- package/dist/umd/react-core.min.css +26 -7
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +6 -6
- package/src/components/CalendarMonth/CalendarMonth.tsx +10 -1
- package/src/components/CalendarMonth/__tests__/CalendarMonth.test.tsx +57 -0
- package/src/demos/NotificationDrawer/NotificationDrawer.md +8 -20
- package/src/demos/PrimaryDetail.md +283 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.225.
|
|
3
|
+
"version": "4.225.10",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.76.
|
|
38
|
-
"@patternfly/react-styles": "^4.75.
|
|
39
|
-
"@patternfly/react-tokens": "^4.77.
|
|
37
|
+
"@patternfly/react-icons": "^4.76.10",
|
|
38
|
+
"@patternfly/react-styles": "^4.75.10",
|
|
39
|
+
"@patternfly/react-tokens": "^4.77.10",
|
|
40
40
|
"focus-trap": "6.9.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.
|
|
46
|
+
"@patternfly/patternfly": "4.204.2",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "ae1f341cfd4e094892f9fba068aece48bef36dd3"
|
|
64
64
|
}
|
|
@@ -64,13 +64,20 @@ const yearFormat = (date: Date) => date.getFullYear();
|
|
|
64
64
|
|
|
65
65
|
const buildCalendar = (year: number, month: number, weekStart: number, validators: ((date: Date) => boolean)[]) => {
|
|
66
66
|
const defaultDate = new Date(year, month);
|
|
67
|
+
|
|
67
68
|
const firstDayOfWeek = new Date(defaultDate);
|
|
68
69
|
firstDayOfWeek.setDate(firstDayOfWeek.getDate() - firstDayOfWeek.getDay() + weekStart);
|
|
70
|
+
|
|
69
71
|
// We will show a maximum of 6 weeks like Google calendar
|
|
70
72
|
// Assume we just want the numbers for now...
|
|
71
73
|
const calendarWeeks = [];
|
|
74
|
+
|
|
75
|
+
if (firstDayOfWeek.getMonth() === defaultDate.getMonth() && firstDayOfWeek.getDate() !== 1) {
|
|
76
|
+
firstDayOfWeek.setDate(firstDayOfWeek.getDate() - 7);
|
|
77
|
+
}
|
|
72
78
|
for (let i = 0; i < 6; i++) {
|
|
73
79
|
const week = [];
|
|
80
|
+
|
|
74
81
|
for (let j = 0; j < 7; j++) {
|
|
75
82
|
const date = new Date(firstDayOfWeek);
|
|
76
83
|
week.push({
|
|
@@ -338,7 +345,9 @@ export const CalendarMonth = ({
|
|
|
338
345
|
tabIndex={isFocused ? 0 : -1}
|
|
339
346
|
disabled={!isValid}
|
|
340
347
|
aria-label={
|
|
341
|
-
cellAriaLabel
|
|
348
|
+
cellAriaLabel
|
|
349
|
+
? cellAriaLabel(date)
|
|
350
|
+
: `${dayFormat(date)} ${monthFormat(date)} ${yearFormat(date)}`
|
|
342
351
|
}
|
|
343
352
|
{...(isFocused && { ref: focusRef })}
|
|
344
353
|
>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import { CalendarMonth } from '../CalendarMonth';
|
|
6
|
+
|
|
7
|
+
test('Renders the first date in a month when a custom weekStart is passed', () => {
|
|
8
|
+
// custom aria label generation function because of bug with default aria label generation
|
|
9
|
+
// can be removed once the bug is fixed
|
|
10
|
+
const formatAria = (date: Date) =>
|
|
11
|
+
`${date.getDate()} ${date.toLocaleDateString(undefined, { month: 'long' })} ${date.getFullYear()}`;
|
|
12
|
+
|
|
13
|
+
render(<CalendarMonth cellAriaLabel={formatAria} weekStart={1} date={new Date(2023, 0)} />);
|
|
14
|
+
|
|
15
|
+
const firstDate = screen.getByRole('button', { name: '1 January 2023' });
|
|
16
|
+
expect(firstDate).toBeVisible();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('Renders the last date in a month when a custom weekStart is passed', () => {
|
|
20
|
+
// custom aria label generation function because of bug with default aria labels
|
|
21
|
+
// can be removed once the bug is fixed
|
|
22
|
+
const formatAria = (date: Date) =>
|
|
23
|
+
`${date.getDate()} ${date.toLocaleDateString(undefined, { month: 'long' })} ${date.getFullYear()}`;
|
|
24
|
+
|
|
25
|
+
render(<CalendarMonth cellAriaLabel={formatAria} weekStart={1} date={new Date(2023, 0)} />);
|
|
26
|
+
|
|
27
|
+
const lastDate = screen.getByRole('button', { name: '31 January 2023' });
|
|
28
|
+
expect(lastDate).toBeVisible();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('Previous month dates have correct month in aria label', () => {
|
|
32
|
+
render(<CalendarMonth date={new Date(2024, 5)} />);
|
|
33
|
+
|
|
34
|
+
const previousMonthDate = screen.getByRole('button', { name: '31 May 2024' });
|
|
35
|
+
expect(previousMonthDate).toBeVisible();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('Next month dates have correct month in aria label', () => {
|
|
39
|
+
render(<CalendarMonth date={new Date(2024, 6)} />);
|
|
40
|
+
|
|
41
|
+
const nextMonthDate = screen.getByRole('button', { name: '1 August 2024' });
|
|
42
|
+
expect(nextMonthDate).toBeVisible();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('Previous year dates have correct year in aria label', () => {
|
|
46
|
+
render(<CalendarMonth date={new Date(2024, 0)} />);
|
|
47
|
+
|
|
48
|
+
const previousYearDate = screen.getByRole('button', { name: '31 December 2023' });
|
|
49
|
+
expect(previousYearDate).toBeVisible();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('Next year dates have correct year in aria label', () => {
|
|
53
|
+
render(<CalendarMonth date={new Date(2024, 11)} />);
|
|
54
|
+
|
|
55
|
+
const nextYearDate = screen.getByRole('button', { name: '1 January 2025' });
|
|
56
|
+
expect(nextYearDate).toBeVisible();
|
|
57
|
+
});
|
|
@@ -12,7 +12,6 @@ import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-
|
|
|
12
12
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
13
13
|
import imgBrand from '@patternfly/react-core/src/components/Brand/examples/pfLogo.svg';
|
|
14
14
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
15
|
-
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
16
15
|
|
|
17
16
|
## Demos
|
|
18
17
|
|
|
@@ -32,13 +31,10 @@ import {
|
|
|
32
31
|
BreadcrumbItem,
|
|
33
32
|
Button,
|
|
34
33
|
ButtonVariant,
|
|
35
|
-
Card,
|
|
36
|
-
CardBody,
|
|
37
|
-
Drawer,
|
|
38
|
-
DrawerContent,
|
|
39
|
-
DrawerContentBody,
|
|
40
34
|
Dropdown,
|
|
41
35
|
DropdownGroup,
|
|
36
|
+
DropdownPosition,
|
|
37
|
+
DropdownDirection,
|
|
42
38
|
DropdownToggle,
|
|
43
39
|
DropdownItem,
|
|
44
40
|
DropdownSeparator,
|
|
@@ -46,8 +42,7 @@ import {
|
|
|
46
42
|
EmptyStateBody,
|
|
47
43
|
EmptyStateIcon,
|
|
48
44
|
EmptyStatePrimary,
|
|
49
|
-
|
|
50
|
-
GalleryItem,
|
|
45
|
+
EmptyStateVariant,
|
|
51
46
|
KebabToggle,
|
|
52
47
|
Nav,
|
|
53
48
|
NavItem,
|
|
@@ -79,7 +74,6 @@ import {
|
|
|
79
74
|
ToolbarGroup,
|
|
80
75
|
ToolbarContent
|
|
81
76
|
} from '@patternfly/react-core';
|
|
82
|
-
import { css } from '@patternfly/react-styles';
|
|
83
77
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
84
78
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
85
79
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
@@ -87,7 +81,7 @@ import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-
|
|
|
87
81
|
import BarsIcon from '@patternfly/react-icons/dist/js/icons/bars-icon';
|
|
88
82
|
import imgBrand from '@patternfly/react-core/src/components/Brand/examples/pfLogo.svg';
|
|
89
83
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
90
|
-
import
|
|
84
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
91
85
|
|
|
92
86
|
class BasicNotificationDrawer extends React.Component {
|
|
93
87
|
constructor(props) {
|
|
@@ -548,13 +542,10 @@ import {
|
|
|
548
542
|
BreadcrumbItem,
|
|
549
543
|
Button,
|
|
550
544
|
ButtonVariant,
|
|
551
|
-
Card,
|
|
552
|
-
CardBody,
|
|
553
|
-
Drawer,
|
|
554
|
-
DrawerContent,
|
|
555
|
-
DrawerContentBody,
|
|
556
545
|
Dropdown,
|
|
557
546
|
DropdownGroup,
|
|
547
|
+
DropdownPosition,
|
|
548
|
+
DropdownDirection,
|
|
558
549
|
DropdownToggle,
|
|
559
550
|
DropdownItem,
|
|
560
551
|
DropdownSeparator,
|
|
@@ -562,8 +553,7 @@ import {
|
|
|
562
553
|
EmptyStateBody,
|
|
563
554
|
EmptyStateIcon,
|
|
564
555
|
EmptyStatePrimary,
|
|
565
|
-
|
|
566
|
-
GalleryItem,
|
|
556
|
+
EmptyStateVariant,
|
|
567
557
|
KebabToggle,
|
|
568
558
|
Nav,
|
|
569
559
|
NavItem,
|
|
@@ -597,16 +587,14 @@ import {
|
|
|
597
587
|
ToolbarGroup,
|
|
598
588
|
ToolbarContent
|
|
599
589
|
} from '@patternfly/react-core';
|
|
600
|
-
import { css } from '@patternfly/react-styles';
|
|
601
590
|
import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
|
602
591
|
import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
|
|
603
|
-
import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
|
604
592
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
605
593
|
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
594
|
+
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
606
595
|
import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
|
|
607
596
|
import imgBrand from '@patternfly/react-core/src/components/Brand/examples/pfLogo.svg';
|
|
608
597
|
import imgAvatar from '@patternfly/react-core/src/components/Avatar/examples/avatarImg.svg';
|
|
609
|
-
import { Table, TableHeader, TableBody } from '@patternfly/react-table';
|
|
610
598
|
|
|
611
599
|
class GroupedNotificationDrawer extends React.Component {
|
|
612
600
|
constructor(props) {
|