@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
24 lines • 2.59 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaginationStandAlone = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const text_1 = require("../../components/text/text");
const component_1 = require("../../components/text/types/component");
const role_1 = require("../../types/role/role");
const type_1 = require("../button/types/type");
const paginationButtonControl_1 = require("./fragments/paginationButtonControl");
const pagination_styled_1 = require("./pagination.styled");
const state_1 = require("./types/state");
const PaginationStandAloneComponent = ({ styles, stepActive, stepsNumber, onStepClick, paginationLeftButtonControl, paginationRightButtonControl, leftDisabled, rightDisabled, dataTestId = 'pagination', }, ref) => {
return ((0, jsx_runtime_1.jsxs)(pagination_styled_1.PaginationContainerStyled, { ref: ref, "data-testid": dataTestId, styles: styles, children: [(0, jsx_runtime_1.jsx)(paginationButtonControl_1.PaginationButtonControl, { disabled: leftDisabled, paginationButtonControl: paginationLeftButtonControl, styles: styles.paginationLeftArrowIcon }), (0, jsx_runtime_1.jsx)(pagination_styled_1.PaginationPagesContainerStyled, { "data-testid": `${dataTestId}-steps-content`, styles: styles, children: stepsNumber.map((value, index) => {
const state = stepActive === index ? state_1.PaginationState.SELECTED : state_1.PaginationState.DEFAULT;
const isClickable = typeof value === 'number';
return ((0, jsx_runtime_1.jsx)(pagination_styled_1.PaginationPageContainerStyled, { "$isClickable": isClickable, as: isClickable ? role_1.ROLES.BUTTON : undefined, state: state, styles: styles, type: isClickable ? type_1.ButtonType.BUTTON : undefined, onClick: isClickable ? onStepClick?.(value - 1) : undefined, children: (0, jsx_runtime_1.jsx)(text_1.Text, { component: component_1.TextComponentType.SPAN, customTypography: styles[state]?.page, children: value }) }, `PaginationContent-${index}`));
}) }), (0, jsx_runtime_1.jsx)(paginationButtonControl_1.PaginationButtonControl, { disabled: rightDisabled, paginationButtonControl: paginationRightButtonControl, styles: styles.paginationRightArrowIcon })] }));
};
exports.PaginationStandAlone = react_1.default.forwardRef(PaginationStandAloneComponent);
//# sourceMappingURL=paginationStandAlone.js.map