tfs-input 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -61
- package/dist/style.css +1 -1
- package/dist/tfsInput.js +32 -17
- package/dist/tfsInput.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/tfsInput.vue +27 -5
package/README.md
CHANGED
@@ -1,65 +1,6 @@
|
|
1
|
-
# tfsInput
|
1
|
+
# tfsInput [![npm](https://img.shields.io/npm/v/tfs-input.svg)](https://www.npmjs.com/package/tfs-input) [![Download](https://img.shields.io/npm/dm/tfs-input)](https://www.npmjs.com/package/tfs-input)
|
2
2
|
|
3
|
-
A customizable Vue 3 input component with
|
4
|
-
|
5
|
-
## Features
|
6
|
-
|
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.
|
12
|
-
|
13
|
-
## Installation
|
14
|
-
|
15
|
-
Install via npm:
|
16
|
-
|
17
|
-
```bash
|
18
|
-
npm install tfs-input@latest
|
19
|
-
```
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
Import and use the component in your Vue project.
|
24
|
-
|
25
|
-
```vue
|
26
|
-
<template>
|
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>
|
35
|
-
</template>
|
36
|
-
|
37
|
-
<script setup>
|
38
|
-
import { ref } from "vue";
|
39
|
-
import tInput from "tfs-input";
|
40
|
-
import "tfs-input/style.css";
|
41
|
-
|
42
|
-
const name = ref("");
|
43
|
-
</script>
|
44
|
-
```
|
45
|
-
|
46
|
-
## Properties
|
47
|
-
|
48
|
-
### Props
|
49
|
-
|
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. |
|
57
|
-
|
58
|
-
### Emits
|
59
|
-
|
60
|
-
| **Event** | **Description** |
|
61
|
-
| ------------ | ---------------------------------------------------- |
|
62
|
-
| `update:val` | Emits input value updates for v-model compatibility. |
|
3
|
+
A highly customizable Vue 3 input component with dynamic theming, reactive properties, and modern styling. Supports light/dark mode, responsive design, and customizable colors for seamless integration into any project.
|
63
4
|
|
64
5
|
## Credits
|
65
6
|
|
package/dist/style.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
[data-v-
|
1
|
+
[data-v-c12c66bd]:root,.light[data-v-c12c66bd],.auto[data-v-c12c66bd]{--c1: #52525b;--c2: #71717a}.dark[data-v-c12c66bd]{--c1: #71717a;--c2: #a1a1aa}@media (prefers-color-scheme: dark){.auto[data-v-c12c66bd]{--c1: #71717a;--c2: #a1a1aa}}.contain[data-v-c12c66bd]{position:relative}.inp[data-v-c12c66bd]{background-color:transparent;color:var(--text);border:1px solid var(--c1);width:90%;margin:5px 15px;border-radius:8.75px;background:none;padding:12px 16px;font-size:18px}.inp[data-v-c12c66bd]:focus{border:1px solid var(--primary);outline:none}.inp[data-v-c12c66bd]::placeholder{color:var(--c2)}.inp[data-v-c12c66bd],.label[data-v-c12c66bd]{transition:color,background-color,border-color .2s ease-out}.label[data-v-c12c66bd]{background-color:transparent;color:var(--c2);border:1px solid var(--c1);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-c12c66bd]{color:var(--primary);border:1px solid var(--primary)}
|
package/dist/tfsInput.js
CHANGED
@@ -1,23 +1,38 @@
|
|
1
|
-
import { computed as r, openBlock as c, createElementBlock as
|
2
|
-
const
|
1
|
+
import { computed as r, openBlock as c, createElementBlock as i, normalizeStyle as s, normalizeClass as u, createElementVNode as n, toDisplayString as d } from "vue";
|
2
|
+
const p = (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
|
+
}, m = ["placeholder", "value"], v = { class: "label" }, y = {
|
8
8
|
name: "tInput"
|
9
|
-
},
|
9
|
+
}, f = /* @__PURE__ */ Object.assign(y, {
|
10
10
|
props: {
|
11
|
-
label: {
|
12
|
-
|
13
|
-
|
11
|
+
label: {
|
12
|
+
type: String,
|
13
|
+
default: "Label"
|
14
|
+
},
|
15
|
+
val: {
|
16
|
+
type: String,
|
17
|
+
default: "Input Value"
|
18
|
+
},
|
19
|
+
placehold: {
|
20
|
+
type: String,
|
21
|
+
default: "Placeholder"
|
22
|
+
},
|
14
23
|
primaryColor: {
|
15
24
|
type: String,
|
16
|
-
default: "#2563eb"
|
25
|
+
default: "#2563eb",
|
26
|
+
validator: (t) => /^#([0-9A-F]{3}){1,2}$/i.test(t)
|
17
27
|
},
|
18
28
|
textColor: {
|
19
29
|
type: String,
|
20
|
-
default: "#27272a"
|
30
|
+
default: "#27272a",
|
31
|
+
validator: (t) => /^#([0-9A-F]{3}){1,2}$/i.test(t)
|
32
|
+
},
|
33
|
+
theme: {
|
34
|
+
type: String,
|
35
|
+
default: "auto"
|
21
36
|
}
|
22
37
|
},
|
23
38
|
emits: ["update:val"],
|
@@ -26,9 +41,9 @@ const i = (t, a) => {
|
|
26
41
|
"--primary": t.primaryColor,
|
27
42
|
"--text": t.textColor
|
28
43
|
}));
|
29
|
-
return (e, l) => (c(),
|
30
|
-
class: "contain",
|
31
|
-
style:
|
44
|
+
return (e, l) => (c(), i("div", {
|
45
|
+
class: u(["contain", t.theme]),
|
46
|
+
style: s(a.value)
|
32
47
|
}, [
|
33
48
|
n("input", {
|
34
49
|
class: "inp",
|
@@ -37,11 +52,11 @@ const i = (t, a) => {
|
|
37
52
|
placeholder: t.placehold,
|
38
53
|
value: t.val,
|
39
54
|
onInput: l[0] || (l[0] = (o) => e.$emit("update:val", o.target.value))
|
40
|
-
}, null, 40,
|
41
|
-
n("label",
|
42
|
-
],
|
55
|
+
}, null, 40, m),
|
56
|
+
n("label", v, d(t.label), 1)
|
57
|
+
], 6));
|
43
58
|
}
|
44
|
-
}),
|
59
|
+
}), b = /* @__PURE__ */ p(f, [["__scopeId", "data-v-c12c66bd"]]);
|
45
60
|
export {
|
46
|
-
|
61
|
+
b as default
|
47
62
|
};
|
package/dist/tfsInput.umd.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("vue")):typeof define=="function"&&define.amd?define(["vue"],l):(e=typeof globalThis<"u"?globalThis:e||self,e["tfs-Input"]=l(e.Vue))})(this,function(e){"use strict";const l=(t,o)=>{const
|
1
|
+
(function(e,l){typeof exports=="object"&&typeof module<"u"?module.exports=l(require("vue")):typeof define=="function"&&define.amd?define(["vue"],l):(e=typeof globalThis<"u"?globalThis:e||self,e["tfs-Input"]=l(e.Vue))})(this,function(e){"use strict";const l=(t,o)=>{const a=t.__vccOpts||t;for(const[n,i]of o)a[n]=i;return a},r=["placeholder","value"],s={class:"label"};return l(Object.assign({name:"tInput"},{props:{label:{type:String,default:"Label"},val:{type:String,default:"Input Value"},placehold:{type:String,default:"Placeholder"},primaryColor:{type:String,default:"#2563eb",validator:t=>/^#([0-9A-F]{3}){1,2}$/i.test(t)},textColor:{type:String,default:"#27272a",validator:t=>/^#([0-9A-F]{3}){1,2}$/i.test(t)},theme:{type:String,default:"auto"}},emits:["update:val"],setup(t){const o=e.computed(()=>({"--primary":t.primaryColor,"--text":t.textColor}));return(a,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["contain",t.theme]),style:e.normalizeStyle(o.value)},[e.createElementVNode("input",{class:"inp",name:"text",type:"text",placeholder:t.placehold,value:t.val,onInput:n[0]||(n[0]=i=>a.$emit("update:val",i.target.value))},null,40,r),e.createElementVNode("label",s,e.toDisplayString(t.label),1)],6))}}),[["__scopeId","data-v-c12c66bd"]])});
|
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" :style="colors">
|
8
|
+
<div class="contain" :class="theme" :style="colors">
|
9
9
|
<input
|
10
10
|
class="inp"
|
11
11
|
name="text"
|
@@ -22,16 +22,31 @@ export default {
|
|
22
22
|
import { computed } from "vue";
|
23
23
|
|
24
24
|
const { label, val, placehold, primaryColor, textColor } = defineProps({
|
25
|
-
label: {
|
26
|
-
|
27
|
-
|
25
|
+
label: {
|
26
|
+
type: String,
|
27
|
+
default: "Label",
|
28
|
+
},
|
29
|
+
val: {
|
30
|
+
type: String,
|
31
|
+
default: "Input Value",
|
32
|
+
},
|
33
|
+
placehold: {
|
34
|
+
type: String,
|
35
|
+
default: "Placeholder",
|
36
|
+
},
|
28
37
|
primaryColor: {
|
29
38
|
type: String,
|
30
39
|
default: "#2563eb",
|
40
|
+
validator: (value) => /^#([0-9A-F]{3}){1,2}$/i.test(value),
|
31
41
|
},
|
32
42
|
textColor: {
|
33
43
|
type: String,
|
34
44
|
default: "#27272a",
|
45
|
+
validator: (value) => /^#([0-9A-F]{3}){1,2}$/i.test(value),
|
46
|
+
},
|
47
|
+
theme: {
|
48
|
+
type: String,
|
49
|
+
default: "auto",
|
35
50
|
},
|
36
51
|
});
|
37
52
|
|
@@ -45,7 +60,8 @@ const colors = computed(() => ({
|
|
45
60
|
|
46
61
|
<style scoped>
|
47
62
|
:root,
|
48
|
-
.light
|
63
|
+
.light,
|
64
|
+
.auto {
|
49
65
|
--c1: #52525b;
|
50
66
|
--c2: #71717a;
|
51
67
|
}
|
@@ -53,6 +69,12 @@ const colors = computed(() => ({
|
|
53
69
|
--c1: #71717a;
|
54
70
|
--c2: #a1a1aa;
|
55
71
|
}
|
72
|
+
@media (prefers-color-scheme: dark) {
|
73
|
+
.auto {
|
74
|
+
--c1: #71717a;
|
75
|
+
--c2: #a1a1aa;
|
76
|
+
}
|
77
|
+
}
|
56
78
|
.contain {
|
57
79
|
position: relative;
|
58
80
|
}
|