@brightspace-ui/labs 2.38.0 → 2.38.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/package.json CHANGED
@@ -114,5 +114,5 @@
114
114
  "resize-observer-polyfill": "^1",
115
115
  "webvtt-parser": "^2.1.2"
116
116
  },
117
- "version": "2.38.0"
117
+ "version": "2.38.1"
118
118
  }
@@ -10,6 +10,7 @@ import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
10
10
  import { styleMap } from 'lit/directives/style-map.js';
11
11
 
12
12
  const mediaQueryList = window.matchMedia('(max-width: 615px)');
13
+ const immersiveNavTextSpacingFlag = getFlag('GAUD-8465-immersive-nav-text-spacing', false);
13
14
 
14
15
  class NavigationImmersive extends LitElement {
15
16
 
@@ -38,6 +39,7 @@ class NavigationImmersive extends LitElement {
38
39
  reflect: true
39
40
  },
40
41
  _dynamicSpacingHeight: { state: true },
42
+ _spacingUseHeightVar: { attribute: '_spacing-use-height-var', type: Boolean, reflect: true },
41
43
  _middleHidden: { state: true },
42
44
  _middleNoRightBorder: { state: true },
43
45
  _smallWidth: { state: true }
@@ -130,10 +132,13 @@ class NavigationImmersive extends LitElement {
130
132
  }
131
133
 
132
134
  .d2l-labs-navigation-immersive-spacing {
133
- height: calc(var(--d2l-labs-navigation-immersive-height-main) + 5px);
134
135
  position: unset;
135
136
  }
136
137
 
138
+ :host([_spacing-use-height-var]) .d2l-labs-navigation-immersive-spacing {
139
+ height: calc(var(--d2l-labs-navigation-immersive-height-main) + 5px);
140
+ }
141
+
137
142
  @media (max-width: 929px) {
138
143
  .d2l-labs-navigation-immersive-margin {
139
144
  margin: 0 24px;
@@ -173,9 +178,10 @@ class NavigationImmersive extends LitElement {
173
178
  this._middleNoRightBorder = true;
174
179
  this._middleObserver = new ResizeObserver(this._onMiddleResize.bind(this));
175
180
  this._rightObserver = new ResizeObserver(this._onRightResize.bind(this));
181
+ this._spacingUseHeightVar = !immersiveNavTextSpacingFlag;
176
182
 
177
183
  // Only create navigation observer if feature flag is enabled
178
- if (getFlag('GAUD-8465-immersive-nav-text-spacing', false)) {
184
+ if (immersiveNavTextSpacingFlag) {
179
185
  this._navigationObserver = new ResizeObserver(this._onNavigationResize.bind(this));
180
186
  }
181
187
 
@@ -235,8 +241,6 @@ class NavigationImmersive extends LitElement {
235
241
  `;
236
242
  }
237
243
 
238
- #prevHeight = 0;
239
-
240
244
  _handleBackClick() {
241
245
  this.dispatchEvent(
242
246
  new CustomEvent(
@@ -263,15 +267,9 @@ class NavigationImmersive extends LitElement {
263
267
  }
264
268
 
265
269
  const newHeight = entries[0].contentRect.height;
266
- if (this.#prevHeight === 0) {
267
- this.#prevHeight = newHeight;
268
- return;
269
- } else if (this.#prevHeight === newHeight) {
270
- return;
271
- }
270
+ if (!newHeight) return;
272
271
 
273
- this.#prevHeight = newHeight;
274
- this._dynamicSpacingHeight = newHeight + 5; // 5px is the standard spacing buffer
272
+ this._dynamicSpacingHeight = newHeight;
275
273
  }
276
274
 
277
275
  _onRightResize(entries) {