Skip to content

Commit c438f2e

Browse files
[6.x] Prevent tabindex prop type warnings on login page (#13493)
Co-authored-by: Jason Varga <[email protected]>
1 parent 923fe6d commit c438f2e

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

resources/js/components/ui/Checkbox/Item.vue

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<script setup>
22
import { CheckboxIndicator, CheckboxRoot, useId } from 'reka-ui';
3-
import { computed } from 'vue';
3+
import { computed, useAttrs } from 'vue';
44
import { cva } from 'cva';
5+
import { twMerge } from 'tailwind-merge';
6+
7+
defineOptions({ inheritAttrs: false });
8+
9+
const attrs = useAttrs();
510
611
const props = defineProps({
712
/** Controls the vertical alignment of the checkbox with its label. Options: `start`, `center` */
@@ -23,8 +28,6 @@ const props = defineProps({
2328
size: { type: String, default: 'base' },
2429
/** 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 */
2530
solo: { type: Boolean, default: false },
26-
/** Tab index for keyboard navigation */
27-
tabindex: { type: Number, default: null },
2831
/** Value of the checkbox when used in a group */
2932
value: { type: [String, Number, Boolean] },
3033
});
@@ -63,7 +66,7 @@ const checkboxClasses = computed(() => {
6366
});
6467
6568
const containerClasses = computed(() => {
66-
return cva({
69+
const classes = cva({
6770
base: 'flex gap-2',
6871
variants: {
6972
align: {
@@ -72,6 +75,8 @@ const containerClasses = computed(() => {
7275
},
7376
},
7477
})({ ...props });
78+
79+
return twMerge(classes, attrs.class);
7580
});
7681
7782
const conditionalProps = computed(() => {
@@ -109,7 +114,7 @@ const conditionalProps = computed(() => {
109114
@update:modelValue="emit('update:modelValue', $event)"
110115
@keydown="handleKeydown"
111116
:class="checkboxClasses"
112-
:tabindex="tabindex"
117+
:tabindex="attrs.tabindex"
113118
>
114119
<CheckboxIndicator class="relative flex h-full w-full items-center justify-center text-white">
115120
<!-- Checkmark icon for checked state -->

resources/js/components/ui/Input/Input.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ const props = defineProps({
4242
required: { type: Boolean, default: false },
4343
/** Controls the size of the input. Options: `xs`, `sm`, `base`, `lg` */
4444
size: { type: String, default: 'base' },
45-
/** Tab index for keyboard navigation */
46-
tabindex: { type: Number, default: null },
4745
/** Input type attribute */
4846
type: { type: String, default: 'text' },
4947
/** Controls the appearance of the input. Options: `default`, `filled` */
@@ -62,7 +60,7 @@ const inputAttributeKeys = [
6260
'accept', 'autocomplete', 'autofocus', 'capture', 'checked', 'dirname', 'form',
6361
'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget',
6462
'list', 'max', 'maxlength', 'min', 'minlength', 'multiple', 'name', 'pattern',
65-
'readonly', 'required', 'size', 'src', 'step', 'value'
63+
'readonly', 'required', 'size', 'src', 'step', 'tabindex', 'value'
6664
];
6765
6866
const outerAttrs = computed(() => {
@@ -232,7 +230,6 @@ defineExpose({ focus });
232230
:placeholder="placeholder"
233231
:disabled="disabled"
234232
:readonly="readOnly"
235-
:tabindex="tabindex"
236233
data-ui-control
237234
data-ui-group-target
238235
v-bind="inputAttrs"

0 commit comments

Comments
 (0)