UNPKG

@payfit/unity-components

Version:

66 lines (65 loc) 1.94 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 { useIntl as o } from "react-intl"; //#region src/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(), h = o(), { root: g, indicator: _ } = s(); return p === 1 ? null : /* @__PURE__ */ a("div", { className: g({ class: r }), role: "toolbar", "aria-label": h.formatMessage({ id: "unity:component:carousel:nav:toolbar-label", defaultMessage: "Carousel navigation" }), "data-unity-slot": "carousel-nav", children: [ /* @__PURE__ */ i(e, { variant: "ghost", color: "neutral", icon: "CaretLeftOutlined", label: h.formatMessage({ id: "unity:component:carousel:nav:previous:label", defaultMessage: "Go to previous slide" }), 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.formatMessage({ id: "unity:component:carousel:nav:next:label", defaultMessage: "Go to next slide" }), 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 };