Skip to content

Commit

Permalink
fix(checkbox): emit single event on input
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Feb 2, 2023
1 parent 180778b commit d8efaa5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/anu-vue/src/components/checkbox/ACheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ const props = defineProps({
*/
icon: defu({ default: 'i-bx-check' }, configurableProp),
/**
* Bind classes to input element
*/
inputClasses: { type: null },
/**
* Disable checkbox
*/
Expand All @@ -42,6 +47,7 @@ const emit = defineEmits<{
defineOptions({
name: 'ACheckbox',
inheritAttrs: false,
})
const attrs = useAttrs()
Expand Down Expand Up @@ -75,15 +81,18 @@ const state = computed(() => {
<label
:for="elementId"
class="inline-flex items-center cursor-pointer"
:class="[props.disabled && 'a-checkbox-disabled pointer-events-none']"
:class="[
$attrs.class,
props.disabled && 'a-checkbox-disabled pointer-events-none',
]"
>
<input
v-bind="{ ...$attrs, class: props.inputClasses }"
:id="elementId"
:ref="refCheckbox"
v-model="data"
class="hidden"
type="checkbox"
v-bind="attrs"
>
<div
class="a-checkbox-box flex items-center justify-center shrink-0"
Expand Down

0 comments on commit d8efaa5

Please sign in to comment.