{"version":3,"file":"Checkbox.cjs","sources":["../../common/Checkbox/Checkbox.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { VNode } from \"vue\";\n\nimport { CheckboxClassesKey, ICheckboxProps } from \"./types\";\n\nconst {\n  checked = false,\n  disabled = false,\n  labelPlacement = \"right\",\n  label = \"\",\n  description = \"\",\n  value = \"\",\n  id = \"\",\n  classes = {} as Partial<Record<CheckboxClassesKey, string>>,\n} = defineProps<ICheckboxProps>();\n\ndefineSlots<{\n  checkboxLabel(): VNode;\n}>();\n\nconst emits = defineEmits<{\n  (e: \"onChange\", isChecked: boolean, checkedValue: string, event?: Event): void;\n  (e: \"update:checked\", isChecked: boolean): void;\n}>();\n\nconst handleCheckboxChange = (event: Event) => {\n  const isChecked = (event?.target as HTMLInputElement)?.checked;\n  const checkedValue = (event?.target as HTMLInputElement)?.value;\n  emits(\"onChange\", isChecked, checkedValue, event);\n  emits(\"update:checked\", isChecked);\n};\n</script>\n\n<template>\n  <div :class=\"['flex w-fit items-center gap-2', `checkbox-label-${labelPlacement}`, $attrs.class, classes?.container]\">\n    <input\n      :id=\"id\"\n      :aria-checked=\"checked\"\n      :aria-labelledby=\"label || 'Checkbox Label'\"\n      :checked=\"checked\"\n      type=\"checkbox\"\n      :value=\"value\"\n      :class=\"['checkbox-input', { 'cursor-pointer': !disabled, 'cursor-not-allowed hover:!ring-0': disabled }, classes?.input]\"\n      :disabled=\"disabled\"\n      v-bind=\"{ ...$attrs, class: '', style: {} }\"\n      @change=\"handleCheckboxChange\"\n    />\n    <label\n      v-if=\"label && !$slots?.checkboxLabel\"\n      :for=\"id\"\n      :class=\"['checkbox-label flex flex-col', { '!text-app-gray-400 !cursor-not-allowed': disabled }, classes?.label, disabled && classes?.disabled]\"\n    >\n      <span data-testid=\"checkbox-label\">{{ label }}</span>\n      <span v-if=\"description\" data-testid=\"checkbox-desc\" class=\"text-app-gray-500 dark:text-app-gray-400 text-xs\">{{ description }}</span>\n    </label>\n    <label v-if=\"$slots?.checkboxLabel\" :for=\"id\">\n      <slot name=\"checkboxLabel\" />\n    </label>\n  </div>\n</template>\n\n<style scoped>\n@reference \"../../styles/main.css\";\n\n.checkbox-input {\n  @apply w-4 h-4 text-app-primary-600 bg-app-gray-50 border-app-gray-300 rounded-lg hover:ring-offset-0 hover:ring-1 hover:ring-app-primary-200 hover:outline-0 disabled:hover:ring-app-gray-100 dark:bg-app-gray-700 dark:border-app-gray-600 dark:hover:ring-app-primary-500;\n}\n\n.checkbox-label {\n  @apply text-sm font-normal text-app-gray-900 dark:text-app-white cursor-pointer;\n}\n\n.checkbox-label-left {\n  @apply flex-row-reverse;\n}\n\n.checkbox-label-right {\n  @apply flex-row;\n}\n\n.checkbox-label-top {\n  @apply flex-col-reverse;\n}\n\n.checkbox-label-bottom {\n  @apply flex-col;\n}\n</style>\n"],"names":["emits","__emit","handleCheckboxChange","event","isChecked","checkedValue","_createElementBlock","_normalizeClass","__props","$attrs","_createElementVNode","_mergeProps","_hoisted_1","$slots","_hoisted_3","_toDisplayString","_hoisted_4","_renderSlot","_ctx"],"mappings":"soBAoBA,MAAMA,EAAQC,EAKRC,EAAwBC,GAAiB,CAC7C,MAAMC,EAAaD,GAAO,QAA6B,QACjDE,EAAgBF,GAAO,QAA6B,MAC1DH,EAAM,WAAYI,EAAWC,EAAcF,CAAK,EAChDH,EAAM,iBAAkBI,CAAS,CACnC,8BAIEE,EAAAA,mBAwBM,MAAA,CAxBA,MAAKC,EAAAA,eAAA,CAAA,gCAAA,kBAAsDC,gBAAc,GAAIC,EAAAA,OAAO,MAAOD,EAAA,SAAS,SAAS,CAAA,CAAA,GACjHE,EAAAA,mBAWE,QAXFC,aAWE,CAVC,GAAIH,EAAA,GACJ,eAAcA,EAAA,QACd,kBAAiBA,EAAA,OAAK,iBACtB,QAASA,EAAA,QACV,KAAK,WACJ,MAAOA,EAAA,MACP,2CAA+CA,EAAA,SAAQ,mCAAsCA,YAAYA,EAAA,SAAS,KAAK,EACvH,SAAUA,EAAA,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