@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redseed/redseed-ui-vue3",
3
- "version": "8.29.0",
3
+ "version": "8.29.2",
4
4
  "description": "RedSeed UI Vue 3 components",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/redseedtraining/redseed-ui",
@@ -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
- :class="[
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
- * Get the viewport height
147
- */
148
- const viewportHeight = window.innerHeight
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
- if (spaceAbove <= dropdownElementHeight
190
- && spaceBelow <= dropdownElementHeight) {
191
- dropdownElement.value.style.top = '0'
192
- dropdownElement.value.style.bottom = 'auto'
193
- return
194
- } else if (spaceBelow > dropdownElementHeight) {
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 > dropdownElementHeight) {
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
  }