import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
import "./styles/tabs.css";
import { computed, toRef } from "vue";
import { defineComponent } from "../../utils";
import { SlideGroup } from "../slide-group";
import { makeDensityProps, useDensity } from "../../composables/density";
import { makeTagProps } from "../../composables/tag";
import { provideDefaults } from "../../composables/defaults";
import { TabsKey } from "./key";
import { Tab } from "./tab";
function parseItems(items) {
  if (!items)
    return [];
  return items.map((item) => {
    if (typeof item === "string")
      return {
        title: item,
        value: item
      };
    return item;
  });
}
const Tabs = defineComponent({
  name: "VeTabs",
  props: {
    alignWithTitle: Boolean,
    color: String,
    direction: {
      type: String,
      default: "horizontal"
    },
    fixedTabs: Boolean,
    items: {
      type: Array,
      default: () => []
    },
    stacked: Boolean,
    backgroundColor: String,
    centered: Boolean,
    grow: Boolean,
    height: {
      type: [Number, String],
      default: void 0
    },
    hideSlider: Boolean,
    optional: Boolean,
    right: Boolean,
    sliderColor: String,
    ...makeDensityProps(),
    ...makeTagProps()
  },
  setup(props, {
    slots,
    attrs
  }) {
    const parsedItems = computed(() => parseItems(props.items));
    const {
      densityClasses
    } = useDensity(props);
    provideDefaults({
      Tab: {
        color: toRef(props, "color"),
        direction: toRef(props, "direction"),
        stacked: toRef(props, "stacked"),
        fixed: toRef(props, "fixedTabs"),
        sliderColor: toRef(props, "sliderColor"),
        hideSlider: toRef(props, "hideSlider")
      }
    });
    return () => _createVNode(SlideGroup, _mergeProps({
      "class": ["ve-tabs", `ve-tabs--${props.direction}`, {
        "ve-tabs--align-with-title": props.alignWithTitle,
        "ve-tabs--centered": props.centered,
        "ve-tabs--fixed-tabs": props.fixedTabs,
        "ve-tabs--grow": props.grow,
        "ve-tabs--right": props.right,
        "ve-tabs--stacked": props.stacked
      }, densityClasses.value],
      "role": "tablist",
      "symbol": TabsKey,
      "mandatory": "force",
      "direction": props.direction
    }, attrs), {
      default: () => [slots.default ? slots.default() : parsedItems.value.map((item) => _createVNode(Tab, _mergeProps(item, {
        "key": item.title
      }), null))]
    });
  }
});
export {
  Tabs
};
//# sourceMappingURL=tabs.mjs.map
