tfs-input 0.9.7 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
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 animated floating labels for clean, modern forms.
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
- .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)}
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 s, normalizeStyle as i, createElementVNode as n, toDisplayString as p } from "vue";
2
- const u = (t, a) => {
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
- }, d = ["placeholder", "value"], m = { class: "label" }, v = {
7
+ }, m = ["placeholder", "value"], v = { class: "label" }, y = {
8
8
  name: "tInput"
9
- }, y = /* @__PURE__ */ Object.assign(v, {
9
+ }, f = /* @__PURE__ */ Object.assign(y, {
10
10
  props: {
11
- label: String,
12
- val: String,
13
- placehold: String,
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 u = (t, a) => {
26
41
  "--primary": t.primaryColor,
27
42
  "--text": t.textColor
28
43
  }));
29
- return (e, l) => (c(), s("div", {
30
- class: "contain",
31
- style: i(a.value)
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 u = (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, d),
41
- n("label", m, p(t.label), 1)
42
- ], 4));
55
+ }, null, 40, m),
56
+ n("label", v, d(t.label), 1)
57
+ ], 6));
43
58
  }
44
- }), f = /* @__PURE__ */ u(y, [["__scopeId", "data-v-4c91c086"]]);
59
+ }), b = /* @__PURE__ */ p(f, [["__scopeId", "data-v-c12c66bd"]]);
45
60
  export {
46
- f as default
61
+ b as default
47
62
  };
@@ -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,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"]])});
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
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "tfs-input",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Customizable Vue input component floating labels for modern UIs.",
7
- "homepage": "https://github.com/MFM-347/tfsInput#readme",
7
+ "homepage": "https://MFM-347.github.io/tfsInput",
8
8
  "files": [
9
9
  "dist/*",
10
10
  "src/*"
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: String,
26
- val: String,
27
- placehold: String,
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
 
@@ -44,6 +59,22 @@ const colors = computed(() => ({
44
59
  </script>
45
60
 
46
61
  <style scoped>
62
+ :root,
63
+ .light,
64
+ .auto {
65
+ --c1: #52525b;
66
+ --c2: #71717a;
67
+ }
68
+ .dark {
69
+ --c1: #71717a;
70
+ --c2: #a1a1aa;
71
+ }
72
+ @media (prefers-color-scheme: dark) {
73
+ .auto {
74
+ --c1: #71717a;
75
+ --c2: #a1a1aa;
76
+ }
77
+ }
47
78
  .contain {
48
79
  position: relative;
49
80
  }
@@ -51,7 +82,7 @@ const colors = computed(() => ({
51
82
  .inp {
52
83
  background-color: transparent;
53
84
  color: var(--text);
54
- border: 1px solid #52525b;
85
+ border: 1px solid var(--c1);
55
86
  width: 90%;
56
87
  margin: 5px 15px;
57
88
  border-radius: 8.75px;
@@ -66,7 +97,7 @@ const colors = computed(() => ({
66
97
  }
67
98
 
68
99
  .inp::placeholder {
69
- color: #71717a;
100
+ color: var(--c2);
70
101
  }
71
102
 
72
103
  .inp,
@@ -79,8 +110,8 @@ const colors = computed(() => ({
79
110
 
80
111
  .label {
81
112
  background-color: transparent;
82
- color: #71717a;
83
- border: 1px solid #52525b;
113
+ color: var(--c2);
114
+ border: 1px solid var(--c1);
84
115
  font-size: 15px;
85
116
  font-weight: 600;
86
117
  padding: 0 6px;