import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
import { createElementBlock as t, createVNode as n, mergeProps as r, normalizeClass as i, openBlock as a, ref as o, renderSlot as s, resolveComponent as c, resolveDirective as l, useTemplateRef as u, withCtx as d, withDirectives as f } from "vue";
var p = /*#__PURE__*/ e({
	__name: "wt-button-select",
	props: {
		options: {
			type: Array,
			required: !0
		},
		color: {
			type: String,
			default: "primary"
		},
		disabled: {
			type: Boolean,
			default: !1
		}
	},
	emits: ["click", "click:option"],
	setup(e, { emit: p }) {
		let m = p, h = o(!1), g = u("buttonSelect"), _ = ({ option: e, index: t }) => {
			m("click:option", e, t), h.value = !1;
		}, v = () => {
			h.value = !1;
		}, y = (e, t) => {
			h.value = !h.value, e(t, g.value);
		};
		return (o, u) => {
			let p = c("wt-button"), m = c("wt-icon"), b = c("wt-context-menu"), x = l("clickaway");
			return f((a(), t("div", {
				ref_key: "buttonSelect",
				ref: g,
				class: "wt-button-select"
			}, [n(p, r(o.$attrs, {
				color: e.color,
				disabled: e.disabled,
				class: "wt-button-select__button"
			}, { onClick: u[0] ||= (e) => o.$emit("click", e) }), {
				default: d(() => [s(o.$slots, "default", {}, void 0, !0)], void 0, !0),
				_: 3
			}, 16, ["color", "disabled"]), n(b, {
				disabled: e.disabled,
				options: e.options,
				visible: h.value,
				"tooltip-triggers": [],
				onClick: _
			}, {
				activator: d(({ toggle: t, show: a }) => [n(p, r(o.$attrs, {
					color: e.color,
					disabled: e.disabled,
					loading: !1,
					class: "wt-button-select__select-btn"
				}, { onClick: (e) => y(t, e) }), {
					default: d(() => [n(m, {
						class: i([{ "wt-button-select__select-arrow--active": h.value }, "wt-button-select__select-arrow"]),
						color: e.color === "primary" ? "on-primary" : "default",
						disabled: e.disabled,
						icon: "arrow-down"
					}, null, 8, [
						"class",
						"color",
						"disabled"
					])], void 0, !0),
					_: 1
				}, 16, [
					"color",
					"disabled",
					"onClick"
				])]),
				_: 1
			}, 8, [
				"disabled",
				"options",
				"visible"
			])])), [[x, v]]);
		};
	}
}, [["__scopeId", "data-v-17b6dce6"]]);
//#endregion
export { p as default };
