@patternfly/react-core 4.267.3 → 4.267.5
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 +16 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +14 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +10 -2
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +14 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +10 -2
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/CalendarMonth/CalendarMonth.tsx +26 -1
- package/src/components/CalendarMonth/__tests__/CalendarMonth.test.tsx +9 -0
- package/src/components/CalendarMonth/examples/CalendarMonth.md +1 -1
- package/src/components/CalendarMonth/examples/CalendarMonthDateRange.tsx +19 -2
- package/src/components/CalendarMonth/examples/CalendarMonthSelectableDate.tsx +14 -4
- package/src/components/Wizard/examples/Wizard.md +14 -691
- package/src/components/Wizard/examples/WizardAnchorsForNavItems.tsx +42 -0
- package/src/components/Wizard/examples/WizardBasic.tsx +14 -0
- package/src/components/Wizard/examples/WizardBasicWithDisabledSteps.tsx +14 -0
- package/src/components/Wizard/examples/WizardEnabledOnFormValidation.tsx +139 -0
- package/src/components/Wizard/examples/WizardExpandableSteps.tsx +34 -0
- package/src/components/Wizard/examples/WizardFinished.tsx +90 -0
- package/src/components/Wizard/examples/WizardGetCurrentStep.tsx +33 -0
- package/src/components/Wizard/examples/WizardInModal.tsx +32 -0
- package/src/components/Wizard/examples/WizardIncrementallyEnabledSteps.tsx +61 -0
- package/src/components/Wizard/examples/WizardValidateOnButtonPress.tsx +204 -0
- package/src/components/Wizard/examples/WizardWithDrawer.tsx +126 -0
- package/src/components/Wizard/examples/FinishedStep.js +0 -70
- package/src/components/Wizard/examples/SampleForm.js +0 -59
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.267.
|
|
3
|
+
"version": "4.267.5",
|
|
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",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"react": "^16.8 || ^17 || ^18",
|
|
78
78
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "caf893d71966a0eabcde909a29d9a872367d9897"
|
|
81
81
|
}
|
|
@@ -20,6 +20,15 @@ export enum Weekday {
|
|
|
20
20
|
Saturday
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export interface CalendarMonthInlineProps {
|
|
24
|
+
/** Component wrapping the calendar month when used inline. Recommended to be 'article'. */
|
|
25
|
+
component?: keyof JSX.IntrinsicElements;
|
|
26
|
+
/** Title of the calendar rendered above the inline calendar month. Recommended to be a 'title' component. */
|
|
27
|
+
title?: React.ReactNode;
|
|
28
|
+
/** Id of the accessible label of the calendar month. Recommended to map to the title. */
|
|
29
|
+
ariaLabelledby?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
/** Additional properties that extend from and can be passed to the main component. These
|
|
24
33
|
* properties allow customizing the calendar formatting and aria-labels.
|
|
25
34
|
*/
|
|
@@ -49,6 +58,8 @@ export interface CalendarFormat {
|
|
|
49
58
|
weekStart?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | Weekday;
|
|
50
59
|
/** Accessible label for the year input. */
|
|
51
60
|
yearInputAriaLabel?: string;
|
|
61
|
+
/** Props used to ensure accessibility when displaying the calendar month inline. */
|
|
62
|
+
inlineProps?: CalendarMonthInlineProps;
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
export interface CalendarProps extends CalendarFormat, Omit<React.HTMLProps<HTMLDivElement>, 'onChange'> {
|
|
@@ -133,6 +144,7 @@ export const CalendarMonth = ({
|
|
|
133
144
|
yearInputAriaLabel = 'Select year',
|
|
134
145
|
cellAriaLabel,
|
|
135
146
|
isDateFocused = false,
|
|
147
|
+
inlineProps,
|
|
136
148
|
...props
|
|
137
149
|
}: CalendarProps) => {
|
|
138
150
|
const longMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(monthNum => new Date(1990, monthNum)).map(monthFormat);
|
|
@@ -232,7 +244,8 @@ export const CalendarMonth = ({
|
|
|
232
244
|
const isHoveredDateValid = isValidated(hoveredDate);
|
|
233
245
|
const monthFormatted = monthFormat(focusedDate);
|
|
234
246
|
const yearFormatted = yearFormat(focusedDate);
|
|
235
|
-
|
|
247
|
+
|
|
248
|
+
const calendarToRender = (
|
|
236
249
|
<div className={css(styles.calendarMonth, className)} {...props}>
|
|
237
250
|
<div className={styles.calendarMonthHeader}>
|
|
238
251
|
<div className={css(styles.calendarMonthHeaderNavControl, styles.modifiers.prevMonth)}>
|
|
@@ -386,4 +399,16 @@ export const CalendarMonth = ({
|
|
|
386
399
|
</table>
|
|
387
400
|
</div>
|
|
388
401
|
);
|
|
402
|
+
|
|
403
|
+
if (inlineProps !== undefined) {
|
|
404
|
+
const Component = (inlineProps.component ? inlineProps.component : 'article') as any;
|
|
405
|
+
return (
|
|
406
|
+
<Component {...(inlineProps.ariaLabelledby && { 'aria-labelledby': inlineProps.ariaLabelledby })}>
|
|
407
|
+
{inlineProps.title}
|
|
408
|
+
{calendarToRender}
|
|
409
|
+
</Component>
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
return calendarToRender;
|
|
389
413
|
};
|
|
414
|
+
CalendarMonth.displayName = 'CalendarMonth';
|
|
@@ -55,3 +55,12 @@ test('Next year dates have correct year in aria label', () => {
|
|
|
55
55
|
const nextYearDate = screen.getByRole('button', { name: '1 January 2025' });
|
|
56
56
|
expect(nextYearDate).toBeVisible();
|
|
57
57
|
});
|
|
58
|
+
|
|
59
|
+
test('InlineProps render correct wrapper component and attributes', () => {
|
|
60
|
+
render(<CalendarMonth inlineProps={{component: 'article', title: <div id="hi">Title</div>, ariaLabelledby: "hi"}} />);
|
|
61
|
+
|
|
62
|
+
const article = screen.getByRole('article');
|
|
63
|
+
expect(article).toHaveAttribute('aria-labelledby', 'hi');
|
|
64
|
+
const title = screen.getByText('Title');
|
|
65
|
+
expect(title).toBeVisible();
|
|
66
|
+
});
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CalendarMonth } from '@patternfly/react-core';
|
|
2
|
+
import { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const CalendarMonthDateRange: React.FunctionComponent = () => {
|
|
5
5
|
const startDate = new Date(2020, 10, 11);
|
|
6
6
|
const endDate = new Date(2020, 10, 24);
|
|
7
7
|
const disablePreStartDates = (date: Date) => date >= startDate;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const inlineProps: CalendarMonthInlineProps = {
|
|
10
|
+
component: 'article',
|
|
11
|
+
title: (
|
|
12
|
+
<Title id="display-range" headingLevel="h4">
|
|
13
|
+
Calendar month displaying a range
|
|
14
|
+
</Title>
|
|
15
|
+
),
|
|
16
|
+
ariaLabelledby: 'display-range'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<CalendarMonth
|
|
21
|
+
validators={[disablePreStartDates]}
|
|
22
|
+
date={endDate}
|
|
23
|
+
rangeStart={startDate}
|
|
24
|
+
inlineProps={inlineProps}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
10
27
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CalendarMonth } from '@patternfly/react-core';
|
|
2
|
+
import { CalendarMonth, Title, CalendarMonthInlineProps } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const CalendarMonthSelectableDate: React.FunctionComponent = () => {
|
|
5
5
|
const [date, setDate] = React.useState(new Date(2020, 10, 24));
|
|
@@ -9,10 +9,20 @@ export const CalendarMonthSelectableDate: React.FunctionComponent = () => {
|
|
|
9
9
|
console.log(`updated month: ${newDate.getMonth()}, updated year: ${newDate.getFullYear()}`);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
const inlineProps: CalendarMonthInlineProps = {
|
|
13
|
+
component: 'article',
|
|
14
|
+
title: (
|
|
15
|
+
<Title headingLevel="h4" id="favorite-date">
|
|
16
|
+
Select your favorite date
|
|
17
|
+
</Title>
|
|
18
|
+
),
|
|
19
|
+
ariaLabelledby: 'favorite-date'
|
|
20
|
+
};
|
|
21
|
+
|
|
12
22
|
return (
|
|
13
|
-
|
|
23
|
+
<>
|
|
24
|
+
<CalendarMonth date={date} onChange={setDate} onMonthChange={onMonthChange} inlineProps={inlineProps} />
|
|
14
25
|
<pre>Selected date: {date.toString()}</pre>
|
|
15
|
-
|
|
16
|
-
</React.Fragment>
|
|
26
|
+
</>
|
|
17
27
|
);
|
|
18
28
|
};
|