@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,108 @@
|
|
|
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/link/link.ts
|
|
13
|
+
import { html, nothing } 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/link/link.ts
|
|
38
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
39
|
+
import "@latty-ds/icons";
|
|
40
|
+
|
|
41
|
+
// src/components/link/link.styles.ts
|
|
42
|
+
import { css } from "lit";
|
|
43
|
+
var linkStyles = css`
|
|
44
|
+
:host {
|
|
45
|
+
display: inline;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
a[part='base'] {
|
|
49
|
+
align-items: center;
|
|
50
|
+
color: var(--lt-text-primary);
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
font: inherit;
|
|
54
|
+
gap: 0.25em;
|
|
55
|
+
text-decoration: none;
|
|
56
|
+
vertical-align: baseline;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
a[part='base']:hover {
|
|
60
|
+
color: var(--lt-text-primary);
|
|
61
|
+
text-decoration: underline;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
a[part='base']:focus-visible {
|
|
65
|
+
border-radius: 2px;
|
|
66
|
+
outline: 2px solid var(--lt-border-focus);
|
|
67
|
+
outline-offset: 2px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
lt-icon[part='icon'] {
|
|
71
|
+
flex-shrink: 0;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
// src/components/link/link.ts
|
|
76
|
+
var Link = class extends ThemeableElement {
|
|
77
|
+
constructor() {
|
|
78
|
+
super(...arguments);
|
|
79
|
+
this.href = "";
|
|
80
|
+
this.external = false;
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
return html`
|
|
84
|
+
<a
|
|
85
|
+
part="base"
|
|
86
|
+
href=${this.href || nothing}
|
|
87
|
+
target=${this.external ? "_blank" : nothing}
|
|
88
|
+
rel=${this.external ? "noopener noreferrer" : nothing}
|
|
89
|
+
>
|
|
90
|
+
<slot></slot>
|
|
91
|
+
${this.external ? html`<lt-icon name="external" size="xs" part="icon"></lt-icon>` : nothing}
|
|
92
|
+
</a>
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
Link.styles = linkStyles;
|
|
97
|
+
__decorateClass([
|
|
98
|
+
property2({ reflect: true })
|
|
99
|
+
], Link.prototype, "href", 2);
|
|
100
|
+
__decorateClass([
|
|
101
|
+
property2({ type: Boolean, reflect: true })
|
|
102
|
+
], Link.prototype, "external", 2);
|
|
103
|
+
Link = __decorateClass([
|
|
104
|
+
customElement("lt-link")
|
|
105
|
+
], Link);
|
|
106
|
+
export {
|
|
107
|
+
Link
|
|
108
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import '@latty-ds/icons';
|
|
3
|
+
/**
|
|
4
|
+
* A styled anchor element. Uses the primary color by default with an underline on hover.
|
|
5
|
+
* Set `external` to open in a new tab and display a trailing external-link icon.
|
|
6
|
+
*
|
|
7
|
+
* @element lt-link
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <lt-link href="https://example.com">Visit site</lt-link>
|
|
12
|
+
* <lt-link href="https://example.com" external>Open in new tab</lt-link>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class Link extends ThemeableElement {
|
|
16
|
+
static styles: import("lit").CSSResult;
|
|
17
|
+
/** Destination URL forwarded to the underlying `<a>` element. */
|
|
18
|
+
href: string;
|
|
19
|
+
/** Opens the link in a new tab and appends an external-link icon. */
|
|
20
|
+
external: boolean;
|
|
21
|
+
render(): import("lit").TemplateResult<1>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const linkStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type LinkTarget = '_blank' | '_self' | '_parent' | '_top';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List component module.
|
|
3
|
+
* Exports the List web component and related type definitions.
|
|
4
|
+
*
|
|
5
|
+
* @module components/list
|
|
6
|
+
*/
|
|
7
|
+
export { List } from './list';
|
|
8
|
+
export { ListItem } from './list-item';
|
|
9
|
+
export type { ListType, ListSize } from './list.types';
|
|
@@ -0,0 +1,254 @@
|
|
|
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/list/list.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/list/list.ts
|
|
38
|
+
import { customElement as customElement2, property as property3 } from "lit/decorators.js";
|
|
39
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
40
|
+
|
|
41
|
+
// src/components/list/list.styles.ts
|
|
42
|
+
import { css } from "lit";
|
|
43
|
+
var listStyles = css`
|
|
44
|
+
:host {
|
|
45
|
+
display: block;
|
|
46
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
47
|
+
--list-marker-color: var(--lt-color-neutral-500);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
ul,
|
|
51
|
+
ol {
|
|
52
|
+
margin: 0;
|
|
53
|
+
padding: 0;
|
|
54
|
+
list-style-position: outside;
|
|
55
|
+
color: var(--lt-text-default);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ul {
|
|
59
|
+
padding-left: var(--lt-spacing-5);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ol {
|
|
63
|
+
padding-left: var(--lt-spacing-5);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
::slotted(li),
|
|
67
|
+
::slotted(lt-list-item) {
|
|
68
|
+
margin-bottom: var(--lt-spacing-2);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
::slotted(li:last-child),
|
|
72
|
+
::slotted(lt-list-item:last-child) {
|
|
73
|
+
margin-bottom: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
::slotted(lt-list) {
|
|
77
|
+
display: block;
|
|
78
|
+
margin-top: var(--lt-spacing-2);
|
|
79
|
+
margin-bottom: var(--lt-spacing-2);
|
|
80
|
+
padding-left: var(--lt-spacing-5);
|
|
81
|
+
font-size: 0.9em;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* No marker */
|
|
85
|
+
:host([no-marker]) ul,
|
|
86
|
+
:host([no-marker]) ol {
|
|
87
|
+
list-style: none;
|
|
88
|
+
padding-left: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Divider */
|
|
92
|
+
:host([divider]) ::slotted(lt-list-item) {
|
|
93
|
+
border-bottom: 1px solid var(--lt-border-default);
|
|
94
|
+
padding-bottom: var(--lt-spacing-2);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host([divider]) ::slotted(lt-list-item:last-child) {
|
|
98
|
+
border-bottom: none;
|
|
99
|
+
padding-bottom: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
::slotted(lt-list:first-child) {
|
|
103
|
+
margin-top: var(--lt-spacing-2);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
::slotted(lt-list:last-child) {
|
|
107
|
+
margin-bottom: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ul ::slotted(li)::marker {
|
|
111
|
+
color: var(--list-marker-color);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
ol ::slotted(li)::marker {
|
|
115
|
+
color: var(--list-marker-color);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Size variants */
|
|
119
|
+
:host([size='sm']) ul,
|
|
120
|
+
:host([size='sm']) ol {
|
|
121
|
+
font-size: 0.875rem;
|
|
122
|
+
line-height: 1.5;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host([size='sm']) ::slotted(li),
|
|
126
|
+
:host([size='sm']) ::slotted(lt-list-item) {
|
|
127
|
+
margin-bottom: var(--lt-spacing-1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host([size='md']) ul,
|
|
131
|
+
:host([size='md']) ol {
|
|
132
|
+
font-size: 1rem;
|
|
133
|
+
line-height: 1.6;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:host([size='md']) ::slotted(li),
|
|
137
|
+
:host([size='md']) ::slotted(lt-list-item) {
|
|
138
|
+
margin-bottom: var(--lt-spacing-2);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:host([size='lg']) ul,
|
|
142
|
+
:host([size='lg']) ol {
|
|
143
|
+
font-size: 1.125rem;
|
|
144
|
+
line-height: 1.7;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:host([size='lg']) ::slotted(li),
|
|
148
|
+
:host([size='lg']) ::slotted(lt-list-item) {
|
|
149
|
+
margin-bottom: var(--lt-spacing-3);
|
|
150
|
+
}
|
|
151
|
+
`;
|
|
152
|
+
|
|
153
|
+
// src/components/list/list-item.ts
|
|
154
|
+
import { html, nothing } from "lit";
|
|
155
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
156
|
+
|
|
157
|
+
// src/components/list/list-item.styles.ts
|
|
158
|
+
import { css as css2 } from "lit";
|
|
159
|
+
var listItemStyles = css2`
|
|
160
|
+
:host {
|
|
161
|
+
display: list-item;
|
|
162
|
+
margin: 0;
|
|
163
|
+
padding: 0;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.inner {
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: flex-start;
|
|
169
|
+
gap: var(--lt-spacing-2);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
lt-icon {
|
|
173
|
+
flex-shrink: 0;
|
|
174
|
+
color: var(--lt-color-neutral-500);
|
|
175
|
+
font-size: inherit;
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
|
|
179
|
+
// src/components/list/list-item.ts
|
|
180
|
+
import "@latty-ds/icons";
|
|
181
|
+
var ListItem = class extends ThemeableElement {
|
|
182
|
+
constructor() {
|
|
183
|
+
super(...arguments);
|
|
184
|
+
this.iconStart = "";
|
|
185
|
+
this.iconEnd = "";
|
|
186
|
+
}
|
|
187
|
+
connectedCallback() {
|
|
188
|
+
super.connectedCallback();
|
|
189
|
+
if (!this.hasAttribute("role")) this.setAttribute("role", "listitem");
|
|
190
|
+
}
|
|
191
|
+
render() {
|
|
192
|
+
return html`
|
|
193
|
+
<div class="inner">
|
|
194
|
+
${this.iconStart ? html`<lt-icon class="icon-start" name=${this.iconStart}></lt-icon>` : nothing}
|
|
195
|
+
<slot></slot>
|
|
196
|
+
${this.iconEnd ? html`<lt-icon class="icon-end" name=${this.iconEnd}></lt-icon>` : nothing}
|
|
197
|
+
</div>
|
|
198
|
+
`;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
ListItem.styles = listItemStyles;
|
|
202
|
+
__decorateClass([
|
|
203
|
+
property2({ attribute: "icon-start" })
|
|
204
|
+
], ListItem.prototype, "iconStart", 2);
|
|
205
|
+
__decorateClass([
|
|
206
|
+
property2({ attribute: "icon-end" })
|
|
207
|
+
], ListItem.prototype, "iconEnd", 2);
|
|
208
|
+
ListItem = __decorateClass([
|
|
209
|
+
customElement("lt-list-item")
|
|
210
|
+
], ListItem);
|
|
211
|
+
|
|
212
|
+
// src/components/list/list.ts
|
|
213
|
+
var List = class extends ThemeableElement {
|
|
214
|
+
constructor() {
|
|
215
|
+
super(...arguments);
|
|
216
|
+
this.type = "unordered";
|
|
217
|
+
this.size = "md";
|
|
218
|
+
this.markerColor = "";
|
|
219
|
+
this.divider = false;
|
|
220
|
+
this.noMarker = false;
|
|
221
|
+
}
|
|
222
|
+
render() {
|
|
223
|
+
const isOrdered = this.type === "ordered";
|
|
224
|
+
const styles = this.markerColor ? { "--list-marker-color": this.markerColor } : {};
|
|
225
|
+
return isOrdered ? html2`<ol part="list" style=${styleMap(styles)}>
|
|
226
|
+
<slot></slot>
|
|
227
|
+
</ol>` : html2`<ul part="list" style=${styleMap(styles)}>
|
|
228
|
+
<slot></slot>
|
|
229
|
+
</ul>`;
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
List.styles = listStyles;
|
|
233
|
+
__decorateClass([
|
|
234
|
+
property3({ reflect: true })
|
|
235
|
+
], List.prototype, "type", 2);
|
|
236
|
+
__decorateClass([
|
|
237
|
+
property3({ reflect: true })
|
|
238
|
+
], List.prototype, "size", 2);
|
|
239
|
+
__decorateClass([
|
|
240
|
+
property3({ attribute: "marker-color" })
|
|
241
|
+
], List.prototype, "markerColor", 2);
|
|
242
|
+
__decorateClass([
|
|
243
|
+
property3({ type: Boolean, reflect: true })
|
|
244
|
+
], List.prototype, "divider", 2);
|
|
245
|
+
__decorateClass([
|
|
246
|
+
property3({ type: Boolean, attribute: "no-marker", reflect: true })
|
|
247
|
+
], List.prototype, "noMarker", 2);
|
|
248
|
+
List = __decorateClass([
|
|
249
|
+
customElement2("lt-list")
|
|
250
|
+
], List);
|
|
251
|
+
export {
|
|
252
|
+
List,
|
|
253
|
+
ListItem
|
|
254
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import '@latty-ds/icons';
|
|
3
|
+
/**
|
|
4
|
+
* A list item component that renders a `<li>` element in shadow DOM.
|
|
5
|
+
*
|
|
6
|
+
* This component solves the HTML parser issue where nested `<lt-list>` components
|
|
7
|
+
* cannot contain plain `<li>` elements due to browser parsing rules. By wrapping
|
|
8
|
+
* the `<li>` in a custom element's shadow DOM, we can properly nest lists.
|
|
9
|
+
*
|
|
10
|
+
* @element lt-list-item
|
|
11
|
+
*
|
|
12
|
+
* @slot - Default slot for list item content
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```html
|
|
16
|
+
* <lt-list>
|
|
17
|
+
* <lt-list-item>First item</lt-list-item>
|
|
18
|
+
* <lt-list-item>Second item</lt-list-item>
|
|
19
|
+
* <lt-list-item>Third item</lt-list-item>
|
|
20
|
+
* </lt-list>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* With icons:
|
|
25
|
+
* ```html
|
|
26
|
+
* <lt-list>
|
|
27
|
+
* <lt-list-item icon-start="check">Done</lt-list-item>
|
|
28
|
+
* <lt-list-item icon-start="clock">Pending</lt-list-item>
|
|
29
|
+
* <lt-list-item icon-start="info" icon-end="arrow-right">Details</lt-list-item>
|
|
30
|
+
* </lt-list>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class ListItem extends ThemeableElement {
|
|
34
|
+
static styles: import("lit").CSSResult;
|
|
35
|
+
connectedCallback(): void;
|
|
36
|
+
/** Icon name to display before the item content. */
|
|
37
|
+
iconStart: string;
|
|
38
|
+
/** Icon name to display after the item content. */
|
|
39
|
+
iconEnd: string;
|
|
40
|
+
render(): import("lit").TemplateResult<1>;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listItemStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import { ListType, ListSize } from './list.types';
|
|
3
|
+
import './list-item';
|
|
4
|
+
/**
|
|
5
|
+
* A customizable list component supporting both ordered and unordered lists.
|
|
6
|
+
*
|
|
7
|
+
* @element lt-list
|
|
8
|
+
*
|
|
9
|
+
* @slot - Default slot for list items (`<li>` elements)
|
|
10
|
+
*
|
|
11
|
+
* @csspart list - The underlying `<ul>` or `<ol>` element
|
|
12
|
+
*
|
|
13
|
+
* @cssprop --list-marker-color - Color of the bullet points or numbers (default: neutral-500)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <lt-list>
|
|
18
|
+
* <li>First item</li>
|
|
19
|
+
* <li>Second item</li>
|
|
20
|
+
* <li>Third item</li>
|
|
21
|
+
* </lt-list>
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```html
|
|
26
|
+
* <lt-list type="ordered" size="lg">
|
|
27
|
+
* <li>Step one</li>
|
|
28
|
+
* <li>Step two</li>
|
|
29
|
+
* <li>Step three</li>
|
|
30
|
+
* </lt-list>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```html
|
|
35
|
+
* <lt-list marker-color="var(--lt-color-primary-500)">
|
|
36
|
+
* <li>Highlighted item</li>
|
|
37
|
+
* <li>Another item</li>
|
|
38
|
+
* </lt-list>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* Nested lists:
|
|
43
|
+
* ```html
|
|
44
|
+
* <lt-list>
|
|
45
|
+
* <li>
|
|
46
|
+
* Main item
|
|
47
|
+
* <lt-list type="ordered">
|
|
48
|
+
* <li>Nested item 1</li>
|
|
49
|
+
* <li>Nested item 2</li>
|
|
50
|
+
* </lt-list>
|
|
51
|
+
* </li>
|
|
52
|
+
* </lt-list>
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare class List extends ThemeableElement {
|
|
56
|
+
static styles: import("lit").CSSResult;
|
|
57
|
+
/**
|
|
58
|
+
* Type of list to render.
|
|
59
|
+
* @default 'unordered'
|
|
60
|
+
*/
|
|
61
|
+
type: ListType;
|
|
62
|
+
/**
|
|
63
|
+
* Size of the list items.
|
|
64
|
+
* @default 'md'
|
|
65
|
+
*/
|
|
66
|
+
size: ListSize;
|
|
67
|
+
/**
|
|
68
|
+
* Custom color for the list markers (bullets or numbers).
|
|
69
|
+
* Accepts any valid CSS color value.
|
|
70
|
+
* @default ''
|
|
71
|
+
*/
|
|
72
|
+
markerColor: string;
|
|
73
|
+
/**
|
|
74
|
+
* Whether to show a divider line between list items.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
divider: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to hide the list markers (bullets or numbers).
|
|
80
|
+
* Also removes the left indent reserved for the marker.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
noMarker: boolean;
|
|
84
|
+
render(): import("lit").TemplateResult<1>;
|
|
85
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const listStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type of list to render.
|
|
3
|
+
*
|
|
4
|
+
* - `unordered`: Renders a `<ul>` element with bullet markers
|
|
5
|
+
* - `ordered`: Renders an `<ol>` element with number markers
|
|
6
|
+
*/
|
|
7
|
+
export type ListType = 'unordered' | 'ordered';
|
|
8
|
+
/**
|
|
9
|
+
* Size variant of the list component.
|
|
10
|
+
* Affects font size and spacing.
|
|
11
|
+
*
|
|
12
|
+
* - `sm`: 0.875rem font size, compact spacing
|
|
13
|
+
* - `md`: 1rem font size, standard spacing
|
|
14
|
+
* - `lg`: 1.125rem font size, relaxed spacing
|
|
15
|
+
*/
|
|
16
|
+
export type ListSize = 'sm' | 'md' | 'lg';
|