import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import * as React from 'react';
import Bubble from '../../bubble/Bubble';
import Text from '../../text/Text';
import Button from '../../buttons/Button';
import Icon from '../../icons/Icon';
import Transition from '../Transition';
import Stage from './common/Stage';
var fadeEffect = {
  initial: {
    opacity: 0
  },
  animate: {
    opacity: 1,
    duration: 'moderate1',
    easing: 'entry'
  },
  exit: {
    opacity: 0,
    duration: 'quick2',
    easing: 'exit'
  }
};
var containerSlideEffect = {
  initial: {
    opacity: 0,
    transform: {
      translateY: '-m',
      scaleY: 0.5
    }
  },
  animate: {
    opacity: {
      value: 1,
      duration: 'quick2'
    },
    transform: {
      translateY: 0,
      duration: 'gentle1',
      origin: 'left top'
    },
    easing: 'entry'
  },
  exit: {
    opacity: 0,
    transform: {
      translateY: '-m'
    },
    duration: 'quick2',
    easing: 'exit'
  }
};
/**
 * A content transformation opposite to the container
 * transformation will keep the height of the content
 * while animating the container.
 */

var contentCounterSlideEffect = {
  initial: {
    // counter scale...
    transform: {
      scaleY: 1.5
    }
  },
  animate: {
    // with the same duration and easing as container
    transform: {
      scaleY: 1,
      duration: 'gentle1',
      origin: 'left top'
    },
    easing: 'entry'
  },
  exit: {
    opacity: 0,
    duration: 'quick2',
    easing: 'exit'
  }
};
export var OffsetBehavior = function OffsetBehavior() {
  var _React$useState = React.useState(false),
      _React$useState2 = _slicedToArray(_React$useState, 2),
      open = _React$useState2[0],
      setOpen = _React$useState2[1];

  return /*#__PURE__*/React.createElement(Stage, {
    format: "portrait"
  }, /*#__PURE__*/React.createElement(Transition, {
    active: open,
    effect: containerSlideEffect
  }, /*#__PURE__*/React.createElement(Bubble, {
    color: "blue-30",
    direction: "top",
    style: {
      padding: 24,
      marginTop: 64
    },
    noShadow: true
  }, /*#__PURE__*/React.createElement(Transition, {
    active: open,
    effect: fadeEffect,
    fillMode: "backwards",
    delay: 100
  }, /*#__PURE__*/React.createElement(Transition, {
    active: open,
    effect: contentCounterSlideEffect,
    fillMode: "backwards",
    className: "sg-space-y-s"
  }, /*#__PURE__*/React.createElement(Text, {
    size: "small",
    weight: "bold"
  }, "Louis Napoleon Bonaparte was the nephew of Napoleon Bonaparte."), /*#__PURE__*/React.createElement(Text, {
    size: "small"
  }, "Napoleon III, the nephew of Napoleon I, was the first elected President of France from 1848 to 1852. Louis Napoleon seized power in 1851 and served as Emperor of the French from 1852 to 1870. He founded the Second French Empire and was its only emperor until the French army was defeated in the Franco-Prussian War in 1870."), /*#__PURE__*/React.createElement(Text, {
    size: "small"
  }, "He aimed to modernize the French economy, rebuilt the center of Paris, expanded the overseas empire."))))), /*#__PURE__*/React.createElement(Button, {
    variant: "solid",
    icon: /*#__PURE__*/React.createElement(Icon, {
      type: open ? 'close' : 'plus'
    }),
    onClick: function onClick() {
      return setOpen(function (b) {
        return !b;
      });
    },
    iconOnly: true,
    style: {
      position: 'absolute',
      top: 24,
      left: '50%',
      marginLeft: -20
    }
  }));
};
OffsetBehavior.parameters = {
  layout: 'centered'
};