import { s as script$1 } from './headerText-0fd3adc1.mjs';
import { ref, onMounted, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, Fragment, renderList, createBlock, withModifiers, withCtx, createTextVNode, toDisplayString, renderSlot, normalizeClass } from 'vue';

var script = {
    components: {
        TsHeaderText: script$1,
    },
    props: {
        items: {
            type: Array,
            required: true,
        },
    },
    emits: ["update:selectedTab"],
    name: "TsTabs",
    setup(props, context) {
        const selectedTab = ref("");
        const selectDefaultTab = () => {
            selectedTab.value = props.items[0]?.key;
        };
        onMounted(() => {
            selectDefaultTab();
        });
        watch(props.options, () => {
            selectDefaultTab();
        });
        watch(selectedTab, () => {
            context.emit("update:selectedTab", selectedTab.value);
        });
        return {
            selectedTab,
        };
    },
};

const _hoisted_1 = { class: "w-full flex flex-col col-span-full" };
const _hoisted_2 = {
  class: /*#__PURE__*/normalizeClass(` border-b-[1px] w-full px-3  border-gray-200 flex flex-row items-center justify-between mdlg:!px-0 `)
};
const _hoisted_3 = { class: "flex flex-row items-center space-x-2 mdlg:!space-x-5" };

function render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_ts_header_text = resolveComponent("ts-header-text");

  return (openBlock(), createElementBlock("div", _hoisted_1, [
    createElementVNode("div", _hoisted_2, [
      createElementVNode("div", _hoisted_3, [
        (openBlock(true), createElementBlock(Fragment, null, renderList($props.items, (item, index) => {
          return (openBlock(), createBlock(_component_ts_header_text, {
            size: "lg",
            key: index,
            onClick: withModifiers($event => ($setup.selectedTab = item.key), ["stop"]),
            "custom-class": ` mdlg:border-b-[2px] border-b-[1.5px] px-3 mdlg:px-0 cursor-pointer ${
            $setup.selectedTab == item.key ? ' border-headerText ' : 'border-transparent '
          }   py-2 lg:!pb-2 mdlg:py-3 lg:pt-6`,
            color: `${
            $setup.selectedTab == item.key ? ' text-headerText' : 'text-headerText opacity-40'
          }`
          }, {
            default: withCtx(() => [
              createTextVNode(toDisplayString(item.value), 1 /* TEXT */)
            ]),
            _: 2 /* DYNAMIC */
          }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onClick", "custom-class", "color"]))
        }), 128 /* KEYED_FRAGMENT */))
      ]),
      renderSlot(_ctx.$slots, "extra")
    ])
  ]))
}

script.render = render;
script.__file = "src/components/TsTabs/index.vue";

export { script as default };
