@kubex/zinc 1.1.109 → 1.1.111

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": "@kubex/zinc",
3
- "version": "1.1.109",
3
+ "version": "1.1.111",
4
4
  "description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
5
5
  "keywords": [
6
6
  "web components",
@@ -406,3 +406,27 @@ zn-navbar {
406
406
  :host .page__tabs #content.page__content {
407
407
  padding: 0 var(--zn-gutter, 0);
408
408
  }
409
+
410
+ // On narrow pages the breadcrumb is supporting context, not a second title.
411
+ // Stack it above the current page caption and reduce its visual weight instead
412
+ // of forcing both labels and their separator into the same cramped row.
413
+ @container (max-width: 600px) {
414
+ .header--has-breadcrumb {
415
+ .header__caption {
416
+ align-items: flex-start;
417
+ flex-direction: column;
418
+ gap: var(--zn-spacing-3x-small);
419
+ }
420
+
421
+ .breadcrumb {
422
+ color: rgb(var(--zn-text-muted));
423
+ font-size: var(--zn-font-size-small);
424
+ font-weight: var(--zn-font-weight-normal);
425
+ line-height: var(--zn-line-height-dense);
426
+ }
427
+
428
+ .breadcrumb__separator {
429
+ display: none;
430
+ }
431
+ }
432
+ }
@@ -268,6 +268,7 @@ export default class ZnPopup extends ZincElement {
268
268
  if (!this.anchorEl) {
269
269
  return;
270
270
  }
271
+ this.cleanup?.();
271
272
  this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {
272
273
  this.reposition();
273
274
  });
@@ -406,7 +407,9 @@ export default class ZnPopup extends ZincElement {
406
407
 
407
408
  if (!this.popup?.isConnected) return;
408
409
 
409
- this.popup.showPopover();
410
+ if (!this.popup.matches(':popover-open')) {
411
+ this.popup.showPopover();
412
+ }
410
413
 
411
414
  if (this.arrow) {
412
415
  const arrowX = middlewareData.arrow!.x;
@@ -537,7 +540,7 @@ export default class ZnPopup extends ZincElement {
537
540
  <div
538
541
  id="popup"
539
542
  part="popup"
540
- popover
543
+ popover="manual"
541
544
  class="${classMap({
542
545
  popup: true,
543
546
  'popup--active': this.active,
@@ -1,5 +1,5 @@
1
1
  import '../../../dist/zn.min.js';
2
- import {expect, fixture, html} from '@open-wc/testing';
2
+ import {expect, fixture, html, waitUntil} from '@open-wc/testing';
3
3
  import type ZnOption from '../option/option.component';
4
4
  import type ZnSelect from './select.component';
5
5
 
@@ -824,4 +824,44 @@ describe('<zn-select>', () => {
824
824
  expect(getComputedStyle(addRow).fontSize).to.equal('11px');
825
825
  });
826
826
  });
827
+
828
+ it('does not flicker the open listbox when a second select is opened', async () => {
829
+ const wrapper = await fixture(html`
830
+ <div>
831
+ <zn-select id="first">
832
+ <zn-option value="apple">Apple</zn-option>
833
+ <zn-option value="banana">Banana</zn-option>
834
+ </zn-select>
835
+ <zn-select id="second">
836
+ <zn-option value="cherry">Cherry</zn-option>
837
+ <zn-option value="date">Date</zn-option>
838
+ </zn-select>
839
+ </div>
840
+ `);
841
+
842
+ const first = wrapper.querySelector<ZnSelect>('#first')!;
843
+ const second = wrapper.querySelector<ZnSelect>('#second')!;
844
+ await Promise.all([first.updateComplete, second.updateComplete]);
845
+
846
+ const popoverOf = (el: ZnSelect) =>
847
+ el.shadowRoot!.querySelector('zn-popup')!.shadowRoot!.querySelector<HTMLElement>('#popup')!;
848
+
849
+ const states: string[] = [];
850
+ popoverOf(first).addEventListener('beforetoggle', (event: Event) =>
851
+ states.push((event as ToggleEvent).newState));
852
+
853
+ await first.show();
854
+ states.length = 0;
855
+
856
+ // Mimic a click on the second select: the document mousedown closes the first, the combobox
857
+ // mousedown opens the second
858
+ document.dispatchEvent(new MouseEvent('mousedown', {bubbles: true, composed: true}));
859
+ second.shadowRoot!.querySelector('.select__combobox')!
860
+ .dispatchEvent(new MouseEvent('mousedown', {bubbles: true, composed: true}));
861
+ await second.updateComplete;
862
+ await waitUntil(() => !first.open && states.includes('closed'));
863
+
864
+ expect(states).to.deep.equal(['closed']);
865
+ expect(popoverOf(second).matches(':popover-open')).to.be.true;
866
+ });
827
867
  });
@@ -413,14 +413,20 @@ export default class ZnTabs extends ZincElement {
413
413
  _handleClick(event: PointerEvent) {
414
414
  // ts-ignore
415
415
  const target = (event.relatedTarget ?? event.target) as HTMLElement;
416
- if (target) {
417
- if ('startViewTransition' in document) {
418
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
419
- (document as any).startViewTransition(() => this.clickTab(target, event.altKey, true));
420
- } else {
421
- this.clickTab(target, event.altKey, true)
422
- }
416
+ if (!target) {
417
+ return;
423
418
  }
419
+
420
+ if (!('startViewTransition' in document)) {
421
+ this.clickTab(target, event.altKey, true);
422
+ return;
423
+ }
424
+
425
+ const transition = document.startViewTransition(() => this.clickTab(target, event.altKey, true));
426
+
427
+ void transition.ready.catch(() => undefined);
428
+ void transition.finished.catch(() => undefined);
429
+ void transition.updateCallbackDone.catch(() => undefined);
424
430
  }
425
431
 
426
432
  fetchUriTab(target: HTMLElement) {