@patternfly/react-core 4.226.0 → 4.227.0
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 +27 -0
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts +3 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/esm/components/CalendarMonth/CalendarMonth.js +9 -6
- package/dist/esm/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.js +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/esm/components/Wizard/Wizard.d.ts +4 -0
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/esm/components/Wizard/Wizard.js +28 -13
- package/dist/esm/components/Wizard/Wizard.js.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts +3 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.d.ts.map +1 -1
- package/dist/js/components/CalendarMonth/CalendarMonth.js +9 -6
- package/dist/js/components/CalendarMonth/CalendarMonth.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.js +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/js/components/Wizard/Wizard.d.ts +4 -0
- package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
- package/dist/js/components/Wizard/Wizard.js +28 -13
- package/dist/js/components/Wizard/Wizard.js.map +1 -1
- package/dist/umd/react-core.css +164 -163
- package/dist/umd/react-core.js +38 -20
- package/dist/umd/react-core.min.css +4 -3
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/CalendarMonth/CalendarMonth.tsx +22 -5
- package/src/components/CalendarMonth/examples/CalendarMonth.md +0 -5
- package/src/components/CalendarMonth/examples/CalendarMonthSelectableDate.tsx +6 -1
- package/src/components/Dropdown/DropdownToggle.tsx +1 -0
- package/src/components/Dropdown/__tests__/DropdownToggle.test.tsx +18 -0
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +1 -1
- package/src/components/Dropdown/examples/Dropdown.md +5 -0
- package/src/components/Dropdown/examples/DropdownSplitButtonActionSecondary.tsx +107 -0
- package/src/components/Pagination/examples/Pagination.md +14 -14
- package/src/components/Toolbar/examples/Toolbar.md +2 -2
- package/src/components/Truncate/__tests__/Truncate.test.tsx +143 -4
- package/src/components/Truncate/__tests__/__snapshots__/Truncate.test.tsx.snap +34 -29
- package/src/components/Wizard/Wizard.tsx +34 -12
- package/src/components/Wizard/__tests__/Wizard.test.tsx +59 -0
- package/src/components/Wizard/examples/Wizard.md +9 -19
- package/src/components/CalendarMonth/examples/CalendarMonthDefault.tsx +0 -4
package/dist/umd/react-core.js
CHANGED
|
@@ -5921,7 +5921,7 @@
|
|
|
5921
5921
|
ToggleIndicator && (React__namespace.createElement("span", { className: css(!splitButtonItems && toggleIndicatorClass) },
|
|
5922
5922
|
React__namespace.createElement(ToggleIndicator, null)))))));
|
|
5923
5923
|
if (splitButtonItems) {
|
|
5924
|
-
return (React__namespace.createElement("div", { className: css(styles$15.dropdownToggle, styles$15.modifiers.splitButton, splitButtonVariant === 'action' && styles$15.modifiers.action, (toggleVariant === 'primary' || isPrimary) && splitButtonVariant === 'action' && styles$15.modifiers.primary, isDisabled && styles$15.modifiers.disabled) },
|
|
5924
|
+
return (React__namespace.createElement("div", { className: css(styles$15.dropdownToggle, styles$15.modifiers.splitButton, splitButtonVariant === 'action' && styles$15.modifiers.action, (toggleVariant === 'primary' || isPrimary) && splitButtonVariant === 'action' && styles$15.modifiers.primary, toggleVariant === 'secondary' && splitButtonVariant === 'action' && styles$15.modifiers.secondary, isDisabled && styles$15.modifiers.disabled) },
|
|
5925
5925
|
splitButtonItems,
|
|
5926
5926
|
toggle));
|
|
5927
5927
|
}
|
|
@@ -8614,7 +8614,7 @@
|
|
|
8614
8614
|
const today = new Date();
|
|
8615
8615
|
const CalendarMonth = (_a) => {
|
|
8616
8616
|
var { date: dateProp, locale = undefined, monthFormat = date => date.toLocaleDateString(locale, { month: 'long' }), weekdayFormat = date => date.toLocaleDateString(locale, { weekday: 'narrow' }), longWeekdayFormat = date => date.toLocaleDateString(locale, { weekday: 'long' }), dayFormat = date => date.getDate(), weekStart = 0, // Use the American Sunday as a default
|
|
8617
|
-
onChange = () => { }, validators = [() => true], className, onSelectToggle = () => { }, rangeStart, prevMonthAriaLabel = 'Previous month', nextMonthAriaLabel = 'Next month', yearInputAriaLabel = 'Select year', cellAriaLabel, isDateFocused = false } = _a, props = __rest$1(_a, ["date", "locale", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "onChange", "validators", "className", "onSelectToggle", "rangeStart", "prevMonthAriaLabel", "nextMonthAriaLabel", "yearInputAriaLabel", "cellAriaLabel", "isDateFocused"]);
|
|
8617
|
+
onChange = () => { }, validators = [() => true], className, onSelectToggle = () => { }, onMonthChange = () => { }, rangeStart, prevMonthAriaLabel = 'Previous month', nextMonthAriaLabel = 'Next month', yearInputAriaLabel = 'Select year', cellAriaLabel, isDateFocused = false } = _a, props = __rest$1(_a, ["date", "locale", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "onChange", "validators", "className", "onSelectToggle", "onMonthChange", "rangeStart", "prevMonthAriaLabel", "nextMonthAriaLabel", "yearInputAriaLabel", "cellAriaLabel", "isDateFocused"]);
|
|
8618
8618
|
const longMonths = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(monthNum => new Date(1990, monthNum)).map(monthFormat);
|
|
8619
8619
|
const [isSelectOpen, setIsSelectOpen] = React__default["default"].useState(false);
|
|
8620
8620
|
// eslint-disable-next-line prefer-const
|
|
@@ -8656,10 +8656,11 @@
|
|
|
8656
8656
|
setShouldFocus(true);
|
|
8657
8657
|
}
|
|
8658
8658
|
}, [focusedDate, isDateFocused, focusedDateValidated, focusRef]);
|
|
8659
|
-
const onMonthClick = (newDate) => {
|
|
8659
|
+
const onMonthClick = (newDate, ev) => {
|
|
8660
8660
|
setFocusedDate(newDate);
|
|
8661
8661
|
setHoveredDate(newDate);
|
|
8662
8662
|
setShouldFocus(false);
|
|
8663
|
+
onMonthChange(newDate, ev);
|
|
8663
8664
|
};
|
|
8664
8665
|
const onKeyDown = (ev) => {
|
|
8665
8666
|
const newDate = new Date(focusedDate);
|
|
@@ -8715,7 +8716,7 @@
|
|
|
8715
8716
|
return (React__default["default"].createElement("div", Object.assign({ className: css(styles$T.calendarMonth, className) }, props),
|
|
8716
8717
|
React__default["default"].createElement("div", { className: styles$T.calendarMonthHeader },
|
|
8717
8718
|
React__default["default"].createElement("div", { className: css(styles$T.calendarMonthHeaderNavControl, styles$T.modifiers.prevMonth) },
|
|
8718
|
-
React__default["default"].createElement(Button, { variant: "plain", "aria-label": prevMonthAriaLabel, onClick: () => onMonthClick(prevMonth) },
|
|
8719
|
+
React__default["default"].createElement(Button, { variant: "plain", "aria-label": prevMonthAriaLabel, onClick: (ev) => onMonthClick(prevMonth, ev) },
|
|
8719
8720
|
React__default["default"].createElement(AngleLeftIcon$1, { "aria-hidden": true }))),
|
|
8720
8721
|
React__default["default"].createElement(InputGroup, null,
|
|
8721
8722
|
React__default["default"].createElement("div", { className: styles$T.calendarMonthHeaderMonth },
|
|
@@ -8727,7 +8728,7 @@
|
|
|
8727
8728
|
width: "140px", "aria-labelledby": hiddenMonthId, isOpen: isSelectOpen, onToggle: () => {
|
|
8728
8729
|
setIsSelectOpen(!isSelectOpen);
|
|
8729
8730
|
onSelectToggle(!isSelectOpen);
|
|
8730
|
-
}, onSelect: (
|
|
8731
|
+
}, onSelect: (ev, monthNum) => {
|
|
8731
8732
|
// When we put CalendarMonth in a Popover we want the Popover's onDocumentClick
|
|
8732
8733
|
// to see the SelectOption as a child so it doesn't close the Popover.
|
|
8733
8734
|
setTimeout(() => {
|
|
@@ -8738,18 +8739,20 @@
|
|
|
8738
8739
|
setFocusedDate(newDate);
|
|
8739
8740
|
setHoveredDate(newDate);
|
|
8740
8741
|
setShouldFocus(false);
|
|
8742
|
+
onMonthChange(newDate, ev);
|
|
8741
8743
|
}, 0);
|
|
8742
8744
|
}, variant: "single", selections: monthFormatted }, longMonths.map((longMonth, index) => (React__default["default"].createElement(SelectOption, { key: index, value: index, isSelected: longMonth === monthFormatted }, longMonth))))),
|
|
8743
8745
|
React__default["default"].createElement("div", { className: styles$T.calendarMonthHeaderYear },
|
|
8744
|
-
React__default["default"].createElement(TextInput, { "aria-label": yearInputAriaLabel, type: "number", value: yearFormatted, onChange: year => {
|
|
8746
|
+
React__default["default"].createElement(TextInput, { "aria-label": yearInputAriaLabel, type: "number", value: yearFormatted, onChange: (year, ev) => {
|
|
8745
8747
|
const newDate = new Date(focusedDate);
|
|
8746
8748
|
newDate.setFullYear(+year);
|
|
8747
8749
|
setFocusedDate(newDate);
|
|
8748
8750
|
setHoveredDate(newDate);
|
|
8749
8751
|
setShouldFocus(false);
|
|
8752
|
+
onMonthChange(newDate, ev);
|
|
8750
8753
|
} }))),
|
|
8751
8754
|
React__default["default"].createElement("div", { className: css(styles$T.calendarMonthHeaderNavControl, styles$T.modifiers.nextMonth) },
|
|
8752
|
-
React__default["default"].createElement(Button, { variant: "plain", "aria-label": nextMonthAriaLabel, onClick: () => onMonthClick(nextMonth) },
|
|
8755
|
+
React__default["default"].createElement(Button, { variant: "plain", "aria-label": nextMonthAriaLabel, onClick: (ev) => onMonthClick(nextMonth, ev) },
|
|
8753
8756
|
React__default["default"].createElement(AngleRightIcon$1, { "aria-hidden": true })))),
|
|
8754
8757
|
React__default["default"].createElement("table", { className: styles$T.calendarMonthCalendar },
|
|
8755
8758
|
React__default["default"].createElement("thead", { className: styles$T.calendarMonthDays },
|
|
@@ -21032,9 +21035,7 @@
|
|
|
21032
21035
|
break;
|
|
21033
21036
|
}
|
|
21034
21037
|
}
|
|
21035
|
-
this.
|
|
21036
|
-
currentStep: newStep
|
|
21037
|
-
});
|
|
21038
|
+
this.setCurrentStep(newStep, flattenedSteps[newStep - 1]);
|
|
21038
21039
|
const { id: prevId, name: prevName } = flattenedSteps[currentStep - 1];
|
|
21039
21040
|
const { id, name } = flattenedSteps[newStep - 1];
|
|
21040
21041
|
return onNext && onNext({ id, name }, { prevId, prevName });
|
|
@@ -21047,9 +21048,7 @@
|
|
|
21047
21048
|
if (flattenedSteps.length < currentStep) {
|
|
21048
21049
|
// Previous step was removed, just update the currentStep state
|
|
21049
21050
|
const adjustedStep = flattenedSteps.length;
|
|
21050
|
-
this.
|
|
21051
|
-
currentStep: adjustedStep
|
|
21052
|
-
});
|
|
21051
|
+
this.setCurrentStep(adjustedStep, flattenedSteps[adjustedStep - 1]);
|
|
21053
21052
|
}
|
|
21054
21053
|
else {
|
|
21055
21054
|
let newStep = currentStep;
|
|
@@ -21062,9 +21061,7 @@
|
|
|
21062
21061
|
break;
|
|
21063
21062
|
}
|
|
21064
21063
|
}
|
|
21065
|
-
this.
|
|
21066
|
-
currentStep: newStep
|
|
21067
|
-
});
|
|
21064
|
+
this.setCurrentStep(newStep, flattenedSteps[newStep - 1]);
|
|
21068
21065
|
const { id: prevId, name: prevName } = flattenedSteps[newStep];
|
|
21069
21066
|
const { id, name } = flattenedSteps[newStep - 1];
|
|
21070
21067
|
return onBack && onBack({ id, name }, { prevId, prevName });
|
|
@@ -21084,7 +21081,8 @@
|
|
|
21084
21081
|
else if (step > maxSteps) {
|
|
21085
21082
|
step = maxSteps;
|
|
21086
21083
|
}
|
|
21087
|
-
this.
|
|
21084
|
+
this.setCurrentStep(step, flattenedSteps[step - 1]);
|
|
21085
|
+
this.setState({ isNavOpen: false });
|
|
21088
21086
|
const { id: prevId, name: prevName } = flattenedSteps[currentStep - 1];
|
|
21089
21087
|
const { id, name } = flattenedSteps[step - 1];
|
|
21090
21088
|
return onGoToStep && onGoToStep({ id, name }, { prevId, prevName });
|
|
@@ -21099,7 +21097,7 @@
|
|
|
21099
21097
|
}
|
|
21100
21098
|
}
|
|
21101
21099
|
if (step) {
|
|
21102
|
-
this.
|
|
21100
|
+
this.setCurrentStep(step, flattenedSteps[step - 1]);
|
|
21103
21101
|
}
|
|
21104
21102
|
};
|
|
21105
21103
|
this.goToStepByName = (stepName) => {
|
|
@@ -21112,7 +21110,7 @@
|
|
|
21112
21110
|
}
|
|
21113
21111
|
}
|
|
21114
21112
|
if (step) {
|
|
21115
|
-
this.
|
|
21113
|
+
this.setCurrentStep(step, flattenedSteps[step - 1]);
|
|
21116
21114
|
}
|
|
21117
21115
|
};
|
|
21118
21116
|
this.getFlattenedSteps = () => {
|
|
@@ -21163,8 +21161,23 @@
|
|
|
21163
21161
|
currentStep: this.props.startAtStep && Number.isInteger(this.props.startAtStep) ? this.props.startAtStep : 1,
|
|
21164
21162
|
isNavOpen: false
|
|
21165
21163
|
};
|
|
21164
|
+
if (props.onCurrentStepChanged) {
|
|
21165
|
+
const flattenedSteps = this.getFlattenedSteps();
|
|
21166
|
+
if (flattenedSteps.length >= this.state.currentStep) {
|
|
21167
|
+
const currentStep = flattenedSteps[this.state.currentStep - 1];
|
|
21168
|
+
props.onCurrentStepChanged(currentStep);
|
|
21169
|
+
}
|
|
21170
|
+
}
|
|
21166
21171
|
this.drawerRef = React__namespace.createRef();
|
|
21167
21172
|
}
|
|
21173
|
+
setCurrentStep(currentStep, currentStepObject) {
|
|
21174
|
+
this.setState({
|
|
21175
|
+
currentStep
|
|
21176
|
+
});
|
|
21177
|
+
if (this.props.onCurrentStepChanged) {
|
|
21178
|
+
this.props.onCurrentStepChanged(currentStepObject);
|
|
21179
|
+
}
|
|
21180
|
+
}
|
|
21168
21181
|
componentDidMount() {
|
|
21169
21182
|
const target = typeof document !== 'undefined' ? document.body : null;
|
|
21170
21183
|
if (target) {
|
|
@@ -21177,10 +21190,15 @@
|
|
|
21177
21190
|
target.removeEventListener('keydown', this.handleKeyClicks, false);
|
|
21178
21191
|
}
|
|
21179
21192
|
}
|
|
21193
|
+
componentDidUpdate(prevProps) {
|
|
21194
|
+
if (prevProps.startAtStep !== this.props.startAtStep) {
|
|
21195
|
+
this.setState({ currentStep: this.props.startAtStep });
|
|
21196
|
+
}
|
|
21197
|
+
}
|
|
21180
21198
|
render() {
|
|
21181
21199
|
const _a = this.props, {
|
|
21182
21200
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
21183
|
-
width, height, title, description, descriptionComponent, onClose, onSave, onBack, onNext, onGoToStep, className, steps, startAtStep, nextButtonText = 'Next', backButtonText = 'Back', cancelButtonText = 'Cancel', hideClose, closeButtonAriaLabel = 'Close', navAriaLabel, navAriaLabelledBy, mainAriaLabel, mainAriaLabelledBy, hasNoBodyPadding, footer, appendTo, isOpen, titleId, descriptionId, isNavExpandable, hasDrawer, isDrawerExpanded } = _a, rest = __rest$1(_a, ["width", "height", "title", "description", "descriptionComponent", "onClose", "onSave", "onBack", "onNext", "onGoToStep", "className", "steps", "startAtStep", "nextButtonText", "backButtonText", "cancelButtonText", "hideClose", "closeButtonAriaLabel", "navAriaLabel", "navAriaLabelledBy", "mainAriaLabel", "mainAriaLabelledBy", "hasNoBodyPadding", "footer", "appendTo", "isOpen", "titleId", "descriptionId", "isNavExpandable", "hasDrawer", "isDrawerExpanded"])
|
|
21201
|
+
width, height, title, description, descriptionComponent, onClose, onSave, onBack, onNext, onGoToStep, className, steps, startAtStep, nextButtonText = 'Next', backButtonText = 'Back', cancelButtonText = 'Cancel', hideClose, closeButtonAriaLabel = 'Close', navAriaLabel, navAriaLabelledBy, mainAriaLabel, mainAriaLabelledBy, hasNoBodyPadding, footer, appendTo, isOpen, titleId, descriptionId, isNavExpandable, onCurrentStepChanged, hasDrawer, isDrawerExpanded } = _a, rest = __rest$1(_a, ["width", "height", "title", "description", "descriptionComponent", "onClose", "onSave", "onBack", "onNext", "onGoToStep", "className", "steps", "startAtStep", "nextButtonText", "backButtonText", "cancelButtonText", "hideClose", "closeButtonAriaLabel", "navAriaLabel", "navAriaLabelledBy", "mainAriaLabel", "mainAriaLabelledBy", "hasNoBodyPadding", "footer", "appendTo", "isOpen", "titleId", "descriptionId", "isNavExpandable", "onCurrentStepChanged", "hasDrawer", "isDrawerExpanded"])
|
|
21184
21202
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
21185
21203
|
;
|
|
21186
21204
|
const { currentStep } = this.state;
|
|
@@ -781,6 +781,7 @@
|
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
.pf-c-form-control {
|
|
784
|
+
--pf-c-form-control--Color: var(--pf-global--Color--100);
|
|
784
785
|
--pf-c-form-control--FontSize: var(--pf-global--FontSize--md);
|
|
785
786
|
--pf-c-form-control--LineHeight: var(--pf-global--LineHeight--md);
|
|
786
787
|
--pf-c-form-control--BorderWidth: var(--pf-global--BorderWidth--sm);
|
|
@@ -903,7 +904,7 @@
|
|
|
903
904
|
--pf-c-form-control--m-icon-sprite__select--success--BackgroundPosition: calc(100% - var(--pf-global--spacer--md) + 1px - var(--pf-global--spacer--lg));
|
|
904
905
|
--pf-c-form-control--m-icon-sprite__select--m-warning--BackgroundPosition: calc(100% - var(--pf-global--spacer--md) - var(--pf-global--spacer--lg) + 0.0625rem);
|
|
905
906
|
--pf-c-form-control--m-icon-sprite__select--invalid--BackgroundPosition: calc(100% - var(--pf-global--spacer--md) - var(--pf-global--spacer--lg));
|
|
906
|
-
color: var(--pf-
|
|
907
|
+
color: var(--pf-c-form-control--Color);
|
|
907
908
|
width: var(--pf-c-form-control--Width);
|
|
908
909
|
padding: var(--pf-c-form-control--PaddingTop) var(--pf-c-form-control--PaddingRight) var(--pf-c-form-control--PaddingBottom) var(--pf-c-form-control--PaddingLeft);
|
|
909
910
|
font-size: var(--pf-c-form-control--FontSize);
|
|
@@ -957,8 +958,8 @@
|
|
|
957
958
|
}
|
|
958
959
|
|
|
959
960
|
.pf-c-form-control:disabled {
|
|
960
|
-
--pf-c-form-control--Color: var(--pf-c-form-control--disabled--Color);
|
|
961
961
|
--pf-c-form-control--BackgroundColor: var(--pf-c-form-control--disabled--BackgroundColor);
|
|
962
|
+
color: var(--pf-c-form-control--disabled--Color);
|
|
962
963
|
cursor: not-allowed;
|
|
963
964
|
border-color: var(--pf-c-form-control--disabled--BorderColor);
|
|
964
965
|
}
|
|
@@ -16718,7 +16719,7 @@ label.pf-c-menu__item:where(:not([disabled], .pf-m-disabled)) {
|
|
|
16718
16719
|
--pf-c-popover__arrow--m-left--Rotate: 45deg;
|
|
16719
16720
|
--pf-c-popover--c-button--MarginLeft: var(--pf-global--spacer--sm);
|
|
16720
16721
|
--pf-c-popover--c-button--Top: calc(var(--pf-c-popover__content--PaddingTop) - var(--pf-global--spacer--form-element));
|
|
16721
|
-
--pf-c-popover--c-button--Right: var(--pf-global--spacer--md);
|
|
16722
|
+
--pf-c-popover--c-button--Right: calc(var(--pf-c-popover__content--PaddingRight) - var(--pf-global--spacer--md));
|
|
16722
16723
|
--pf-c-popover--c-button--sibling--PaddingRight: var(--pf-global--spacer--2xl);
|
|
16723
16724
|
--pf-c-popover--c-title--MarginBottom: var(--pf-global--spacer--sm);
|
|
16724
16725
|
--pf-c-popover__title--MarginBottom: var(--pf-global--spacer--sm);
|