import React from 'react';
import { useTranslation } from '../hooks/use-translation';
import { Message, MESSAGE_TYPES } from '../message';
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
export const wrapperClassName = 'smooth-transition-content';
export const hiddenWrapperClassName = 'smooth-transition-content-hidden';
/** The component designed to render loading state for charts
 * @midnight-gray-supported
 * @alpine-light-supported
 */
export function SmoothTransitionLoader({
  children,
  isLoading,
  loadingMessage,
  loaderTestId = 'smooth-transition-prerender-loader',
  wrapperTestId = 'smooth-transition-prerender-wrapper'
}) {
  const {
    t
  } = useTranslation();
  const loader = /*#__PURE__*/_jsx("div", {
    className: "smooth-transition-prerender-loader",
    "test-id": loaderTestId,
    children: /*#__PURE__*/_jsx(Message, {
      type: MESSAGE_TYPES.IN_PROGRESS,
      isCentered: true,
      children: loadingMessage ?? t('Initializing Data')
    })
  });
  if (!children) {
    return loader;
  }
  return /*#__PURE__*/_jsxs(_Fragment, {
    children: [isLoading && loader, /*#__PURE__*/_jsx("div", {
      "test-id": wrapperTestId,
      className: isLoading ? hiddenWrapperClassName : wrapperClassName,
      children: children
    })]
  });
}