@a-vision-software/vue-input-components 1.1.42 → 1.1.51

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.
@@ -1,348 +0,0 @@
1
- <template>
2
- <div class="text-input-test">
3
- <div class="header">
4
- <router-link to="/" class="back-link">
5
- <font-awesome-icon icon="home" />
6
- <span>Back to Dashboard</span>
7
- </router-link>
8
- <h1>Text Input Testing</h1>
9
- </div>
10
- <div class="test-container">
11
- <div class="column">
12
- <div class="input-group">
13
- <h2>Account Information</h2>
14
- <TextInput
15
- v-model="username"
16
- type="text"
17
- icon="user"
18
- placeholder="Enter your username"
19
- :required="true"
20
- :error="usernameError"
21
- label="Username"
22
- label-position="left"
23
- label-align="right"
24
- label-width="20%"
25
- total-width="100%"
26
- />
27
- <TextInput
28
- v-model="password"
29
- type="password"
30
- icon="lock"
31
- placeholder="Enter your password"
32
- :required="true"
33
- :error="passwordError"
34
- label="Password"
35
- label-position="left"
36
- label-align="right"
37
- label-width="20%"
38
- total-width="100%"
39
- />
40
- </div>
41
- <div class="input-group">
42
- <h2>Additional Information</h2>
43
- <TextInput
44
- v-model="bio"
45
- isTextarea
46
- label="Bio"
47
- icon="user-circle"
48
- placeholder="Tell us about yourself..."
49
- :rows="4"
50
- :maxLength="500"
51
- :error="bioError"
52
- :autosave="handleBioAutosave"
53
- label-position="top"
54
- label-align="left"
55
- total-width="100%"
56
- height="10rem"
57
- max-height="20rem"
58
- />
59
- <TextInput
60
- v-model="feedback"
61
- isTextarea
62
- label="Feedback"
63
- icon="comment"
64
- placeholder="Share your thoughts..."
65
- :rows="3"
66
- :maxLength="1000"
67
- :error="feedbackError"
68
- :autosave="handleFeedbackAutosave"
69
- label-position="left"
70
- label-align="left"
71
- label-width="auto"
72
- total-width="100%"
73
- max-height="8rem"
74
- />
75
- </div>
76
- </div>
77
- <div class="column">
78
- <div class="input-group">
79
- <h2>Address Information</h2>
80
- <TextInput
81
- v-model="street"
82
- label="Street Address"
83
- type="text"
84
- icon="road"
85
- placeholder="Enter your street address"
86
- :error="streetError"
87
- :autosave="handleStreetAutosave"
88
- label-position="top"
89
- label-align="left"
90
- total-width="100%"
91
- />
92
- <div class="address-row">
93
- <TextInput
94
- v-model="city"
95
- label="City"
96
- type="text"
97
- icon="building"
98
- placeholder="Enter your city"
99
- :error="cityError"
100
- :autosave="handleCityAutosave"
101
- label-position="top"
102
- label-align="left"
103
- total-width="48%"
104
- />
105
- <TextInput
106
- v-model="postalCode"
107
- label="Postal Code"
108
- type="text"
109
- icon="fas fa-hashtag"
110
- placeholder="1234AB"
111
- :error="postalCodeError"
112
- @update:modelValue="handlePostalCodeInput"
113
- :autosave="handlePostalCodeAutosave"
114
- label-position="top"
115
- label-align="left"
116
- total-width="48%"
117
- />
118
- </div>
119
- <TextInput
120
- v-model="country"
121
- label="Country"
122
- type="text"
123
- icon="flag"
124
- placeholder="Enter your country"
125
- :error="countryError"
126
- :autosave="handleCountryAutosave"
127
- label-position="top"
128
- label-align="left"
129
- total-width="100%"
130
- />
131
- <TextInput
132
- v-model="comment"
133
- label="Comment"
134
- type="text"
135
- placeholder="Your comment"
136
- label-position="top"
137
- label-align="left"
138
- total-width="100%"
139
- />
140
- </div>
141
- </div>
142
- </div>
143
- </div>
144
- </template>
145
-
146
- <script setup lang="ts">
147
- import { ref } from 'vue'
148
- import TextInput from '@/components/TextInput.vue'
149
-
150
- const username = ref('')
151
- const password = ref('')
152
- const street = ref('')
153
- const city = ref('')
154
- const postalCode = ref('')
155
- const country = ref('')
156
- const comment = ref('')
157
- const bio = ref('')
158
- const feedback = ref('')
159
-
160
- const usernameError = ref('')
161
- const passwordError = ref('')
162
- const streetError = ref('')
163
- const cityError = ref('')
164
- const postalCodeError = ref('')
165
- const countryError = ref('')
166
- const bioError = ref('')
167
- const feedbackError = ref('')
168
-
169
- const formatPostalCode = (value: string) => {
170
- // Remove all non-alphanumeric characters except spaces
171
- let formatted = value.replace(/[^a-zA-Z0-9\s]/g, '')
172
-
173
- // Convert to uppercase
174
- formatted = formatted.toUpperCase()
175
-
176
- // Format as NNNN AA
177
- if (formatted.length > 4) {
178
- formatted = formatted.slice(0, 4) + ' ' + formatted.slice(4, 6)
179
- }
180
-
181
- return formatted
182
- }
183
-
184
- const handlePostalCodeInput = (_value: string) => {
185
- postalCodeError.value = ''
186
- }
187
-
188
- const handlePostalCodeAutosave = async (value: string) => {
189
- // First validate the format
190
- if (value.length > 0) {
191
- const postalCodeRegex = /^[0-9]{4}\s?[A-Za-z]{2}$/
192
- if (!postalCodeRegex.test(value)) {
193
- postalCodeError.value = 'Postal code must be in format NNNN AA (e.g., 1234 AB)'
194
- return
195
- }
196
- }
197
-
198
- // Format the value after successful validation
199
- const formattedValue = formatPostalCode(value)
200
- postalCode.value = formattedValue
201
-
202
- await new Promise((resolve) => setTimeout(resolve, 1000))
203
- postalCodeError.value = ''
204
- }
205
-
206
- const handleStreetAutosave = async (value: string) => {
207
- console.log('Autosaving street:', value)
208
- await new Promise((resolve) => setTimeout(resolve, 1000))
209
- streetError.value = ''
210
- }
211
-
212
- const handleCityAutosave = async (value: string) => {
213
- console.log('Autosaving city:', value)
214
- await new Promise((resolve) => setTimeout(resolve, 1000))
215
- cityError.value = ''
216
- }
217
-
218
- const handleCountryAutosave = async (value: string) => {
219
- console.log('Autosaving country:', value)
220
- await new Promise((resolve) => setTimeout(resolve, 1000))
221
- countryError.value = ''
222
- }
223
-
224
- const handleBioAutosave = async (value: string) => {
225
- console.log('Autosaving bio:', value)
226
- await new Promise((resolve) => setTimeout(resolve, 1000))
227
- bioError.value = ''
228
- }
229
-
230
- const handleFeedbackAutosave = async (value: string) => {
231
- console.log('Autosaving feedback:', value)
232
- await new Promise((resolve) => setTimeout(resolve, 1000))
233
- feedbackError.value = ''
234
- }
235
- </script>
236
-
237
- <style scoped>
238
- .text-input-test {
239
- padding: 2rem;
240
- min-height: 100vh;
241
- background-image: url('https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&q=80&w=2070');
242
- background-size: cover;
243
- background-position: center;
244
- background-attachment: fixed;
245
- }
246
-
247
- .text-input-grid {
248
- display: grid;
249
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
250
- gap: 2rem;
251
- margin-top: 2rem;
252
- }
253
-
254
- .input-section {
255
- background: rgba(255, 255, 255, 0.9);
256
- padding: 2rem;
257
- border-radius: 0.75rem;
258
- border: 1px solid rgba(255, 255, 255, 0.2);
259
- backdrop-filter: blur(10px);
260
- }
261
-
262
- .input-section h2 {
263
- margin-bottom: 1rem;
264
- color: var(--text-color);
265
- }
266
-
267
- .group {
268
- display: flex;
269
- flex-direction: column;
270
- gap: 1rem;
271
- padding: 2rem;
272
- border-radius: 1rem;
273
- background-color: rgba(255, 255, 255, 1);
274
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
275
- backdrop-filter: blur(5px);
276
- }
277
-
278
- .header {
279
- display: flex;
280
- align-items: center;
281
- gap: 0.5rem;
282
- margin-bottom: 1rem;
283
- }
284
-
285
- .back-link {
286
- display: flex;
287
- align-items: center;
288
- gap: 0.25rem;
289
- color: var(--text-color);
290
- text-decoration: none;
291
- font-size: 1rem;
292
- transition: color 0.2s;
293
- }
294
-
295
- .back-link:hover {
296
- color: var(--primary-color);
297
- }
298
-
299
- h1 {
300
- margin: 0;
301
- color: #212529;
302
- }
303
-
304
- h2 {
305
- color: #495057;
306
- font-size: 1.1rem;
307
- margin-bottom: 0.5rem;
308
- }
309
-
310
- .test-container {
311
- display: grid;
312
- grid-template-columns: repeat(auto-fit, minmax(min(100%, 600px), 1fr));
313
- gap: 1rem;
314
- }
315
-
316
- .column {
317
- display: flex;
318
- flex-direction: column;
319
- gap: 1rem;
320
- }
321
-
322
- .input-group {
323
- background: rgba(255, 255, 255, 0.8);
324
- border-radius: 8px;
325
- padding: 1rem;
326
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
327
- height: fit-content;
328
- backdrop-filter: blur(5px);
329
- }
330
-
331
- .input-group h2 {
332
- margin: 0 0 0.5rem 0;
333
- color: var(--text-color);
334
- font-size: 1.1rem;
335
- }
336
-
337
- .address-row {
338
- display: flex;
339
- justify-content: space-between;
340
- gap: 0.5rem;
341
- }
342
-
343
- @media (max-width: 1200px) {
344
- .test-container {
345
- grid-template-columns: 1fr;
346
- }
347
- }
348
- </style>