Skip to content

Commit 13ba39e

Browse files
authored
fix: input duplicated class name, remove type="text" (#194)
If the **type** attribute is not specified, the default type is "text"
1 parent e2d9e04 commit 13ba39e

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

apps/www/src/lib/registry/default/ui/input/Input.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<script setup lang="ts">
2+
import { useAttrs } from 'vue'
23
import { useVModel } from '@vueuse/core'
34
import { cn } from '@/lib/utils'
45
6+
defineOptions({
7+
inheritAttrs: false,
8+
})
9+
510
const props = defineProps<{
611
defaultValue?: string | number
712
modelValue?: string | number
@@ -11,12 +16,14 @@ const emits = defineEmits<{
1116
(e: 'update:modelValue', payload: string | number): void
1217
}>()
1318
19+
const { class: className, ...rest } = useAttrs()
20+
1421
const modelValue = useVModel(props, 'modelValue', emits, {
1522
passive: true,
1623
defaultValue: props.defaultValue,
1724
})
1825
</script>
1926

2027
<template>
21-
<input v-model="modelValue" type="text" :class="cn('flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', $attrs.class ?? '')">
28+
<input v-model="modelValue" :class="cn('flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', className ?? '')" v-bind="rest">
2229
</template>

apps/www/src/lib/registry/new-york/ui/input/Input.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
<script setup lang="ts">
2+
import { useAttrs } from 'vue'
23
import { useVModel } from '@vueuse/core'
34
import { cn } from '@/lib/utils'
45
6+
defineOptions({
7+
inheritAttrs: false,
8+
})
9+
510
const props = defineProps<{
611
defaultValue?: string | number
712
modelValue?: string | number
@@ -11,12 +16,14 @@ const emits = defineEmits<{
1116
(e: 'update:modelValue', payload: string | number): void
1217
}>()
1318
19+
const { class: className, ...rest } = useAttrs()
20+
1421
const modelValue = useVModel(props, 'modelValue', emits, {
1522
passive: true,
1623
defaultValue: props.defaultValue,
1724
})
1825
</script>
1926

2027
<template>
21-
<input v-model="modelValue" type="text" :class="cn('flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', $attrs.class ?? '')">
28+
<input v-model="modelValue" :class="cn('flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50', className ?? '')" v-bind="rest">
2229
</template>

0 commit comments

Comments
 (0)