UNPKG

@kubit-ui-web/react-components

Version:

Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience

18 lines 2.13 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import React from 'react'; import { Text } from '../../components/text/text'; import { TextComponentType } from '../../components/text/types/component'; import { ROLES } from '../../types/role/role'; import { ButtonType } from '../button/types/type'; import { PaginationButtonControl } from './fragments/paginationButtonControl'; import { PaginationContainerStyled, PaginationPageContainerStyled, PaginationPagesContainerStyled, } from './pagination.styled'; import { PaginationState } from './types/state'; const PaginationStandAloneComponent = ({ styles, stepActive, stepsNumber, onStepClick, paginationLeftButtonControl, paginationRightButtonControl, leftDisabled, rightDisabled, dataTestId = 'pagination', }, ref) => { return (_jsxs(PaginationContainerStyled, { ref: ref, "data-testid": dataTestId, styles: styles, children: [_jsx(PaginationButtonControl, { disabled: leftDisabled, paginationButtonControl: paginationLeftButtonControl, styles: styles.paginationLeftArrowIcon }), _jsx(PaginationPagesContainerStyled, { "data-testid": `${dataTestId}-steps-content`, styles: styles, children: stepsNumber.map((value, index) => { const state = stepActive === index ? PaginationState.SELECTED : PaginationState.DEFAULT; const isClickable = typeof value === 'number'; return (_jsx(PaginationPageContainerStyled, { "$isClickable": isClickable, as: isClickable ? ROLES.BUTTON : undefined, state: state, styles: styles, type: isClickable ? ButtonType.BUTTON : undefined, onClick: isClickable ? onStepClick?.(value - 1) : undefined, children: _jsx(Text, { component: TextComponentType.SPAN, customTypography: styles[state]?.page, children: value }) }, `PaginationContent-${index}`)); }) }), _jsx(PaginationButtonControl, { disabled: rightDisabled, paginationButtonControl: paginationRightButtonControl, styles: styles.paginationRightArrowIcon })] })); }; export const PaginationStandAlone = React.forwardRef(PaginationStandAloneComponent); //# sourceMappingURL=paginationStandAlone.js.map