Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions resources/js/components/ui/Checkbox/Item.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<script setup>
import { CheckboxIndicator, CheckboxRoot, useId } from 'reka-ui';
import { computed } from 'vue';
import { computed, useAttrs } from 'vue';
import { cva } from 'cva';
import { twMerge } from 'tailwind-merge';

defineOptions({ inheritAttrs: false });

const attrs = useAttrs();

const props = defineProps({
/** Controls the vertical alignment of the checkbox with its label. Options: `start`, `center` */
Expand All @@ -23,8 +28,6 @@ const props = defineProps({
size: { type: String, default: 'base' },
/** When `true`, hides the label and description. Use this when the checkbox is used in a context where the label is provided elsewhere, like in a table cell */
solo: { type: Boolean, default: false },
/** Tab index for keyboard navigation */
tabindex: { type: Number, default: null },
/** Value of the checkbox when used in a group */
value: { type: [String, Number, Boolean] },
});
Expand Down Expand Up @@ -63,7 +66,7 @@ const checkboxClasses = computed(() => {
});

const containerClasses = computed(() => {
return cva({
const classes = cva({
base: 'flex gap-2',
variants: {
align: {
Expand All @@ -72,6 +75,8 @@ const containerClasses = computed(() => {
},
},
})({ ...props });

return twMerge(classes, attrs.class);
});

const conditionalProps = computed(() => {
Expand Down Expand Up @@ -109,7 +114,7 @@ const conditionalProps = computed(() => {
@update:modelValue="emit('update:modelValue', $event)"
@keydown="handleKeydown"
:class="checkboxClasses"
:tabindex="tabindex"
:tabindex="attrs.tabindex"
>
<CheckboxIndicator class="relative flex h-full w-full items-center justify-center text-white">
<!-- Checkmark icon for checked state -->
Expand Down
5 changes: 1 addition & 4 deletions resources/js/components/ui/Input/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ const props = defineProps({
required: { type: Boolean, default: false },
/** Controls the size of the input. Options: `xs`, `sm`, `base`, `lg` */
size: { type: String, default: 'base' },
/** Tab index for keyboard navigation */
tabindex: { type: Number, default: null },
/** Input type attribute */
type: { type: String, default: 'text' },
/** Controls the appearance of the input. Options: `default`, `filled` */
Expand All @@ -62,7 +60,7 @@ const inputAttributeKeys = [
'accept', 'autocomplete', 'autofocus', 'capture', 'checked', 'dirname', 'form',
'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget',
'list', 'max', 'maxlength', 'min', 'minlength', 'multiple', 'name', 'pattern',
'readonly', 'required', 'size', 'src', 'step', 'value'
'readonly', 'required', 'size', 'src', 'step', 'tabindex', 'value'
];

const outerAttrs = computed(() => {
Expand Down Expand Up @@ -232,7 +230,6 @@ defineExpose({ focus });
:placeholder="placeholder"
:disabled="disabled"
:readonly="readOnly"
:tabindex="tabindex"
data-ui-control
data-ui-group-target
v-bind="inputAttrs"
Expand Down