@getflip/swirl-components 0.289.0 → 0.290.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.
package/components.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2025-02-05T12:09:19",
2
+ "timestamp": "2025-02-06T13:05:01",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.18.1",
@@ -37,6 +37,13 @@ const SwirlTabBar = class {
37
37
  this.tabs = [];
38
38
  this.variant = "default";
39
39
  }
40
+ onTabFocus(event) {
41
+ event.target.scrollIntoView({
42
+ behavior: "smooth",
43
+ block: "nearest",
44
+ inline: "center",
45
+ });
46
+ }
40
47
  focusAdjacentTab(previous) {
41
48
  const tabs = this.getTabs();
42
49
  const selectedTabIndex = tabs.findIndex((tab) => tab.ariaSelected === "true");
@@ -65,7 +72,7 @@ const SwirlTabBar = class {
65
72
  ? `var(--s-space-${this.paddingBlockStart})`
66
73
  : undefined,
67
74
  };
68
- return (index.h(index.Host, { key: 'deb50eba4e47565ae6338a5af43b7a0a1054e6b1' }, index.h("div", { key: '75cc9b8e1ffbe76ff00165fb3428799fcd7ea2ac', "aria-label": this.label, class: className, onKeyDown: this.onKeyDown, role: this.disableTabSemantics ? undefined : "tablist", style: styles }, this.tabs.map((tab) => {
75
+ return (index.h(index.Host, { key: 'f5ebe5a9d614fa2b59dac17e08e90aba4a3c4a60' }, index.h("div", { key: '8bf90f073348f34fe7293e837e70fe8ea09220ce', "aria-label": this.label, class: className, onKeyDown: this.onKeyDown, role: this.disableTabSemantics ? undefined : "tablist", style: styles }, this.tabs.map((tab) => {
69
76
  const className = index$1.classnames("tab-bar__tab", {
70
77
  "tab-bar__tab--active": tab.active,
71
78
  "tab-bar__tab--variant-pill": this.variant === "pill",
@@ -80,7 +87,7 @@ const SwirlTabBar = class {
80
87
  ? "true"
81
88
  : "false", class: className, id: `tab-${tab.id}`, key: tab.id,
82
89
  // eslint-disable-next-line react/jsx-no-bind
83
- onClick: () => this.activateTab.emit(tab.id), role: this.disableTabSemantics ? undefined : "tab", tabIndex: this.disableTabSemantics ? undefined : tab.active ? 0 : -1, type: "button" }, tab.icon && (index.h("span", { class: "tab-bar__tab-icon", innerHTML: tab.icon })), index.h("span", { class: labelClassName }, tab.label)));
90
+ onClick: () => this.activateTab.emit(tab.id), onFocus: this.onTabFocus, role: this.disableTabSemantics ? undefined : "tab", tabIndex: this.disableTabSemantics ? undefined : tab.active ? 0 : -1, type: "button" }, tab.icon && (index.h("span", { class: "tab-bar__tab-icon", innerHTML: tab.icon })), index.h("span", { class: labelClassName }, tab.label)));
84
91
  }))));
85
92
  }
86
93
  get el() { return index.getElement(this); }
@@ -25,6 +25,13 @@ export class SwirlTabBar {
25
25
  this.tabs = [];
26
26
  this.variant = "default";
27
27
  }
28
+ onTabFocus(event) {
29
+ event.target.scrollIntoView({
30
+ behavior: "smooth",
31
+ block: "nearest",
32
+ inline: "center",
33
+ });
34
+ }
28
35
  focusAdjacentTab(previous) {
29
36
  const tabs = this.getTabs();
30
37
  const selectedTabIndex = tabs.findIndex((tab) => tab.ariaSelected === "true");
@@ -53,7 +60,7 @@ export class SwirlTabBar {
53
60
  ? `var(--s-space-${this.paddingBlockStart})`
54
61
  : undefined,
55
62
  };
56
- return (h(Host, { key: 'deb50eba4e47565ae6338a5af43b7a0a1054e6b1' }, h("div", { key: '75cc9b8e1ffbe76ff00165fb3428799fcd7ea2ac', "aria-label": this.label, class: className, onKeyDown: this.onKeyDown, role: this.disableTabSemantics ? undefined : "tablist", style: styles }, this.tabs.map((tab) => {
63
+ return (h(Host, { key: 'f5ebe5a9d614fa2b59dac17e08e90aba4a3c4a60' }, h("div", { key: '8bf90f073348f34fe7293e837e70fe8ea09220ce', "aria-label": this.label, class: className, onKeyDown: this.onKeyDown, role: this.disableTabSemantics ? undefined : "tablist", style: styles }, this.tabs.map((tab) => {
57
64
  const className = classnames("tab-bar__tab", {
58
65
  "tab-bar__tab--active": tab.active,
59
66
  "tab-bar__tab--variant-pill": this.variant === "pill",
@@ -68,7 +75,7 @@ export class SwirlTabBar {
68
75
  ? "true"
69
76
  : "false", class: className, id: `tab-${tab.id}`, key: tab.id,
70
77
  // eslint-disable-next-line react/jsx-no-bind
71
- onClick: () => this.activateTab.emit(tab.id), role: this.disableTabSemantics ? undefined : "tab", tabIndex: this.disableTabSemantics ? undefined : tab.active ? 0 : -1, type: "button" }, tab.icon && (h("span", { class: "tab-bar__tab-icon", innerHTML: tab.icon })), h("span", { class: labelClassName }, tab.label)));
78
+ onClick: () => this.activateTab.emit(tab.id), onFocus: this.onTabFocus, role: this.disableTabSemantics ? undefined : "tab", tabIndex: this.disableTabSemantics ? undefined : tab.active ? 0 : -1, type: "button" }, tab.icon && (h("span", { class: "tab-bar__tab-icon", innerHTML: tab.icon })), h("span", { class: labelClassName }, tab.label)));
72
79
  }))));
73
80
  }
74
81
  static get is() { return "swirl-tab-bar"; }