tfs-input 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +23 -11
- package/dist/style.css +1 -1
- package/dist/tfsInput.js +26 -11
- package/dist/tfsInput.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/tfsInput.vue +31 -11
package/README.md
CHANGED
@@ -4,30 +4,40 @@ A customizable Vue 3 input component with animated floating labels for clean, mo
|
|
4
4
|
|
5
5
|
## Features
|
6
6
|
|
7
|
-
- Modern UI
|
8
|
-
- Customizable placeholder, label, and value.
|
9
|
-
-
|
7
|
+
- Modern and minimalistic UI with smooth transitions.
|
8
|
+
- Customizable placeholder, label, and value for flexible usage.
|
9
|
+
- Built-in support for two-way binding using `v-model`.
|
10
|
+
- Dynamic theme customization, including primary and text colors.
|
11
|
+
- Lightweight, performant, and designed with accessibility in mind.
|
10
12
|
|
11
13
|
## Installation
|
12
14
|
|
13
15
|
Install via npm:
|
14
16
|
|
15
17
|
```bash
|
16
|
-
npm install tfs-input
|
18
|
+
npm install tfs-input@latest
|
17
19
|
```
|
18
20
|
|
19
|
-
##
|
21
|
+
## Usage
|
20
22
|
|
21
23
|
Import and use the component in your Vue project.
|
22
24
|
|
23
25
|
```vue
|
24
26
|
<template>
|
25
|
-
<tInput
|
27
|
+
<tInput
|
28
|
+
label="Name"
|
29
|
+
primaryColor="yellow"
|
30
|
+
textColor="white"
|
31
|
+
placehold="Enter your name"
|
32
|
+
v-model:val="name"
|
33
|
+
/>
|
34
|
+
<p>Hello, {{ name }}!</p>
|
26
35
|
</template>
|
27
36
|
|
28
37
|
<script setup>
|
29
38
|
import { ref } from "vue";
|
30
39
|
import tInput from "tfs-input";
|
40
|
+
import "tfs-input/style.css";
|
31
41
|
|
32
42
|
const name = ref("");
|
33
43
|
</script>
|
@@ -37,11 +47,13 @@ const name = ref("");
|
|
37
47
|
|
38
48
|
### Props
|
39
49
|
|
40
|
-
| **Prop**
|
41
|
-
|
|
42
|
-
| `label`
|
43
|
-
| `val`
|
44
|
-
| `placehold`
|
50
|
+
| **Prop** | **Type** | **Description** |
|
51
|
+
| -------------- | -------- | ----------------------------------- |
|
52
|
+
| `label` | String | Text displayed as a floating label. |
|
53
|
+
| `val` | String | Bound value for input. |
|
54
|
+
| `placehold` | String | Placeholder text for input. |
|
55
|
+
| `primaryColor` | string | Customizes the primary color. |
|
56
|
+
| `textColor` | string | Customizes the text color. |
|
45
57
|
|
46
58
|
### Emits
|
47
59
|
|
package/dist/style.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.contain[data-v-
|
1
|
+
.contain[data-v-4c91c086]{position:relative}.inp[data-v-4c91c086]{background-color:transparent;color:var(--text);border:1px solid #52525b;width:90%;margin:5px 15px;border-radius:8.75px;background:none;padding:12px 16px;font-size:18px}.inp[data-v-4c91c086]:focus{border:1px solid var(--primary);outline:none}.inp[data-v-4c91c086]::placeholder{color:#71717a}.inp[data-v-4c91c086],.label[data-v-4c91c086]{transition:color,background-color,border-color .2s ease-out}.label[data-v-4c91c086]{background-color:transparent;color:#71717a;border:1px solid #52525b;font-size:15px;font-weight:600;padding:0 6px;border-radius:7.25px;position:absolute;top:-12px;left:24px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.contain:focus-within .label[data-v-4c91c086]{color:var(--primary);border:1px solid var(--primary)}
|
package/dist/tfsInput.js
CHANGED
@@ -1,32 +1,47 @@
|
|
1
|
-
import { openBlock as
|
2
|
-
const
|
1
|
+
import { computed as r, openBlock as c, createElementBlock as s, normalizeStyle as i, createElementVNode as n, toDisplayString as p } from "vue";
|
2
|
+
const u = (t, a) => {
|
3
3
|
const e = t.__vccOpts || t;
|
4
4
|
for (const [l, o] of a)
|
5
5
|
e[l] = o;
|
6
6
|
return e;
|
7
|
-
},
|
7
|
+
}, d = ["placeholder", "value"], m = { class: "label" }, v = {
|
8
8
|
name: "tInput"
|
9
|
-
},
|
9
|
+
}, y = /* @__PURE__ */ Object.assign(v, {
|
10
10
|
props: {
|
11
11
|
label: String,
|
12
12
|
val: String,
|
13
|
-
placehold: String
|
13
|
+
placehold: String,
|
14
|
+
primaryColor: {
|
15
|
+
type: String,
|
16
|
+
default: "#2563eb"
|
17
|
+
},
|
18
|
+
textColor: {
|
19
|
+
type: String,
|
20
|
+
default: "#27272a"
|
21
|
+
}
|
14
22
|
},
|
15
23
|
emits: ["update:val"],
|
16
24
|
setup(t) {
|
17
|
-
|
25
|
+
const a = r(() => ({
|
26
|
+
"--primary": t.primaryColor,
|
27
|
+
"--text": t.textColor
|
28
|
+
}));
|
29
|
+
return (e, l) => (c(), s("div", {
|
30
|
+
class: "contain",
|
31
|
+
style: i(a.value)
|
32
|
+
}, [
|
18
33
|
n("input", {
|
19
34
|
class: "inp",
|
20
35
|
name: "text",
|
21
36
|
type: "text",
|
22
37
|
placeholder: t.placehold,
|
23
38
|
value: t.val,
|
24
|
-
onInput:
|
25
|
-
}, null, 40,
|
26
|
-
n("label",
|
27
|
-
]));
|
39
|
+
onInput: l[0] || (l[0] = (o) => e.$emit("update:val", o.target.value))
|
40
|
+
}, null, 40, d),
|
41
|
+
n("label", m, p(t.label), 1)
|
42
|
+
], 4));
|
28
43
|
}
|
29
|
-
}), f = /* @__PURE__ */
|
44
|
+
}), f = /* @__PURE__ */ u(y, [["__scopeId", "data-v-4c91c086"]]);
|
30
45
|
export {
|
31
46
|
f as default
|
32
47
|
};
|
package/dist/tfsInput.umd.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue")):typeof define=="function"&&define.amd?define(["vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,e["tfs-Input"]=n(e.Vue))})(this,function(e){"use strict";const n=(t,
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue")):typeof define=="function"&&define.amd?define(["vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,e["tfs-Input"]=n(e.Vue))})(this,function(e){"use strict";const n=(t,a)=>{const l=t.__vccOpts||t;for(const[o,i]of a)l[o]=i;return l},r=["placeholder","value"],s={class:"label"};return n(Object.assign({name:"tInput"},{props:{label:String,val:String,placehold:String,primaryColor:{type:String,default:"#2563eb"},textColor:{type:String,default:"#27272a"}},emits:["update:val"],setup(t){const a=e.computed(()=>({"--primary":t.primaryColor,"--text":t.textColor}));return(l,o)=>(e.openBlock(),e.createElementBlock("div",{class:"contain",style:e.normalizeStyle(a.value)},[e.createElementVNode("input",{class:"inp",name:"text",type:"text",placeholder:t.placehold,value:t.val,onInput:o[0]||(o[0]=i=>l.$emit("update:val",i.target.value))},null,40,r),e.createElementVNode("label",s,e.toDisplayString(t.label),1)],4))}}),[["__scopeId","data-v-4c91c086"]])});
|
package/package.json
CHANGED
package/src/tfsInput.vue
CHANGED
@@ -5,7 +5,7 @@ export default {
|
|
5
5
|
</script>
|
6
6
|
|
7
7
|
<template>
|
8
|
-
<div class="contain">
|
8
|
+
<div class="contain" :style="colors">
|
9
9
|
<input
|
10
10
|
class="inp"
|
11
11
|
name="text"
|
@@ -17,22 +17,40 @@ export default {
|
|
17
17
|
<label class="label"> {{ label }} </label>
|
18
18
|
</div>
|
19
19
|
</template>
|
20
|
+
|
20
21
|
<script setup>
|
21
|
-
|
22
|
+
import { computed } from "vue";
|
23
|
+
|
24
|
+
const { label, val, placehold, primaryColor, textColor } = defineProps({
|
22
25
|
label: String,
|
23
26
|
val: String,
|
24
27
|
placehold: String,
|
28
|
+
primaryColor: {
|
29
|
+
type: String,
|
30
|
+
default: "#2563eb",
|
31
|
+
},
|
32
|
+
textColor: {
|
33
|
+
type: String,
|
34
|
+
default: "#27272a",
|
35
|
+
},
|
25
36
|
});
|
26
37
|
|
27
38
|
defineEmits(["update:val"]);
|
39
|
+
|
40
|
+
const colors = computed(() => ({
|
41
|
+
"--primary": primaryColor,
|
42
|
+
"--text": textColor,
|
43
|
+
}));
|
28
44
|
</script>
|
45
|
+
|
29
46
|
<style scoped>
|
30
47
|
.contain {
|
31
48
|
position: relative;
|
32
49
|
}
|
50
|
+
|
33
51
|
.inp {
|
34
52
|
background-color: transparent;
|
35
|
-
color:
|
53
|
+
color: var(--text);
|
36
54
|
border: 1px solid #52525b;
|
37
55
|
width: 90%;
|
38
56
|
margin: 5px 15px;
|
@@ -41,16 +59,16 @@ defineEmits(["update:val"]);
|
|
41
59
|
padding: 12px 16px;
|
42
60
|
font-size: 18px;
|
43
61
|
}
|
62
|
+
|
44
63
|
.inp:focus {
|
45
|
-
border: 1px solid
|
64
|
+
border: 1px solid var(--primary);
|
46
65
|
outline: none;
|
47
66
|
}
|
48
|
-
|
49
|
-
.inp
|
50
|
-
.inp::-ms-input-placeholder,
|
51
|
-
.inp::-moz-input-placeholder {
|
67
|
+
|
68
|
+
.inp::placeholder {
|
52
69
|
color: #71717a;
|
53
70
|
}
|
71
|
+
|
54
72
|
.inp,
|
55
73
|
.label {
|
56
74
|
transition:
|
@@ -58,6 +76,7 @@ defineEmits(["update:val"]);
|
|
58
76
|
background-color,
|
59
77
|
border-color 0.2s ease-out;
|
60
78
|
}
|
79
|
+
|
61
80
|
.label {
|
62
81
|
background-color: transparent;
|
63
82
|
color: #71717a;
|
@@ -68,11 +87,12 @@ defineEmits(["update:val"]);
|
|
68
87
|
border-radius: 7.25px;
|
69
88
|
position: absolute;
|
70
89
|
top: -12px;
|
71
|
-
left:
|
90
|
+
left: 24px;
|
72
91
|
backdrop-filter: blur(8px);
|
73
92
|
}
|
93
|
+
|
74
94
|
.contain:focus-within .label {
|
75
|
-
color:
|
76
|
-
border: 1px solid
|
95
|
+
color: var(--primary);
|
96
|
+
border: 1px solid var(--primary);
|
77
97
|
}
|
78
98
|
</style>
|