{"size": 4457, "ext": "js", "max_stars_repo_path": "webcaptcha/frontend/node_modules/@auth0/cosmos/molecules/pager/pager.js", "max_stars_repo_name": "jelauria/team-418-teapot", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "webcaptcha/frontend/node_modules/@auth0/cosmos/molecules/pager/pager.js", "max_issues_repo_name": "jelauria/team-418-teapot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "webcaptcha/frontend/node_modules/@auth0/cosmos/molecules/pager/pager.js", "max_forks_repo_name": "jelauria/team-418-teapot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 56.417721519, "max_line_length": 316, "alphanum_fraction": 0.6210455463}
"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
            t[p[i]] = s[p[i]];
    return t;
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var automation_attribute_1 = __importDefault(require("../../_helpers/automation-attribute"));
var container_styles_1 = __importDefault(require("../../_helpers/container-styles"));
var pagination_1 = require("../../_helpers/pagination");
var button_1 = __importDefault(require("../../atoms/button"));
var styled_1 = __importDefault(require("../../styled"));
var Pager = function (_a) {
    var onPageChanged = _a.onPageChanged, page = _a.page, perPage = _a.perPage, items = _a.items, showInfo = _a.showInfo, props = __rest(_a, ["onPageChanged", "page", "perPage", "items", "showInfo"]);
    var inFirstPage = page === 1;
    var inLastPage = showInfo && items && perPage ? pagination_1.pagesFromItems(items, perPage) === page : false;
    var nextPageEnabled = (typeof items === 'undefined' || items > 0) && !inLastPage;
    var ignoreNextPageCheck = !items;
    return (React.createElement(Pager.Element, __assign({}, automation_attribute_1.default('pager'), props),
        React.createElement(button_1.default, { size: "compressed", appearance: "secondary", disabled: inFirstPage, onClick: function () {
                return pagination_1.changePageIfAppropiate({
                    rawNextPage: page - 1,
                    total: items,
                    perPage: perPage,
                    onPageChanged: onPageChanged,
                    ignoreNextPageCheck: ignoreNextPageCheck
                });
            }, icon: "chevron-left" }, "Newer"),
        React.createElement(Pager.PageSelector, null,
            showInfo && items ? pagination_1.totals(page, perPage, items) : null,
            showInfo && !items ? "Page " + page : null),
        React.createElement(button_1.default, { size: "compressed", appearance: "secondary", disabled: !nextPageEnabled, icon: "chevron-right", iconAlign: "right", onClick: function () {
                return pagination_1.changePageIfAppropiate({
                    rawNextPage: page + 1,
                    total: items,
                    perPage: perPage,
                    onPageChanged: onPageChanged,
                    ignoreNextPageCheck: ignoreNextPageCheck
                });
            } }, "Older")));
};
Pager.defaultProps = {
    showInfo: true
};
Pager.Element = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  ", ";\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n"], ["\n  ", ";\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n"])), container_styles_1.default);
Pager.PageSelector = styled_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n"], ["\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n"])));
exports.default = Pager;
var templateObject_1, templateObject_2;
//# sourceMappingURL=pager.js.map