2021-10-28 21:41:42 +02:00
|
|
|
<template>
|
|
|
|
<label class="flex justify-start items-start">
|
2021-10-31 01:50:49 +02:00
|
|
|
<div class="bg-white border-2 rounded border-gray-400 flex flex-shrink-0 justify-center items-center focus-within:border-blue-500" :class="wrapperClass">
|
2021-10-28 21:41:42 +02:00
|
|
|
<input v-model="selected" type="checkbox" class="opacity-0 absolute" />
|
2021-10-31 01:50:49 +02:00
|
|
|
<svg v-if="selected" class="fill-current text-green-500 pointer-events-none" :class="svgClass" viewBox="0 0 20 20"><path d="M0 11l2-2 5 5L18 3l2 2L7 18z" /></svg>
|
2021-10-28 21:41:42 +02:00
|
|
|
</div>
|
|
|
|
<div v-if="label" class="select-none">{{ label }}</div>
|
|
|
|
</label>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: Boolean,
|
2021-10-31 01:50:49 +02:00
|
|
|
label: Boolean,
|
|
|
|
small: Boolean
|
2021-10-28 21:41:42 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
selected: {
|
|
|
|
get() {
|
|
|
|
return this.value
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('input', !!val)
|
|
|
|
}
|
2021-10-31 01:50:49 +02:00
|
|
|
},
|
|
|
|
wrapperClass() {
|
|
|
|
if (this.small) return 'w-4 h-4'
|
|
|
|
return 'w-6 h-6'
|
|
|
|
},
|
|
|
|
svgClass() {
|
|
|
|
if (this.small) return 'w-3 h-3'
|
|
|
|
return 'w-4 h-4'
|
2021-10-28 21:41:42 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|