@ferrlabs/ui-ng 1.61.2 → 1.62.0

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.
@@ -16370,6 +16370,9 @@ var TabComponent = class TabComponent {
16370
16370
  focus() {
16371
16371
  this.control()?.nativeElement.focus();
16372
16372
  }
16373
+ element() {
16374
+ return this.control()?.nativeElement ?? null;
16375
+ }
16373
16376
  onClick(event) {
16374
16377
  if (this.disabled()) {
16375
16378
  event.preventDefault();
@@ -16453,7 +16456,7 @@ var TabComponent = class TabComponent {
16453
16456
  }],
16454
16457
  ngImport: i0,
16455
16458
  template: "@if (asLink()) {\n <a\n #control\n class=\"flr-tab\"\n [class.flr-tab--active]=\"active()\"\n [href]=\"href()\"\n [attr.aria-current]=\"active() ? 'page' : null\"\n (click)=\"onClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"body\" />\n </a>\n} @else {\n <button\n #control\n type=\"button\"\n class=\"flr-tab\"\n [class.flr-tab--active]=\"active()\"\n [disabled]=\"disabled()\"\n [attr.role]=\"isPanel() ? 'tab' : null\"\n [attr.aria-selected]=\"isPanel() ? active() : null\"\n [attr.aria-controls]=\"isPanel() ? panelId() : null\"\n [attr.aria-current]=\"!isPanel() && active() ? 'page' : null\"\n [attr.tabindex]=\"tabIndex()\"\n (click)=\"onClick($event)\"\n (keydown)=\"onKeydown($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"body\" />\n </button>\n}\n\n<ng-template #body>\n <span class=\"flr-tab__label\">{{ label() }}</span>\n @if (count() !== null) {\n <span class=\"mono flr-tab__count\">{{ count() }}</span>\n }\n</ng-template>\n",
16456
- styles: [":host{display:contents}.flr-tab{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:44px;padding:8px 12px;border:none;border-bottom:2px solid transparent;background:transparent;color:var(--color-fg-2, #475569);font:inherit;font-size:13px;font-weight:500;line-height:1.4;white-space:nowrap;text-decoration:none;cursor:pointer;transition:color .12s ease,border-color .12s ease}.flr-tab:hover:not(:disabled){color:var(--color-fg, #1e293b);border-bottom-color:var(--color-rule-strong, rgba(30, 41, 59, .28))}.flr-tab:focus-visible{outline:2px solid var(--color-accent, var(--color-fg, #1e293b));outline-offset:-2px;border-radius:var(--radius-control, 4px) var(--radius-control, 4px) 0 0}.flr-tab--active,.flr-tab--active:hover{color:var(--color-fg, #1e293b);border-bottom-color:var(--color-accent, var(--color-fg, #1e293b))}.flr-tab:disabled{opacity:.45;cursor:not-allowed}.flr-tab__count{font-size:11px;color:var(--color-fg-3, #5d6b80)}.flr-tab--active .flr-tab__count{color:var(--color-fg-2, #475569)}@media(prefers-reduced-motion:reduce){.flr-tab{transition:none}}\n"],
16459
+ styles: [":host{display:contents}.flr-tab{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:44px;padding:8px 12px;border:none;border-bottom:2px solid transparent;background:transparent;color:var(--color-fg-2, #475569);font:inherit;font-size:13px;font-weight:500;line-height:1.4;white-space:nowrap;scroll-snap-align:start;text-decoration:none;cursor:pointer;transition:color .12s ease,border-color .12s ease}.flr-tab:hover:not(:disabled){color:var(--color-fg, #1e293b);border-bottom-color:var(--color-rule-strong, rgba(30, 41, 59, .28))}.flr-tab:focus-visible{outline:2px solid var(--color-accent, var(--color-fg, #1e293b));outline-offset:-2px;border-radius:var(--radius-control, 4px) var(--radius-control, 4px) 0 0}.flr-tab--active,.flr-tab--active:hover{color:var(--color-fg, #1e293b);border-bottom-color:var(--color-accent, var(--color-fg, #1e293b))}.flr-tab:disabled{opacity:.45;cursor:not-allowed}.flr-tab__count{font-size:11px;color:var(--color-fg-3, #5d6b80)}.flr-tab--active .flr-tab__count{color:var(--color-fg-2, #475569)}@media(prefers-reduced-motion:reduce){.flr-tab{transition:none}}\n"],
16457
16460
  dependencies: [{
16458
16461
  kind: "directive",
16459
16462
  type: NgTemplateOutlet,
@@ -16480,7 +16483,7 @@ i0.ɵɵngDeclareClassMetadata({
16480
16483
  changeDetection: ChangeDetectionStrategy.OnPush,
16481
16484
  imports: [NgTemplateOutlet],
16482
16485
  template: "@if (asLink()) {\n <a\n #control\n class=\"flr-tab\"\n [class.flr-tab--active]=\"active()\"\n [href]=\"href()\"\n [attr.aria-current]=\"active() ? 'page' : null\"\n (click)=\"onClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"body\" />\n </a>\n} @else {\n <button\n #control\n type=\"button\"\n class=\"flr-tab\"\n [class.flr-tab--active]=\"active()\"\n [disabled]=\"disabled()\"\n [attr.role]=\"isPanel() ? 'tab' : null\"\n [attr.aria-selected]=\"isPanel() ? active() : null\"\n [attr.aria-controls]=\"isPanel() ? panelId() : null\"\n [attr.aria-current]=\"!isPanel() && active() ? 'page' : null\"\n [attr.tabindex]=\"tabIndex()\"\n (click)=\"onClick($event)\"\n (keydown)=\"onKeydown($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"body\" />\n </button>\n}\n\n<ng-template #body>\n <span class=\"flr-tab__label\">{{ label() }}</span>\n @if (count() !== null) {\n <span class=\"mono flr-tab__count\">{{ count() }}</span>\n }\n</ng-template>\n",
16483
- styles: [":host{display:contents}.flr-tab{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:44px;padding:8px 12px;border:none;border-bottom:2px solid transparent;background:transparent;color:var(--color-fg-2, #475569);font:inherit;font-size:13px;font-weight:500;line-height:1.4;white-space:nowrap;text-decoration:none;cursor:pointer;transition:color .12s ease,border-color .12s ease}.flr-tab:hover:not(:disabled){color:var(--color-fg, #1e293b);border-bottom-color:var(--color-rule-strong, rgba(30, 41, 59, .28))}.flr-tab:focus-visible{outline:2px solid var(--color-accent, var(--color-fg, #1e293b));outline-offset:-2px;border-radius:var(--radius-control, 4px) var(--radius-control, 4px) 0 0}.flr-tab--active,.flr-tab--active:hover{color:var(--color-fg, #1e293b);border-bottom-color:var(--color-accent, var(--color-fg, #1e293b))}.flr-tab:disabled{opacity:.45;cursor:not-allowed}.flr-tab__count{font-size:11px;color:var(--color-fg-3, #5d6b80)}.flr-tab--active .flr-tab__count{color:var(--color-fg-2, #475569)}@media(prefers-reduced-motion:reduce){.flr-tab{transition:none}}\n"]
16486
+ styles: [":host{display:contents}.flr-tab{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-height:44px;padding:8px 12px;border:none;border-bottom:2px solid transparent;background:transparent;color:var(--color-fg-2, #475569);font:inherit;font-size:13px;font-weight:500;line-height:1.4;white-space:nowrap;scroll-snap-align:start;text-decoration:none;cursor:pointer;transition:color .12s ease,border-color .12s ease}.flr-tab:hover:not(:disabled){color:var(--color-fg, #1e293b);border-bottom-color:var(--color-rule-strong, rgba(30, 41, 59, .28))}.flr-tab:focus-visible{outline:2px solid var(--color-accent, var(--color-fg, #1e293b));outline-offset:-2px;border-radius:var(--radius-control, 4px) var(--radius-control, 4px) 0 0}.flr-tab--active,.flr-tab--active:hover{color:var(--color-fg, #1e293b);border-bottom-color:var(--color-accent, var(--color-fg, #1e293b))}.flr-tab:disabled{opacity:.45;cursor:not-allowed}.flr-tab__count{font-size:11px;color:var(--color-fg-3, #5d6b80)}.flr-tab--active .flr-tab__count{color:var(--color-fg-2, #475569)}@media(prefers-reduced-motion:reduce){.flr-tab{transition:none}}\n"]
16484
16487
  }]
16485
16488
  }],
16486
16489
  propDecorators: {
@@ -16542,6 +16545,38 @@ i0.ɵɵngDeclareClassMetadata({
16542
16545
  }]
16543
16546
  }
16544
16547
  });
16548
+ const EDGE_TOLERANCE_PX = 1;
16549
+ function fadeEdges(scrollLeft, clientWidth, scrollWidth) {
16550
+ const overflow = scrollWidth - clientWidth;
16551
+ if (overflow <= EDGE_TOLERANCE_PX) return {
16552
+ start: false,
16553
+ end: false
16554
+ };
16555
+ const offset = Math.abs(scrollLeft);
16556
+ return {
16557
+ start: offset > EDGE_TOLERANCE_PX,
16558
+ end: offset < overflow - EDGE_TOLERANCE_PX
16559
+ };
16560
+ }
16561
+ function centeredScrollLeft(scrollLeft, tab, strip) {
16562
+ return scrollLeft + (tab.left - strip.left + tab.width / 2) - strip.width / 2;
16563
+ }
16564
+ function scrollBehavior(prefersReducedMotion, animate) {
16565
+ return animate && !prefersReducedMotion ? "smooth" : "auto";
16566
+ }
16567
+ function shouldReveal(previous, next, userScrolled) {
16568
+ if (userScrolled) return false;
16569
+ if (previous === null) return true;
16570
+ return previous.clientWidth !== next.clientWidth || previous.scrollWidth !== next.scrollWidth;
16571
+ }
16572
+ function focusScrollLeft(scrollLeft, tab, strip) {
16573
+ const visibleStart = strip.left + 24;
16574
+ const visibleEnd = strip.left + strip.width - 24;
16575
+ if (tab.left < visibleStart) return scrollLeft + tab.left - visibleStart;
16576
+ const tabEnd = tab.left + tab.width;
16577
+ if (tabEnd > visibleEnd) return scrollLeft + tabEnd - visibleEnd;
16578
+ return null;
16579
+ }
16545
16580
  var TabsComponent = class TabsComponent {
16546
16581
  constructor() {
16547
16582
  this.mode = input("nav", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
@@ -16550,10 +16585,87 @@ var TabsComponent = class TabsComponent {
16550
16585
  ...ngDevMode ? { debugName: "tabs" } : /* istanbul ignore next */ {},
16551
16586
  descendants: true
16552
16587
  });
16588
+ this.strip = viewChild.required("strip", ...ngDevMode ? [{ debugName: "strip" }] : /* istanbul ignore next */ []);
16589
+ this.activeTab = computed(() => this.tabs().find((t) => t.active()), ...ngDevMode ? [{ debugName: "activeTab" }] : /* istanbul ignore next */ []);
16590
+ this.placed = false;
16591
+ this.userScrolled = false;
16592
+ this.geometry = null;
16593
+ this.fadeStart = signal(false, ...ngDevMode ? [{ debugName: "fadeStart" }] : /* istanbul ignore next */ []);
16594
+ this.fadeEnd = signal(false, ...ngDevMode ? [{ debugName: "fadeEnd" }] : /* istanbul ignore next */ []);
16553
16595
  this.role = computed(() => {
16554
16596
  if (this.mode() === "panel") return "tablist";
16555
16597
  return this.ariaLabel() ? "navigation" : null;
16556
16598
  }, ...ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []);
16599
+ afterRenderEffect(() => {
16600
+ this.activeTab();
16601
+ this.mode();
16602
+ this.userScrolled = false;
16603
+ this.revealActive(this.placed);
16604
+ this.placed = true;
16605
+ });
16606
+ afterRenderEffect(() => this.observeLayout(this.tabs()));
16607
+ const destroyRef = inject(DestroyRef);
16608
+ afterNextRender(() => {
16609
+ this.observer = new ResizeObserver(() => this.settleLayout());
16610
+ this.observeLayout(this.tabs());
16611
+ destroyRef.onDestroy(() => this.observer?.disconnect());
16612
+ });
16613
+ }
16614
+ updateFade() {
16615
+ const { scrollLeft, clientWidth, scrollWidth } = this.strip().nativeElement;
16616
+ const { start, end } = fadeEdges(scrollLeft, clientWidth, scrollWidth);
16617
+ this.fadeStart.set(start);
16618
+ this.fadeEnd.set(end);
16619
+ }
16620
+ markUserScrolled() {
16621
+ this.userScrolled = true;
16622
+ }
16623
+ keepFocusVisible(event) {
16624
+ if (this.mode() !== "nav" || !(event.target instanceof Node)) return;
16625
+ const target = event.target;
16626
+ const element = this.tabs().map((tab) => tab.element()).find((el) => el?.contains(target));
16627
+ if (!element) return;
16628
+ const strip = this.strip().nativeElement;
16629
+ const left = focusScrollLeft(strip.scrollLeft, element.getBoundingClientRect(), strip.getBoundingClientRect());
16630
+ if (left !== null) strip.scrollTo({
16631
+ left,
16632
+ behavior: scrollBehavior(prefersReducedMotion(), true)
16633
+ });
16634
+ }
16635
+ observeLayout(tabs) {
16636
+ const observer = this.observer;
16637
+ if (!observer) return;
16638
+ observer.disconnect();
16639
+ observer.observe(this.strip().nativeElement);
16640
+ for (const tab of tabs) {
16641
+ const element = tab.element();
16642
+ if (element) observer.observe(element);
16643
+ }
16644
+ }
16645
+ settleLayout() {
16646
+ const { clientWidth, scrollWidth } = this.strip().nativeElement;
16647
+ const next = {
16648
+ clientWidth,
16649
+ scrollWidth
16650
+ };
16651
+ if (shouldReveal(this.geometry, next, this.userScrolled)) this.revealActive(false);
16652
+ this.geometry = next;
16653
+ this.updateFade();
16654
+ }
16655
+ revealActive(animate) {
16656
+ const active = this.activeTab();
16657
+ if (this.mode() === "nav" && active) this.scrollToActive(active, animate);
16658
+ this.updateFade();
16659
+ }
16660
+ scrollToActive(tab, animate) {
16661
+ const element = tab.element();
16662
+ if (!element) return;
16663
+ const strip = this.strip().nativeElement;
16664
+ const left = centeredScrollLeft(strip.scrollLeft, element.getBoundingClientRect(), strip.getBoundingClientRect());
16665
+ strip.scrollTo({
16666
+ left,
16667
+ behavior: scrollBehavior(prefersReducedMotion(), animate)
16668
+ });
16557
16669
  }
16558
16670
  isFocusable(tab) {
16559
16671
  const reachable = this.tabs().filter((t) => !t.disabled());
@@ -16621,9 +16733,16 @@ var TabsComponent = class TabsComponent {
16621
16733
  descendants: true,
16622
16734
  isSignal: true
16623
16735
  }],
16736
+ viewQueries: [{
16737
+ propertyName: "strip",
16738
+ first: true,
16739
+ predicate: ["strip"],
16740
+ descendants: true,
16741
+ isSignal: true
16742
+ }],
16624
16743
  ngImport: i0,
16625
- template: "<div class=\"flr-tabs\" [attr.role]=\"role()\" [attr.aria-label]=\"ariaLabel()\">\n <ng-content />\n</div>\n",
16626
- styles: [":host{display:block}.flr-tabs{display:flex;align-items:flex-end;gap:4px;box-shadow:inset 0 -1px 0 var(--color-rule, rgba(30, 41, 59, .14));overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}\n"],
16744
+ template: "<div\n #strip\n class=\"flr-tabs\"\n [class.flr-tabs--nav]=\"mode() === 'nav'\"\n [class.flr-tabs--fade-start]=\"fadeStart()\"\n [class.flr-tabs--fade-end]=\"fadeEnd()\"\n [attr.role]=\"role()\"\n [attr.aria-label]=\"ariaLabel()\"\n (scroll)=\"updateFade()\"\n (wheel)=\"markUserScrolled()\"\n (touchstart)=\"markUserScrolled()\"\n (pointerdown)=\"markUserScrolled()\"\n (focusin)=\"keepFocusVisible($event)\"\n>\n <ng-content />\n</div>\n",
16745
+ styles: [":host{display:block;box-shadow:inset 0 -1px 0 var(--color-rule, rgba(30, 41, 59, .14))}.flr-tabs{display:flex;align-items:flex-end;gap:4px;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}.flr-tabs--nav{scroll-snap-type:x proximity;scroll-padding-inline:24px;--fade-start: 0px;--fade-end: 0px;-webkit-mask-image:linear-gradient(to right,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent);mask-image:linear-gradient(to right,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent)}.flr-tabs--nav:dir(rtl){-webkit-mask-image:linear-gradient(to left,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent);mask-image:linear-gradient(to left,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent)}.flr-tabs--nav.flr-tabs--fade-start{--fade-start: 24px}.flr-tabs--nav.flr-tabs--fade-end{--fade-end: 24px}\n"],
16627
16746
  changeDetection: i0.ChangeDetectionStrategy.OnPush
16628
16747
  });
16629
16748
  }
@@ -16642,10 +16761,11 @@ i0.ɵɵngDeclareClassMetadata({
16642
16761
  provide: TABS_STRIP,
16643
16762
  useExisting: forwardRef(() => TabsComponent)
16644
16763
  }],
16645
- template: "<div class=\"flr-tabs\" [attr.role]=\"role()\" [attr.aria-label]=\"ariaLabel()\">\n <ng-content />\n</div>\n",
16646
- styles: [":host{display:block}.flr-tabs{display:flex;align-items:flex-end;gap:4px;box-shadow:inset 0 -1px 0 var(--color-rule, rgba(30, 41, 59, .14));overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}\n"]
16764
+ template: "<div\n #strip\n class=\"flr-tabs\"\n [class.flr-tabs--nav]=\"mode() === 'nav'\"\n [class.flr-tabs--fade-start]=\"fadeStart()\"\n [class.flr-tabs--fade-end]=\"fadeEnd()\"\n [attr.role]=\"role()\"\n [attr.aria-label]=\"ariaLabel()\"\n (scroll)=\"updateFade()\"\n (wheel)=\"markUserScrolled()\"\n (touchstart)=\"markUserScrolled()\"\n (pointerdown)=\"markUserScrolled()\"\n (focusin)=\"keepFocusVisible($event)\"\n>\n <ng-content />\n</div>\n",
16765
+ styles: [":host{display:block;box-shadow:inset 0 -1px 0 var(--color-rule, rgba(30, 41, 59, .14))}.flr-tabs{display:flex;align-items:flex-end;gap:4px;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}.flr-tabs--nav{scroll-snap-type:x proximity;scroll-padding-inline:24px;--fade-start: 0px;--fade-end: 0px;-webkit-mask-image:linear-gradient(to right,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent);mask-image:linear-gradient(to right,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent)}.flr-tabs--nav:dir(rtl){-webkit-mask-image:linear-gradient(to left,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent);mask-image:linear-gradient(to left,transparent,#000 var(--fade-start),#000 calc(100% - var(--fade-end)),transparent)}.flr-tabs--nav.flr-tabs--fade-start{--fade-start: 24px}.flr-tabs--nav.flr-tabs--fade-end{--fade-end: 24px}\n"]
16647
16766
  }]
16648
16767
  }],
16768
+ ctorParameters: () => [],
16649
16769
  propDecorators: {
16650
16770
  mode: [{
16651
16771
  type: i0.Input,
@@ -16669,9 +16789,16 @@ i0.ɵɵngDeclareClassMetadata({
16669
16789
  descendants: true,
16670
16790
  isSignal: true
16671
16791
  }]
16792
+ }],
16793
+ strip: [{
16794
+ type: i0.ViewChild,
16795
+ args: ["strip", { isSignal: true }]
16672
16796
  }]
16673
16797
  }
16674
16798
  });
16799
+ function prefersReducedMotion() {
16800
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
16801
+ }
16675
16802
  const CONTACT_PRODUCTS = [
16676
16803
  {
16677
16804
  value: "ferrlabs",