@a-vision-software/vue-input-components 1.2.12 → 1.2.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.
@@ -4,6 +4,7 @@ import FileUploadTestView from '../views/FileUploadTestView.vue'
4
4
  import ActionTestView from '../views/ActionTestView.vue'
5
5
  import DashboardView from '../views/DashboardView.vue'
6
6
  import NavigationTestView from '../views/NavigationTestView.vue'
7
+ import DropdownTestView from '../views/DropdownTestView.vue'
7
8
 
8
9
  const router = createRouter({
9
10
  history: createWebHistory(import.meta.env.BASE_URL),
@@ -38,6 +39,12 @@ const router = createRouter({
38
39
  component: NavigationTestView,
39
40
  meta: { title: 'Navigation Test' },
40
41
  },
42
+ {
43
+ path: '/dropdown',
44
+ name: 'dropdown',
45
+ component: DropdownTestView,
46
+ meta: { title: 'Dropdown Test' },
47
+ },
41
48
  ],
42
49
  })
43
50
 
@@ -0,0 +1,25 @@
1
+ export interface DropdownOption {
2
+ id: string
3
+ label: string
4
+ disabled?: boolean
5
+ }
6
+
7
+ export interface DropdownProps {
8
+ options: DropdownOption[]
9
+ modelValue: string | string[]
10
+ multiple?: boolean
11
+ placeholder?: string
12
+ filterable?: boolean
13
+ disabled?: boolean
14
+ maxHeight?: string
15
+ width?: string
16
+ color?: string
17
+ hoverColor?: string
18
+ activeColor?: string
19
+ disabledColor?: string
20
+ backgroundColor?: string
21
+ borderRadius?: string
22
+ padding?: string
23
+ icon?: string
24
+ iconSize?: 'normal' | 'large'
25
+ }
@@ -30,6 +30,13 @@
30
30
  <p>Test the navigation component</p>
31
31
  </div>
32
32
  </router-link>
33
+ <router-link to="/dropdown" class="tile">
34
+ <div class="tile-content">
35
+ <font-awesome-icon icon="chevron-down" class="tile-icon" />
36
+ <h2>Dropdown</h2>
37
+ <p>Test the dropdown component with single/multiple selection and filtering</p>
38
+ </div>
39
+ </router-link>
33
40
  </div>
34
41
  </div>
35
42
  </template>
@@ -0,0 +1,191 @@
1
+ <template>
2
+ <div class="dropdown-test">
3
+ <div class="dropdown-test__back">
4
+ <router-link to="/" class="back-link"> ← Back to Dashboard </router-link>
5
+ </div>
6
+
7
+ <div class="dropdown-test__section">
8
+ <h2>Single Select Dropdown</h2>
9
+ <Dropdown v-model="selectedSingle" :options="options" placeholder="Select a color" filterable
10
+ @update:modelValue="handleSingleChange" />
11
+ <div v-if="selectedSingle" class="selection-info">
12
+ Selected: {{ getOptionLabel(selectedSingle) }}
13
+ </div>
14
+ </div>
15
+
16
+ <div class="dropdown-test__section">
17
+ <h2>Multiple Select Dropdown</h2>
18
+ <Dropdown v-model="selectedMultiple" :options="options" multiple filterable placeholder="Select colors"
19
+ icon="paintbrush" @update:modelValue="handleMultipleChange" color="#aa0000" />
20
+ <div v-if="selectedMultiple.length" class="selection-info">
21
+ Selected: {{ getSelectedLabels(selectedMultiple).join(', ') }}
22
+ </div>
23
+ </div>
24
+
25
+ <div class="dropdown-test__section">
26
+ <h2>Dropdown with Icon</h2>
27
+ <Dropdown v-model="selectedWithIcon" :options="options" placeholder="Select with icon" icon="house"
28
+ @update:modelValue="handleIconChange" />
29
+ <div v-if="selectedWithIcon" class="selection-info">
30
+ Selected: {{ getOptionLabel(selectedWithIcon) }}
31
+ </div>
32
+ </div>
33
+
34
+ <div class="dropdown-test__section">
35
+ <h2>Dropdown with Large Icon</h2>
36
+ <Dropdown v-model="selectedWithLargeIcon" :options="options" placeholder="Select with large icon"
37
+ icon="gauge-high" iconSize="large" @update:modelValue="handleLargeIconChange" />
38
+ <div v-if="selectedWithLargeIcon" class="selection-info">
39
+ Selected: {{ getOptionLabel(selectedWithLargeIcon) }}
40
+ </div>
41
+ </div>
42
+
43
+ <div class="dropdown-test__section">
44
+ <h2>Custom Styled Dropdown</h2>
45
+ <Dropdown v-model="selectedCustom" :options="options" placeholder="Select with custom style" color="#4a90e2"
46
+ hoverColor="#357abd" activeColor="#2c5a8c" borderRadius="1rem" padding="0.75rem 1rem"
47
+ @update:modelValue="handleCustomChange" />
48
+ <div v-if="selectedCustom" class="selection-info">
49
+ Selected: {{ getOptionLabel(selectedCustom) }}
50
+ </div>
51
+ </div>
52
+
53
+ <div class="dropdown-test__section">
54
+ <h2>Disabled Dropdown</h2>
55
+ <Dropdown v-model="selectedDisabled" :options="options" disabled placeholder="This dropdown is disabled" />
56
+ </div>
57
+
58
+ <div class="dropdown-test__section">
59
+ <h2>Dropdown with Disabled Options</h2>
60
+ <Dropdown v-model="selectedWithDisabled" :options="optionsWithDisabled" placeholder="Some options are disabled"
61
+ @update:modelValue="handleDisabledChange" />
62
+ <div v-if="selectedWithDisabled" class="selection-info">
63
+ Selected: {{ getOptionLabel(selectedWithDisabled) }}
64
+ </div>
65
+ </div>
66
+ </div>
67
+ </template>
68
+
69
+ <script setup lang="ts">
70
+ import { ref } from 'vue'
71
+ import type { DropdownOption } from '../types/dropdown'
72
+ import Dropdown from '@/components/Dropdown.vue'
73
+
74
+ const options: DropdownOption[] = [
75
+ { id: 'red', label: 'Red' },
76
+ { id: 'blue', label: 'Blue' },
77
+ { id: 'green', label: 'Green' },
78
+ { id: 'yellow', label: 'Yellow' },
79
+ { id: 'purple', label: 'Purple' },
80
+ { id: 'orange', label: 'Orange' },
81
+ { id: 'pink', label: 'Pink' },
82
+ { id: 'brown', label: 'Brown' },
83
+ { id: 'gray', label: 'Gray' },
84
+ { id: 'black', label: 'Black' },
85
+ ]
86
+
87
+ const optionsWithDisabled: DropdownOption[] = [
88
+ { id: 'red', label: 'Red' },
89
+ { id: 'blue', label: 'Blue', disabled: true },
90
+ { id: 'green', label: 'Green' },
91
+ { id: 'yellow', label: 'Yellow', disabled: true },
92
+ { id: 'purple', label: 'Purple' },
93
+ ]
94
+
95
+ const selectedSingle = ref('')
96
+ const selectedMultiple = ref<string[]>([])
97
+ const selectedCustom = ref('')
98
+ const selectedDisabled = ref('')
99
+ const selectedWithDisabled = ref('')
100
+ const selectedWithIcon = ref('')
101
+ const selectedWithLargeIcon = ref('')
102
+
103
+ const getOptionLabel = (id: string) => {
104
+ return options.find((option) => option.id === id)?.label || ''
105
+ }
106
+
107
+ const getSelectedLabels = (ids: string[]) => {
108
+ return ids.map((id) => getOptionLabel(id)).filter(Boolean)
109
+ }
110
+
111
+ const handleSingleChange = (value: string | string[]) => {
112
+ if (typeof value === 'string') {
113
+ console.log('Single selection changed:', value)
114
+ }
115
+ }
116
+
117
+ const handleMultipleChange = (value: string | string[]) => {
118
+ if (Array.isArray(value)) {
119
+ console.log('Multiple selection changed:', value)
120
+ }
121
+ }
122
+
123
+ const handleCustomChange = (value: string | string[]) => {
124
+ if (typeof value === 'string') {
125
+ console.log('Custom selection changed:', value)
126
+ }
127
+ }
128
+
129
+ const handleDisabledChange = (value: string | string[]) => {
130
+ if (typeof value === 'string') {
131
+ console.log('Selection with disabled options changed:', value)
132
+ }
133
+ }
134
+
135
+ const handleIconChange = (value: string | string[]) => {
136
+ if (typeof value === 'string') {
137
+ console.log('Selection with icon changed:', value)
138
+ }
139
+ }
140
+
141
+ const handleLargeIconChange = (value: string | string[]) => {
142
+ if (typeof value === 'string') {
143
+ console.log('Selection with large icon changed:', value)
144
+ }
145
+ }
146
+ </script>
147
+
148
+ <style scoped>
149
+ .dropdown-test {
150
+ max-width: 800px;
151
+ margin: 0 auto;
152
+ padding: 2rem;
153
+ margin-bottom: 5rem;
154
+ }
155
+
156
+ .dropdown-test__back {
157
+ margin-bottom: 2rem;
158
+ }
159
+
160
+ .back-link {
161
+ display: inline-flex;
162
+ align-items: center;
163
+ gap: 0.5rem;
164
+ color: #4a90e2;
165
+ text-decoration: none;
166
+ font-weight: 500;
167
+ }
168
+
169
+ .back-link:hover {
170
+ color: #357abd;
171
+ }
172
+
173
+ .dropdown-test__section {
174
+ margin-bottom: 3rem;
175
+ }
176
+
177
+ .dropdown-test__section h2 {
178
+ margin-bottom: 1rem;
179
+ color: #333;
180
+ font-size: 1.5rem;
181
+ }
182
+
183
+ .selection-info {
184
+ margin-top: 1rem;
185
+ padding: 0.5rem;
186
+ background-color: #f7fafc;
187
+ border-radius: 4px;
188
+ font-size: 0.9rem;
189
+ color: #4a5568;
190
+ }
191
+ </style>