@latty-ds/web 0.2.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/LICENSE +21 -0
- package/README.md +106 -0
- package/custom-elements.json +8785 -0
- package/dist/base/index.d.ts +1 -0
- package/dist/base/index.js +35 -0
- package/dist/base/themeable-element.d.ts +20 -0
- package/dist/components/accordion/accordion.d.ts +82 -0
- package/dist/components/accordion/accordion.styles.d.ts +1 -0
- package/dist/components/accordion/accordion.types.d.ts +10 -0
- package/dist/components/accordion/index.d.ts +8 -0
- package/dist/components/accordion/index.js +468 -0
- package/dist/components/alert/alert.d.ts +51 -0
- package/dist/components/alert/alert.styles.d.ts +1 -0
- package/dist/components/alert/alert.types.d.ts +2 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +746 -0
- package/dist/components/avatar/avatar.d.ts +27 -0
- package/dist/components/avatar/avatar.styles.d.ts +1 -0
- package/dist/components/avatar/avatar.types.d.ts +3 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +222 -0
- package/dist/components/badge/badge.d.ts +29 -0
- package/dist/components/badge/badge.styles.d.ts +1 -0
- package/dist/components/badge/badge.types.d.ts +3 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +277 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +53 -0
- package/dist/components/breadcrumb/breadcrumb.styles.d.ts +2 -0
- package/dist/components/breadcrumb/breadcrumb.types.d.ts +1 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +166 -0
- package/dist/components/button/button.d.ts +111 -0
- package/dist/components/button/button.styles.d.ts +1 -0
- package/dist/components/button/button.types.d.ts +38 -0
- package/dist/components/button/index.d.ts +8 -0
- package/dist/components/button/index.js +466 -0
- package/dist/components/calendar/calendar.d.ts +84 -0
- package/dist/components/calendar/calendar.styles.d.ts +1 -0
- package/dist/components/calendar/calendar.types.d.ts +15 -0
- package/dist/components/calendar/index.d.ts +1 -0
- package/dist/components/calendar/index.js +958 -0
- package/dist/components/checkbox/checkbox.d.ts +113 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
- package/dist/components/checkbox/checkbox.types.d.ts +21 -0
- package/dist/components/checkbox/index.d.ts +8 -0
- package/dist/components/checkbox/index.js +320 -0
- package/dist/components/chip/chip.d.ts +35 -0
- package/dist/components/chip/chip.styles.d.ts +1 -0
- package/dist/components/chip/chip.types.d.ts +3 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +282 -0
- package/dist/components/color-input/color-input.d.ts +55 -0
- package/dist/components/color-input/color-input.styles.d.ts +1 -0
- package/dist/components/color-input/color-input.types.d.ts +2 -0
- package/dist/components/color-input/index.d.ts +1 -0
- package/dist/components/color-input/index.js +489 -0
- package/dist/components/combobox/combobox.d.ts +59 -0
- package/dist/components/combobox/combobox.styles.d.ts +1 -0
- package/dist/components/combobox/combobox.types.d.ts +7 -0
- package/dist/components/combobox/index.d.ts +2 -0
- package/dist/components/combobox/index.js +1988 -0
- package/dist/components/date-input/date-input.d.ts +66 -0
- package/dist/components/date-input/date-input.styles.d.ts +1 -0
- package/dist/components/date-input/date-input.types.d.ts +3 -0
- package/dist/components/date-input/index.d.ts +2 -0
- package/dist/components/date-input/index.js +2863 -0
- package/dist/components/datepicker/datepicker.d.ts +52 -0
- package/dist/components/datepicker/datepicker.styles.d.ts +1 -0
- package/dist/components/datepicker/datepicker.types.d.ts +3 -0
- package/dist/components/datepicker/index.d.ts +2 -0
- package/dist/components/datepicker/index.js +416 -0
- package/dist/components/dialog/dialog.d.ts +114 -0
- package/dist/components/dialog/dialog.styles.d.ts +1 -0
- package/dist/components/dialog/dialog.types.d.ts +11 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +920 -0
- package/dist/components/divider/divider.d.ts +35 -0
- package/dist/components/divider/divider.styles.d.ts +1 -0
- package/dist/components/divider/divider.types.d.ts +2 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +149 -0
- package/dist/components/dropdown/dropdown-item.d.ts +24 -0
- package/dist/components/dropdown/dropdown-item.styles.d.ts +1 -0
- package/dist/components/dropdown/dropdown.d.ts +30 -0
- package/dist/components/dropdown/dropdown.styles.d.ts +1 -0
- package/dist/components/dropdown/dropdown.types.d.ts +1 -0
- package/dist/components/dropdown/index.d.ts +3 -0
- package/dist/components/dropdown/index.js +1791 -0
- package/dist/components/header/header.d.ts +19 -0
- package/dist/components/header/header.styles.d.ts +1 -0
- package/dist/components/header/header.types.d.ts +1 -0
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/header/index.js +104 -0
- package/dist/components/icon-button/icon-button.d.ts +52 -0
- package/dist/components/icon-button/icon-button.styles.d.ts +1 -0
- package/dist/components/icon-button/icon-button.types.d.ts +8 -0
- package/dist/components/icon-button/index.d.ts +1 -0
- package/dist/components/icon-button/index.js +342 -0
- package/dist/components/image/image.d.ts +26 -0
- package/dist/components/image/image.styles.d.ts +1 -0
- package/dist/components/image/image.types.d.ts +0 -0
- package/dist/components/image/index.d.ts +1 -0
- package/dist/components/image/index.js +105 -0
- package/dist/components/link/index.d.ts +1 -0
- package/dist/components/link/index.js +108 -0
- package/dist/components/link/link.d.ts +22 -0
- package/dist/components/link/link.styles.d.ts +1 -0
- package/dist/components/link/link.types.d.ts +1 -0
- package/dist/components/list/index.d.ts +9 -0
- package/dist/components/list/index.js +254 -0
- package/dist/components/list/list-item.d.ts +41 -0
- package/dist/components/list/list-item.styles.d.ts +1 -0
- package/dist/components/list/list.d.ts +85 -0
- package/dist/components/list/list.styles.d.ts +1 -0
- package/dist/components/list/list.types.d.ts +16 -0
- package/dist/components/nav/index.d.ts +3 -0
- package/dist/components/nav/index.js +345 -0
- package/dist/components/nav/nav-item.d.ts +73 -0
- package/dist/components/nav/nav.d.ts +49 -0
- package/dist/components/nav/nav.styles.d.ts +2 -0
- package/dist/components/nav/nav.types.d.ts +1 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +210 -0
- package/dist/components/pagination/pagination.d.ts +34 -0
- package/dist/components/pagination/pagination.styles.d.ts +1 -0
- package/dist/components/pagination/pagination.types.d.ts +1 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.js +167 -0
- package/dist/components/progress/progress.d.ts +44 -0
- package/dist/components/progress/progress.styles.d.ts +1 -0
- package/dist/components/progress/progress.types.d.ts +2 -0
- package/dist/components/radio/index.d.ts +8 -0
- package/dist/components/radio/index.js +294 -0
- package/dist/components/radio/radio.d.ts +96 -0
- package/dist/components/radio/radio.styles.d.ts +1 -0
- package/dist/components/radio/radio.types.d.ts +21 -0
- package/dist/components/radio-group/index.d.ts +8 -0
- package/dist/components/radio-group/index.js +384 -0
- package/dist/components/radio-group/radio-group.d.ts +100 -0
- package/dist/components/radio-group/radio-group.styles.d.ts +1 -0
- package/dist/components/radio-group/radio-group.types.d.ts +8 -0
- package/dist/components/select/index.d.ts +8 -0
- package/dist/components/select/index.js +2123 -0
- package/dist/components/select/select.d.ts +129 -0
- package/dist/components/select/select.styles.d.ts +1 -0
- package/dist/components/select/select.types.d.ts +37 -0
- package/dist/components/shared/backdrop.styles.d.ts +1 -0
- package/dist/components/shared/floating.d.ts +10 -0
- package/dist/components/sidepanel/index.d.ts +1 -0
- package/dist/components/sidepanel/index.js +768 -0
- package/dist/components/sidepanel/sidepanel.d.ts +48 -0
- package/dist/components/sidepanel/sidepanel.styles.d.ts +1 -0
- package/dist/components/sidepanel/sidepanel.types.d.ts +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +129 -0
- package/dist/components/skeleton/skeleton.d.ts +39 -0
- package/dist/components/skeleton/skeleton.styles.d.ts +1 -0
- package/dist/components/skeleton/skeleton.types.d.ts +1 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +635 -0
- package/dist/components/slider/slider.d.ts +33 -0
- package/dist/components/slider/slider.styles.d.ts +1 -0
- package/dist/components/slider/slider.types.d.ts +1 -0
- package/dist/components/snackbar/index.d.ts +2 -0
- package/dist/components/snackbar/index.js +358 -0
- package/dist/components/snackbar/snackbar.d.ts +63 -0
- package/dist/components/snackbar/snackbar.styles.d.ts +1 -0
- package/dist/components/snackbar/snackbar.types.d.ts +1 -0
- package/dist/components/spinner/index.d.ts +8 -0
- package/dist/components/spinner/index.js +131 -0
- package/dist/components/spinner/spineer.styles.d.ts +1 -0
- package/dist/components/spinner/spinner.d.ts +52 -0
- package/dist/components/spinner/spinner.types.d.ts +18 -0
- package/dist/components/surface/index.d.ts +8 -0
- package/dist/components/surface/index.js +128 -0
- package/dist/components/surface/surface.d.ts +48 -0
- package/dist/components/surface/surface.styles.d.ts +1 -0
- package/dist/components/surface/surface.types.d.ts +20 -0
- package/dist/components/switch/index.d.ts +8 -0
- package/dist/components/switch/index.js +293 -0
- package/dist/components/switch/switch.d.ts +90 -0
- package/dist/components/switch/switch.styles.d.ts +1 -0
- package/dist/components/switch/switch.types.d.ts +21 -0
- package/dist/components/tab/index.d.ts +9 -0
- package/dist/components/tab/index.js +252 -0
- package/dist/components/tab/tab-panel.d.ts +28 -0
- package/dist/components/tab/tab-panel.styles.d.ts +1 -0
- package/dist/components/tab/tab.d.ts +59 -0
- package/dist/components/tab/tab.styles.d.ts +1 -0
- package/dist/components/tab/tab.types.d.ts +7 -0
- package/dist/components/tab-group/index.d.ts +8 -0
- package/dist/components/tab-group/index.js +441 -0
- package/dist/components/tab-group/tab-group.d.ts +99 -0
- package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
- package/dist/components/tab-group/tab-group.types.d.ts +11 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +582 -0
- package/dist/components/table/table.d.ts +160 -0
- package/dist/components/table/table.styles.d.ts +1 -0
- package/dist/components/table/table.types.d.ts +106 -0
- package/dist/components/text/index.d.ts +1 -0
- package/dist/components/text/index.js +207 -0
- package/dist/components/text/text.d.ts +32 -0
- package/dist/components/text/text.styles.d.ts +1 -0
- package/dist/components/text/text.types.d.ts +2 -0
- package/dist/components/textfield/index.d.ts +8 -0
- package/dist/components/textfield/index.js +718 -0
- package/dist/components/textfield/textfield.d.ts +168 -0
- package/dist/components/textfield/textfield.styles.d.ts +1 -0
- package/dist/components/textfield/textfield.types.d.ts +40 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +379 -0
- package/dist/components/tooltip/tooltip.d.ts +42 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
- package/dist/components/tooltip/tooltip.types.d.ts +1 -0
- package/dist/css/font-face.css +22 -0
- package/dist/css/latty.css +57 -0
- package/dist/fonts/HankenGrotesk-Variable.woff2 +0 -0
- package/dist/fonts/HankenGrotesk-VariableItalic.woff2 +0 -0
- package/dist/index.cjs +12739 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.js +11406 -0
- package/dist/manifest.json +2396 -0
- package/dist/utils/click-outside.d.ts +22 -0
- package/dist/utils/color.d.ts +14 -0
- package/dist/utils/dispatch.d.ts +18 -0
- package/dist/utils/index.d.ts +3 -0
- package/package.json +231 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/components/tab-group/tab-group.ts
|
|
13
|
+
import { html as html3 } from "lit";
|
|
14
|
+
|
|
15
|
+
// src/base/themeable-element.ts
|
|
16
|
+
import { LitElement } from "lit";
|
|
17
|
+
import { property } from "lit/decorators.js";
|
|
18
|
+
var ThemeableElement = class extends LitElement {
|
|
19
|
+
willUpdate(changed) {
|
|
20
|
+
super.willUpdate(changed);
|
|
21
|
+
if (changed.has("theme")) {
|
|
22
|
+
this._syncThemeAttribute();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
_syncThemeAttribute() {
|
|
26
|
+
if (this.theme === "dark" || this.theme === "light") {
|
|
27
|
+
this.setAttribute("data-theme", this.theme);
|
|
28
|
+
} else {
|
|
29
|
+
this.removeAttribute("data-theme");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
__decorateClass([
|
|
34
|
+
property({ reflect: true })
|
|
35
|
+
], ThemeableElement.prototype, "theme", 2);
|
|
36
|
+
|
|
37
|
+
// src/components/tab-group/tab-group.ts
|
|
38
|
+
import { customElement as customElement3, property as property4, queryAssignedElements } from "lit/decorators.js";
|
|
39
|
+
|
|
40
|
+
// src/components/tab-group/tab-group.styles.ts
|
|
41
|
+
import { css } from "lit";
|
|
42
|
+
var tabGroupStyles = css`
|
|
43
|
+
:host {
|
|
44
|
+
display: block;
|
|
45
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.tab-group {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.tabs-container {
|
|
54
|
+
border-bottom: 1px solid var(--lt-border-default);
|
|
55
|
+
display: flex;
|
|
56
|
+
gap: var(--lt-spacing-1);
|
|
57
|
+
overflow-x: auto;
|
|
58
|
+
scrollbar-width: thin;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.tabs-container::-webkit-scrollbar {
|
|
62
|
+
height: 4px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.tabs-container::-webkit-scrollbar-track {
|
|
66
|
+
background: var(--lt-bg-surface);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.tabs-container::-webkit-scrollbar-thumb {
|
|
70
|
+
background: var(--lt-color-neutral-300);
|
|
71
|
+
border-radius: 2px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.panels-container {
|
|
75
|
+
padding: var(--lt-spacing-4) 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
::slotted([slot='panel']) {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
::slotted([slot='panel'][active]) {
|
|
83
|
+
display: block;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Pills variant */
|
|
87
|
+
:host([appearance='pills']) .tabs-container {
|
|
88
|
+
background: var(--lt-bg-surface);
|
|
89
|
+
border: none;
|
|
90
|
+
border-radius: var(--lt-border-radius);
|
|
91
|
+
gap: var(--lt-spacing-2);
|
|
92
|
+
padding: var(--lt-spacing-1);
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
// src/components/tab/tab.ts
|
|
97
|
+
import { html } from "lit";
|
|
98
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
99
|
+
|
|
100
|
+
// src/components/tab/tab.styles.ts
|
|
101
|
+
import { css as css2 } from "lit";
|
|
102
|
+
var tabStyles = css2`
|
|
103
|
+
:host {
|
|
104
|
+
display: inline-block;
|
|
105
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.tab {
|
|
109
|
+
align-items: center;
|
|
110
|
+
background: transparent;
|
|
111
|
+
border: none;
|
|
112
|
+
border-bottom: 2px solid transparent;
|
|
113
|
+
color: var(--lt-text-subtle);
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
display: flex;
|
|
116
|
+
font-family: inherit;
|
|
117
|
+
font-size: 0.9375rem;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
gap: var(--lt-spacing-2);
|
|
120
|
+
outline: none;
|
|
121
|
+
padding: var(--lt-spacing-3) var(--lt-spacing-4);
|
|
122
|
+
transition:
|
|
123
|
+
color 150ms ease,
|
|
124
|
+
border-color 150ms ease;
|
|
125
|
+
user-select: none;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host(:not([disabled])):hover .tab {
|
|
130
|
+
color: var(--lt-text-default);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host(:focus-visible) .tab {
|
|
134
|
+
color: var(--lt-text-primary);
|
|
135
|
+
outline: 2px solid var(--lt-border-focus);
|
|
136
|
+
outline-offset: 2px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host([active]) .tab {
|
|
140
|
+
border-color: var(--lt-border-primary-strong);
|
|
141
|
+
color: var(--lt-text-primary);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:host([disabled]) .tab {
|
|
145
|
+
color: var(--lt-color-neutral-300);
|
|
146
|
+
cursor: not-allowed;
|
|
147
|
+
opacity: 0.5;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.icon {
|
|
151
|
+
font-size: 1.125rem;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* Size variants */
|
|
155
|
+
:host([size='sm']) .tab {
|
|
156
|
+
font-size: 0.875rem;
|
|
157
|
+
padding: var(--lt-spacing-2) var(--lt-spacing-3);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host([size='sm']) .icon {
|
|
161
|
+
font-size: 1rem;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
:host([size='lg']) .tab {
|
|
165
|
+
font-size: 1rem;
|
|
166
|
+
padding: var(--lt-spacing-4) var(--lt-spacing-5);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
:host([size='lg']) .icon {
|
|
170
|
+
font-size: 1.25rem;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/* Pills variant (applied by parent tab-group) */
|
|
174
|
+
:host([data-variant='pills']) .tab {
|
|
175
|
+
border-bottom: none;
|
|
176
|
+
border-radius: var(--lt-border-radius);
|
|
177
|
+
transition:
|
|
178
|
+
color 150ms ease,
|
|
179
|
+
background-color 150ms ease,
|
|
180
|
+
box-shadow 150ms ease;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
:host([data-variant='pills'][active]) .tab {
|
|
184
|
+
background: var(--lt-bg-default);
|
|
185
|
+
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
|
|
186
|
+
color: var(--lt-text-primary);
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
|
|
190
|
+
// src/components/tab/tab.ts
|
|
191
|
+
import "@latty-ds/icons";
|
|
192
|
+
var Tab = class extends ThemeableElement {
|
|
193
|
+
constructor() {
|
|
194
|
+
super(...arguments);
|
|
195
|
+
this.label = "";
|
|
196
|
+
this.value = "";
|
|
197
|
+
this.iconStart = "";
|
|
198
|
+
this.active = false;
|
|
199
|
+
this.disabled = false;
|
|
200
|
+
this.size = "md";
|
|
201
|
+
this._handleHostClick = () => {
|
|
202
|
+
if (this.disabled) return;
|
|
203
|
+
this.dispatchEvent(
|
|
204
|
+
new CustomEvent("tab-click", {
|
|
205
|
+
detail: { value: this.value },
|
|
206
|
+
bubbles: true,
|
|
207
|
+
composed: true
|
|
208
|
+
})
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
this._handleHostKeydown = (e) => {
|
|
212
|
+
if (this.disabled) return;
|
|
213
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
this._handleHostClick();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
connectedCallback() {
|
|
220
|
+
super.connectedCallback();
|
|
221
|
+
this.setAttribute("role", "tab");
|
|
222
|
+
this.tabIndex = 0;
|
|
223
|
+
this.addEventListener("click", this._handleHostClick);
|
|
224
|
+
this.addEventListener("keydown", this._handleHostKeydown);
|
|
225
|
+
}
|
|
226
|
+
disconnectedCallback() {
|
|
227
|
+
super.disconnectedCallback();
|
|
228
|
+
this.removeEventListener("click", this._handleHostClick);
|
|
229
|
+
this.removeEventListener("keydown", this._handleHostKeydown);
|
|
230
|
+
}
|
|
231
|
+
updated(changedProperties) {
|
|
232
|
+
super.updated(changedProperties);
|
|
233
|
+
if (changedProperties.has("active")) {
|
|
234
|
+
this.setAttribute("aria-selected", String(this.active));
|
|
235
|
+
}
|
|
236
|
+
if (changedProperties.has("disabled")) {
|
|
237
|
+
this.setAttribute("aria-disabled", String(this.disabled));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
render() {
|
|
241
|
+
return html`
|
|
242
|
+
<span class="tab">
|
|
243
|
+
${this.iconStart ? html`<lt-icon class="icon" name="${this.iconStart}"></lt-icon>` : ""}
|
|
244
|
+
<span class="label"><slot>${this.label}</slot></span>
|
|
245
|
+
</span>
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
Tab.styles = tabStyles;
|
|
250
|
+
__decorateClass([
|
|
251
|
+
property2()
|
|
252
|
+
], Tab.prototype, "label", 2);
|
|
253
|
+
__decorateClass([
|
|
254
|
+
property2()
|
|
255
|
+
], Tab.prototype, "value", 2);
|
|
256
|
+
__decorateClass([
|
|
257
|
+
property2({ attribute: "icon-start" })
|
|
258
|
+
], Tab.prototype, "iconStart", 2);
|
|
259
|
+
__decorateClass([
|
|
260
|
+
property2({ type: Boolean, reflect: true })
|
|
261
|
+
], Tab.prototype, "active", 2);
|
|
262
|
+
__decorateClass([
|
|
263
|
+
property2({ type: Boolean, reflect: true })
|
|
264
|
+
], Tab.prototype, "disabled", 2);
|
|
265
|
+
__decorateClass([
|
|
266
|
+
property2({ reflect: true })
|
|
267
|
+
], Tab.prototype, "size", 2);
|
|
268
|
+
Tab = __decorateClass([
|
|
269
|
+
customElement("lt-tab")
|
|
270
|
+
], Tab);
|
|
271
|
+
|
|
272
|
+
// src/components/tab/tab-panel.ts
|
|
273
|
+
import { html as html2 } from "lit";
|
|
274
|
+
import { customElement as customElement2, property as property3 } from "lit/decorators.js";
|
|
275
|
+
|
|
276
|
+
// src/components/tab/tab-panel.styles.ts
|
|
277
|
+
import { css as css3 } from "lit";
|
|
278
|
+
var tabPanelStyles = css3`
|
|
279
|
+
:host {
|
|
280
|
+
display: none;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
:host([active]) {
|
|
284
|
+
display: block;
|
|
285
|
+
}
|
|
286
|
+
`;
|
|
287
|
+
|
|
288
|
+
// src/components/tab/tab-panel.ts
|
|
289
|
+
var TabPanel = class extends ThemeableElement {
|
|
290
|
+
constructor() {
|
|
291
|
+
super(...arguments);
|
|
292
|
+
this.value = "";
|
|
293
|
+
this.active = false;
|
|
294
|
+
}
|
|
295
|
+
render() {
|
|
296
|
+
return html2`<slot></slot>`;
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
TabPanel.styles = tabPanelStyles;
|
|
300
|
+
__decorateClass([
|
|
301
|
+
property3({ reflect: true })
|
|
302
|
+
], TabPanel.prototype, "value", 2);
|
|
303
|
+
__decorateClass([
|
|
304
|
+
property3({ type: Boolean, reflect: true })
|
|
305
|
+
], TabPanel.prototype, "active", 2);
|
|
306
|
+
TabPanel = __decorateClass([
|
|
307
|
+
customElement2("lt-tab-panel")
|
|
308
|
+
], TabPanel);
|
|
309
|
+
|
|
310
|
+
// src/components/tab-group/tab-group.ts
|
|
311
|
+
var TabGroup = class extends ThemeableElement {
|
|
312
|
+
constructor() {
|
|
313
|
+
super(...arguments);
|
|
314
|
+
this.value = "";
|
|
315
|
+
this.appearance = "default";
|
|
316
|
+
this.size = "md";
|
|
317
|
+
/**
|
|
318
|
+
* Handles click events from tabs.
|
|
319
|
+
* @private
|
|
320
|
+
*/
|
|
321
|
+
this.handleTabClick = (e) => {
|
|
322
|
+
const tab = e.target;
|
|
323
|
+
if (tab.disabled) return;
|
|
324
|
+
this.value = tab.value;
|
|
325
|
+
this.updateTabs();
|
|
326
|
+
this.updatePanels();
|
|
327
|
+
this.dispatchEvent(
|
|
328
|
+
new CustomEvent("change", {
|
|
329
|
+
detail: { value: this.value },
|
|
330
|
+
bubbles: true,
|
|
331
|
+
composed: true
|
|
332
|
+
})
|
|
333
|
+
);
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Lifecycle: Called after the element's DOM has been updated.
|
|
338
|
+
*/
|
|
339
|
+
firstUpdated() {
|
|
340
|
+
this.updateTabs();
|
|
341
|
+
this.updatePanels();
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Updates all tabs with the correct active state and size.
|
|
345
|
+
* @private
|
|
346
|
+
*/
|
|
347
|
+
updateTabs() {
|
|
348
|
+
if (!this.tabs) return;
|
|
349
|
+
this.tabs.forEach((tab) => {
|
|
350
|
+
tab.size = this.size;
|
|
351
|
+
tab.active = tab.value === this.value;
|
|
352
|
+
if (this.appearance === "pills") {
|
|
353
|
+
tab.setAttribute("data-variant", "pills");
|
|
354
|
+
} else {
|
|
355
|
+
tab.removeAttribute("data-variant");
|
|
356
|
+
}
|
|
357
|
+
tab.addEventListener("tab-click", this.handleTabClick);
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Updates panel visibility based on selected value.
|
|
362
|
+
* @private
|
|
363
|
+
*/
|
|
364
|
+
updatePanels() {
|
|
365
|
+
if (!this.panels) return;
|
|
366
|
+
this.panels.forEach((panel) => {
|
|
367
|
+
const panelValue = panel.getAttribute("value") ?? panel.getAttribute("data-value");
|
|
368
|
+
if (panelValue === this.value) {
|
|
369
|
+
panel.setAttribute("active", "");
|
|
370
|
+
} else {
|
|
371
|
+
panel.removeAttribute("active");
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Handles slot changes.
|
|
377
|
+
* @private
|
|
378
|
+
*/
|
|
379
|
+
handleSlotChange() {
|
|
380
|
+
this.updateTabs();
|
|
381
|
+
this.updatePanels();
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Cleanup event listeners when component is removed.
|
|
385
|
+
*/
|
|
386
|
+
disconnectedCallback() {
|
|
387
|
+
super.disconnectedCallback();
|
|
388
|
+
if (this.tabs) {
|
|
389
|
+
this.tabs.forEach((tab) => {
|
|
390
|
+
tab.removeEventListener("tab-click", this.handleTabClick);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Watch for value changes.
|
|
396
|
+
*/
|
|
397
|
+
updated(changedProperties) {
|
|
398
|
+
super.updated(changedProperties);
|
|
399
|
+
if (changedProperties.has("value")) {
|
|
400
|
+
this.updateTabs();
|
|
401
|
+
this.updatePanels();
|
|
402
|
+
}
|
|
403
|
+
if (changedProperties.has("size") || changedProperties.has("appearance")) {
|
|
404
|
+
this.updateTabs();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
render() {
|
|
408
|
+
return html3`
|
|
409
|
+
<div class="tab-group">
|
|
410
|
+
<div class="tabs-container" role="tablist">
|
|
411
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
412
|
+
</div>
|
|
413
|
+
<div class="panels-container" part="panels-container">
|
|
414
|
+
<slot name="panel"></slot>
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
`;
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
TabGroup.styles = tabGroupStyles;
|
|
421
|
+
__decorateClass([
|
|
422
|
+
property4()
|
|
423
|
+
], TabGroup.prototype, "value", 2);
|
|
424
|
+
__decorateClass([
|
|
425
|
+
property4({ reflect: true })
|
|
426
|
+
], TabGroup.prototype, "appearance", 2);
|
|
427
|
+
__decorateClass([
|
|
428
|
+
property4({ reflect: true })
|
|
429
|
+
], TabGroup.prototype, "size", 2);
|
|
430
|
+
__decorateClass([
|
|
431
|
+
queryAssignedElements({ selector: "lt-tab" })
|
|
432
|
+
], TabGroup.prototype, "tabs", 2);
|
|
433
|
+
__decorateClass([
|
|
434
|
+
queryAssignedElements({ slot: "panel" })
|
|
435
|
+
], TabGroup.prototype, "panels", 2);
|
|
436
|
+
TabGroup = __decorateClass([
|
|
437
|
+
customElement3("lt-tab-group")
|
|
438
|
+
], TabGroup);
|
|
439
|
+
export {
|
|
440
|
+
TabGroup
|
|
441
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import { TabGroupSize, TabGroupAppearance } from './tab-group.types';
|
|
3
|
+
import '../tab/tab';
|
|
4
|
+
import '../tab/tab-panel';
|
|
5
|
+
/**
|
|
6
|
+
* A container component that manages a group of tabs.
|
|
7
|
+
*
|
|
8
|
+
* @element lt-tab-group
|
|
9
|
+
*
|
|
10
|
+
* @fires {CustomEvent<{value: string}>} change - Dispatched when a tab is selected
|
|
11
|
+
*
|
|
12
|
+
* @slot - Tab elements
|
|
13
|
+
* @slot panel - Tab panel content (use multiple panels with matching values)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <lt-tab-group value="profile">
|
|
18
|
+
* <lt-tab value="profile" label="Profile"></lt-tab>
|
|
19
|
+
* <lt-tab value="settings" label="Settings"></lt-tab>
|
|
20
|
+
*
|
|
21
|
+
* <div slot="panel" data-value="profile">Profile content</div>
|
|
22
|
+
* <div slot="panel" data-value="settings">Settings content</div>
|
|
23
|
+
* </lt-tab-group>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```html
|
|
28
|
+
* <lt-tab-group appearance="pills" value="home">
|
|
29
|
+
* <lt-tab value="home" icon-start="home" label="Home"></lt-tab>
|
|
30
|
+
* <lt-tab value="search" icon-start="search" label="Search"></lt-tab>
|
|
31
|
+
* <lt-tab value="settings" icon-start="settings" label="Settings"></lt-tab>
|
|
32
|
+
*
|
|
33
|
+
* <div slot="panel" data-value="home">Home content</div>
|
|
34
|
+
* <div slot="panel" data-value="search">Search content</div>
|
|
35
|
+
* <div slot="panel" data-value="settings">Settings content</div>
|
|
36
|
+
* </lt-tab-group>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class TabGroup extends ThemeableElement {
|
|
40
|
+
static styles: import("lit").CSSResult;
|
|
41
|
+
/**
|
|
42
|
+
* Currently selected tab value.
|
|
43
|
+
* @default ''
|
|
44
|
+
*/
|
|
45
|
+
value: string;
|
|
46
|
+
/**
|
|
47
|
+
* Visual appearance of the tab group.
|
|
48
|
+
* @default 'default'
|
|
49
|
+
*/
|
|
50
|
+
appearance: TabGroupAppearance;
|
|
51
|
+
/**
|
|
52
|
+
* Size of the tabs.
|
|
53
|
+
* @default 'md'
|
|
54
|
+
*/
|
|
55
|
+
size: TabGroupSize;
|
|
56
|
+
/**
|
|
57
|
+
* Reference to all slotted tab elements.
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
private tabs;
|
|
61
|
+
/**
|
|
62
|
+
* Reference to all slotted panel elements.
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
private panels;
|
|
66
|
+
/**
|
|
67
|
+
* Lifecycle: Called after the element's DOM has been updated.
|
|
68
|
+
*/
|
|
69
|
+
firstUpdated(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Updates all tabs with the correct active state and size.
|
|
72
|
+
* @private
|
|
73
|
+
*/
|
|
74
|
+
private updateTabs;
|
|
75
|
+
/**
|
|
76
|
+
* Updates panel visibility based on selected value.
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
private updatePanels;
|
|
80
|
+
/**
|
|
81
|
+
* Handles click events from tabs.
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
private handleTabClick;
|
|
85
|
+
/**
|
|
86
|
+
* Handles slot changes.
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
private handleSlotChange;
|
|
90
|
+
/**
|
|
91
|
+
* Cleanup event listeners when component is removed.
|
|
92
|
+
*/
|
|
93
|
+
disconnectedCallback(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Watch for value changes.
|
|
96
|
+
*/
|
|
97
|
+
protected updated(changedProperties: Map<string, unknown>): void;
|
|
98
|
+
render(): import("lit").TemplateResult<1>;
|
|
99
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tabGroupStyles: import("lit").CSSResult;
|