@patternfly/react-table 4.106.3 → 4.106.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.
@@ -4929,31 +4929,32 @@
4929
4929
  this.additionalRef = React__namespace.createRef();
4930
4930
  this.getInnerNode = (node) => (node && node.childNodes && node.childNodes.length ? node.childNodes[0] : node);
4931
4931
  this.onKeyDown = (event) => {
4932
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
4932
4933
  // Detected key press on this item, notify the menu parent so that the appropriate item can be focused
4933
4934
  const innerIndex = event.target === this.ref.current ? 0 : 1;
4934
4935
  if (!this.props.customChild) {
4935
4936
  event.preventDefault();
4936
4937
  }
4937
4938
  if (event.key === 'ArrowUp') {
4938
- this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.UP);
4939
+ (_b = (_a = this.props.context) === null || _a === void 0 ? void 0 : _a.keyHandler) === null || _b === void 0 ? void 0 : _b.call(_a, this.props.index, innerIndex, KEYHANDLER_DIRECTION.UP);
4939
4940
  event.stopPropagation();
4940
4941
  }
4941
4942
  else if (event.key === 'ArrowDown') {
4942
- this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.DOWN);
4943
+ (_d = (_c = this.props.context) === null || _c === void 0 ? void 0 : _c.keyHandler) === null || _d === void 0 ? void 0 : _d.call(_c, this.props.index, innerIndex, KEYHANDLER_DIRECTION.DOWN);
4943
4944
  event.stopPropagation();
4944
4945
  }
4945
4946
  else if (event.key === 'ArrowRight') {
4946
- this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.RIGHT);
4947
+ (_f = (_e = this.props.context) === null || _e === void 0 ? void 0 : _e.keyHandler) === null || _f === void 0 ? void 0 : _f.call(_e, this.props.index, innerIndex, KEYHANDLER_DIRECTION.RIGHT);
4947
4948
  event.stopPropagation();
4948
4949
  }
4949
4950
  else if (event.key === 'ArrowLeft') {
4950
- this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.LEFT);
4951
+ (_h = (_g = this.props.context) === null || _g === void 0 ? void 0 : _g.keyHandler) === null || _h === void 0 ? void 0 : _h.call(_g, this.props.index, innerIndex, KEYHANDLER_DIRECTION.LEFT);
4951
4952
  event.stopPropagation();
4952
4953
  }
4953
4954
  else if (event.key === 'Enter' || event.key === ' ') {
4954
4955
  event.target.click();
4955
4956
  this.props.enterTriggersArrowDown &&
4956
- this.props.context.keyHandler(this.props.index, innerIndex, KEYHANDLER_DIRECTION.DOWN);
4957
+ ((_k = (_j = this.props.context) === null || _j === void 0 ? void 0 : _j.keyHandler) === null || _k === void 0 ? void 0 : _k.call(_j, this.props.index, innerIndex, KEYHANDLER_DIRECTION.DOWN));
4957
4958
  }
4958
4959
  };
4959
4960
  this.componentRef = (element) => {
@@ -4971,15 +4972,17 @@
4971
4972
  };
4972
4973
  }
4973
4974
  componentDidMount() {
4975
+ var _a;
4974
4976
  const { context, index, isDisabled, role, customChild, autoFocus } = this.props;
4975
4977
  const customRef = customChild ? this.getInnerNode(this.ref.current) : this.ref.current;
4976
- context.sendRef(index, [customRef, customChild ? customRef : this.additionalRef.current], isDisabled, role === 'separator');
4978
+ (_a = context === null || context === void 0 ? void 0 : context.sendRef) === null || _a === void 0 ? void 0 : _a.call(context, index, [customRef, customChild ? customRef : this.additionalRef.current], isDisabled, role === 'separator');
4977
4979
  autoFocus && setTimeout(() => customRef.focus());
4978
4980
  }
4979
4981
  componentDidUpdate() {
4982
+ var _a;
4980
4983
  const { context, index, isDisabled, role, customChild } = this.props;
4981
4984
  const customRef = customChild ? this.getInnerNode(this.ref.current) : this.ref.current;
4982
- context.sendRef(index, [customRef, customChild ? customRef : this.additionalRef.current], isDisabled, role === 'separator');
4985
+ (_a = context === null || context === void 0 ? void 0 : context.sendRef) === null || _a === void 0 ? void 0 : _a.call(context, index, [customRef, customChild ? customRef : this.additionalRef.current], isDisabled, role === 'separator');
4983
4986
  }
4984
4987
  extendAdditionalChildRef() {
4985
4988
  const { additionalChild } = this.props;
@@ -5024,12 +5027,12 @@
5024
5027
  onKeyDown: this.onKeyDown
5025
5028
  });
5026
5029
  }
5027
- return (React__namespace.createElement("li", { className: listItemClassName || null, role: "none", onKeyDown: this.onKeyDown, onClick: (event) => {
5030
+ return (React__namespace.createElement("li", Object.assign({}, (listItemClassName && { className: listItemClassName }), { role: "none", onKeyDown: this.onKeyDown, onClick: (event) => {
5028
5031
  if (!isDisabled && !isAriaDisabled) {
5029
- onClick(event);
5030
- onSelect(event);
5032
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
5033
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(event);
5031
5034
  }
5032
- }, id: id },
5035
+ }, id: id }),
5033
5036
  renderWithTooltip(React__namespace.isValidElement(component)
5034
5037
  ? renderClonedComponent(component)
5035
5038
  : renderDefaultComponent(component)),
@@ -5207,10 +5210,11 @@
5207
5210
  const clickedOnToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
5208
5211
  const clickedWithinMenu = menuRef && menuRef.contains && menuRef.contains(event.target);
5209
5212
  if (isOpen && !(clickedOnToggle || clickedWithinMenu)) {
5210
- onToggle(false, event);
5213
+ onToggle === null || onToggle === void 0 ? void 0 : onToggle(false, event);
5211
5214
  }
5212
5215
  };
5213
5216
  this.onEscPress = (event) => {
5217
+ var _a, _b, _c;
5214
5218
  const { parentRef, getMenuRef } = this.props;
5215
5219
  const menuRef = getMenuRef && getMenuRef();
5216
5220
  const escFromToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
@@ -5218,11 +5222,12 @@
5218
5222
  if (this.props.isOpen &&
5219
5223
  (event.key === KeyTypes.Escape || event.key === 'Tab') &&
5220
5224
  (escFromToggle || escFromWithinMenu)) {
5221
- this.props.onToggle(false, event);
5222
- this.buttonRef.current.focus();
5225
+ (_b = (_a = this.props).onToggle) === null || _b === void 0 ? void 0 : _b.call(_a, false, event);
5226
+ (_c = this.buttonRef.current) === null || _c === void 0 ? void 0 : _c.focus();
5223
5227
  }
5224
5228
  };
5225
5229
  this.onKeyDown = (event) => {
5230
+ var _a, _b, _c, _d, _e, _f;
5226
5231
  if (event.key === 'Tab' && !this.props.isOpen) {
5227
5232
  return;
5228
5233
  }
@@ -5231,15 +5236,15 @@
5231
5236
  event.stopPropagation();
5232
5237
  }
5233
5238
  event.preventDefault();
5234
- this.props.onToggle(!this.props.isOpen, event);
5239
+ (_b = (_a = this.props).onToggle) === null || _b === void 0 ? void 0 : _b.call(_a, !this.props.isOpen, event);
5235
5240
  }
5236
5241
  else if ((event.key === 'Enter' || event.key === ' ') && !this.props.isOpen) {
5237
5242
  if (!this.props.bubbleEvent) {
5238
5243
  event.stopPropagation();
5239
5244
  }
5240
5245
  event.preventDefault();
5241
- this.props.onToggle(!this.props.isOpen, event);
5242
- this.props.onEnter();
5246
+ (_d = (_c = this.props).onToggle) === null || _d === void 0 ? void 0 : _d.call(_c, !this.props.isOpen, event);
5247
+ (_f = (_e = this.props).onEnter) === null || _f === void 0 ? void 0 : _f.call(_e);
5243
5248
  }
5244
5249
  };
5245
5250
  }
@@ -5249,7 +5254,7 @@
5249
5254
  isActive, bubbleEvent, onEnter, parentRef, getMenuRef,
5250
5255
  /* eslint-enable @typescript-eslint/no-unused-vars */
5251
5256
  id, type } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isDisabled", "isPlain", "isText", "isPrimary", "isSplitButton", "toggleVariant", "onToggle", 'aria-haspopup', "isActive", "bubbleEvent", "onEnter", "parentRef", "getMenuRef", "id", "type"]);
5252
- return (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleClass }) => (React__namespace.createElement("button", Object.assign({}, props, { id: id, ref: this.buttonRef, className: css(isSplitButton ? styles$8.dropdownToggleButton : toggleClass || styles$8.dropdownToggle, isActive && styles$8.modifiers.active, isPlain && styles$8.modifiers.plain, isText && styles$8.modifiers.text, isPrimary && styles$8.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))));
5257
+ return (React__namespace.createElement(DropdownContext.Consumer, null, ({ toggleClass }) => (React__namespace.createElement("button", Object.assign({}, props, { id: id, ref: this.buttonRef, className: css(isSplitButton ? styles$8.dropdownToggleButton : toggleClass || styles$8.dropdownToggle, isActive && styles$8.modifiers.active, isPlain && styles$8.modifiers.plain, isText && styles$8.modifiers.text, isPrimary && styles$8.modifiers.primary, toggleVariant && buttonVariantStyles[toggleVariant], className), type: type || 'button', onClick: event => onToggle === null || onToggle === void 0 ? void 0 : onToggle(!isOpen, event), "aria-expanded": isOpen, "aria-haspopup": ariaHasPopup, onKeyDown: event => this.onKeyDown(event), disabled: isDisabled }), children))));
5253
5258
  }
5254
5259
  }
5255
5260
  Toggle.displayName = 'Toggle';