@getflip/swirl-components 0.40.1 → 0.42.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 +203 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-pagination.cjs.entry.js +14 -2
- package/dist/cjs/swirl-tab-bar.cjs.entry.js +47 -0
- package/dist/cjs/swirl-tabs.cjs.entry.js +20 -20
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/swirl-pagination/swirl-pagination.css +52 -0
- package/dist/collection/components/swirl-pagination/swirl-pagination.js +96 -1
- package/dist/collection/components/swirl-tab-bar/swirl-tab-bar.css +86 -0
- package/dist/collection/components/swirl-tab-bar/swirl-tab-bar.js +152 -0
- package/dist/collection/components/swirl-tab-bar/swirl-tab-bar.stories.js +35 -0
- package/dist/collection/components/swirl-tabs/swirl-tabs.css +0 -79
- package/dist/collection/components/swirl-tabs/swirl-tabs.js +21 -20
- package/dist/components/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/components/swirl-pagination.js +38 -4
- package/dist/components/swirl-tab-bar.d.ts +11 -0
- package/dist/components/swirl-tab-bar.js +6 -0
- package/dist/components/swirl-tab-bar2.js +62 -0
- package/dist/components/swirl-tabs.js +28 -21
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-pagination.entry.js +14 -2
- package/dist/esm/swirl-tab-bar.entry.js +43 -0
- package/dist/esm/swirl-tabs.entry.js +20 -20
- package/dist/swirl-components/p-42d9aace.entry.js +1 -0
- package/dist/swirl-components/p-da4c54e0.entry.js +1 -0
- package/dist/swirl-components/p-f50fcc4d.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-pagination/swirl-pagination.d.ts +6 -0
- package/dist/types/components/swirl-tab-bar/swirl-tab-bar.d.ts +16 -0
- package/dist/types/components/swirl-tab-bar/swirl-tab-bar.stories.d.ts +13 -0
- package/dist/types/components/swirl-tabs/swirl-tabs.d.ts +6 -1
- package/dist/types/components.d.ts +37 -0
- package/package.json +1 -1
- package/vscode-data.json +29 -0
- package/dist/swirl-components/p-3c2325ba.entry.js +0 -1
- package/dist/swirl-components/p-9ef30977.entry.js +0 -1
|
@@ -9,13 +9,19 @@ export declare class SwirlPagination {
|
|
|
9
9
|
pageLabel?: string;
|
|
10
10
|
pages: number;
|
|
11
11
|
pageSelectLabel?: string;
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
pageSizeOptions?: number[];
|
|
14
|
+
pageSizeSelectLabel?: string;
|
|
12
15
|
prevButtonLabel?: string;
|
|
16
|
+
showPageSizeSelect?: boolean;
|
|
13
17
|
variant?: SwirlPaginationVariant;
|
|
14
18
|
setPage: EventEmitter<number>;
|
|
19
|
+
setPageSize: EventEmitter<number>;
|
|
15
20
|
private onFirstPageButtonClick;
|
|
16
21
|
private onLastPageButtonClick;
|
|
17
22
|
private onPrevButtonClick;
|
|
18
23
|
private onNextButtonClick;
|
|
19
24
|
private onSelect;
|
|
25
|
+
private onPageSizeSelect;
|
|
20
26
|
render(): any;
|
|
21
27
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EventEmitter } from "../../stencil-public-runtime";
|
|
2
|
+
export type SwirlTabBarTab = {
|
|
3
|
+
active?: boolean;
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
};
|
|
7
|
+
export declare class SwirlTabBar {
|
|
8
|
+
disableTabSemantics?: boolean;
|
|
9
|
+
label: string;
|
|
10
|
+
tabs: SwirlTabBarTab[];
|
|
11
|
+
activateNextTab: EventEmitter<void>;
|
|
12
|
+
activatePreviousTab: EventEmitter<void>;
|
|
13
|
+
activateTab: EventEmitter<string>;
|
|
14
|
+
private onKeyDown;
|
|
15
|
+
render(): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="mdx" />
|
|
2
|
+
import Docs from "./swirl-tab-bar.mdx";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
component: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
page: typeof Docs;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
title: string;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
export declare const SwirlTabBar: any;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { EventEmitter } from "../../stencil-public-runtime";
|
|
2
|
+
import { SwirlTabBarTab } from "../swirl-tab-bar/swirl-tab-bar";
|
|
2
3
|
export declare class SwirlTabs {
|
|
3
4
|
el: HTMLElement;
|
|
4
5
|
initialTab?: string;
|
|
5
6
|
label: string;
|
|
6
7
|
activeTab?: string;
|
|
8
|
+
tabBarTabs: SwirlTabBarTab[];
|
|
7
9
|
tabActivated: EventEmitter<HTMLSwirlTabElement>;
|
|
8
10
|
private tabs;
|
|
9
11
|
componentWillLoad(): void;
|
|
@@ -15,6 +17,9 @@ export declare class SwirlTabs {
|
|
|
15
17
|
private activateNextTab;
|
|
16
18
|
private activatePreviousTab;
|
|
17
19
|
private collectTabs;
|
|
18
|
-
private
|
|
20
|
+
private updateTabBarTabs;
|
|
21
|
+
private onActivateNextTab;
|
|
22
|
+
private onActivatePreviousTab;
|
|
23
|
+
private onActivateTab;
|
|
19
24
|
render(): any;
|
|
20
25
|
}
|
|
@@ -44,6 +44,7 @@ import { SwirlSkeletonTextSize } from "./components/swirl-skeleton-text/swirl-sk
|
|
|
44
44
|
import { SwirlSpinnerSize } from "./components/swirl-spinner/swirl-spinner";
|
|
45
45
|
import { SwirlStackAlign, SwirlStackJustify, SwirlStackOrientation, SwirlStackSpacing } from "./components/swirl-stack/swirl-stack";
|
|
46
46
|
import { SwirlSwitchSize } from "./components/swirl-switch/swirl-switch";
|
|
47
|
+
import { SwirlTabBarTab } from "./components/swirl-tab-bar/swirl-tab-bar";
|
|
47
48
|
import { SwirlTableColumnSort } from "./components/swirl-table-column/swirl-table-column";
|
|
48
49
|
import { SwirlTagIntent } from "./components/swirl-tag/swirl-tag";
|
|
49
50
|
import { SwirlTextAlign, SwirlTextColor, SwirlTextFontStyle, SwirlTextSize, SwirlTextWeight } from "./components/swirl-text/swirl-text";
|
|
@@ -92,6 +93,7 @@ export { SwirlSkeletonTextSize } from "./components/swirl-skeleton-text/swirl-sk
|
|
|
92
93
|
export { SwirlSpinnerSize } from "./components/swirl-spinner/swirl-spinner";
|
|
93
94
|
export { SwirlStackAlign, SwirlStackJustify, SwirlStackOrientation, SwirlStackSpacing } from "./components/swirl-stack/swirl-stack";
|
|
94
95
|
export { SwirlSwitchSize } from "./components/swirl-switch/swirl-switch";
|
|
96
|
+
export { SwirlTabBarTab } from "./components/swirl-tab-bar/swirl-tab-bar";
|
|
95
97
|
export { SwirlTableColumnSort } from "./components/swirl-table-column/swirl-table-column";
|
|
96
98
|
export { SwirlTagIntent } from "./components/swirl-tag/swirl-tag";
|
|
97
99
|
export { SwirlTextAlign, SwirlTextColor, SwirlTextFontStyle, SwirlTextSize, SwirlTextWeight } from "./components/swirl-text/swirl-text";
|
|
@@ -905,8 +907,12 @@ export namespace Components {
|
|
|
905
907
|
"page": number;
|
|
906
908
|
"pageLabel"?: string;
|
|
907
909
|
"pageSelectLabel"?: string;
|
|
910
|
+
"pageSize"?: number;
|
|
911
|
+
"pageSizeOptions"?: number[];
|
|
912
|
+
"pageSizeSelectLabel"?: string;
|
|
908
913
|
"pages": number;
|
|
909
914
|
"prevButtonLabel"?: string;
|
|
915
|
+
"showPageSizeSelect"?: boolean;
|
|
910
916
|
"variant"?: SwirlPaginationVariant;
|
|
911
917
|
}
|
|
912
918
|
interface SwirlPdfReader {
|
|
@@ -1081,6 +1087,11 @@ export namespace Components {
|
|
|
1081
1087
|
"label": string;
|
|
1082
1088
|
"tabId": string;
|
|
1083
1089
|
}
|
|
1090
|
+
interface SwirlTabBar {
|
|
1091
|
+
"disableTabSemantics"?: boolean;
|
|
1092
|
+
"label": string;
|
|
1093
|
+
"tabs": SwirlTabBarTab[];
|
|
1094
|
+
}
|
|
1084
1095
|
interface SwirlTable {
|
|
1085
1096
|
"caption"?: string;
|
|
1086
1097
|
"emptyStateLabel"?: string;
|
|
@@ -1359,6 +1370,10 @@ export interface SwirlSwitchCustomEvent<T> extends CustomEvent<T> {
|
|
|
1359
1370
|
detail: T;
|
|
1360
1371
|
target: HTMLSwirlSwitchElement;
|
|
1361
1372
|
}
|
|
1373
|
+
export interface SwirlTabBarCustomEvent<T> extends CustomEvent<T> {
|
|
1374
|
+
detail: T;
|
|
1375
|
+
target: HTMLSwirlTabBarElement;
|
|
1376
|
+
}
|
|
1362
1377
|
export interface SwirlTabsCustomEvent<T> extends CustomEvent<T> {
|
|
1363
1378
|
detail: T;
|
|
1364
1379
|
target: HTMLSwirlTabsElement;
|
|
@@ -2404,6 +2419,12 @@ declare global {
|
|
|
2404
2419
|
prototype: HTMLSwirlTabElement;
|
|
2405
2420
|
new (): HTMLSwirlTabElement;
|
|
2406
2421
|
};
|
|
2422
|
+
interface HTMLSwirlTabBarElement extends Components.SwirlTabBar, HTMLStencilElement {
|
|
2423
|
+
}
|
|
2424
|
+
var HTMLSwirlTabBarElement: {
|
|
2425
|
+
prototype: HTMLSwirlTabBarElement;
|
|
2426
|
+
new (): HTMLSwirlTabBarElement;
|
|
2427
|
+
};
|
|
2407
2428
|
interface HTMLSwirlTableElement extends Components.SwirlTable, HTMLStencilElement {
|
|
2408
2429
|
}
|
|
2409
2430
|
var HTMLSwirlTableElement: {
|
|
@@ -2676,6 +2697,7 @@ declare global {
|
|
|
2676
2697
|
"swirl-stack": HTMLSwirlStackElement;
|
|
2677
2698
|
"swirl-switch": HTMLSwirlSwitchElement;
|
|
2678
2699
|
"swirl-tab": HTMLSwirlTabElement;
|
|
2700
|
+
"swirl-tab-bar": HTMLSwirlTabBarElement;
|
|
2679
2701
|
"swirl-table": HTMLSwirlTableElement;
|
|
2680
2702
|
"swirl-table-cell": HTMLSwirlTableCellElement;
|
|
2681
2703
|
"swirl-table-column": HTMLSwirlTableColumnElement;
|
|
@@ -3433,11 +3455,16 @@ declare namespace LocalJSX {
|
|
|
3433
3455
|
"lastPageButtonLabel"?: string;
|
|
3434
3456
|
"nextButtonLabel"?: string;
|
|
3435
3457
|
"onSetPage"?: (event: SwirlPaginationCustomEvent<number>) => void;
|
|
3458
|
+
"onSetPageSize"?: (event: SwirlPaginationCustomEvent<number>) => void;
|
|
3436
3459
|
"page": number;
|
|
3437
3460
|
"pageLabel"?: string;
|
|
3438
3461
|
"pageSelectLabel"?: string;
|
|
3462
|
+
"pageSize"?: number;
|
|
3463
|
+
"pageSizeOptions"?: number[];
|
|
3464
|
+
"pageSizeSelectLabel"?: string;
|
|
3439
3465
|
"pages": number;
|
|
3440
3466
|
"prevButtonLabel"?: string;
|
|
3467
|
+
"showPageSizeSelect"?: boolean;
|
|
3441
3468
|
"variant"?: SwirlPaginationVariant;
|
|
3442
3469
|
}
|
|
3443
3470
|
interface SwirlPdfReader {
|
|
@@ -3597,6 +3624,14 @@ declare namespace LocalJSX {
|
|
|
3597
3624
|
"label": string;
|
|
3598
3625
|
"tabId": string;
|
|
3599
3626
|
}
|
|
3627
|
+
interface SwirlTabBar {
|
|
3628
|
+
"disableTabSemantics"?: boolean;
|
|
3629
|
+
"label": string;
|
|
3630
|
+
"onActivateNextTab"?: (event: SwirlTabBarCustomEvent<void>) => void;
|
|
3631
|
+
"onActivatePreviousTab"?: (event: SwirlTabBarCustomEvent<void>) => void;
|
|
3632
|
+
"onActivateTab"?: (event: SwirlTabBarCustomEvent<string>) => void;
|
|
3633
|
+
"tabs"?: SwirlTabBarTab[];
|
|
3634
|
+
}
|
|
3600
3635
|
interface SwirlTable {
|
|
3601
3636
|
"caption"?: string;
|
|
3602
3637
|
"emptyStateLabel"?: string;
|
|
@@ -3890,6 +3925,7 @@ declare namespace LocalJSX {
|
|
|
3890
3925
|
"swirl-stack": SwirlStack;
|
|
3891
3926
|
"swirl-switch": SwirlSwitch;
|
|
3892
3927
|
"swirl-tab": SwirlTab;
|
|
3928
|
+
"swirl-tab-bar": SwirlTabBar;
|
|
3893
3929
|
"swirl-table": SwirlTable;
|
|
3894
3930
|
"swirl-table-cell": SwirlTableCell;
|
|
3895
3931
|
"swirl-table-column": SwirlTableColumn;
|
|
@@ -4092,6 +4128,7 @@ declare module "@stencil/core" {
|
|
|
4092
4128
|
"swirl-stack": LocalJSX.SwirlStack & JSXBase.HTMLAttributes<HTMLSwirlStackElement>;
|
|
4093
4129
|
"swirl-switch": LocalJSX.SwirlSwitch & JSXBase.HTMLAttributes<HTMLSwirlSwitchElement>;
|
|
4094
4130
|
"swirl-tab": LocalJSX.SwirlTab & JSXBase.HTMLAttributes<HTMLSwirlTabElement>;
|
|
4131
|
+
"swirl-tab-bar": LocalJSX.SwirlTabBar & JSXBase.HTMLAttributes<HTMLSwirlTabBarElement>;
|
|
4095
4132
|
"swirl-table": LocalJSX.SwirlTable & JSXBase.HTMLAttributes<HTMLSwirlTableElement>;
|
|
4096
4133
|
"swirl-table-cell": LocalJSX.SwirlTableCell & JSXBase.HTMLAttributes<HTMLSwirlTableCellElement>;
|
|
4097
4134
|
"swirl-table-column": LocalJSX.SwirlTableColumn & JSXBase.HTMLAttributes<HTMLSwirlTableColumnElement>;
|
package/package.json
CHANGED
package/vscode-data.json
CHANGED
|
@@ -3633,6 +3633,14 @@
|
|
|
3633
3633
|
"name": "page-select-label",
|
|
3634
3634
|
"description": ""
|
|
3635
3635
|
},
|
|
3636
|
+
{
|
|
3637
|
+
"name": "page-size",
|
|
3638
|
+
"description": ""
|
|
3639
|
+
},
|
|
3640
|
+
{
|
|
3641
|
+
"name": "page-size-select-label",
|
|
3642
|
+
"description": ""
|
|
3643
|
+
},
|
|
3636
3644
|
{
|
|
3637
3645
|
"name": "pages",
|
|
3638
3646
|
"description": ""
|
|
@@ -3641,6 +3649,10 @@
|
|
|
3641
3649
|
"name": "prev-button-label",
|
|
3642
3650
|
"description": ""
|
|
3643
3651
|
},
|
|
3652
|
+
{
|
|
3653
|
+
"name": "show-page-size-select",
|
|
3654
|
+
"description": ""
|
|
3655
|
+
},
|
|
3644
3656
|
{
|
|
3645
3657
|
"name": "variant",
|
|
3646
3658
|
"description": "",
|
|
@@ -4482,6 +4494,23 @@
|
|
|
4482
4494
|
}
|
|
4483
4495
|
]
|
|
4484
4496
|
},
|
|
4497
|
+
{
|
|
4498
|
+
"name": "swirl-tab-bar",
|
|
4499
|
+
"description": {
|
|
4500
|
+
"kind": "markdown",
|
|
4501
|
+
"value": ""
|
|
4502
|
+
},
|
|
4503
|
+
"attributes": [
|
|
4504
|
+
{
|
|
4505
|
+
"name": "disable-tab-semantics",
|
|
4506
|
+
"description": ""
|
|
4507
|
+
},
|
|
4508
|
+
{
|
|
4509
|
+
"name": "label",
|
|
4510
|
+
"description": ""
|
|
4511
|
+
}
|
|
4512
|
+
]
|
|
4513
|
+
},
|
|
4485
4514
|
{
|
|
4486
4515
|
"name": "swirl-table",
|
|
4487
4516
|
"description": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,c as t,h as a,H as s}from"./p-05c15d47.js";import{c as n}from"./p-b7898321.js";const e=class{constructor(a){i(this,a),this.setPage=t(this,"setPage",7),this.onFirstPageButtonClick=()=>{1!==this.page&&this.setPage.emit(1)},this.onLastPageButtonClick=()=>{this.page!==this.pages&&this.setPage.emit(this.pages)},this.onPrevButtonClick=()=>{const i=Math.max(this.page-1,1);this.page!==i&&this.setPage.emit(i)},this.onNextButtonClick=()=>{const i=Math.min(this.page+1,this.pages);this.page!==i&&this.setPage.emit(i)},this.onSelect=i=>{const t=+i.target.value;this.page!==t&&this.setPage.emit(t)},this.firstPageButtonLabel="First page",this.lastPageButtonLabel="Last page",this.label=void 0,this.nextButtonLabel="Next page",this.page=void 0,this.pageLabel="out of",this.pages=void 0,this.pageSelectLabel="Select a page",this.prevButtonLabel="Previous page",this.variant="default"}render(){const i="simple"!==this.variant,t="advanced"===this.variant,e=`${this.page} ${this.pageLabel} ${this.pages}`,o=n("pagination",`pagination--variant-${this.variant}`);return a(s,null,a("nav",{"aria-label":this.label,class:o},a("ul",{class:"pagination__list",part:"pagination__list"},a("li",{class:"pagination__list-item"},a("swirl-button",{class:"pagination__first-page-button",disabled:this.page<=1,hideLabel:!0,icon:"<swirl-icon-double-arrow-left></swirl-icon-double-arrow-left>",intent:"primary",label:this.firstPageButtonLabel,onClick:this.onFirstPageButtonClick})),a("li",{class:"pagination__list-item"},a("swirl-button",{class:"pagination__prev-button",disabled:this.page<=1,hideLabel:!0,icon:"<swirl-icon-chevron-left></swirl-icon-chevron-left>",intent:"primary",label:this.prevButtonLabel,onClick:this.onPrevButtonClick})),i?a("li",{class:"pagination__list-item pagination__page-label"},a("span",null,t?a("span",{"aria-current":"page",class:"pagination__advanced-label"},a("span",{class:"pagination__page-select-container"},a("select",{"aria-label":this.pageSelectLabel,class:"pagination__page-select",onChange:this.onSelect},new Array(this.pages).fill(void 0).map(((i,t)=>t+1)).map((i=>a("option",{selected:this.page===i,value:String(i)},i))))),a("span",{"aria-hidden":"true"},this.pageLabel," ",this.pages)):a("span",{"aria-current":"page"},e))):a("li",{class:"pagination__list-item"},a("swirl-visually-hidden",null,a("span",{"aria-current":"page"},e))),a("li",{class:"pagination__list-item"},a("swirl-button",{class:"pagination__next-button",disabled:this.page>=this.pages,hideLabel:!0,icon:"<swirl-icon-chevron-right></swirl-icon-chevron-right>",iconPosition:"end",intent:"primary",label:this.nextButtonLabel,onClick:this.onNextButtonClick})),a("li",{class:"pagination__list-item"},a("swirl-button",{class:"pagination__last-page-button",disabled:this.page>=this.pages,hideLabel:!0,icon:"<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>",intent:"primary",label:this.lastPageButtonLabel,onClick:this.onLastPageButtonClick})))))}};e.style=":host{display:block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}:host *{box-sizing:border-box}.pagination{display:block;width:100%}.pagination--variant-simple .pagination__list{gap:0}.pagination__list{display:flex;margin:0;padding:0;justify-content:flex-start;align-items:center;line-height:var(--s-line-height-base);list-style:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__list{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.pagination__page-label{padding-right:var(--s-space-8);padding-left:var(--s-space-8)}.pagination__advanced-label{display:flex;align-items:center;white-space:nowrap;gap:var(--s-space-8)}.pagination__page-select-container{position:relative}.pagination__page-select{display:inline-flex;padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);border:none;border-radius:var(--s-border-radius-sm);background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:center;cursor:pointer;box-shadow:inset 0 0 0 var(--s-border-width-default) var(--s-border-strong);-webkit-appearance:none;-moz-appearance:none;appearance:none}.pagination__page-select:focus:not(:focus-visible){outline:none}.pagination__page-select:focus-visible{outline-color:var(--s-focus-default)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.pagination__page-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}";export{e as swirl_pagination}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as a,H as i,g as r}from"./p-05c15d47.js";import{c as e}from"./p-b7898321.js";const o=class{constructor(a){t(this,a),this.tabActivated=s(this,"tabActivated",7),this.tabs=[],this.onKeyDown=t=>{"ArrowLeft"===t.code?(t.preventDefault(),this.activatePreviousTab()):"ArrowRight"===t.code&&(t.preventDefault(),this.activateNextTab())},this.initialTab=void 0,this.label=void 0,this.activeTab=void 0}componentWillLoad(){this.collectTabs()}async activateTab(t){if(this.activeTab===t)return;this.activeTab=t,this.tabs.forEach((t=>t.active=!1));const s=this.tabs.find((s=>s.tabId===t));Boolean(s)&&(s.active=!0,this.tabActivated.emit(s))}activateNextTab(){const t=this.tabs.findIndex((t=>t.tabId===this.activeTab)),s=Math.min(this.tabs.length-1,t+1);this.activateTab(this.tabs[s].tabId),requestAnimationFrame((()=>{var t;null===(t=this.el.querySelector(".tabs__tab--active"))||void 0===t||t.focus()}))}activatePreviousTab(){const t=this.tabs.findIndex((t=>t.tabId===this.activeTab)),s=Math.max(0,t-1);this.activateTab(this.tabs[s].tabId),requestAnimationFrame((()=>{var t;null===(t=this.el.querySelector(".tabs__tab--active"))||void 0===t||t.focus()}))}collectTabs(){if(this.tabs=Array.from(this.el.querySelectorAll("swirl-tab")),0===this.tabs.length)return;const t=this.tabs.find((t=>t.tabId===this.initialTab));this.activateTab(Boolean(t)?t.tabId:this.tabs[0].tabId)}render(){return a(i,null,a("div",{class:"tabs"},a("div",{"aria-label":this.label,class:"tabs__tab-bar",onKeyDown:this.onKeyDown,role:"tablist"},this.tabs.map((t=>{const s=t.tabId===this.activeTab,i=e("tabs__tab",{"tabs__tab--active":s});return a("button",{"aria-controls":t.tabId,"aria-selected":s?"true":"false",class:i,id:`tab-${t.tabId}`,key:t.tabId,onClick:()=>this.activateTab(t.tabId),role:"tab",tabIndex:s?0:-1,type:"button"},a("span",{class:"tabs__tab-label"},t.label))}))),a("slot",null)))}get el(){return r(this)}};o.style='.sc-swirl-tabs-h{display:block;width:100%}.sc-swirl-tabs-h *.sc-swirl-tabs{box-sizing:border-box}.tabs.sc-swirl-tabs{width:100%}.tabs__tab-bar.sc-swirl-tabs{position:relative;display:flex;width:100%;justify-content:flex-start;border-bottom:var(--s-border-width-default) solid var(--s-border-default)}.tabs__tab.sc-swirl-tabs{position:relative;display:block;min-width:0;margin:0;padding:var(--s-space-4) var(--s-space-8);border:none;background-color:transparent;font:inherit;font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);cursor:pointer}.tabs__tab.sc-swirl-tabs:focus{outline:none}.tabs__tab.sc-swirl-tabs:focus-visible .tabs__tab-label.sc-swirl-tabs{border-radius:var(--s-border-radius-s);box-shadow:inset 0 0 0 0.125rem var(--s-focus-default)}.tabs__tab.sc-swirl-tabs:not(.tabs__tab--active):hover:after{position:absolute;bottom:0;left:50%;width:calc(100% - var(--s-space-8));height:0.1875rem;border-radius:0.125rem;background-color:var(--s-border-default);content:"";transform:translateX(-50%);pointer-events:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.tabs__tab.sc-swirl-tabs{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.tabs__tab-label.sc-swirl-tabs{display:block;overflow:hidden;width:100%;padding:var(--s-space-8) var(--s-space-8);text-align:center;white-space:nowrap;text-overflow:ellipsis}.tabs__tab--active.sc-swirl-tabs{color:var(--s-text-highlight)}.tabs__tab--active.sc-swirl-tabs:after{position:absolute;bottom:0;left:50%;width:calc(100% - var(--s-space-8));height:0.1875rem;border-radius:0.125rem;background-color:var(--s-border-highlight);content:"";transform:translateX(-50%);pointer-events:none}';export{o as swirl_tabs}
|