@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.
package/dist/index.js CHANGED
@@ -828,7 +828,7 @@ var TooltipElement = function TooltipElement(_ref, forwardedRef) {
828
828
  * Checking if is a tooltip on a cell because it is probably the DataTableEditableCell.
829
829
  * We can't change the div structure (unmounting/mounting tooltip) otherwise the cell input will lose focus
830
830
  */
831
- var isTableCell = anchorElements === 1 && children.props.role === 'cell';
831
+ var isTableCell = anchorElements === 1 && React__default["default"].isValidElement(children) && children.props.role === 'cell';
832
832
  if (!overlay && !header && !isTableCell || anchorElements === 0) {
833
833
  return children;
834
834
  }
@@ -850,27 +850,28 @@ var TooltipElement = function TooltipElement(_ref, forwardedRef) {
850
850
  testId: testId,
851
851
  maxHeight: maxHeight
852
852
  }, theme === TOOLTIP_THEME.BLACK && !header ? null : overlay) : null;
853
- if (React__default["default"].Children.count(children) === 1) {
854
- return React__default["default"].createElement(React.Fragment, null, React__default["default"].Children.map(children, function (child) {
855
- return React__default["default"].cloneElement(child, {
856
- onMouseEnter: openTooltip,
857
- onMouseLeave: closeTooltipWithDelay,
858
- onFocus: openTooltip,
859
- onBlur: closeTooltipWithDelay,
860
- ref: containerRef
861
- });
862
- }), overlayElement);
863
- }
864
- return React__default["default"].createElement("div", {
865
- className: classnames__default["default"](styles$1k['tooltip']),
853
+ var commonProps = {
866
854
  onMouseEnter: openTooltip,
867
855
  onMouseLeave: closeTooltipWithDelay,
868
856
  onFocus: openTooltip,
869
857
  onBlur: closeTooltipWithDelay,
870
858
  ref: containerRef
871
- }, children, overlayElement);
859
+ };
860
+ if (anchorElements === 1 && isTooltipCompatible(children)) {
861
+ return React__default["default"].createElement(React.Fragment, null, React__default["default"].Children.map(children, function (child) {
862
+ return React__default["default"].cloneElement(child, commonProps);
863
+ }), overlayElement);
864
+ }
865
+ return React__default["default"].createElement("div", _extends({
866
+ className: classnames__default["default"](styles$1k['tooltip'])
867
+ }, commonProps, {
868
+ ref: containerRef
869
+ }), children, overlayElement);
872
870
  };
873
871
  var Tooltip = React.forwardRef(TooltipElement);
872
+ var isTooltipCompatible = function isTooltipCompatible(element) {
873
+ return React__default["default"].isValidElement(element) && typeof element.type === 'string';
874
+ };
874
875
 
875
876
  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"};
876
877
 
@@ -6687,7 +6688,8 @@ var TextComponent = function TextComponent(_ref, ref) {
6687
6688
  otherProps = _getPositionProps.otherProps;
6688
6689
  var positionStyles = usePositionStyles(positionProps);
6689
6690
  var _getDataProps = getDataProps(otherProps),
6690
- dataProps = _getDataProps.dataProps;
6691
+ dataProps = _getDataProps.dataProps,
6692
+ other = _getDataProps.otherProps;
6691
6693
  var elementProps = _extends({
6692
6694
  style: _extends({
6693
6695
  color: getColor(color),
@@ -6695,7 +6697,7 @@ var TextComponent = function TextComponent(_ref, ref) {
6695
6697
  }, positionStyles),
6696
6698
  className: classnames__default["default"](styles$19['text'], (_classnames = {}, _classnames[styles$19['text--bold']] = emphasis == null ? void 0 : emphasis.includes(FONT_EMPHASIS.BOLD), _classnames[styles$19['text--italic']] = emphasis == null ? void 0 : emphasis.includes(FONT_EMPHASIS.ITALIC), _classnames[styles$19['text--underline']] = emphasis == null ? void 0 : emphasis.includes(FONT_EMPHASIS.UNDERLINE), _classnames[styles$19['text--dotted-underline']] = emphasis == null ? void 0 : emphasis.includes(FONT_EMPHASIS.DOTTED_UNDERLINE), _classnames[styles$19['text--monospace']] = emphasis == null ? void 0 : emphasis.includes(FONT_EMPHASIS.MONOSPACE), _classnames[styles$19['text--line-through']] = emphasis == null ? void 0 : emphasis.includes(FONT_EMPHASIS.STRIKETHROUGH), _classnames[styles$19['text--align-left']] = alignment === ALIGNMENTS.LEFT, _classnames[styles$19['text--align-right']] = alignment === ALIGNMENTS.RIGHT, _classnames[styles$19['text--align-center']] = alignment === ALIGNMENTS.CENTER, _classnames[styles$19['text--align-justify']] = alignment === ALIGNMENTS.JUSTIFY, _classnames[styles$19['text__body']] = as === TEXT_TYPES.BODY, _classnames[styles$19['text__insight']] = as === TEXT_TYPES.INSIGHT, _classnames[styles$19['text__caption']] = as === TEXT_TYPES.CAPTION, _classnames[styles$19['text__span']] = as === TEXT_TYPES.SPAN, _classnames)),
6697
6699
  'data-testid': testId
6698
- }, dataProps, {
6700
+ }, dataProps, other, {
6699
6701
  ref: ref
6700
6702
  });
6701
6703
  // check for TEXT_TYPES that should be a <p> element in the dom