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