UNPKG

@hitachivantara/uikit-react-core

Version:

Core React components for the NEXT Design System.

63 lines (62 loc) 2.27 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const jsxRuntime = require("react/jsx-runtime"); const React = require("react"); const uikitReactUtils = require("@hitachivantara/uikit-react-utils"); const helpers = require("../utils/helpers.cjs"); const DotPagination_styles = require("./DotPagination.styles.cjs"); const RadioGroup = require("../RadioGroup/RadioGroup.cjs"); const BaseRadio = require("../BaseRadio/BaseRadio.cjs"); const currentStep = /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 8 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) }); const otherStep = /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 4 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) }); const getSelectorIcons = (radioIcon, radioCheckedIcon, classes) => { return { radio: React.cloneElement(radioIcon || otherStep, { className: classes?.icon }), radioChecked: React.cloneElement(radioCheckedIcon || currentStep, { className: classes?.icon }) }; }; const HvDotPagination = (props) => { const { className, classes: classesProp, unselectedIcon, selectedIcon, pages = 1, page = 0, onPageChange, getItemAriaLabel, ...others } = uikitReactUtils.useDefaultProps("HvDotPagination", props); const { classes, cx } = DotPagination_styles.useClasses(classesProp); const icons = getSelectorIcons(unselectedIcon, selectedIcon, classes); return /* @__PURE__ */ jsxRuntime.jsx( RadioGroup.HvRadioGroup, { className: cx(classes.root, className), classes: { horizontal: classes.horizontal }, orientation: "horizontal", ...others, children: helpers.range(pages).map((i) => /* @__PURE__ */ jsxRuntime.jsx( BaseRadio.HvBaseRadio, { className: cx(classes.radioRoot, classes.radio), value: i, checked: page === i, onChange: (event) => onPageChange?.(event, i), icon: icons.radio, checkedIcon: icons.radioChecked, inputProps: { "aria-label": getItemAriaLabel?.(i) } }, i )) } ); }; exports.dotPaginationClasses = DotPagination_styles.staticClasses; exports.HvDotPagination = HvDotPagination;