@baloise/ds-core 16.3.0 → 16.4.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/README.md +1 -1
- package/components/bal-accordion-summary.js +12 -2
- package/components/bal-accordion-trigger.js +15 -2
- package/components/bal-carousel-item2.js +13 -3
- package/components/bal-carousel2.js +50 -20
- package/components/bal-checkbox-group.js +1 -1
- package/components/bal-checkbox2.js +13 -2
- package/components/bal-close2.js +1 -6
- package/components/bal-date.js +1 -1
- package/components/bal-datepicker.js +1 -1
- package/components/bal-dropdown.js +3 -3
- package/components/bal-file-upload.js +1 -1
- package/components/bal-list-item-accordion-head2.js +7 -1
- package/components/bal-nav-menu-bar2.js +1 -1
- package/components/bal-nav-menu-flyout2.js +3 -6
- package/components/bal-nav.js +11 -8
- package/components/bal-option-list.js +27 -2
- package/components/bal-pagination2.js +3 -3
- package/components/bal-progress-bar.js +4 -2
- package/components/bal-radio2.js +1 -1
- package/components/bal-select2.js +1 -1
- package/components/bal-steps.js +8 -6
- package/components/bal-tab-item.js +10 -2
- package/components/bal-tabs2.js +149 -31
- package/components/index.esm.js +1 -1
- package/components/index.js +1 -1
- package/components/option.js +4 -1
- package/components/tokens.esm.js +1 -1
- package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
- package/dist/baloise-design-system/index.esm.js +1 -1
- package/dist/baloise-design-system/p-0295f5df96.entry.js +1 -0
- package/dist/baloise-design-system/p-098f268743.entry.js +1 -0
- package/dist/baloise-design-system/{p-ae28b86fe5.entry.js → p-0ab43941ba.entry.js} +1 -1
- package/dist/baloise-design-system/p-0d69371467.entry.js +1 -0
- package/dist/baloise-design-system/p-1509eaa7.system.js +1 -1
- package/dist/baloise-design-system/{p-60f45a7b48.entry.js → p-167594de04.entry.js} +1 -1
- package/dist/baloise-design-system/{p-692536f9ff.system.entry.js → p-19542d9bfc.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-2f4c6257f4.entry.js +1 -0
- package/dist/baloise-design-system/{p-47b18581c7.system.entry.js → p-3e8b5dec38.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1de6b20b1c.system.entry.js → p-44d845a857.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-544a0af68d.system.entry.js +1 -0
- package/dist/baloise-design-system/p-54f81c32.js +1 -1
- package/dist/baloise-design-system/p-67e6932c19.entry.js +1 -0
- package/dist/baloise-design-system/{p-d319b257.system.js → p-685405e0.system.js} +1 -1
- package/dist/baloise-design-system/{p-d0d06aa690.entry.js → p-68eead378f.entry.js} +1 -1
- package/dist/baloise-design-system/p-6d9afce4c2.entry.js +1 -0
- package/dist/baloise-design-system/{p-7047afd8.system.js → p-77ccb1f4.system.js} +1 -1
- package/dist/baloise-design-system/{p-b7035c24.system.js → p-83ff83d0.system.js} +1 -1
- package/dist/baloise-design-system/p-86b8ffa1ab.system.entry.js +1 -0
- package/dist/baloise-design-system/p-8754258843.entry.js +1 -0
- package/dist/baloise-design-system/p-88493e9537.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-6cf5e22bb4.entry.js → p-886bedebf9.entry.js} +1 -1
- package/dist/baloise-design-system/{p-1be257c9cd.system.entry.js → p-8b6aca042a.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-95c6192efb.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-12bcc7da.js → p-9b4da619.js} +1 -1
- package/dist/baloise-design-system/p-a7c3119418.system.entry.js +1 -0
- package/dist/baloise-design-system/p-aee4ebe860.system.entry.js +1 -0
- package/dist/baloise-design-system/{p-f9db454e37.entry.js → p-b069b55a8d.entry.js} +1 -1
- package/dist/baloise-design-system/p-b0f4388e4c.system.entry.js +1 -0
- package/dist/baloise-design-system/p-b33c021c08.entry.js +1 -0
- package/dist/baloise-design-system/p-b397abec9a.system.entry.js +1 -0
- package/dist/baloise-design-system/p-b487614e8b.entry.js +1 -0
- package/dist/baloise-design-system/p-b51665840d.entry.js +1 -0
- package/dist/baloise-design-system/{p-80b45dd4d6.system.entry.js → p-bcb892a723.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-bcca1ed3.system.js +1 -1
- package/dist/baloise-design-system/{p-6ceac3e144.system.entry.js → p-c0f4b35c8c.system.entry.js} +1 -1
- package/dist/baloise-design-system/p-c2de2596d1.system.entry.js +1 -0
- package/dist/baloise-design-system/p-c69783ee18.entry.js +1 -0
- package/dist/baloise-design-system/{p-cf0c50d42a.system.entry.js → p-c92eb37957.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-c572e259f4.system.entry.js → p-d66c8f0da9.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-3bad0907.system.js → p-de36076c.system.js} +1 -1
- package/dist/baloise-design-system/{p-7292c6e1a1.entry.js → p-e066dc532d.entry.js} +1 -1
- package/dist/baloise-design-system/{p-301e753d6f.system.entry.js → p-e18ec1401d.system.entry.js} +1 -1
- package/dist/baloise-design-system/{p-0ab7aa0e.js → p-e851f284.js} +1 -1
- package/dist/baloise-design-system/{p-f02ea04390.entry.js → p-e9c3c1c4cc.entry.js} +1 -1
- package/dist/baloise-design-system/p-f7091a61.js +1 -0
- package/dist/cjs/bal-accordion_4.cjs.entry.js +29 -4
- package/dist/cjs/bal-carousel_2.cjs.entry.js +60 -24
- package/dist/cjs/bal-checkbox_2.cjs.entry.js +11 -1
- package/dist/cjs/bal-close.cjs.entry.js +1 -6
- package/dist/cjs/bal-datepicker.cjs.entry.js +3 -3
- package/dist/cjs/bal-dropdown.cjs.entry.js +3 -3
- package/dist/cjs/bal-hint_3.cjs.entry.js +3 -3
- package/dist/cjs/bal-list_8.cjs.entry.js +12 -4
- package/dist/cjs/bal-logo.cjs.entry.js +3 -3
- package/dist/cjs/bal-nav_8.cjs.entry.js +17 -18
- package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
- package/dist/cjs/bal-option_2.cjs.entry.js +26 -2
- package/dist/cjs/bal-pagination.cjs.entry.js +6 -6
- package/dist/cjs/bal-popover_2.cjs.entry.js +3 -3
- package/dist/cjs/bal-progress-bar.cjs.entry.js +6 -5
- package/dist/cjs/bal-shape.cjs.entry.js +1 -1
- package/dist/cjs/bal-steps.cjs.entry.js +9 -8
- package/dist/cjs/bal-tab-item_2.cjs.entry.js +157 -33
- package/dist/cjs/baloise-design-system.cjs.js +1 -1
- package/dist/cjs/{breakpoints.decorator-47fd06b2.js → breakpoints.decorator-e278a735.js} +1 -1
- package/dist/cjs/{breakpoints.subject-06716a68.js → breakpoints.subject-0802767f.js} +1 -1
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/initialize-2a19d091.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{option-c33cf2b8.js → option-4034ca7d.js} +4 -1
- package/dist/cjs/{tokens.esm-dc93a5d7.js → tokens.esm-be397f27.js} +1 -1
- package/dist/collection/components/bal-accordion/bal-accordion-summary/bal-accordion-summary.css +1 -1
- package/dist/collection/components/bal-accordion/bal-accordion-summary/bal-accordion-summary.js +11 -1
- package/dist/collection/components/bal-accordion/bal-accordion-trigger/bal-accordion-trigger.css +1 -1
- package/dist/collection/components/bal-accordion/bal-accordion-trigger/bal-accordion-trigger.js +14 -1
- package/dist/collection/components/bal-carousel/bal-carousel-item/bal-carousel-item.js +45 -2
- package/dist/collection/components/bal-carousel/bal-carousel.js +76 -13
- package/dist/collection/components/bal-carousel/controls/dot-control.js +2 -2
- package/dist/collection/components/bal-carousel/controls/large-control.js +2 -2
- package/dist/collection/components/bal-carousel/controls/small-control.js +2 -2
- package/dist/collection/components/bal-carousel/controls/tab-control.js +2 -2
- package/dist/collection/components/bal-checkbox/bal-checkbox.js +13 -2
- package/dist/collection/components/bal-close/bal-close.js +1 -6
- package/dist/collection/components/bal-list/bal-list-item-accordion-head/bal-list-item-accordion-head.js +7 -1
- package/dist/collection/components/bal-nav/bal-nav-menu-bar/bal-nav-menu-bar.css +1 -1
- package/dist/collection/components/bal-nav/bal-nav-menu-flyout/bal-nav-menu-flyout.js +24 -6
- package/dist/collection/components/bal-nav/bal-nav.css +1 -1
- package/dist/collection/components/bal-nav/bal-nav.js +5 -2
- package/dist/collection/components/bal-nav/models/bal-nav-menu-link-item.js +2 -2
- package/dist/collection/components/bal-nav/models/bal-nav-meta-link-item.js +3 -3
- package/dist/collection/components/bal-option-list/bal-option-list.js +43 -2
- package/dist/collection/components/bal-pagination/bal-pagination.js +3 -3
- package/dist/collection/components/bal-progress-bar/bal-progress-bar.css +1 -1
- package/dist/collection/components/bal-progress-bar/bal-progress-bar.js +26 -2
- package/dist/collection/components/bal-steps/bal-steps.css +1 -1
- package/dist/collection/components/bal-steps/bal-steps.js +26 -2
- package/dist/collection/components/bal-steps/components/step-button.js +2 -2
- package/dist/collection/components/bal-tabs/bal-tab-item/bal-tab-item.js +47 -2
- package/dist/collection/components/bal-tabs/bal-tabs.js +124 -21
- package/dist/collection/components/bal-tabs/components/tab-button.js +18 -6
- package/dist/collection/components/bal-tabs/components/tab-nav.js +3 -3
- package/dist/collection/utils/constants/version.constant.js +1 -1
- package/dist/collection/utils/date/date.spec.js +0 -1
- package/dist/collection/utils/dropdown/option.js +4 -1
- package/dist/collection/utils/dropdown/popup.js +2 -2
- package/dist/collection/utils/string.js +10 -0
- package/dist/collection/utils/string.spec.js +24 -0
- package/dist/esm/bal-accordion_4.entry.js +29 -4
- package/dist/esm/bal-carousel_2.entry.js +61 -25
- package/dist/esm/bal-checkbox_2.entry.js +11 -1
- package/dist/esm/bal-close.entry.js +1 -6
- package/dist/esm/bal-datepicker.entry.js +3 -3
- package/dist/esm/bal-dropdown.entry.js +3 -3
- package/dist/esm/bal-hint_3.entry.js +3 -3
- package/dist/esm/bal-list_8.entry.js +12 -4
- package/dist/esm/bal-logo.entry.js +3 -3
- package/dist/esm/bal-nav_8.entry.js +17 -18
- package/dist/esm/bal-navbar_5.entry.js +3 -3
- package/dist/esm/bal-option_2.entry.js +26 -2
- package/dist/esm/bal-pagination.entry.js +6 -6
- package/dist/esm/bal-popover_2.entry.js +3 -3
- package/dist/esm/bal-progress-bar.entry.js +6 -5
- package/dist/esm/bal-shape.entry.js +1 -1
- package/dist/esm/bal-steps.entry.js +9 -8
- package/dist/esm/bal-tab-item_2.entry.js +158 -34
- package/dist/esm/baloise-design-system.js +1 -1
- package/dist/esm/{breakpoints.decorator-f979fe5c.js → breakpoints.decorator-d0f1affe.js} +1 -1
- package/dist/esm/{breakpoints.subject-9ea7074e.js → breakpoints.subject-f57eda2c.js} +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/initialize-e216cfe4.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{option-37cb0282.js → option-01553dab.js} +4 -1
- package/dist/esm/{tokens.esm-7d2734e1.js → tokens.esm-70c16b84.js} +1 -1
- package/dist/esm-es5/bal-accordion_4.entry.js +1 -1
- package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
- package/dist/esm-es5/bal-checkbox_2.entry.js +1 -1
- package/dist/esm-es5/bal-close.entry.js +1 -1
- package/dist/esm-es5/bal-datepicker.entry.js +1 -1
- package/dist/esm-es5/bal-dropdown.entry.js +1 -1
- package/dist/esm-es5/bal-hint_3.entry.js +1 -1
- package/dist/esm-es5/bal-list_8.entry.js +1 -1
- package/dist/esm-es5/bal-logo.entry.js +1 -1
- package/dist/esm-es5/bal-nav_8.entry.js +1 -1
- package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
- package/dist/esm-es5/bal-option_2.entry.js +1 -1
- package/dist/esm-es5/bal-pagination.entry.js +1 -1
- package/dist/esm-es5/bal-popover_2.entry.js +1 -1
- package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
- package/dist/esm-es5/bal-shape.entry.js +1 -1
- package/dist/esm-es5/bal-steps.entry.js +1 -1
- package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
- package/dist/esm-es5/baloise-design-system.js +1 -1
- package/dist/esm-es5/{breakpoints.decorator-f979fe5c.js → breakpoints.decorator-d0f1affe.js} +1 -1
- package/dist/esm-es5/{breakpoints.subject-9ea7074e.js → breakpoints.subject-f57eda2c.js} +1 -1
- package/dist/esm-es5/index.js +1 -1
- package/dist/esm-es5/initialize-e216cfe4.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/option-01553dab.js +1 -0
- package/dist/html.html-data.json +81 -3
- package/dist/types/components/bal-accordion/bal-accordion-summary/bal-accordion-summary.d.ts +1 -0
- package/dist/types/components/bal-accordion/bal-accordion-trigger/bal-accordion-trigger.d.ts +1 -0
- package/dist/types/components/bal-carousel/bal-carousel-item/bal-carousel-item.d.ts +6 -0
- package/dist/types/components/bal-carousel/bal-carousel.d.ts +11 -2
- package/dist/types/components/bal-carousel/controls/dot-control.d.ts +1 -0
- package/dist/types/components/bal-carousel/controls/large-control.d.ts +1 -0
- package/dist/types/components/bal-carousel/controls/small-control.d.ts +1 -0
- package/dist/types/components/bal-carousel/controls/tab-control.d.ts +1 -0
- package/dist/types/components/bal-checkbox/bal-checkbox.d.ts +5 -0
- package/dist/types/components/bal-close/bal-close.d.ts +0 -2
- package/dist/types/components/bal-list/bal-list-item-accordion-head/bal-list-item-accordion-head.d.ts +1 -0
- package/dist/types/components/bal-nav/bal-nav-menu-flyout/bal-nav-menu-flyout.d.ts +4 -1
- package/dist/types/components/bal-nav/models/bal-nav-link-item.d.ts +1 -0
- package/dist/types/components/bal-nav/models/bal-nav-menu-link-item.d.ts +1 -0
- package/dist/types/components/bal-nav/models/bal-nav-meta-link-item.d.ts +3 -1
- package/dist/types/components/bal-option-list/bal-option-list.d.ts +5 -0
- package/dist/types/components/bal-progress-bar/bal-progress-bar.d.ts +5 -1
- package/dist/types/components/bal-progress-bar/bal-progress-bar.interfaces.d.ts +1 -0
- package/dist/types/components/bal-steps/bal-steps.d.ts +4 -0
- package/dist/types/components/bal-steps/bal-steps.interfaces.d.ts +3 -1
- package/dist/types/components/bal-steps/components/step-button.d.ts +1 -0
- package/dist/types/components/bal-tabs/bal-tab-item/bal-tab-item.d.ts +10 -0
- package/dist/types/components/bal-tabs/bal-tab.type.d.ts +5 -3
- package/dist/types/components/bal-tabs/bal-tabs.d.ts +15 -3
- package/dist/types/components/bal-tabs/bal-tabs.interfaces.d.ts +3 -0
- package/dist/types/components/bal-tabs/components/tab-button.d.ts +1 -0
- package/dist/types/components/bal-tabs/components/tab-nav.d.ts +1 -0
- package/dist/types/components.d.ts +71 -10
- package/dist/types/utils/dropdown/option.d.ts +1 -1
- package/dist/types/utils/dropdown/popup.d.ts +1 -1
- package/dist/types/utils/string.d.ts +1 -0
- package/package.json +8 -8
- package/dist/baloise-design-system/p-1502fa2526.entry.js +0 -1
- package/dist/baloise-design-system/p-1e100fd83b.entry.js +0 -1
- package/dist/baloise-design-system/p-254b130be5.system.entry.js +0 -1
- package/dist/baloise-design-system/p-2d82b78410.entry.js +0 -1
- package/dist/baloise-design-system/p-2e2ed7a07f.entry.js +0 -1
- package/dist/baloise-design-system/p-2ebc8f9d0c.system.entry.js +0 -1
- package/dist/baloise-design-system/p-30fc270ec1.entry.js +0 -1
- package/dist/baloise-design-system/p-35aa7ecb24.entry.js +0 -1
- package/dist/baloise-design-system/p-4f3776ea4e.system.entry.js +0 -1
- package/dist/baloise-design-system/p-55f280cf33.system.entry.js +0 -1
- package/dist/baloise-design-system/p-63dfa27862.system.entry.js +0 -1
- package/dist/baloise-design-system/p-7d498fc5.js +0 -1
- package/dist/baloise-design-system/p-87d9c24d45.system.entry.js +0 -1
- package/dist/baloise-design-system/p-96c55b4f58.entry.js +0 -1
- package/dist/baloise-design-system/p-b22fa7966b.entry.js +0 -1
- package/dist/baloise-design-system/p-c304d5fa9c.entry.js +0 -1
- package/dist/baloise-design-system/p-cee7a0dd73.system.entry.js +0 -1
- package/dist/baloise-design-system/p-cf47f1f53c.entry.js +0 -1
- package/dist/baloise-design-system/p-dbc2d22240.system.entry.js +0 -1
- package/dist/baloise-design-system/p-e7a4d97c51.entry.js +0 -1
- package/dist/baloise-design-system/p-f0ee1b670b.system.entry.js +0 -1
- package/dist/esm-es5/option-37cb0282.js +0 -1
- /package/dist/baloise-design-system/{p-fc80aa3e.system.js → p-83486137.system.js} +0 -0
- /package/dist/baloise-design-system/{p-6b5343bd.js → p-ec4875a2.js} +0 -0
- /package/dist/esm-es5/{tokens.esm-7d2734e1.js → tokens.esm-70c16b84.js} +0 -0
|
@@ -2,10 +2,10 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { BEM } from "../../../utils/bem";
|
|
3
3
|
import { StepIcon } from "./step-icon";
|
|
4
4
|
import { StepLabel } from "./step-label";
|
|
5
|
-
export const StepButton = ({ item, isMobile, clickable, onSelectTab }) => {
|
|
5
|
+
export const StepButton = ({ item, color, isMobile, clickable, onSelectTab }) => {
|
|
6
6
|
const bemEl = BEM.block('steps').element('nav').element('item');
|
|
7
7
|
if (item.invisible) {
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
return (h("a", { role: "tab", class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bemEl.class()), bemEl.modifier('done').class(item.done)), bemEl.modifier('active').class(item.active)), bemEl.modifier('failed').class(item.failed)), bemEl.modifier('disabled').class(item.disabled)), bemEl.modifier('clickable').class(clickable)), bemEl.modifier('passed').class(item.passed)), { 'bal-focusable': !item.disabled && !item.invisible }), "data-label": item.label, "data-value": item.value, "data-index": item.index, "data-testid": "bal-steps-option", "aria-disabled": `${item.disabled}`, href: item.href === '' ? 'javascript:;' : item.href, target: item.target, onClick: (ev) => onSelectTab(ev, item) }, h(StepIcon, { item: item, isMobile: isMobile }), h(StepLabel, { item: item })));
|
|
10
|
+
return (h("a", { role: "tab", class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bemEl.class()), bemEl.modifier(`color-${color}`).class()), bemEl.modifier('done').class(item.done)), bemEl.modifier('active').class(item.active)), bemEl.modifier('failed').class(item.failed)), bemEl.modifier('disabled').class(item.disabled)), bemEl.modifier('clickable').class(clickable)), bemEl.modifier('passed').class(item.passed)), { 'bal-focusable': !item.disabled && !item.invisible }), "data-label": item.label, "data-value": item.value, "data-index": item.index, "data-testid": "bal-steps-option", "aria-disabled": `${item.disabled}`, href: item.href === '' ? 'javascript:;' : item.href, target: item.target, onClick: (ev) => onSelectTab(ev, item) }, h(StepIcon, { item: item, isMobile: isMobile }), h(StepLabel, { item: item })));
|
|
11
11
|
};
|
|
@@ -15,6 +15,8 @@ export class TabItem {
|
|
|
15
15
|
this.invisible = false;
|
|
16
16
|
this.prevent = false;
|
|
17
17
|
this.icon = undefined;
|
|
18
|
+
this.noPanel = false;
|
|
19
|
+
this.aria = undefined;
|
|
18
20
|
}
|
|
19
21
|
componentWillLoad() {
|
|
20
22
|
this.inheritAttributes = inheritTrackingAttributes(this.el);
|
|
@@ -47,13 +49,17 @@ export class TabItem {
|
|
|
47
49
|
prevent: this.prevent,
|
|
48
50
|
navigate: this.balNavigate,
|
|
49
51
|
trackingData: this.inheritAttributes,
|
|
52
|
+
noPanel: this.noPanel,
|
|
53
|
+
aria: this.aria,
|
|
50
54
|
};
|
|
51
55
|
}
|
|
52
56
|
render() {
|
|
53
|
-
|
|
57
|
+
const hasPanel = !this.noPanel;
|
|
58
|
+
const noPanelOrInactive = !this.isActive || this.noPanel;
|
|
59
|
+
return (h(Host, { id: this.tabPanelID, class: {
|
|
54
60
|
'bal-tab-item': true,
|
|
55
61
|
'bal-tab-item--active': this.isActive,
|
|
56
|
-
} }, h("slot", null)));
|
|
62
|
+
}, role: hasPanel ? 'tabpanel' : undefined, "aria-label": hasPanel ? this.label : undefined, "aria-hidden": noPanelOrInactive ? 'true' : 'false', tabindex: noPanelOrInactive ? '-1' : undefined, hidden: noPanelOrInactive ? true : undefined }, h("slot", null)));
|
|
57
63
|
}
|
|
58
64
|
static get is() { return "bal-tab-item"; }
|
|
59
65
|
static get properties() {
|
|
@@ -242,6 +248,45 @@ export class TabItem {
|
|
|
242
248
|
"attribute": "icon",
|
|
243
249
|
"reflect": true,
|
|
244
250
|
"defaultValue": "undefined"
|
|
251
|
+
},
|
|
252
|
+
"noPanel": {
|
|
253
|
+
"type": "boolean",
|
|
254
|
+
"mutable": false,
|
|
255
|
+
"complexType": {
|
|
256
|
+
"original": "boolean",
|
|
257
|
+
"resolved": "boolean",
|
|
258
|
+
"references": {}
|
|
259
|
+
},
|
|
260
|
+
"required": false,
|
|
261
|
+
"optional": false,
|
|
262
|
+
"docs": {
|
|
263
|
+
"tags": [],
|
|
264
|
+
"text": "If `true` the tab does not have a panel"
|
|
265
|
+
},
|
|
266
|
+
"attribute": "no-panel",
|
|
267
|
+
"reflect": false,
|
|
268
|
+
"defaultValue": "false"
|
|
269
|
+
},
|
|
270
|
+
"aria": {
|
|
271
|
+
"type": "unknown",
|
|
272
|
+
"mutable": false,
|
|
273
|
+
"complexType": {
|
|
274
|
+
"original": "BalProps.BalTabItemAria",
|
|
275
|
+
"resolved": "{ controls?: string; }",
|
|
276
|
+
"references": {
|
|
277
|
+
"BalProps": {
|
|
278
|
+
"location": "global",
|
|
279
|
+
"id": "global::BalProps"
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"required": false,
|
|
284
|
+
"optional": true,
|
|
285
|
+
"docs": {
|
|
286
|
+
"tags": [],
|
|
287
|
+
"text": "A11y attributes for the native tab element."
|
|
288
|
+
},
|
|
289
|
+
"defaultValue": "undefined"
|
|
245
290
|
}
|
|
246
291
|
};
|
|
247
292
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Host, h, } from "@stencil/core";
|
|
3
3
|
import { areArraysEqual } from "@baloise/web-app-utils";
|
|
4
|
-
import { debounceEvent, deepReady, hasParent, isChildOfEventTarget, isDescendant, raf, transitionEndAsync, } from "../../utils/helpers";
|
|
4
|
+
import { debounceEvent, deepReady, hasParent, isChildOfEventTarget, isDescendant, raf, transitionEndAsync, waitAfterFramePaint, } from "../../utils/helpers";
|
|
5
5
|
import { ListenToConfig } from "../../utils/config";
|
|
6
6
|
import { BEM } from "../../utils/bem";
|
|
7
7
|
import { Logger } from "../../utils/log";
|
|
8
8
|
import { newBalTabOption } from "./bal-tab.util";
|
|
9
9
|
import { stopEventBubbling } from "../../utils/form-input";
|
|
10
10
|
import { TabSelect } from "./components/tab-select";
|
|
11
|
-
import { TabNav } from "./components/tab-nav";
|
|
12
11
|
import { getComputedPadding } from "../../utils/style";
|
|
13
12
|
import { ListenToBreakpoints, balBreakpoints } from "../../utils/breakpoints";
|
|
14
13
|
import { ListenToMutation } from "../../utils/mutation";
|
|
15
14
|
import { ListenToResize } from "../../utils/resize";
|
|
15
|
+
import { TabNav } from "./components/tab-nav";
|
|
16
|
+
import { toKebabCase } from "../../utils/string";
|
|
16
17
|
export class Tabs {
|
|
17
18
|
constructor() {
|
|
18
19
|
this.tabsId = `bal-tabs-${TabsIds++}`;
|
|
@@ -34,8 +35,8 @@ export class Tabs {
|
|
|
34
35
|
this.store = newStore;
|
|
35
36
|
}
|
|
36
37
|
else if (!this.optionalTabSelection && !this.accordion && this.value === undefined && this.store.length > 0) {
|
|
37
|
-
const
|
|
38
|
-
this.value =
|
|
38
|
+
const firstTab = this.store[0];
|
|
39
|
+
this.value = firstTab.value;
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
this.setActiveItem = () => {
|
|
@@ -47,7 +48,7 @@ export class Tabs {
|
|
|
47
48
|
};
|
|
48
49
|
this.setActiveContent = () => {
|
|
49
50
|
if (this.options.length === 0) {
|
|
50
|
-
this.items.forEach(item => item.setActive(this.
|
|
51
|
+
this.items.forEach(item => item.setActive(this.isTabActive(item)));
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
this.getLineSize = (element, padding) => {
|
|
@@ -242,25 +243,26 @@ export class Tabs {
|
|
|
242
243
|
console.warn('[WARN] - Could not read tab options');
|
|
243
244
|
}
|
|
244
245
|
};
|
|
245
|
-
this.onSelectTab = async (ev,
|
|
246
|
-
if (
|
|
246
|
+
this.onSelectTab = async (ev, tab) => {
|
|
247
|
+
if (tab.prevent || tab.disabled || !this.clickable) {
|
|
247
248
|
stopEventBubbling(ev);
|
|
248
249
|
}
|
|
249
|
-
if (!
|
|
250
|
+
if (!tab.disabled && this.clickable) {
|
|
250
251
|
if (this.accordion) {
|
|
251
|
-
if (
|
|
252
|
+
if (tab.value === this.value) {
|
|
252
253
|
this.toggleAccordionState();
|
|
253
254
|
}
|
|
254
255
|
else {
|
|
255
256
|
this.expandAccordion();
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
|
-
if (
|
|
259
|
-
|
|
259
|
+
if (tab.navigate) {
|
|
260
|
+
tab.navigate.emit(ev);
|
|
260
261
|
}
|
|
261
|
-
if (
|
|
262
|
-
this.balChange.emit(
|
|
263
|
-
await this.select(
|
|
262
|
+
if (tab.value !== this.value) {
|
|
263
|
+
this.balChange.emit(tab.value);
|
|
264
|
+
await this.select(tab);
|
|
265
|
+
await this.focus(tab);
|
|
264
266
|
}
|
|
265
267
|
}
|
|
266
268
|
};
|
|
@@ -358,6 +360,26 @@ export class Tabs {
|
|
|
358
360
|
isChildOfEventTarget(ev, this.el, () => this.animateLine());
|
|
359
361
|
this.isUsedInNavbar(ev);
|
|
360
362
|
}
|
|
363
|
+
listenToKeyDown(ev) {
|
|
364
|
+
if (this.isTabList) {
|
|
365
|
+
if (this.vertical !== false) {
|
|
366
|
+
if (ev.code === 'ArrowDown') {
|
|
367
|
+
this.tabListSelectNext(ev);
|
|
368
|
+
}
|
|
369
|
+
else if (ev.code === 'ArrowUp') {
|
|
370
|
+
this.tabListSelectPrevious(ev);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
if (ev.code === 'ArrowRight') {
|
|
375
|
+
this.tabListSelectNext(ev);
|
|
376
|
+
}
|
|
377
|
+
else if (ev.code === 'ArrowLeft') {
|
|
378
|
+
this.tabListSelectPrevious(ev);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
361
383
|
isUsedInNavbar(ev) {
|
|
362
384
|
const target = ev.target;
|
|
363
385
|
const parentNavbar = target.closest('bal-navbar');
|
|
@@ -409,11 +431,17 @@ export class Tabs {
|
|
|
409
431
|
* PRIVATE METHODS
|
|
410
432
|
* ------------------------------------------------------
|
|
411
433
|
*/
|
|
434
|
+
get isTabList() {
|
|
435
|
+
return this.store.filter(tab => !!tab.href).length === 0;
|
|
436
|
+
}
|
|
412
437
|
get items() {
|
|
413
438
|
return Array.from(this.el.querySelectorAll(`#${this.tabsId} > bal-tab-item`));
|
|
414
439
|
}
|
|
415
|
-
|
|
416
|
-
return
|
|
440
|
+
isTabActive(tab) {
|
|
441
|
+
return tab.value === this.value;
|
|
442
|
+
}
|
|
443
|
+
isTabVisible(tab) {
|
|
444
|
+
return !tab.hidden;
|
|
417
445
|
}
|
|
418
446
|
parseVertical() {
|
|
419
447
|
if (this.vertical === 'true' || this.vertical === '') {
|
|
@@ -451,6 +479,73 @@ export class Tabs {
|
|
|
451
479
|
getCarouselElement() {
|
|
452
480
|
return this.el.querySelector(`#${this.tabsId}-carousel`);
|
|
453
481
|
}
|
|
482
|
+
/**
|
|
483
|
+
* PRIVATE Tab Navigation with Arrow Keys
|
|
484
|
+
* ------------------------------------------------------
|
|
485
|
+
*/
|
|
486
|
+
findNextTab(previous = false) {
|
|
487
|
+
const indexOfActive = this.store.findIndex(t => this.isTabActive(t));
|
|
488
|
+
let tabs = this.store.map((tab, index) => ({
|
|
489
|
+
index,
|
|
490
|
+
visible: !tab.hidden && !tab.disabled,
|
|
491
|
+
}));
|
|
492
|
+
if (previous) {
|
|
493
|
+
tabs = tabs.reverse();
|
|
494
|
+
}
|
|
495
|
+
const visibleTabs = tabs.filter(t => t.visible).map(t => t.index);
|
|
496
|
+
const findNextTabReducer = (acc, index) => {
|
|
497
|
+
// found a new higher index need to break out
|
|
498
|
+
if (acc > indexOfActive) {
|
|
499
|
+
return acc;
|
|
500
|
+
}
|
|
501
|
+
if (index <= acc) {
|
|
502
|
+
return acc;
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
return index;
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
const findPreviousTabReducer = (acc, index) => {
|
|
509
|
+
// found a new lower index need to break out
|
|
510
|
+
if (acc < indexOfActive) {
|
|
511
|
+
return acc;
|
|
512
|
+
}
|
|
513
|
+
if (index >= acc) {
|
|
514
|
+
return acc;
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
return index;
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
const reducer = previous ? findPreviousTabReducer : findNextTabReducer;
|
|
521
|
+
const nextIndex = visibleTabs.reduce((acc, value) => reducer(acc, value), indexOfActive);
|
|
522
|
+
return this.store[nextIndex];
|
|
523
|
+
}
|
|
524
|
+
findPreviousTab() {
|
|
525
|
+
return this.findNextTab(true);
|
|
526
|
+
}
|
|
527
|
+
tabListSelectNext(ev) {
|
|
528
|
+
const nextTab = this.findNextTab();
|
|
529
|
+
if (nextTab) {
|
|
530
|
+
this.onSelectTab(ev, nextTab);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
tabListSelectPrevious(ev) {
|
|
534
|
+
const previousTab = this.findPreviousTab();
|
|
535
|
+
if (previousTab) {
|
|
536
|
+
this.onSelectTab(ev, previousTab);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
async focus(tab) {
|
|
540
|
+
await waitAfterFramePaint();
|
|
541
|
+
const hasKeyboardFocus = this.el.querySelector(`button.bal-focused`) !== null;
|
|
542
|
+
if (hasKeyboardFocus) {
|
|
543
|
+
const tabEl = this.el.querySelector(`#${this.tabsId}-button-${toKebabCase(tab.value)}`);
|
|
544
|
+
if (tabEl) {
|
|
545
|
+
tabEl.focus({ preventScroll: true });
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
454
549
|
/**
|
|
455
550
|
* RENDER
|
|
456
551
|
* ------------------------------------------------------
|
|
@@ -467,13 +562,15 @@ export class Tabs {
|
|
|
467
562
|
const tabs = this.store.map(tab => (Object.assign(Object.assign({}, tab), { active: tab.value === this.value })));
|
|
468
563
|
const expanded = this.accordionState === 4 /* AccordionState.Expanded */ || this.accordionState === 8 /* AccordionState.Expanding */;
|
|
469
564
|
const contentPart = expanded ? 'content expanded' : 'content';
|
|
565
|
+
const valueExists = this.value !== undefined && !!this.store.find(o => o.value === this.value);
|
|
566
|
+
const isLinkList = !this.isTabList;
|
|
470
567
|
return (h(Host, { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('navbar').class(this.inNavbar)), block.modifier('vertical').class(isVertical)), block.modifier('fullwidth').class(this.expanded || this.fullwidth)), block.modifier('accordion').class(this.accordion)), block.modifier('animated').class(this.animated)), block.modifier('expanding').class(this.accordionState === 8 /* AccordionState.Expanding */)), block.modifier('expanded').class(this.accordionState === 4 /* AccordionState.Expanded */)), block.modifier('collapsing').class(this.accordionState === 2 /* AccordionState.Collapsing */)), block.modifier('collapsed').class(this.accordionState === 1 /* AccordionState.Collapsed */)), "data-value": this.store
|
|
471
|
-
.filter(t => this.
|
|
568
|
+
.filter(t => this.isTabActive(t))
|
|
472
569
|
.map(t => t.value)
|
|
473
570
|
.join(','), "data-label": this.store
|
|
474
|
-
.filter(t => this.
|
|
571
|
+
.filter(t => this.isTabActive(t))
|
|
475
572
|
.map(t => t.label)
|
|
476
|
-
.join(',') }, isSelect ? (h(TabSelect, { value: this.value, items: tabs, onSelectTab: this.onSelectTab })) : (h(TabNav, { items: tabs,
|
|
573
|
+
.join(',') }, isSelect ? (h(TabSelect, { value: this.value, items: tabs, onSelectTab: this.onSelectTab })) : (h(TabNav, { items: tabs, isLinkList: isLinkList, tabsId: this.tabsId, clickable: this.clickable, accordion: this.accordion, isAccordionOpen: this.isAccordionOpen, lineActive: valueExists, inverted: isInverted, animated: this.animated, context: this.context, border: this.border, spaceless: this.spaceless, expanded: this.expanded, isMobile: isMobile, isTouch: isTouch, isVertical: isVertical, inNavbar: this.inNavbar, hasCarousel: hasCarousel, iconPosition: this.iconPosition, verticalColSize: this.verticalColSize, onSelectTab: this.onSelectTab })), h("div", { part: contentPart, ref: contentEl => (this.contentEl = contentEl), class: Object.assign({}, block.element('tabs').element('content').class()) }, h("div", { id: this.tabsId, class: Object.assign({}, block.element('tabs').element('content').element('wrapper').class()), ref: contentElWrapper => (this.contentElWrapper = contentElWrapper) }, h("slot", null)))));
|
|
477
574
|
}
|
|
478
575
|
static get is() { return "bal-tabs"; }
|
|
479
576
|
static get originalStyleUrls() {
|
|
@@ -586,7 +683,7 @@ export class Tabs {
|
|
|
586
683
|
"optional": false,
|
|
587
684
|
"docs": {
|
|
588
685
|
"tags": [],
|
|
589
|
-
"text": "
|
|
686
|
+
"text": "Tabs can be passed as a property or through HTML markup."
|
|
590
687
|
},
|
|
591
688
|
"defaultValue": "[]"
|
|
592
689
|
},
|
|
@@ -683,7 +780,7 @@ export class Tabs {
|
|
|
683
780
|
"optional": false,
|
|
684
781
|
"docs": {
|
|
685
782
|
"tags": [],
|
|
686
|
-
"text": "If `true` the tabs or
|
|
783
|
+
"text": "If `true` the tabs or tabs can be clicked."
|
|
687
784
|
},
|
|
688
785
|
"attribute": "clickable",
|
|
689
786
|
"reflect": false,
|
|
@@ -1072,6 +1169,12 @@ export class Tabs {
|
|
|
1072
1169
|
"target": "window",
|
|
1073
1170
|
"capture": false,
|
|
1074
1171
|
"passive": false
|
|
1172
|
+
}, {
|
|
1173
|
+
"name": "keydown",
|
|
1174
|
+
"method": "listenToKeyDown",
|
|
1175
|
+
"target": undefined,
|
|
1176
|
+
"capture": false,
|
|
1177
|
+
"passive": false
|
|
1075
1178
|
}];
|
|
1076
1179
|
}
|
|
1077
1180
|
}
|
|
@@ -2,7 +2,9 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { BEM } from "../../../utils/bem";
|
|
3
3
|
import { TabIcon } from "./tab-icon";
|
|
4
4
|
import { TabLabel } from "./tab-label";
|
|
5
|
-
|
|
5
|
+
import { toKebabCase } from "../../../utils/string";
|
|
6
|
+
export const TabButton = ({ item, tabsId, isFirst, isLast, isMobile, isVertical, accordion, isAccordionOpen, isLinkList, inverted, expanded, spaceless, clickable, iconPosition, context, onSelectTab, }) => {
|
|
7
|
+
var _a;
|
|
6
8
|
const bemEl = BEM.block('tabs').element('nav').element('item');
|
|
7
9
|
if (item.invisible) {
|
|
8
10
|
return;
|
|
@@ -15,13 +17,23 @@ export const TabButton = ({ item, tabsId, isFirst, isLast, isMobile, isVertical,
|
|
|
15
17
|
const hasLabelBubble = (!hasIcon && hasBubble && !accordion) ||
|
|
16
18
|
(hasBubble && !isMobile && iconPosition === 'horizontal' && !accordion) ||
|
|
17
19
|
(hasBubble && isVertical && !accordion);
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
20
|
+
const isTabButton = item.href === undefined || item.href === '';
|
|
21
|
+
const TagType = isTabButton ? 'button' : 'a';
|
|
22
|
+
const attrs = isTabButton
|
|
23
|
+
? {
|
|
24
|
+
'type': 'button',
|
|
25
|
+
'role': 'tab',
|
|
26
|
+
'aria-controls': ((_a = item.aria) === null || _a === void 0 ? void 0 : _a.controls) || item.tabPanelID || undefined,
|
|
27
|
+
'aria-expanded': item.active ? 'true' : 'false',
|
|
28
|
+
'aria-disabled': `${item.disabled}`,
|
|
29
|
+
'aria-label': item.label,
|
|
30
|
+
}
|
|
21
31
|
: {
|
|
22
32
|
href: item.href,
|
|
23
33
|
target: item.target,
|
|
24
34
|
};
|
|
25
|
-
|
|
35
|
+
if (!isLinkList) {
|
|
36
|
+
attrs['tabindex'] = item.active ? '0' : '-1';
|
|
37
|
+
}
|
|
38
|
+
return (h(TagType, Object.assign({ id: `${tabsId}-button-${toKebabCase(item.value)}`, class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bemEl.class()), bemEl.modifier('active').class(item.active)), bemEl.modifier('disabled').class(item.disabled)), bemEl.modifier('clickable').class(clickable)), bemEl.modifier('accordion').class(accordion)), bemEl.modifier('inverted').class(inverted)), bemEl.modifier('expanded').class(expanded)), bemEl.modifier('spaceless').class(spaceless)), bemEl.modifier('first').class(isFirst)), bemEl.modifier('last').class(isLast)), bemEl.modifier('passed').class(item.passed)), bemEl.modifier('vertical').class(isVertical)), bemEl.modifier(`context-${context}`).class(context !== undefined)), bemEl.modifier(`icon-position-${iconPosition}`).class(iconPosition !== 'horizontal')), { 'bal-focusable': !item.disabled && !item.invisible }), draggable: false, "data-tabs": tabsId, "data-label": item.label, "data-value": item.value, "data-index": item.index, "data-testid": "bal-tabs-item", "aria-selected": !isTabButton ? undefined : item.active ? 'true' : 'false' }, attrs, { onClick: (ev) => onSelectTab(ev, item) }), item.icon ? (h(TabIcon, { accordion: false, item: item, isMobile: isMobile, hasBubble: hasIconBubble, inverted: inverted })) : (''), h(TabLabel, { item: item, isMobile: isMobile, isVertical: isVertical, hasBubble: hasLabelBubble, inverted: inverted, context: context }), accordion && !item.href ? (h(TabIcon, { accordion: accordion, isAccordionOpen: isAccordionOpen, item: item, isMobile: isMobile, hasBubble: hasAccordionIconBubble, inverted: inverted })) : ('')));
|
|
26
39
|
};
|
|
27
|
-
let TabButtonIds = 0;
|
|
@@ -2,10 +2,10 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { BEM } from "../../../utils/bem";
|
|
3
3
|
import { stopEventBubbling } from "../../../utils/form-input";
|
|
4
4
|
import { TabButton } from "./tab-button";
|
|
5
|
-
export const TabNav = ({ items, tabsId, hasCarousel, isVertical, inNavbar, isMobile, isTouch, lineActive, border, accordion, isAccordionOpen, inverted, clickable, animated, spaceless, expanded, verticalColSize, iconPosition, context, onSelectTab, }) => {
|
|
5
|
+
export const TabNav = ({ items, tabsId, hasCarousel, isVertical, inNavbar, isMobile, isTouch, lineActive, isLinkList, border, accordion, isAccordionOpen, inverted, clickable, animated, spaceless, expanded, verticalColSize, iconPosition, context, onSelectTab, }) => {
|
|
6
6
|
const bemEl = BEM.block('tabs').element('nav');
|
|
7
7
|
const tabs = items.filter(tab => !tab.invisible);
|
|
8
8
|
const isFullHeight = inNavbar && !isTouch;
|
|
9
|
-
const Button = ({ item, index }) => (h(TabButton, { item: item, tabsId: tabsId, isFirst: index === 0, isLast: index === tabs.length - 1, isMobile: isMobile, isVertical: isVertical, iconPosition: iconPosition, spaceless: spaceless, inverted: inverted, accordion: accordion, isAccordionOpen: isAccordionOpen, context: context, expanded: expanded, clickable: clickable && !item.disabled, onSelectTab: onSelectTab }));
|
|
10
|
-
return (h("div", {
|
|
9
|
+
const Button = ({ item, index }) => (h(TabButton, { item: item, isLinkList: isLinkList, tabsId: tabsId, isFirst: index === 0, isLast: index === tabs.length - 1, isMobile: isMobile, isVertical: isVertical, iconPosition: iconPosition, spaceless: spaceless, inverted: inverted, accordion: accordion, isAccordionOpen: isAccordionOpen, context: context, expanded: expanded, clickable: clickable && !item.disabled, onSelectTab: onSelectTab }));
|
|
10
|
+
return (h("div", { id: `${tabsId}-nav`, class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bemEl.class()), bemEl.modifier(`full-height`).class(isFullHeight)), bemEl.modifier(`border`).class(border)), bemEl.modifier(`animated`).class(animated)), bemEl.modifier(`vertical`).class(isVertical)), bemEl.modifier(`expanded`).class(expanded && !isVertical)), bemEl.modifier(`vertical-col-${verticalColSize}`).class(isVertical)) }, hasCarousel ? (h("bal-carousel", { id: `${tabsId}-carousel`, class: Object.assign({}, bemEl.element('carousel').class()), htmlRole: 'tablist', fullHeight: isFullHeight, border: border, inverted: inverted, controls: "small", "items-per-view": "auto", steps: 3, onBalChange: stopEventBubbling }, tabs.map((tab, index) => (h("bal-carousel-item", { key: tab.value, htmlRole: '', class: Object.assign(Object.assign({}, bemEl.element('carousel').element('item').class()), bemEl.element('carousel').element('item').modifier('expanded').class(expanded)) }, h(Button, { item: tab, index: index })))), h("div", { id: `${tabsId}-line`, class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bemEl.element('line').class()), bemEl.element('line').modifier(`active`).class(lineActive)), bemEl.element('line').modifier(`inverted`).class(inverted)), bemEl.element('line').modifier(`animated`).class(animated)), bemEl.element('line').modifier(`vertical`).class(isVertical)) }))) : (tabs.map((tab, index) => h(Button, { item: tab, index: index }))), !hasCarousel ? (h("div", { id: `${tabsId}-border`, class: Object.assign(Object.assign(Object.assign({}, bemEl.element('border').class()), bemEl.element('border').modifier(`inverted`).class(inverted)), bemEl.element('border').modifier(`vertical`).class(isVertical)) })) : (''), !hasCarousel ? (h("div", { id: `${tabsId}-line`, class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, bemEl.element('line').class()), bemEl.element('line').modifier(`active`).class(lineActive)), bemEl.element('line').modifier(`inverted`).class(inverted)), bemEl.element('line').modifier(`animated`).class(animated)), bemEl.element('line').modifier(`vertical`).class(isVertical)) })) : ('')));
|
|
11
11
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by .build/version.js
|
|
2
|
-
export const VERSION = '16.
|
|
2
|
+
export const VERSION = '16.4.0';
|
|
@@ -70,7 +70,6 @@ describe('balDate', () => {
|
|
|
70
70
|
const year = new Date().getFullYear();
|
|
71
71
|
const cutoff = year + 10;
|
|
72
72
|
const cutoffTwoDigits = cutoff % 100;
|
|
73
|
-
console.log('cutoff', cutoff);
|
|
74
73
|
expect(BalDate.fromAnyFormat(`1.1.${cutoffTwoDigits}`).toISODate()).toStrictEqual(`20${cutoffTwoDigits}-01-01`);
|
|
75
74
|
expect(BalDate.fromAnyFormat(`1.1.${cutoffTwoDigits - 1}`).toISODate()).toStrictEqual(`20${cutoffTwoDigits - 1}-01-01`);
|
|
76
75
|
expect(BalDate.fromAnyFormat(`1.1.${cutoffTwoDigits + 1}`).toISODate()).toStrictEqual(`19${cutoffTwoDigits + 1}-01-01`);
|
|
@@ -33,12 +33,15 @@ export class DropdownOptionUtil {
|
|
|
33
33
|
this.component.rawOptions = this.component.options.map(mapOption);
|
|
34
34
|
await this.component.valueUtil.updateInputContent();
|
|
35
35
|
}
|
|
36
|
-
async listenToOptionChange(
|
|
36
|
+
async listenToOptionChange(ev) {
|
|
37
37
|
var _a;
|
|
38
38
|
const newSelectedValues = (await ((_a = this.component.listEl) === null || _a === void 0 ? void 0 : _a.getSelectedValues())) || [];
|
|
39
39
|
this.component.valueUtil.updateRawValueBySelection(newSelectedValues);
|
|
40
40
|
if (!this.component.multiple) {
|
|
41
41
|
this.component.popupUtil.collapseList();
|
|
42
|
+
if (this.component.hasFocus) {
|
|
43
|
+
this.component.balBlur.emit(new FocusEvent('blur', { relatedTarget: this.component.el }));
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -26,13 +26,13 @@ export class DropdownPopupUtil {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
expandList() {
|
|
29
|
+
async expandList() {
|
|
30
30
|
var _a;
|
|
31
31
|
if (this.component.panelEl) {
|
|
32
32
|
this.component.panelCleanup = autoUpdate(this.component.el, this.component.panelEl, this.updatePanelPosition(this.component.el, this.component.panelEl));
|
|
33
33
|
}
|
|
34
34
|
this.component.isExpanded = true;
|
|
35
|
-
(_a = this.component.listEl) === null || _a === void 0 ? void 0 : _a.
|
|
35
|
+
await ((_a = this.component.listEl) === null || _a === void 0 ? void 0 : _a.focusSelected());
|
|
36
36
|
}
|
|
37
37
|
collapseList() {
|
|
38
38
|
var _a;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { toKebabCase } from "./string";
|
|
2
|
+
describe('string', () => {
|
|
3
|
+
describe('toKebabCase', () => {
|
|
4
|
+
test('should format non string values correctly', () => {
|
|
5
|
+
expect(toKebabCase('')).toBe('');
|
|
6
|
+
expect(toKebabCase(undefined)).toBe('');
|
|
7
|
+
expect(toKebabCase(null)).toBe('');
|
|
8
|
+
expect(toKebabCase([])).toBe('');
|
|
9
|
+
expect(toKebabCase({})).toBe('');
|
|
10
|
+
expect(toKebabCase(7)).toBe('');
|
|
11
|
+
expect(toKebabCase(78)).toBe('');
|
|
12
|
+
expect(toKebabCase(true)).toBe('');
|
|
13
|
+
expect(toKebabCase(false)).toBe('');
|
|
14
|
+
});
|
|
15
|
+
test('should format string values correctly', () => {
|
|
16
|
+
expect(toKebabCase('HelloWorld')).toBe('hello-world');
|
|
17
|
+
expect(toKebabCase('Hello4World')).toBe('hello-4-world');
|
|
18
|
+
expect(toKebabCase('Hello44World')).toBe('hello-44-world');
|
|
19
|
+
expect(toKebabCase('4World')).toBe('4-world');
|
|
20
|
+
expect(toKebabCase('4World4')).toBe('4-world-4');
|
|
21
|
+
expect(toKebabCase('World')).toBe('world');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -5,9 +5,12 @@ import { B as BEM } from './bem-8c7d2eb0.js';
|
|
|
5
5
|
import { L as Logger } from './log-dfd1c19f.js';
|
|
6
6
|
import { L as ListenToConfig } from './config.decorator-d18abfe1.js';
|
|
7
7
|
import { s as stopEventBubbling } from './form-input-28a08ec5.js';
|
|
8
|
+
import { h as isEnterKey, e as isSpaceKey } from './index.esm-83b1f9c4.js';
|
|
8
9
|
import './browser-a8073d92.js';
|
|
9
10
|
import './icons.constant-a7885631.js';
|
|
10
11
|
import './config.utils-6ac6c9bd.js';
|
|
12
|
+
import './index-82aff103.js';
|
|
13
|
+
import './_commonjsHelpers-1c8beb5f.js';
|
|
11
14
|
|
|
12
15
|
const balAccordionCss = ".bal-accordion{display:block;position:relative;width:100%}.bal-accordion--card-v1,.bal-accordion--card-v2{margin-top:var(--bal-space-medium)}@media screen and (min-width: 769px),print{.bal-accordion--card-v1,.bal-accordion--card-v2{margin-top:var(--bal-space-medium-tablet)}}@media screen and (min-width: 1024px){.bal-accordion--card-v1,.bal-accordion--card-v2{margin-top:var(--bal-space-medium-desktop)}}.bal-accordion--card-v2{padding-left:var(--bal-space-medium);padding-right:var(--bal-space-medium);padding-bottom:var(--bal-space-medium)}@media screen and (min-width: 769px),print{.bal-accordion--card-v2{padding-left:var(--bal-space-medium-tablet);padding-right:var(--bal-space-medium-tablet);padding-bottom:var(--bal-space-medium-tablet)}}@media screen and (min-width: 1024px){.bal-accordion--card-v2{padding-left:var(--bal-space-medium-desktop);padding-right:var(--bal-space-medium-desktop);padding-bottom:var(--bal-space-medium-desktop)}}.bal-accordion__wrapper{display:-ms-flexbox;display:flex;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.bal-accordion__trigger--card{margin-left:var(--bal-space-medium);margin-right:var(--bal-space-medium);margin-bottom:var(--bal-space-medium)}@media screen and (min-width: 769px),print{.bal-accordion__trigger--card{margin-left:var(--bal-space-medium-tablet);margin-right:var(--bal-space-medium-tablet);margin-bottom:var(--bal-space-medium-tablet)}}@media screen and (min-width: 1024px){.bal-accordion__trigger--card{margin-left:var(--bal-space-medium-desktop);margin-right:var(--bal-space-medium-desktop);margin-bottom:var(--bal-space-medium-desktop)}}.bal-accordion__content--card{margin-left:var(--bal-space-medium);margin-right:var(--bal-space-medium)}@media screen and (min-width: 769px),print{.bal-accordion__content--card{margin-left:var(--bal-space-medium-tablet);margin-right:var(--bal-space-medium-tablet)}}@media screen and (min-width: 1024px){.bal-accordion__content--card{margin-left:var(--bal-space-medium-desktop);margin-right:var(--bal-space-medium-desktop)}}.bal-accordion--animated{-webkit-transition:all var(--bal-animation-transition-duration) var(--bal-animation-transition-easing);transition:all var(--bal-animation-transition-duration) var(--bal-animation-transition-easing)}.bal-accordion--animated .bal-accordion__content{-webkit-transition:max-height var(--bal-animation-transition-duration) var(--bal-animation-transition-easing);transition:max-height var(--bal-animation-transition-duration) var(--bal-animation-transition-easing)}.bal-accordion__content{overflow:hidden;will-change:max-height}.bal-accordion--collapsing .bal-accordion__content{max-height:0 !important}.bal-accordion--collapsed .bal-accordion__content{display:none}.bal-accordion--expanding .bal-accordion__content{max-height:0}@media (prefers-reduced-motion: reduce){.bal-accordion,.bal-accordion__content{-webkit-transition:none !important;transition:none !important}}";
|
|
13
16
|
const BalAccordionStyle0 = balAccordionCss;
|
|
@@ -359,7 +362,7 @@ __decorate([
|
|
|
359
362
|
let accordionDetailIds = 0;
|
|
360
363
|
AccordionDetails.style = BalAccordionDetailsStyle0;
|
|
361
364
|
|
|
362
|
-
const balAccordionSummaryCss = ".bal-accordion__summary{position:static}.bal-accordion__summary--trigger{cursor:pointer}";
|
|
365
|
+
const balAccordionSummaryCss = "@media (hover: hover)and (pointer: fine){.bal-accordion__summary--trigger:focus-visible{-webkit-box-shadow:var(--bal-focus-shadow) !important;box-shadow:var(--bal-focus-shadow) !important}}.bal-accordion__summary{position:static;display:block}.bal-accordion__summary--trigger{cursor:pointer}";
|
|
363
366
|
const BalAccordionSummaryStyle0 = balAccordionSummaryCss;
|
|
364
367
|
|
|
365
368
|
const AccordionSummary = class {
|
|
@@ -380,6 +383,13 @@ const AccordionSummary = class {
|
|
|
380
383
|
stopEventBubbling(ev);
|
|
381
384
|
(_a = this.parentAccordionElement) === null || _a === void 0 ? void 0 : _a.humanToggle();
|
|
382
385
|
};
|
|
386
|
+
this.onKeyDown = (ev) => {
|
|
387
|
+
var _a;
|
|
388
|
+
if (isEnterKey(ev) || isSpaceKey(ev)) {
|
|
389
|
+
stopEventBubbling(ev);
|
|
390
|
+
(_a = this.parentAccordionElement) === null || _a === void 0 ? void 0 : _a.humanToggle();
|
|
391
|
+
}
|
|
392
|
+
};
|
|
383
393
|
this.parentAccordionId = undefined;
|
|
384
394
|
this.trigger = false;
|
|
385
395
|
this.active = false;
|
|
@@ -428,12 +438,14 @@ const AccordionSummary = class {
|
|
|
428
438
|
attributes = {
|
|
429
439
|
'aria-controls': `${this.parentAccordionId}-details-content`,
|
|
430
440
|
'role': 'button',
|
|
441
|
+
'tabindex': 0,
|
|
431
442
|
'part': buttonPart,
|
|
432
443
|
'data-testid': 'bal-accordion-button',
|
|
433
444
|
'onClick': this.onClick,
|
|
445
|
+
'onKeyDown': this.onKeyDown,
|
|
434
446
|
};
|
|
435
447
|
}
|
|
436
|
-
return (h(Host, Object.assign({ id: id, class: Object.assign(Object.assign({}, block.class()), block.modifier('trigger').class(this.trigger)) }, attributes, { "data-testid": "bal-accordion-summary" })));
|
|
448
|
+
return (h(Host, Object.assign({ id: id, class: Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('trigger').class(this.trigger)), block.modifier('inner-trigger').class(!this.trigger)), { 'bal-focused': this.trigger }) }, attributes, { "data-testid": "bal-accordion-summary" })));
|
|
437
449
|
}
|
|
438
450
|
get el() { return getElement(this); }
|
|
439
451
|
};
|
|
@@ -446,7 +458,7 @@ __decorate([
|
|
|
446
458
|
let accordionSummaryIds = 0;
|
|
447
459
|
AccordionSummary.style = BalAccordionSummaryStyle0;
|
|
448
460
|
|
|
449
|
-
const balAccordionTriggerCss = ".bal-accordion__trigger{position:static}.bal-accordion__trigger__button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;background:rgba(0,0,0,0);border:none;height:3rem;width:3rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}";
|
|
461
|
+
const balAccordionTriggerCss = "@media (hover: hover)and (pointer: fine){.bal-accordion__trigger__button.bal-focused:focus-visible{-webkit-box-shadow:var(--bal-focus-shadow) !important;box-shadow:var(--bal-focus-shadow) !important}}.bal-accordion__trigger{position:static;display:block}.bal-accordion__trigger__button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;background:rgba(0,0,0,0);border:none;height:3rem;width:3rem;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}";
|
|
450
462
|
const BalAccordionTriggerStyle0 = balAccordionTriggerCss;
|
|
451
463
|
|
|
452
464
|
const AccordionTrigger = class {
|
|
@@ -499,6 +511,10 @@ const AccordionTrigger = class {
|
|
|
499
511
|
var _a;
|
|
500
512
|
return ((_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('bal-accordion')) || null;
|
|
501
513
|
}
|
|
514
|
+
get parentAccordionSummaryElement() {
|
|
515
|
+
var _a;
|
|
516
|
+
return ((_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('bal-accordion-summary')) || null;
|
|
517
|
+
}
|
|
502
518
|
/**
|
|
503
519
|
* RENDER
|
|
504
520
|
* ------------------------------------------------------
|
|
@@ -515,7 +531,16 @@ const AccordionTrigger = class {
|
|
|
515
531
|
}
|
|
516
532
|
const expanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
|
|
517
533
|
const buttonPart = expanded ? 'button expanded' : 'button';
|
|
518
|
-
|
|
534
|
+
const parentSummaryEl = this.parentAccordionSummaryElement;
|
|
535
|
+
let triggerAttributes = {
|
|
536
|
+
tabindex: -1,
|
|
537
|
+
};
|
|
538
|
+
if (parentSummaryEl && !parentSummaryEl.trigger) {
|
|
539
|
+
triggerAttributes = {
|
|
540
|
+
tabindex: 0,
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
return (h(Host, { id: id, class: Object.assign({}, block.class()) }, this.button ? (h("bal-button", { id: `${id}-button`, "aria-controls": `${this.parentAccordionId}-details-content`, part: buttonPart, "data-testid": "bal-accordion-trigger", expanded: true, icon: icon, iconTurn: turn, color: this.color, size: this.size, onClick: this.onClick }, label)) : (h("button", Object.assign({ class: Object.assign(Object.assign({}, block.element('button').class()), { 'bal-focused': parentSummaryEl && !parentSummaryEl.trigger }), id: `${id}-button`, "aria-controls": `${this.parentAccordionId}-details-content`, "aria-label": "accordion trigger", part: buttonPart, "data-testid": "bal-accordion-trigger", onClick: this.onClick }, triggerAttributes), h("bal-icon", { turn: turn, name: icon })))));
|
|
519
544
|
}
|
|
520
545
|
get el() { return getElement(this); }
|
|
521
546
|
};
|