'use strict';

var clsx = require('clsx');
var reactIntl = require('react-intl');
require('../common/theme.js');
require('../common/direction.js');
require('../common/propsValues/control.js');
var breakpoint = require('../common/propsValues/breakpoint.js');
require('../common/propsValues/size.js');
require('../common/propsValues/typography.js');
require('../common/propsValues/width.js');
require('../common/propsValues/type.js');
require('../common/propsValues/dateMode.js');
require('../common/propsValues/monthFormat.js');
require('../common/propsValues/position.js');
var layouts = require('../common/propsValues/layouts.js');
require('../common/propsValues/status.js');
require('../common/propsValues/sentiment.js');
require('../common/propsValues/profileType.js');
require('../common/propsValues/variant.js');
require('../common/propsValues/scroll.js');
require('../common/propsValues/markdownNodeType.js');
require('../common/fileType.js');
var CloseButton = require('../common/closeButton/CloseButton.js');
var FlowHeader = require('../common/flowHeader/FlowHeader.js');
var Logo = require('../logo/Logo.js');
var Stepper = require('../stepper/Stepper.js');
var useScreenSize = require('../common/hooks/useScreenSize.js');
var FlowNavigation_messages = require('./FlowNavigation.messages.js');
var AnimatedLabel = require('./animatedLabel/AnimatedLabel.js');
var BackButton = require('./backButton/BackButton.js');
var jsxRuntime = require('react/jsx-runtime');

const FlowNavigation = ({
  activeStep = 0,
  avatar,
  logo = /*#__PURE__*/jsxRuntime.jsx(Logo.default, {}),
  done = false,
  onClose,
  onGoBack,
  steps
}) => {
  const intl = reactIntl.useIntl();
  const closeButton = onClose != null && /*#__PURE__*/jsxRuntime.jsx(CloseButton.CloseButton, {
    size: "lg",
    onClick: onClose
  });
  const screenSm = useScreenSize.useScreenSize(breakpoint.Breakpoint.SMALL);
  const screenLg = useScreenSize.useScreenSize(breakpoint.Breakpoint.LARGE);
  const newAvatar = done ? null : avatar;
  const displayGoBack = onGoBack != null && activeStep > 0;
  return /*#__PURE__*/jsxRuntime.jsx("div", {
    className: clsx.clsx('np-flow-navigation d-flex align-items-center justify-content-center p-y-3', {
      'np-flow-navigation--border-bottom': !done
    }),
    children: /*#__PURE__*/jsxRuntime.jsx(FlowHeader, {
      className: clsx.clsx('np-flow-navigation__content p-x-3', screenSm == null ? 'np-flow-navigation--hidden' : {
        'np-flow-navigation--xs-max': !screenSm,
        // Size switches on parent container which may or may not have the same size as the window.
        'np-flow-navigation--sm': screenSm,
        'np-flow-navigation--lg': screenLg
      }),
      leftContent: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
        children: [!screenSm && displayGoBack ? /*#__PURE__*/jsxRuntime.jsx(BackButton, {
          "aria-label": intl.formatMessage(FlowNavigation_messages.back),
          onClick: onGoBack
        }) : /*#__PURE__*/jsxRuntime.jsx("div", {
          className: "np-flow-header__left",
          children: logo
        }), !screenSm && !done && /*#__PURE__*/jsxRuntime.jsx(AnimatedLabel, {
          className: "m-x-1",
          steps: steps,
          activeLabel: activeStep
        })]
      }),
      rightContent: /*#__PURE__*/jsxRuntime.jsxs("div", {
        className: "np-flow-header__right d-flex align-items-center justify-content-end order-2--lg",
        children: [newAvatar, newAvatar && closeButton && /*#__PURE__*/jsxRuntime.jsx("span", {
          className: "m-x-1"
        }), closeButton]
      }),
      bottomContent: !done && /*#__PURE__*/jsxRuntime.jsx(Stepper, {
        activeStep: activeStep,
        steps: steps,
        className: clsx.clsx('np-flow-navigation__stepper')
      }),
      layout: !screenLg ? layouts.Layout.VERTICAL : layouts.Layout.HORIZONTAL
    })
  });
};

module.exports = FlowNavigation;
//# sourceMappingURL=FlowNavigation.js.map
