UNPKG

@payfit/unity-components

Version:

57 lines (56 loc) • 1.78 kB
import { IconButton as e } from "../../icon-button/IconButton.js"; import { Text as t } from "../../text/Text.js"; import { useCarousel as n } from "../Carousel.context.js"; import { uyTv as r } from "@payfit/unity-themes"; import { jsx as i, jsxs as a } from "react/jsx-runtime"; import { useTranslation as o } from "react-i18next"; //#region src/core/components/carousel/parts/CarouselNav.tsx var s = r({ slots: { root: "uy:flex uy:items-center uy:gap-50", indicator: "uy:tabular-nums uy:select-none" } }), c = ({ className: r }) => { let { goToNext: c, goToPrev: l, canGoToPrev: u, canGoToNext: d, selectedSnap: f, snapCount: p, a11yIds: m } = n(), { t: h } = o("unity"), { root: g, indicator: _ } = s(); return p === 1 ? null : /* @__PURE__ */ a("div", { className: g({ class: r }), role: "toolbar", "aria-label": h((e) => e.unity.component.carousel.nav.toolbarLabel), "data-unity-slot": "carousel-nav", children: [ /* @__PURE__ */ i(e, { variant: "ghost", color: "neutral", icon: "CaretLeftOutlined", label: h((e) => e.unity.component.carousel.nav.previous.label), onClick: l, isDisabled: !u(), "aria-disabled": !u(), "aria-controls": m.track, id: m.previousButton }), /* @__PURE__ */ a(t, { variant: "body", color: "content.neutral", className: _(), children: [ f + 1, "/", p ] }), /* @__PURE__ */ i(e, { variant: "ghost", color: "neutral", icon: "CaretRightOutlined", label: h((e) => e.unity.component.carousel.nav.next.label), onClick: c, isDisabled: !d(), "aria-disabled": !d(), "aria-controls": m.track, id: m.nextButton }) ] }); }; c.displayName = "CarouselNav"; //#endregion export { c as CarouselNav, s as carouselNav };