@patternfly/react-core 4.175.15 → 4.177.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 +49 -0
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts +3 -1
- package/dist/esm/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/DropdownToggle.js +4 -4
- package/dist/esm/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/esm/components/Dropdown/Toggle.d.ts +3 -1
- package/dist/esm/components/Dropdown/Toggle.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Toggle.js +8 -3
- package/dist/esm/components/Dropdown/Toggle.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +2 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +7 -9
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
- package/dist/esm/components/Slider/Slider.js +9 -6
- package/dist/esm/components/Slider/Slider.js.map +1 -1
- package/dist/esm/helpers/OUIA/ouia.d.ts.map +1 -1
- package/dist/esm/helpers/OUIA/ouia.js +9 -1
- package/dist/esm/helpers/OUIA/ouia.js.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts +3 -1
- package/dist/js/components/Dropdown/DropdownToggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/DropdownToggle.js +4 -4
- package/dist/js/components/Dropdown/DropdownToggle.js.map +1 -1
- package/dist/js/components/Dropdown/Toggle.d.ts +3 -1
- package/dist/js/components/Dropdown/Toggle.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Toggle.js +8 -3
- package/dist/js/components/Dropdown/Toggle.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +2 -0
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +7 -9
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Slider/Slider.d.ts.map +1 -1
- package/dist/js/components/Slider/Slider.js +9 -6
- package/dist/js/components/Slider/Slider.js.map +1 -1
- package/dist/js/helpers/OUIA/ouia.d.ts.map +1 -1
- package/dist/js/helpers/OUIA/ouia.js +9 -1
- package/dist/js/helpers/OUIA/ouia.js.map +1 -1
- package/dist/umd/react-core.js +37 -23
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +5 -5
- package/src/components/Alert/examples/Alert.md +201 -382
- package/src/components/Alert/examples/AlertAsyncLiveRegion.tsx +61 -0
- package/src/components/Alert/examples/AlertDynamicLiveRegion.tsx +61 -0
- package/src/components/ApplicationLauncher/__tests__/__snapshots__/ApplicationLauncher.test.tsx.snap +6 -0
- package/src/components/Dropdown/DropdownToggle.tsx +6 -1
- package/src/components/Dropdown/Toggle.tsx +11 -1
- package/src/components/Dropdown/__tests__/DropdownToggle.test.tsx +51 -0
- package/src/components/Dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +8 -0
- package/src/components/Dropdown/__tests__/__snapshots__/DropdownToggle.test.tsx.snap +346 -4
- package/src/components/Dropdown/__tests__/__snapshots__/Toggle.test.tsx.snap +1 -0
- package/src/components/Dropdown/examples/Dropdown.md +160 -91
- package/src/components/OptionsMenu/__tests__/__snapshots__/OptionsMenu.test.tsx.snap +7 -0
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +15 -0
- package/src/components/Select/Select.tsx +9 -1
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +25 -0
- package/src/components/Select/examples/Select.md +75 -9
- package/src/components/Slider/Slider.tsx +9 -6
- package/src/components/Slider/examples/Slider.md +27 -0
- package/src/demos/CardDemos.md +65 -91
- package/src/demos/Tabs/NestedTabsDemo.js +151 -0
- package/src/demos/Tabs.md +4 -0
- package/src/helpers/OUIA/ouia.ts +8 -1
package/dist/umd/react-core.js
CHANGED
|
@@ -934,7 +934,15 @@
|
|
|
934
934
|
}
|
|
935
935
|
*/
|
|
936
936
|
try {
|
|
937
|
-
|
|
937
|
+
let key;
|
|
938
|
+
if (typeof window !== 'undefined') {
|
|
939
|
+
// browser environments
|
|
940
|
+
key = `${window.location.href}-${componentType}-${variant || ''}`;
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
// node/SSR environments
|
|
944
|
+
key = `${componentType}-${variant || ''}`;
|
|
945
|
+
}
|
|
938
946
|
if (!ouiaIdByRoute[key]) {
|
|
939
947
|
ouiaIdByRoute[key] = 0;
|
|
940
948
|
}
|
|
@@ -5026,6 +5034,11 @@
|
|
|
5026
5034
|
|
|
5027
5035
|
var CaretDownIcon$1 = CaretDownIcon;
|
|
5028
5036
|
|
|
5037
|
+
const buttonVariantStyles = {
|
|
5038
|
+
default: '',
|
|
5039
|
+
primary: _default$1a.modifiers.primary,
|
|
5040
|
+
secondary: _default$1a.modifiers.secondary
|
|
5041
|
+
};
|
|
5029
5042
|
class Toggle extends React__namespace.Component {
|
|
5030
5043
|
constructor() {
|
|
5031
5044
|
super(...arguments);
|
|
@@ -5084,12 +5097,12 @@
|
|
|
5084
5097
|
};
|
|
5085
5098
|
}
|
|
5086
5099
|
render() {
|
|
5087
|
-
const _a = this.props, { className, children, isOpen, isDisabled, isPlain, isPrimary, isSplitButton, onToggle, 'aria-haspopup': ariaHasPopup,
|
|
5100
|
+
const _a = this.props, { className, children, isOpen, isDisabled, isPlain, isPrimary, isSplitButton, toggleVariant, onToggle, 'aria-haspopup': ariaHasPopup,
|
|
5088
5101
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5089
5102
|
isActive, bubbleEvent, onEnter, parentRef, getMenuRef,
|
|
5090
5103
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
5091
|
-
id, type } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isDisabled", "isPlain", "isPrimary", "isSplitButton", "onToggle", 'aria-haspopup', "isActive", "bubbleEvent", "onEnter", "parentRef", "getMenuRef", "id", "type"]);
|
|
5092
|
-
return (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleClass }) => (React__namespace.createElement("button", Object.assign({}, props, { id: id, ref: this.buttonRef, className: css(isSplitButton ? _default$1a.dropdownToggleButton : toggleClass || _default$1a.dropdownToggle, isActive && _default$1a.modifiers.active, isPlain && _default$1a.modifiers.plain, isPrimary && _default$1a.modifiers.primary, className), type: type || 'button', onClick: event => onToggle(!isOpen, event), "aria-expanded": isOpen, "aria-haspopup": ariaHasPopup, onKeyDown: event => this.onKeyDown(event), disabled: isDisabled }), children))));
|
|
5104
|
+
id, type } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isDisabled", "isPlain", "isPrimary", "isSplitButton", "toggleVariant", "onToggle", 'aria-haspopup', "isActive", "bubbleEvent", "onEnter", "parentRef", "getMenuRef", "id", "type"]);
|
|
5105
|
+
return (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleClass }) => (React__namespace.createElement("button", Object.assign({}, props, { id: id, ref: this.buttonRef, className: css(isSplitButton ? _default$1a.dropdownToggleButton : toggleClass || _default$1a.dropdownToggle, isActive && _default$1a.modifiers.active, isPlain && _default$1a.modifiers.plain, isPrimary && _default$1a.modifiers.primary, buttonVariantStyles[toggleVariant], className), type: type || 'button', onClick: event => onToggle(!isOpen, event), "aria-expanded": isOpen, "aria-haspopup": ariaHasPopup, onKeyDown: event => this.onKeyDown(event), disabled: isDisabled }), children))));
|
|
5093
5106
|
}
|
|
5094
5107
|
}
|
|
5095
5108
|
Toggle.displayName = 'Toggle';
|
|
@@ -5159,22 +5172,22 @@
|
|
|
5159
5172
|
KebabToggle.displayName = 'KebabToggle';
|
|
5160
5173
|
|
|
5161
5174
|
const DropdownToggle = (_a) => {
|
|
5162
|
-
var { id = '', children = null, className = '', isOpen = false, parentRef = null, getMenuRef = null, isDisabled = false, isPlain = false, isPrimary = false,
|
|
5175
|
+
var { id = '', children = null, className = '', isOpen = false, parentRef = null, getMenuRef = null, isDisabled = false, isPlain = false, isPrimary = false, toggleVariant = 'default',
|
|
5163
5176
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5164
5177
|
isActive = false,
|
|
5165
5178
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5166
5179
|
onToggle = (_isOpen) => undefined, icon = null, toggleIndicator: ToggleIndicator = CaretDownIcon$1, splitButtonItems, splitButtonVariant = 'checkbox', 'aria-haspopup': ariaHasPopup, ouiaId, ouiaSafe,
|
|
5167
5180
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5168
5181
|
ref } = _a, // Types of Ref are different for React.FC vs React.Component
|
|
5169
|
-
props = __rest$1(_a, ["id", "children", "className", "isOpen", "parentRef", "getMenuRef", "isDisabled", "isPlain", "isPrimary", "isActive", "onToggle", "icon", "toggleIndicator", "splitButtonItems", "splitButtonVariant", 'aria-haspopup', "ouiaId", "ouiaSafe", "ref"]);
|
|
5182
|
+
props = __rest$1(_a, ["id", "children", "className", "isOpen", "parentRef", "getMenuRef", "isDisabled", "isPlain", "isPrimary", "toggleVariant", "isActive", "onToggle", "icon", "toggleIndicator", "splitButtonItems", "splitButtonVariant", 'aria-haspopup', "ouiaId", "ouiaSafe", "ref"]);
|
|
5170
5183
|
const ouiaProps = useOUIAProps(DropdownToggle.displayName, ouiaId, ouiaSafe);
|
|
5171
|
-
const toggle = (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleTextClass, toggleIndicatorClass, toggleIconClass }) => (React__namespace.createElement(Toggle, Object.assign({}, props, { id: id, className: className, isOpen: isOpen, parentRef: parentRef, getMenuRef: getMenuRef, isActive: isActive, isDisabled: isDisabled, isPlain: isPlain, isPrimary: isPrimary, onToggle: onToggle, "aria-haspopup": ariaHasPopup }, ouiaProps, (splitButtonItems && { isSplitButton: true, 'aria-label': props['aria-label'] || 'Select' })),
|
|
5184
|
+
const toggle = (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleTextClass, toggleIndicatorClass, toggleIconClass }) => (React__namespace.createElement(Toggle, Object.assign({}, props, { id: id, className: className, isOpen: isOpen, parentRef: parentRef, getMenuRef: getMenuRef, isActive: isActive, isDisabled: isDisabled, isPlain: isPlain, isPrimary: isPrimary, toggleVariant: toggleVariant, onToggle: onToggle, "aria-haspopup": ariaHasPopup }, ouiaProps, (splitButtonItems && { isSplitButton: true, 'aria-label': props['aria-label'] || 'Select' })),
|
|
5172
5185
|
icon && React__namespace.createElement("span", { className: css(toggleIconClass) }, icon),
|
|
5173
5186
|
children && React__namespace.createElement("span", { className: ToggleIndicator && css(toggleTextClass) }, children),
|
|
5174
5187
|
ToggleIndicator && (React__namespace.createElement("span", { className: css(!splitButtonItems && toggleIndicatorClass) },
|
|
5175
5188
|
React__namespace.createElement(ToggleIndicator, null)))))));
|
|
5176
5189
|
if (splitButtonItems) {
|
|
5177
|
-
return (React__namespace.createElement("div", { className: css(_default$1a.dropdownToggle, _default$1a.modifiers.splitButton, splitButtonVariant === 'action' && _default$1a.modifiers.action, isDisabled && _default$1a.modifiers.disabled) },
|
|
5190
|
+
return (React__namespace.createElement("div", { className: css(_default$1a.dropdownToggle, _default$1a.modifiers.splitButton, splitButtonVariant === 'action' && _default$1a.modifiers.action, (toggleVariant === 'primary' || isPrimary) && splitButtonVariant === 'action' && _default$1a.modifiers.primary, isDisabled && _default$1a.modifiers.disabled) },
|
|
5178
5191
|
splitButtonItems,
|
|
5179
5192
|
toggle));
|
|
5180
5193
|
}
|
|
@@ -6726,13 +6739,10 @@
|
|
|
6726
6739
|
onToggle(isExpanded);
|
|
6727
6740
|
};
|
|
6728
6741
|
this.onClose = () => {
|
|
6729
|
-
this.
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
typeaheadCurrIndex: -1,
|
|
6734
|
-
tabbedIntoFavoritesMenu: false
|
|
6735
|
-
});
|
|
6742
|
+
const { isInputFilterPersisted } = this.props;
|
|
6743
|
+
this.setState(Object.assign(Object.assign({ focusFirstOption: false, typeaheadInputValue: null }, (!isInputFilterPersisted && {
|
|
6744
|
+
typeaheadFilteredChildren: React__namespace.Children.toArray(this.props.children)
|
|
6745
|
+
})), { typeaheadCurrIndex: -1, tabbedIntoFavoritesMenu: false }));
|
|
6736
6746
|
};
|
|
6737
6747
|
this.onChange = (e) => {
|
|
6738
6748
|
if (e.target.value.toString() !== '' && !this.props.isOpen) {
|
|
@@ -7087,11 +7097,11 @@
|
|
|
7087
7097
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7088
7098
|
onTypeaheadInputChanged, onCreateOption, isCreatable, onToggle, createText, noResultsFoundText, customBadgeText, inputIdPrefix,
|
|
7089
7099
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7090
|
-
isInputValuePersisted,
|
|
7100
|
+
isInputValuePersisted, isInputFilterPersisted,
|
|
7091
7101
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
7092
7102
|
menuAppendTo, favorites, onFavorite,
|
|
7093
7103
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7094
|
-
favoritesLabel, footer, loadingVariant, isCreateSelectOptionObject } = _a, props = __rest$1(_a, ["children", "chipGroupProps", "chipGroupComponent", "className", "customContent", "variant", "direction", "onSelect", "onClear", "toggleId", "isOpen", "isGrouped", "isPlain", "isDisabled", "hasPlaceholderStyle", "validated", "selections", "typeAheadAriaLabel", "clearSelectionsAriaLabel", "toggleAriaLabel", "removeSelectionAriaLabel", 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-invalid', "placeholderText", "width", "maxHeight", "toggleIcon", "ouiaId", "ouiaSafe", "hasInlineFilter", "isCheckboxSelectionBadgeHidden", "inlineFilterPlaceholderText", "onFilter", "onTypeaheadInputChanged", "onCreateOption", "isCreatable", "onToggle", "createText", "noResultsFoundText", "customBadgeText", "inputIdPrefix", "isInputValuePersisted", "menuAppendTo", "favorites", "onFavorite", "favoritesLabel", "footer", "loadingVariant", "isCreateSelectOptionObject"]);
|
|
7104
|
+
favoritesLabel, footer, loadingVariant, isCreateSelectOptionObject } = _a, props = __rest$1(_a, ["children", "chipGroupProps", "chipGroupComponent", "className", "customContent", "variant", "direction", "onSelect", "onClear", "toggleId", "isOpen", "isGrouped", "isPlain", "isDisabled", "hasPlaceholderStyle", "validated", "selections", "typeAheadAriaLabel", "clearSelectionsAriaLabel", "toggleAriaLabel", "removeSelectionAriaLabel", 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-invalid', "placeholderText", "width", "maxHeight", "toggleIcon", "ouiaId", "ouiaSafe", "hasInlineFilter", "isCheckboxSelectionBadgeHidden", "inlineFilterPlaceholderText", "onFilter", "onTypeaheadInputChanged", "onCreateOption", "isCreatable", "onToggle", "createText", "noResultsFoundText", "customBadgeText", "inputIdPrefix", "isInputValuePersisted", "isInputFilterPersisted", "menuAppendTo", "favorites", "onFavorite", "favoritesLabel", "footer", "loadingVariant", "isCreateSelectOptionObject"]);
|
|
7095
7105
|
const { focusFirstOption: openedOnEnter, typeaheadCurrIndex, typeaheadInputValue, typeaheadFilteredChildren, favoritesGroup } = this.state;
|
|
7096
7106
|
const selectToggleId = toggleId || `pf-select-toggle-id-${currentId$1++}`;
|
|
7097
7107
|
const selections = Array.isArray(selectionsProp) ? selectionsProp : [selectionsProp];
|
|
@@ -7335,6 +7345,7 @@
|
|
|
7335
7345
|
ouiaSafe: true,
|
|
7336
7346
|
chipGroupComponent: null,
|
|
7337
7347
|
isInputValuePersisted: false,
|
|
7348
|
+
isInputFilterPersisted: false,
|
|
7338
7349
|
isCreateSelectOptionObject: false
|
|
7339
7350
|
};
|
|
7340
7351
|
|
|
@@ -17125,16 +17136,19 @@
|
|
|
17125
17136
|
}
|
|
17126
17137
|
/* If custom steps are discrete, snap to closest step value */
|
|
17127
17138
|
if (!areCustomStepsContinuous && customSteps) {
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
|
|
17139
|
+
let percentage = newPercentage;
|
|
17140
|
+
if (customSteps[customSteps.length - 1].value !== 100) {
|
|
17141
|
+
const numSteps = customSteps.length - 1;
|
|
17142
|
+
const percentagePerStep = 100 / numSteps;
|
|
17143
|
+
percentage = newPercentage / percentagePerStep;
|
|
17144
|
+
}
|
|
17145
|
+
const stepIndex = customSteps.findIndex(stepObj => stepObj.value >= percentage);
|
|
17146
|
+
if (customSteps[stepIndex].value === percentage) {
|
|
17133
17147
|
snapValue = customSteps[stepIndex].value;
|
|
17134
17148
|
}
|
|
17135
17149
|
else {
|
|
17136
17150
|
const midpoint = (customSteps[stepIndex].value + customSteps[stepIndex - 1].value) / 2;
|
|
17137
|
-
if (midpoint >
|
|
17151
|
+
if (midpoint > percentage) {
|
|
17138
17152
|
snapValue = customSteps[stepIndex - 1].value;
|
|
17139
17153
|
}
|
|
17140
17154
|
else {
|