"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PageIndicator = void 0;
var _react = _interopRequireWildcard(require("react"));
var _nativeProps = require("../../utils/native-props");
var _classnames = _interopRequireDefault(require("classnames"));
var _withDefaultProps = require("../../utils/with-default-props");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const classPrefix = `adm-page-indicator`;
const defaultProps = {
  color: 'primary',
  direction: 'horizontal'
};
const PageIndicator = exports.PageIndicator = (0, _react.memo)(p => {
  const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
  const dots = [];
  for (let i = 0; i < props.total; i++) {
    dots.push(_react.default.createElement("div", {
      key: i,
      className: (0, _classnames.default)(`${classPrefix}-dot`, {
        [`${classPrefix}-dot-active`]: props.current === i
      })
    }));
  }
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
    className: (0, _classnames.default)(classPrefix, `${classPrefix}-${props.direction}`, `${classPrefix}-color-${props.color}`)
  }, dots));
});