@7shifts/sous-chef 3.79.1 → 3.80.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.
@@ -798,7 +798,7 @@ const TooltipElement = ({
798
798
  * Checking if is a tooltip on a cell because it is probably the DataTableEditableCell.
799
799
  * We can't change the div structure (unmounting/mounting tooltip) otherwise the cell input will lose focus
800
800
  */
801
- const isTableCell = anchorElements === 1 && children.props.role === 'cell';
801
+ const isTableCell = anchorElements === 1 && React__default.isValidElement(children) && children.props.role === 'cell';
802
802
  if (!overlay && !header && !isTableCell || anchorElements === 0) {
803
803
  return children;
804
804
  }
@@ -820,27 +820,28 @@ const TooltipElement = ({
820
820
  testId: testId,
821
821
  maxHeight: maxHeight
822
822
  }, _theme === TOOLTIP_THEME.BLACK && !header ? null : overlay) : null;
823
- if (React__default.Children.count(children) === 1) {
824
- return React__default.createElement(Fragment, null, React__default.Children.map(children, child => {
825
- return React__default.cloneElement(child, {
826
- onMouseEnter: openTooltip,
827
- onMouseLeave: closeTooltipWithDelay,
828
- onFocus: openTooltip,
829
- onBlur: closeTooltipWithDelay,
830
- ref: containerRef
831
- });
832
- }), overlayElement);
833
- }
834
- return React__default.createElement("div", {
835
- className: classnames(styles$1k['tooltip']),
823
+ const commonProps = {
836
824
  onMouseEnter: openTooltip,
837
825
  onMouseLeave: closeTooltipWithDelay,
838
826
  onFocus: openTooltip,
839
827
  onBlur: closeTooltipWithDelay,
840
828
  ref: containerRef
841
- }, children, overlayElement);
829
+ };
830
+ if (anchorElements === 1 && isTooltipCompatible(children)) {
831
+ return React__default.createElement(Fragment, null, React__default.Children.map(children, child => {
832
+ return React__default.cloneElement(child, commonProps);
833
+ }), overlayElement);
834
+ }
835
+ return React__default.createElement("div", _extends({
836
+ className: classnames(styles$1k['tooltip'])
837
+ }, commonProps, {
838
+ ref: containerRef
839
+ }), children, overlayElement);
842
840
  };
843
841
  const Tooltip = forwardRef(TooltipElement);
842
+ const isTooltipCompatible = element => {
843
+ return React__default.isValidElement(element) && typeof element.type === 'string';
844
+ };
844
845
 
845
846
  var styles$1i = {"button":"_pgOR3","button--loading":"_2yB9-","button__spinner":"_ppC-S","button--size-min-width-100":"_GtXOQ","button--size-full-width":"_Y-OxO","button--icon-only":"_3EfuT","button--default":"_ICNz7","button--primary":"_XwJWT","button--danger":"_gr3Dh","button--upsell":"_ME8te","button--marketing":"_mI-Dx","button--hollow":"_orywo","button--hollow-contrast":"_obtsl","button--link-contrast":"_00jK4","button--link-primary":"_JPwJ7","button--link-danger":"_9TprN","button--link-upsell":"_tktX-","button--link-toolbar":"_r3SQl","button--link-icon":"_oFBLN","disabled-button-wrapper":"_yTBTz"};
846
847
 
@@ -6837,7 +6838,8 @@ const TextComponent = (_ref, ref) => {
6837
6838
  } = getPositionProps(rest);
6838
6839
  const positionStyles = usePositionStyles(positionProps);
6839
6840
  const {
6840
- dataProps
6841
+ dataProps,
6842
+ otherProps: other
6841
6843
  } = getDataProps(otherProps);
6842
6844
  const elementProps = _extends({
6843
6845
  style: _extends({
@@ -6861,7 +6863,7 @@ const TextComponent = (_ref, ref) => {
6861
6863
  [styles$19['text__span']]: as === TEXT_TYPES.SPAN
6862
6864
  }),
6863
6865
  'data-testid': testId
6864
- }, dataProps, {
6866
+ }, dataProps, other, {
6865
6867
  ref
6866
6868
  });
6867
6869
  // check for TEXT_TYPES that should be a <p> element in the dom