@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,34 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import type { PaginationSize } from './pagination.types';
|
|
3
|
+
import '@latty-ds/icons';
|
|
4
|
+
/**
|
|
5
|
+
* Page navigation control for paged data sets.
|
|
6
|
+
*
|
|
7
|
+
* @element lt-pagination
|
|
8
|
+
*
|
|
9
|
+
* @fires {CustomEvent<{page: number}>} change - Fired when the user navigates to a different page.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <lt-pagination page="1" total-pages="10"></lt-pagination>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <lt-pagination page="5" total-pages="20" size="sm"></lt-pagination>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare class Pagination extends ThemeableElement {
|
|
22
|
+
static styles: import("lit").CSSResult;
|
|
23
|
+
/** Currently active page (1-indexed). */
|
|
24
|
+
page: number;
|
|
25
|
+
/** Total number of pages. */
|
|
26
|
+
totalPages: number;
|
|
27
|
+
/** Visual size. */
|
|
28
|
+
size: PaginationSize;
|
|
29
|
+
/** Disable all controls. */
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
private _go;
|
|
32
|
+
private _pages;
|
|
33
|
+
render(): import("lit").TemplateResult<1>;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const paginationStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PaginationSize = 'sm' | 'md' | 'lg';
|
|
@@ -0,0 +1,167 @@
|
|
|
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/progress/progress.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/progress/progress.ts
|
|
38
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
39
|
+
|
|
40
|
+
// src/components/progress/progress.styles.ts
|
|
41
|
+
import { css } from "lit";
|
|
42
|
+
var progressStyles = css`
|
|
43
|
+
:host {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host {
|
|
48
|
+
--_fill-color: var(--lt-interactive-primary-bg);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([variant='primary']) {
|
|
52
|
+
--_fill-color: var(--lt-interactive-primary-bg);
|
|
53
|
+
}
|
|
54
|
+
:host([variant='success']) {
|
|
55
|
+
--_fill-color: var(--lt-interactive-success-bg);
|
|
56
|
+
}
|
|
57
|
+
:host([variant='warning']) {
|
|
58
|
+
--_fill-color: var(--lt-interactive-warning-bg);
|
|
59
|
+
}
|
|
60
|
+
:host([variant='error']) {
|
|
61
|
+
--_fill-color: var(--lt-interactive-error-bg);
|
|
62
|
+
}
|
|
63
|
+
:host([variant='neutral']) {
|
|
64
|
+
--_fill-color: var(--lt-color-neutral-600);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
[part='track'] {
|
|
68
|
+
background: var(--lt-progress-track-color, var(--lt-color-neutral-200));
|
|
69
|
+
border-radius: 999px;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
width: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[part='fill'] {
|
|
75
|
+
background: var(--lt-progress-color, var(--_fill-color));
|
|
76
|
+
border-radius: 999px;
|
|
77
|
+
height: 100%;
|
|
78
|
+
transition: width 300ms ease;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* ── Sizes ──────────────────────────────────────────────────────────────── */
|
|
82
|
+
|
|
83
|
+
:host([size='sm']) [part='track'] {
|
|
84
|
+
height: var(--lt-progress-height, 4px);
|
|
85
|
+
}
|
|
86
|
+
:host([size='md']) [part='track'] {
|
|
87
|
+
height: var(--lt-progress-height, 8px);
|
|
88
|
+
}
|
|
89
|
+
:host([size='lg']) [part='track'] {
|
|
90
|
+
height: var(--lt-progress-height, 12px);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ── Indeterminate ──────────────────────────────────────────────────────── */
|
|
94
|
+
|
|
95
|
+
:host([indeterminate]) [part='fill'] {
|
|
96
|
+
animation: indeterminate 1.5s ease-in-out infinite;
|
|
97
|
+
width: 40%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@keyframes indeterminate {
|
|
101
|
+
0% {
|
|
102
|
+
transform: translateX(-250%);
|
|
103
|
+
}
|
|
104
|
+
100% {
|
|
105
|
+
transform: translateX(350%);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (prefers-reduced-motion: reduce) {
|
|
110
|
+
[part='fill'] {
|
|
111
|
+
transition: none;
|
|
112
|
+
}
|
|
113
|
+
:host([indeterminate]) [part='fill'] {
|
|
114
|
+
animation: none;
|
|
115
|
+
width: 100%;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
// src/components/progress/progress.ts
|
|
121
|
+
var Progress = class extends ThemeableElement {
|
|
122
|
+
constructor() {
|
|
123
|
+
super(...arguments);
|
|
124
|
+
this.value = 0;
|
|
125
|
+
this.variant = "primary";
|
|
126
|
+
this.size = "md";
|
|
127
|
+
this.label = "";
|
|
128
|
+
this.indeterminate = false;
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
const pct = Math.min(100, Math.max(0, this.value));
|
|
132
|
+
return html`
|
|
133
|
+
<div
|
|
134
|
+
part="track"
|
|
135
|
+
role="progressbar"
|
|
136
|
+
aria-label=${this.label || nothing}
|
|
137
|
+
aria-valuenow=${this.indeterminate ? nothing : pct}
|
|
138
|
+
aria-valuemin="0"
|
|
139
|
+
aria-valuemax="100"
|
|
140
|
+
>
|
|
141
|
+
<div part="fill" style=${this.indeterminate ? nothing : `width:${pct}%`}></div>
|
|
142
|
+
</div>
|
|
143
|
+
`;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
Progress.styles = progressStyles;
|
|
147
|
+
__decorateClass([
|
|
148
|
+
property2({ type: Number })
|
|
149
|
+
], Progress.prototype, "value", 2);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
property2({ reflect: true })
|
|
152
|
+
], Progress.prototype, "variant", 2);
|
|
153
|
+
__decorateClass([
|
|
154
|
+
property2({ reflect: true })
|
|
155
|
+
], Progress.prototype, "size", 2);
|
|
156
|
+
__decorateClass([
|
|
157
|
+
property2()
|
|
158
|
+
], Progress.prototype, "label", 2);
|
|
159
|
+
__decorateClass([
|
|
160
|
+
property2({ type: Boolean, reflect: true })
|
|
161
|
+
], Progress.prototype, "indeterminate", 2);
|
|
162
|
+
Progress = __decorateClass([
|
|
163
|
+
customElement("lt-progress")
|
|
164
|
+
], Progress);
|
|
165
|
+
export {
|
|
166
|
+
Progress
|
|
167
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import type { ProgressSize, ProgressVariant } from './progress.types';
|
|
3
|
+
/**
|
|
4
|
+
* A horizontal bar that shows how far along a process is.
|
|
5
|
+
* Supports determinate (0–100 value) and indeterminate modes.
|
|
6
|
+
*
|
|
7
|
+
* @element lt-progress
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <lt-progress value="40"></lt-progress>
|
|
12
|
+
* <lt-progress value="75" variant="success"></lt-progress>
|
|
13
|
+
* <lt-progress indeterminate></lt-progress>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class Progress extends ThemeableElement {
|
|
17
|
+
static styles: import("lit").CSSResult;
|
|
18
|
+
/**
|
|
19
|
+
* Current progress value (0–100). Ignored when `indeterminate` is true.
|
|
20
|
+
* @default 0
|
|
21
|
+
*/
|
|
22
|
+
value: number;
|
|
23
|
+
/**
|
|
24
|
+
* Color variant of the progress bar.
|
|
25
|
+
* @default 'primary'
|
|
26
|
+
*/
|
|
27
|
+
variant: ProgressVariant;
|
|
28
|
+
/**
|
|
29
|
+
* Height of the track.
|
|
30
|
+
* @default 'md'
|
|
31
|
+
*/
|
|
32
|
+
size: ProgressSize;
|
|
33
|
+
/**
|
|
34
|
+
* Accessible label for screen readers.
|
|
35
|
+
* @default ''
|
|
36
|
+
*/
|
|
37
|
+
label: string;
|
|
38
|
+
/**
|
|
39
|
+
* When true the bar animates continuously without a set value.
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
indeterminate: boolean;
|
|
43
|
+
render(): import("lit").TemplateResult<1>;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const progressStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,294 @@
|
|
|
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/radio/radio.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/radio/radio.ts
|
|
38
|
+
import { customElement, property as property2 } from "lit/decorators.js";
|
|
39
|
+
|
|
40
|
+
// src/components/radio/radio.styles.ts
|
|
41
|
+
import { css } from "lit";
|
|
42
|
+
var radioStyles = css`
|
|
43
|
+
:host {
|
|
44
|
+
display: inline-block;
|
|
45
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.radio-wrapper {
|
|
49
|
+
align-items: center;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
gap: var(--lt-spacing-2);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.radio-container {
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
position: relative;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([label-position='left']) .radio-wrapper {
|
|
61
|
+
flex-direction: row-reverse;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
:host([disabled]) .radio-wrapper {
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
opacity: 0.6;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
input[type='radio'] {
|
|
70
|
+
appearance: none;
|
|
71
|
+
border-radius: 50%;
|
|
72
|
+
border: 2px solid var(--lt-border-strong);
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
flex-shrink: 0;
|
|
75
|
+
margin: 0;
|
|
76
|
+
position: relative;
|
|
77
|
+
transition:
|
|
78
|
+
background-color 120ms ease,
|
|
79
|
+
border-color 120ms ease;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
input[type='radio']:hover:not(:disabled) {
|
|
83
|
+
border-color: var(--lt-color-neutral-600);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
input[type='radio']:focus-visible {
|
|
87
|
+
outline: 3px solid var(--lt-border-focus);
|
|
88
|
+
outline-offset: 2px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input[type='radio']:disabled {
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.dot {
|
|
96
|
+
background: white;
|
|
97
|
+
border-radius: 50%;
|
|
98
|
+
display: none;
|
|
99
|
+
pointer-events: none;
|
|
100
|
+
position: absolute;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
input[type='radio']:checked ~ .dot {
|
|
104
|
+
display: block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.label {
|
|
108
|
+
color: var(--lt-text-default);
|
|
109
|
+
user-select: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Size variants */
|
|
113
|
+
:host([size='sm']) input[type='radio'] {
|
|
114
|
+
height: 16px;
|
|
115
|
+
width: 16px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([size='sm']) .dot {
|
|
119
|
+
height: 8px;
|
|
120
|
+
width: 8px;
|
|
121
|
+
left: 4px;
|
|
122
|
+
top: 4px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host([size='sm']) .label {
|
|
126
|
+
font-size: 0.875rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
:host([size='md']) input[type='radio'] {
|
|
130
|
+
height: 20px;
|
|
131
|
+
width: 20px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([size='md']) .dot {
|
|
135
|
+
height: 10px;
|
|
136
|
+
width: 10px;
|
|
137
|
+
left: 5px;
|
|
138
|
+
top: 5px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:host([size='md']) .label {
|
|
142
|
+
font-size: 1rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:host([size='lg']) input[type='radio'] {
|
|
146
|
+
height: 24px;
|
|
147
|
+
width: 24px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
:host([size='lg']) .dot {
|
|
151
|
+
height: 12px;
|
|
152
|
+
width: 12px;
|
|
153
|
+
left: 6px;
|
|
154
|
+
top: 6px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:host([size='lg']) .label {
|
|
158
|
+
font-size: 1.0625rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* Variant styles */
|
|
162
|
+
:host([variant='primary']) input[type='radio']:checked {
|
|
163
|
+
background: var(--lt-interactive-primary-bg);
|
|
164
|
+
border-color: var(--lt-interactive-primary-bg);
|
|
165
|
+
}
|
|
166
|
+
:host([variant='primary']) input[type='radio']:checked:hover:not(:disabled) {
|
|
167
|
+
background: var(--lt-interactive-primary-bg-hover);
|
|
168
|
+
border-color: var(--lt-interactive-primary-bg-hover);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:host([variant='secondary']) input[type='radio']:checked {
|
|
172
|
+
background: var(--lt-interactive-secondary-bg);
|
|
173
|
+
border-color: var(--lt-interactive-secondary-bg);
|
|
174
|
+
}
|
|
175
|
+
:host([variant='secondary']) input[type='radio']:checked:hover:not(:disabled) {
|
|
176
|
+
background: var(--lt-interactive-secondary-bg-hover);
|
|
177
|
+
border-color: var(--lt-interactive-secondary-bg-hover);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
:host([variant='success']) input[type='radio']:checked {
|
|
181
|
+
background: var(--lt-interactive-success-bg);
|
|
182
|
+
border-color: var(--lt-interactive-success-bg);
|
|
183
|
+
}
|
|
184
|
+
:host([variant='success']) input[type='radio']:checked:hover:not(:disabled) {
|
|
185
|
+
background: var(--lt-interactive-success-bg-hover);
|
|
186
|
+
border-color: var(--lt-interactive-success-bg-hover);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
:host([variant='error']) input[type='radio']:checked {
|
|
190
|
+
background: var(--lt-interactive-error-bg);
|
|
191
|
+
border-color: var(--lt-interactive-error-bg);
|
|
192
|
+
}
|
|
193
|
+
:host([variant='error']) input[type='radio']:checked:hover:not(:disabled) {
|
|
194
|
+
background: var(--lt-interactive-error-bg-hover);
|
|
195
|
+
border-color: var(--lt-interactive-error-bg-hover);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
:host([variant='info']) input[type='radio']:checked {
|
|
199
|
+
background: var(--lt-interactive-info-bg);
|
|
200
|
+
border-color: var(--lt-interactive-info-bg);
|
|
201
|
+
}
|
|
202
|
+
:host([variant='info']) input[type='radio']:checked:hover:not(:disabled) {
|
|
203
|
+
background: var(--lt-interactive-info-bg-hover);
|
|
204
|
+
border-color: var(--lt-interactive-info-bg-hover);
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
|
|
208
|
+
// src/components/radio/radio.ts
|
|
209
|
+
var Radio = class extends ThemeableElement {
|
|
210
|
+
constructor() {
|
|
211
|
+
super(...arguments);
|
|
212
|
+
this.variant = "primary";
|
|
213
|
+
this.size = "md";
|
|
214
|
+
this.checked = false;
|
|
215
|
+
this.disabled = false;
|
|
216
|
+
this.required = false;
|
|
217
|
+
this.label = "";
|
|
218
|
+
this.labelPosition = "right";
|
|
219
|
+
this.name = "";
|
|
220
|
+
this.value = "";
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Handles radio change events.
|
|
224
|
+
* Updates the checked state and dispatches a custom change event.
|
|
225
|
+
*
|
|
226
|
+
* @param e - The native change event
|
|
227
|
+
* @private
|
|
228
|
+
*/
|
|
229
|
+
handleChange(e) {
|
|
230
|
+
const target = e.target;
|
|
231
|
+
this.checked = target.checked;
|
|
232
|
+
this.dispatchEvent(
|
|
233
|
+
new CustomEvent("change", {
|
|
234
|
+
detail: { value: this.value, checked: this.checked },
|
|
235
|
+
bubbles: true,
|
|
236
|
+
composed: true
|
|
237
|
+
})
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
render() {
|
|
241
|
+
return html`
|
|
242
|
+
<label class="radio-wrapper">
|
|
243
|
+
<div class="radio-container">
|
|
244
|
+
<input
|
|
245
|
+
type="radio"
|
|
246
|
+
.checked=${this.checked}
|
|
247
|
+
?disabled=${this.disabled}
|
|
248
|
+
?required=${this.required}
|
|
249
|
+
name=${this.name}
|
|
250
|
+
value=${this.value}
|
|
251
|
+
@change=${this.handleChange}
|
|
252
|
+
aria-label=${this.label || "radio"}
|
|
253
|
+
/>
|
|
254
|
+
<span class="dot"></span>
|
|
255
|
+
</div>
|
|
256
|
+
${this.label ? html`<span class="label">${this.label}</span>` : ""}
|
|
257
|
+
</label>
|
|
258
|
+
`;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
Radio.styles = radioStyles;
|
|
262
|
+
__decorateClass([
|
|
263
|
+
property2({ reflect: true })
|
|
264
|
+
], Radio.prototype, "variant", 2);
|
|
265
|
+
__decorateClass([
|
|
266
|
+
property2({ reflect: true })
|
|
267
|
+
], Radio.prototype, "size", 2);
|
|
268
|
+
__decorateClass([
|
|
269
|
+
property2({ type: Boolean, reflect: true })
|
|
270
|
+
], Radio.prototype, "checked", 2);
|
|
271
|
+
__decorateClass([
|
|
272
|
+
property2({ type: Boolean, reflect: true })
|
|
273
|
+
], Radio.prototype, "disabled", 2);
|
|
274
|
+
__decorateClass([
|
|
275
|
+
property2({ type: Boolean, reflect: true })
|
|
276
|
+
], Radio.prototype, "required", 2);
|
|
277
|
+
__decorateClass([
|
|
278
|
+
property2()
|
|
279
|
+
], Radio.prototype, "label", 2);
|
|
280
|
+
__decorateClass([
|
|
281
|
+
property2({ attribute: "label-position", reflect: true })
|
|
282
|
+
], Radio.prototype, "labelPosition", 2);
|
|
283
|
+
__decorateClass([
|
|
284
|
+
property2()
|
|
285
|
+
], Radio.prototype, "name", 2);
|
|
286
|
+
__decorateClass([
|
|
287
|
+
property2()
|
|
288
|
+
], Radio.prototype, "value", 2);
|
|
289
|
+
Radio = __decorateClass([
|
|
290
|
+
customElement("lt-radio")
|
|
291
|
+
], Radio);
|
|
292
|
+
export {
|
|
293
|
+
Radio
|
|
294
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import { RadioSize, RadioVariant, RadioLabelPosition } from './radio.types';
|
|
3
|
+
/**
|
|
4
|
+
* A customizable radio button component with support for multiple variants and sizes.
|
|
5
|
+
*
|
|
6
|
+
* @element lt-radio
|
|
7
|
+
*
|
|
8
|
+
* @fires {CustomEvent<{value: string, checked: boolean}>} change - Dispatched when the radio is selected
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```html
|
|
12
|
+
* <lt-radio name="size" value="small" label="Small"></lt-radio>
|
|
13
|
+
* <lt-radio name="size" value="medium" label="Medium" checked></lt-radio>
|
|
14
|
+
* <lt-radio name="size" value="large" label="Large"></lt-radio>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```html
|
|
19
|
+
* <lt-radio
|
|
20
|
+
* variant="success"
|
|
21
|
+
* name="option"
|
|
22
|
+
* value="yes"
|
|
23
|
+
* label="Yes, I agree"
|
|
24
|
+
* checked
|
|
25
|
+
* ></lt-radio>
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```html
|
|
30
|
+
* <lt-radio
|
|
31
|
+
* variant="error"
|
|
32
|
+
* name="delete"
|
|
33
|
+
* value="confirm"
|
|
34
|
+
* label="Confirm deletion"
|
|
35
|
+
* required
|
|
36
|
+
* ></lt-radio>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare class Radio extends ThemeableElement {
|
|
40
|
+
static styles: import("lit").CSSResult;
|
|
41
|
+
/**
|
|
42
|
+
* Visual variant that determines the color when checked.
|
|
43
|
+
* @default 'primary'
|
|
44
|
+
*/
|
|
45
|
+
variant: RadioVariant;
|
|
46
|
+
/**
|
|
47
|
+
* Size of the radio button.
|
|
48
|
+
* @default 'md'
|
|
49
|
+
*/
|
|
50
|
+
size: RadioSize;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the radio is checked.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
checked: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the radio is disabled.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the radio is required.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
required: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Label text displayed next to the radio button.
|
|
68
|
+
* @default ''
|
|
69
|
+
*/
|
|
70
|
+
label: string;
|
|
71
|
+
/**
|
|
72
|
+
* Position of the label relative to the radio button.
|
|
73
|
+
* @default 'right'
|
|
74
|
+
*/
|
|
75
|
+
labelPosition: RadioLabelPosition;
|
|
76
|
+
/**
|
|
77
|
+
* Name attribute for radio group.
|
|
78
|
+
* All radios with the same name belong to the same group.
|
|
79
|
+
* @default ''
|
|
80
|
+
*/
|
|
81
|
+
name: string;
|
|
82
|
+
/**
|
|
83
|
+
* Value attribute for form submission.
|
|
84
|
+
* @default ''
|
|
85
|
+
*/
|
|
86
|
+
value: string;
|
|
87
|
+
/**
|
|
88
|
+
* Handles radio change events.
|
|
89
|
+
* Updates the checked state and dispatches a custom change event.
|
|
90
|
+
*
|
|
91
|
+
* @param e - The native change event
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
private handleChange;
|
|
95
|
+
render(): import("lit").TemplateResult<1>;
|
|
96
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const radioStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Size variant of the radio component.
|
|
3
|
+
* Affects the radio button size and label font size.
|
|
4
|
+
*
|
|
5
|
+
* - `sm`: 16px radio, 0.875rem label
|
|
6
|
+
* - `md`: 20px radio, 1rem label (default)
|
|
7
|
+
* - `lg`: 24px radio, 1.0625rem label
|
|
8
|
+
*/
|
|
9
|
+
export type RadioSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
/**
|
|
11
|
+
* Visual variant of the radio component.
|
|
12
|
+
* Determines the color when checked.
|
|
13
|
+
*
|
|
14
|
+
* - `primary`: Primary brand color (default)
|
|
15
|
+
* - `secondary`: Secondary brand color
|
|
16
|
+
* - `success`: Green color
|
|
17
|
+
* - `error`: Red color
|
|
18
|
+
* - `info`: Blue color
|
|
19
|
+
*/
|
|
20
|
+
export type RadioVariant = 'primary' | 'secondary' | 'success' | 'error' | 'info';
|
|
21
|
+
export type RadioLabelPosition = 'left' | 'right';
|