"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.FullscreenPopupDecorator = exports.FullscreenPopupBase = exports.FullscreenPopup = exports["default"] = void 0;

var _jsxRuntime = require("react/jsx-runtime");

var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));

var _kind = _interopRequireDefault(require("@enact/core/kind"));

var _Transition = _interopRequireDefault(require("@enact/ui/Transition"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _compose = _interopRequireDefault(require("ramda/src/compose"));

var _PopupState = _interopRequireDefault(require("../Popup/PopupState"));

var _Skinnable = _interopRequireDefault(require("../Skinnable"));

var _FullscreenPopupModule = _interopRequireDefault(require("./FullscreenPopup.module.css"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

/**
 * Full screen popup component.
 *
 * Usage:
 * ```
 * <FullscreenPopup open>
 *   Hello Fullscreen Popup
 * </FullscreenPopup>
 * ```
 *
 * @class FullscreenPopupBase
 * @memberof agate/FullscreenPopup
 * @extends ui/Transition.Transition
 * @ui
 * @public
 */
var FullscreenPopupBase = (0, _kind["default"])({
  name: 'FullscreenPopup',
  propTypes:
  /** @lends agate/FullscreenPopup.FullscreenPopupBase.prototype */
  {
    css: _propTypes["default"].object,
    direction: _propTypes["default"].string,
    duration: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].string]),
    noAnimation: _propTypes["default"].bool,
    onHide: _propTypes["default"].func,
    open: _propTypes["default"].bool,
    type: _propTypes["default"].string
  },
  defaultProps: {
    direction: 'down',
    duration: 'short',
    noAnimation: false,
    open: false,
    type: 'slide'
  },
  styles: {
    css: _FullscreenPopupModule["default"],
    className: 'fullscreenPopup'
  },
  computed: {
    className: function className(_ref) {
      var styler = _ref.styler;
      return styler.append('enact-fit');
    }
  },
  render: (0, _deprecate["default"])(function (_ref2) {
    var children = _ref2.children,
        className = _ref2.className,
        css = _ref2.css,
        direction = _ref2.direction,
        duration = _ref2.duration,
        noAnimation = _ref2.noAnimation,
        onHide = _ref2.onHide,
        open = _ref2.open,
        type = _ref2.type,
        rest = _objectWithoutProperties(_ref2, ["children", "className", "css", "direction", "duration", "noAnimation", "onHide", "open", "type"]);

    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Transition["default"], {
      className: className,
      css: css,
      direction: direction,
      duration: duration,
      noAnimation: noAnimation,
      onHide: onHide,
      type: type,
      visible: open,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
        children: children
      }))
    });
  }, {
    name: 'agate/FullscreenPopup',
    replacedBy: 'agate/Popup',
    until: '2.0.0'
  })
});
/**
 * Applies Agate specific behaviors to [FullscreenPopupBase]{@link agate/FullscreenPopup.FullscreenPopupBase}.
 *
 * @hoc
 * @memberof agate/FullscreenPopup
 * @mixes agate/Skinnable.Skinnable
 * @public
 */

exports.FullscreenPopupBase = FullscreenPopupBase;
var FullscreenPopupDecorator = (0, _compose["default"])((0, _Skinnable["default"])({
  prop: 'skin'
}), _PopupState["default"]);
/**
 * Full screen popup component, ready to use in Agate applications.
 *
 * @class FullscreenPopup
 * @memberof agate/FullscreenPopup
 * @extends agate/FullscreenPopup.FullscreenPopupBase
 * @mixes agate/FullscreenPopup.FullscreenPopupDecorator
 * @ui
 * @public
 */

exports.FullscreenPopupDecorator = FullscreenPopupDecorator;
var FullscreenPopup = FullscreenPopupDecorator(FullscreenPopupBase);
exports.FullscreenPopup = FullscreenPopup;
var _default = FullscreenPopup;
exports["default"] = _default;