UNPKG

@progress/kendo-vue-buttons

Version:
76 lines (75 loc) 2.48 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 { defineComponent as u, createVNode as c } from "vue"; import { classNames as d, SvgIcon as p } from "@progress/kendo-vue-common"; import { prevArrowTitle as e, messages as n, nextArrowTitle as r } from "../messages/index.mjs"; import { caretAltLeftIcon as b, caretAltRightIcon as m } from "@progress/kendo-svg-icons"; import { provideLocalizationService as l } from "@progress/kendo-vue-intl"; const L = /* @__PURE__ */ u({ name: "KendoToolbarScrollButton", props: { buttonScrollSpeed: Number, disabled: Boolean, scrollContentRef: Object, type: String, prevButton: Object, nextButton: Object, dir: String }, inject: { kendoLocalizationService: { default: null } }, emits: { contentscroll: (o) => !0 }, methods: { getScrollButtonTitle() { const { dir: o, type: t } = this.$props; return o !== "rtl" ? t === "prev" ? l(this).toLanguageString(e, n[e]) : l(this).toLanguageString(r, n[r]) : t === "prev" ? l(this).toLanguageString(r, n[r]) : l(this).toLanguageString(e, n[e]); } }, render() { const { disabled: o, type: t, scrollContentRef: s, buttonScrollSpeed: i, prevButton: g, nextButton: S } = this.$props, a = () => { s && i && (s.scrollBy({ left: t === "next" ? i : -i, behavior: "smooth" }), this.$emit("contentscroll", t)); }; 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 c("span", { class: d("k-button", "k-button-md", "k-button-solid", "k-button-solid-base", "k-rounded-md", "k-icon-button", `k-toolbar-${t}`, { "k-disabled": o }), title: this.getScrollButtonTitle(), "aria-hidden": !0, tabindex: o ? -1 : void 0, onClick: a }, [c(p, { icon: t === "prev" ? b : m, class: "k-button-icon" }, null)]) ); } }); export { L as ToolbarScrollButton };