@patternfly/react-core 4.214.2 → 4.214.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/esm/components/Banner/Banner.d.ts +2 -0
  3. package/dist/esm/components/Banner/Banner.d.ts.map +1 -1
  4. package/dist/esm/components/Banner/Banner.js +4 -2
  5. package/dist/esm/components/Banner/Banner.js.map +1 -1
  6. package/dist/esm/components/Chip/Chip.d.ts +5 -0
  7. package/dist/esm/components/Chip/Chip.d.ts.map +1 -1
  8. package/dist/esm/components/Chip/Chip.js +7 -2
  9. package/dist/esm/components/Chip/Chip.js.map +1 -1
  10. package/dist/esm/components/Slider/Slider.d.ts +4 -0
  11. package/dist/esm/components/Slider/Slider.d.ts.map +1 -1
  12. package/dist/esm/components/Slider/Slider.js +2 -2
  13. package/dist/esm/components/Slider/Slider.js.map +1 -1
  14. package/dist/esm/components/Switch/Switch.d.ts.map +1 -1
  15. package/dist/esm/components/Switch/Switch.js +2 -3
  16. package/dist/esm/components/Switch/Switch.js.map +1 -1
  17. package/dist/esm/components/TextArea/TextArea.d.ts +1 -1
  18. package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
  19. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  20. package/dist/js/components/Banner/Banner.d.ts +2 -0
  21. package/dist/js/components/Banner/Banner.d.ts.map +1 -1
  22. package/dist/js/components/Banner/Banner.js +4 -2
  23. package/dist/js/components/Banner/Banner.js.map +1 -1
  24. package/dist/js/components/Chip/Chip.d.ts +5 -0
  25. package/dist/js/components/Chip/Chip.d.ts.map +1 -1
  26. package/dist/js/components/Chip/Chip.js +7 -2
  27. package/dist/js/components/Chip/Chip.js.map +1 -1
  28. package/dist/js/components/Slider/Slider.d.ts +4 -0
  29. package/dist/js/components/Slider/Slider.d.ts.map +1 -1
  30. package/dist/js/components/Slider/Slider.js +2 -2
  31. package/dist/js/components/Slider/Slider.js.map +1 -1
  32. package/dist/js/components/Switch/Switch.d.ts.map +1 -1
  33. package/dist/js/components/Switch/Switch.js +2 -3
  34. package/dist/js/components/Switch/Switch.js.map +1 -1
  35. package/dist/js/components/TextArea/TextArea.d.ts +1 -1
  36. package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
  37. package/dist/js/components/TextArea/TextArea.js.map +1 -1
  38. package/dist/umd/react-core.css +545 -545
  39. package/dist/umd/react-core.js +15 -9
  40. package/dist/umd/react-core.min.js +2 -2
  41. package/package.json +5 -5
  42. package/src/components/Banner/Banner.tsx +4 -0
  43. package/src/components/Banner/__tests__/Banner.test.tsx +5 -1
  44. package/src/components/Banner/__tests__/__snapshots__/Banner.test.tsx.snap +30 -0
  45. package/src/components/Banner/examples/BannerBasic.tsx +4 -2
  46. package/src/components/Chip/Chip.tsx +14 -0
  47. package/src/components/Chip/__tests__/Chip.test.tsx +9 -0
  48. package/src/components/Chip/__tests__/__snapshots__/Chip.test.tsx.snap +44 -0
  49. package/src/components/Slider/Slider.tsx +8 -0
  50. package/src/components/Slider/_tests_/Slider.test.tsx +27 -1
  51. package/src/components/Switch/Switch.tsx +7 -6
  52. package/src/components/TextArea/TextArea.tsx +1 -1
@@ -5804,8 +5804,10 @@
5804
5804
  };
5805
5805
 
5806
5806
  const Banner = (_a) => {
5807
- var { children, className, variant = 'default', isSticky = false } = _a, props = __rest$1(_a, ["children", "className", "variant", "isSticky"]);
5808
- return (React__namespace.createElement("div", Object.assign({ className: css(styles$11.banner, styles$11.modifiers[variant], isSticky && styles$11.modifiers.sticky, className) }, props), children));
5807
+ var { children, className, variant = 'default', screenReaderText, isSticky = false } = _a, props = __rest$1(_a, ["children", "className", "variant", "screenReaderText", "isSticky"]);
5808
+ return (React__namespace.createElement("div", Object.assign({ className: css(styles$11.banner, styles$11.modifiers[variant], isSticky && styles$11.modifiers.sticky, className) }, props),
5809
+ children,
5810
+ React__namespace.createElement("span", { className: "pf-u-screen-reader" }, screenReaderText || `${variant} banner`)));
5809
5811
  };
5810
5812
  Banner.displayName = 'Banner';
5811
5813
 
@@ -6745,10 +6747,13 @@
6745
6747
  constructor(props) {
6746
6748
  super(props);
6747
6749
  this.span = React__namespace.createRef();
6750
+ this.setChipStyle = () => ({
6751
+ '--pf-c-chip__text--MaxWidth': this.props.textMaxWidth
6752
+ });
6748
6753
  this.renderOverflowChip = () => {
6749
6754
  const { children, className, onClick, ouiaId } = this.props;
6750
6755
  const Component = this.props.component;
6751
- return (React__namespace.createElement(Component, Object.assign({ onClick: onClick, className: css(styles$W.chip, styles$W.modifiers.overflow, className) }, (this.props.component === 'button' ? { type: 'button' } : {}), getOUIAProps('OverflowChip', ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)),
6756
+ return (React__namespace.createElement(Component, Object.assign({ onClick: onClick }, (this.props.textMaxWidth && Object.assign({ style: this.setChipStyle() }, this.props.style)), { className: css(styles$W.chip, styles$W.modifiers.overflow, className) }, (this.props.component === 'button' ? { type: 'button' } : {}), getOUIAProps('OverflowChip', ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)),
6752
6757
  React__namespace.createElement("span", { className: css(styles$W.chipText) }, children)));
6753
6758
  };
6754
6759
  this.renderChip = (randomId) => {
@@ -6771,7 +6776,9 @@
6771
6776
  renderInnerChip(id) {
6772
6777
  const { children, className, onClick, closeBtnAriaLabel, isReadOnly, component, ouiaId } = this.props;
6773
6778
  const Component = component;
6774
- return (React__namespace.createElement(Component, Object.assign({ className: css(styles$W.chip, className) }, (this.state.isTooltipVisible && { tabIndex: 0 }), getOUIAProps(Chip.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)),
6779
+ return (React__namespace.createElement(Component, Object.assign({}, (this.props.textMaxWidth && {
6780
+ style: this.setChipStyle()
6781
+ }), { className: css(styles$W.chip, className) }, (this.state.isTooltipVisible && { tabIndex: 0 }), getOUIAProps(Chip.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId)),
6775
6782
  React__namespace.createElement("span", { ref: this.span, className: css(styles$W.chipText), id: id }, children),
6776
6783
  !isReadOnly && (React__namespace.createElement(Button, { onClick: onClick, variant: "plain", "aria-label": closeBtnAriaLabel, id: `remove_${id}`, "aria-labelledby": `remove_${id} ${id}`, ouiaId: ouiaId || closeBtnAriaLabel },
6777
6784
  React__namespace.createElement(TimesIcon$1, { "aria-hidden": "true" })))));
@@ -17922,7 +17929,7 @@
17922
17929
 
17923
17930
  const getPercentage = (current, max) => (100 * current) / max;
17924
17931
  const Slider = (_a) => {
17925
- var { className, value = 0, customSteps, areCustomStepsContinuous = false, isDisabled = false, isInputVisible = false, inputValue = 0, inputLabel, inputAriaLabel = 'Slider value input', thumbAriaLabel = 'Value', hasTooltipOverThumb = false, inputPosition = 'right', onChange, leftActions, rightActions, step = 1, min = 0, max = 100, showTicks = false, showBoundaries = true } = _a, props = __rest$1(_a, ["className", "value", "customSteps", "areCustomStepsContinuous", "isDisabled", "isInputVisible", "inputValue", "inputLabel", "inputAriaLabel", "thumbAriaLabel", "hasTooltipOverThumb", "inputPosition", "onChange", "leftActions", "rightActions", "step", "min", "max", "showTicks", "showBoundaries"]);
17932
+ var { className, value = 0, customSteps, areCustomStepsContinuous = false, isDisabled = false, isInputVisible = false, inputValue = 0, inputLabel, inputAriaLabel = 'Slider value input', thumbAriaLabel = 'Value', hasTooltipOverThumb = false, inputPosition = 'right', onChange, leftActions, rightActions, step = 1, min = 0, max = 100, showTicks = false, showBoundaries = true, 'aria-describedby': ariaDescribedby, 'aria-labelledby': ariaLabelledby } = _a, props = __rest$1(_a, ["className", "value", "customSteps", "areCustomStepsContinuous", "isDisabled", "isInputVisible", "inputValue", "inputLabel", "inputAriaLabel", "thumbAriaLabel", "hasTooltipOverThumb", "inputPosition", "onChange", "leftActions", "rightActions", "step", "min", "max", "showTicks", "showBoundaries", 'aria-describedby', 'aria-labelledby']);
17926
17933
  const sliderRailRef = React__namespace.useRef();
17927
17934
  const thumbRef = React__namespace.useRef();
17928
17935
  const [localValue, setValue] = React.useState(value);
@@ -18130,7 +18137,7 @@
18130
18137
  }
18131
18138
  return builtSteps;
18132
18139
  };
18133
- const thumbComponent = (React__namespace.createElement("div", { className: css(styles$j.sliderThumb), ref: thumbRef, tabIndex: isDisabled ? -1 : 0, role: "slider", "aria-valuemin": customSteps ? customSteps[0].value : min, "aria-valuemax": customSteps ? customSteps[customSteps.length - 1].value : max, "aria-valuenow": localValue, "aria-valuetext": findAriaTextValue(), "aria-label": thumbAriaLabel, "aria-disabled": isDisabled, onMouseDown: !isDisabled ? handleMouseDown : null, onTouchStart: !isDisabled ? handleTouchStart : null, onKeyDown: !isDisabled ? handleThumbKeys : null, onClick: !isDisabled ? onThumbClick : null }));
18140
+ const thumbComponent = (React__namespace.createElement("div", { className: css(styles$j.sliderThumb), ref: thumbRef, tabIndex: isDisabled ? -1 : 0, role: "slider", "aria-valuemin": customSteps ? customSteps[0].value : min, "aria-valuemax": customSteps ? customSteps[customSteps.length - 1].value : max, "aria-valuenow": localValue, "aria-valuetext": findAriaTextValue(), "aria-label": thumbAriaLabel, "aria-disabled": isDisabled, "aria-describedby": ariaDescribedby, "aria-labelledby": ariaLabelledby, onMouseDown: !isDisabled ? handleMouseDown : null, onTouchStart: !isDisabled ? handleTouchStart : null, onKeyDown: !isDisabled ? handleThumbKeys : null, onClick: !isDisabled ? onThumbClick : null }));
18134
18141
  return (React__namespace.createElement("div", Object.assign({ className: css(styles$j.slider, className, isDisabled && styles$j.modifiers.disabled), style: Object.assign(Object.assign({}, style), inputStyle) }, props),
18135
18142
  leftActions && React__namespace.createElement("div", { className: css(styles$j.sliderActions) }, leftActions),
18136
18143
  React__namespace.createElement("div", { className: css(styles$j.sliderMain) },
@@ -18184,10 +18191,9 @@
18184
18191
  return (React__namespace.createElement("label", Object.assign({ className: css(styles$i.switch, isReversed && styles$i.modifiers.reverse, className), htmlFor: this.id }, getOUIAProps(Switch.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe)),
18185
18192
  React__namespace.createElement("input", Object.assign({ id: this.id, className: css(styles$i.switchInput), type: "checkbox", onChange: event => onChange(event.target.checked, event), checked: isChecked, disabled: isDisabled, "aria-labelledby": isAriaLabelledBy ? `${this.id}-on` : null }, props)),
18186
18193
  label !== undefined ? (React__namespace.createElement(React__namespace.Fragment, null,
18187
- React__namespace.createElement("span", { className: css(styles$i.switchToggle) }),
18194
+ React__namespace.createElement("span", { className: css(styles$i.switchToggle) }, hasCheckIcon && (React__namespace.createElement("span", { className: css(styles$i.switchToggleIcon), "aria-hidden": "true" },
18195
+ React__namespace.createElement(CheckIcon$1, { noVerticalAlign: true })))),
18188
18196
  React__namespace.createElement("span", { className: css(styles$i.switchLabel, styles$i.modifiers.on), id: isAriaLabelledBy ? `${this.id}-on` : null, "aria-hidden": "true" }, label),
18189
- hasCheckIcon && (React__namespace.createElement("div", { className: css(styles$i.switchToggleIcon), "aria-hidden": "true" },
18190
- React__namespace.createElement(CheckIcon$1, { noVerticalAlign: true }))),
18191
18197
  React__namespace.createElement("span", { className: css(styles$i.switchLabel, styles$i.modifiers.off), id: isAriaLabelledBy ? `${this.id}-off` : null, "aria-hidden": "true" }, labelOff !== undefined ? labelOff : label))) : (React__namespace.createElement("span", { className: css(styles$i.switchToggle) },
18192
18198
  React__namespace.createElement("div", { className: css(styles$i.switchToggleIcon), "aria-hidden": "true" },
18193
18199
  React__namespace.createElement(CheckIcon$1, { noVerticalAlign: true }))))));