@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,489 @@
|
|
|
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/color-input/color-input.ts
|
|
13
|
+
import { html as html2 } from "lit";
|
|
14
|
+
import { customElement as customElement2, property as property3 } from "lit/decorators.js";
|
|
15
|
+
|
|
16
|
+
// src/base/themeable-element.ts
|
|
17
|
+
import { LitElement } from "lit";
|
|
18
|
+
import { property } from "lit/decorators.js";
|
|
19
|
+
var ThemeableElement = class extends LitElement {
|
|
20
|
+
willUpdate(changed) {
|
|
21
|
+
super.willUpdate(changed);
|
|
22
|
+
if (changed.has("theme")) {
|
|
23
|
+
this._syncThemeAttribute();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
_syncThemeAttribute() {
|
|
27
|
+
if (this.theme === "dark" || this.theme === "light") {
|
|
28
|
+
this.setAttribute("data-theme", this.theme);
|
|
29
|
+
} else {
|
|
30
|
+
this.removeAttribute("data-theme");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
__decorateClass([
|
|
35
|
+
property({ reflect: true })
|
|
36
|
+
], ThemeableElement.prototype, "theme", 2);
|
|
37
|
+
|
|
38
|
+
// src/components/color-input/color-input.styles.ts
|
|
39
|
+
import { css } from "lit";
|
|
40
|
+
var colorInputStyles = css`
|
|
41
|
+
:host {
|
|
42
|
+
display: inline-block;
|
|
43
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
44
|
+
width: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.wrapper {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: var(--lt-spacing-1);
|
|
51
|
+
width: 100%;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([disabled]) .wrapper {
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.label {
|
|
60
|
+
color: var(--lt-text-subtle);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.input-container {
|
|
64
|
+
position: relative;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
background: var(--lt-bg-subtle);
|
|
68
|
+
border: 1px solid var(--lt-border-default);
|
|
69
|
+
border-radius: var(--lt-border-radius);
|
|
70
|
+
box-sizing: border-box;
|
|
71
|
+
transition:
|
|
72
|
+
border-color 120ms ease,
|
|
73
|
+
box-shadow 120ms ease;
|
|
74
|
+
width: 100%;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.input-container:hover:not(:has(.native-picker:disabled)) {
|
|
79
|
+
border-color: var(--lt-border-strong);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.input-container:focus-within {
|
|
83
|
+
border-color: var(--lt-interactive-primary-bg);
|
|
84
|
+
box-shadow: 0 0 0 3px var(--lt-bg-primary-subtle);
|
|
85
|
+
outline: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([disabled]) .input-container {
|
|
89
|
+
background: var(--lt-bg-surface);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.color-swatch {
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
border-radius: 50%;
|
|
95
|
+
border: 1.5px solid rgb(0 0 0 / 0.15);
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.color-swatch.empty {
|
|
100
|
+
border-style: dashed;
|
|
101
|
+
border-color: var(--lt-border-default);
|
|
102
|
+
background: repeating-conic-gradient(var(--lt-bg-muted) 0% 25%, transparent 0% 50%) 0 0 / 8px 8px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.display-value {
|
|
106
|
+
flex: 1;
|
|
107
|
+
color: var(--lt-text-default);
|
|
108
|
+
font-family: inherit;
|
|
109
|
+
font-weight: 400;
|
|
110
|
+
white-space: nowrap;
|
|
111
|
+
overflow: hidden;
|
|
112
|
+
text-overflow: ellipsis;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.display-value.is-placeholder {
|
|
116
|
+
color: var(--lt-text-muted);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:host([disabled]) .display-value {
|
|
120
|
+
color: var(--lt-text-muted);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.icon-end {
|
|
124
|
+
flex-shrink: 0;
|
|
125
|
+
color: var(--lt-text-muted);
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* The native picker is invisible but covers the entire container to handle all click/keyboard events */
|
|
130
|
+
.native-picker {
|
|
131
|
+
position: absolute;
|
|
132
|
+
inset: 0;
|
|
133
|
+
width: 100%;
|
|
134
|
+
height: 100%;
|
|
135
|
+
opacity: 0;
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
border: none;
|
|
138
|
+
padding: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.native-picker:disabled {
|
|
142
|
+
cursor: not-allowed;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* ── sizes ───────────────────────────────────────────────────────────────── */
|
|
146
|
+
|
|
147
|
+
:host([size='sm']) .input-container {
|
|
148
|
+
height: 32px;
|
|
149
|
+
padding-inline: var(--lt-spacing-3);
|
|
150
|
+
gap: var(--lt-spacing-2);
|
|
151
|
+
font-size: 0.875rem;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([size='sm']) .color-swatch {
|
|
155
|
+
width: 14px;
|
|
156
|
+
height: 14px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:host([size='md']) .input-container {
|
|
160
|
+
height: 40px;
|
|
161
|
+
padding-inline: var(--lt-spacing-4);
|
|
162
|
+
gap: var(--lt-spacing-2);
|
|
163
|
+
font-size: 1rem;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:host([size='md']) .color-swatch {
|
|
167
|
+
width: 16px;
|
|
168
|
+
height: 16px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:host([size='lg']) .input-container {
|
|
172
|
+
height: 48px;
|
|
173
|
+
padding-inline: var(--lt-spacing-5);
|
|
174
|
+
gap: var(--lt-spacing-3);
|
|
175
|
+
font-size: 1.0625rem;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
:host([size='lg']) .color-swatch {
|
|
179
|
+
width: 20px;
|
|
180
|
+
height: 20px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
:host([size='lg']) .icon-end {
|
|
184
|
+
width: 24px;
|
|
185
|
+
height: 24px;
|
|
186
|
+
}
|
|
187
|
+
`;
|
|
188
|
+
|
|
189
|
+
// src/components/color-input/color-input.ts
|
|
190
|
+
import "@latty-ds/icons";
|
|
191
|
+
|
|
192
|
+
// src/components/text/text.ts
|
|
193
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
194
|
+
import { html, unsafeStatic } from "lit/static-html.js";
|
|
195
|
+
|
|
196
|
+
// src/components/text/text.styles.ts
|
|
197
|
+
import { css as css2 } from "lit";
|
|
198
|
+
var textStyles = css2`
|
|
199
|
+
:host {
|
|
200
|
+
display: block;
|
|
201
|
+
color: inherit;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Inline variants sit in text flow */
|
|
205
|
+
:host([variant='caption']),
|
|
206
|
+
:host([variant='overline']),
|
|
207
|
+
:host([variant='label']) {
|
|
208
|
+
display: inline;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
[part='base'] {
|
|
212
|
+
margin: 0;
|
|
213
|
+
color: inherit;
|
|
214
|
+
font-family: var(--lt-typography-fontfamily);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* ── Display ─────────────────────────────────────────────────────────── */
|
|
218
|
+
|
|
219
|
+
:host([variant='display-2xl']) [part='base'] {
|
|
220
|
+
font-size: clamp(2.5rem, 6vw, 4.5rem);
|
|
221
|
+
font-weight: var(--lt-text-weight, 200);
|
|
222
|
+
line-height: 1.1;
|
|
223
|
+
letter-spacing: -0.02em;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
:host([variant='display-xl']) [part='base'] {
|
|
227
|
+
font-size: clamp(2rem, 5vw, 3.75rem);
|
|
228
|
+
font-weight: var(--lt-text-weight, 200);
|
|
229
|
+
line-height: 1.1;
|
|
230
|
+
letter-spacing: -0.02em;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
:host([variant='display-lg']) [part='base'] {
|
|
234
|
+
font-size: clamp(2rem, 4vw, 3rem);
|
|
235
|
+
font-weight: var(--lt-text-weight, 200);
|
|
236
|
+
line-height: 1.15;
|
|
237
|
+
letter-spacing: -0.01em;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* ── Headings ─────────────────────────────────────────────────────────── */
|
|
241
|
+
|
|
242
|
+
:host([variant='h1']) [part='base'] {
|
|
243
|
+
font-size: clamp(1.75rem, 2.5vw + 0.75rem, 2.5rem);
|
|
244
|
+
font-weight: var(--lt-text-weight, 600);
|
|
245
|
+
line-height: 1.2;
|
|
246
|
+
letter-spacing: -0.02em;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
:host([variant='h2']) [part='base'] {
|
|
250
|
+
font-size: clamp(1.5rem, 2vw + 0.5rem, 2rem);
|
|
251
|
+
font-weight: var(--lt-text-weight, 600);
|
|
252
|
+
line-height: 1.25;
|
|
253
|
+
letter-spacing: -0.01em;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
:host([variant='h3']) [part='base'] {
|
|
257
|
+
font-size: clamp(1.25rem, 1.5vw + 0.5rem, 1.5rem);
|
|
258
|
+
font-weight: var(--lt-text-weight, 600);
|
|
259
|
+
line-height: 1.3;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
:host([variant='h4']) [part='base'] {
|
|
263
|
+
font-size: 1.25rem;
|
|
264
|
+
font-weight: var(--lt-text-weight, 600);
|
|
265
|
+
line-height: 1.35;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
:host([variant='h5']) [part='base'] {
|
|
269
|
+
font-size: 1.125rem;
|
|
270
|
+
font-weight: var(--lt-text-weight, 600);
|
|
271
|
+
line-height: 1.4;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:host([variant='h6']) [part='base'] {
|
|
275
|
+
font-size: 1rem;
|
|
276
|
+
font-weight: var(--lt-text-weight, 600);
|
|
277
|
+
line-height: 1.4;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/* ── Body ─────────────────────────────────────────────────────────────── */
|
|
281
|
+
|
|
282
|
+
:host([variant='lead']) [part='base'] {
|
|
283
|
+
font-size: 1.25rem;
|
|
284
|
+
font-weight: var(--lt-text-weight, 400);
|
|
285
|
+
line-height: 1.6;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
:host([variant='body']) [part='base'],
|
|
289
|
+
:host(:not([variant])) [part='base'] {
|
|
290
|
+
font-size: 1rem;
|
|
291
|
+
font-weight: var(--lt-text-weight, 400);
|
|
292
|
+
line-height: 1.6;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
:host([variant='body-sm']) [part='base'] {
|
|
296
|
+
font-size: 0.875rem;
|
|
297
|
+
font-weight: var(--lt-text-weight, 400);
|
|
298
|
+
line-height: 1.6;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/* ── Inline ───────────────────────────────────────────────────────────── */
|
|
302
|
+
|
|
303
|
+
:host([variant='caption']) [part='base'] {
|
|
304
|
+
font-size: 0.75rem;
|
|
305
|
+
font-weight: var(--lt-text-weight, 400);
|
|
306
|
+
line-height: 1.5;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
:host([variant='overline']) [part='base'] {
|
|
310
|
+
font-size: 0.6875rem;
|
|
311
|
+
font-weight: var(--lt-text-weight, 600);
|
|
312
|
+
line-height: 1.2;
|
|
313
|
+
letter-spacing: 0.08em;
|
|
314
|
+
text-transform: uppercase;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
:host([variant='label']) [part='base'] {
|
|
318
|
+
font-size: 0.875rem;
|
|
319
|
+
font-weight: var(--lt-text-weight, 600);
|
|
320
|
+
line-height: 1.4;
|
|
321
|
+
}
|
|
322
|
+
`;
|
|
323
|
+
|
|
324
|
+
// src/components/text/text.ts
|
|
325
|
+
var VARIANT_TAG = {
|
|
326
|
+
"display-2xl": "p",
|
|
327
|
+
"display-xl": "p",
|
|
328
|
+
"display-lg": "p",
|
|
329
|
+
h1: "h1",
|
|
330
|
+
h2: "h2",
|
|
331
|
+
h3: "h3",
|
|
332
|
+
h4: "h4",
|
|
333
|
+
h5: "h5",
|
|
334
|
+
h6: "h6",
|
|
335
|
+
lead: "p",
|
|
336
|
+
body: "p",
|
|
337
|
+
"body-sm": "p",
|
|
338
|
+
caption: "span",
|
|
339
|
+
overline: "span",
|
|
340
|
+
label: "span"
|
|
341
|
+
};
|
|
342
|
+
var Text = class extends ThemeableElement {
|
|
343
|
+
constructor() {
|
|
344
|
+
super(...arguments);
|
|
345
|
+
this.variant = "body";
|
|
346
|
+
this.as = "";
|
|
347
|
+
}
|
|
348
|
+
render() {
|
|
349
|
+
const tag = unsafeStatic(this.as || VARIANT_TAG[this.variant] || "p");
|
|
350
|
+
return html`<${tag} part="base"><slot></slot></${tag}>`;
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
Text.styles = textStyles;
|
|
354
|
+
__decorateClass([
|
|
355
|
+
property2({ reflect: true })
|
|
356
|
+
], Text.prototype, "variant", 2);
|
|
357
|
+
__decorateClass([
|
|
358
|
+
property2({ reflect: true })
|
|
359
|
+
], Text.prototype, "as", 2);
|
|
360
|
+
Text = __decorateClass([
|
|
361
|
+
customElement("lt-text")
|
|
362
|
+
], Text);
|
|
363
|
+
|
|
364
|
+
// src/components/color-input/color-input.ts
|
|
365
|
+
function hexToRgbTuple(hex) {
|
|
366
|
+
const m = /^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
367
|
+
return m ? [parseInt(m[1], 16), parseInt(m[2], 16), parseInt(m[3], 16)] : null;
|
|
368
|
+
}
|
|
369
|
+
function hexToHslTuple(hex) {
|
|
370
|
+
const rgb = hexToRgbTuple(hex);
|
|
371
|
+
if (!rgb) return null;
|
|
372
|
+
const [r, g, b] = rgb.map((v) => v / 255);
|
|
373
|
+
const max = Math.max(r, g, b);
|
|
374
|
+
const min = Math.min(r, g, b);
|
|
375
|
+
const l = (max + min) / 2;
|
|
376
|
+
if (max === min) return [0, 0, Math.round(l * 100)];
|
|
377
|
+
const d = max - min;
|
|
378
|
+
const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
379
|
+
let h = 0;
|
|
380
|
+
if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
381
|
+
else if (max === g) h = ((b - r) / d + 2) / 6;
|
|
382
|
+
else h = ((r - g) / d + 4) / 6;
|
|
383
|
+
return [Math.round(h * 360), Math.round(s * 100), Math.round(l * 100)];
|
|
384
|
+
}
|
|
385
|
+
function hslToHex(h, s, l) {
|
|
386
|
+
s /= 100;
|
|
387
|
+
l /= 100;
|
|
388
|
+
const k = (n) => (n + h / 30) % 12;
|
|
389
|
+
const a = s * Math.min(l, 1 - l);
|
|
390
|
+
const f = (n) => l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
391
|
+
const toHexByte = (x) => Math.round(x * 255).toString(16).padStart(2, "0");
|
|
392
|
+
return `#${toHexByte(f(0))}${toHexByte(f(8))}${toHexByte(f(4))}`;
|
|
393
|
+
}
|
|
394
|
+
function toHex(value) {
|
|
395
|
+
value = value.trim();
|
|
396
|
+
if (!value) return "";
|
|
397
|
+
if (/^#[0-9a-f]{6}$/i.test(value)) return value.toLowerCase();
|
|
398
|
+
if (/^#[0-9a-f]{3}$/i.test(value)) {
|
|
399
|
+
const [, r, g, b] = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(value);
|
|
400
|
+
return `#${r}${r}${g}${g}${b}${b}`;
|
|
401
|
+
}
|
|
402
|
+
const rgb = value.match(/^rgb\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)\s*\)$/i);
|
|
403
|
+
if (rgb) {
|
|
404
|
+
const toB = (n) => Number(n).toString(16).padStart(2, "0");
|
|
405
|
+
return `#${toB(rgb[1])}${toB(rgb[2])}${toB(rgb[3])}`;
|
|
406
|
+
}
|
|
407
|
+
const hsl = value.match(/^hsl\(\s*(\d+)[,\s]+(\d+)%[,\s]+(\d+)%\s*\)$/i);
|
|
408
|
+
if (hsl) return hslToHex(Number(hsl[1]), Number(hsl[2]), Number(hsl[3]));
|
|
409
|
+
return "";
|
|
410
|
+
}
|
|
411
|
+
function formatColor(hex, format) {
|
|
412
|
+
if (format === "rgb") {
|
|
413
|
+
const t = hexToRgbTuple(hex);
|
|
414
|
+
return t ? `rgb(${t[0]}, ${t[1]}, ${t[2]})` : hex;
|
|
415
|
+
}
|
|
416
|
+
if (format === "hsl") {
|
|
417
|
+
const t = hexToHslTuple(hex);
|
|
418
|
+
return t ? `hsl(${t[0]}, ${t[1]}%, ${t[2]}%)` : hex;
|
|
419
|
+
}
|
|
420
|
+
return hex;
|
|
421
|
+
}
|
|
422
|
+
var ColorInput = class extends ThemeableElement {
|
|
423
|
+
constructor() {
|
|
424
|
+
super(...arguments);
|
|
425
|
+
this.value = "";
|
|
426
|
+
this.format = "hex";
|
|
427
|
+
this.label = "";
|
|
428
|
+
this.placeholder = "Pick a color";
|
|
429
|
+
this.disabled = false;
|
|
430
|
+
this.size = "md";
|
|
431
|
+
}
|
|
432
|
+
_handleChange(e) {
|
|
433
|
+
const pickerHex = e.target.value;
|
|
434
|
+
this.value = formatColor(pickerHex, this.format);
|
|
435
|
+
this.dispatchEvent(
|
|
436
|
+
new CustomEvent("change", {
|
|
437
|
+
detail: { value: this.value },
|
|
438
|
+
bubbles: true,
|
|
439
|
+
composed: true
|
|
440
|
+
})
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
render() {
|
|
444
|
+
const hex = toHex(this.value);
|
|
445
|
+
return html2`
|
|
446
|
+
<label class="wrapper">
|
|
447
|
+
${this.label ? html2`<span class="label"><lt-text variant="label" as="span">${this.label}</lt-text></span>` : ""}
|
|
448
|
+
<span class="input-container">
|
|
449
|
+
<span class="color-swatch ${hex ? "" : "empty"}" style="background: ${hex || "transparent"}"></span>
|
|
450
|
+
<span class="display-value ${hex ? "" : "is-placeholder"}"> ${this.value || this.placeholder} </span>
|
|
451
|
+
<lt-icon class="icon-end" name="color-palette"></lt-icon>
|
|
452
|
+
<input
|
|
453
|
+
type="color"
|
|
454
|
+
class="native-picker"
|
|
455
|
+
.value=${hex || "#000000"}
|
|
456
|
+
?disabled=${this.disabled}
|
|
457
|
+
aria-label=${this.label || this.placeholder}
|
|
458
|
+
@change=${this._handleChange}
|
|
459
|
+
/>
|
|
460
|
+
</span>
|
|
461
|
+
</label>
|
|
462
|
+
`;
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
ColorInput.styles = colorInputStyles;
|
|
466
|
+
__decorateClass([
|
|
467
|
+
property3()
|
|
468
|
+
], ColorInput.prototype, "value", 2);
|
|
469
|
+
__decorateClass([
|
|
470
|
+
property3({ reflect: true })
|
|
471
|
+
], ColorInput.prototype, "format", 2);
|
|
472
|
+
__decorateClass([
|
|
473
|
+
property3()
|
|
474
|
+
], ColorInput.prototype, "label", 2);
|
|
475
|
+
__decorateClass([
|
|
476
|
+
property3()
|
|
477
|
+
], ColorInput.prototype, "placeholder", 2);
|
|
478
|
+
__decorateClass([
|
|
479
|
+
property3({ type: Boolean, reflect: true })
|
|
480
|
+
], ColorInput.prototype, "disabled", 2);
|
|
481
|
+
__decorateClass([
|
|
482
|
+
property3({ reflect: true })
|
|
483
|
+
], ColorInput.prototype, "size", 2);
|
|
484
|
+
ColorInput = __decorateClass([
|
|
485
|
+
customElement2("lt-color-input")
|
|
486
|
+
], ColorInput);
|
|
487
|
+
export {
|
|
488
|
+
ColorInput
|
|
489
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import type { ComboboxOption, ComboboxSize, ComboboxVariant } from './combobox.types';
|
|
3
|
+
import '@latty-ds/icons';
|
|
4
|
+
import '../text/text';
|
|
5
|
+
/**
|
|
6
|
+
* Searchable single-select combobox. The user types to filter options; selecting an option sets the value.
|
|
7
|
+
*
|
|
8
|
+
* @element lt-combobox
|
|
9
|
+
*
|
|
10
|
+
* @fires {CustomEvent<{value: string, label: string}>} change - Fired when the selected value changes.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <lt-combobox
|
|
15
|
+
* label="Country"
|
|
16
|
+
* placeholder="Search countries…"
|
|
17
|
+
* .options=${[{ value: 'us', label: 'United States' }, { value: 'ca', label: 'Canada' }]}
|
|
18
|
+
* ></lt-combobox>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class Combobox extends ThemeableElement {
|
|
22
|
+
static styles: import("lit").CSSResult[];
|
|
23
|
+
/** Array of selectable options. Set as a JS property (`.options`). */
|
|
24
|
+
options: ComboboxOption[];
|
|
25
|
+
/** Currently selected value. */
|
|
26
|
+
value: string;
|
|
27
|
+
/** Field label displayed above the input. */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Placeholder text shown when nothing is typed. */
|
|
30
|
+
placeholder: string;
|
|
31
|
+
/** Helper or error text displayed below the input. */
|
|
32
|
+
helperText: string;
|
|
33
|
+
/** Visual state variant. */
|
|
34
|
+
variant: ComboboxVariant;
|
|
35
|
+
/** Visual size. */
|
|
36
|
+
size: ComboboxSize;
|
|
37
|
+
/** Whether the field is disabled. */
|
|
38
|
+
disabled: boolean;
|
|
39
|
+
/** Whether the field is required. */
|
|
40
|
+
required: boolean;
|
|
41
|
+
/** Name used in form submission. */
|
|
42
|
+
name: string;
|
|
43
|
+
private query;
|
|
44
|
+
private open;
|
|
45
|
+
private activeIndex;
|
|
46
|
+
private _cleanupClickOutside;
|
|
47
|
+
private _floatingCleanup;
|
|
48
|
+
private get selectedLabel();
|
|
49
|
+
private get filtered();
|
|
50
|
+
private openDropdown;
|
|
51
|
+
private closeDropdown;
|
|
52
|
+
private selectOption;
|
|
53
|
+
private handleInput;
|
|
54
|
+
private handleFocus;
|
|
55
|
+
private handleKeydown;
|
|
56
|
+
connectedCallback(): void;
|
|
57
|
+
disconnectedCallback(): void;
|
|
58
|
+
render(): import("lit").TemplateResult<1>;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const comboboxStyles: import("lit").CSSResult[];
|