'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TextTracker = undefined;

var _react = require('react');

var React = _interopRequireWildcard(_react);

var _compose = require('recompose/compose');

var _compose2 = _interopRequireDefault(_compose);

var _setDisplayName = require('recompose/setDisplayName');

var _setDisplayName2 = _interopRequireDefault(_setDisplayName);

var _withStepper = require('./with-stepper');

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

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

var defaultGenerateText = function defaultGenerateText(current, total) {
  return 'Step ' + (current + 1) + ' of ' + total;
};
/**
 * A component for tracking the current and total pages
 * using a text.
 *
 * ### Usage
 * ```
 * <TextTracker />
 * ```
 *
 * ### Options
 * The default behavior is to render a tect in the format `Step 1 of 2`.
 * To render in a different format, pass a function in the generateText property
 * that takes the current and total number of pages as arguments and returns
 * the text to be rendered.
 *
 * For example
 * ```
 * (current, total) => `${current + 1} / ${total}`
 * ```
 * will render `1 / 2`. Note that the current page is zero based.
 */
var TextTracker = exports.TextTracker = (0, _compose2.default)(_withStepper.withStepper, (0, _setDisplayName2.default)('TextTracker'))(function (_ref) {
  var pages = _ref.pages,
      currentPage = _ref.currentPage,
      _ref$generateText = _ref.generateText,
      generateText = _ref$generateText === undefined ? defaultGenerateText : _ref$generateText,
      style = _ref.style;
  return React.createElement("span", { style: style }, generateText(currentPage, pages.length));
});
//# sourceMappingURL=text-tracker.js.map
