UNPKG

@progress/kendo-react-buttons

Version:

All you need in React Button in one package: disabled/enabled states, built-in styles and more. KendoReact Buttons package

50 lines (49 loc) 1.92 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as a from "react"; import { classNames as b, SvgIcon as k } from "@progress/kendo-react-common"; import { useLocalization as f } from "@progress/kendo-react-intl"; import { prevArrowTitle as l, messages as c, nextArrowTitle as i } from "../messages/index.mjs"; import { caretAltLeftIcon as g, caretAltRightIcon as v } from "@progress/kendo-svg-icons"; const I = (s) => { const n = f(), { disabled: r, type: t, scrollContentRef: o, buttonScrollSpeed: e, prevButton: m, nextButton: u } = s, d = (S) => { o && o.current && e && o.current.scrollBy({ left: t === "next" ? e : -e, behavior: "smooth" }); }, p = t === "prev" ? m || "span" : u || "span"; return ( // Using span instead of real Button component is intentional. // Ref: https://progresssoftware.atlassian.net/wiki/spaces/DE/pages/edit-v2/544997922#Hidden-interactive-elements /* @__PURE__ */ a.createElement( p, { className: b( "k-button", "k-button-md", "k-button-solid", "k-button-solid-base", "k-rounded-md", "k-icon-button", `k-toolbar-${t}`, { "k-disabled": r } ), title: `${t === "prev" ? n.toLanguageString(l, c[l]) : n.toLanguageString(i, c[i])}`, "aria-hidden": !0, tabIndex: r ? -1 : void 0, onClick: d }, /* @__PURE__ */ a.createElement(k, { icon: t === "prev" ? g : v, className: "k-button-icon" }) ) ); }; export { I as ToolbarScrollButton };