@redseed/redseed-ui-vue3 8.36.0 → 8.38.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redseed/redseed-ui-vue3",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.38.0",
|
|
4
4
|
"description": "RedSeed UI Vue 3 components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "https://github.com/redseedtraining/redseed-ui",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"license": "ISC",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@heroicons/vue": "2.2.0",
|
|
15
|
-
"apexcharts": "5.
|
|
15
|
+
"apexcharts": "5.14.0",
|
|
16
16
|
"vue3-apexcharts": "1.11.1",
|
|
17
|
-
"@vueuse/components": "14.
|
|
18
|
-
"@vueuse/core": "14.
|
|
19
|
-
"@vueuse/integrations": "14.
|
|
20
|
-
"fuse.js": "7.
|
|
21
|
-
"lodash": "4.
|
|
17
|
+
"@vueuse/components": "14.3.0",
|
|
18
|
+
"@vueuse/core": "14.3.0",
|
|
19
|
+
"@vueuse/integrations": "14.3.0",
|
|
20
|
+
"fuse.js": "7.4.2",
|
|
21
|
+
"lodash": "4.18.1",
|
|
22
22
|
"lottie-web": "5.13.0",
|
|
23
|
-
"vue": "3.5.
|
|
23
|
+
"vue": "3.5.35"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -22,6 +22,15 @@ const props = defineProps({
|
|
|
22
22
|
type: Number,
|
|
23
23
|
default: 2,
|
|
24
24
|
},
|
|
25
|
+
dropdownWidth: {
|
|
26
|
+
// Fixes the suggestions dropdown to an exact width, decoupling it from
|
|
27
|
+
// the input's width. Useful when the input must be narrow for layout
|
|
28
|
+
// reasons but the results list needs more room (e.g. "Name | Location"
|
|
29
|
+
// rows). Accepts a number (treated as px) or any CSS length string.
|
|
30
|
+
// Unset = the dropdown follows the input width, as before.
|
|
31
|
+
type: [String, Number],
|
|
32
|
+
default: null,
|
|
33
|
+
},
|
|
25
34
|
})
|
|
26
35
|
|
|
27
36
|
const emit = defineEmits(['input', 'query-change', 'navigate', 'keyup-enter'])
|
|
@@ -32,6 +41,7 @@ const { inputId, ariaDescribedby, ariaInvalid } = useFormFieldA11y()
|
|
|
32
41
|
const query = ref('')
|
|
33
42
|
const isOpen = ref(false)
|
|
34
43
|
const inputElement = ref(null)
|
|
44
|
+
const fieldElement = ref(null)
|
|
35
45
|
const rootElement = ref(null)
|
|
36
46
|
const dropdownElement = ref(null)
|
|
37
47
|
const highlightedIndex = ref(-1)
|
|
@@ -218,28 +228,33 @@ onClickOutside(rootElement, () => {
|
|
|
218
228
|
if (isOpen.value) close()
|
|
219
229
|
})
|
|
220
230
|
|
|
221
|
-
|
|
231
|
+
// Measure the whole field box (icon prefix + input), not the inner <input> —
|
|
232
|
+
// the input sits to the right of the prefix and is narrower, so anchoring to
|
|
233
|
+
// it would leave the dropdown shifted right and narrower than the field.
|
|
234
|
+
const fieldElementBounding = useElementBounding(fieldElement)
|
|
222
235
|
|
|
223
236
|
function calculateDropdownPosition() {
|
|
224
237
|
if (!dropdownElement.value) return
|
|
225
238
|
|
|
226
239
|
const viewportHeight = window.innerHeight
|
|
227
240
|
const dropdownHeight = dropdownElement.value.offsetHeight
|
|
228
|
-
const spaceAbove =
|
|
229
|
-
const spaceBelow = viewportHeight -
|
|
241
|
+
const spaceAbove = fieldElementBounding.top.value
|
|
242
|
+
const spaceBelow = viewportHeight - fieldElementBounding.bottom.value
|
|
230
243
|
|
|
231
|
-
dropdownElement.value.style.width =
|
|
232
|
-
|
|
244
|
+
dropdownElement.value.style.width = props.dropdownWidth != null
|
|
245
|
+
? (typeof props.dropdownWidth === 'number' ? `${props.dropdownWidth}px` : props.dropdownWidth)
|
|
246
|
+
: `${fieldElementBounding.width.value}px`
|
|
247
|
+
dropdownElement.value.style.left = `${fieldElementBounding.left.value}px`
|
|
233
248
|
|
|
234
249
|
if (spaceAbove <= dropdownHeight && spaceBelow <= dropdownHeight) {
|
|
235
250
|
dropdownElement.value.style.top = '0'
|
|
236
251
|
dropdownElement.value.style.bottom = 'auto'
|
|
237
252
|
} else if (spaceBelow > dropdownHeight) {
|
|
238
|
-
dropdownElement.value.style.top = `${
|
|
253
|
+
dropdownElement.value.style.top = `${fieldElementBounding.bottom.value + window.scrollY}px`
|
|
239
254
|
dropdownElement.value.style.bottom = 'auto'
|
|
240
255
|
} else if (spaceAbove > dropdownHeight) {
|
|
241
256
|
dropdownElement.value.style.top = 'auto'
|
|
242
|
-
dropdownElement.value.style.bottom = `${spaceBelow +
|
|
257
|
+
dropdownElement.value.style.bottom = `${spaceBelow + fieldElementBounding.height.value + 8 - window.scrollY}px`
|
|
243
258
|
}
|
|
244
259
|
}
|
|
245
260
|
|
|
@@ -274,7 +289,7 @@ defineExpose({
|
|
|
274
289
|
<slot name="label"></slot>
|
|
275
290
|
</template>
|
|
276
291
|
|
|
277
|
-
<div class="rsui-form-field-text__group">
|
|
292
|
+
<div ref="fieldElement" class="rsui-form-field-text__group">
|
|
278
293
|
<div
|
|
279
294
|
class="rsui-form-field-text__prefix"
|
|
280
295
|
aria-hidden="true"
|