tfs-input 0.9.5 → 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 -49
- package/dist/tfsInput.js +45 -51
- package/dist/tfsInput.umd.cjs +1 -55
- package/package.json +1 -1
- package/src/main.js +3 -1
- package/src/tfsInput.vue +37 -15
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,49 +1 @@
|
|
1
|
-
.contain[data-v-
|
2
|
-
position: relative;
|
3
|
-
}
|
4
|
-
.inp[data-v-cb9a3059] {
|
5
|
-
background-color: transparent;
|
6
|
-
color: #27272a;
|
7
|
-
border: 1px solid #52525b;
|
8
|
-
width: 100%;
|
9
|
-
margin: 5px 15px;
|
10
|
-
border-radius: 8.75px;
|
11
|
-
background: none;
|
12
|
-
padding: 12px 16px;
|
13
|
-
font-size: 18px;
|
14
|
-
}
|
15
|
-
.inp[data-v-cb9a3059]:focus {
|
16
|
-
border: 1px solid #2563eb;
|
17
|
-
outline: none;
|
18
|
-
}
|
19
|
-
.inp[data-v-cb9a3059]::placeholder,
|
20
|
-
.inp[data-v-cb9a3059]::-webkit-input-placeholder,
|
21
|
-
.inp[data-v-cb9a3059]::-ms-input-placeholder,
|
22
|
-
.inp[data-v-cb9a3059]::-moz-input-placeholder {
|
23
|
-
color: #71717a;
|
24
|
-
}
|
25
|
-
.inp[data-v-cb9a3059],
|
26
|
-
.label[data-v-cb9a3059] {
|
27
|
-
transition:
|
28
|
-
color,
|
29
|
-
background-color,
|
30
|
-
border-color 0.2s ease-out;
|
31
|
-
}
|
32
|
-
.label[data-v-cb9a3059] {
|
33
|
-
background-color: transparent;
|
34
|
-
color: #71717a;
|
35
|
-
border: 1px solid #52525b;
|
36
|
-
font-size: 15px;
|
37
|
-
font-weight: 600;
|
38
|
-
padding: 0 6px;
|
39
|
-
border-radius: 7.25px;
|
40
|
-
position: absolute;
|
41
|
-
top: -12px;
|
42
|
-
left: 40px;
|
43
|
-
-webkit-backdrop-filter: blur(8px);
|
44
|
-
backdrop-filter: blur(8px);
|
45
|
-
}
|
46
|
-
.contain:focus-within .label[data-v-cb9a3059] {
|
47
|
-
color: #2563eb;
|
48
|
-
border: 1px solid #2563eb;
|
49
|
-
}
|
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,53 +1,47 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
props: {
|
18
|
-
label: String,
|
19
|
-
val: String,
|
20
|
-
placehold: String,
|
21
|
-
},
|
22
|
-
emits: ["update:val"],
|
23
|
-
setup(t, { expose: l }) {
|
24
|
-
return (
|
25
|
-
l({
|
26
|
-
name: "tInput",
|
27
|
-
}),
|
28
|
-
(e, a) => (
|
29
|
-
s(),
|
30
|
-
c("div", i, [
|
31
|
-
o(
|
32
|
-
"input",
|
33
|
-
{
|
34
|
-
class: "inp",
|
35
|
-
name: "text",
|
36
|
-
type: "text",
|
37
|
-
placeholder: t.placehold,
|
38
|
-
value: t.val,
|
39
|
-
onInput:
|
40
|
-
a[0] || (a[0] = (n) => e.$emit("update:val", n.target.value)),
|
41
|
-
},
|
42
|
-
null,
|
43
|
-
40,
|
44
|
-
u,
|
45
|
-
),
|
46
|
-
o("label", d, p(t.label), 1),
|
47
|
-
])
|
48
|
-
)
|
49
|
-
);
|
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
|
+
const e = t.__vccOpts || t;
|
4
|
+
for (const [l, o] of a)
|
5
|
+
e[l] = o;
|
6
|
+
return e;
|
7
|
+
}, d = ["placeholder", "value"], m = { class: "label" }, v = {
|
8
|
+
name: "tInput"
|
9
|
+
}, y = /* @__PURE__ */ Object.assign(v, {
|
10
|
+
props: {
|
11
|
+
label: String,
|
12
|
+
val: String,
|
13
|
+
placehold: String,
|
14
|
+
primaryColor: {
|
15
|
+
type: String,
|
16
|
+
default: "#2563eb"
|
50
17
|
},
|
18
|
+
textColor: {
|
19
|
+
type: String,
|
20
|
+
default: "#27272a"
|
21
|
+
}
|
51
22
|
},
|
52
|
-
|
53
|
-
|
23
|
+
emits: ["update:val"],
|
24
|
+
setup(t) {
|
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
|
+
}, [
|
33
|
+
n("input", {
|
34
|
+
class: "inp",
|
35
|
+
name: "text",
|
36
|
+
type: "text",
|
37
|
+
placeholder: t.placehold,
|
38
|
+
value: t.val,
|
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));
|
43
|
+
}
|
44
|
+
}), f = /* @__PURE__ */ u(y, [["__scopeId", "data-v-4c91c086"]]);
|
45
|
+
export {
|
46
|
+
f as default
|
47
|
+
};
|
package/dist/tfsInput.umd.cjs
CHANGED
@@ -1,55 +1 @@
|
|
1
|
-
(function (
|
2
|
-
typeof exports == "object" && typeof module < "u"
|
3
|
-
? e(exports, require("vue"))
|
4
|
-
: typeof define == "function" && define.amd
|
5
|
-
? define(["exports", "vue"], e)
|
6
|
-
: ((t = typeof globalThis < "u" ? globalThis : t || self),
|
7
|
-
e((t["tfs-Input"] = {}), t.Vue));
|
8
|
-
})(this, function (t, e) {
|
9
|
-
"use strict";
|
10
|
-
const i = (n, a) => {
|
11
|
-
const o = n.__vccOpts || n;
|
12
|
-
for (const [l, s] of a) o[l] = s;
|
13
|
-
return o;
|
14
|
-
},
|
15
|
-
c = { class: "contain" },
|
16
|
-
p = ["placeholder", "value"],
|
17
|
-
u = { class: "label" },
|
18
|
-
d = i(
|
19
|
-
{
|
20
|
-
__name: "tfsInput",
|
21
|
-
props: { label: String, val: String, placehold: String },
|
22
|
-
emits: ["update:val"],
|
23
|
-
setup(n, { expose: a }) {
|
24
|
-
return (
|
25
|
-
a({ name: "tInput" }),
|
26
|
-
(o, l) => (
|
27
|
-
e.openBlock(),
|
28
|
-
e.createElementBlock("div", c, [
|
29
|
-
e.createElementVNode(
|
30
|
-
"input",
|
31
|
-
{
|
32
|
-
class: "inp",
|
33
|
-
name: "text",
|
34
|
-
type: "text",
|
35
|
-
placeholder: n.placehold,
|
36
|
-
value: n.val,
|
37
|
-
onInput:
|
38
|
-
l[0] ||
|
39
|
-
(l[0] = (s) => o.$emit("update:val", s.target.value)),
|
40
|
-
},
|
41
|
-
null,
|
42
|
-
40,
|
43
|
-
p,
|
44
|
-
),
|
45
|
-
e.createElementVNode("label", u, e.toDisplayString(n.label), 1),
|
46
|
-
])
|
47
|
-
)
|
48
|
-
);
|
49
|
-
},
|
50
|
-
},
|
51
|
-
[["__scopeId", "data-v-cb9a3059"]],
|
52
|
-
);
|
53
|
-
(t.tInput = d),
|
54
|
-
Object.defineProperty(t, Symbol.toStringTag, { value: "Module" });
|
55
|
-
});
|
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/main.js
CHANGED
package/src/tfsInput.vue
CHANGED
@@ -1,5 +1,11 @@
|
|
1
|
+
<script>
|
2
|
+
export default {
|
3
|
+
name: "tInput",
|
4
|
+
};
|
5
|
+
</script>
|
6
|
+
|
1
7
|
<template>
|
2
|
-
<div class="contain">
|
8
|
+
<div class="contain" :style="colors">
|
3
9
|
<input
|
4
10
|
class="inp"
|
5
11
|
name="text"
|
@@ -13,42 +19,56 @@
|
|
13
19
|
</template>
|
14
20
|
|
15
21
|
<script setup>
|
16
|
-
|
22
|
+
import { computed } from "vue";
|
23
|
+
|
24
|
+
const { label, val, placehold, primaryColor, textColor } = defineProps({
|
17
25
|
label: String,
|
18
26
|
val: String,
|
19
27
|
placehold: String,
|
28
|
+
primaryColor: {
|
29
|
+
type: String,
|
30
|
+
default: "#2563eb",
|
31
|
+
},
|
32
|
+
textColor: {
|
33
|
+
type: String,
|
34
|
+
default: "#27272a",
|
35
|
+
},
|
20
36
|
});
|
21
37
|
|
22
38
|
defineEmits(["update:val"]);
|
23
|
-
|
24
|
-
|
25
|
-
|
39
|
+
|
40
|
+
const colors = computed(() => ({
|
41
|
+
"--primary": primaryColor,
|
42
|
+
"--text": textColor,
|
43
|
+
}));
|
26
44
|
</script>
|
45
|
+
|
27
46
|
<style scoped>
|
28
47
|
.contain {
|
29
48
|
position: relative;
|
30
49
|
}
|
50
|
+
|
31
51
|
.inp {
|
32
52
|
background-color: transparent;
|
33
|
-
color:
|
53
|
+
color: var(--text);
|
34
54
|
border: 1px solid #52525b;
|
35
|
-
width:
|
55
|
+
width: 90%;
|
36
56
|
margin: 5px 15px;
|
37
57
|
border-radius: 8.75px;
|
38
58
|
background: none;
|
39
59
|
padding: 12px 16px;
|
40
60
|
font-size: 18px;
|
41
61
|
}
|
62
|
+
|
42
63
|
.inp:focus {
|
43
|
-
border: 1px solid
|
64
|
+
border: 1px solid var(--primary);
|
44
65
|
outline: none;
|
45
66
|
}
|
46
|
-
|
47
|
-
.inp
|
48
|
-
.inp::-ms-input-placeholder,
|
49
|
-
.inp::-moz-input-placeholder {
|
67
|
+
|
68
|
+
.inp::placeholder {
|
50
69
|
color: #71717a;
|
51
70
|
}
|
71
|
+
|
52
72
|
.inp,
|
53
73
|
.label {
|
54
74
|
transition:
|
@@ -56,6 +76,7 @@ defineExpose({
|
|
56
76
|
background-color,
|
57
77
|
border-color 0.2s ease-out;
|
58
78
|
}
|
79
|
+
|
59
80
|
.label {
|
60
81
|
background-color: transparent;
|
61
82
|
color: #71717a;
|
@@ -66,11 +87,12 @@ defineExpose({
|
|
66
87
|
border-radius: 7.25px;
|
67
88
|
position: absolute;
|
68
89
|
top: -12px;
|
69
|
-
left:
|
90
|
+
left: 24px;
|
70
91
|
backdrop-filter: blur(8px);
|
71
92
|
}
|
93
|
+
|
72
94
|
.contain:focus-within .label {
|
73
|
-
color:
|
74
|
-
border: 1px solid
|
95
|
+
color: var(--primary);
|
96
|
+
border: 1px solid var(--primary);
|
75
97
|
}
|
76
98
|
</style>
|