/*!
 * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */

import { memo } from "react";
import { Box } from "../Box.js";
import { Button } from "../Buttons/Button.js";
import { ArrowLeftIcon, ArrowRightIcon } from "../icons.generated/index.js";
import { Support } from "../Typography.js";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
export const paginationTypeValues = ["paged", "loadMore"];
const DataTablePagination = ({
  currentPage,
  currentNumberOfResults,
  isNextButtonDisabled,
  isPreviousButtonDisabled,
  onClickNext,
  onClickPrevious,
  paginationType
}) => {
  return _jsx(Box, {
    sx: {
      display: "flex",
      gap: 4,
      alignItems: "center"
    },
    children: paginationType === "loadMore" ? _jsxs(_Fragment, {
      children: [_jsx(Button, {
        isDisabled: isNextButtonDisabled,
        label: "Show more",
        onClick: onClickNext,
        variant: "secondary"
      }), currentNumberOfResults && _jsxs(Support, {
        color: "textSecondary",
        children: [currentNumberOfResults, " results"]
      })]
    }) : _jsxs(_Fragment, {
      children: [_jsx(Button, {
        isDisabled: isPreviousButtonDisabled,
        label: "Previous",
        onClick: onClickPrevious,
        startIcon: _jsx(ArrowLeftIcon, {}),
        variant: "secondary"
      }), currentPage && _jsx(Box, {
        children: _jsxs(Support, {
          color: "textSecondary",
          component: "span",
          children: ["Page ", currentPage]
        })
      }), _jsx(Button, {
        endIcon: _jsx(ArrowRightIcon, {}),
        isDisabled: isNextButtonDisabled,
        label: "Next",
        onClick: onClickNext,
        variant: "secondary"
      })]
    })
  });
};
const MemoizedDataTablePagination = memo(DataTablePagination);
MemoizedDataTablePagination.displayName = "DataTablePagination";
export { MemoizedDataTablePagination as DataTablePagination };
//# sourceMappingURL=DataTablePagination.js.map