@energysage/es-ds-components 5.7.0 → 5.7.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.7.1](https://github.com/EnergySage/es-ds/compare/es-ds-components-v5.7.0...es-ds-components-v5.7.1) (2026-06-12)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * floating sticky bar no longer causes mobile layout shift ([#1773](https://github.com/EnergySage/es-ds/issues/1773)) ([077eb77](https://github.com/EnergySage/es-ds/commit/077eb77f062df07a2e8714e8146c842e11c1b2db))
9
+
3
10
  ## [5.7.0](https://github.com/EnergySage/es-ds/compare/es-ds-components-v5.6.2...es-ds-components-v5.7.0) (2026-06-11)
4
11
 
5
12
 
@@ -7,12 +7,12 @@ import {
7
7
  } from '../utils/menu-bar';
8
8
 
9
9
  interface IProps {
10
- initialState?: 'static' | 'absolute';
10
+ floatStartingAtBreakpoint?: 'lg' | 'xl' | 'xxl' | '';
11
11
  transparentColor?: string;
12
12
  transparentStartingAtBreakpoint?: 'lg' | 'xl' | 'xxl' | '';
13
13
  }
14
- const props = withDefaults(defineProps<IProps>(), {
15
- initialState: 'static',
14
+ withDefaults(defineProps<IProps>(), {
15
+ floatStartingAtBreakpoint: '',
16
16
  transparentColor: 'transparent',
17
17
  transparentStartingAtBreakpoint: '',
18
18
  });
@@ -28,7 +28,7 @@ const emitter = useEsdsEvents();
28
28
  // - fixed-visible: bar is pinned to the top of the viewport, visible
29
29
  // - fixed-hidden: bar is pinned but translated off screen above the viewport
30
30
  type BarState = 'static' | 'absolute' | 'fixed-visible' | 'fixed-hidden';
31
- const barState = ref<BarState>(props.initialState);
31
+ const barState = ref<BarState>('static');
32
32
 
33
33
  // ref to the bar element, used to read its rendered height
34
34
  const bar = ref<HTMLElement | null>(null);
@@ -189,6 +189,7 @@ onUnmounted(() => {
189
189
  class="es-sticky-bar"
190
190
  :class="[
191
191
  `es-sticky-bar--${barState}`,
192
+ floatStartingAtBreakpoint && `es-sticky-bar--float-from-${floatStartingAtBreakpoint}`,
192
193
  transparentStartingAtBreakpoint && `es-sticky-bar--transparent-from-${transparentStartingAtBreakpoint}`,
193
194
  {
194
195
  'es-sticky-bar--no-transition': suppressTransition,
@@ -200,10 +201,11 @@ onUnmounted(() => {
200
201
  @mouseout="isHovered = false">
201
202
  <slot />
202
203
  </div>
203
- <!-- holds the bar's space in normal flow when the bar is absolutely or fixed positioned -->
204
+ <!-- holds the bar's space in normal flow when the bar is absolutely or fixed positioned;
205
+ hidden at/above the float breakpoint, where the bar overlaps page content instead -->
204
206
  <div
205
207
  v-if="barState !== 'static'"
206
- :class="{ 'd-xl-none': initialState !== 'static' }"
208
+ :class="floatStartingAtBreakpoint && `d-${floatStartingAtBreakpoint}-none`"
207
209
  :style="{ height: `${barHeight}px` }"
208
210
  aria-hidden="true" />
209
211
  </template>
@@ -235,6 +237,17 @@ $shadow: 0 0 6px 0 rgba(34, 38, 51, 0.2);
235
237
  }
236
238
  }
237
239
 
240
+ // while still in the pre-mount static state, take the bar out of flow at/above the float
241
+ // breakpoint so it overlaps page content from the first paint; below the breakpoint the
242
+ // bar stays in flow until mount (when the spacer appears), avoiding a layout shift
243
+ @each $bp in (lg, xl, xxl) {
244
+ &--float-from-#{$bp}.es-sticky-bar--static {
245
+ @include breakpoints.media-breakpoint-up($bp) {
246
+ position: absolute;
247
+ }
248
+ }
249
+ }
250
+
238
251
  @media not (prefers-reduced-motion) {
239
252
  transition:
240
253
  background 0.2s ease-in-out,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energysage/es-ds-components",
3
- "version": "5.7.0",
3
+ "version": "5.7.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "An EnergySage Vue component library",