richie 2.34.1.dev31__py2.py3-none-any.whl → 2.34.1.dev33__py2.py3-none-any.whl

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.

Potentially problematic release.


This version of richie might be problematic. Click here for more details.

@@ -241,13 +241,9 @@
241
241
  display: none;
242
242
  position: absolute;
243
243
  transform: translateX(-8px);
244
+ width: max-content;
244
245
  max-width: 100%;
245
246
 
246
- &--full-width {
247
- left: 0;
248
- transform: inherit;
249
- }
250
-
251
247
  & > ul[role='menu'] {
252
248
  display: flex;
253
249
  flex-wrap: wrap;
@@ -268,6 +264,15 @@
268
264
  color: var(--active-text-color);
269
265
  }
270
266
  }
267
+
268
+ &--full-width {
269
+ left: 0;
270
+ transform: inherit;
271
+ }
272
+
273
+ &--position-right {
274
+ transform: translateX(calc(-100% + (var(--button-width) + 8px)));
275
+ }
271
276
  }
272
277
  }
273
278
  }
@@ -275,6 +275,7 @@
275
275
  const $menuButton = $dropdown.previousElementSibling;
276
276
  const topbarWidth = $topbar.getBoundingClientRect().width;
277
277
  const topbarLeft = $topbar.getBoundingClientRect().left;
278
+ const menuButtonWidth = $menuButton.getBoundingClientRect().width;
278
279
  const menuButtonLeft = $menuButton.getBoundingClientRect().left;
279
280
  $dropdown.style.display = 'block';
280
281
  $menu.style.flexWrap = 'nowrap';
@@ -282,11 +283,21 @@
282
283
  $dropdown.style = '';
283
284
  $menu.style = '';
284
285
  const menuRelativeOffsetX = menuButtonLeft - topbarLeft;
286
+ const rightRemainingSpace = topbarWidth - menuRelativeOffsetX;
285
287
 
286
-
287
- if (menuWidth > (topbarWidth - menuRelativeOffsetX)) {
288
- $dropdown.classList.add('topbar__sublist--full-width');
289
- } else {
288
+ if (menuWidth > rightRemainingSpace) {
289
+ if (menuWidth < (menuRelativeOffsetX + menuButtonWidth)) {
290
+ $dropdown.classList.add('topbar__sublist--position-right');
291
+ $dropdown.style.setProperty('--button-width', `${menuButtonWidth}px`);
292
+ $dropdown.classList.remove('topbar__sublist--full-width');
293
+ }
294
+ else {
295
+ $dropdown.classList.add('topbar__sublist--full-width');
296
+ $dropdown.classList.remove('topbar__sublist--position-right');
297
+ }
298
+ }
299
+ else {
300
+ $dropdown.classList.remove('topbar__sublist--position-right');
290
301
  $dropdown.classList.remove('topbar__sublist--full-width');
291
302
  }
292
303
  }