UNPKG

@progress/kendo-vue-buttons

Version:
69 lines (68 loc) 2.32 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 l, createVNode as m, h as f } from "vue"; import { getDefaultSlots as c, classNames as i, validatePackage as g } from "@progress/kendo-vue-common"; import { ButtonWrap as b } from "./ButtonWrap.mjs"; import h from "./util.mjs"; import { packageMetadata as $ } from "./package-metadata.mjs"; const o = h.styles, S = /* @__PURE__ */ l({ name: "KendoButtonGroup", props: { disabled: { type: Boolean, default: void 0 }, width: String, dir: { type: String, default: function() { } } }, created() { g($); }, render() { const t = c(this), p = function(s, n, r, e) { const a = i({ [o["state-disabled"]]: this.$props.disabled, [o["group-start"]]: e ? r : n === 0, [o["group-end"]]: e ? n === 0 : r }); return f(b, { class: a, "aria-disabled": this.$props.disabled }, function() { return [s]; }); }, d = function(s) { const n = s.length, r = this.$props.dir !== void 0 ? this.$props.dir === "rtl" : this.$el && getComputedStyle(this.$el).direction === "rtl" || !1; return s.map((e, a) => this.isValidButton(e) ? p.call(this, e, a, a === n - 1, r) : e); }, u = i([o["button-group"]], { "k-disabled": this.$props.disabled, [o["button-group-stretched"]]: !!this.$props.width }); return m("div", { style: { width: this.width }, dir: this.$props.dir, role: "group", "aria-disabled": this.$props.disabled, class: u }, [d.call(this, t)]); }, methods: { isValidButton(t) { return t && t.tag && t.tag.toLowerCase().indexOf("button") !== -1 || t.componentOptions && t.componentOptions.tag && t.componentOptions.tag.toLowerCase().indexOf("button") !== -1 || t.type && t.type.name && t.type.name.toLowerCase().indexOf("kendobutton") !== -1; } } }); export { S as ButtonGroup };