@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.
Files changed (209) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/.storybook/main.ts +1 -1
  3. package/.storybook/preview.ts +6 -4
  4. package/.storybook/static/global.css +5 -0
  5. package/CHANGELOG.md +44 -0
  6. package/dist/{Accordion-B04QkmHz.js → Accordion-D9kLsiBW.js} +1 -1
  7. package/dist/Accordion.d.ts +1 -1
  8. package/dist/Accordion.js +2 -2
  9. package/dist/{Button-BgNUxmo_.d.ts → Button-DcuvEVkC.d.ts} +14 -12
  10. package/dist/{Button-BkhqVjug.js → Button-DyNVOHCd.js} +90 -82
  11. package/dist/Button.d.ts +1 -1
  12. package/dist/Button.js +4 -4
  13. package/dist/{ButtonGroup-B8U9fDvM.js → ButtonGroup-MEh4vb5a.js} +2 -2
  14. package/dist/ButtonGroup.d.ts +1 -1
  15. package/dist/ButtonGroup.js +5 -5
  16. package/dist/{ChartWrapper-CSMFwz9e.js → ChartWrapper-DAl91BIN.js} +2 -2
  17. package/dist/ChartWrapper.d.ts +3 -3
  18. package/dist/ChartWrapper.js +3 -3
  19. package/dist/{Checkbox-Dd1QLpfn.js → Checkbox-CGGyUW9U.js} +2 -2
  20. package/dist/Checkbox.d.ts +3 -3
  21. package/dist/Checkbox.js +3 -3
  22. package/dist/{CheckboxGroup-Bz2eWEFL.js → CheckboxGroup-DXt5iMdj.js} +2 -2
  23. package/dist/CheckboxGroup.d.ts +1 -1
  24. package/dist/CheckboxGroup.js +4 -4
  25. package/dist/{Chip-XAQIIsXq.js → Chip-BGs71WGH.js} +1 -1
  26. package/dist/{Chip-DLKM9P7v.d.ts → Chip-DVGjEPJE.d.ts} +1 -1
  27. package/dist/Chip.d.ts +1 -1
  28. package/dist/Chip.js +2 -2
  29. package/dist/{ChipGroup-Ta8Ht4jc.d.ts → ChipGroup-BK5BYM0X.d.ts} +2 -2
  30. package/dist/{ChipGroup-DLqfK2kn.js → ChipGroup-BcGyusP-.js} +1 -1
  31. package/dist/ChipGroup.d.ts +1 -1
  32. package/dist/ChipGroup.js +3 -3
  33. package/dist/{ChipLink-BAxyQO2M.d.ts → ChipLink-BdG2o-nk.d.ts} +1 -1
  34. package/dist/ChipLink.d.ts +1 -1
  35. package/dist/ChipLink.js +2 -2
  36. package/dist/{ChipRemovable-DBjwt0CH.d.ts → ChipRemovable-CCwSQTAL.d.ts} +2 -2
  37. package/dist/ChipRemovable.d.ts +1 -1
  38. package/dist/ChipRemovable.js +3 -3
  39. package/dist/{ChipSelectable-CMJNcE4U.d.ts → ChipSelectable-BQ3VLVi5.d.ts} +1 -1
  40. package/dist/ChipSelectable.d.ts +1 -1
  41. package/dist/ChipSelectable.js +2 -2
  42. package/dist/{Dialog-DHuXR_oo.js → Dialog-BzuyL1U3.js} +2 -2
  43. package/dist/Dialog.d.ts +3 -3
  44. package/dist/Dialog.js +3 -3
  45. package/dist/{Dropdown-DtFTePbc.js → Dropdown-plyBTM15.js} +5 -5
  46. package/dist/Dropdown.d.ts +6 -6
  47. package/dist/Dropdown.js +8 -8
  48. package/dist/{FileInput-b8sbLDPI.js → FileInput-BT3Fe-0J.js} +22 -7
  49. package/dist/FileInput.d.ts +16 -5
  50. package/dist/FileInput.js +6 -6
  51. package/dist/{Icon-Op80LrrO.d.ts → Icon-CUfh3eb3.d.ts} +1 -1
  52. package/dist/{Icon-C_yYuynf.js → Icon-D83qesg5.js} +1 -1
  53. package/dist/Icon.d.ts +1 -1
  54. package/dist/Icon.js +2 -2
  55. package/dist/{Input-DEOVocTa.js → Input-D7zS50oz.js} +32 -11
  56. package/dist/{Input-D2THgo7c.d.ts → Input-fEiQvGDF.d.ts} +9 -5
  57. package/dist/Input.d.ts +1 -1
  58. package/dist/Input.js +3 -3
  59. package/dist/{LeuElement-BeFrgKes.js → LeuElement-DQI8cqZV.js} +1 -1
  60. package/dist/{Menu-BeqqtCw6.js → Menu-DRU1LiMM.js} +2 -2
  61. package/dist/{Menu-CQdx1ef3.d.ts → Menu-Z2b7dsB5.d.ts} +2 -2
  62. package/dist/Menu.d.ts +1 -1
  63. package/dist/Menu.js +4 -4
  64. package/dist/{MenuItem-DVg8-1Bq.js → MenuItem-DCttylRO.js} +2 -2
  65. package/dist/{MenuItem-QcgnRk_7.d.ts → MenuItem-LY4TRIho.d.ts} +2 -2
  66. package/dist/MenuItem.d.ts +1 -1
  67. package/dist/MenuItem.js +3 -3
  68. package/dist/{Message-BhknWvAF.js → Message-0NxnKEqw.js} +2 -2
  69. package/dist/Message.d.ts +2 -2
  70. package/dist/Message.js +3 -3
  71. package/dist/{Pagination-CqkHh-Vd.d.ts → Pagination-9eZ8WMvR.d.ts} +4 -4
  72. package/dist/{Pagination-DJI5MIi_.js → Pagination-CIy7YvWE.js} +4 -4
  73. package/dist/Pagination.d.ts +1 -1
  74. package/dist/Pagination.js +6 -6
  75. package/dist/{Placeholder-BJybFwSg.js → Placeholder-Dol_X5Hp.js} +1 -1
  76. package/dist/Placeholder.d.ts +1 -1
  77. package/dist/Placeholder.js +2 -2
  78. package/dist/{Popup-Btgm2a3D.d.ts → Popup-B5iDSLIO.d.ts} +1 -1
  79. package/dist/{Popup-DNlm_9AA.js → Popup-nJrJHGSy.js} +1 -1
  80. package/dist/Popup.d.ts +1 -1
  81. package/dist/Popup.js +2 -2
  82. package/dist/{ProgressBar-B0wYj1KF.js → ProgressBar-Dmq9veqU.js} +1 -1
  83. package/dist/ProgressBar.d.ts +1 -1
  84. package/dist/ProgressBar.js +2 -2
  85. package/dist/{Radio-DMCL8c4D.js → Radio-W5ck_IJI.js} +1 -1
  86. package/dist/Radio.d.ts +1 -1
  87. package/dist/Radio.js +2 -2
  88. package/dist/{RadioGroup-CM6IyBlq.js → RadioGroup-De5x2YCO.js} +2 -2
  89. package/dist/RadioGroup.d.ts +1 -1
  90. package/dist/RadioGroup.js +3 -3
  91. package/dist/{Range-B72rtfln.js → Range-NCdfDkeD.js} +1 -1
  92. package/dist/Range.d.ts +1 -1
  93. package/dist/Range.js +2 -2
  94. package/dist/{ScrollTop-BFAqBVDR.js → ScrollTop-DwcNIKmN.js} +20 -20
  95. package/dist/ScrollTop.d.ts +8 -8
  96. package/dist/ScrollTop.js +5 -5
  97. package/dist/{Select-vxl3BvD4.js → Select-Bpicra9q.js} +153 -134
  98. package/dist/Select.d.ts +80 -78
  99. package/dist/Select.js +9 -9
  100. package/dist/{Spinner-DDTqijTO.js → Spinner-BBiVZxFH.js} +1 -1
  101. package/dist/{Spinner-CrM1enM0.d.ts → Spinner-DHYaX6-Y.d.ts} +1 -1
  102. package/dist/Spinner.d.ts +1 -1
  103. package/dist/Spinner.js +2 -2
  104. package/dist/Tab-CN97q0nj.d.ts +30 -0
  105. package/dist/Tab-Ce9nrDok.js +117 -0
  106. package/dist/Tab.d.ts +2 -0
  107. package/dist/Tab.js +3 -0
  108. package/dist/TabGroup-C-cd4Wcx.js +248 -0
  109. package/dist/TabGroup.d.ts +64 -0
  110. package/dist/TabGroup.js +5 -0
  111. package/dist/TabPanel-BW1ydVBT.js +65 -0
  112. package/dist/TabPanel-DQgWP7LO.d.ts +26 -0
  113. package/dist/TabPanel.d.ts +2 -0
  114. package/dist/TabPanel.js +3 -0
  115. package/dist/{Table-BgCxfBcm.js → Table-DiYqIzBu.js} +3 -3
  116. package/dist/Table.d.ts +3 -3
  117. package/dist/Table.js +7 -7
  118. package/dist/{Tag-DK2KkPIQ.js → Tag-Ct8Hhv7W.js} +1 -1
  119. package/dist/Tag.d.ts +1 -1
  120. package/dist/Tag.js +2 -2
  121. package/dist/{VisuallyHidden-OeQvhxYn.d.ts → VisuallyHidden-CB7aRJzF.d.ts} +1 -1
  122. package/dist/{VisuallyHidden-pll3amXE.js → VisuallyHidden-CpYXyuC7.js} +1 -1
  123. package/dist/VisuallyHidden.d.ts +1 -1
  124. package/dist/VisuallyHidden.js +2 -2
  125. package/dist/index.d.ts +14 -14
  126. package/dist/index.js +30 -30
  127. package/dist/leu-accordion.js +2 -2
  128. package/dist/leu-button-group.js +5 -5
  129. package/dist/leu-button.d.ts +1 -1
  130. package/dist/leu-button.js +4 -4
  131. package/dist/leu-chart-wrapper.js +3 -3
  132. package/dist/leu-checkbox-group.js +4 -4
  133. package/dist/leu-checkbox.js +3 -3
  134. package/dist/leu-chip-group.d.ts +1 -1
  135. package/dist/leu-chip-group.js +3 -3
  136. package/dist/leu-chip-link.d.ts +1 -1
  137. package/dist/leu-chip-link.js +2 -2
  138. package/dist/leu-chip-removable.d.ts +1 -1
  139. package/dist/leu-chip-removable.js +3 -3
  140. package/dist/leu-chip-selectable.d.ts +1 -1
  141. package/dist/leu-chip-selectable.js +2 -2
  142. package/dist/leu-dialog.js +3 -3
  143. package/dist/leu-dropdown.js +8 -8
  144. package/dist/leu-file-input.js +6 -6
  145. package/dist/leu-icon.d.ts +1 -1
  146. package/dist/leu-icon.js +2 -2
  147. package/dist/leu-input.d.ts +1 -1
  148. package/dist/leu-input.js +3 -3
  149. package/dist/leu-menu-item.d.ts +1 -1
  150. package/dist/leu-menu-item.js +3 -3
  151. package/dist/leu-menu.d.ts +1 -1
  152. package/dist/leu-menu.js +4 -4
  153. package/dist/leu-message.js +3 -3
  154. package/dist/leu-pagination.d.ts +1 -1
  155. package/dist/leu-pagination.js +6 -6
  156. package/dist/leu-placeholder.js +2 -2
  157. package/dist/leu-popup.d.ts +1 -1
  158. package/dist/leu-popup.js +2 -2
  159. package/dist/leu-progress-bar.js +2 -2
  160. package/dist/leu-radio-group.js +3 -3
  161. package/dist/leu-radio.js +2 -2
  162. package/dist/leu-range.js +2 -2
  163. package/dist/leu-scroll-top.js +5 -5
  164. package/dist/leu-select.js +9 -9
  165. package/dist/leu-spinner.d.ts +1 -1
  166. package/dist/leu-spinner.js +2 -2
  167. package/dist/leu-tab-group.d.ts +10 -0
  168. package/dist/leu-tab-group.js +8 -0
  169. package/dist/leu-tab-panel.d.ts +10 -0
  170. package/dist/leu-tab-panel.js +6 -0
  171. package/dist/leu-tab.d.ts +10 -0
  172. package/dist/leu-tab.js +6 -0
  173. package/dist/leu-table.js +7 -7
  174. package/dist/leu-tag.js +2 -2
  175. package/dist/leu-visually-hidden.d.ts +1 -1
  176. package/dist/leu-visually-hidden.js +2 -2
  177. package/dist/vscode.html-custom-data.json +90 -35
  178. package/dist/vue/index.d.ts +89 -29
  179. package/dist/web-types.json +182 -76
  180. package/package.json +1 -2
  181. package/src/components/button/Button.ts +45 -30
  182. package/src/components/button/button.css +55 -54
  183. package/src/components/button/stories/button.stories.ts +17 -20
  184. package/src/components/button/test/button.test.ts +46 -0
  185. package/src/components/file-input/FileInput.ts +24 -5
  186. package/src/components/input/Input.ts +43 -8
  187. package/src/components/input/test/input.test.ts +106 -1
  188. package/src/components/scroll-top/ScrollTop.ts +18 -16
  189. package/src/components/select/Select.ts +198 -125
  190. package/src/components/select/select.css +4 -0
  191. package/src/components/select/stories/select.stories.ts +10 -0
  192. package/src/components/select/test/select.test.ts +440 -35
  193. package/src/components/tab/Tab.ts +72 -0
  194. package/src/components/tab/TabGroup.ts +267 -0
  195. package/src/components/tab/TabPanel.ts +59 -0
  196. package/src/components/tab/leu-tab-group.ts +11 -0
  197. package/src/components/tab/leu-tab-panel.ts +11 -0
  198. package/src/components/tab/leu-tab.ts +11 -0
  199. package/src/components/tab/stories/tab.stories.ts +97 -0
  200. package/src/components/tab/tab-group.css +63 -0
  201. package/src/components/tab/tab-panel.css +10 -0
  202. package/src/components/tab/tab.css +54 -0
  203. package/src/components/tab/test/tab-group.test.ts +426 -0
  204. package/src/components/tab/test/tab-panel.test.ts +102 -0
  205. package/src/components/tab/test/tab.test.ts +139 -0
  206. package/tsconfig.json +1 -0
  207. /package/dist/{FormAssociatedMixin-Cc74LjbC.d.ts → FormAssociatedMixin-Cw7LsSUE.d.ts} +0 -0
  208. /package/dist/{LeuElement-pJFU18Xm.d.ts → LeuElement-DK1jntuu.d.ts} +0 -0
  209. /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
@@ -0,0 +1,2 @@
1
+ import { t as LeuTab } from "./Tab-CN97q0nj.js";
2
+ export { LeuTab };
package/dist/Tab.js ADDED
@@ -0,0 +1,3 @@
1
+ import "./LeuElement-DQI8cqZV.js";
2
+ import { t as LeuTab } from "./Tab-Ce9nrDok.js";
3
+ export { LeuTab };
@@ -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 };
@@ -0,0 +1,5 @@
1
+ import "./LeuElement-DQI8cqZV.js";
2
+ import "./Tab-Ce9nrDok.js";
3
+ import "./TabPanel-BW1ydVBT.js";
4
+ import { t as LeuTabGroup } from "./TabGroup-C-cd4Wcx.js";
5
+ export { LeuTabGroup };
@@ -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 };
@@ -0,0 +1,2 @@
1
+ import { t as LeuTabPanel } from "./TabPanel-DQgWP7LO.js";
2
+ export { LeuTabPanel };
@@ -0,0 +1,3 @@
1
+ import "./LeuElement-DQI8cqZV.js";
2
+ import { t as LeuTabPanel } from "./TabPanel-BW1ydVBT.js";
3
+ export { LeuTabPanel };
@@ -1,6 +1,6 @@
1
- import { t as LeuElement } from "./LeuElement-BeFrgKes.js";
2
- import { t as LeuIcon } from "./Icon-C_yYuynf.js";
3
- import { t as LeuPagination } from "./Pagination-DJI5MIi_.js";
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-pJFU18Xm.js";
2
- import { t as LeuIcon } from "./Icon-Op80LrrO.js";
3
- import { t as LeuPagination } from "./Pagination-CqkHh-Vd.js";
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-BeFrgKes.js";
2
- import "./Icon-C_yYuynf.js";
3
- import "./Spinner-DDTqijTO.js";
4
- import "./Button-BkhqVjug.js";
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-pll3amXE.js";
7
- import "./Pagination-DJI5MIi_.js";
8
- import { t as LeuTable } from "./Table-BgCxfBcm.js";
6
+ import "./VisuallyHidden-CpYXyuC7.js";
7
+ import "./Pagination-CIy7YvWE.js";
8
+ import { t as LeuTable } from "./Table-DiYqIzBu.js";
9
9
  export { LeuTable };
@@ -1,4 +1,4 @@
1
- import { t as LeuElement } from "./LeuElement-BeFrgKes.js";
1
+ import { t as LeuElement } from "./LeuElement-DQI8cqZV.js";
2
2
  import { t as __decorate } from "./decorate-DwpAc4D0.js";
3
3
  import { css, html } from "lit";
4
4
  import { property } from "lit/decorators.js";
package/dist/Tag.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as LeuElement } from "./LeuElement-pJFU18Xm.js";
1
+ import { t as LeuElement } from "./LeuElement-DK1jntuu.js";
2
2
  import * as lit_html0 from "lit-html";
3
3
 
4
4
  //#region src/components/tag/Tag.d.ts
package/dist/Tag.js CHANGED
@@ -1,3 +1,3 @@
1
- import "./LeuElement-BeFrgKes.js";
2
- import { t as LeuTag } from "./Tag-DK2KkPIQ.js";
1
+ import "./LeuElement-DQI8cqZV.js";
2
+ import { t as LeuTag } from "./Tag-Ct8Hhv7W.js";
3
3
  export { LeuTag };
@@ -1,4 +1,4 @@
1
- import { t as LeuElement } from "./LeuElement-pJFU18Xm.js";
1
+ import { t as LeuElement } from "./LeuElement-DK1jntuu.js";
2
2
  import * as lit_html0 from "lit-html";
3
3
 
4
4
  //#region src/components/visually-hidden/VisuallyHidden.d.ts
@@ -1,4 +1,4 @@
1
- import { t as LeuElement } from "./LeuElement-BeFrgKes.js";
1
+ import { t as LeuElement } from "./LeuElement-DQI8cqZV.js";
2
2
  import { css, html } from "lit";
3
3
  //#region src/components/visually-hidden/visually-hidden.css?inline
4
4
  var visually_hidden_default = css`:host {
@@ -1,2 +1,2 @@
1
- import { t as LeuVisuallyHidden } from "./VisuallyHidden-OeQvhxYn.js";
1
+ import { t as LeuVisuallyHidden } from "./VisuallyHidden-CB7aRJzF.js";
2
2
  export { LeuVisuallyHidden };
@@ -1,3 +1,3 @@
1
- import "./LeuElement-BeFrgKes.js";
2
- import { t as LeuVisuallyHidden } from "./VisuallyHidden-pll3amXE.js";
1
+ import "./LeuElement-DQI8cqZV.js";
2
+ import { t as LeuVisuallyHidden } from "./VisuallyHidden-CpYXyuC7.js";
3
3
  export { LeuVisuallyHidden };