@innertia-solutions/ui 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Forms/Input.vue +72 -0
- package/package.json +11 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
|
+
import { IconEye, IconEyeOff } from '@tabler/icons-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search'
|
|
7
|
+
placeholder?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
error?: string | null
|
|
10
|
+
label?: string
|
|
11
|
+
hint?: string
|
|
12
|
+
iconLeft?: object | Function | null
|
|
13
|
+
autocomplete?: string
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const modelValue = defineModel<string | number | null>({ default: '' })
|
|
17
|
+
|
|
18
|
+
const showPassword = ref(false)
|
|
19
|
+
|
|
20
|
+
const inputType = computed(() => {
|
|
21
|
+
if (props.type === 'password') return showPassword.value ? 'text' : 'password'
|
|
22
|
+
return props.type ?? 'text'
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const baseClasses = 'py-2 px-3 block w-full rounded-lg text-sm text-slate-800 border border-gray-200 dark:border-slate-700 focus:ring-0 focus:border-gray-400 focus:outline-none disabled:opacity-50 dark:bg-transparent dark:text-slate-300 transition-colors placeholder:text-slate-400 dark:placeholder:text-slate-500'
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div class="w-full">
|
|
30
|
+
<label v-if="label" class="block text-sm font-medium text-slate-700 dark:text-slate-300 mb-1.5">
|
|
31
|
+
{{ label }}
|
|
32
|
+
</label>
|
|
33
|
+
|
|
34
|
+
<div class="relative">
|
|
35
|
+
<!-- Ícono izquierdo -->
|
|
36
|
+
<div v-if="iconLeft" class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none text-slate-400">
|
|
37
|
+
<component :is="iconLeft" class="size-4" />
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<input
|
|
41
|
+
v-model="modelValue"
|
|
42
|
+
:type="inputType"
|
|
43
|
+
:placeholder="placeholder"
|
|
44
|
+
:disabled="disabled"
|
|
45
|
+
:autocomplete="autocomplete"
|
|
46
|
+
:class="[
|
|
47
|
+
baseClasses,
|
|
48
|
+
iconLeft ? 'ps-9' : '',
|
|
49
|
+
type === 'password' ? 'pe-10' : '',
|
|
50
|
+
error ? '!border-red-400 dark:!border-red-500' : '',
|
|
51
|
+
]"
|
|
52
|
+
/>
|
|
53
|
+
|
|
54
|
+
<!-- Toggle contraseña -->
|
|
55
|
+
<button
|
|
56
|
+
v-if="type === 'password'"
|
|
57
|
+
type="button"
|
|
58
|
+
tabindex="-1"
|
|
59
|
+
class="absolute inset-y-0 end-0 flex items-center px-3 text-slate-400 hover:text-slate-600 dark:hover:text-slate-300 transition-colors"
|
|
60
|
+
@click="showPassword = !showPassword"
|
|
61
|
+
>
|
|
62
|
+
<component :is="showPassword ? IconEyeOff : IconEye" class="size-4" />
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<!-- Error -->
|
|
67
|
+
<p v-if="error" class="text-xs text-red-500 dark:text-red-400 mt-1">{{ error }}</p>
|
|
68
|
+
|
|
69
|
+
<!-- Hint -->
|
|
70
|
+
<p v-else-if="hint" class="text-xs text-slate-400 mt-1">{{ hint }}</p>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
package/package.json
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innertia-solutions/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Innertia Solutions — Nuxt UI layer: components and composables",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"nuxt",
|
|
7
|
+
"vue",
|
|
8
|
+
"components",
|
|
9
|
+
"design-system"
|
|
10
|
+
],
|
|
6
11
|
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/innertia-solutions/innertia-ui-kit"
|
|
15
|
+
},
|
|
7
16
|
"publishConfig": {
|
|
8
17
|
"access": "public"
|
|
9
18
|
},
|