{"version":3,"file":"index.mjs","sources":["../../../../src/components/TabsSwitch/index.vue"],"sourcesContent":["<template>\n  <div\n    ref=\"root\"\n    class=\"transition-color text-shade-20 relative flex select-none gap-1 bg-gray-100 p-1 duration-100 ease-in-out dark:bg-gray-700\"\n    :class=\"[rounded ? 'rounded-full' : 'rounded-lg']\"\n  >\n    <button\n      v-for=\"tab in tabs\"\n      :key=\"tab.value\"\n      :ref=\"registerTab\"\n      type=\"button\"\n      :data-value=\"tab.value\"\n      class=\"whitespace-no-wrap z-10 flex h-full flex-1 flex-shrink-0 flex-grow items-center justify-center self-stretch whitespace-nowrap rounded transition-colors duration-75\"\n      :class=\"[\n        condensed ? 'px-3 py-1' : 'px-4  py-1.5',\n        {\n          'bg-primary-500 text-white': modelValue === tab.value,\n        },\n      ]\"\n      @click=\"select($event, tab.value)\"\n    >\n      <slot :tab=\"tab\">\n        {{ tab.title }}\n      </slot>\n    </button>\n  </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { MaybeRef } from '@vueuse/core';\nimport { PropType, inject, ref } from 'vue';\n\nexport interface Tab {\n  title: string;\n  value: string;\n}\n\ndefineProps({\n  tabs: {\n    type: Array as PropType<Tab[]>,\n    required: true,\n  },\n  rounded: {\n    type: Boolean,\n    default: false,\n  },\n  modelValue: {\n    type: String,\n    required: true,\n  },\n  condensed: {\n    type: Boolean,\n    default: false,\n  },\n});\n\nconst emit = defineEmits(['update:modelValue']);\n\nconst registeredTabs = ref<HTMLElement[]>([]);\n\nconst registerTab = (el: HTMLElement) => {\n  registeredTabs.value?.push(el);\n};\n\nconst root = ref<HTMLElement>();\n\nconst select = (event: MouseEvent, value: string) => {\n  // emit a value update event and change the background size and position to the newly selected tab\n  emit('update:modelValue', value);\n};\n</script>\n"],"names":["emit","__emit","registeredTabs","ref","registerTab","el","_a","root","select","event","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwDA,UAAMA,IAAOC,GAEPC,IAAiBC,EAAmB,CAAA,CAAE,GAEtCC,IAAc,CAACC,MAAoB;;AACxB,OAAAC,IAAAJ,EAAA,UAAA,QAAAI,EAAO,KAAKD;AAAA,IAAE,GAGzBE,IAAOJ,KAEPK,IAAS,CAACC,GAAmBC,MAAkB;AAEnD,MAAAV,EAAK,qBAAqBU,CAAK;AAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}