@a-vision-software/vue-input-components 1.1.56 → 1.2.0
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/README.md +92 -239
- package/dist/types.d.ts +2 -0
- package/dist/vue-input-components.cjs.js +1 -561
- package/dist/vue-input-components.css +1 -1
- package/dist/vue-input-components.es.js +4639 -7764
- package/dist/vue-input-components.umd.js +1 -561
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,36 +1,16 @@
|
|
|
1
1
|
# Vue Input Components
|
|
2
2
|
|
|
3
|
-
A collection of reusable Vue 3 input components with TypeScript support.
|
|
3
|
+
A collection of reusable Vue 3 input components with TypeScript support, designed for modern web applications.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- Autosave functionality with debounce
|
|
15
|
-
- Change indicators (saved, changed)
|
|
16
|
-
- Fully responsive
|
|
17
|
-
- Accessible
|
|
18
|
-
- TypeScript support
|
|
19
|
-
- Multiline text input support (textarea)
|
|
20
|
-
- Adjustable number of visible rows
|
|
21
|
-
- Optional maximum length limit
|
|
22
|
-
- Vertical resizing support
|
|
23
|
-
|
|
24
|
-
### FileUpload Component
|
|
25
|
-
|
|
26
|
-
- Drag and drop file upload
|
|
27
|
-
- File size validation (20MB limit)
|
|
28
|
-
- Multiple file selection
|
|
29
|
-
- Progress bar for upload status
|
|
30
|
-
- Customizable icons
|
|
31
|
-
- Automatic or manual upload modes
|
|
32
|
-
- File list display with sizes
|
|
33
|
-
- Error handling and status messages
|
|
7
|
+
- 🚀 Built with Vue 3 and TypeScript
|
|
8
|
+
- 🎨 Customizable styling with CSS variables
|
|
9
|
+
- 📦 Tree-shakeable components
|
|
10
|
+
- 🎯 Fully typed with TypeScript
|
|
11
|
+
- 🎨 Beautiful and consistent design
|
|
12
|
+
- 🔍 Accessible by default
|
|
13
|
+
- 📱 Responsive and mobile-friendly
|
|
34
14
|
|
|
35
15
|
## Installation
|
|
36
16
|
|
|
@@ -38,102 +18,34 @@ A collection of reusable Vue 3 input components with TypeScript support.
|
|
|
38
18
|
npm install @a-vision-software/vue-input-components
|
|
39
19
|
```
|
|
40
20
|
|
|
41
|
-
##
|
|
21
|
+
## Usage
|
|
42
22
|
|
|
43
|
-
|
|
23
|
+
### Import Styles
|
|
44
24
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
import { TextInput, FileUpload } from '@a-vision-software/vue-input-components'
|
|
48
|
-
</script>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
2. Import the color variables in your main CSS file:
|
|
52
|
-
|
|
53
|
-
```css
|
|
54
|
-
@import '@a-vision-software/vue-input-components/dist/colors.css';
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
3. Use the components in your template:
|
|
58
|
-
|
|
59
|
-
```vue
|
|
60
|
-
<template>
|
|
61
|
-
<TextInput v-model="username" label="Username" icon="user" :required="true" />
|
|
62
|
-
|
|
63
|
-
<FileUpload
|
|
64
|
-
icon="upload"
|
|
65
|
-
upload-url="https://api.example.com/upload"
|
|
66
|
-
@upload-complete="handleUploadComplete"
|
|
67
|
-
/>
|
|
68
|
-
</template>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Development
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npm run dev
|
|
25
|
+
```typescript
|
|
26
|
+
import '@a-vision-software/vue-input-components/styles.css'
|
|
75
27
|
```
|
|
76
28
|
|
|
77
|
-
|
|
29
|
+
### Import Components
|
|
78
30
|
|
|
79
|
-
```
|
|
80
|
-
|
|
31
|
+
```typescript
|
|
32
|
+
import { TextInput, FileUpload, Action } from '@a-vision-software/vue-input-components'
|
|
81
33
|
```
|
|
82
34
|
|
|
83
35
|
## Components
|
|
84
36
|
|
|
85
37
|
### TextInput
|
|
86
38
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
#### Props
|
|
90
|
-
|
|
91
|
-
| Prop | Type | Default | Description |
|
|
92
|
-
| ------------- | -------------------------------- | --------- | ------------------------------------------ |
|
|
93
|
-
| modelValue | string | required | The input value (v-model) |
|
|
94
|
-
| label | string | undefined | Input label |
|
|
95
|
-
| type | string | 'text' | Input type (text, password, email, etc.) |
|
|
96
|
-
| icon | string | undefined | Font Awesome icon name |
|
|
97
|
-
| placeholder | string | undefined | Input placeholder |
|
|
98
|
-
| required | boolean | false | Whether the field is required |
|
|
99
|
-
| disabled | boolean | false | Whether the field is disabled |
|
|
100
|
-
| error | string | undefined | Error message |
|
|
101
|
-
| success | string | undefined | Success message |
|
|
102
|
-
| labelPosition | 'top' \| 'left' | 'top' | Label position |
|
|
103
|
-
| labelAlign | 'left' \| 'right' \| 'center' | 'left' | Label text alignment |
|
|
104
|
-
| totalWidth | string | '100%' | Total width of the component |
|
|
105
|
-
| inputWidth | string | undefined | Width of the input field |
|
|
106
|
-
| labelWidth | string | undefined | Width of the label (when position is left) |
|
|
107
|
-
| autosave | (value: string) => Promise<void> | undefined | Autosave callback function |
|
|
108
|
-
| isTextarea | boolean | false | Whether to render as a textarea |
|
|
109
|
-
| maxHeight | string | '14rem' | Maximum height for textarea |
|
|
110
|
-
| height | string | '5.5rem' | Initial height for textarea |
|
|
111
|
-
|
|
112
|
-
#### Events
|
|
113
|
-
|
|
114
|
-
| Event | Payload | Description |
|
|
115
|
-
| ----------------- | ------- | --------------------------------------------------- |
|
|
116
|
-
| update:modelValue | string | Emitted when the input value changes |
|
|
117
|
-
| changed | void | Emitted when the value has changed (500ms debounce) |
|
|
118
|
-
| saved | void | Emitted when autosave completes successfully |
|
|
119
|
-
|
|
120
|
-
#### Examples
|
|
121
|
-
|
|
122
|
-
##### Basic Text Input
|
|
39
|
+
A versatile text input component with validation and error handling.
|
|
123
40
|
|
|
124
41
|
```vue
|
|
125
42
|
<template>
|
|
126
43
|
<TextInput
|
|
127
|
-
v-model="
|
|
44
|
+
v-model="value"
|
|
128
45
|
label="Username"
|
|
129
|
-
type="text"
|
|
130
|
-
icon="user"
|
|
131
46
|
placeholder="Enter your username"
|
|
132
|
-
:error="
|
|
133
|
-
:
|
|
134
|
-
label-position="top"
|
|
135
|
-
label-align="left"
|
|
136
|
-
required
|
|
47
|
+
:error="error"
|
|
48
|
+
:disabled="false"
|
|
137
49
|
/>
|
|
138
50
|
</template>
|
|
139
51
|
|
|
@@ -141,181 +53,122 @@ Basic text input component with advanced features, including textarea support.
|
|
|
141
53
|
import { ref } from 'vue'
|
|
142
54
|
import { TextInput } from '@a-vision-software/vue-input-components'
|
|
143
55
|
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
const handleUsernameAutosave = async (value: string) => {
|
|
148
|
-
// Your autosave logic here
|
|
149
|
-
}
|
|
56
|
+
const value = ref('')
|
|
57
|
+
const error = ref('')
|
|
150
58
|
</script>
|
|
151
59
|
```
|
|
152
60
|
|
|
153
|
-
|
|
61
|
+
#### Props
|
|
62
|
+
|
|
63
|
+
| Prop | Type | Default | Description |
|
|
64
|
+
| ------------- | --------------------------------------------------------------- | -------- | ----------------------------- |
|
|
65
|
+
| `modelValue` | `string` | `''` | The input value |
|
|
66
|
+
| `label` | `string` | `''` | The input label |
|
|
67
|
+
| `placeholder` | `string` | `''` | The input placeholder |
|
|
68
|
+
| `error` | `string` | `''` | Error message to display |
|
|
69
|
+
| `disabled` | `boolean` | `false` | Whether the input is disabled |
|
|
70
|
+
| `required` | `boolean` | `false` | Whether the input is required |
|
|
71
|
+
| `type` | `'text' \| 'password' \| 'email' \| 'number' \| 'tel' \| 'url'` | `'text'` | The input type |
|
|
72
|
+
|
|
73
|
+
### FileUpload
|
|
74
|
+
|
|
75
|
+
A file upload component with drag-and-drop support and file type validation.
|
|
154
76
|
|
|
155
77
|
```vue
|
|
156
78
|
<template>
|
|
157
|
-
<
|
|
158
|
-
v-model="
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
:error="descriptionError"
|
|
164
|
-
:autosave="handleDescriptionAutosave"
|
|
165
|
-
label-position="top"
|
|
166
|
-
label-align="left"
|
|
167
|
-
required
|
|
79
|
+
<FileUpload
|
|
80
|
+
v-model="files"
|
|
81
|
+
accept="image/*"
|
|
82
|
+
:multiple="true"
|
|
83
|
+
:max-size="5 * 1024 * 1024"
|
|
84
|
+
@error="handleError"
|
|
168
85
|
/>
|
|
169
86
|
</template>
|
|
170
87
|
|
|
171
88
|
<script setup lang="ts">
|
|
172
89
|
import { ref } from 'vue'
|
|
173
|
-
import {
|
|
90
|
+
import { FileUpload } from '@a-vision-software/vue-input-components'
|
|
174
91
|
|
|
175
|
-
const
|
|
176
|
-
const descriptionError = ref('')
|
|
92
|
+
const files = ref<File[]>([])
|
|
177
93
|
|
|
178
|
-
const
|
|
179
|
-
|
|
94
|
+
const handleError = (error: string) => {
|
|
95
|
+
console.error(error)
|
|
180
96
|
}
|
|
181
97
|
</script>
|
|
182
98
|
```
|
|
183
99
|
|
|
184
|
-
### FileUpload
|
|
185
|
-
|
|
186
|
-
Flexible file upload component with drag and drop support.
|
|
187
|
-
|
|
188
100
|
#### Props
|
|
189
101
|
|
|
190
|
-
| Prop
|
|
191
|
-
|
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
|
|
195
|
-
|
|
102
|
+
| Prop | Type | Default | Description |
|
|
103
|
+
| ------------ | --------- | ----------------- | -------------------------------------- |
|
|
104
|
+
| `modelValue` | `File[]` | `[]` | The selected files |
|
|
105
|
+
| `accept` | `string` | `'*'` | Accepted file types |
|
|
106
|
+
| `multiple` | `boolean` | `false` | Whether multiple files can be selected |
|
|
107
|
+
| `max-size` | `number` | `5 * 1024 * 1024` | Maximum file size in bytes |
|
|
108
|
+
| `disabled` | `boolean` | `false` | Whether the upload is disabled |
|
|
196
109
|
|
|
197
|
-
|
|
198
|
-
| ----------------- | --------------- | --------------------------------------------------- |
|
|
199
|
-
| `upload-complete` | `files: File[]` | Emitted when files are successfully uploaded |
|
|
200
|
-
| `upload-error` | `error: string` | Emitted when an upload error occurs |
|
|
201
|
-
| `files-selected` | `files: File[]` | Emitted when files are selected (manual mode) |
|
|
202
|
-
| `start-upload` | `files: File[]` | Emitted when upload button is clicked (manual mode) |
|
|
110
|
+
### Action
|
|
203
111
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
##### Automatic Upload Mode
|
|
112
|
+
A versatile action component that can be used as a button or link with customizable colors and icons.
|
|
207
113
|
|
|
208
114
|
```vue
|
|
209
115
|
<template>
|
|
210
|
-
<
|
|
211
|
-
icon="upload"
|
|
212
|
-
upload-url="https://api.example.com/upload"
|
|
213
|
-
@upload-complete="handleUploadComplete"
|
|
214
|
-
@upload-error="handleUploadError"
|
|
215
|
-
/>
|
|
116
|
+
<Action icon="save" label="Save Changes" :color="'#4CAF50'" @click="handleSave" />
|
|
216
117
|
</template>
|
|
217
118
|
|
|
218
|
-
<script setup>
|
|
219
|
-
import {
|
|
220
|
-
|
|
221
|
-
const handleUploadComplete = (files) => {
|
|
222
|
-
console.log('Uploaded files:', files)
|
|
223
|
-
}
|
|
119
|
+
<script setup lang="ts">
|
|
120
|
+
import { Action } from '@a-vision-software/vue-input-components'
|
|
224
121
|
|
|
225
|
-
const
|
|
226
|
-
console.
|
|
122
|
+
const handleSave = () => {
|
|
123
|
+
console.log('Saving changes...')
|
|
227
124
|
}
|
|
228
125
|
</script>
|
|
229
126
|
```
|
|
230
127
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
```vue
|
|
234
|
-
<template>
|
|
235
|
-
<FileUpload
|
|
236
|
-
icon="image"
|
|
237
|
-
@files-selected="handleFilesSelected"
|
|
238
|
-
@start-upload="handleStartUpload"
|
|
239
|
-
/>
|
|
240
|
-
</template>
|
|
241
|
-
|
|
242
|
-
<script setup>
|
|
243
|
-
import { FileUpload } from '@a-vision-software/vue-input-components'
|
|
128
|
+
#### Props
|
|
244
129
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
</script>
|
|
254
|
-
```
|
|
130
|
+
| Prop | Type | Default | Description |
|
|
131
|
+
| ---------- | --------------------------------- | ----------- | ------------------------------ |
|
|
132
|
+
| `icon` | `string` | `''` | Font Awesome icon name |
|
|
133
|
+
| `label` | `string` | `''` | Action label text |
|
|
134
|
+
| `color` | `string` | `'#4CAF50'` | Custom color for the action |
|
|
135
|
+
| `disabled` | `boolean` | `false` | Whether the action is disabled |
|
|
136
|
+
| `href` | `string` | `''` | URL for link actions |
|
|
137
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | Button type |
|
|
255
138
|
|
|
256
139
|
## Styling
|
|
257
140
|
|
|
258
|
-
|
|
141
|
+
The components use CSS variables for easy customization. You can override these variables in your application:
|
|
259
142
|
|
|
260
143
|
```css
|
|
261
144
|
:root {
|
|
262
|
-
|
|
263
|
-
--primary
|
|
264
|
-
--
|
|
265
|
-
--
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
--text-color: #2c3e50;
|
|
269
|
-
--text-color-light: #7f8c8d;
|
|
270
|
-
|
|
271
|
-
/* UI colors */
|
|
272
|
-
--border-color: #dcdfe6;
|
|
273
|
-
--icon-color: #95a5a6;
|
|
274
|
-
|
|
275
|
-
/* State colors */
|
|
276
|
-
--error-color: #e74c3c;
|
|
277
|
-
--error-color-light: rgba(231, 76, 60, 0.2);
|
|
278
|
-
--success-color: #2ecc71;
|
|
279
|
-
--success-color-light: rgba(46, 204, 113, 0.2);
|
|
280
|
-
--warning-color: #f1c40f;
|
|
281
|
-
--warning-color-light: rgba(241, 196, 15, 0.2);
|
|
282
|
-
|
|
283
|
-
/* Background colors */
|
|
284
|
-
--disabled-color: #bdc3c7;
|
|
285
|
-
--disabled-background: #f5f7fa;
|
|
286
|
-
--card-bg: #ffffff;
|
|
287
|
-
--background-color: #f8f9fa;
|
|
288
|
-
|
|
289
|
-
/* Input colors */
|
|
290
|
-
--input-bg-color: rgba(255, 255, 255, 0.8);
|
|
291
|
-
--input-bg-hover: rgba(0, 0, 0, 0.05);
|
|
292
|
-
--input-bg-disabled: rgba(0, 0, 0, 0.05);
|
|
293
|
-
|
|
294
|
-
/* File Upload specific colors */
|
|
295
|
-
--upload-border-color: var(--border-color);
|
|
296
|
-
--upload-bg-color: var(--background-color);
|
|
297
|
-
--upload-dragging-border-color: var(--primary-color);
|
|
298
|
-
--upload-dragging-bg-color: var(--primary-color-light);
|
|
299
|
-
--upload-has-files-border-color: var(--success-color);
|
|
300
|
-
--upload-has-files-bg-color: var(--success-color-light);
|
|
301
|
-
--upload-icon-color: var(--icon-color);
|
|
302
|
-
--upload-text-color: var(--text-color-light);
|
|
303
|
-
--progress-bg-color: var(--disabled-background);
|
|
304
|
-
--progress-color: var(--primary-color);
|
|
145
|
+
--primary-color: #4caf50;
|
|
146
|
+
--text-primary: #333;
|
|
147
|
+
--text-secondary: #666;
|
|
148
|
+
--border-color: #ddd;
|
|
149
|
+
--input-bg: #fff;
|
|
150
|
+
--error-color: #f44336;
|
|
305
151
|
}
|
|
306
152
|
```
|
|
307
153
|
|
|
308
|
-
##
|
|
154
|
+
## Development
|
|
155
|
+
|
|
156
|
+
### Setup
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Install dependencies
|
|
160
|
+
npm install
|
|
309
161
|
|
|
310
|
-
|
|
162
|
+
# Start development server
|
|
163
|
+
npm run dev
|
|
311
164
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
165
|
+
# Build for production
|
|
166
|
+
npm run build
|
|
167
|
+
|
|
168
|
+
# Run tests
|
|
169
|
+
npm run test
|
|
170
|
+
```
|
|
318
171
|
|
|
319
172
|
## License
|
|
320
173
|
|
|
321
|
-
MIT
|
|
174
|
+
MIT © [A-Vision Software](https://github.com/a-vision)
|