"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _clsx = _interopRequireDefault(require("clsx"));
var _element = require("@wordpress/element");
var _label = _interopRequireDefault(require("./label"));
var _utils = require("./utils");
var _resizeTooltip = require("./styles/resize-tooltip.styles");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * External dependencies
 */

/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

const noop = () => {};
function ResizeTooltip({
  axis,
  className,
  fadeTimeout = 180,
  isVisible = true,
  labelRef,
  onResize = noop,
  position = _utils.POSITIONS.bottom,
  showPx = true,
  zIndex = 1000,
  ...props
}, ref) {
  const {
    label,
    resizeListener
  } = (0, _utils.useResizeLabel)({
    axis,
    fadeTimeout,
    onResize,
    showPx,
    position
  });
  if (!isVisible) {
    return null;
  }
  const classes = (0, _clsx.default)('components-resize-tooltip', className);
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_resizeTooltip.Root, {
    "aria-hidden": "true",
    className: classes,
    ref: ref,
    ...props,
    children: [resizeListener, /*#__PURE__*/(0, _jsxRuntime.jsx)(_label.default, {
      "aria-hidden": props['aria-hidden'],
      label: label,
      position: position,
      ref: labelRef,
      zIndex: zIndex
    })]
  });
}
const ForwardedComponent = (0, _element.forwardRef)(ResizeTooltip);
var _default = exports.default = ForwardedComponent;
//# sourceMappingURL=index.js.map