@redseed/redseed-ui-vue3 8.29.0 → 8.29.2
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
|
@@ -30,6 +30,7 @@ function check(event) {
|
|
|
30
30
|
<FormFieldSlot
|
|
31
31
|
:id="$attrs.id"
|
|
32
32
|
:required="$attrs.required"
|
|
33
|
+
:showAsterisk="false"
|
|
33
34
|
class="rsui-form-field-checkbox"
|
|
34
35
|
>
|
|
35
36
|
<template #label>
|
|
@@ -51,12 +52,14 @@ function check(event) {
|
|
|
51
52
|
>
|
|
52
53
|
</div>
|
|
53
54
|
<div v-if="$slots.label"
|
|
54
|
-
|
|
55
|
-
'rsui-form-field-checkbox__label',
|
|
56
|
-
{ 'rsui-form-field-checkbox__label--required': $attrs.required !== undefined },
|
|
57
|
-
]"
|
|
55
|
+
class="rsui-form-field-checkbox__label"
|
|
58
56
|
>
|
|
59
57
|
<slot name="label"></slot>
|
|
58
|
+
<span
|
|
59
|
+
v-if="$attrs.required !== undefined && $attrs.required !== false"
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
class="rsui-form-field-slot__asterisk"
|
|
62
|
+
>*</span>
|
|
60
63
|
</div>
|
|
61
64
|
</div>
|
|
62
65
|
</template>
|
|
@@ -142,24 +142,17 @@ const anchorBounding = useElementBounding(anchorElement)
|
|
|
142
142
|
function calculateDropdownPosition() {
|
|
143
143
|
if (!dropdownElement.value) return
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
// Reset inline positioning before measuring so a previously-applied
|
|
146
|
+
// max-height (from an earlier constrained open) doesn't pollute the
|
|
147
|
+
// offsetHeight read below. Without this, a subsequent re-open after
|
|
148
|
+
// window resize would see the *capped* height and pick the wrong branch.
|
|
149
|
+
dropdownElement.value.style.maxHeight = ''
|
|
150
|
+
dropdownElement.value.style.top = ''
|
|
151
|
+
dropdownElement.value.style.bottom = ''
|
|
149
152
|
|
|
150
|
-
/**
|
|
151
|
-
* Get the dropdown element height
|
|
152
|
-
*/
|
|
153
153
|
const dropdownElementHeight = dropdownElement.value.offsetHeight
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Get space above the anchor element
|
|
157
|
-
*/
|
|
154
|
+
const viewportHeight = window.innerHeight
|
|
158
155
|
const spaceAbove = anchorBounding.top.value
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Get space below the anchor element
|
|
162
|
-
*/
|
|
163
156
|
const spaceBelow = viewportHeight - anchorBounding.bottom.value
|
|
164
157
|
|
|
165
158
|
dropdownElement.value.style.minWidth = `${anchorBounding.width.value}px`
|
|
@@ -186,18 +179,24 @@ function calculateDropdownPosition() {
|
|
|
186
179
|
dropdownElement.value.style.left = `${clampedLeft}px`
|
|
187
180
|
}
|
|
188
181
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
182
|
+
// The dropdown has `mt-2` (8px) in CSS, so 8px gets consumed by the
|
|
183
|
+
// visual gap to the trigger; subtract another 8px for breathing room
|
|
184
|
+
// from the viewport edge (sub-pixel rounding + box-shadow ink).
|
|
185
|
+
const verticalOffset = 16
|
|
186
|
+
|
|
187
|
+
if (spaceBelow > dropdownElementHeight) {
|
|
195
188
|
dropdownElement.value.style.top = `${anchorBounding.bottom.value + window.scrollY}px`
|
|
196
189
|
dropdownElement.value.style.bottom = 'auto'
|
|
197
190
|
return
|
|
198
|
-
} else if (spaceAbove >
|
|
191
|
+
} else if (spaceAbove > spaceBelow) {
|
|
199
192
|
dropdownElement.value.style.top = 'auto'
|
|
200
193
|
dropdownElement.value.style.bottom = `${spaceBelow + anchorBounding.height.value + 8 - window.scrollY}px`
|
|
194
|
+
dropdownElement.value.style.maxHeight = `${spaceAbove - verticalOffset}px`
|
|
195
|
+
return
|
|
196
|
+
} else {
|
|
197
|
+
dropdownElement.value.style.top = `${anchorBounding.bottom.value + window.scrollY}px`
|
|
198
|
+
dropdownElement.value.style.bottom = 'auto'
|
|
199
|
+
dropdownElement.value.style.maxHeight = `${spaceBelow - verticalOffset}px`
|
|
201
200
|
return
|
|
202
201
|
}
|
|
203
202
|
}
|