@patternfly/react-core 4.192.0 → 4.192.4
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 +38 -0
- package/dist/esm/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +7 -3
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -2
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts +2 -0
- package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectOption.js +70 -48
- package/dist/esm/components/Select/SelectOption.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +7 -3
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +2 -2
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectOption.d.ts +2 -0
- package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/js/components/Select/SelectOption.js +70 -48
- package/dist/js/components/Select/SelectOption.js.map +1 -1
- package/dist/umd/react-core.js +79 -53
- package/dist/umd/react-core.min.js +1 -1
- package/index.d.ts +4 -0
- package/package.json +5 -5
- package/src/components/BackToTop/examples/BackToTop.css +3 -3
- package/src/components/BackToTop/examples/BackToTop.md +1 -5
- package/src/components/BackToTop/examples/BackToTopBasic.tsx +4 -0
- package/src/components/Backdrop/examples/Backdrop.md +3 -12
- package/src/components/Backdrop/examples/BackdropBasic.tsx +4 -0
- package/src/components/Backdrop/examples/BackdropSpinner.tsx +10 -0
- package/src/components/BackgroundImage/examples/BackgroundImage.md +2 -21
- package/src/components/BackgroundImage/examples/BackgroundImageBasic.tsx +15 -0
- package/src/components/Badge/examples/Badge.md +3 -24
- package/src/components/Badge/examples/BadgeRead.tsx +19 -0
- package/src/components/Badge/examples/BadgeUnread.tsx +8 -0
- package/src/components/Banner/examples/Banner.md +1 -14
- package/src/components/Banner/examples/BannerBasic.tsx +16 -0
- package/src/components/Brand/examples/Brand.md +3 -5
- package/src/components/Brand/examples/BrandBasic.tsx +5 -0
- package/src/components/Breadcrumb/examples/Breadcrumb.md +4 -105
- package/src/components/Breadcrumb/examples/BreadcrumbBasic.tsx +13 -0
- package/src/components/Breadcrumb/examples/BreadcrumbDropdown.tsx +53 -0
- package/src/components/Breadcrumb/examples/BreadcrumbWithHeading.tsx +12 -0
- package/src/components/Breadcrumb/examples/BreadcrumbWithoutHomeLink.tsx +15 -0
- package/src/components/Button/examples/ButtonAriaDisabled.tsx +33 -37
- package/src/components/Button/examples/ButtonCallToAction.tsx +8 -6
- package/src/components/Button/examples/ButtonDisabled.tsx +33 -37
- package/src/components/Button/examples/ButtonInlineSpanLink.tsx +2 -2
- package/src/components/Button/examples/ButtonLinks.tsx +6 -6
- package/src/components/Button/examples/ButtonProgress.tsx +8 -5
- package/src/components/Button/examples/ButtonSmall.tsx +9 -7
- package/src/components/Button/examples/ButtonTypes.tsx +4 -6
- package/src/components/Button/examples/ButtonVariations.tsx +31 -36
- package/src/components/DatePicker/DatePicker.tsx +10 -2
- package/src/components/DatePicker/examples/DatePicker.md +4 -1
- package/src/components/Select/Select.tsx +2 -1
- package/src/components/Select/SelectOption.tsx +188 -133
- package/src/demos/Tabs/NestedTabsDemo.js +3 -3
- package/src/demos/Tabs.md +4 -0
- package/src/demos/examples/Tabs/GrayTabs.tsx +158 -0
package/dist/umd/react-core.js
CHANGED
|
@@ -6076,7 +6076,7 @@
|
|
|
6076
6076
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6077
6077
|
const _a = this.props, { children, className, id, description, itemCount, value, onClick, isDisabled, isPlaceholder, isNoResultsOption, isSelected, isChecked, isFocused, sendRef, keyHandler, index, component, inputId, isFavorite, ariaIsFavoriteLabel = 'starred', ariaIsNotFavoriteLabel = 'not starred', isLoad, isLoading, setViewMoreNextIndex,
|
|
6078
6078
|
// eslint-disable-next-line no-console
|
|
6079
|
-
isLastOptionBeforeFooter } = _a, props = __rest$1(_a, ["children", "className", "id", "description", "itemCount", "value", "onClick", "isDisabled", "isPlaceholder", "isNoResultsOption", "isSelected", "isChecked", "isFocused", "sendRef", "keyHandler", "index", "component", "inputId", "isFavorite", "ariaIsFavoriteLabel", "ariaIsNotFavoriteLabel", "isLoad", "isLoading", "setViewMoreNextIndex", "isLastOptionBeforeFooter"]);
|
|
6079
|
+
isLastOptionBeforeFooter, isGrouped = false } = _a, props = __rest$1(_a, ["children", "className", "id", "description", "itemCount", "value", "onClick", "isDisabled", "isPlaceholder", "isNoResultsOption", "isSelected", "isChecked", "isFocused", "sendRef", "keyHandler", "index", "component", "inputId", "isFavorite", "ariaIsFavoriteLabel", "ariaIsNotFavoriteLabel", "isLoad", "isLoading", "setViewMoreNextIndex", "isLastOptionBeforeFooter", "isGrouped"]);
|
|
6080
6080
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
6081
6081
|
const Component = component;
|
|
6082
6082
|
if (!id && isFavorite !== null) {
|
|
@@ -6099,56 +6099,78 @@
|
|
|
6099
6099
|
setViewMoreNextIndex();
|
|
6100
6100
|
onClick(event);
|
|
6101
6101
|
};
|
|
6102
|
-
|
|
6103
|
-
variant !== exports.SelectVariant.checkbox &&
|
|
6104
|
-
isLoading && children
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6102
|
+
const renderOption = (onSelect, onClose, variant, inputIdPrefix, onFavorite) => {
|
|
6103
|
+
if (variant !== exports.SelectVariant.checkbox && isLoading && isGrouped) {
|
|
6104
|
+
return (React__namespace.createElement("div", { role: "presentation", className: css(_default$13.selectListItem, isLoading && _default$13.modifiers.loading, className) }, children));
|
|
6105
|
+
}
|
|
6106
|
+
else if (variant !== exports.SelectVariant.checkbox && isLoad && isGrouped) {
|
|
6107
|
+
return (React__namespace.createElement("div", null,
|
|
6108
|
+
React__namespace.createElement("button", Object.assign({}, props, { role: "presentation", className: css(_default$13.selectMenuItem, _default$13.modifiers.load, className), onClick: (event) => {
|
|
6109
|
+
onViewMoreClick(event);
|
|
6110
|
+
event.stopPropagation();
|
|
6111
|
+
}, ref: this.ref, type: "button" }), children || value.toString())));
|
|
6112
|
+
}
|
|
6113
|
+
else if (variant !== exports.SelectVariant.checkbox) {
|
|
6114
|
+
return (React__namespace.createElement("li", { id: generatedId, role: "presentation", className: css(isLoading && _default$13.selectListItem, !isLoad && !isLoading && _default$13.selectMenuWrapper, isFavorite && _default$13.modifiers.favorite, isFocused && _default$13.modifiers.focus, isLoading && _default$13.modifiers.loading), ref: this.liRef },
|
|
6115
|
+
isLoading && children,
|
|
6116
|
+
isLoad && !isGrouped && (React__namespace.createElement("button", Object.assign({}, props, { className: css(_default$13.selectMenuItem, _default$13.modifiers.load, className), onClick: (event) => {
|
|
6117
|
+
onViewMoreClick(event);
|
|
6118
|
+
event.stopPropagation();
|
|
6119
|
+
}, ref: this.ref, type: "button" }), itemDisplay)),
|
|
6120
|
+
!isLoading && !isLoad && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
6121
|
+
React__namespace.createElement(Component, Object.assign({}, props, { className: css(_default$13.selectMenuItem, isLoad && _default$13.modifiers.load, isSelected && _default$13.modifiers.selected, isDisabled && _default$13.modifiers.disabled, description && _default$13.modifiers.description, isFavorite !== null && _default$13.modifiers.link, className), onClick: (event) => {
|
|
6122
|
+
if (!isDisabled) {
|
|
6123
|
+
onClick(event);
|
|
6124
|
+
onSelect(event, value, isPlaceholder);
|
|
6125
|
+
onClose();
|
|
6126
|
+
}
|
|
6127
|
+
}, role: "option", "aria-selected": isSelected || null, ref: this.ref, onKeyDown: (event) => {
|
|
6128
|
+
this.onKeyDown(event, 0);
|
|
6129
|
+
}, type: "button" }),
|
|
6130
|
+
description && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
6131
|
+
React__namespace.createElement("span", { className: css(_default$13.selectMenuItemMain) },
|
|
6132
|
+
itemDisplay,
|
|
6133
|
+
isSelected && (React__namespace.createElement("span", { className: css(_default$13.selectMenuItemIcon) },
|
|
6134
|
+
React__namespace.createElement(CheckIcon$1, { "aria-hidden": true })))),
|
|
6135
|
+
React__namespace.createElement("span", { className: css(_default$13.selectMenuItemDescription) }, description))),
|
|
6136
|
+
!description && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
6121
6137
|
itemDisplay,
|
|
6122
6138
|
isSelected && (React__namespace.createElement("span", { className: css(_default$13.selectMenuItemIcon) },
|
|
6123
|
-
React__namespace.createElement(CheckIcon$1, { "aria-hidden": true })))),
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
React__namespace.createElement(CheckIcon$1, { "aria-hidden": true })))))),
|
|
6129
|
-
isFavorite !== null && id && favoriteButton(onFavorite))))),
|
|
6130
|
-
variant === exports.SelectVariant.checkbox && isLoad && (React__namespace.createElement("button", { className: css(_default$13.selectMenuItem, _default$13.modifiers.load, isFocused && _default$13.modifiers.focus, className), onKeyDown: (event) => {
|
|
6131
|
-
this.onKeyDown(event, 0, undefined, true);
|
|
6132
|
-
}, onClick: (event) => {
|
|
6133
|
-
onViewMoreClick(event);
|
|
6134
|
-
event.stopPropagation();
|
|
6135
|
-
}, ref: this.ref }, children || (value && value.toString && value.toString()))),
|
|
6136
|
-
variant === exports.SelectVariant.checkbox && isLoading && (React__namespace.createElement("div", { className: css(_default$13.selectListItem, isLoading && _default$13.modifiers.loading, className) }, children)),
|
|
6137
|
-
variant === exports.SelectVariant.checkbox && !isNoResultsOption && !isLoading && !isLoad && (React__namespace.createElement("label", Object.assign({}, props, { className: css(_default$11.check, _default$13.selectMenuItem, isDisabled && _default$13.modifiers.disabled, description && _default$13.modifiers.description, className), onKeyDown: (event) => {
|
|
6138
|
-
this.onKeyDown(event, 0, undefined, true);
|
|
6139
|
-
} }),
|
|
6140
|
-
React__namespace.createElement("input", { id: inputId || `${inputIdPrefix}-${value.toString()}`, className: css(_default$11.checkInput), type: "checkbox", onChange: event => {
|
|
6141
|
-
if (!isDisabled) {
|
|
6142
|
-
onClick(event);
|
|
6143
|
-
onSelect(event, value);
|
|
6144
|
-
}
|
|
6145
|
-
}, ref: this.ref, checked: isChecked || false, disabled: isDisabled }),
|
|
6146
|
-
React__namespace.createElement("span", { className: css(_default$11.checkLabel, isDisabled && _default$13.modifiers.disabled) }, itemDisplay),
|
|
6147
|
-
description && React__namespace.createElement("div", { className: css(_default$11.checkDescription) }, description))),
|
|
6148
|
-
variant === exports.SelectVariant.checkbox && isNoResultsOption && !isLoading && !isLoad && (React__namespace.createElement("div", null,
|
|
6149
|
-
React__namespace.createElement(Component, Object.assign({}, props, { className: css(_default$13.selectMenuItem, isSelected && _default$13.modifiers.selected, isDisabled && _default$13.modifiers.disabled, className), role: "option", "aria-selected": isSelected || null, ref: this.ref, onKeyDown: (event) => {
|
|
6139
|
+
React__namespace.createElement(CheckIcon$1, { "aria-hidden": true })))))),
|
|
6140
|
+
isFavorite !== null && id && favoriteButton(onFavorite)))));
|
|
6141
|
+
}
|
|
6142
|
+
else if (variant === exports.SelectVariant.checkbox && isLoad) {
|
|
6143
|
+
return (React__namespace.createElement("button", { className: css(_default$13.selectMenuItem, _default$13.modifiers.load, isFocused && _default$13.modifiers.focus, className), onKeyDown: (event) => {
|
|
6150
6144
|
this.onKeyDown(event, 0, undefined, true);
|
|
6151
|
-
},
|
|
6145
|
+
}, onClick: (event) => {
|
|
6146
|
+
onViewMoreClick(event);
|
|
6147
|
+
event.stopPropagation();
|
|
6148
|
+
}, ref: this.ref }, children || (value && value.toString && value.toString())));
|
|
6149
|
+
}
|
|
6150
|
+
else if (variant === exports.SelectVariant.checkbox && isLoading) {
|
|
6151
|
+
return (React__namespace.createElement("div", { className: css(_default$13.selectListItem, isLoading && _default$13.modifiers.loading, className) }, children));
|
|
6152
|
+
}
|
|
6153
|
+
else if (variant === exports.SelectVariant.checkbox && !isNoResultsOption && !isLoading && !isLoad) {
|
|
6154
|
+
return (React__namespace.createElement("label", Object.assign({}, props, { className: css(_default$11.check, _default$13.selectMenuItem, isDisabled && _default$13.modifiers.disabled, description && _default$13.modifiers.description, className), onKeyDown: (event) => {
|
|
6155
|
+
this.onKeyDown(event, 0, undefined, true);
|
|
6156
|
+
} }),
|
|
6157
|
+
React__namespace.createElement("input", { id: inputId || `${inputIdPrefix}-${value.toString()}`, className: css(_default$11.checkInput), type: "checkbox", onChange: event => {
|
|
6158
|
+
if (!isDisabled) {
|
|
6159
|
+
onClick(event);
|
|
6160
|
+
onSelect(event, value);
|
|
6161
|
+
}
|
|
6162
|
+
}, ref: this.ref, checked: isChecked || false, disabled: isDisabled }),
|
|
6163
|
+
React__namespace.createElement("span", { className: css(_default$11.checkLabel, isDisabled && _default$13.modifiers.disabled) }, itemDisplay),
|
|
6164
|
+
description && React__namespace.createElement("div", { className: css(_default$11.checkDescription) }, description)));
|
|
6165
|
+
}
|
|
6166
|
+
else if (variant === exports.SelectVariant.checkbox && isNoResultsOption && !isLoading && !isLoad) {
|
|
6167
|
+
return (React__namespace.createElement("div", null,
|
|
6168
|
+
React__namespace.createElement(Component, Object.assign({}, props, { className: css(_default$13.selectMenuItem, isSelected && _default$13.modifiers.selected, isDisabled && _default$13.modifiers.disabled, className), role: "option", "aria-selected": isSelected || null, ref: this.ref, onKeyDown: (event) => {
|
|
6169
|
+
this.onKeyDown(event, 0, undefined, true);
|
|
6170
|
+
}, type: "button" }), itemDisplay)));
|
|
6171
|
+
}
|
|
6172
|
+
};
|
|
6173
|
+
return (React__namespace.createElement(SelectConsumer, null, ({ onSelect, onClose, variant, inputIdPrefix, onFavorite }) => (React__namespace.createElement(React__namespace.Fragment, null, renderOption(onSelect, onClose, variant, inputIdPrefix, onFavorite)))));
|
|
6152
6174
|
}
|
|
6153
6175
|
}
|
|
6154
6176
|
SelectOption.displayName = 'SelectOption';
|
|
@@ -7156,11 +7178,11 @@
|
|
|
7156
7178
|
if (isOpen) {
|
|
7157
7179
|
if (renderableItems.find(item => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.key) === 'loading'; }) === undefined) {
|
|
7158
7180
|
if (loadingVariant === 'spinner') {
|
|
7159
|
-
renderableItems.push(React__namespace.createElement(SelectOption, { isLoading: true, key: "loading", value: "loading" },
|
|
7181
|
+
renderableItems.push(React__namespace.createElement(SelectOption, { isLoading: true, key: "loading", value: "loading", isGrouped: true },
|
|
7160
7182
|
React__namespace.createElement(Spinner, { size: "lg" })));
|
|
7161
7183
|
}
|
|
7162
7184
|
else if (loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.text) {
|
|
7163
|
-
renderableItems.push(React__namespace.createElement(SelectOption, { isLoad: true, key: "loading", value: loadingVariant.text, setViewMoreNextIndex: this.setVieMoreNextIndex, onClick: loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.onClick }));
|
|
7185
|
+
renderableItems.push(React__namespace.createElement(SelectOption, { isLoad: true, key: "loading", value: loadingVariant.text, isGrouped: true, setViewMoreNextIndex: this.setVieMoreNextIndex, onClick: loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.onClick }));
|
|
7164
7186
|
}
|
|
7165
7187
|
}
|
|
7166
7188
|
}
|
|
@@ -9222,7 +9244,7 @@
|
|
|
9222
9244
|
.toString()
|
|
9223
9245
|
.padStart(2, '0')}`;
|
|
9224
9246
|
const DatePickerBase = (_a, ref) => {
|
|
9225
|
-
var { className, locale = undefined, dateFormat = yyyyMMddFormat, dateParse = (val) => val.split('-').length === 3 && new Date(`${val}T00:00:00`), isDisabled = false, placeholder = 'YYYY-MM-DD', value: valueProp = '', 'aria-label': ariaLabel = 'Date picker', buttonAriaLabel = 'Toggle date picker', onChange = () => undefined, invalidFormatText = 'Invalid date', helperText, appendTo, popoverProps, monthFormat, weekdayFormat, longWeekdayFormat, dayFormat, weekStart, validators = [], rangeStart, style: styleProps = {}, inputProps = {} } = _a, props = __rest$1(_a, ["className", "locale", "dateFormat", "dateParse", "isDisabled", "placeholder", "value", 'aria-label', "buttonAriaLabel", "onChange", "invalidFormatText", "helperText", "appendTo", "popoverProps", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "validators", "rangeStart", "style", "inputProps"]);
|
|
9247
|
+
var { className, locale = undefined, dateFormat = yyyyMMddFormat, dateParse = (val) => val.split('-').length === 3 && new Date(`${val}T00:00:00`), isDisabled = false, placeholder = 'YYYY-MM-DD', value: valueProp = '', 'aria-label': ariaLabel = 'Date picker', buttonAriaLabel = 'Toggle date picker', onChange = () => undefined, onBlur = () => undefined, invalidFormatText = 'Invalid date', helperText, appendTo, popoverProps, monthFormat, weekdayFormat, longWeekdayFormat, dayFormat, weekStart, validators = [], rangeStart, style: styleProps = {}, inputProps = {} } = _a, props = __rest$1(_a, ["className", "locale", "dateFormat", "dateParse", "isDisabled", "placeholder", "value", 'aria-label', "buttonAriaLabel", "onChange", "onBlur", "invalidFormatText", "helperText", "appendTo", "popoverProps", "monthFormat", "weekdayFormat", "longWeekdayFormat", "dayFormat", "weekStart", "validators", "rangeStart", "style", "inputProps"]);
|
|
9226
9248
|
const [value, setValue] = React__namespace.useState(valueProp);
|
|
9227
9249
|
const [valueDate, setValueDate] = React__namespace.useState(dateParse(value));
|
|
9228
9250
|
const [errorText, setErrorText] = React__namespace.useState('');
|
|
@@ -9236,9 +9258,11 @@
|
|
|
9236
9258
|
setValue(valueProp);
|
|
9237
9259
|
setValueDate(dateParse(valueProp));
|
|
9238
9260
|
}, [valueProp]);
|
|
9261
|
+
React__namespace.useEffect(() => {
|
|
9262
|
+
setPristine(!value);
|
|
9263
|
+
}, [value]);
|
|
9239
9264
|
const setError = (date) => setErrorText(validators.map(validator => validator(date)).join('\n') || '');
|
|
9240
9265
|
const onTextInput = (value) => {
|
|
9241
|
-
setPristine(false);
|
|
9242
9266
|
setValue(value);
|
|
9243
9267
|
setErrorText('');
|
|
9244
9268
|
const newValueDate = dateParse(value);
|
|
@@ -9256,9 +9280,11 @@
|
|
|
9256
9280
|
}
|
|
9257
9281
|
const newValueDate = dateParse(value);
|
|
9258
9282
|
if (isValidDate(newValueDate)) {
|
|
9283
|
+
onBlur(value, new Date(newValueDate));
|
|
9259
9284
|
setError(newValueDate);
|
|
9260
9285
|
}
|
|
9261
9286
|
else {
|
|
9287
|
+
onBlur(value);
|
|
9262
9288
|
setErrorText(invalidFormatText);
|
|
9263
9289
|
}
|
|
9264
9290
|
};
|
|
@@ -9309,7 +9335,7 @@
|
|
|
9309
9335
|
errorText.trim() && React__namespace.createElement("div", { className: css(_default$S.datePickerHelperText, _default$S.modifiers.error) }, errorText)));
|
|
9310
9336
|
};
|
|
9311
9337
|
const DatePicker = React__namespace.forwardRef(DatePickerBase);
|
|
9312
|
-
DatePicker.displayName = '
|
|
9338
|
+
DatePicker.displayName = 'DatePicker';
|
|
9313
9339
|
|
|
9314
9340
|
var _default$Q = {
|
|
9315
9341
|
"descriptionList": "pf-c-description-list",
|