@statistikzh/leu 0.26.0 → 0.28.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/.release-please-manifest.json +1 -1
- package/.storybook/main.ts +1 -1
- package/.storybook/preview.ts +6 -4
- package/.storybook/static/global.css +5 -0
- package/CHANGELOG.md +44 -0
- package/dist/{Accordion-B04QkmHz.js → Accordion-D9kLsiBW.js} +1 -1
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/{Button-BgNUxmo_.d.ts → Button-DcuvEVkC.d.ts} +14 -12
- package/dist/{Button-BkhqVjug.js → Button-DyNVOHCd.js} +90 -82
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/{ButtonGroup-B8U9fDvM.js → ButtonGroup-MEh4vb5a.js} +2 -2
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +5 -5
- package/dist/{ChartWrapper-CSMFwz9e.js → ChartWrapper-DAl91BIN.js} +2 -2
- package/dist/ChartWrapper.d.ts +3 -3
- package/dist/ChartWrapper.js +3 -3
- package/dist/{Checkbox-Dd1QLpfn.js → Checkbox-CGGyUW9U.js} +2 -2
- package/dist/Checkbox.d.ts +3 -3
- package/dist/Checkbox.js +3 -3
- package/dist/{CheckboxGroup-Bz2eWEFL.js → CheckboxGroup-DXt5iMdj.js} +2 -2
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.js +4 -4
- package/dist/{Chip-XAQIIsXq.js → Chip-BGs71WGH.js} +1 -1
- package/dist/{Chip-DLKM9P7v.d.ts → Chip-DVGjEPJE.d.ts} +1 -1
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.js +2 -2
- package/dist/{ChipGroup-Ta8Ht4jc.d.ts → ChipGroup-BK5BYM0X.d.ts} +2 -2
- package/dist/{ChipGroup-DLqfK2kn.js → ChipGroup-BcGyusP-.js} +1 -1
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.js +3 -3
- package/dist/{ChipLink-BAxyQO2M.d.ts → ChipLink-BdG2o-nk.d.ts} +1 -1
- package/dist/ChipLink.d.ts +1 -1
- package/dist/ChipLink.js +2 -2
- package/dist/{ChipRemovable-DBjwt0CH.d.ts → ChipRemovable-CCwSQTAL.d.ts} +2 -2
- package/dist/ChipRemovable.d.ts +1 -1
- package/dist/ChipRemovable.js +3 -3
- package/dist/{ChipSelectable-CMJNcE4U.d.ts → ChipSelectable-BQ3VLVi5.d.ts} +1 -1
- package/dist/ChipSelectable.d.ts +1 -1
- package/dist/ChipSelectable.js +2 -2
- package/dist/{Dialog-DHuXR_oo.js → Dialog-BzuyL1U3.js} +2 -2
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js +3 -3
- package/dist/{Dropdown-DtFTePbc.js → Dropdown-plyBTM15.js} +5 -5
- package/dist/Dropdown.d.ts +6 -6
- package/dist/Dropdown.js +8 -8
- package/dist/{FileInput-b8sbLDPI.js → FileInput-BT3Fe-0J.js} +22 -7
- package/dist/FileInput.d.ts +16 -5
- package/dist/FileInput.js +6 -6
- package/dist/{Icon-Op80LrrO.d.ts → Icon-CUfh3eb3.d.ts} +1 -1
- package/dist/{Icon-C_yYuynf.js → Icon-D83qesg5.js} +1 -1
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +2 -2
- package/dist/{Input-DEOVocTa.js → Input-D7zS50oz.js} +32 -11
- package/dist/{Input-D2THgo7c.d.ts → Input-fEiQvGDF.d.ts} +9 -5
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +3 -3
- package/dist/{LeuElement-BeFrgKes.js → LeuElement-DQI8cqZV.js} +1 -1
- package/dist/{Menu-BeqqtCw6.js → Menu-DRU1LiMM.js} +2 -2
- package/dist/{Menu-CQdx1ef3.d.ts → Menu-Z2b7dsB5.d.ts} +2 -2
- package/dist/Menu.d.ts +1 -1
- package/dist/Menu.js +4 -4
- package/dist/{MenuItem-DVg8-1Bq.js → MenuItem-DCttylRO.js} +2 -2
- package/dist/{MenuItem-QcgnRk_7.d.ts → MenuItem-LY4TRIho.d.ts} +2 -2
- package/dist/MenuItem.d.ts +1 -1
- package/dist/MenuItem.js +3 -3
- package/dist/{Message-BhknWvAF.js → Message-0NxnKEqw.js} +2 -2
- package/dist/Message.d.ts +2 -2
- package/dist/Message.js +3 -3
- package/dist/{Pagination-CqkHh-Vd.d.ts → Pagination-9eZ8WMvR.d.ts} +4 -4
- package/dist/{Pagination-DJI5MIi_.js → Pagination-CIy7YvWE.js} +4 -4
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +6 -6
- package/dist/{Placeholder-BJybFwSg.js → Placeholder-Dol_X5Hp.js} +1 -1
- package/dist/Placeholder.d.ts +1 -1
- package/dist/Placeholder.js +2 -2
- package/dist/{Popup-Btgm2a3D.d.ts → Popup-B5iDSLIO.d.ts} +1 -1
- package/dist/{Popup-DNlm_9AA.js → Popup-nJrJHGSy.js} +1 -1
- package/dist/Popup.d.ts +1 -1
- package/dist/Popup.js +2 -2
- package/dist/{ProgressBar-B0wYj1KF.js → ProgressBar-Dmq9veqU.js} +1 -1
- package/dist/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/{Radio-DMCL8c4D.js → Radio-W5ck_IJI.js} +1 -1
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-CM6IyBlq.js → RadioGroup-De5x2YCO.js} +2 -2
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +3 -3
- package/dist/{Range-B72rtfln.js → Range-NCdfDkeD.js} +1 -1
- package/dist/Range.d.ts +1 -1
- package/dist/Range.js +2 -2
- package/dist/{ScrollTop-BFAqBVDR.js → ScrollTop-DwcNIKmN.js} +20 -20
- package/dist/ScrollTop.d.ts +8 -8
- package/dist/ScrollTop.js +5 -5
- package/dist/{Select-vxl3BvD4.js → Select-Bpicra9q.js} +153 -134
- package/dist/Select.d.ts +80 -78
- package/dist/Select.js +9 -9
- package/dist/{Spinner-DDTqijTO.js → Spinner-BBiVZxFH.js} +1 -1
- package/dist/{Spinner-CrM1enM0.d.ts → Spinner-DHYaX6-Y.d.ts} +1 -1
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +2 -2
- package/dist/Tab-CN97q0nj.d.ts +30 -0
- package/dist/Tab-Ce9nrDok.js +117 -0
- package/dist/Tab.d.ts +2 -0
- package/dist/Tab.js +3 -0
- package/dist/TabGroup-C-cd4Wcx.js +248 -0
- package/dist/TabGroup.d.ts +64 -0
- package/dist/TabGroup.js +5 -0
- package/dist/TabPanel-BW1ydVBT.js +65 -0
- package/dist/TabPanel-DQgWP7LO.d.ts +26 -0
- package/dist/TabPanel.d.ts +2 -0
- package/dist/TabPanel.js +3 -0
- package/dist/{Table-BgCxfBcm.js → Table-DiYqIzBu.js} +3 -3
- package/dist/Table.d.ts +3 -3
- package/dist/Table.js +7 -7
- package/dist/{Tag-DK2KkPIQ.js → Tag-Ct8Hhv7W.js} +1 -1
- package/dist/Tag.d.ts +1 -1
- package/dist/Tag.js +2 -2
- package/dist/{VisuallyHidden-OeQvhxYn.d.ts → VisuallyHidden-CB7aRJzF.d.ts} +1 -1
- package/dist/{VisuallyHidden-pll3amXE.js → VisuallyHidden-CpYXyuC7.js} +1 -1
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.js +2 -2
- package/dist/index.d.ts +14 -14
- package/dist/index.js +30 -30
- package/dist/leu-accordion.js +2 -2
- package/dist/leu-button-group.js +5 -5
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.js +4 -4
- package/dist/leu-chart-wrapper.js +3 -3
- package/dist/leu-checkbox-group.js +4 -4
- package/dist/leu-checkbox.js +3 -3
- package/dist/leu-chip-group.d.ts +1 -1
- package/dist/leu-chip-group.js +3 -3
- package/dist/leu-chip-link.d.ts +1 -1
- package/dist/leu-chip-link.js +2 -2
- package/dist/leu-chip-removable.d.ts +1 -1
- package/dist/leu-chip-removable.js +3 -3
- package/dist/leu-chip-selectable.d.ts +1 -1
- package/dist/leu-chip-selectable.js +2 -2
- package/dist/leu-dialog.js +3 -3
- package/dist/leu-dropdown.js +8 -8
- package/dist/leu-file-input.js +6 -6
- package/dist/leu-icon.d.ts +1 -1
- package/dist/leu-icon.js +2 -2
- package/dist/leu-input.d.ts +1 -1
- package/dist/leu-input.js +3 -3
- package/dist/leu-menu-item.d.ts +1 -1
- package/dist/leu-menu-item.js +3 -3
- package/dist/leu-menu.d.ts +1 -1
- package/dist/leu-menu.js +4 -4
- package/dist/leu-message.js +3 -3
- package/dist/leu-pagination.d.ts +1 -1
- package/dist/leu-pagination.js +6 -6
- package/dist/leu-placeholder.js +2 -2
- package/dist/leu-popup.d.ts +1 -1
- package/dist/leu-popup.js +2 -2
- package/dist/leu-progress-bar.js +2 -2
- package/dist/leu-radio-group.js +3 -3
- package/dist/leu-radio.js +2 -2
- package/dist/leu-range.js +2 -2
- package/dist/leu-scroll-top.js +5 -5
- package/dist/leu-select.js +9 -9
- package/dist/leu-spinner.d.ts +1 -1
- package/dist/leu-spinner.js +2 -2
- package/dist/leu-tab-group.d.ts +10 -0
- package/dist/leu-tab-group.js +8 -0
- package/dist/leu-tab-panel.d.ts +10 -0
- package/dist/leu-tab-panel.js +6 -0
- package/dist/leu-tab.d.ts +10 -0
- package/dist/leu-tab.js +6 -0
- package/dist/leu-table.js +7 -7
- package/dist/leu-tag.js +2 -2
- package/dist/leu-visually-hidden.d.ts +1 -1
- package/dist/leu-visually-hidden.js +2 -2
- package/dist/vscode.html-custom-data.json +90 -35
- package/dist/vue/index.d.ts +89 -29
- package/dist/web-types.json +182 -76
- package/package.json +1 -2
- package/src/components/button/Button.ts +45 -30
- package/src/components/button/button.css +55 -54
- package/src/components/button/stories/button.stories.ts +17 -20
- package/src/components/button/test/button.test.ts +46 -0
- package/src/components/file-input/FileInput.ts +24 -5
- package/src/components/input/Input.ts +43 -8
- package/src/components/input/test/input.test.ts +106 -1
- package/src/components/scroll-top/ScrollTop.ts +18 -16
- package/src/components/select/Select.ts +198 -125
- package/src/components/select/select.css +4 -0
- package/src/components/select/stories/select.stories.ts +10 -0
- package/src/components/select/test/select.test.ts +440 -35
- package/src/components/tab/Tab.ts +72 -0
- package/src/components/tab/TabGroup.ts +267 -0
- package/src/components/tab/TabPanel.ts +59 -0
- package/src/components/tab/leu-tab-group.ts +11 -0
- package/src/components/tab/leu-tab-panel.ts +11 -0
- package/src/components/tab/leu-tab.ts +11 -0
- package/src/components/tab/stories/tab.stories.ts +97 -0
- package/src/components/tab/tab-group.css +63 -0
- package/src/components/tab/tab-panel.css +10 -0
- package/src/components/tab/tab.css +54 -0
- package/src/components/tab/test/tab-group.test.ts +426 -0
- package/src/components/tab/test/tab-panel.test.ts +102 -0
- package/src/components/tab/test/tab.test.ts +139 -0
- package/tsconfig.json +1 -0
- /package/dist/{FormAssociatedMixin-Cc74LjbC.d.ts → FormAssociatedMixin-Cw7LsSUE.d.ts} +0 -0
- /package/dist/{LeuElement-pJFU18Xm.d.ts → LeuElement-DK1jntuu.d.ts} +0 -0
- /package/dist/{hasSlotController-DWPyZ52b.d.ts → hasSlotController-BjKyhJm-.d.ts} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DK1jntuu.js";
|
|
2
|
+
import { PropertyValues } from "lit";
|
|
3
|
+
import * as lit_html0 from "lit-html";
|
|
4
|
+
|
|
5
|
+
//#region src/components/tab/Tab.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Tab Button.
|
|
8
|
+
*
|
|
9
|
+
* @prop {string} name - Name to link Button and Panel together
|
|
10
|
+
* @prop {boolean} active - Is active
|
|
11
|
+
*
|
|
12
|
+
* @tagname leu-tab
|
|
13
|
+
*/
|
|
14
|
+
declare class LeuTab extends LeuElement {
|
|
15
|
+
static styles: any[];
|
|
16
|
+
protected readonly componentId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Name of the tab. Apply the same name to the corresponding panel to link them together.
|
|
19
|
+
* Has to be unique within the tab component.
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
active: boolean;
|
|
23
|
+
connectedCallback(): void;
|
|
24
|
+
disconnectedCallback(): void;
|
|
25
|
+
handleClick(): void;
|
|
26
|
+
updated(changedProperties: PropertyValues<this>): void;
|
|
27
|
+
render(): lit_html0.TemplateResult<1>;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { LeuTab as t };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DwpAc4D0.js";
|
|
3
|
+
import { css, html } from "lit";
|
|
4
|
+
import { property } from "lit/decorators.js";
|
|
5
|
+
//#region src/components/tab/tab.css?inline
|
|
6
|
+
var tab_default = css`:host {
|
|
7
|
+
--tab-button-font-regular: var(--leu-font-family-regular);
|
|
8
|
+
|
|
9
|
+
--tab-button-active-background: var(--leu-color-black-100);
|
|
10
|
+
--tab-button-active-color: var(--leu-color-black-0);
|
|
11
|
+
|
|
12
|
+
--tab-button-inactive-background: var(--leu-color-black-transp-10);
|
|
13
|
+
--tab-button-inactive-color: var(--leu-color-black-transp-60);
|
|
14
|
+
|
|
15
|
+
--tab-button-hover-background: var(--leu-color-black-transp-20);
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
font-family: var(--tab-button-font-regular);
|
|
21
|
+
background: var(--tab-button-inactive-background);
|
|
22
|
+
color: var(--tab-button-inactive-color);
|
|
23
|
+
border: 0;
|
|
24
|
+
border-radius: 0.25rem;
|
|
25
|
+
padding: 0.5rem 0.75rem;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
}
|
|
30
|
+
@media (min-width: 1024px) {
|
|
31
|
+
:host {
|
|
32
|
+
padding-left: 1rem;
|
|
33
|
+
padding-right: 1rem;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
:host(:hover) {
|
|
37
|
+
background: var(--tab-button-hover-background);
|
|
38
|
+
}
|
|
39
|
+
:host(:focus-visible) {
|
|
40
|
+
outline: 2px solid var(--leu-color-func-cyan);
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
}
|
|
43
|
+
:host([active]) {
|
|
44
|
+
background: var(--tab-button-active-background);
|
|
45
|
+
color: var(--tab-button-active-color);
|
|
46
|
+
}
|
|
47
|
+
.label {
|
|
48
|
+
font-size: 1rem;
|
|
49
|
+
line-height: 1.5rem;
|
|
50
|
+
}
|
|
51
|
+
@media (min-width: 1024px) {
|
|
52
|
+
.label {
|
|
53
|
+
font-size: 1.125rem;
|
|
54
|
+
line-height: 1.75rem;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/components/tab/Tab.ts
|
|
60
|
+
let nextId = 1;
|
|
61
|
+
/**
|
|
62
|
+
* Tab Button.
|
|
63
|
+
*
|
|
64
|
+
* @prop {string} name - Name to link Button and Panel together
|
|
65
|
+
* @prop {boolean} active - Is active
|
|
66
|
+
*
|
|
67
|
+
* @tagname leu-tab
|
|
68
|
+
*/
|
|
69
|
+
var LeuTab = class extends LeuElement {
|
|
70
|
+
constructor(..._args) {
|
|
71
|
+
super(..._args);
|
|
72
|
+
this.componentId = `leu-tab-${nextId++}`;
|
|
73
|
+
this.name = "";
|
|
74
|
+
this.active = false;
|
|
75
|
+
}
|
|
76
|
+
static {
|
|
77
|
+
this.styles = [LeuElement.styles, tab_default];
|
|
78
|
+
}
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
super.connectedCallback();
|
|
81
|
+
this.setAttribute("role", "tab");
|
|
82
|
+
this.addEventListener("click", this.handleClick);
|
|
83
|
+
this.id = this.id.length > 0 ? this.id : this.componentId;
|
|
84
|
+
}
|
|
85
|
+
disconnectedCallback() {
|
|
86
|
+
super.disconnectedCallback();
|
|
87
|
+
this.removeEventListener("click", this.handleClick);
|
|
88
|
+
}
|
|
89
|
+
handleClick() {
|
|
90
|
+
if (this.active) return;
|
|
91
|
+
this.active = true;
|
|
92
|
+
this.dispatchEvent(new CustomEvent("leu:tab-select", {
|
|
93
|
+
detail: { name: this.name },
|
|
94
|
+
bubbles: true,
|
|
95
|
+
composed: true
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
updated(changedProperties) {
|
|
99
|
+
if (changedProperties.has("active")) {
|
|
100
|
+
this.ariaSelected = this.active ? "true" : "false";
|
|
101
|
+
this.tabIndex = this.active ? 0 : -1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
render() {
|
|
105
|
+
return html`<span class="label"><slot></slot></span>`;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
__decorate([property({
|
|
109
|
+
type: String,
|
|
110
|
+
reflect: true
|
|
111
|
+
})], LeuTab.prototype, "name", void 0);
|
|
112
|
+
__decorate([property({
|
|
113
|
+
type: Boolean,
|
|
114
|
+
reflect: true
|
|
115
|
+
})], LeuTab.prototype, "active", void 0);
|
|
116
|
+
//#endregion
|
|
117
|
+
export { LeuTab as t };
|
package/dist/Tab.d.ts
ADDED
package/dist/Tab.js
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DwpAc4D0.js";
|
|
3
|
+
import { t as LeuTab } from "./Tab-Ce9nrDok.js";
|
|
4
|
+
import { t as LeuTabPanel } from "./TabPanel-BW1ydVBT.js";
|
|
5
|
+
import { css, html } from "lit";
|
|
6
|
+
import { property, state } from "lit/decorators.js";
|
|
7
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
8
|
+
import { createRef, ref } from "lit/directives/ref.js";
|
|
9
|
+
//#region src/components/tab/tab-group.css?inline
|
|
10
|
+
var tab_group_default = css`:host {
|
|
11
|
+
--tab-font-regular: var(--leu-font-family-regular);
|
|
12
|
+
--tab-font-black: var(--leu-font-family-black);
|
|
13
|
+
|
|
14
|
+
font-family: var(--tab-font-regular);
|
|
15
|
+
}
|
|
16
|
+
.container {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
.container::before,
|
|
21
|
+
.container::after {
|
|
22
|
+
content: "";
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
height: 100%;
|
|
26
|
+
width: 0.375rem;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
visibility: hidden;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
transition: 0.2s ease;
|
|
31
|
+
transition-property: visibility, opacity;
|
|
32
|
+
}
|
|
33
|
+
.container::before {
|
|
34
|
+
left: 0;
|
|
35
|
+
background: linear-gradient(to right, rgba(0, 0, 0, 0.2), transparent);
|
|
36
|
+
}
|
|
37
|
+
.container::after {
|
|
38
|
+
right: 0;
|
|
39
|
+
background: linear-gradient(to left, rgba(0, 0, 0, 0.2), transparent);
|
|
40
|
+
}
|
|
41
|
+
.container--scrollable-left::before,
|
|
42
|
+
.container--scrollable-right::after {
|
|
43
|
+
visibility: visible;
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
.tab-menu {
|
|
47
|
+
display: flex;
|
|
48
|
+
gap: 0.5rem;
|
|
49
|
+
padding: 0.5rem 0;
|
|
50
|
+
margin-bottom: 1.5rem;
|
|
51
|
+
border-bottom: 1px solid var(--leu-color-black-transp-10);
|
|
52
|
+
|
|
53
|
+
overflow: auto;
|
|
54
|
+
scrollbar-width: thin;
|
|
55
|
+
}
|
|
56
|
+
@media (min-width: 1024px) {
|
|
57
|
+
.tab-menu {
|
|
58
|
+
margin-bottom: 2rem;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
@media (min-width: 1280px) {
|
|
62
|
+
.tab-menu {
|
|
63
|
+
padding: 1rem 0;
|
|
64
|
+
margin-bottom: 2.5rem;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/components/tab/TabGroup.ts
|
|
70
|
+
/**
|
|
71
|
+
* Tab Group
|
|
72
|
+
*
|
|
73
|
+
* @slot tabs - Slot for the leu-tab elements
|
|
74
|
+
* @slot panels - Slot for the leu-tab-panel elements
|
|
75
|
+
* @todo: add disabled state to tabs and panels
|
|
76
|
+
* @todo: add backdrop / shadow
|
|
77
|
+
* @todo: add styling option for full-bleed layout (tabslist is full-bleed, panels use the full width of the container)
|
|
78
|
+
*
|
|
79
|
+
* @tagname leu-tab-group
|
|
80
|
+
*/
|
|
81
|
+
var LeuTabGroup = class extends LeuElement {
|
|
82
|
+
constructor(..._args) {
|
|
83
|
+
super(..._args);
|
|
84
|
+
this.label = "";
|
|
85
|
+
this.active = "";
|
|
86
|
+
this.isScrollable = {
|
|
87
|
+
left: false,
|
|
88
|
+
right: false
|
|
89
|
+
};
|
|
90
|
+
this.tabs = [];
|
|
91
|
+
this.panels = [];
|
|
92
|
+
this.initialShowEventDispatched = false;
|
|
93
|
+
this.tabMenuRef = createRef();
|
|
94
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
95
|
+
this.checkScrollable();
|
|
96
|
+
});
|
|
97
|
+
this.mutationObserver = new MutationObserver((records) => {
|
|
98
|
+
for (const record of records) {
|
|
99
|
+
if (!(record.target instanceof HTMLElement)) continue;
|
|
100
|
+
if (record.type === "attributes" && record.attributeName === "id" && record.target.matches("leu-tab, leu-tab-panel")) {
|
|
101
|
+
this.linkTabsAndPanels();
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
static {
|
|
108
|
+
this.styles = [LeuElement.styles, tab_group_default];
|
|
109
|
+
}
|
|
110
|
+
connectedCallback() {
|
|
111
|
+
super.connectedCallback();
|
|
112
|
+
}
|
|
113
|
+
disconnectedCallback() {
|
|
114
|
+
super.disconnectedCallback();
|
|
115
|
+
this.resizeObserver.disconnect();
|
|
116
|
+
this.mutationObserver.disconnect();
|
|
117
|
+
}
|
|
118
|
+
firstUpdated() {
|
|
119
|
+
if (this.tabMenuRef.value) this.resizeObserver.observe(this.tabMenuRef.value);
|
|
120
|
+
this.mutationObserver.observe(this, {
|
|
121
|
+
subtree: true,
|
|
122
|
+
attributes: true,
|
|
123
|
+
attributeFilter: ["id"]
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
updated(changedProperties) {
|
|
127
|
+
if (changedProperties.has("active") || changedProperties.has("tabs") || changedProperties.has("panels")) {
|
|
128
|
+
this.updatePanels();
|
|
129
|
+
this.updateTabs();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async handleTabsSlotChange() {
|
|
133
|
+
this.tabs = (this.shadowRoot?.querySelector("slot[name=\"tabs\"]"))?.assignedElements({ flatten: true }).filter((el) => el instanceof LeuTab) ?? [];
|
|
134
|
+
if (this.tabs.length > 0 && !this.tabs.some((tab) => tab.name === this.active)) this.active = this.tabs[0].name;
|
|
135
|
+
this.linkTabsAndPanels();
|
|
136
|
+
await this.updateComplete;
|
|
137
|
+
this.checkScrollable();
|
|
138
|
+
}
|
|
139
|
+
handlePanelsSlotChange() {
|
|
140
|
+
this.panels = (this.shadowRoot?.querySelector("slot[name=\"panels\"]"))?.assignedElements({ flatten: true }).filter((el) => el instanceof LeuTabPanel) ?? [];
|
|
141
|
+
this.linkTabsAndPanels();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Link tabs and panels by setting the appropriate aria attributes.
|
|
145
|
+
* Generates global ids for tabs and panels if they don't have one.
|
|
146
|
+
*/
|
|
147
|
+
linkTabsAndPanels() {
|
|
148
|
+
for (const tab of this.tabs) {
|
|
149
|
+
const panel = this.panels.find((o) => o.name === tab.name);
|
|
150
|
+
if (!panel) continue;
|
|
151
|
+
tab.setAttribute("aria-controls", panel.id);
|
|
152
|
+
panel.setAttribute("aria-labelledby", tab.id);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
get activeTab() {
|
|
156
|
+
return this.tabs.find((o) => o.active);
|
|
157
|
+
}
|
|
158
|
+
get activePanel() {
|
|
159
|
+
return this.panels.find((o) => o.name === this.activeTab?.name);
|
|
160
|
+
}
|
|
161
|
+
updatePanels() {
|
|
162
|
+
for (const panel of this.panels) panel.active = panel.name === this.active;
|
|
163
|
+
}
|
|
164
|
+
updateTabs() {
|
|
165
|
+
for (const tab of this.tabs) tab.active = tab.name === this.active;
|
|
166
|
+
}
|
|
167
|
+
async keydownHandler(event) {
|
|
168
|
+
const activeTab = this.activeTab;
|
|
169
|
+
let nextTab = null;
|
|
170
|
+
if (![
|
|
171
|
+
"ArrowRight",
|
|
172
|
+
"ArrowLeft",
|
|
173
|
+
"Home",
|
|
174
|
+
"End"
|
|
175
|
+
].includes(event.key) || !activeTab) return;
|
|
176
|
+
switch (event.key) {
|
|
177
|
+
case "ArrowRight":
|
|
178
|
+
case "ArrowLeft": {
|
|
179
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
180
|
+
const currentIndex = this.tabs.indexOf(activeTab);
|
|
181
|
+
const numOfTabs = this.tabs.length;
|
|
182
|
+
const nextIndex = (currentIndex + direction + numOfTabs) % numOfTabs;
|
|
183
|
+
nextTab = this.tabs[nextIndex];
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case "Home":
|
|
187
|
+
nextTab = this.tabs[0];
|
|
188
|
+
break;
|
|
189
|
+
case "End":
|
|
190
|
+
nextTab = this.tabs[this.tabs.length - 1];
|
|
191
|
+
break;
|
|
192
|
+
default: return;
|
|
193
|
+
}
|
|
194
|
+
this.active = nextTab.name;
|
|
195
|
+
await this.updateComplete;
|
|
196
|
+
nextTab.focus();
|
|
197
|
+
nextTab.scrollIntoView({
|
|
198
|
+
block: "nearest",
|
|
199
|
+
inline: "nearest"
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
checkScrollable() {
|
|
203
|
+
const tabMenu = this.tabMenuRef.value;
|
|
204
|
+
if (!tabMenu) return;
|
|
205
|
+
this.isScrollable = {
|
|
206
|
+
left: tabMenu.scrollLeft > 0,
|
|
207
|
+
right: tabMenu.scrollLeft < tabMenu.scrollWidth - tabMenu.clientWidth
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
handleScrollEvent() {
|
|
211
|
+
this.checkScrollable();
|
|
212
|
+
}
|
|
213
|
+
handleTabSelect(event) {
|
|
214
|
+
this.active = event.detail.name;
|
|
215
|
+
}
|
|
216
|
+
render() {
|
|
217
|
+
return html`
|
|
218
|
+
<div class=${classMap({
|
|
219
|
+
container: true,
|
|
220
|
+
"container--scrollable-left": this.isScrollable.left,
|
|
221
|
+
"container--scrollable-right": this.isScrollable.right
|
|
222
|
+
})}>
|
|
223
|
+
<div
|
|
224
|
+
class="tab-menu"
|
|
225
|
+
role="tablist"
|
|
226
|
+
@keydown=${this.keydownHandler}
|
|
227
|
+
@leu:tab-select=${this.handleTabSelect}
|
|
228
|
+
@scroll="${this.handleScrollEvent}"
|
|
229
|
+
aria-label=${this.label}
|
|
230
|
+
${ref(this.tabMenuRef)}
|
|
231
|
+
>
|
|
232
|
+
<slot name="tabs" @slotchange=${this.handleTabsSlotChange}></slot>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
<slot name="panels" @slotchange=${this.handlePanelsSlotChange}></slot>
|
|
236
|
+
`;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
__decorate([property({ type: String })], LeuTabGroup.prototype, "label", void 0);
|
|
240
|
+
__decorate([property({
|
|
241
|
+
type: String,
|
|
242
|
+
reflect: true
|
|
243
|
+
})], LeuTabGroup.prototype, "active", void 0);
|
|
244
|
+
__decorate([state()], LeuTabGroup.prototype, "isScrollable", void 0);
|
|
245
|
+
__decorate([state()], LeuTabGroup.prototype, "tabs", void 0);
|
|
246
|
+
__decorate([state()], LeuTabGroup.prototype, "panels", void 0);
|
|
247
|
+
//#endregion
|
|
248
|
+
export { LeuTabGroup as t };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DK1jntuu.js";
|
|
2
|
+
import { t as LeuTab } from "./Tab-CN97q0nj.js";
|
|
3
|
+
import { t as LeuTabPanel } from "./TabPanel-DQgWP7LO.js";
|
|
4
|
+
import { PropertyValues } from "lit";
|
|
5
|
+
import * as lit_html0 from "lit-html";
|
|
6
|
+
import * as lit_html_directives_ref_js0 from "lit-html/directives/ref.js";
|
|
7
|
+
|
|
8
|
+
//#region src/components/tab/TabGroup.d.ts
|
|
9
|
+
type ScrollableState = {
|
|
10
|
+
left: boolean;
|
|
11
|
+
right: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Tab Group
|
|
15
|
+
*
|
|
16
|
+
* @slot tabs - Slot for the leu-tab elements
|
|
17
|
+
* @slot panels - Slot for the leu-tab-panel elements
|
|
18
|
+
* @todo: add disabled state to tabs and panels
|
|
19
|
+
* @todo: add backdrop / shadow
|
|
20
|
+
* @todo: add styling option for full-bleed layout (tabslist is full-bleed, panels use the full width of the container)
|
|
21
|
+
*
|
|
22
|
+
* @tagname leu-tab-group
|
|
23
|
+
*/
|
|
24
|
+
declare class LeuTabGroup extends LeuElement {
|
|
25
|
+
static styles: any[];
|
|
26
|
+
/**
|
|
27
|
+
* Label for the tab list, used for accessibility.
|
|
28
|
+
* Content will not be visible on the page, but should be provided for screen readers.
|
|
29
|
+
*/
|
|
30
|
+
label: string;
|
|
31
|
+
/**
|
|
32
|
+
* Name of the active/selected tab and panel. Has to match the name property of a leu-tab and leu-tab-panel.
|
|
33
|
+
*/
|
|
34
|
+
active: string;
|
|
35
|
+
protected isScrollable: ScrollableState;
|
|
36
|
+
protected tabs: LeuTab[];
|
|
37
|
+
protected panels: LeuTabPanel[];
|
|
38
|
+
protected initialShowEventDispatched: boolean;
|
|
39
|
+
protected tabMenuRef: lit_html_directives_ref_js0.Ref<HTMLDivElement>;
|
|
40
|
+
protected resizeObserver: ResizeObserver;
|
|
41
|
+
protected mutationObserver: MutationObserver;
|
|
42
|
+
connectedCallback(): void;
|
|
43
|
+
disconnectedCallback(): void;
|
|
44
|
+
firstUpdated(): void;
|
|
45
|
+
updated(changedProperties: PropertyValues): void;
|
|
46
|
+
protected handleTabsSlotChange(): Promise<void>;
|
|
47
|
+
protected handlePanelsSlotChange(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Link tabs and panels by setting the appropriate aria attributes.
|
|
50
|
+
* Generates global ids for tabs and panels if they don't have one.
|
|
51
|
+
*/
|
|
52
|
+
protected linkTabsAndPanels(): void;
|
|
53
|
+
protected get activeTab(): LeuTab;
|
|
54
|
+
protected get activePanel(): LeuTabPanel;
|
|
55
|
+
protected updatePanels(): void;
|
|
56
|
+
protected updateTabs(): void;
|
|
57
|
+
protected keydownHandler(event: KeyboardEvent): Promise<void>;
|
|
58
|
+
protected checkScrollable(): void;
|
|
59
|
+
protected handleScrollEvent(): void;
|
|
60
|
+
protected handleTabSelect(event: CustomEvent): void;
|
|
61
|
+
render(): lit_html0.TemplateResult<1>;
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { LeuTabGroup };
|
package/dist/TabGroup.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DwpAc4D0.js";
|
|
3
|
+
import { css, html } from "lit";
|
|
4
|
+
import { property } from "lit/decorators.js";
|
|
5
|
+
//#region src/components/tab/tab-panel.css?inline
|
|
6
|
+
var tab_panel_default = css`:host {
|
|
7
|
+
--tab-panel-font-regular: var(--leu-font-family-regular);
|
|
8
|
+
--tab-panel-font-black: var(--leu-font-family-black);
|
|
9
|
+
|
|
10
|
+
font-family: var(--tab-panel-font-regular);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([aria-hidden="true"]) {
|
|
14
|
+
display: none;
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/components/tab/TabPanel.ts
|
|
19
|
+
let nextId = 1;
|
|
20
|
+
/**
|
|
21
|
+
* Tab Panel
|
|
22
|
+
*
|
|
23
|
+
* @tagname leu-tab-panel
|
|
24
|
+
* @fires leu:show-tab-panel - Fired when a tab panel is shown
|
|
25
|
+
*/
|
|
26
|
+
var LeuTabPanel = class extends LeuElement {
|
|
27
|
+
constructor(..._args) {
|
|
28
|
+
super(..._args);
|
|
29
|
+
this.componentId = `leu-tab-panel-${nextId++}`;
|
|
30
|
+
this.name = "";
|
|
31
|
+
this.active = false;
|
|
32
|
+
}
|
|
33
|
+
static {
|
|
34
|
+
this.styles = [LeuElement.styles, tab_panel_default];
|
|
35
|
+
}
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
this.setAttribute("role", "tabpanel");
|
|
39
|
+
this.tabIndex = 0;
|
|
40
|
+
this.id = this.id.length > 0 ? this.id : this.componentId;
|
|
41
|
+
}
|
|
42
|
+
updated(changedProperties) {
|
|
43
|
+
if (changedProperties.has("active")) {
|
|
44
|
+
this.ariaHidden = this.active ? "false" : "true";
|
|
45
|
+
if (this.active) this.dispatchEvent(new CustomEvent("leu:show-tab-panel", {
|
|
46
|
+
detail: { name: this.name },
|
|
47
|
+
bubbles: true,
|
|
48
|
+
composed: true
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
return html`<slot></slot>`;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
__decorate([property({
|
|
57
|
+
type: String,
|
|
58
|
+
reflect: true
|
|
59
|
+
})], LeuTabPanel.prototype, "name", void 0);
|
|
60
|
+
__decorate([property({
|
|
61
|
+
type: Boolean,
|
|
62
|
+
reflect: true
|
|
63
|
+
})], LeuTabPanel.prototype, "active", void 0);
|
|
64
|
+
//#endregion
|
|
65
|
+
export { LeuTabPanel as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DK1jntuu.js";
|
|
2
|
+
import { PropertyValues } from "lit";
|
|
3
|
+
import * as lit_html0 from "lit-html";
|
|
4
|
+
|
|
5
|
+
//#region src/components/tab/TabPanel.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Tab Panel
|
|
8
|
+
*
|
|
9
|
+
* @tagname leu-tab-panel
|
|
10
|
+
* @fires leu:show-tab-panel - Fired when a tab panel is shown
|
|
11
|
+
*/
|
|
12
|
+
declare class LeuTabPanel extends LeuElement {
|
|
13
|
+
static styles: any[];
|
|
14
|
+
protected readonly componentId: string;
|
|
15
|
+
/**
|
|
16
|
+
* Name of the tab. Apply the same name to the corresponding tab button to link them together.
|
|
17
|
+
* Has to be unique within the tab component.
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
active: boolean;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
23
|
+
render(): lit_html0.TemplateResult<1>;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { LeuTabPanel as t };
|
package/dist/TabPanel.js
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as LeuElement } from "./LeuElement-
|
|
2
|
-
import { t as LeuIcon } from "./Icon-
|
|
3
|
-
import { t as LeuPagination } from "./Pagination-
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as LeuIcon } from "./Icon-D83qesg5.js";
|
|
3
|
+
import { t as LeuPagination } from "./Pagination-CIy7YvWE.js";
|
|
4
4
|
import { css, html, noChange, nothing } from "lit";
|
|
5
5
|
import { classMap } from "lit/directives/class-map.js";
|
|
6
6
|
import { createRef, ref } from "lit/directives/ref.js";
|
package/dist/Table.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as LeuElement } from "./LeuElement-
|
|
2
|
-
import { t as LeuIcon } from "./Icon-
|
|
3
|
-
import { t as LeuPagination } from "./Pagination-
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DK1jntuu.js";
|
|
2
|
+
import { t as LeuIcon } from "./Icon-CUfh3eb3.js";
|
|
3
|
+
import { t as LeuPagination } from "./Pagination-9eZ8WMvR.js";
|
|
4
4
|
import * as lit_html0 from "lit-html";
|
|
5
5
|
|
|
6
6
|
//#region src/components/table/Table.d.ts
|
package/dist/Table.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import "./Icon-
|
|
3
|
-
import "./Spinner-
|
|
4
|
-
import "./Button-
|
|
1
|
+
import "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import "./Icon-D83qesg5.js";
|
|
3
|
+
import "./Spinner-BBiVZxFH.js";
|
|
4
|
+
import "./Button-DyNVOHCd.js";
|
|
5
5
|
import "./FormAssociatedMixin-DLPvFtbT.js";
|
|
6
|
-
import "./VisuallyHidden-
|
|
7
|
-
import "./Pagination-
|
|
8
|
-
import { t as LeuTable } from "./Table-
|
|
6
|
+
import "./VisuallyHidden-CpYXyuC7.js";
|
|
7
|
+
import "./Pagination-CIy7YvWE.js";
|
|
8
|
+
import { t as LeuTable } from "./Table-DiYqIzBu.js";
|
|
9
9
|
export { LeuTable };
|
package/dist/Tag.d.ts
CHANGED
package/dist/Tag.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuTag } from "./Tag-
|
|
1
|
+
import "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as LeuTag } from "./Tag-Ct8Hhv7W.js";
|
|
3
3
|
export { LeuTag };
|
package/dist/VisuallyHidden.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as LeuVisuallyHidden } from "./VisuallyHidden-
|
|
1
|
+
import { t as LeuVisuallyHidden } from "./VisuallyHidden-CB7aRJzF.js";
|
|
2
2
|
export { LeuVisuallyHidden };
|
package/dist/VisuallyHidden.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuVisuallyHidden } from "./VisuallyHidden-
|
|
1
|
+
import "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as LeuVisuallyHidden } from "./VisuallyHidden-CpYXyuC7.js";
|
|
3
3
|
export { LeuVisuallyHidden };
|