@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.
- package/README.md +121 -102
- package/dist/vue-input-components.cjs.js +1 -561
- package/dist/vue-input-components.css +1 -1
- package/dist/vue-input-components.es.js +4906 -8034
- package/dist/vue-input-components.umd.js +1 -561
- package/package.json +82 -86
- package/src/assets/colors.css +2 -1
- package/src/components/Dropdown.vue +400 -0
- package/src/components/Navigation.vue +26 -27
- package/src/main.ts +1 -1
- package/src/router/index.ts +7 -0
- package/src/types/dropdown.ts +25 -0
- package/src/views/DashboardView.vue +7 -0
- package/src/views/DropdownTestView.vue +191 -0
package/package.json
CHANGED
|
@@ -1,88 +1,84 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://github.com/a-vision/vue-input-components#readme",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"vue",
|
|
14
|
-
"vue3",
|
|
15
|
-
"components",
|
|
16
|
-
"input",
|
|
17
|
-
"form",
|
|
18
|
-
"typescript",
|
|
19
|
-
"file-upload",
|
|
20
|
-
"text-input",
|
|
21
|
-
"textarea"
|
|
22
|
-
],
|
|
23
|
-
"type": "module",
|
|
24
|
-
"files": [
|
|
25
|
-
"src",
|
|
26
|
-
"dist"
|
|
27
|
-
],
|
|
28
|
-
"main": "./dist/vue-input-components.cjs.js",
|
|
29
|
-
"module": "./dist/vue-input-components.es.js",
|
|
30
|
-
"types": "./dist/types.d.ts",
|
|
31
|
-
"exports": {
|
|
32
|
-
".": {
|
|
33
|
-
"import": "./dist/vue-input-components.es.js",
|
|
34
|
-
"require": "./dist/vue-input-components.cjs.js",
|
|
35
|
-
"types": "./dist/types.d.ts"
|
|
2
|
+
"name": "@a-vision-software/vue-input-components",
|
|
3
|
+
"version": "1.2.13",
|
|
4
|
+
"description": "A collection of reusable Vue 3 input components with TypeScript support",
|
|
5
|
+
"author": "A-Vision Software",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/a-vision/vue-input-components.git"
|
|
36
10
|
},
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
11
|
+
"homepage": "https://github.com/a-vision/vue-input-components#readme",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"vue",
|
|
14
|
+
"vue3",
|
|
15
|
+
"components",
|
|
16
|
+
"input",
|
|
17
|
+
"form",
|
|
18
|
+
"typescript",
|
|
19
|
+
"file-upload",
|
|
20
|
+
"text-input",
|
|
21
|
+
"textarea"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"files": [
|
|
25
|
+
"src",
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"main": "./dist/vue-input-components.cjs.js",
|
|
29
|
+
"module": "./dist/vue-input-components.es.js",
|
|
30
|
+
"types": "./dist/types.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"import": "./dist/vue-input-components.es.js",
|
|
34
|
+
"require": "./dist/vue-input-components.cjs.js",
|
|
35
|
+
"types": "./dist/types.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./styles.css": "./dist/vue-input-components.css",
|
|
38
|
+
"./styles": "./dist/vue-input-components.css"
|
|
39
|
+
},
|
|
40
|
+
"sideEffects": [
|
|
41
|
+
"**/*.css"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"dev": "vite",
|
|
45
|
+
"build": "vue-tsc && vite build",
|
|
46
|
+
"preview": "vite preview",
|
|
47
|
+
"test": "vitest"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"vue": "^3.5.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@fortawesome/fontawesome-svg-core": "^6.7.0",
|
|
54
|
+
"@fortawesome/free-regular-svg-icons": "^6.7.0",
|
|
55
|
+
"@fortawesome/free-solid-svg-icons": "^6.7.0",
|
|
56
|
+
"@fortawesome/vue-fontawesome": "^3.0.0",
|
|
57
|
+
"@vuepic/vue-datepicker": "^11.0.2"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@tsconfig/node20": "^20.1.2",
|
|
61
|
+
"@types/node": "^20.11.0",
|
|
62
|
+
"@vitejs/plugin-vue": "^5.0.0",
|
|
63
|
+
"@vue/eslint-config-prettier": "^9.0.0",
|
|
64
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
65
|
+
"@vue/test-utils": "^2.4.0",
|
|
66
|
+
"@vue/tsconfig": "^0.5.1",
|
|
67
|
+
"eslint": "^8.56.0",
|
|
68
|
+
"eslint-plugin-vue": "^9.21.0",
|
|
69
|
+
"npm-run-all": "^4.1.5",
|
|
70
|
+
"prettier": "^3.2.0",
|
|
71
|
+
"typescript": "~5.3.0",
|
|
72
|
+
"vite": "^5.0.0",
|
|
73
|
+
"vite-plugin-dts": "^3.7.0",
|
|
74
|
+
"vitest": "^1.2.0",
|
|
75
|
+
"vue-router": "^4.2.0",
|
|
76
|
+
"vue-tsc": "^1.8.0"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=18.0.0"
|
|
80
|
+
},
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "public"
|
|
83
|
+
}
|
|
84
|
+
}
|
package/src/assets/colors.css
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
/* Text Colors */
|
|
35
35
|
--text-muted: #6c757d;
|
|
36
|
+
--text-primary: #2c3e50;
|
|
36
37
|
|
|
37
38
|
/* Border Colors */
|
|
38
39
|
--input-bg: #ffffff;
|
|
@@ -64,4 +65,4 @@
|
|
|
64
65
|
--success-text-color: var(--success-color);
|
|
65
66
|
--error-bg-color: var(--error-color-light);
|
|
66
67
|
--error-text-color: var(--error-color);
|
|
67
|
-
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="dropdown" :class="{
|
|
3
|
+
'dropdown--open': isOpen,
|
|
4
|
+
'dropdown--disabled': disabled,
|
|
5
|
+
'dropdown--multiple': multiple,
|
|
6
|
+
'dropdown--large-icon': iconSize === 'large',
|
|
7
|
+
}" :style="{
|
|
8
|
+
'--dropdown-color': color,
|
|
9
|
+
'--dropdown-hover-color': hoverColor,
|
|
10
|
+
'--dropdown-active-color': activeColor,
|
|
11
|
+
'--dropdown-disabled-color': disabledColor,
|
|
12
|
+
'--dropdown-background-color': backgroundColor,
|
|
13
|
+
'--dropdown-border-radius': borderRadius,
|
|
14
|
+
'--dropdown-padding': padding,
|
|
15
|
+
'--dropdown-max-height': maxHeight,
|
|
16
|
+
'--dropdown-width': width,
|
|
17
|
+
}" @click="toggleDropdown" @keydown.esc="closeDropdown" @keydown.space.prevent="toggleDropdown"
|
|
18
|
+
@keydown.enter.prevent="toggleDropdown" tabindex="0">
|
|
19
|
+
<div class="dropdown__selected">
|
|
20
|
+
<div v-if="icon" class="dropdown__icon">
|
|
21
|
+
<img v-if="icon.startsWith('img:')" :src="icon.substring(4)" :alt="placeholder" class="dropdown__icon-image" />
|
|
22
|
+
<font-awesome-icon v-else :icon="icon" />
|
|
23
|
+
</div>
|
|
24
|
+
<div v-if="!hasSelection" class="dropdown__placeholder">
|
|
25
|
+
{{ placeholder }}
|
|
26
|
+
</div>
|
|
27
|
+
<div v-else class="dropdown__selected-items">
|
|
28
|
+
<template v-if="multiple">
|
|
29
|
+
<div v-for="option in selectedOptions" :key="option.id" class="dropdown__selected-tag"
|
|
30
|
+
@click.stop="deselectOption(option)">
|
|
31
|
+
{{ option.label }}
|
|
32
|
+
<font-awesome-icon icon="xmark" class="dropdown__selected-tag-remove" />
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
<template v-else>
|
|
36
|
+
{{ selectedOptions[0]?.label }}
|
|
37
|
+
</template>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="dropdown__icons">
|
|
40
|
+
<font-awesome-icon v-if="hasSelection && !multiple" icon="xmark" class="dropdown__clear"
|
|
41
|
+
@click.stop="clearSelection" />
|
|
42
|
+
<font-awesome-icon icon="chevron-down" class="dropdown__arrow" :class="{ 'dropdown__arrow--open': isOpen }" />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div v-if="isOpen" class="dropdown__content">
|
|
47
|
+
<div v-if="filterable" class="dropdown__filter">
|
|
48
|
+
<input ref="filterInput" v-model="filterText" type="text" class="dropdown__filter-input"
|
|
49
|
+
placeholder="Type to filter..." @click.stop @keydown.stop />
|
|
50
|
+
</div>
|
|
51
|
+
<div class="dropdown__options">
|
|
52
|
+
<div v-for="option in filteredOptions" :key="option.id" class="dropdown__option" :class="{
|
|
53
|
+
'dropdown__option--selected': isSelected(option),
|
|
54
|
+
'dropdown__option--disabled': option.disabled,
|
|
55
|
+
}" @click.stop="toggleOption(option)">
|
|
56
|
+
<font-awesome-icon v-if="multiple && isSelected(option)" icon="check" class="dropdown__option-check" />
|
|
57
|
+
{{ option.label }}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
|
|
64
|
+
<script setup lang="ts">
|
|
65
|
+
import { ref, computed, watch, nextTick } from 'vue'
|
|
66
|
+
import type { DropdownProps, DropdownOption } from '../types/dropdown'
|
|
67
|
+
|
|
68
|
+
const props = withDefaults(defineProps<DropdownProps>(), {
|
|
69
|
+
multiple: false,
|
|
70
|
+
placeholder: 'Select an option',
|
|
71
|
+
filterable: false,
|
|
72
|
+
disabled: false,
|
|
73
|
+
maxHeight: '300px',
|
|
74
|
+
width: '100%',
|
|
75
|
+
color: 'var(--text-primary)',
|
|
76
|
+
hoverColor: 'var(--primary)',
|
|
77
|
+
activeColor: 'var(--primary)',
|
|
78
|
+
disabledColor: 'var(--text-disabled)',
|
|
79
|
+
backgroundColor: 'white',
|
|
80
|
+
borderRadius: '0.375rem',
|
|
81
|
+
padding: '0.5rem',
|
|
82
|
+
icon: '',
|
|
83
|
+
iconSize: 'normal',
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
const emit = defineEmits<{
|
|
87
|
+
(e: 'update:modelValue', value: string | string[]): void
|
|
88
|
+
}>()
|
|
89
|
+
|
|
90
|
+
const isOpen = ref(false)
|
|
91
|
+
const filterText = ref('')
|
|
92
|
+
const filterInput = ref<HTMLInputElement | null>(null)
|
|
93
|
+
|
|
94
|
+
const selectedOptions = computed(() => {
|
|
95
|
+
if (Array.isArray(props.modelValue)) {
|
|
96
|
+
return props.options.filter((option) => props.modelValue.includes(option.id))
|
|
97
|
+
}
|
|
98
|
+
return props.options.filter((option) => option.id === props.modelValue)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
const hasSelection = computed(() => {
|
|
102
|
+
if (Array.isArray(props.modelValue)) {
|
|
103
|
+
return props.modelValue.length > 0
|
|
104
|
+
}
|
|
105
|
+
return !!props.modelValue
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
const filteredOptions = computed(() => {
|
|
109
|
+
if (!filterText.value) return props.options
|
|
110
|
+
const searchText = filterText.value.toLowerCase()
|
|
111
|
+
return props.options.filter((option) =>
|
|
112
|
+
option.label.toLowerCase().includes(searchText)
|
|
113
|
+
)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const isSelected = (option: DropdownOption) => {
|
|
117
|
+
if (Array.isArray(props.modelValue)) {
|
|
118
|
+
return props.modelValue.includes(option.id)
|
|
119
|
+
}
|
|
120
|
+
return option.id === props.modelValue
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const toggleDropdown = () => {
|
|
124
|
+
if (props.disabled) return
|
|
125
|
+
isOpen.value = !isOpen.value
|
|
126
|
+
if (isOpen.value && props.filterable) {
|
|
127
|
+
nextTick(() => {
|
|
128
|
+
filterInput.value?.focus()
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const closeDropdown = () => {
|
|
134
|
+
isOpen.value = false
|
|
135
|
+
filterText.value = ''
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const toggleOption = (option: DropdownOption) => {
|
|
139
|
+
if (option.disabled) return
|
|
140
|
+
|
|
141
|
+
if (props.multiple) {
|
|
142
|
+
const currentValue = Array.isArray(props.modelValue) ? props.modelValue : []
|
|
143
|
+
const newValue = currentValue.includes(option.id)
|
|
144
|
+
? currentValue.filter((id) => id !== option.id)
|
|
145
|
+
: [...currentValue, option.id]
|
|
146
|
+
emit('update:modelValue', newValue)
|
|
147
|
+
} else {
|
|
148
|
+
emit('update:modelValue', option.id)
|
|
149
|
+
closeDropdown()
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const deselectOption = (option: DropdownOption) => {
|
|
154
|
+
if (props.disabled || option.disabled) return
|
|
155
|
+
|
|
156
|
+
if (props.multiple && Array.isArray(props.modelValue)) {
|
|
157
|
+
const newValue = props.modelValue.filter((id) => id !== option.id)
|
|
158
|
+
emit('update:modelValue', newValue)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const clearSelection = () => {
|
|
163
|
+
if (props.disabled) return
|
|
164
|
+
emit('update:modelValue', props.multiple ? [] : '')
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Close dropdown when clicking outside
|
|
168
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
169
|
+
const target = event.target as HTMLElement
|
|
170
|
+
if (!target.closest('.dropdown')) {
|
|
171
|
+
closeDropdown()
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
watch(isOpen, (newValue) => {
|
|
176
|
+
if (newValue) {
|
|
177
|
+
document.addEventListener('click', handleClickOutside)
|
|
178
|
+
} else {
|
|
179
|
+
document.removeEventListener('click', handleClickOutside)
|
|
180
|
+
}
|
|
181
|
+
})
|
|
182
|
+
</script>
|
|
183
|
+
|
|
184
|
+
<style scoped>
|
|
185
|
+
.dropdown {
|
|
186
|
+
position: relative;
|
|
187
|
+
width: var(--dropdown-width);
|
|
188
|
+
font-family: Arial, sans-serif;
|
|
189
|
+
cursor: pointer;
|
|
190
|
+
user-select: none;
|
|
191
|
+
outline: none;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.dropdown--disabled {
|
|
195
|
+
opacity: 0.6;
|
|
196
|
+
cursor: not-allowed;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.dropdown__selected {
|
|
200
|
+
display: grid;
|
|
201
|
+
grid-template-columns: auto 1fr auto;
|
|
202
|
+
align-items: center;
|
|
203
|
+
min-height: 2.5rem;
|
|
204
|
+
border: 1px solid var(--dropdown-color);
|
|
205
|
+
border-radius: var(--dropdown-border-radius);
|
|
206
|
+
background-color: var(--dropdown-background-color);
|
|
207
|
+
color: var(--dropdown-color);
|
|
208
|
+
transition: all 0.2s ease;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.dropdown:not(.dropdown--disabled):hover .dropdown__selected {
|
|
212
|
+
border-color: var(--dropdown-hover-color);
|
|
213
|
+
color: var(--dropdown-hover-color);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.dropdown--open .dropdown__selected {
|
|
217
|
+
border-color: var(--dropdown-active-color);
|
|
218
|
+
color: var(--dropdown-active-color);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.dropdown__icon {
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
justify-content: center;
|
|
225
|
+
font-size: 1.2em;
|
|
226
|
+
color: var(--dropdown-color);
|
|
227
|
+
padding: 0 0.75rem;
|
|
228
|
+
border-right: 1px solid rgba(0, 0, 0, 0.2);
|
|
229
|
+
grid-column: 1;
|
|
230
|
+
height: 100%;
|
|
231
|
+
align-self: stretch;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.dropdown__selected-items {
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-wrap: wrap;
|
|
237
|
+
gap: 0.25rem;
|
|
238
|
+
min-width: 0;
|
|
239
|
+
padding: 0.5rem 0.75rem;
|
|
240
|
+
grid-column: 2;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.dropdown__placeholder {
|
|
244
|
+
color: var(--text-secondary);
|
|
245
|
+
font-style: italic;
|
|
246
|
+
padding: 0.5rem 0.75rem;
|
|
247
|
+
grid-column: 2;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.dropdown__selected-tag {
|
|
251
|
+
display: flex;
|
|
252
|
+
align-items: center;
|
|
253
|
+
gap: 0.25rem;
|
|
254
|
+
padding: 0.125rem 0.375rem;
|
|
255
|
+
background-color: var(--dropdown-active-color);
|
|
256
|
+
color: white;
|
|
257
|
+
border-radius: calc(var(--dropdown-border-radius) * 0.75);
|
|
258
|
+
font-size: 0.875rem;
|
|
259
|
+
color: var(--dropdown-color);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.dropdown__selected-tag-remove {
|
|
263
|
+
font-size: 0.75rem;
|
|
264
|
+
opacity: 0.8;
|
|
265
|
+
transition: opacity 0.2s ease;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.dropdown__selected-tag:hover .dropdown__selected-tag-remove {
|
|
269
|
+
opacity: 1;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.dropdown__icons {
|
|
273
|
+
display: flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
gap: 0.5rem;
|
|
276
|
+
padding: 0 0.75rem;
|
|
277
|
+
grid-column: 3;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.dropdown__clear {
|
|
281
|
+
font-size: 0.875rem;
|
|
282
|
+
opacity: 0.6;
|
|
283
|
+
transition: opacity 0.2s ease;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.dropdown__clear:hover {
|
|
287
|
+
opacity: 1;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.dropdown__arrow {
|
|
291
|
+
font-size: 0.875rem;
|
|
292
|
+
transition: transform 0.2s ease;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.dropdown__arrow--open {
|
|
296
|
+
transform: rotate(180deg);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.dropdown__content {
|
|
300
|
+
position: absolute;
|
|
301
|
+
top: 100%;
|
|
302
|
+
left: 0;
|
|
303
|
+
right: 0;
|
|
304
|
+
margin-top: 0.25rem;
|
|
305
|
+
background-color: var(--dropdown-background-color);
|
|
306
|
+
border: 1px solid var(--dropdown-color);
|
|
307
|
+
border-radius: var(--dropdown-border-radius);
|
|
308
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
309
|
+
z-index: 10;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.dropdown__filter {
|
|
313
|
+
padding: calc(var(--dropdown-padding) * 0.75);
|
|
314
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.dropdown__filter-input {
|
|
318
|
+
width: 100%;
|
|
319
|
+
padding: 0.375rem 0.5rem;
|
|
320
|
+
border: 1px solid var(--dropdown-color);
|
|
321
|
+
border-radius: calc(var(--dropdown-border-radius) * 0.75);
|
|
322
|
+
font-size: 0.875rem;
|
|
323
|
+
outline: none;
|
|
324
|
+
transition: border-color 0.2s ease;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.dropdown__filter-input:focus {
|
|
328
|
+
border-color: var(--dropdown-active-color);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.dropdown__options {
|
|
332
|
+
max-height: var(--dropdown-max-height);
|
|
333
|
+
overflow-y: auto;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.dropdown__option {
|
|
337
|
+
display: flex;
|
|
338
|
+
align-items: center;
|
|
339
|
+
gap: 0.5rem;
|
|
340
|
+
padding: var(--dropdown-padding);
|
|
341
|
+
transition: all 0.2s ease;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.dropdown__option:not(.dropdown__option--disabled):hover {
|
|
345
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
346
|
+
color: var(--dropdown-hover-color);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.dropdown__option--selected {
|
|
350
|
+
color: var(--dropdown-active-color);
|
|
351
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.dropdown__option--disabled {
|
|
355
|
+
opacity: 0.6;
|
|
356
|
+
cursor: not-allowed;
|
|
357
|
+
color: var(--dropdown-disabled-color);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.dropdown__option-check {
|
|
361
|
+
font-size: 0.875rem;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.dropdown__icon-image {
|
|
365
|
+
width: 1.2em;
|
|
366
|
+
height: 1.2em;
|
|
367
|
+
object-fit: contain;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.dropdown--large-icon .dropdown__selected {
|
|
371
|
+
grid-template-columns: 1fr;
|
|
372
|
+
grid-template-rows: auto 1fr auto;
|
|
373
|
+
gap: 0.5rem;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.dropdown--large-icon .dropdown__icon {
|
|
377
|
+
grid-column: 1;
|
|
378
|
+
grid-row: 1;
|
|
379
|
+
border-right: none;
|
|
380
|
+
padding: 0.75rem 0;
|
|
381
|
+
font-size: 2.5rem;
|
|
382
|
+
margin-bottom: 0.5rem;
|
|
383
|
+
height: auto;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.dropdown--large-icon .dropdown__selected-items,
|
|
387
|
+
.dropdown--large-icon .dropdown__placeholder {
|
|
388
|
+
grid-column: 1;
|
|
389
|
+
grid-row: 2;
|
|
390
|
+
text-align: center;
|
|
391
|
+
padding: 0.5rem 0.75rem;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.dropdown--large-icon .dropdown__icons {
|
|
395
|
+
grid-column: 1;
|
|
396
|
+
grid-row: 3;
|
|
397
|
+
justify-content: center;
|
|
398
|
+
padding: 0.75rem 0;
|
|
399
|
+
}
|
|
400
|
+
</style>
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
`navigation--${orientation}`,
|
|
6
6
|
{ 'navigation--large-icons': iconSize === 'large' },
|
|
7
7
|
]" :style="{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
'--navigation-color': color,
|
|
9
|
+
'--navigation-hover-color': hoverColor,
|
|
10
|
+
'--navigation-active-color': activeColor,
|
|
11
|
+
'--navigation-disabled-color': disabledColor,
|
|
12
|
+
'--navigation-gap': gap,
|
|
13
|
+
'--navigation-padding': padding,
|
|
14
|
+
'--navigation-border-radius': borderRadius,
|
|
15
|
+
'--navigation-height': height,
|
|
16
|
+
'--navigation-width': width,
|
|
17
|
+
'--navigation-background-color': backgroundColor,
|
|
18
|
+
'--navigation-active-background-color': activeBackgroundColor || 'rgba(0, 0, 0, 0.1)',
|
|
19
|
+
'--navigation-bottom-border': showBottomBorder
|
|
20
|
+
? `1px solid ${bottomBorderColor || 'rgba(0, 0, 0, 0.2)'}`
|
|
21
|
+
: 'none',
|
|
22
|
+
'--navigation-tiles-grid': navigationGrid,
|
|
23
|
+
'max-height': height,
|
|
24
|
+
}">
|
|
25
25
|
<template v-if="type === 'tiles'">
|
|
26
26
|
<div class="navigation__tiles">
|
|
27
27
|
<div v-for="(item, index) in sortedItems" :key="item.id" class="navigation__tile" :class="[
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
{ 'navigation__tile--open': isDropdownOpen(item.id) },
|
|
32
32
|
{ 'navigation__tile--spacer': item.id.includes('spacer') },
|
|
33
33
|
]" :style="{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
'--item-alignment': item.alignment || activeItemAlignment,
|
|
35
|
+
width: item.width || '150px',
|
|
36
|
+
'min-width': item.width || '150px',
|
|
37
|
+
'max-width': item.width || '150px',
|
|
38
|
+
'grid-column': item.alignment === 'right' ? `${index - items.length}` : `auto`,
|
|
39
|
+
}" @click="(e) => !item.id.includes('spacer') && handleItemClick(item, e)">
|
|
40
40
|
<div class="navigation__tile-content" :class="{
|
|
41
41
|
'navigation__tile-content--icon-only': !item.label,
|
|
42
42
|
'navigation__tile-content--large-icon': iconSize === 'large' && item.icon,
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
{ 'navigation__dropdown--end': item.alignment === 'end' },
|
|
94
94
|
{ 'navigation__dropdown--open': isDropdownOpen(item.id) },
|
|
95
95
|
]" :style="{
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
'--item-alignment': item.alignment || activeItemAlignment,
|
|
97
|
+
}">
|
|
98
98
|
<div class="navigation__dropdown-header" :class="{
|
|
99
99
|
'navigation__dropdown-header--icon-only': !item.label,
|
|
100
100
|
'navigation__dropdown-header--large-icon': iconSize === 'large' && item.icon,
|
|
@@ -146,8 +146,7 @@
|
|
|
146
146
|
|
|
147
147
|
<script setup lang="ts">
|
|
148
148
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
|
149
|
-
import {
|
|
150
|
-
import { NavigationProps, NavigationItem } from '../types/navigation'
|
|
149
|
+
import type { NavigationProps, NavigationItem } from '../types/navigation'
|
|
151
150
|
|
|
152
151
|
const props = defineProps<NavigationProps>()
|
|
153
152
|
const emit = defineEmits<{
|
package/src/main.ts
CHANGED