@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,358 @@
|
|
|
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/snackbar/snackbar.ts
|
|
13
|
+
import { html as html2 } 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/snackbar/snackbar.ts
|
|
38
|
+
import { customElement as customElement2, property as property3 } from "lit/decorators.js";
|
|
39
|
+
|
|
40
|
+
// src/components/snackbar/snackbar.styles.ts
|
|
41
|
+
import { css } from "lit";
|
|
42
|
+
var snackbarStyles = css`
|
|
43
|
+
:host {
|
|
44
|
+
display: block;
|
|
45
|
+
bottom: 24px;
|
|
46
|
+
left: 50%;
|
|
47
|
+
max-width: calc(100vw - 48px);
|
|
48
|
+
opacity: 0;
|
|
49
|
+
position: fixed;
|
|
50
|
+
transform: translateX(-50%) translateY(8px);
|
|
51
|
+
transition:
|
|
52
|
+
opacity 200ms ease,
|
|
53
|
+
transform 200ms ease,
|
|
54
|
+
visibility 200ms ease;
|
|
55
|
+
visibility: hidden;
|
|
56
|
+
width: max-content;
|
|
57
|
+
z-index: 9000;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([open]) {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
transform: translateX(-50%) translateY(0);
|
|
63
|
+
visibility: visible;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* ── Layout ──────────────────────────────────────────────── */
|
|
67
|
+
|
|
68
|
+
.inner {
|
|
69
|
+
align-items: center;
|
|
70
|
+
color: var(--lt-text-inverse);
|
|
71
|
+
display: flex;
|
|
72
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
73
|
+
font-size: 0.875rem;
|
|
74
|
+
gap: var(--lt-spacing-2);
|
|
75
|
+
line-height: 1.4;
|
|
76
|
+
padding: var(--lt-spacing-3) var(--lt-spacing-4);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* ── Variant text colors ─────────────────────────────────── */
|
|
80
|
+
|
|
81
|
+
:host([variant='success']) .inner {
|
|
82
|
+
color: var(--lt-text-on-success);
|
|
83
|
+
}
|
|
84
|
+
:host([variant='warning']) .inner {
|
|
85
|
+
color: var(--lt-text-on-warning);
|
|
86
|
+
}
|
|
87
|
+
:host([variant='error']) .inner {
|
|
88
|
+
color: var(--lt-text-on-error);
|
|
89
|
+
}
|
|
90
|
+
:host([variant='info']) .inner {
|
|
91
|
+
color: var(--lt-text-on-info);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* ── Variant icon ────────────────────────────────────────── */
|
|
95
|
+
|
|
96
|
+
.variant-icon {
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
font-size: 1.125rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* ── Message ─────────────────────────────────────────────── */
|
|
102
|
+
|
|
103
|
+
.message {
|
|
104
|
+
flex: 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* ── Action button ───────────────────────────────────────── */
|
|
108
|
+
|
|
109
|
+
.action {
|
|
110
|
+
background: transparent;
|
|
111
|
+
border: none;
|
|
112
|
+
color: inherit;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
font-family: inherit;
|
|
115
|
+
font-size: 0.8125rem;
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
letter-spacing: 0.05em;
|
|
118
|
+
opacity: 0.85;
|
|
119
|
+
padding: 0 var(--lt-spacing-1);
|
|
120
|
+
text-transform: uppercase;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.action:hover {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* ── Close button ────────────────────────────────────────── */
|
|
128
|
+
|
|
129
|
+
.close {
|
|
130
|
+
align-items: center;
|
|
131
|
+
background: transparent;
|
|
132
|
+
border: none;
|
|
133
|
+
color: inherit;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-shrink: 0;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
opacity: 0.7;
|
|
139
|
+
padding: 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.close:hover {
|
|
143
|
+
opacity: 1;
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
// src/utils/dispatch.ts
|
|
148
|
+
var dispatch = (host, name, detail, init) => host.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true, ...init }));
|
|
149
|
+
|
|
150
|
+
// src/utils/color.ts
|
|
151
|
+
var resolveColorValue = (value) => value.startsWith("--") ? `var(${value})` : value;
|
|
152
|
+
|
|
153
|
+
// src/components/snackbar/snackbar.ts
|
|
154
|
+
import "@latty-ds/icons";
|
|
155
|
+
|
|
156
|
+
// src/components/surface/surface.ts
|
|
157
|
+
import { html } from "lit";
|
|
158
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
159
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
160
|
+
|
|
161
|
+
// src/components/surface/surface.styles.ts
|
|
162
|
+
import { css as css2 } from "lit";
|
|
163
|
+
var surfaceStyles = css2`
|
|
164
|
+
:host {
|
|
165
|
+
display: block;
|
|
166
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.surface {
|
|
170
|
+
background: var(--lt-surface-bg, var(--lt-bg-subtle));
|
|
171
|
+
border-radius: var(--lt-border-radius);
|
|
172
|
+
box-sizing: border-box;
|
|
173
|
+
transition:
|
|
174
|
+
box-shadow 120ms ease,
|
|
175
|
+
border-color 120ms ease;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Elevation variants */
|
|
179
|
+
:host([elevation='0']) .surface {
|
|
180
|
+
box-shadow: var(--lt-elevation-0);
|
|
181
|
+
}
|
|
182
|
+
:host([elevation='1']) .surface {
|
|
183
|
+
box-shadow: var(--lt-elevation-1);
|
|
184
|
+
}
|
|
185
|
+
:host([elevation='2']) .surface {
|
|
186
|
+
box-shadow: var(--lt-elevation-2);
|
|
187
|
+
}
|
|
188
|
+
:host([elevation='3']) .surface {
|
|
189
|
+
box-shadow: var(--lt-elevation-3);
|
|
190
|
+
}
|
|
191
|
+
:host([elevation='4']) .surface {
|
|
192
|
+
box-shadow: var(--lt-elevation-4);
|
|
193
|
+
}
|
|
194
|
+
:host([elevation='5']) .surface {
|
|
195
|
+
box-shadow: var(--lt-elevation-5);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Visual appearances */
|
|
199
|
+
:host([appearance='filled']) .surface {
|
|
200
|
+
border: none;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
:host([appearance='outlined']) .surface {
|
|
204
|
+
background: var(--lt-surface-bg, transparent);
|
|
205
|
+
border: 1px solid var(--lt-border-default);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
:host([appearance='outlined']:hover) .surface {
|
|
209
|
+
border-color: var(--lt-border-strong);
|
|
210
|
+
}
|
|
211
|
+
`;
|
|
212
|
+
|
|
213
|
+
// src/components/surface/surface.ts
|
|
214
|
+
var Surface = class extends ThemeableElement {
|
|
215
|
+
constructor() {
|
|
216
|
+
super(...arguments);
|
|
217
|
+
this.elevation = "1";
|
|
218
|
+
this.appearance = "filled";
|
|
219
|
+
this.background = "";
|
|
220
|
+
}
|
|
221
|
+
render() {
|
|
222
|
+
const style = this.background ? { "--_surface-bg": resolveColorValue(this.background) } : {};
|
|
223
|
+
return html`
|
|
224
|
+
<div class="surface" part="surface" style=${styleMap(style)}>
|
|
225
|
+
<slot></slot>
|
|
226
|
+
</div>
|
|
227
|
+
`;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
Surface.styles = surfaceStyles;
|
|
231
|
+
__decorateClass([
|
|
232
|
+
property2({ reflect: true })
|
|
233
|
+
], Surface.prototype, "elevation", 2);
|
|
234
|
+
__decorateClass([
|
|
235
|
+
property2({ reflect: true })
|
|
236
|
+
], Surface.prototype, "appearance", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
property2({ reflect: true })
|
|
239
|
+
], Surface.prototype, "background", 2);
|
|
240
|
+
Surface = __decorateClass([
|
|
241
|
+
customElement("lt-surface")
|
|
242
|
+
], Surface);
|
|
243
|
+
|
|
244
|
+
// src/components/snackbar/snackbar.ts
|
|
245
|
+
var Snackbar = class extends ThemeableElement {
|
|
246
|
+
constructor() {
|
|
247
|
+
super(...arguments);
|
|
248
|
+
this.variant = "default";
|
|
249
|
+
this.duration = 4e3;
|
|
250
|
+
this.open = false;
|
|
251
|
+
this.closable = true;
|
|
252
|
+
this.actionLabel = "";
|
|
253
|
+
this.icon = "";
|
|
254
|
+
}
|
|
255
|
+
/** Shows the snackbar and starts the auto-dismiss timer. */
|
|
256
|
+
show() {
|
|
257
|
+
this.open = true;
|
|
258
|
+
}
|
|
259
|
+
/** Dismisses the snackbar. */
|
|
260
|
+
hide() {
|
|
261
|
+
this.open = false;
|
|
262
|
+
}
|
|
263
|
+
updated(changedProperties) {
|
|
264
|
+
if (changedProperties.has("open")) {
|
|
265
|
+
if (this.open) {
|
|
266
|
+
this._startTimer();
|
|
267
|
+
dispatch(this, "show");
|
|
268
|
+
} else {
|
|
269
|
+
this._clearTimer();
|
|
270
|
+
dispatch(this, "hide");
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
disconnectedCallback() {
|
|
275
|
+
super.disconnectedCallback();
|
|
276
|
+
this._clearTimer();
|
|
277
|
+
}
|
|
278
|
+
_startTimer() {
|
|
279
|
+
this._clearTimer();
|
|
280
|
+
if (this.duration > 0) {
|
|
281
|
+
this._timer = setTimeout(() => this.hide(), this.duration);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
_clearTimer() {
|
|
285
|
+
if (this._timer !== void 0) {
|
|
286
|
+
clearTimeout(this._timer);
|
|
287
|
+
this._timer = void 0;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
_handleClose() {
|
|
291
|
+
this.hide();
|
|
292
|
+
}
|
|
293
|
+
_handleAction() {
|
|
294
|
+
dispatch(this, "action");
|
|
295
|
+
this.hide();
|
|
296
|
+
}
|
|
297
|
+
get _resolvedIcon() {
|
|
298
|
+
if (this.icon === "none") return "";
|
|
299
|
+
if (this.icon) return this.icon;
|
|
300
|
+
if (this.variant === "default") return "";
|
|
301
|
+
return Snackbar._iconMap[this.variant] ?? "";
|
|
302
|
+
}
|
|
303
|
+
render() {
|
|
304
|
+
const iconName = this._resolvedIcon;
|
|
305
|
+
return html2`
|
|
306
|
+
<lt-surface elevation="5" background=${Snackbar._bgMap[this.variant]}>
|
|
307
|
+
<div class="inner" role="status" aria-live="polite" part="base">
|
|
308
|
+
${iconName ? html2`<lt-icon class="variant-icon" name=${iconName} part="icon"></lt-icon>` : ""}
|
|
309
|
+
<span class="message" part="message">
|
|
310
|
+
<slot></slot>
|
|
311
|
+
</span>
|
|
312
|
+
${this.actionLabel ? html2`<button class="action" @click=${this._handleAction} part="action">${this.actionLabel}</button>` : ""}
|
|
313
|
+
${this.closable ? html2`<button class="close" @click=${this._handleClose} aria-label="Dismiss" part="close">
|
|
314
|
+
<lt-icon name="xmark"></lt-icon>
|
|
315
|
+
</button>` : ""}
|
|
316
|
+
</div>
|
|
317
|
+
</lt-surface>
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
Snackbar.styles = snackbarStyles;
|
|
322
|
+
Snackbar._iconMap = {
|
|
323
|
+
success: "check-circle",
|
|
324
|
+
warning: "warning-triangle",
|
|
325
|
+
error: "xmark-circle",
|
|
326
|
+
info: "info-circle"
|
|
327
|
+
};
|
|
328
|
+
Snackbar._bgMap = {
|
|
329
|
+
default: "--lt-bg-inverse",
|
|
330
|
+
success: "--lt-interactive-success-bg",
|
|
331
|
+
warning: "--lt-interactive-warning-bg",
|
|
332
|
+
error: "--lt-interactive-error-bg",
|
|
333
|
+
info: "--lt-interactive-info-bg"
|
|
334
|
+
};
|
|
335
|
+
__decorateClass([
|
|
336
|
+
property3({ reflect: true })
|
|
337
|
+
], Snackbar.prototype, "variant", 2);
|
|
338
|
+
__decorateClass([
|
|
339
|
+
property3({ type: Number, reflect: true })
|
|
340
|
+
], Snackbar.prototype, "duration", 2);
|
|
341
|
+
__decorateClass([
|
|
342
|
+
property3({ type: Boolean, reflect: true })
|
|
343
|
+
], Snackbar.prototype, "open", 2);
|
|
344
|
+
__decorateClass([
|
|
345
|
+
property3({ type: Boolean, reflect: true })
|
|
346
|
+
], Snackbar.prototype, "closable", 2);
|
|
347
|
+
__decorateClass([
|
|
348
|
+
property3({ attribute: "action-label", reflect: true })
|
|
349
|
+
], Snackbar.prototype, "actionLabel", 2);
|
|
350
|
+
__decorateClass([
|
|
351
|
+
property3({ reflect: true })
|
|
352
|
+
], Snackbar.prototype, "icon", 2);
|
|
353
|
+
Snackbar = __decorateClass([
|
|
354
|
+
customElement2("lt-snackbar")
|
|
355
|
+
], Snackbar);
|
|
356
|
+
export {
|
|
357
|
+
Snackbar
|
|
358
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import type { SnackbarVariant } from './snackbar.types';
|
|
3
|
+
import '@latty-ds/icons';
|
|
4
|
+
import '../surface/surface';
|
|
5
|
+
/**
|
|
6
|
+
* Brief notification that appears temporarily at the bottom of the viewport.
|
|
7
|
+
*
|
|
8
|
+
* @element lt-snackbar
|
|
9
|
+
*
|
|
10
|
+
* @slot - Notification content. Accepts any HTML — bold, links, etc.
|
|
11
|
+
*
|
|
12
|
+
* @fires show - Fired when the snackbar becomes visible.
|
|
13
|
+
* @fires hide - Fired when the snackbar is dismissed.
|
|
14
|
+
* @fires action - Fired when the action button is clicked.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <lt-snackbar id="sb" variant="success">Changes saved</lt-snackbar>
|
|
19
|
+
* <script type="module">
|
|
20
|
+
* document.getElementById('sb').show();
|
|
21
|
+
* </script>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```html
|
|
26
|
+
* <lt-snackbar action-label="Undo" duration="6000">
|
|
27
|
+
* File <strong>report.pdf</strong> deleted
|
|
28
|
+
* </lt-snackbar>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class Snackbar extends ThemeableElement {
|
|
32
|
+
static styles: import("lit").CSSResult;
|
|
33
|
+
/** Visual style. */
|
|
34
|
+
variant: SnackbarVariant;
|
|
35
|
+
/** Auto-dismiss delay in milliseconds. Set to 0 to disable auto-dismiss. */
|
|
36
|
+
duration: number;
|
|
37
|
+
/** Whether the snackbar is visible. */
|
|
38
|
+
open: boolean;
|
|
39
|
+
/** Show a dismiss button. */
|
|
40
|
+
closable: boolean;
|
|
41
|
+
/** Label for the optional action button. */
|
|
42
|
+
actionLabel: string;
|
|
43
|
+
/**
|
|
44
|
+
* Icon to show before the message. Leave empty for auto (shows variant icon for status variants),
|
|
45
|
+
* set to `"none"` to suppress, or pass any icon name to override.
|
|
46
|
+
*/
|
|
47
|
+
icon: string;
|
|
48
|
+
private _timer?;
|
|
49
|
+
/** Shows the snackbar and starts the auto-dismiss timer. */
|
|
50
|
+
show(): void;
|
|
51
|
+
/** Dismisses the snackbar. */
|
|
52
|
+
hide(): void;
|
|
53
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
54
|
+
disconnectedCallback(): void;
|
|
55
|
+
private _startTimer;
|
|
56
|
+
private _clearTimer;
|
|
57
|
+
private _handleClose;
|
|
58
|
+
private _handleAction;
|
|
59
|
+
private static readonly _iconMap;
|
|
60
|
+
private static readonly _bgMap;
|
|
61
|
+
private get _resolvedIcon();
|
|
62
|
+
render(): import("lit").TemplateResult<1>;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const snackbarStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SnackbarVariant = 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
@@ -0,0 +1,131 @@
|
|
|
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/spinner/spinner.ts
|
|
13
|
+
import { html } 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/spinner/spinner.ts
|
|
38
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
39
|
+
|
|
40
|
+
// src/components/spinner/spineer.styles.ts
|
|
41
|
+
import { css } from "lit";
|
|
42
|
+
var spinnerStyles = css`
|
|
43
|
+
:host {
|
|
44
|
+
--lt-spinner-size: var(--lt-spacing-4, 1rem);
|
|
45
|
+
--lt-spinner-color: currentColor;
|
|
46
|
+
|
|
47
|
+
display: inline-block;
|
|
48
|
+
line-height: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Sizes */
|
|
52
|
+
:host([size='sm']) {
|
|
53
|
+
--lt-spinner-size: var(--lt-spacing-3, 0.75rem);
|
|
54
|
+
}
|
|
55
|
+
:host([size='md']) {
|
|
56
|
+
--lt-spinner-size: var(--lt-spacing-4, 1rem);
|
|
57
|
+
}
|
|
58
|
+
:host([size='lg']) {
|
|
59
|
+
--lt-spinner-size: var(--lt-spacing-6, 1.5rem);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Color */
|
|
63
|
+
:host([variant='primary']) {
|
|
64
|
+
--lt-spinner-color: var(--lt-interactive-primary-bg);
|
|
65
|
+
}
|
|
66
|
+
:host([variant='secondary']) {
|
|
67
|
+
--lt-spinner-color: var(--lt-interactive-secondary-bg);
|
|
68
|
+
}
|
|
69
|
+
:host([variant='neutral']) {
|
|
70
|
+
--lt-spinner-color: var(--lt-color-neutral-500);
|
|
71
|
+
}
|
|
72
|
+
:host([variant='current']) {
|
|
73
|
+
--lt-spinner-color: currentColor;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.spinner {
|
|
77
|
+
animation: spin 700ms linear infinite;
|
|
78
|
+
border-bottom-color: var(--lt-spinner-color);
|
|
79
|
+
border-left-color: var(--lt-spinner-color);
|
|
80
|
+
border-radius: 999px;
|
|
81
|
+
border-right-color: transparent;
|
|
82
|
+
border-style: solid;
|
|
83
|
+
border-top-color: var(--lt-spinner-color);
|
|
84
|
+
border-width: 2px;
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
display: block;
|
|
87
|
+
height: var(--lt-spinner-size);
|
|
88
|
+
width: var(--lt-spinner-size);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@keyframes spin {
|
|
92
|
+
to {
|
|
93
|
+
transform: rotate(360deg);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media (prefers-reduced-motion: reduce) {
|
|
98
|
+
.spinner {
|
|
99
|
+
animation: none;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
// src/components/spinner/spinner.ts
|
|
105
|
+
var Spinner = class extends ThemeableElement {
|
|
106
|
+
constructor() {
|
|
107
|
+
super(...arguments);
|
|
108
|
+
this.size = "md";
|
|
109
|
+
this.variant = "current";
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Renders the spinner element.
|
|
113
|
+
* Hidden from assistive technologies with aria-hidden.
|
|
114
|
+
*/
|
|
115
|
+
render() {
|
|
116
|
+
return html`<span class="spinner" aria-hidden="true"></span>`;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
Spinner.styles = spinnerStyles;
|
|
120
|
+
__decorateClass([
|
|
121
|
+
property2({ reflect: true })
|
|
122
|
+
], Spinner.prototype, "size", 2);
|
|
123
|
+
__decorateClass([
|
|
124
|
+
property2({ reflect: true })
|
|
125
|
+
], Spinner.prototype, "variant", 2);
|
|
126
|
+
Spinner = __decorateClass([
|
|
127
|
+
customElement("lt-spinner")
|
|
128
|
+
], Spinner);
|
|
129
|
+
export {
|
|
130
|
+
Spinner
|
|
131
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const spinnerStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import type { SpinnerSize, SpinnerVariant } from './spinner.types';
|
|
3
|
+
/**
|
|
4
|
+
* Spinner component for indicating loading states.
|
|
5
|
+
*
|
|
6
|
+
* @element lt-spinner
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Smooth rotating animation
|
|
10
|
+
* - Multiple size options (sm, md, lg)
|
|
11
|
+
* - Color variants or inherits parent color
|
|
12
|
+
* - Respects reduced motion preferences
|
|
13
|
+
* - Hidden from screen readers (aria-hidden)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <lt-spinner size="md" variant="primary"></lt-spinner>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```html
|
|
22
|
+
* <!-- Inherits text color from parent -->
|
|
23
|
+
* <div style="color: blue;">
|
|
24
|
+
* <lt-spinner variant="current"></lt-spinner>
|
|
25
|
+
* </div>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```html
|
|
30
|
+
* <!-- Large spinner with success color -->
|
|
31
|
+
* <lt-spinner size="lg" variant="primary"></lt-spinner>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class Spinner extends ThemeableElement {
|
|
35
|
+
static styles: import("lit").CSSResult;
|
|
36
|
+
/**
|
|
37
|
+
* Size of the spinner.
|
|
38
|
+
* @default 'md'
|
|
39
|
+
*/
|
|
40
|
+
size: SpinnerSize;
|
|
41
|
+
/**
|
|
42
|
+
* Color variant of the spinner.
|
|
43
|
+
* 'current' inherits color from parent element.
|
|
44
|
+
* @default 'current'
|
|
45
|
+
*/
|
|
46
|
+
variant: SpinnerVariant;
|
|
47
|
+
/**
|
|
48
|
+
* Renders the spinner element.
|
|
49
|
+
* Hidden from assistive technologies with aria-hidden.
|
|
50
|
+
*/
|
|
51
|
+
render(): import("lit").TemplateResult<1>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Size variant of the spinner component.
|
|
3
|
+
* Determines the diameter of the spinner.
|
|
4
|
+
*
|
|
5
|
+
* - `sm`: 0.75rem (12px)
|
|
6
|
+
* - `md`: 1rem (16px) - default
|
|
7
|
+
* - `lg`: 1.5rem (24px)
|
|
8
|
+
*/
|
|
9
|
+
export type SpinnerSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
/**
|
|
11
|
+
* Color variant of the spinner component.
|
|
12
|
+
*
|
|
13
|
+
* - `primary`: Primary brand color
|
|
14
|
+
* - `secondary`: Secondary brand color
|
|
15
|
+
* - `neutral`: Neutral gray color
|
|
16
|
+
* - `current`: Inherits color from parent (default)
|
|
17
|
+
*/
|
|
18
|
+
export type SpinnerVariant = 'primary' | 'secondary' | 'neutral' | 'current';
|