@xplortech/apollo-core 2.6.0 → 2.7.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/.typings/apollo-components.html-data.json +626 -35
- package/build/style.css +5949 -3070
- package/dist/apollo-core/apollo-core.css +29 -19
- package/dist/apollo-core/apollo-core.esm.js +1 -1
- package/dist/apollo-core/p-0bf50890.entry.js +1 -0
- package/dist/apollo-core/p-1947e7a8.entry.js +1 -0
- package/dist/apollo-core/p-27928cb0.entry.js +1 -0
- package/dist/apollo-core/{p-5549756c.entry.js → p-34438721.entry.js} +1 -1
- package/dist/apollo-core/p-35c2f72d.entry.js +1 -0
- package/dist/apollo-core/p-368c81f1.entry.js +1 -0
- package/dist/apollo-core/{p-f5af9539.entry.js → p-36ba29da.entry.js} +1 -1
- package/dist/apollo-core/p-406b27a8.entry.js +1 -0
- package/dist/apollo-core/p-5d63b4ce.entry.js +1 -0
- package/dist/apollo-core/{p-02167464.entry.js → p-6a15f1e0.entry.js} +1 -1
- package/dist/apollo-core/p-8d692d05.entry.js +1 -0
- package/dist/apollo-core/{p-C_Z2nG0p.js → p-C7bgJs6C.js} +2 -2
- package/dist/apollo-core/{p-42016063.entry.js → p-b61d7952.entry.js} +1 -1
- package/dist/apollo-core/{p-8a1affce.entry.js → p-ca127ee8.entry.js} +1 -1
- package/dist/apollo-core/p-d1c9c233.entry.js +1 -0
- package/dist/apollo-core/p-dc205893.entry.js +1 -0
- package/dist/apollo-core/p-e2a5d41c.entry.js +1 -0
- package/dist/cjs/apollo-core.cjs.js +3 -3
- package/dist/cjs/{index-DH6pgWru.js → index-BQ97-AWw.js} +18 -7
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/xpl-accordion.cjs.entry.js +3 -3
- package/dist/cjs/xpl-application-shell.cjs.entry.js +2 -2
- package/dist/cjs/{xpl-avatar_47.cjs.entry.js → xpl-avatar_54.cjs.entry.js} +3726 -536
- package/dist/cjs/xpl-button-row.cjs.entry.js +2 -2
- package/dist/cjs/xpl-calendar.cjs.entry.js +2 -2
- package/dist/cjs/xpl-dynamic-table-cell.cjs.entry.js +3 -3
- package/dist/cjs/xpl-dynamic-table-row.cjs.entry.js +3 -3
- package/dist/cjs/xpl-dynamic-table.cjs.entry.js +2 -2
- package/dist/cjs/xpl-grid-item.cjs.entry.js +2 -2
- package/dist/cjs/xpl-grid.cjs.entry.js +2 -2
- package/dist/cjs/xpl-large-card.cjs.entry.js +2 -2
- package/dist/cjs/xpl-main-nav.cjs.entry.js +2 -2
- package/dist/cjs/xpl-table-header-cell.cjs.entry.js +1 -1
- package/dist/cjs/xpl-table-header.cjs.entry.js +2 -2
- package/dist/cjs/xpl-toggle.cjs.entry.js +4 -4
- package/dist/cjs/xpl-toolbar.cjs.entry.js +3 -3
- package/dist/collection/collection-manifest.json +11 -5
- package/dist/collection/components/xpl-accordion/xpl-accordion.js +2 -2
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +1 -1
- package/dist/collection/components/xpl-avatar/avatar.stories.js +122 -107
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +249 -15
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +1 -1
- package/dist/collection/components/xpl-badge/badge.stories.js +1 -33
- package/dist/collection/components/xpl-badge/xpl-badge.js +1 -1
- package/dist/collection/components/xpl-banner/xpl-banner.js +4 -3
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js +1 -1
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +1 -1
- package/dist/collection/components/xpl-button/xpl-button.js +21 -3
- package/dist/collection/components/xpl-button-row/xpl-button-row.js +1 -1
- package/dist/collection/components/xpl-calendar/xpl-calendar.js +1 -1
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +25 -3
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +1 -1
- package/dist/collection/components/xpl-content-area/xpl-content-area.js +1 -1
- package/dist/collection/components/xpl-dashboard/xpl-dashboard.js +1 -1
- package/dist/collection/components/xpl-data-card/xpl-data-card.js +2 -2
- package/dist/collection/components/xpl-divider/xpl-divider.js +1 -1
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js +1 -1
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js +1 -1
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js +2 -2
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +77 -7
- package/dist/collection/components/xpl-dynamic-table/xpl-dynamic-table.js +1 -1
- package/dist/collection/components/xpl-dynamic-table-cell/xpl-dynamic-table-cell.js +2 -2
- package/dist/collection/components/xpl-dynamic-table-row/xpl-dynamic-table-row.js +2 -2
- package/dist/collection/components/xpl-grid/xpl-grid.js +1 -1
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +1 -1
- package/dist/collection/components/xpl-header-accordion/xpl-header-accordion.js +1 -1
- package/dist/collection/components/xpl-icon/xpl-icon.js +2 -2
- package/dist/collection/components/xpl-input/input.stories.js +96 -1
- package/dist/collection/components/xpl-input/xpl-input-color/xpl-input-color.js +8 -8
- package/dist/collection/components/xpl-input/xpl-input-date/xpl-input-date.js +3 -3
- package/dist/collection/components/xpl-input/xpl-input-file/xpl-input-file.js +4 -4
- package/dist/collection/components/xpl-input/xpl-input-phone/xpl-input-phone.js +5 -5
- package/dist/collection/components/xpl-input/xpl-input-search/xpl-input-search.js +485 -0
- package/dist/collection/components/xpl-input/xpl-input-time/xpl-input-time.js +2 -2
- package/dist/collection/components/xpl-input/xpl-input.js +130 -18
- package/dist/collection/components/xpl-large-card/xpl-large-card.js +1 -1
- package/dist/collection/components/xpl-list/list.stories.js +300 -63
- package/dist/collection/components/xpl-list/xpl-list-item/xpl-list-item.js +818 -0
- package/dist/collection/components/xpl-list/xpl-list.js +579 -21
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +1 -1
- package/dist/collection/components/xpl-modal/xpl-modal.js +1 -1
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +2 -2
- package/dist/collection/components/xpl-pagination/pagination.stories.js +18 -0
- package/dist/collection/components/xpl-pagination/xpl-pagination.js +7 -3
- package/dist/collection/components/xpl-panel/panel.stories.js +5 -3
- package/dist/collection/components/xpl-panel/xpl-panel.js +3 -3
- package/dist/collection/components/xpl-popover/xpl-popover.js +4 -4
- package/dist/collection/components/xpl-progress-bar/xpl-progress-bar.js +2 -2
- package/dist/collection/components/xpl-progress-indicator/progress-indicator.stories.js +118 -0
- package/dist/collection/components/xpl-progress-indicator/xpl-progress-indicator.js +171 -0
- package/dist/collection/components/xpl-radio/xpl-radio.js +3 -3
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +1 -1
- package/dist/collection/components/xpl-select/xpl-select.js +58 -6
- package/dist/collection/components/xpl-side-nav/xpl-side-nav-item/xpl-side-nav-item.js +2 -2
- package/dist/collection/components/xpl-side-nav/xpl-side-nav.js +2 -2
- package/dist/collection/components/xpl-skeleton/xpl-skeleton.js +1 -1
- package/dist/collection/components/xpl-slideout/xpl-slideout.js +1 -1
- package/dist/collection/components/xpl-spotlight/spotlight.stories.js +385 -0
- package/dist/collection/components/xpl-spotlight/xpl-spotlight.js +1085 -0
- package/dist/collection/components/xpl-tab/xpl-tab.js +261 -8
- package/dist/collection/components/xpl-tab-panel/xpl-tab-panel.js +22 -15
- package/dist/collection/components/xpl-table/xpl-table.js +5 -5
- package/dist/collection/components/xpl-table-header/xpl-table-header.js +1 -1
- package/dist/collection/components/xpl-tabs/segment-control.stories.js +31 -0
- package/dist/collection/components/xpl-tabs/tabs.shared.js +156 -0
- package/dist/collection/components/xpl-tabs/tabs.stories.js +10 -60
- package/dist/collection/components/xpl-tabs/xpl-tabs.js +338 -62
- package/dist/collection/components/xpl-tag/tag.stories.js +153 -0
- package/dist/collection/components/xpl-tag/xpl-tag.js +312 -9
- package/dist/collection/components/xpl-toast/xpl-toast.js +2 -2
- package/dist/collection/components/xpl-toggle/xpl-toggle.js +3 -3
- package/dist/collection/components/xpl-toolbar/xpl-toolbar.js +2 -2
- package/dist/collection/components/xpl-tooltip/xpl-tooltip.js +1 -1
- package/dist/collection/components/xpl-top-nav/top-nav.stories.js +625 -0
- package/dist/collection/components/xpl-top-nav/xpl-nav-header-menu/xpl-nav-header-menu.js +122 -0
- package/dist/collection/components/xpl-top-nav/xpl-top-nav-item/xpl-top-nav-item.js +481 -0
- package/dist/collection/components/xpl-top-nav/xpl-top-nav.js +433 -0
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +1 -1
- package/dist/collection/utils/lifecycle.js +79 -0
- package/dist/collection/utils/tab-a11y-ids.js +22 -0
- package/dist/components/floating-ui.dom.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/tab-a11y-ids.js +1 -0
- package/dist/components/xpl-accordion.js +1 -1
- package/dist/components/xpl-application-shell.js +1 -1
- package/dist/components/xpl-avatar2.js +1 -1
- package/dist/components/xpl-backdrop2.js +1 -1
- package/dist/components/xpl-badge2.js +1 -1
- package/dist/components/xpl-banner.js +1 -1
- package/dist/components/xpl-breadcrumb-item.js +1 -1
- package/dist/components/xpl-breadcrumbs.js +1 -1
- package/dist/components/xpl-button-row.js +1 -1
- package/dist/components/xpl-button2.js +1 -1
- package/dist/components/xpl-calendar.js +1 -1
- package/dist/components/xpl-checkbox2.js +1 -1
- package/dist/components/xpl-choicelist.js +1 -1
- package/dist/components/xpl-content-area.js +1 -1
- package/dist/components/xpl-dashboard.js +1 -1
- package/dist/components/xpl-data-card.js +1 -1
- package/dist/components/xpl-divider2.js +1 -1
- package/dist/components/xpl-dropdown-group2.js +1 -1
- package/dist/components/xpl-dropdown-heading2.js +1 -1
- package/dist/components/xpl-dropdown-option2.js +1 -1
- package/dist/components/xpl-dropdown2.js +1 -1
- package/dist/components/xpl-dynamic-table-cell.js +1 -1
- package/dist/components/xpl-dynamic-table-row.js +1 -1
- package/dist/components/xpl-dynamic-table.js +1 -1
- package/dist/components/xpl-grid-item.js +1 -1
- package/dist/components/xpl-grid.js +1 -1
- package/dist/components/xpl-header-accordion.js +1 -1
- package/dist/components/xpl-icon2.js +1 -1
- package/dist/components/xpl-input-date2.js +1 -1
- package/dist/components/xpl-input-file2.js +1 -1
- package/dist/components/xpl-input-search.d.ts +11 -0
- package/dist/components/xpl-input-search.js +1 -0
- package/dist/components/xpl-input-search2.js +1 -0
- package/dist/components/xpl-input2.js +1 -1
- package/dist/components/xpl-large-card.js +1 -1
- package/dist/components/{xpl-progress.d.ts → xpl-list-item.d.ts} +4 -4
- package/dist/components/xpl-list-item.js +1 -0
- package/dist/components/xpl-list-item2.js +1 -0
- package/dist/components/xpl-list.js +1 -1
- package/dist/components/xpl-main-nav.js +1 -1
- package/dist/components/xpl-modal.js +1 -1
- package/dist/components/xpl-nav-header-menu.d.ts +11 -0
- package/dist/components/xpl-nav-header-menu.js +1 -0
- package/dist/components/xpl-nav-item.js +1 -1
- package/dist/components/xpl-pagination.js +1 -1
- package/dist/components/xpl-panel.js +1 -1
- package/dist/components/xpl-popover2.js +1 -1
- package/dist/components/xpl-progress-bar.js +1 -1
- package/dist/components/xpl-progress-indicator.d.ts +11 -0
- package/dist/components/xpl-progress-indicator.js +1 -0
- package/dist/components/xpl-radio2.js +1 -1
- package/dist/components/xpl-secondary-nav.js +1 -1
- package/dist/components/xpl-select2.js +1 -1
- package/dist/components/xpl-side-nav-item.js +1 -1
- package/dist/components/xpl-side-nav.js +1 -1
- package/dist/components/xpl-skeleton.js +1 -1
- package/dist/components/xpl-slideout.js +1 -1
- package/dist/components/xpl-spotlight.d.ts +11 -0
- package/dist/components/xpl-spotlight.js +1 -0
- package/dist/components/xpl-tab-panel.js +1 -1
- package/dist/components/xpl-tab.js +1 -1
- package/dist/components/xpl-table-header.js +1 -1
- package/dist/components/xpl-table.js +1 -1
- package/dist/components/xpl-tabs.js +1 -1
- package/dist/components/xpl-tag2.js +1 -1
- package/dist/components/xpl-toast.js +1 -1
- package/dist/components/xpl-toggle.js +1 -1
- package/dist/components/xpl-toolbar.js +1 -1
- package/dist/components/xpl-tooltip2.js +1 -1
- package/dist/components/xpl-top-nav-item.d.ts +11 -0
- package/dist/components/xpl-top-nav-item.js +1 -0
- package/dist/components/xpl-top-nav-item2.js +1 -0
- package/dist/components/xpl-top-nav.d.ts +11 -0
- package/dist/components/xpl-top-nav.js +1 -0
- package/dist/components/xpl-utility-bar.js +1 -1
- package/dist/docs/xpl-avatar/readme.md +289 -15
- package/dist/docs/xpl-badge/readme.md +14 -9
- package/dist/docs/xpl-banner/readme.md +48 -11
- package/dist/docs/xpl-button/readme.md +28 -18
- package/dist/docs/xpl-calendar/readme.md +1 -1
- package/dist/docs/xpl-checkbox/readme.md +12 -11
- package/dist/docs/xpl-divider/readme.md +6 -4
- package/dist/docs/xpl-dropdown/readme.md +14 -12
- package/dist/docs/xpl-icon/readme.md +14 -2
- package/dist/docs/xpl-input/readme.md +66 -41
- package/dist/docs/xpl-input/xpl-input-color/readme.md +1 -0
- package/dist/docs/xpl-input/xpl-input-phone/readme.md +1 -0
- package/dist/docs/xpl-input/xpl-input-search/readme.md +175 -0
- package/dist/docs/xpl-input/xpl-input-time/readme.md +1 -0
- package/dist/docs/xpl-list/readme.md +320 -10
- package/dist/docs/xpl-list/xpl-list-item/readme.md +99 -0
- package/dist/docs/xpl-pagination/readme.md +1 -0
- package/dist/docs/xpl-panel/readme.md +108 -17
- package/dist/docs/xpl-popover/readme.md +2 -0
- package/dist/docs/xpl-progress-indicator/readme.md +234 -0
- package/dist/docs/xpl-radio/readme.md +6 -4
- package/dist/docs/xpl-select/readme.md +19 -16
- package/dist/docs/xpl-side-nav/readme.md +2 -2
- package/dist/docs/xpl-slideout/readme.md +1 -1
- package/dist/docs/xpl-spotlight/readme.md +235 -0
- package/dist/docs/xpl-tab/readme.md +43 -7
- package/dist/docs/xpl-tab-panel/readme.md +42 -0
- package/dist/docs/xpl-tabs/readme.md +62 -8
- package/dist/docs/xpl-tag/readme.md +379 -4
- package/dist/docs/xpl-toast/readme.md +1 -1
- package/dist/docs/xpl-top-nav/readme.md +179 -0
- package/dist/docs/xpl-top-nav/xpl-nav-header-menu/readme.md +81 -0
- package/dist/docs/xpl-top-nav/xpl-top-nav-item/readme.md +87 -0
- package/dist/esm/apollo-core.js +4 -4
- package/dist/esm/{index-C_Z2nG0p.js → index-C7bgJs6C.js} +18 -8
- package/dist/esm/loader.js +3 -3
- package/dist/esm/xpl-accordion.entry.js +3 -3
- package/dist/esm/xpl-application-shell.entry.js +2 -2
- package/dist/esm/{xpl-avatar_47.entry.js → xpl-avatar_54.entry.js} +3719 -536
- package/dist/esm/xpl-button-row.entry.js +2 -2
- package/dist/esm/xpl-calendar.entry.js +2 -2
- package/dist/esm/xpl-dynamic-table-cell.entry.js +3 -3
- package/dist/esm/xpl-dynamic-table-row.entry.js +3 -3
- package/dist/esm/xpl-dynamic-table.entry.js +2 -2
- package/dist/esm/xpl-grid-item.entry.js +2 -2
- package/dist/esm/xpl-grid.entry.js +2 -2
- package/dist/esm/xpl-large-card.entry.js +2 -2
- package/dist/esm/xpl-main-nav.entry.js +2 -2
- package/dist/esm/xpl-table-header-cell.entry.js +1 -1
- package/dist/esm/xpl-table-header.entry.js +2 -2
- package/dist/esm/xpl-toggle.entry.js +4 -4
- package/dist/esm/xpl-toolbar.entry.js +3 -3
- package/dist/types/components/xpl-avatar/avatar.stories.d.ts +88 -29
- package/dist/types/components/xpl-avatar/xpl-avatar.d.ts +29 -2
- package/dist/types/components/xpl-badge/badge.stories.d.ts +0 -19
- package/dist/types/components/xpl-button/xpl-button.d.ts +7 -0
- package/dist/types/components/xpl-checkbox/xpl-checkbox.d.ts +2 -1
- package/dist/types/components/xpl-dropdown/xpl-dropdown.d.ts +5 -0
- package/dist/types/components/xpl-input/input.stories.d.ts +1 -0
- package/dist/types/components/xpl-input/xpl-input-search/xpl-input-search.d.ts +39 -0
- package/dist/types/components/xpl-input/xpl-input.d.ts +13 -5
- package/dist/types/components/xpl-list/list.stories.d.ts +299 -13
- package/dist/types/components/xpl-list/listitem.d.ts +13 -0
- package/dist/types/components/xpl-list/xpl-list-item/xpl-list-item.d.ts +71 -0
- package/dist/types/components/xpl-list/xpl-list.d.ts +55 -2
- package/dist/types/components/xpl-pagination/pagination.stories.d.ts +13 -0
- package/dist/types/components/xpl-panel/panel.stories.d.ts +2 -0
- package/dist/types/components/xpl-progress-indicator/progress-indicator.stories.d.ts +62 -0
- package/dist/types/components/xpl-progress-indicator/xpl-progress-indicator.d.ts +11 -0
- package/dist/types/components/xpl-select/xpl-select.d.ts +3 -0
- package/dist/types/components/xpl-spotlight/spotlight.stories.d.ts +197 -0
- package/dist/types/components/xpl-spotlight/xpl-spotlight.d.ts +101 -0
- package/dist/types/components/xpl-tab/xpl-tab.d.ts +14 -1
- package/dist/types/components/xpl-tab-panel/xpl-tab-panel.d.ts +2 -1
- package/dist/types/components/xpl-tabs/segment-control.stories.d.ts +112 -0
- package/dist/types/components/xpl-tabs/tabs.shared.d.ts +156 -0
- package/dist/types/components/xpl-tabs/tabs.stories.d.ts +65 -12
- package/dist/types/components/xpl-tabs/xpl-tabs.d.ts +37 -18
- package/dist/types/components/xpl-tag/tag.stories.d.ts +65 -0
- package/dist/types/components/xpl-tag/xpl-tag.d.ts +36 -1
- package/dist/types/components/xpl-top-nav/top-nav.stories.d.ts +471 -0
- package/dist/types/components/xpl-top-nav/xpl-nav-header-menu/xpl-nav-header-menu.d.ts +18 -0
- package/dist/types/components/xpl-top-nav/xpl-top-nav-item/xpl-top-nav-item.d.ts +48 -0
- package/dist/types/components/xpl-top-nav/xpl-top-nav.d.ts +51 -0
- package/dist/types/components.d.ts +1521 -83
- package/dist/types/utils/lifecycle.d.ts +16 -0
- package/dist/types/utils/tab-a11y-ids.d.ts +4 -0
- package/package.json +12 -3
- package/dist/apollo-core/p-0bce3874.entry.js +0 -1
- package/dist/apollo-core/p-1fd3dc87.entry.js +0 -1
- package/dist/apollo-core/p-56fa4941.entry.js +0 -1
- package/dist/apollo-core/p-76c324da.entry.js +0 -1
- package/dist/apollo-core/p-7a3224b4.entry.js +0 -1
- package/dist/apollo-core/p-7e924697.entry.js +0 -1
- package/dist/apollo-core/p-9efca9e1.entry.js +0 -1
- package/dist/apollo-core/p-b252b380.entry.js +0 -1
- package/dist/apollo-core/p-c91daac1.entry.js +0 -1
- package/dist/apollo-core/p-d9b62508.entry.js +0 -1
- package/dist/apollo-core/p-eaea16d1.entry.js +0 -1
- package/dist/apollo-core/p-eed13bca.entry.js +0 -1
- package/dist/cjs/xpl-list.cjs.entry.js +0 -32
- package/dist/collection/components/xpl-progress/progress.stories.js +0 -106
- package/dist/collection/components/xpl-progress/xpl-progress.js +0 -60
- package/dist/components/xpl-progress.js +0 -1
- package/dist/docs/xpl-progress/readme.md +0 -22
- package/dist/esm/xpl-list.entry.js +0 -30
- package/dist/types/components/xpl-progress/progress.stories.d.ts +0 -38
- package/dist/types/components/xpl-progress/xpl-progress.d.ts +0 -6
|
@@ -1,21 +1,139 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { getTabGroupInstanceId, tabPanelDomId, tabTriggerId, } from "../../utils/tab-a11y-ids";
|
|
2
3
|
export class Tab {
|
|
3
4
|
constructor() {
|
|
5
|
+
this.disabled = false;
|
|
6
|
+
this.fullWidth = false;
|
|
7
|
+
this.groupDisabled = false;
|
|
8
|
+
this.iconPosition = 'start';
|
|
4
9
|
this.selected = false;
|
|
10
|
+
this.variant = 'tabs';
|
|
5
11
|
this.handleTabClick = () => {
|
|
12
|
+
if (this.effectivelyDisabled) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
6
15
|
this.tabChange.emit(this.target);
|
|
7
16
|
};
|
|
8
17
|
}
|
|
18
|
+
async getFocusableElement() {
|
|
19
|
+
if (this.isSegment) {
|
|
20
|
+
return this.el.querySelector('xpl-button button');
|
|
21
|
+
}
|
|
22
|
+
return this.el.querySelector('.xpl-tab__button');
|
|
23
|
+
}
|
|
24
|
+
async setTabIndex(value) {
|
|
25
|
+
const btn = await this.getFocusableElement();
|
|
26
|
+
if (btn) {
|
|
27
|
+
btn.tabIndex = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async focusTrigger() {
|
|
31
|
+
const btn = await this.getFocusableElement();
|
|
32
|
+
btn === null || btn === void 0 ? void 0 : btn.focus();
|
|
33
|
+
}
|
|
34
|
+
get a11yIds() {
|
|
35
|
+
var _a;
|
|
36
|
+
const groupId = getTabGroupInstanceId(this.el);
|
|
37
|
+
const t = (_a = this.target) !== null && _a !== void 0 ? _a : '';
|
|
38
|
+
return {
|
|
39
|
+
panelId: tabPanelDomId(groupId, t),
|
|
40
|
+
triggerId: tabTriggerId(groupId, t),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
get effectivelyDisabled() {
|
|
44
|
+
return this.disabled || this.groupDisabled;
|
|
45
|
+
}
|
|
46
|
+
get isSegment() {
|
|
47
|
+
return this.variant === 'segment';
|
|
48
|
+
}
|
|
9
49
|
render() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
50
|
+
var _a;
|
|
51
|
+
const segment = this.isSegment;
|
|
52
|
+
const { panelId, triggerId } = this.a11yIds;
|
|
53
|
+
const ariaSelected = this.selected ? 'true' : 'false';
|
|
54
|
+
const hostClass = {
|
|
55
|
+
'xpl-tab': true,
|
|
56
|
+
'xpl-tab--selected': this.selected,
|
|
57
|
+
'xpl-tab--segment': segment,
|
|
58
|
+
'xpl-tab--disabled': this.effectivelyDisabled,
|
|
59
|
+
};
|
|
60
|
+
if (segment) {
|
|
61
|
+
return (h(Host, { class: hostClass }, h("xpl-button", { controlAttrs: {
|
|
62
|
+
id: triggerId,
|
|
63
|
+
role: 'tab',
|
|
64
|
+
'aria-controls': panelId,
|
|
65
|
+
'aria-selected': ariaSelected,
|
|
66
|
+
}, disabled: this.effectivelyDisabled, fullWidth: this.fullWidth, icon: (_a = this.icon) !== null && _a !== void 0 ? _a : '', iconPosition: this.iconPosition, onClick: this.handleTabClick, size: "sm", type: "button", variant: this.selected ? 'primary' : 'tertiary' }, h("slot", null))));
|
|
67
|
+
}
|
|
68
|
+
return (h(Host, { class: hostClass }, h("button", { "aria-controls": panelId, "aria-selected": ariaSelected, class: "xpl-tab__button", disabled: this.effectivelyDisabled, id: triggerId, onClick: this.handleTabClick, role: "tab", type: "button" }, h("slot", null))));
|
|
14
69
|
}
|
|
15
70
|
static get is() { return "xpl-tab"; }
|
|
16
71
|
static get properties() {
|
|
17
72
|
return {
|
|
18
|
-
"
|
|
73
|
+
"disabled": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"mutable": false,
|
|
76
|
+
"complexType": {
|
|
77
|
+
"original": "boolean",
|
|
78
|
+
"resolved": "boolean",
|
|
79
|
+
"references": {}
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"optional": false,
|
|
83
|
+
"docs": {
|
|
84
|
+
"tags": [],
|
|
85
|
+
"text": "Disables this tab (pill or underline)."
|
|
86
|
+
},
|
|
87
|
+
"getter": false,
|
|
88
|
+
"setter": false,
|
|
89
|
+
"reflect": true,
|
|
90
|
+
"attribute": "disabled",
|
|
91
|
+
"defaultValue": "false"
|
|
92
|
+
},
|
|
93
|
+
"fullWidth": {
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"mutable": false,
|
|
96
|
+
"complexType": {
|
|
97
|
+
"original": "boolean",
|
|
98
|
+
"resolved": "boolean",
|
|
99
|
+
"references": {}
|
|
100
|
+
},
|
|
101
|
+
"required": false,
|
|
102
|
+
"optional": false,
|
|
103
|
+
"docs": {
|
|
104
|
+
"tags": [{
|
|
105
|
+
"name": "internal",
|
|
106
|
+
"text": "Do not set directly; use `full-width` on `xpl-tabs` instead."
|
|
107
|
+
}],
|
|
108
|
+
"text": "Whether the tab should take full width (set by parent `xpl-tabs` when fullWidth is true)."
|
|
109
|
+
},
|
|
110
|
+
"getter": false,
|
|
111
|
+
"setter": false,
|
|
112
|
+
"reflect": false,
|
|
113
|
+
"attribute": "full-width",
|
|
114
|
+
"defaultValue": "false"
|
|
115
|
+
},
|
|
116
|
+
"groupDisabled": {
|
|
117
|
+
"type": "boolean",
|
|
118
|
+
"mutable": true,
|
|
119
|
+
"complexType": {
|
|
120
|
+
"original": "boolean",
|
|
121
|
+
"resolved": "boolean",
|
|
122
|
+
"references": {}
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"optional": false,
|
|
126
|
+
"docs": {
|
|
127
|
+
"tags": [],
|
|
128
|
+
"text": "Set when the parent `xpl-tabs` has `disabled` (group-disabled)."
|
|
129
|
+
},
|
|
130
|
+
"getter": false,
|
|
131
|
+
"setter": false,
|
|
132
|
+
"reflect": true,
|
|
133
|
+
"attribute": "data-group-disabled",
|
|
134
|
+
"defaultValue": "false"
|
|
135
|
+
},
|
|
136
|
+
"icon": {
|
|
19
137
|
"type": "string",
|
|
20
138
|
"mutable": false,
|
|
21
139
|
"complexType": {
|
|
@@ -24,15 +142,35 @@ export class Tab {
|
|
|
24
142
|
"references": {}
|
|
25
143
|
},
|
|
26
144
|
"required": false,
|
|
145
|
+
"optional": true,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": "Optional icon name for segment-style pills (`type=\"segment\"` on parent `xpl-tabs`). Ignored for default tabs."
|
|
149
|
+
},
|
|
150
|
+
"getter": false,
|
|
151
|
+
"setter": false,
|
|
152
|
+
"reflect": true,
|
|
153
|
+
"attribute": "icon"
|
|
154
|
+
},
|
|
155
|
+
"iconPosition": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "'start' | 'end'",
|
|
160
|
+
"resolved": "\"end\" | \"start\"",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
27
164
|
"optional": false,
|
|
28
165
|
"docs": {
|
|
29
166
|
"tags": [],
|
|
30
|
-
"text": "
|
|
167
|
+
"text": "Icon position for segment-style pills."
|
|
31
168
|
},
|
|
32
169
|
"getter": false,
|
|
33
170
|
"setter": false,
|
|
34
171
|
"reflect": false,
|
|
35
|
-
"attribute": "
|
|
172
|
+
"attribute": "icon-position",
|
|
173
|
+
"defaultValue": "'start'"
|
|
36
174
|
},
|
|
37
175
|
"selected": {
|
|
38
176
|
"type": "boolean",
|
|
@@ -53,6 +191,48 @@ export class Tab {
|
|
|
53
191
|
"reflect": false,
|
|
54
192
|
"attribute": "selected",
|
|
55
193
|
"defaultValue": "false"
|
|
194
|
+
},
|
|
195
|
+
"target": {
|
|
196
|
+
"type": "string",
|
|
197
|
+
"mutable": false,
|
|
198
|
+
"complexType": {
|
|
199
|
+
"original": "string",
|
|
200
|
+
"resolved": "string",
|
|
201
|
+
"references": {}
|
|
202
|
+
},
|
|
203
|
+
"required": false,
|
|
204
|
+
"optional": false,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": "The target of the tab, required for the tab to be selected"
|
|
208
|
+
},
|
|
209
|
+
"getter": false,
|
|
210
|
+
"setter": false,
|
|
211
|
+
"reflect": false,
|
|
212
|
+
"attribute": "target"
|
|
213
|
+
},
|
|
214
|
+
"variant": {
|
|
215
|
+
"type": "string",
|
|
216
|
+
"mutable": false,
|
|
217
|
+
"complexType": {
|
|
218
|
+
"original": "'tabs' | 'segment'",
|
|
219
|
+
"resolved": "\"segment\" | \"tabs\"",
|
|
220
|
+
"references": {}
|
|
221
|
+
},
|
|
222
|
+
"required": false,
|
|
223
|
+
"optional": false,
|
|
224
|
+
"docs": {
|
|
225
|
+
"tags": [{
|
|
226
|
+
"name": "internal",
|
|
227
|
+
"text": "Do not set directly; use `type` on `xpl-tabs` instead."
|
|
228
|
+
}],
|
|
229
|
+
"text": "Visual variant: 'tabs' for underline tabs, 'segment' for pill controls.\nSet by the parent `xpl-tabs` component based on its `type` prop."
|
|
230
|
+
},
|
|
231
|
+
"getter": false,
|
|
232
|
+
"setter": false,
|
|
233
|
+
"reflect": false,
|
|
234
|
+
"attribute": "variant",
|
|
235
|
+
"defaultValue": "'tabs'"
|
|
56
236
|
}
|
|
57
237
|
};
|
|
58
238
|
}
|
|
@@ -65,7 +245,7 @@ export class Tab {
|
|
|
65
245
|
"composed": true,
|
|
66
246
|
"docs": {
|
|
67
247
|
"tags": [],
|
|
68
|
-
"text": "
|
|
248
|
+
"text": "Emitted when this tab is activated (if not disabled). The event `detail` is this tab\u2019s `target` string.\nParent `xpl-tabs` listens and updates selection; use `tabChange` on `xpl-tabs` for the group-level event."
|
|
69
249
|
},
|
|
70
250
|
"complexType": {
|
|
71
251
|
"original": "string",
|
|
@@ -74,4 +254,77 @@ export class Tab {
|
|
|
74
254
|
}
|
|
75
255
|
}];
|
|
76
256
|
}
|
|
257
|
+
static get methods() {
|
|
258
|
+
return {
|
|
259
|
+
"getFocusableElement": {
|
|
260
|
+
"complexType": {
|
|
261
|
+
"signature": "() => Promise<HTMLButtonElement | null>",
|
|
262
|
+
"parameters": [],
|
|
263
|
+
"references": {
|
|
264
|
+
"Promise": {
|
|
265
|
+
"location": "global",
|
|
266
|
+
"id": "global::Promise"
|
|
267
|
+
},
|
|
268
|
+
"HTMLButtonElement": {
|
|
269
|
+
"location": "global",
|
|
270
|
+
"id": "global::HTMLButtonElement"
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
"return": "Promise<HTMLButtonElement>"
|
|
274
|
+
},
|
|
275
|
+
"docs": {
|
|
276
|
+
"text": "Returns the focusable button element for this tab (underline `<button>` or segment `xpl-button` inner button).",
|
|
277
|
+
"tags": [{
|
|
278
|
+
"name": "internal",
|
|
279
|
+
"text": "Used by xpl-tabs for roving tabindex and keyboard navigation."
|
|
280
|
+
}]
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"setTabIndex": {
|
|
284
|
+
"complexType": {
|
|
285
|
+
"signature": "(value: number) => Promise<void>",
|
|
286
|
+
"parameters": [{
|
|
287
|
+
"name": "value",
|
|
288
|
+
"type": "number",
|
|
289
|
+
"docs": ""
|
|
290
|
+
}],
|
|
291
|
+
"references": {
|
|
292
|
+
"Promise": {
|
|
293
|
+
"location": "global",
|
|
294
|
+
"id": "global::Promise"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"return": "Promise<void>"
|
|
298
|
+
},
|
|
299
|
+
"docs": {
|
|
300
|
+
"text": "Sets the tabindex on the focusable button element.",
|
|
301
|
+
"tags": [{
|
|
302
|
+
"name": "internal",
|
|
303
|
+
"text": "Used by xpl-tabs for roving tabindex."
|
|
304
|
+
}]
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"focusTrigger": {
|
|
308
|
+
"complexType": {
|
|
309
|
+
"signature": "() => Promise<void>",
|
|
310
|
+
"parameters": [],
|
|
311
|
+
"references": {
|
|
312
|
+
"Promise": {
|
|
313
|
+
"location": "global",
|
|
314
|
+
"id": "global::Promise"
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
"return": "Promise<void>"
|
|
318
|
+
},
|
|
319
|
+
"docs": {
|
|
320
|
+
"text": "Focuses the tab's trigger button.",
|
|
321
|
+
"tags": [{
|
|
322
|
+
"name": "internal",
|
|
323
|
+
"text": "Used by xpl-tabs for keyboard navigation."
|
|
324
|
+
}]
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
static get elementRef() { return "el"; }
|
|
77
330
|
}
|
|
@@ -1,56 +1,63 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { getTabGroupInstanceId, tabPanelDomId, tabTriggerId, } from "../../utils/tab-a11y-ids";
|
|
2
3
|
export class TabPanel {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.selected = false;
|
|
5
6
|
}
|
|
6
7
|
render() {
|
|
7
|
-
|
|
8
|
+
var _a;
|
|
9
|
+
const groupId = getTabGroupInstanceId(this.el);
|
|
10
|
+
const t = (_a = this.target) !== null && _a !== void 0 ? _a : '';
|
|
11
|
+
const panelId = tabPanelDomId(groupId, t);
|
|
12
|
+
const labelledBy = tabTriggerId(groupId, t);
|
|
13
|
+
return (h(Host, { key: '4c4a86dda347872ea6b1c4569f8424bd6cac7bd9', "aria-labelledby": labelledBy, class: {
|
|
8
14
|
'xpl-tab-panel': true,
|
|
9
15
|
'xpl-tab-panel--selected': this.selected,
|
|
10
|
-
}, role: "tabpanel"
|
|
16
|
+
}, id: panelId, role: "tabpanel" }, h("slot", { key: '30c9ae6f3748dc02a73da7535443266b1043d61b' })));
|
|
11
17
|
}
|
|
12
18
|
static get is() { return "xpl-tab-panel"; }
|
|
13
19
|
static get properties() {
|
|
14
20
|
return {
|
|
15
|
-
"
|
|
16
|
-
"type": "
|
|
21
|
+
"selected": {
|
|
22
|
+
"type": "boolean",
|
|
17
23
|
"mutable": false,
|
|
18
24
|
"complexType": {
|
|
19
|
-
"original": "
|
|
20
|
-
"resolved": "
|
|
25
|
+
"original": "boolean",
|
|
26
|
+
"resolved": "boolean",
|
|
21
27
|
"references": {}
|
|
22
28
|
},
|
|
23
29
|
"required": false,
|
|
24
30
|
"optional": false,
|
|
25
31
|
"docs": {
|
|
26
32
|
"tags": [],
|
|
27
|
-
"text": "
|
|
33
|
+
"text": "Whether the panel is selected"
|
|
28
34
|
},
|
|
29
35
|
"getter": false,
|
|
30
36
|
"setter": false,
|
|
31
37
|
"reflect": false,
|
|
32
|
-
"attribute": "
|
|
38
|
+
"attribute": "selected",
|
|
39
|
+
"defaultValue": "false"
|
|
33
40
|
},
|
|
34
|
-
"
|
|
35
|
-
"type": "
|
|
41
|
+
"target": {
|
|
42
|
+
"type": "string",
|
|
36
43
|
"mutable": false,
|
|
37
44
|
"complexType": {
|
|
38
|
-
"original": "
|
|
39
|
-
"resolved": "
|
|
45
|
+
"original": "string",
|
|
46
|
+
"resolved": "string",
|
|
40
47
|
"references": {}
|
|
41
48
|
},
|
|
42
49
|
"required": false,
|
|
43
50
|
"optional": false,
|
|
44
51
|
"docs": {
|
|
45
52
|
"tags": [],
|
|
46
|
-
"text": "
|
|
53
|
+
"text": "The target of the tab, required for the tab to be selected"
|
|
47
54
|
},
|
|
48
55
|
"getter": false,
|
|
49
56
|
"setter": false,
|
|
50
57
|
"reflect": false,
|
|
51
|
-
"attribute": "
|
|
52
|
-
"defaultValue": "false"
|
|
58
|
+
"attribute": "target"
|
|
53
59
|
}
|
|
54
60
|
};
|
|
55
61
|
}
|
|
62
|
+
static get elementRef() { return "el"; }
|
|
56
63
|
}
|
|
@@ -132,14 +132,14 @@ export class Table {
|
|
|
132
132
|
(!this.sortTypeArray || this.sortTypeArray.length !== this.columns.length)) {
|
|
133
133
|
this.sortTypeArray = this.columns.map(() => null);
|
|
134
134
|
}
|
|
135
|
-
return (h(Host, { key: '
|
|
135
|
+
return (h(Host, { key: '10b0bfd08e28fada9a2c8509d405c5314cce1689' }, h("div", { key: '8e5b4fe928618b175a58f858f6cfd65f4bd29c53', class: "xpl-table-container", onScroll: this.onScroll, ref: (el) => {
|
|
136
136
|
this.container = el;
|
|
137
|
-
} }, h("table", { key: '
|
|
137
|
+
} }, h("table", { key: 'a6df646737b9a1d5e67cebe9eaad41911ab606ca', class: {
|
|
138
138
|
'xpl-table': true,
|
|
139
139
|
'xpl-table--striped': this.striped,
|
|
140
140
|
'xpl-table--freeze': this.freeze,
|
|
141
141
|
'xpl-table--has-scrolled': this.hasScrolled,
|
|
142
|
-
} }, this.columns && (h("thead", { key: '
|
|
142
|
+
} }, this.columns && (h("thead", { key: '5f14766107d69f26b865f63c323d417f43260267' }, this.columns.map((column, i) => {
|
|
143
143
|
var _a;
|
|
144
144
|
const iconType = getIconType((_a = this.sortTypeArray) === null || _a === void 0 ? void 0 : _a[i]);
|
|
145
145
|
const isColumnSortable = !!(this.isSortable && this.sortableColumns[i]);
|
|
@@ -148,11 +148,11 @@ export class Table {
|
|
|
148
148
|
e.stopPropagation();
|
|
149
149
|
this.selectAll(e);
|
|
150
150
|
}, type: "checkbox", value: `select-all-${this.selectAllValue}` })), column, isColumnSortable && !!this.sortTypeArray[i] && (h("xpl-icon", { icon: iconType, size: 16 })))));
|
|
151
|
-
}))), h("tbody", { key: '
|
|
151
|
+
}))), h("tbody", { key: 'b13ca1d1a738de189d4f040dfd309187671b341d' }, this.rowData.map((row, rowNum) => (h("tr", { class: this.selected && this.selected[rowNum]
|
|
152
152
|
? 'xpl-table-row-selected'
|
|
153
153
|
: '' }, row.map((cell, i) => (h("td", null, this.multiselect && i === 0 ? (h("label", { htmlFor: `__xpl-table-row-${rowNum}` }, h("input", { id: `__xpl-table-row-${rowNum}`, checked: !!this.selected[rowNum], type: "checkbox", onChange: (e) => this.selectOne(e, rowNum), value: this.selectedValues.length > 0
|
|
154
154
|
? this.selectedValues[rowNum]
|
|
155
|
-
: `xpl-table-checkbox-${rowNum}` }), h("div", { innerHTML: cell }))) : (h("div", { innerHTML: cell }))))))))), ((_a = this.rowFooterData) === null || _a === void 0 ? void 0 : _a.length) > 0 && (h("tfoot", { key: '
|
|
155
|
+
: `xpl-table-checkbox-${rowNum}` }), h("div", { innerHTML: cell }))) : (h("div", { innerHTML: cell }))))))))), ((_a = this.rowFooterData) === null || _a === void 0 ? void 0 : _a.length) > 0 && (h("tfoot", { key: '5d45854ba21aa7e0bfaaf3b8a537e0c121538ac9' }, this.rowFooterData.map((row) => (h("tr", null, row.map((cell) => (h("td", null, h("div", { innerHTML: cell })))))))))))));
|
|
156
156
|
}
|
|
157
157
|
static get is() { return "xpl-table"; }
|
|
158
158
|
static get properties() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
export class TableHeader {
|
|
3
3
|
render() {
|
|
4
|
-
return (h(Host, { key: '
|
|
4
|
+
return (h(Host, { key: '7b36c9e640bd43ac38ea2625e7600e8699a13c5f', role: "row", class: "xpl-table-header" }, h("slot", { key: 'd03fe894a829477b6bf25dbd6dfa724b224b8d42' })));
|
|
5
5
|
}
|
|
6
6
|
static get is() { return "xpl-table-header"; }
|
|
7
7
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { renderTabsStoryMarkup, segmentControlDefaultArgs, segmentControlStoryArgTypes, tabsPlainDomSegmentStoryHtml, } from "./tabs.shared";
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/Segment Control',
|
|
4
|
+
component: 'xpl-tabs',
|
|
5
|
+
parameters: {
|
|
6
|
+
actions: {
|
|
7
|
+
handles: ['tabChange'],
|
|
8
|
+
},
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: '**Segment Control** is `xpl-tabs` with `type="segment"`. For underline tabs see **Components/Tabs**.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
argTypes: segmentControlStoryArgTypes,
|
|
16
|
+
};
|
|
17
|
+
export const SegmentControl = (args, context) => renderTabsStoryMarkup(args, context !== null && context !== void 0 ? context : {});
|
|
18
|
+
SegmentControl.args = segmentControlDefaultArgs;
|
|
19
|
+
SegmentControl.parameters = {
|
|
20
|
+
layout: 'padded',
|
|
21
|
+
'web-component': {
|
|
22
|
+
render: renderTabsStoryMarkup(segmentControlDefaultArgs),
|
|
23
|
+
},
|
|
24
|
+
html: {
|
|
25
|
+
render: tabsPlainDomSegmentStoryHtml,
|
|
26
|
+
},
|
|
27
|
+
design: {
|
|
28
|
+
type: 'figma',
|
|
29
|
+
url: 'https://www.figma.com/design/MjjYek73MFnHmVNdm45Sd1/Apollo-Web?node-id=6405-96230',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export function escapeHtmlAttr(value) {
|
|
2
|
+
return value.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
|
3
|
+
}
|
|
4
|
+
export function clampTabCount(n) {
|
|
5
|
+
if (Number.isNaN(n) || n < 1) {
|
|
6
|
+
return 1;
|
|
7
|
+
}
|
|
8
|
+
return Math.min(200, Math.floor(n));
|
|
9
|
+
}
|
|
10
|
+
export function coerceTabsStoryValue(args) {
|
|
11
|
+
var _a;
|
|
12
|
+
const n = clampTabCount(args.tabCount);
|
|
13
|
+
const targets = Array.from({ length: n }, (_, i) => `tab${i}`);
|
|
14
|
+
const valueTrim = args.value.trim();
|
|
15
|
+
if (!valueTrim) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
if (targets.includes(valueTrim)) {
|
|
19
|
+
return valueTrim;
|
|
20
|
+
}
|
|
21
|
+
return (_a = targets[0]) !== null && _a !== void 0 ? _a : '';
|
|
22
|
+
}
|
|
23
|
+
export function buildTabsMarkup(args) {
|
|
24
|
+
const n = clampTabCount(args.tabCount);
|
|
25
|
+
const targets = Array.from({ length: n }, (_, i) => `tab${i}`);
|
|
26
|
+
const hostAttrs = [];
|
|
27
|
+
if (args.type === 'segment') {
|
|
28
|
+
hostAttrs.push('type="segment"');
|
|
29
|
+
}
|
|
30
|
+
if (args.disabled) {
|
|
31
|
+
hostAttrs.push('disabled');
|
|
32
|
+
}
|
|
33
|
+
if (args.fullWidth) {
|
|
34
|
+
hostAttrs.push('full-width');
|
|
35
|
+
}
|
|
36
|
+
const valueTrim = args.value.trim();
|
|
37
|
+
if (valueTrim && targets.includes(valueTrim)) {
|
|
38
|
+
hostAttrs.push(`value="${escapeHtmlAttr(valueTrim)}"`);
|
|
39
|
+
}
|
|
40
|
+
const open = hostAttrs.length ? `<xpl-tabs ${hostAttrs.join(' ')}>` : '<xpl-tabs>';
|
|
41
|
+
const lines = [open];
|
|
42
|
+
const firstTabParts = ['slot="heading"', 'target="tab0"'];
|
|
43
|
+
if (args.tabDisabled) {
|
|
44
|
+
firstTabParts.push('disabled');
|
|
45
|
+
}
|
|
46
|
+
if (args.type === 'segment') {
|
|
47
|
+
const icon = args.icon.trim();
|
|
48
|
+
if (icon) {
|
|
49
|
+
firstTabParts.push(`icon="${escapeHtmlAttr(icon)}"`);
|
|
50
|
+
}
|
|
51
|
+
if (args.iconPosition !== 'start') {
|
|
52
|
+
firstTabParts.push(`icon-position="${args.iconPosition}"`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const firstHeading = args.type === 'tabs' ? 'Tab' : 'Segment';
|
|
56
|
+
lines.push(` <xpl-tab ${firstTabParts.join(' ')}>${firstHeading} 1</xpl-tab>`);
|
|
57
|
+
for (let i = 1; i < n; i += 1) {
|
|
58
|
+
lines.push(` <xpl-tab slot="heading" target="tab${i}">${args.type === 'tabs' ? 'Tab' : 'Segment'} ${i + 1}</xpl-tab>`);
|
|
59
|
+
}
|
|
60
|
+
for (let i = 0; i < n; i += 1) {
|
|
61
|
+
lines.push(` <xpl-tab-panel slot="panel" target="tab${i}">Content for ${args.type === 'tabs' ? 'tab' : 'segment'} ${i + 1}</xpl-tab-panel>`);
|
|
62
|
+
}
|
|
63
|
+
lines.push('</xpl-tabs>');
|
|
64
|
+
return lines.join('\n');
|
|
65
|
+
}
|
|
66
|
+
export function renderTabsStoryMarkup(args, context = {}) {
|
|
67
|
+
var _a;
|
|
68
|
+
const value = coerceTabsStoryValue(args);
|
|
69
|
+
if (value !== args.value) {
|
|
70
|
+
(_a = context.updateArgs) === null || _a === void 0 ? void 0 : _a.call(context, { value });
|
|
71
|
+
}
|
|
72
|
+
return buildTabsMarkup(Object.assign(Object.assign({}, args), { value }));
|
|
73
|
+
}
|
|
74
|
+
export const tabsPlainDomUnderlineStoryHtml = `<---- Non-interactive plain DOM (tabs.css BEM). Not the <xpl-tabs> API; use the Web Component tab for that. Ids mirror the scoped pattern (data-tabs-instance-id + target). ---->
|
|
75
|
+
<div class="xpl-tabs" data-tabs-instance-id="xpl-tg-1">
|
|
76
|
+
<xpl-select class-names="xpl-tabs__mobile-select" selected-values="tab0"></xpl-select>
|
|
77
|
+
<nav class="xpl-tabs__headings" role="tablist" aria-orientation="horizontal">
|
|
78
|
+
<div class="xpl-tabs__active-bar"></div>
|
|
79
|
+
<div class="xpl-tab xpl-tab--selected">
|
|
80
|
+
<button class="xpl-tab__button" type="button" role="tab" id="xpl-tg-1-tab-tab0" aria-controls="xpl-tg-1-panel-tab0" aria-selected="true">Tab 1</button>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="xpl-tab">
|
|
83
|
+
<button class="xpl-tab__button" type="button" role="tab" id="xpl-tg-1-tab-tab1" aria-controls="xpl-tg-1-panel-tab1" aria-selected="false">Tab 2</button>
|
|
84
|
+
</div>
|
|
85
|
+
</nav>
|
|
86
|
+
<div class="xpl-tabs__panels">
|
|
87
|
+
<div class="xpl-tab-panel xpl-tab-panel--selected" role="tabpanel" id="xpl-tg-1-panel-tab0" aria-labelledby="xpl-tg-1-tab-tab0">Content for tab 1</div>
|
|
88
|
+
<div class="xpl-tab-panel" role="tabpanel" id="xpl-tg-1-panel-tab1" aria-labelledby="xpl-tg-1-tab-tab1">Content for tab 2</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>`;
|
|
91
|
+
export const tabsPlainDomSegmentStoryHtml = `<---- Segment (type='segment'): Stencil renders xpl-tab.xpl-tab--segment > xpl-button; xpl-tab assigns id, role, and aria-* on the inner native <button>. Plain buttons below only illustrate tablist ↔ tabpanel id wiring (not .xpl-tab__button). ---->
|
|
92
|
+
<div class="xpl-tabs xpl-tabs--segment" data-tabs-instance-id="xpl-tg-2">
|
|
93
|
+
<xpl-select class-names="xpl-tabs__mobile-select" selected-values="tab0"></xpl-select>
|
|
94
|
+
<nav class="xpl-tabs__headings" role="tablist" aria-orientation="horizontal">
|
|
95
|
+
<div class="xpl-tab xpl-tab--segment xpl-tab--selected">
|
|
96
|
+
<button type="button" role="tab" id="xpl-tg-2-tab-tab0" aria-controls="xpl-tg-2-panel-tab0" aria-selected="true">Segment 1</button>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="xpl-tab xpl-tab--segment">
|
|
99
|
+
<button type="button" role="tab" id="xpl-tg-2-tab-tab1" aria-controls="xpl-tg-2-panel-tab1" aria-selected="false">Segment 2</button>
|
|
100
|
+
</div>
|
|
101
|
+
</nav>
|
|
102
|
+
<div class="xpl-tabs__panels">
|
|
103
|
+
<div class="xpl-tab-panel xpl-tab-panel--selected" role="tabpanel" id="xpl-tg-2-panel-tab0" aria-labelledby="xpl-tg-2-tab-tab0">Content for segment 1</div>
|
|
104
|
+
<div class="xpl-tab-panel" role="tabpanel" id="xpl-tg-2-panel-tab1" aria-labelledby="xpl-tg-2-tab-tab1">Content for segment 2</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>`;
|
|
107
|
+
export const tabsStoryBaseArgTypes = {
|
|
108
|
+
type: {
|
|
109
|
+
options: ['tabs', 'segment'],
|
|
110
|
+
control: { type: 'select' },
|
|
111
|
+
description: '`xpl-tabs` — underline (`tabs`) or pills (`segment`).',
|
|
112
|
+
},
|
|
113
|
+
disabled: {
|
|
114
|
+
control: { type: 'boolean' },
|
|
115
|
+
description: '`xpl-tabs` — disables the group.',
|
|
116
|
+
},
|
|
117
|
+
fullWidth: {
|
|
118
|
+
control: { type: 'boolean' },
|
|
119
|
+
description: '`xpl-tabs` — full width.',
|
|
120
|
+
},
|
|
121
|
+
value: {
|
|
122
|
+
control: { type: 'text' },
|
|
123
|
+
description: '`xpl-tabs` — selected `target` (e.g. `tab0`). Must match an existing tab for the current **Tab count**; otherwise it resets to `tab0`. Leave empty for the first tab.',
|
|
124
|
+
},
|
|
125
|
+
tabCount: {
|
|
126
|
+
control: { type: 'number', min: 1, max: 200, step: 1 },
|
|
127
|
+
description: 'How many tab/panel pairs to show (`tab0` …).',
|
|
128
|
+
},
|
|
129
|
+
tabDisabled: {
|
|
130
|
+
control: { type: 'boolean' },
|
|
131
|
+
description: 'First `xpl-tab` only — disabled.',
|
|
132
|
+
},
|
|
133
|
+
icon: {
|
|
134
|
+
control: { type: 'text' },
|
|
135
|
+
description: 'First `xpl-tab` only — icon (segment). Empty = none.',
|
|
136
|
+
},
|
|
137
|
+
iconPosition: {
|
|
138
|
+
options: ['start', 'end'],
|
|
139
|
+
control: { type: 'radio' },
|
|
140
|
+
description: 'First `xpl-tab` only — icon position.',
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
const SEGMENT_CATEGORY_XPL_TABS = '01 — xpl-tabs';
|
|
144
|
+
const SEGMENT_CATEGORY_FIRST_TAB = '02 — xpl-tab controls (first tab only for simplicity)';
|
|
145
|
+
export const segmentControlStoryArgTypes = Object.assign(Object.assign({}, tabsStoryBaseArgTypes), { type: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.type), { table: { disable: true } }), disabled: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.disabled), { table: { category: SEGMENT_CATEGORY_XPL_TABS } }), fullWidth: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.fullWidth), { table: { category: SEGMENT_CATEGORY_XPL_TABS } }), value: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.value), { table: { category: SEGMENT_CATEGORY_XPL_TABS } }), tabCount: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.tabCount), { table: { category: SEGMENT_CATEGORY_XPL_TABS } }), tabDisabled: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.tabDisabled), { table: { category: SEGMENT_CATEGORY_FIRST_TAB } }), icon: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.icon), { table: { category: SEGMENT_CATEGORY_FIRST_TAB } }), iconPosition: Object.assign(Object.assign({}, tabsStoryBaseArgTypes.iconPosition), { table: { category: SEGMENT_CATEGORY_FIRST_TAB } }) });
|
|
146
|
+
export const tabsUnderlineDefaultArgs = {
|
|
147
|
+
type: 'tabs',
|
|
148
|
+
disabled: false,
|
|
149
|
+
fullWidth: false,
|
|
150
|
+
value: 'tab0',
|
|
151
|
+
tabCount: 2,
|
|
152
|
+
tabDisabled: false,
|
|
153
|
+
icon: '',
|
|
154
|
+
iconPosition: 'start',
|
|
155
|
+
};
|
|
156
|
+
export const segmentControlDefaultArgs = Object.assign(Object.assign({}, tabsUnderlineDefaultArgs), { type: 'segment', icon: 'house-4' });
|