@a-vision-software/vue-input-components 1.3.12 → 1.3.13
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/dist/src/components/Action.vue.d.ts +60 -0
- package/dist/src/components/Dropdown.vue.d.ts +95 -0
- package/dist/src/components/FileUpload.vue.d.ts +27 -0
- package/dist/src/components/Navigation.vue.d.ts +19 -0
- package/dist/src/components/TextInput.vue.d.ts +95 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/router/index.d.ts +2 -0
- package/dist/src/types/action.d.ts +17 -0
- package/dist/src/types/dropdown.d.ts +31 -0
- package/dist/src/types/fileupload.d.ts +24 -0
- package/dist/src/types/index.d.ts +8 -0
- package/dist/src/types/navigation.d.ts +33 -0
- package/dist/src/types/textinput.d.ts +34 -0
- package/dist/vue-input-components.cjs.js +1 -1
- package/dist/vue-input-components.css +1 -1
- package/dist/vue-input-components.es.js +2608 -2610
- package/dist/vue-input-components.umd.js +1 -1
- package/package.json +6 -3
- package/src/components/TextInput.vue +78 -69
- package/src/types/action.ts +19 -0
- package/src/types/fileupload.ts +26 -0
- package/src/types/index.ts +6 -0
- package/src/types/textinput.ts +36 -0
- package/src/views/TextInputTestView.vue +13 -15
- package/dist/types.d.ts +0 -126
- package/src/types.d.ts +0 -23
- package/src/types.ts +0 -109
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a-vision-software/vue-input-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.13",
|
|
4
4
|
"description": "A collection of reusable Vue 3 input components with TypeScript support",
|
|
5
5
|
"author": "A-Vision Software",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,21 +18,24 @@
|
|
|
18
18
|
"typescript",
|
|
19
19
|
"file-upload",
|
|
20
20
|
"text-input",
|
|
21
|
+
"date-picker",
|
|
22
|
+
"dropdown",
|
|
21
23
|
"textarea"
|
|
22
24
|
],
|
|
23
25
|
"type": "module",
|
|
24
26
|
"files": [
|
|
25
27
|
"src",
|
|
28
|
+
"types",
|
|
26
29
|
"dist"
|
|
27
30
|
],
|
|
28
31
|
"main": "./dist/vue-input-components.cjs.js",
|
|
29
32
|
"module": "./dist/vue-input-components.es.js",
|
|
30
|
-
"types": "./
|
|
33
|
+
"types": "./types/index.ts",
|
|
31
34
|
"exports": {
|
|
32
35
|
".": {
|
|
33
36
|
"import": "./dist/vue-input-components.es.js",
|
|
34
37
|
"require": "./dist/vue-input-components.cjs.js",
|
|
35
|
-
"types": "./
|
|
38
|
+
"types": "./types/index.ts"
|
|
36
39
|
},
|
|
37
40
|
"./styles.css": "./dist/vue-input-components.css",
|
|
38
41
|
"./styles": "./dist/vue-input-components.css"
|
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="text-input" :class="{
|
|
3
|
+
'text-input--disabled': disabled,
|
|
4
|
+
'text-input--has-error': error,
|
|
3
5
|
[`label-${labelPosition}`]: label,
|
|
4
6
|
[`label-align-${labelAlign}`]: label,
|
|
7
|
+
'text-input--has-icon': icon,
|
|
5
8
|
}" :style="[
|
|
6
|
-
{ width:
|
|
9
|
+
{ width: (width || '100%') },
|
|
7
10
|
labelStyle,
|
|
8
11
|
{
|
|
9
|
-
'--
|
|
10
|
-
'--
|
|
11
|
-
'--input-
|
|
12
|
-
'--
|
|
13
|
-
|
|
12
|
+
'--text-input-color': error ? 'var(--danger-color)' : 'var(--text-primary)',
|
|
13
|
+
'--text-input-hover-color': 'var(--primary-color)',
|
|
14
|
+
'--text-input-active-color': 'var(--primary-color)',
|
|
15
|
+
'--text-input-disabled-color': 'var(--text-disabled)',
|
|
16
|
+
'--text-input-background-color': bgColor || 'var(--input-color, #ffffffaa)',
|
|
17
|
+
'--text-dp-background-color': bgColor || '#ffffff',
|
|
18
|
+
'--text-input-border-radius': '0.5rem',
|
|
19
|
+
'--text-input-padding': '0.5rem',
|
|
20
|
+
'--max-textarea-height': maxHeight || height || '14rem',
|
|
21
|
+
'--textarea-height': height || '5.5rem',
|
|
22
|
+
}
|
|
14
23
|
]">
|
|
15
24
|
<label v-if="label" :for="id" class="label">
|
|
16
25
|
{{ label }}
|
|
17
26
|
</label>
|
|
18
|
-
<div class="
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}">
|
|
22
|
-
<div v-if="icon" class="icon-wrapper" @click="focusInput">
|
|
23
|
-
<font-awesome-icon :icon="icon" class="icon" />
|
|
27
|
+
<div class="text-input__wrapper">
|
|
28
|
+
<div v-if="icon" class="text-input__icon" @click="focusInput">
|
|
29
|
+
<font-awesome-icon :icon="icon" />
|
|
24
30
|
</div>
|
|
25
31
|
<Datepicker v-if="type === 'date'" :id="id" v-model="dateValue" :placeholder="placeholder" :disabled="disabled"
|
|
26
32
|
:readonly="readonly" :min-date="min" :max-date="max" :format="dateFormat" :enable-time-picker="false"
|
|
27
33
|
:auto-apply="true" :close-on-auto-apply="true" :clearable="true"
|
|
28
|
-
:input-class-name="['
|
|
29
|
-
@blur="handleBlur" />
|
|
30
|
-
<input v-else-if="
|
|
31
|
-
:required="required" :disabled="disabled" :readonly="readonly" :maxlength="maxlength" class="
|
|
34
|
+
:input-class-name="['text-input__input', { 'text-input__input--has-icon': icon }]"
|
|
35
|
+
@update:model-value="handleDateChange" @focus="handleFocus" @blur="handleBlur" />
|
|
36
|
+
<input v-else-if="type !== 'textarea'" :id="id" :type="type" :value="modelValue" :placeholder="placeholder"
|
|
37
|
+
:required="required" :disabled="disabled" :readonly="readonly" :maxlength="maxlength" class="text-input__input"
|
|
32
38
|
@input="handleInput" @focus="handleFocus" @blur="handleBlur" @keydown="handleKeydown" ref="inputRef" />
|
|
33
39
|
<textarea v-else :id="id" :value="modelValue" :placeholder="placeholder" :required="required" :disabled="disabled"
|
|
34
|
-
class="
|
|
40
|
+
class="text-input__input" @input="handleInput" ref="inputRef"></textarea>
|
|
35
41
|
<span v-if="required && !showSaved && !showChanged && !error"
|
|
36
|
-
class="
|
|
42
|
+
class="text-input__status required-indicator">required</span>
|
|
37
43
|
<transition name="fade">
|
|
38
|
-
<span v-if="showSaved && !showChanged && !error" class="
|
|
44
|
+
<span v-if="showSaved && !showChanged && !error" class="text-input__status saved-indicator">saved</span>
|
|
39
45
|
</transition>
|
|
40
46
|
<transition name="fade">
|
|
41
|
-
<span v-if="showChanged && !error" class="
|
|
47
|
+
<span v-if="showChanged && !error" class="text-input__status changed-indicator">changed</span>
|
|
42
48
|
</transition>
|
|
43
49
|
<transition name="fade">
|
|
44
|
-
<span v-if="error" class="
|
|
50
|
+
<span v-if="error" class="text-input__status error-indicator" :data-error="error">error</span>
|
|
45
51
|
</transition>
|
|
46
52
|
</div>
|
|
47
53
|
</div>
|
|
@@ -49,7 +55,7 @@
|
|
|
49
55
|
|
|
50
56
|
<script setup lang="ts">
|
|
51
57
|
import { computed, ref, onUnmounted, onMounted } from 'vue'
|
|
52
|
-
import { TextInputProps } from '../types'
|
|
58
|
+
import { TextInputProps } from '../types/textinput'
|
|
53
59
|
import Datepicker from '@vuepic/vue-datepicker'
|
|
54
60
|
import '@vuepic/vue-datepicker/dist/main.css'
|
|
55
61
|
|
|
@@ -65,6 +71,13 @@ const props = withDefaults(defineProps<TextInputProps>(), {
|
|
|
65
71
|
error: '',
|
|
66
72
|
min: undefined,
|
|
67
73
|
max: undefined,
|
|
74
|
+
labelPosition: 'top',
|
|
75
|
+
labelAlign: 'left',
|
|
76
|
+
labelWidth: '',
|
|
77
|
+
height: '5.5rem',
|
|
78
|
+
maxHeight: '14rem',
|
|
79
|
+
bgColor: 'var(--input-color, #ffffffee)',
|
|
80
|
+
width: (props) => (props.type === 'date') ? '10rem' : '100%',
|
|
68
81
|
})
|
|
69
82
|
|
|
70
83
|
const emit = defineEmits<{
|
|
@@ -130,7 +143,6 @@ const handleAutosave = async (value: string) => {
|
|
|
130
143
|
}
|
|
131
144
|
|
|
132
145
|
const debounceAutosave = (value: string) => {
|
|
133
|
-
// Clear existing timers
|
|
134
146
|
if (debounceTimer.value) {
|
|
135
147
|
clearTimeout(debounceTimer.value)
|
|
136
148
|
}
|
|
@@ -138,18 +150,15 @@ const debounceAutosave = (value: string) => {
|
|
|
138
150
|
clearTimeout(changedTimer.value)
|
|
139
151
|
}
|
|
140
152
|
|
|
141
|
-
// Show changed indicator immediately
|
|
142
153
|
if (!props.error) {
|
|
143
154
|
showChanged.value = true
|
|
144
155
|
}
|
|
145
156
|
|
|
146
|
-
// Trigger changed event after 500ms
|
|
147
157
|
changedTimer.value = window.setTimeout(() => {
|
|
148
158
|
emit('changed')
|
|
149
159
|
isChanged.value = true
|
|
150
160
|
}, 500)
|
|
151
161
|
|
|
152
|
-
// Trigger autosave after 1500ms
|
|
153
162
|
debounceTimer.value = window.setTimeout(() => {
|
|
154
163
|
handleAutosave(value)
|
|
155
164
|
}, 1500)
|
|
@@ -160,15 +169,17 @@ const focusInput = () => {
|
|
|
160
169
|
}
|
|
161
170
|
|
|
162
171
|
const adjustHeight = (element: HTMLTextAreaElement) => {
|
|
163
|
-
element.style.height = 'auto'
|
|
164
|
-
element.style.height = `${element.scrollHeight}px`
|
|
172
|
+
element.style.height = 'auto'
|
|
173
|
+
element.style.height = `${element.scrollHeight}px`
|
|
165
174
|
}
|
|
166
175
|
|
|
167
176
|
const handleInput = (event: Event) => {
|
|
168
177
|
const value = (event.target as HTMLTextAreaElement).value
|
|
169
178
|
emit('update:modelValue', value)
|
|
170
179
|
debounceAutosave(value)
|
|
171
|
-
|
|
180
|
+
if (props.type === 'text' && (event.target as HTMLTextAreaElement).tagName === 'TEXTAREA') {
|
|
181
|
+
adjustHeight(event.target as HTMLTextAreaElement)
|
|
182
|
+
}
|
|
172
183
|
}
|
|
173
184
|
|
|
174
185
|
const handleFocus = () => {
|
|
@@ -189,7 +200,6 @@ const handleDateChange = (date: Date | null) => {
|
|
|
189
200
|
debounceAutosave(formattedDate)
|
|
190
201
|
}
|
|
191
202
|
|
|
192
|
-
// Cleanup timers on unmount
|
|
193
203
|
onUnmounted(() => {
|
|
194
204
|
if (debounceTimer.value) {
|
|
195
205
|
clearTimeout(debounceTimer.value)
|
|
@@ -218,6 +228,12 @@ defineExpose({
|
|
|
218
228
|
gap: 0.5rem;
|
|
219
229
|
width: 100%;
|
|
220
230
|
margin-top: 0.7rem;
|
|
231
|
+
|
|
232
|
+
&:not(.text-input--has-icon) {
|
|
233
|
+
.text-input__wrapper {
|
|
234
|
+
grid-template-columns: 1fr;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
221
237
|
}
|
|
222
238
|
|
|
223
239
|
.text-input.label-top {
|
|
@@ -253,40 +269,31 @@ defineExpose({
|
|
|
253
269
|
text-align: center;
|
|
254
270
|
}
|
|
255
271
|
|
|
256
|
-
.
|
|
257
|
-
color: var(--danger-color);
|
|
258
|
-
margin-left: 0.25rem;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.input-wrapper {
|
|
272
|
+
.text-input__wrapper {
|
|
262
273
|
position: relative;
|
|
263
274
|
display: grid;
|
|
264
|
-
grid-template-columns:
|
|
265
|
-
border: 1px solid var(--
|
|
266
|
-
border-radius:
|
|
275
|
+
grid-template-columns: 2em auto;
|
|
276
|
+
border: 1px solid var(--text-input-color);
|
|
277
|
+
border-radius: var(--text-input-border-radius);
|
|
267
278
|
transition: all 0.2s ease;
|
|
268
279
|
width: 100%;
|
|
269
280
|
min-height: 2rem;
|
|
270
|
-
background: var(--input-
|
|
271
|
-
|
|
272
|
-
&.has-icon {
|
|
273
|
-
grid-template-columns: auto 1fr;
|
|
274
|
-
}
|
|
281
|
+
background: var(--text-input-background-color);
|
|
275
282
|
|
|
276
283
|
&:hover {
|
|
277
|
-
border-color: var(--
|
|
278
|
-
box-shadow: 0 0 2px var(--
|
|
284
|
+
border-color: var(--text-input-hover-color);
|
|
285
|
+
box-shadow: 0 0 2px var(--text-input-hover-color) inset;
|
|
279
286
|
}
|
|
280
287
|
|
|
281
288
|
&:focus-within {
|
|
282
|
-
border-color: var(--
|
|
283
|
-
box-shadow: 0 0 2px var(--
|
|
289
|
+
border-color: var(--text-input-active-color);
|
|
290
|
+
box-shadow: 0 0 2px var(--text-input-active-color) inset;
|
|
284
291
|
}
|
|
285
292
|
|
|
286
|
-
&.has-error {
|
|
293
|
+
&.text-input--has-error {
|
|
287
294
|
border-color: var(--danger-color);
|
|
288
295
|
|
|
289
|
-
.
|
|
296
|
+
.text-input__icon {
|
|
290
297
|
color: var(--danger-color);
|
|
291
298
|
}
|
|
292
299
|
|
|
@@ -307,11 +314,16 @@ defineExpose({
|
|
|
307
314
|
}
|
|
308
315
|
}
|
|
309
316
|
|
|
310
|
-
.
|
|
317
|
+
.text-input--disabled {
|
|
318
|
+
opacity: 0.6;
|
|
319
|
+
cursor: not-allowed;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.text-input__icon {
|
|
311
323
|
display: grid;
|
|
312
324
|
place-items: start;
|
|
313
325
|
padding: 0.5rem;
|
|
314
|
-
border-right: 1px solid rgb(from var(--
|
|
326
|
+
border-right: 1px solid rgb(from var(--text-input-color) r g b / 20%);
|
|
315
327
|
cursor: pointer;
|
|
316
328
|
overflow: hidden;
|
|
317
329
|
|
|
@@ -325,10 +337,10 @@ defineExpose({
|
|
|
325
337
|
}
|
|
326
338
|
}
|
|
327
339
|
|
|
328
|
-
.
|
|
340
|
+
.text-input__input {
|
|
329
341
|
padding: 0.25rem 0.5rem;
|
|
330
342
|
border: none;
|
|
331
|
-
border-radius:
|
|
343
|
+
border-radius: var(--text-input-border-radius);
|
|
332
344
|
outline: none;
|
|
333
345
|
font-size: 1rem;
|
|
334
346
|
color: var(--text-color);
|
|
@@ -346,7 +358,7 @@ defineExpose({
|
|
|
346
358
|
}
|
|
347
359
|
}
|
|
348
360
|
|
|
349
|
-
.
|
|
361
|
+
.text-input__status {
|
|
350
362
|
position: absolute;
|
|
351
363
|
display: block;
|
|
352
364
|
top: -1px;
|
|
@@ -354,7 +366,7 @@ defineExpose({
|
|
|
354
366
|
right: 0.5rem;
|
|
355
367
|
font-size: 0.75rem;
|
|
356
368
|
color: var(--text-muted);
|
|
357
|
-
background-color: var(--input-
|
|
369
|
+
background-color: var(--text-input-background-color);
|
|
358
370
|
padding: 0 0.25rem;
|
|
359
371
|
|
|
360
372
|
&.saved-indicator {
|
|
@@ -381,8 +393,8 @@ defineExpose({
|
|
|
381
393
|
}
|
|
382
394
|
|
|
383
395
|
textarea {
|
|
384
|
-
min-height: var(--textarea-height
|
|
385
|
-
max-height: var(--max-textarea-height
|
|
396
|
+
min-height: var(--textarea-height);
|
|
397
|
+
max-height: var(--max-textarea-height);
|
|
386
398
|
overflow-y: auto;
|
|
387
399
|
resize: none;
|
|
388
400
|
}
|
|
@@ -407,7 +419,7 @@ textarea {
|
|
|
407
419
|
cursor: not-allowed;
|
|
408
420
|
}
|
|
409
421
|
|
|
410
|
-
:deep(.dp__input.has-icon) {
|
|
422
|
+
:deep(.dp__input.text-input__input--has-icon) {
|
|
411
423
|
padding-left: 2.5rem;
|
|
412
424
|
}
|
|
413
425
|
|
|
@@ -420,9 +432,9 @@ textarea {
|
|
|
420
432
|
}
|
|
421
433
|
|
|
422
434
|
:deep(.dp__menu) {
|
|
423
|
-
background-color: var(--
|
|
424
|
-
border: 1px solid var(--
|
|
425
|
-
border-radius:
|
|
435
|
+
background-color: var(--text-dp-background-color);
|
|
436
|
+
border: 1px solid var(--text-input-color);
|
|
437
|
+
border-radius: var(--text-input-border-radius);
|
|
426
438
|
box-shadow:
|
|
427
439
|
0 4px 6px -1px rgba(0, 0, 0, 0.1),
|
|
428
440
|
0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
|
@@ -433,17 +445,17 @@ textarea {
|
|
|
433
445
|
}
|
|
434
446
|
|
|
435
447
|
:deep(.dp__today) {
|
|
436
|
-
border-color: var(--
|
|
448
|
+
border-color: var(--text-input-active-color);
|
|
437
449
|
}
|
|
438
450
|
|
|
439
451
|
:deep(.dp__active_date) {
|
|
440
|
-
background-color: var(--
|
|
452
|
+
background-color: var(--text-input-active-color);
|
|
441
453
|
color: white;
|
|
442
454
|
}
|
|
443
455
|
|
|
444
456
|
:deep(.dp__range_start),
|
|
445
457
|
:deep(.dp__range_end) {
|
|
446
|
-
background-color: var(--
|
|
458
|
+
background-color: var(--text-input-active-color);
|
|
447
459
|
color: white;
|
|
448
460
|
}
|
|
449
461
|
|
|
@@ -452,10 +464,7 @@ textarea {
|
|
|
452
464
|
color: var(--text-color);
|
|
453
465
|
}
|
|
454
466
|
|
|
455
|
-
:deep(.dp__arrow_bottom)
|
|
456
|
-
background-color: inherit;
|
|
457
|
-
}
|
|
458
|
-
|
|
467
|
+
:deep(.dp__arrow_bottom),
|
|
459
468
|
:deep(.dp__arrow_top) {
|
|
460
469
|
background-color: inherit;
|
|
461
470
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ActionProps {
|
|
2
|
+
icon?: string
|
|
3
|
+
label?: string
|
|
4
|
+
href?: string
|
|
5
|
+
type?: 'button' | 'submit' | 'reset'
|
|
6
|
+
disabled?: boolean
|
|
7
|
+
color?: string
|
|
8
|
+
size?: 'small' | 'regular' | 'large'
|
|
9
|
+
variant?: 'solid' | 'transparent'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ActionEmits {
|
|
13
|
+
(e: 'click', event: MouseEvent): void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ActionComponent {
|
|
17
|
+
focus: () => void
|
|
18
|
+
blur: () => void
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FileUploadProps {
|
|
2
|
+
modelValue: File[]
|
|
3
|
+
label?: string
|
|
4
|
+
placeholder?: string
|
|
5
|
+
error?: string
|
|
6
|
+
disabled?: boolean
|
|
7
|
+
required?: boolean
|
|
8
|
+
multiple?: boolean
|
|
9
|
+
accept?: string
|
|
10
|
+
maxSize?: number
|
|
11
|
+
uploadUrl?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface FileUploadEmits {
|
|
15
|
+
(e: 'update:modelValue', files: File[]): void
|
|
16
|
+
(e: 'files-selected', files: File[]): void
|
|
17
|
+
(e: 'start-upload', files: File[]): void
|
|
18
|
+
(e: 'upload-progress', progress: number): void
|
|
19
|
+
(e: 'upload-success', response: any): void
|
|
20
|
+
(e: 'upload-error', error: Error): void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FileUploadComponent {
|
|
24
|
+
focus: () => void
|
|
25
|
+
blur: () => void
|
|
26
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { NavigationProps, NavigationItem } from './navigation'
|
|
2
2
|
|
|
3
3
|
export type { NavigationProps, NavigationItem }
|
|
4
|
+
|
|
5
|
+
export * from './textinput'
|
|
6
|
+
export * from './fileupload'
|
|
7
|
+
export * from './action'
|
|
8
|
+
export * from './navigation'
|
|
9
|
+
export * from './dropdown'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface TextInputProps {
|
|
2
|
+
modelValue: string
|
|
3
|
+
type?: 'text' | 'textarea' | 'password' | 'email' | 'tel' | 'url' | 'date' | 'number'
|
|
4
|
+
placeholder?: string
|
|
5
|
+
label?: string
|
|
6
|
+
icon?: string
|
|
7
|
+
disabled?: boolean
|
|
8
|
+
readonly?: boolean
|
|
9
|
+
maxlength?: number
|
|
10
|
+
error?: string
|
|
11
|
+
min?: Date | string
|
|
12
|
+
max?: Date | string
|
|
13
|
+
autosave?: (value: string) => Promise<void>
|
|
14
|
+
labelPosition?: 'top' | 'left'
|
|
15
|
+
labelAlign?: 'left' | 'center' | 'right'
|
|
16
|
+
labelWidth?: string
|
|
17
|
+
height?: string
|
|
18
|
+
maxHeight?: string
|
|
19
|
+
bgColor?: string
|
|
20
|
+
width?: string
|
|
21
|
+
required?: boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TextInputEmits {
|
|
25
|
+
(e: 'update:modelValue', value: string): void
|
|
26
|
+
(e: 'changed'): void
|
|
27
|
+
(e: 'saved'): void
|
|
28
|
+
(e: 'focus'): void
|
|
29
|
+
(e: 'blur'): void
|
|
30
|
+
(e: 'keydown', event: KeyboardEvent): void
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface TextInputComponent {
|
|
34
|
+
focus: () => void
|
|
35
|
+
blur: () => void
|
|
36
|
+
}
|
|
@@ -12,20 +12,19 @@
|
|
|
12
12
|
<div class="input-group">
|
|
13
13
|
<h2>Account Information</h2>
|
|
14
14
|
<TextInput v-model="username" type="text" icon="user" placeholder="Enter your username" :required="true"
|
|
15
|
-
:error="usernameError" label="Username" label-position="left" label-align="right" label-width="20%"
|
|
16
|
-
total-width="100%" />
|
|
15
|
+
:error="usernameError" label="Username" label-position="left" label-align="right" label-width="20%" />
|
|
17
16
|
<TextInput v-model="password" type="password" icon="lock" placeholder="Enter your password" :required="true"
|
|
18
|
-
:error="passwordError" label="Password" label-position="left" label-align="right" label-width="20%"
|
|
19
|
-
total-width="100%" />
|
|
17
|
+
:error="passwordError" label="Password" label-position="left" label-align="right" label-width="20%" />
|
|
20
18
|
</div>
|
|
21
19
|
<div class="input-group">
|
|
22
20
|
<h2>Additional Information</h2>
|
|
23
|
-
<TextInput v-model="bio"
|
|
24
|
-
:rows="4" :maxLength="500" :error="bioError"
|
|
25
|
-
label-
|
|
26
|
-
<TextInput v-model="feedback"
|
|
27
|
-
:rows="3" :maxLength="1000" :error="feedbackError"
|
|
28
|
-
|
|
21
|
+
<TextInput v-model="bio" type="textarea" label="Bio" icon="user-circle"
|
|
22
|
+
placeholder="Tell us about yourself..." :rows="4" :maxLength="500" :error="bioError"
|
|
23
|
+
:autosave="handleBioAutosave" label-position="top" label-align="left" height="10rem" max-height="20rem" />
|
|
24
|
+
<TextInput v-model="feedback" type="textarea" label="Feedback" icon="comment"
|
|
25
|
+
placeholder="Share your thoughts..." :rows="3" :maxLength="1000" :error="feedbackError"
|
|
26
|
+
:autosave="handleFeedbackAutosave" label-position="left" label-align="left" label-width="auto"
|
|
27
|
+
max-height="8rem" />
|
|
29
28
|
</div>
|
|
30
29
|
</div>
|
|
31
30
|
<div class="column">
|
|
@@ -33,23 +32,22 @@
|
|
|
33
32
|
<h2>Address Information</h2>
|
|
34
33
|
<TextInput v-model="street" label="Street Address" type="text" icon="road"
|
|
35
34
|
placeholder="Enter your street address" :error="streetError" :autosave="handleStreetAutosave"
|
|
36
|
-
label-position="top" label-align="left"
|
|
35
|
+
label-position="top" label-align="left" />
|
|
37
36
|
<div class="address-row">
|
|
38
37
|
<TextInput v-model="city" label="City" type="text" icon="building" placeholder="Enter your city"
|
|
39
38
|
:error="cityError" :autosave="handleCityAutosave" label-position="top" label-align="left"
|
|
40
39
|
total-width="calc(100% - 11rem)" />
|
|
41
40
|
<TextInput v-model="postalCode" label="Postal Code" type="text" icon="fas fa-hashtag" placeholder="1234AB"
|
|
42
41
|
:error="postalCodeError" @update:modelValue="handlePostalCodeInput" :autosave="handlePostalCodeAutosave"
|
|
43
|
-
label-position="top" label-align="left"
|
|
42
|
+
label-position="top" label-align="left" width="10rem" />
|
|
44
43
|
</div>
|
|
45
44
|
<TextInput v-model="country" label="Country" type="text" icon="flag" placeholder="Enter your country"
|
|
46
|
-
:error="countryError" :autosave="handleCountryAutosave" label-position="top" label-align="left"
|
|
47
|
-
total-width="100%" />
|
|
45
|
+
:error="countryError" :autosave="handleCountryAutosave" label-position="top" label-align="left" />
|
|
48
46
|
<TextInput v-model="birthDate" type="date" label="Date of Birth" icon="calendar" placeholder="DD/MM/YYYY"
|
|
49
47
|
:min="minDate" :max="maxDate" :error="birthDateError" :autosave="handleBirthDateAutosave"
|
|
50
48
|
label-position="top" label-align="left" />
|
|
51
49
|
<TextInput v-model="comment" label="Comment" type="text" placeholder="Your comment" label-position="top"
|
|
52
|
-
label-align="left"
|
|
50
|
+
label-align="left" />
|
|
53
51
|
</div>
|
|
54
52
|
</div>
|
|
55
53
|
</div>
|
package/dist/types.d.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { default as Action } from './components/Action';
|
|
2
|
-
import { Component } from 'vue';
|
|
3
|
-
import { default as Dropdown } from './components/Dropdown';
|
|
4
|
-
import { default as FileUpload } from './components/FileUpload';
|
|
5
|
-
import { default as Navigation } from './components/Navigation';
|
|
6
|
-
import { default as TextInput } from './components/TextInput';
|
|
7
|
-
|
|
8
|
-
export { Action }
|
|
9
|
-
|
|
10
|
-
export declare type ActionComponent = {
|
|
11
|
-
focus: () => void;
|
|
12
|
-
blur: () => void;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export declare interface ActionProps {
|
|
16
|
-
icon?: string;
|
|
17
|
-
label?: string;
|
|
18
|
-
href?: string;
|
|
19
|
-
type?: 'button' | 'submit' | 'reset';
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
color?: string;
|
|
22
|
-
size?: 'small' | 'regular' | 'large';
|
|
23
|
-
variant?: 'solid' | 'transparent';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { Dropdown }
|
|
27
|
-
|
|
28
|
-
export { FileUpload }
|
|
29
|
-
|
|
30
|
-
export declare type FileUploadComponent = Component<FileUploadProps>;
|
|
31
|
-
|
|
32
|
-
export declare interface FileUploadEmits {
|
|
33
|
-
(e: 'update:modelValue', files: File[]): void;
|
|
34
|
-
(e: 'files-selected', files: File[]): void;
|
|
35
|
-
(e: 'start-upload', files: File[]): void;
|
|
36
|
-
(e: 'upload-progress', progress: number): void;
|
|
37
|
-
(e: 'upload-success', response: any): void;
|
|
38
|
-
(e: 'upload-error', error: Error): void;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export declare interface FileUploadProps {
|
|
42
|
-
modelValue: File[];
|
|
43
|
-
label?: string;
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
error?: string;
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
required?: boolean;
|
|
48
|
-
multiple?: boolean;
|
|
49
|
-
accept?: string;
|
|
50
|
-
maxSize?: number;
|
|
51
|
-
uploadUrl?: string;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { Navigation }
|
|
55
|
-
|
|
56
|
-
export declare interface NavigationComponent {
|
|
57
|
-
props: NavigationProps;
|
|
58
|
-
emits: {
|
|
59
|
-
(e: 'item-click', item: NavigationItem): void;
|
|
60
|
-
(e: 'update:activeItem', id: string): void;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export declare interface NavigationItem {
|
|
65
|
-
id: string;
|
|
66
|
-
label: string;
|
|
67
|
-
icon?: string;
|
|
68
|
-
url?: string;
|
|
69
|
-
children?: NavigationItem[];
|
|
70
|
-
type?: 'tile' | 'tab' | 'dropdown';
|
|
71
|
-
color?: string;
|
|
72
|
-
disabled?: boolean;
|
|
73
|
-
alignment?: 'start' | 'end';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export declare interface NavigationProps {
|
|
77
|
-
items: NavigationItem[];
|
|
78
|
-
type?: 'tiles' | 'tabs' | 'dropdowns';
|
|
79
|
-
orientation?: 'horizontal' | 'vertical';
|
|
80
|
-
activeItem?: string;
|
|
81
|
-
color?: string;
|
|
82
|
-
hoverColor?: string;
|
|
83
|
-
activeColor?: string;
|
|
84
|
-
disabledColor?: string;
|
|
85
|
-
iconSize?: string;
|
|
86
|
-
gap?: string;
|
|
87
|
-
padding?: string;
|
|
88
|
-
borderRadius?: string;
|
|
89
|
-
showIcons?: boolean;
|
|
90
|
-
activeItemAlignment?: 'start' | 'end';
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export { TextInput }
|
|
94
|
-
|
|
95
|
-
export declare type TextInputComponent = {
|
|
96
|
-
focus: () => void;
|
|
97
|
-
blur: () => void;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export declare interface TextInputProps {
|
|
101
|
-
modelValue: string;
|
|
102
|
-
type?: 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'date';
|
|
103
|
-
label?: string;
|
|
104
|
-
placeholder?: string;
|
|
105
|
-
icon?: string;
|
|
106
|
-
disabled?: boolean;
|
|
107
|
-
readonly?: boolean;
|
|
108
|
-
maxlength?: number;
|
|
109
|
-
error?: string;
|
|
110
|
-
min?: string;
|
|
111
|
-
max?: string;
|
|
112
|
-
required?: boolean;
|
|
113
|
-
success?: string;
|
|
114
|
-
labelPosition?: 'top' | 'left';
|
|
115
|
-
labelAlign?: 'left' | 'right' | 'center';
|
|
116
|
-
totalWidth?: string;
|
|
117
|
-
inputWidth?: string;
|
|
118
|
-
labelWidth?: string;
|
|
119
|
-
autosave?: (value: string) => Promise<void>;
|
|
120
|
-
isTextarea?: boolean;
|
|
121
|
-
maxHeight?: string;
|
|
122
|
-
height?: string;
|
|
123
|
-
bgColor?: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export { }
|
package/src/types.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare module '@a-vision-software/vue-input-components' {
|
|
2
|
-
import { DefineComponent } from 'vue'
|
|
3
|
-
|
|
4
|
-
export const TextInput: DefineComponent<{
|
|
5
|
-
modelValue?: string
|
|
6
|
-
label?: string
|
|
7
|
-
placeholder?: string
|
|
8
|
-
required?: boolean
|
|
9
|
-
disabled?: boolean
|
|
10
|
-
error?: string
|
|
11
|
-
}>
|
|
12
|
-
|
|
13
|
-
export const FileUpload: DefineComponent<{
|
|
14
|
-
modelValue?: File[]
|
|
15
|
-
maxFiles?: number
|
|
16
|
-
maxFileSize?: number
|
|
17
|
-
accept?: string
|
|
18
|
-
uploadUrl?: string
|
|
19
|
-
required?: boolean
|
|
20
|
-
disabled?: boolean
|
|
21
|
-
error?: string
|
|
22
|
-
}>
|
|
23
|
-
}
|