UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

70 lines (69 loc) 2.6 kB
import { jsx as a } from "../../../external/preact/jsx-runtime/dist/jsxRuntime.module.js"; import { ButtonVariant as s } from "../Button/types.js"; import g from "../../../core/Context/useCoreContext.js"; import b from "classnames"; import { useMemo as h, useCallback as v } from "../../../external/preact/hooks/dist/hooks.module.js"; /* empty css */ import C from "../SVGIcons/ChevronLeft.js"; import _ from "../SVGIcons/ChevronRight.js"; import { Fragment as T } from "../../../external/preact/dist/preact.module.js"; import R from "../FormFields/Select/Select.js"; import d from "../Button/Button.js"; import { isNullish as N } from "../../../utils/value/is.js"; import { EMPTY_ARRAY as c } from "../../../utils/value/constants.js"; function w({ next: m, hasNext: n, hasPrev: o, prev: p, limit: f, limitOptions: t, onLimitSelection: i }) { const { i18n: r } = g(), l = h( () => t && Object.freeze(t.map((e) => ({ id: `${e}`, name: `${e}` }))), [t] ), u = v( ({ target: e }) => { N(e == null ? void 0 : e.value) || i == null || i(+e.value); }, [i] ); return /* @__PURE__ */ a("div", { "aria-label": r.get("paginatedNavigation"), className: `adyen-pe-pagination ${b({})}`, children: [ /* @__PURE__ */ a("div", { className: "adyen-pe-pagination__context", children: l && i && /* @__PURE__ */ a(T, { children: [ /* @__PURE__ */ a("span", { children: r.get("pagination.showing") }), /* @__PURE__ */ a("div", { className: "adyen-pe-pagination__limit-selector", children: /* @__PURE__ */ a( R, { setToTargetWidth: !0, filterable: !1, multiSelect: !1, items: l, onChange: u, selected: `${f ?? ""}` } ) }) ] }) }), /* @__PURE__ */ a("div", { className: "adyen-pe-pagination__controls", children: [ /* @__PURE__ */ a( d, { "aria-label": r.get("pagination.previousPage"), variant: s.TERTIARY, disabled: !o, iconButton: !0, classNameModifiers: ["circle"].concat(o ? c : "disabled"), onClick: p, children: /* @__PURE__ */ a(C, { disabled: !o }) } ), /* @__PURE__ */ a( d, { "aria-label": r.get("pagination.nextPage"), variant: s.TERTIARY, disabled: !n, iconButton: !0, classNameModifiers: ["circle"].concat(n ? c : "disabled"), onClick: m, children: /* @__PURE__ */ a(_, { disabled: !n }) } ) ] }) ] }); } export { w as default };