@schukai/monster 4.139.0 → 4.139.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
@@ -1 +1 @@
1
- {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.139.0"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.139.1"}
@@ -3531,6 +3531,12 @@ function getSelectPopperPositionOptions() {
3531
3531
  popperOptions.strategy = "fixed";
3532
3532
  }
3533
3533
 
3534
+ if (isInControlBar.call(this)) {
3535
+ // Popper content rendered outside a 40px control-bar host must be hit-testable
3536
+ // against the viewport instead of the host's compact shadow boundary.
3537
+ popperOptions.strategy = "fixed";
3538
+ }
3539
+
3534
3540
  return popperOptions;
3535
3541
  }
3536
3542
 
@@ -4873,6 +4879,15 @@ function show() {
4873
4879
  });
4874
4880
  }
4875
4881
 
4882
+ /**
4883
+ * @private
4884
+ * @return {boolean}
4885
+ */
4886
+ function isInControlBar() {
4887
+ return this.closest("monster-control-bar,monster-button-bar") instanceof
4888
+ HTMLElement;
4889
+ }
4890
+
4876
4891
  /**
4877
4892
  * @private
4878
4893
  */
@@ -110,6 +110,8 @@ describe('Select', function () {
110
110
 
111
111
  import("../../../../source/components/host/host.mjs").then(() => {
112
112
  return import("../../../../source/components/form/popper-button.mjs");
113
+ }).then(() => {
114
+ return import("../../../../source/components/form/control-bar.mjs");
113
115
  }).then(() => {
114
116
  return import("../../../../source/components/form/select.mjs");
115
117
  }).then((m) => {
@@ -322,6 +324,52 @@ describe('Select', function () {
322
324
  }, 20);
323
325
  });
324
326
 
327
+ it('should use fixed positioning inside a control bar', function (done) {
328
+ const mocks = document.getElementById('mocks');
329
+ mocks.innerHTML = '<monster-control-bar id="select-bar"></monster-control-bar>';
330
+
331
+ const bar = document.getElementById('select-bar');
332
+ const select = document.createElement('monster-select');
333
+
334
+ select.setOption('options', [
335
+ {label: 'Alpha', value: 'alpha'},
336
+ {label: 'Beta', value: 'beta'}
337
+ ]);
338
+
339
+ bar.appendChild(select);
340
+
341
+ const shadowRoot = select.shadowRoot;
342
+ const control = shadowRoot.querySelector('[data-monster-role=control]');
343
+ const popper = shadowRoot.querySelector('[data-monster-role=popper]');
344
+
345
+ control.getBoundingClientRect = () => ({
346
+ width: 120,
347
+ height: 40,
348
+ top: 100,
349
+ left: 40,
350
+ right: 160,
351
+ bottom: 140,
352
+ x: 40,
353
+ y: 100
354
+ });
355
+
356
+ setTimeout(() => {
357
+ try {
358
+ shadowRoot.querySelector('[data-monster-role=container]').click();
359
+ setTimeout(() => {
360
+ try {
361
+ expect(popper.style.position).to.equal('fixed');
362
+ done();
363
+ } catch (e) {
364
+ done(e);
365
+ }
366
+ }, 80);
367
+ } catch (e) {
368
+ done(e);
369
+ }
370
+ }, 100);
371
+ });
372
+
325
373
  it('should keep the option list height tight for short lists', function () {
326
374
  const result = resolveSelectListDimension({
327
375
  visibleOptionHeights: [28, 28],