{"version":3,"file":"LoadMorePaginator.mjs","names":[],"sources":["../../../../src/components/LoadMore/LoadMorePaginator.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport React from 'react';\n\nimport type { LoadMoreButtonProps } from './LoadMoreButton';\nimport { LoadMoreButton as DefaultLoadMoreButton } from './LoadMoreButton';\nimport type { PaginatorProps } from '../../types/types';\n\nexport type LoadMorePaginatorProps = PaginatorProps & {\n  /** Replaces the default button. Receives `isLoading` and `onClick` set to `loadNextPage`. */\n  LoadMoreButton?: React.ComponentType<LoadMoreButtonProps>;\n  /** Places the button above `children` instead of below. */\n  reverse?: boolean;\n};\n\nexport const UnMemoizedLoadMorePaginator = (\n  props: PropsWithChildren<LoadMorePaginatorProps>,\n) => {\n  const {\n    children,\n    hasNextPage,\n    isLoading,\n    LoadMoreButton = DefaultLoadMoreButton,\n    loadNextPage,\n    reverse,\n  } = props;\n\n  return (\n    <>\n      {!reverse && children}\n      {hasNextPage && <LoadMoreButton isLoading={isLoading} onClick={loadNextPage} />}\n      {reverse && children}\n    </>\n  );\n};\n\nexport const LoadMorePaginator = React.memo(\n  UnMemoizedLoadMorePaginator,\n) as typeof UnMemoizedLoadMorePaginator;\n"],"mappings":";;;;AAcA,IAAa,+BACX,UACG;CACH,MAAM,EACJ,UACA,aACA,WACA,gBAAA,mBAAiB,gBACjB,cACA,YACE;CAEJ,OACE,qBAAA,YAAA,EAAA,UAAA;EACG,CAAC,WAAW;EACZ,eAAe,oBAAC,kBAAD;GAA2B;GAAW,SAAS;EAAe,CAAA;EAC7E,WAAW;CACZ,EAAA,CAAA;AAEN;AAEA,IAAa,oBAAoB,MAAM,KACrC,2BACF"}