@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,113 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import { CheckboxSize, CheckboxVariant, CheckboxLabelPosition } from './checkbox.types';
|
|
3
|
+
import '@latty-ds/icons';
|
|
4
|
+
/**
|
|
5
|
+
* A customizable checkbox component with support for multiple variants and sizes.
|
|
6
|
+
*
|
|
7
|
+
* @element lt-checkbox
|
|
8
|
+
*
|
|
9
|
+
* @fires {CustomEvent<{checked: boolean, indeterminate: boolean}>} change - Dispatched when the checked state changes
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <lt-checkbox label="Accept terms and conditions"></lt-checkbox>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <lt-checkbox
|
|
19
|
+
* variant="success"
|
|
20
|
+
* label="Enable notifications"
|
|
21
|
+
* checked
|
|
22
|
+
* ></lt-checkbox>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```html
|
|
27
|
+
* <lt-checkbox
|
|
28
|
+
* variant="error"
|
|
29
|
+
* label="I agree to the privacy policy"
|
|
30
|
+
* required
|
|
31
|
+
* ></lt-checkbox>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare class Checkbox extends ThemeableElement {
|
|
35
|
+
static styles: import("lit").CSSResult;
|
|
36
|
+
/**
|
|
37
|
+
* Visual variant that determines the color when checked.
|
|
38
|
+
* @default 'primary'
|
|
39
|
+
*/
|
|
40
|
+
variant: CheckboxVariant;
|
|
41
|
+
/**
|
|
42
|
+
* Size of the checkbox.
|
|
43
|
+
* @default 'md'
|
|
44
|
+
*/
|
|
45
|
+
size: CheckboxSize;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the checkbox is checked.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
checked: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the checkbox is in indeterminate state.
|
|
53
|
+
* Used for "select all" checkboxes when some items are selected.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
indeterminate: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the checkbox is disabled.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
disabled: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the checkbox is required.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
required: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Label text displayed next to the checkbox.
|
|
69
|
+
* @default ''
|
|
70
|
+
*/
|
|
71
|
+
label: string;
|
|
72
|
+
/**
|
|
73
|
+
* Position of the label relative to the checkbox.
|
|
74
|
+
* @default 'right'
|
|
75
|
+
*/
|
|
76
|
+
labelPosition: CheckboxLabelPosition;
|
|
77
|
+
/**
|
|
78
|
+
* Name attribute for form submission.
|
|
79
|
+
* @default ''
|
|
80
|
+
*/
|
|
81
|
+
name: string;
|
|
82
|
+
/**
|
|
83
|
+
* Value attribute for form submission.
|
|
84
|
+
* @default 'on'
|
|
85
|
+
*/
|
|
86
|
+
value: string;
|
|
87
|
+
/**
|
|
88
|
+
* Reference to the native input element.
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
91
|
+
private input;
|
|
92
|
+
/**
|
|
93
|
+
* Handles changes to the indeterminate property.
|
|
94
|
+
* Updates the native input's indeterminate state.
|
|
95
|
+
*/
|
|
96
|
+
updated(changedProperties: Map<string, unknown>): void;
|
|
97
|
+
/**
|
|
98
|
+
* Handles checkbox change events.
|
|
99
|
+
* Updates the checked state and dispatches a custom change event.
|
|
100
|
+
*
|
|
101
|
+
* @param e - The native change event
|
|
102
|
+
* @private
|
|
103
|
+
*/
|
|
104
|
+
private handleChange;
|
|
105
|
+
/**
|
|
106
|
+
* Renders the checkbox icon based on state.
|
|
107
|
+
* Shows checkmark when checked, minus when indeterminate.
|
|
108
|
+
*
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
111
|
+
private renderCheckmark;
|
|
112
|
+
render(): import("lit").TemplateResult<1>;
|
|
113
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkboxStyles: import("lit").CSSResult;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Size variant of the checkbox component.
|
|
3
|
+
* Affects the checkbox size and label font size.
|
|
4
|
+
*
|
|
5
|
+
* - `sm`: 16px checkbox, 0.875rem label
|
|
6
|
+
* - `md`: 20px checkbox, 1rem label (default)
|
|
7
|
+
* - `lg`: 24px checkbox, 1.0625rem label
|
|
8
|
+
*/
|
|
9
|
+
export type CheckboxSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
/**
|
|
11
|
+
* Visual variant of the checkbox 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 CheckboxVariant = 'primary' | 'secondary' | 'success' | 'error' | 'info';
|
|
21
|
+
export type CheckboxLabelPosition = 'left' | 'right';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox component module.
|
|
3
|
+
* Exports the Checkbox web component and related type definitions.
|
|
4
|
+
*
|
|
5
|
+
* @module components/checkbox
|
|
6
|
+
*/
|
|
7
|
+
export { Checkbox } from './checkbox';
|
|
8
|
+
export type { CheckboxSize, CheckboxVariant, CheckboxLabelPosition } from './checkbox.types';
|
|
@@ -0,0 +1,320 @@
|
|
|
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/checkbox/checkbox.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/checkbox/checkbox.ts
|
|
38
|
+
import { customElement, property as property2, query } from "lit/decorators.js";
|
|
39
|
+
|
|
40
|
+
// src/components/checkbox/checkbox.styles.ts
|
|
41
|
+
import { css } from "lit";
|
|
42
|
+
var checkboxStyles = css`
|
|
43
|
+
:host {
|
|
44
|
+
display: inline-block;
|
|
45
|
+
font-family: 'Hanken Grotesk', sans-serif;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.checkbox-wrapper {
|
|
49
|
+
align-items: center;
|
|
50
|
+
cursor: pointer;
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
gap: var(--lt-spacing-2);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.box {
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
flex-shrink: 0;
|
|
58
|
+
position: relative;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([label-position='left']) .checkbox-wrapper {
|
|
62
|
+
flex-direction: row-reverse;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:host([disabled]) .checkbox-wrapper {
|
|
66
|
+
cursor: not-allowed;
|
|
67
|
+
opacity: 0.6;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
input[type='checkbox'] {
|
|
71
|
+
appearance: none;
|
|
72
|
+
border-radius: calc(var(--lt-border-radius) * 0.5);
|
|
73
|
+
border: 2px solid var(--lt-border-strong);
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
margin: 0;
|
|
76
|
+
position: relative;
|
|
77
|
+
transition:
|
|
78
|
+
background-color 120ms ease,
|
|
79
|
+
border-color 120ms ease;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
input[type='checkbox']:hover:not(:disabled) {
|
|
83
|
+
border-color: var(--lt-color-neutral-600);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
input[type='checkbox']:focus-visible {
|
|
87
|
+
outline: 3px solid var(--lt-border-focus);
|
|
88
|
+
outline-offset: 2px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
input[type='checkbox']:disabled {
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.checkmark {
|
|
96
|
+
align-items: center;
|
|
97
|
+
color: white;
|
|
98
|
+
display: none;
|
|
99
|
+
inset: 0;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
position: absolute;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
input[type='checkbox']:checked ~ .checkmark,
|
|
106
|
+
input[type='checkbox']:indeterminate ~ .checkmark {
|
|
107
|
+
display: flex;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.label {
|
|
111
|
+
color: var(--lt-text-default);
|
|
112
|
+
user-select: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Size variants */
|
|
116
|
+
:host([size='sm']) input[type='checkbox'] {
|
|
117
|
+
height: 16px;
|
|
118
|
+
width: 16px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host([size='sm']) .label {
|
|
122
|
+
font-size: 0.875rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:host([size='md']) input[type='checkbox'] {
|
|
126
|
+
height: 20px;
|
|
127
|
+
width: 20px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host([size='md']) .label {
|
|
131
|
+
font-size: 1rem;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([size='lg']) input[type='checkbox'] {
|
|
135
|
+
height: 24px;
|
|
136
|
+
width: 24px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host([size='lg']) .label {
|
|
140
|
+
font-size: 1.0625rem;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* Variant styles */
|
|
144
|
+
:host([variant='primary']) input[type='checkbox']:checked,
|
|
145
|
+
:host([variant='primary']) input[type='checkbox']:indeterminate {
|
|
146
|
+
background: var(--lt-interactive-primary-bg);
|
|
147
|
+
border-color: var(--lt-interactive-primary-bg);
|
|
148
|
+
}
|
|
149
|
+
:host([variant='primary']) input[type='checkbox']:checked:hover:not(:disabled),
|
|
150
|
+
:host([variant='primary']) input[type='checkbox']:indeterminate:hover:not(:disabled) {
|
|
151
|
+
background: var(--lt-interactive-primary-bg-hover);
|
|
152
|
+
border-color: var(--lt-interactive-primary-bg-hover);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:host([variant='secondary']) input[type='checkbox']:checked,
|
|
156
|
+
:host([variant='secondary']) input[type='checkbox']:indeterminate {
|
|
157
|
+
background: var(--lt-interactive-secondary-bg);
|
|
158
|
+
border-color: var(--lt-interactive-secondary-bg);
|
|
159
|
+
}
|
|
160
|
+
:host([variant='secondary']) input[type='checkbox']:checked:hover:not(:disabled),
|
|
161
|
+
:host([variant='secondary']) input[type='checkbox']:indeterminate:hover:not(:disabled) {
|
|
162
|
+
background: var(--lt-interactive-secondary-bg-hover);
|
|
163
|
+
border-color: var(--lt-interactive-secondary-bg-hover);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:host([variant='success']) input[type='checkbox']:checked,
|
|
167
|
+
:host([variant='success']) input[type='checkbox']:indeterminate {
|
|
168
|
+
background: var(--lt-interactive-success-bg);
|
|
169
|
+
border-color: var(--lt-interactive-success-bg);
|
|
170
|
+
}
|
|
171
|
+
:host([variant='success']) input[type='checkbox']:checked:hover:not(:disabled),
|
|
172
|
+
:host([variant='success']) input[type='checkbox']:indeterminate:hover:not(:disabled) {
|
|
173
|
+
background: var(--lt-interactive-success-bg-hover);
|
|
174
|
+
border-color: var(--lt-interactive-success-bg-hover);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
:host([variant='error']) input[type='checkbox']:checked,
|
|
178
|
+
:host([variant='error']) input[type='checkbox']:indeterminate {
|
|
179
|
+
background: var(--lt-interactive-error-bg);
|
|
180
|
+
border-color: var(--lt-interactive-error-bg);
|
|
181
|
+
}
|
|
182
|
+
:host([variant='error']) input[type='checkbox']:checked:hover:not(:disabled),
|
|
183
|
+
:host([variant='error']) input[type='checkbox']:indeterminate:hover:not(:disabled) {
|
|
184
|
+
background: var(--lt-interactive-error-bg-hover);
|
|
185
|
+
border-color: var(--lt-interactive-error-bg-hover);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
:host([variant='info']) input[type='checkbox']:checked,
|
|
189
|
+
:host([variant='info']) input[type='checkbox']:indeterminate {
|
|
190
|
+
background: var(--lt-interactive-info-bg);
|
|
191
|
+
border-color: var(--lt-interactive-info-bg);
|
|
192
|
+
}
|
|
193
|
+
:host([variant='info']) input[type='checkbox']:checked:hover:not(:disabled),
|
|
194
|
+
:host([variant='info']) input[type='checkbox']:indeterminate:hover:not(:disabled) {
|
|
195
|
+
background: var(--lt-interactive-info-bg-hover);
|
|
196
|
+
border-color: var(--lt-interactive-info-bg-hover);
|
|
197
|
+
}
|
|
198
|
+
`;
|
|
199
|
+
|
|
200
|
+
// src/components/checkbox/checkbox.ts
|
|
201
|
+
import "@latty-ds/icons";
|
|
202
|
+
var Checkbox = class extends ThemeableElement {
|
|
203
|
+
constructor() {
|
|
204
|
+
super(...arguments);
|
|
205
|
+
this.variant = "primary";
|
|
206
|
+
this.size = "md";
|
|
207
|
+
this.checked = false;
|
|
208
|
+
this.indeterminate = false;
|
|
209
|
+
this.disabled = false;
|
|
210
|
+
this.required = false;
|
|
211
|
+
this.label = "";
|
|
212
|
+
this.labelPosition = "right";
|
|
213
|
+
this.name = "";
|
|
214
|
+
this.value = "on";
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Handles changes to the indeterminate property.
|
|
218
|
+
* Updates the native input's indeterminate state.
|
|
219
|
+
*/
|
|
220
|
+
updated(changedProperties) {
|
|
221
|
+
if (changedProperties.has("indeterminate") && this.input) {
|
|
222
|
+
this.input.indeterminate = this.indeterminate;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Handles checkbox change events.
|
|
227
|
+
* Updates the checked state and dispatches a custom change event.
|
|
228
|
+
*
|
|
229
|
+
* @param e - The native change event
|
|
230
|
+
* @private
|
|
231
|
+
*/
|
|
232
|
+
handleChange(e) {
|
|
233
|
+
const target = e.target;
|
|
234
|
+
this.checked = target.checked;
|
|
235
|
+
this.indeterminate = false;
|
|
236
|
+
this.dispatchEvent(
|
|
237
|
+
new CustomEvent("change", {
|
|
238
|
+
detail: { checked: this.checked, indeterminate: this.indeterminate },
|
|
239
|
+
bubbles: true,
|
|
240
|
+
composed: true
|
|
241
|
+
})
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Renders the checkbox icon based on state.
|
|
246
|
+
* Shows checkmark when checked, minus when indeterminate.
|
|
247
|
+
*
|
|
248
|
+
* @private
|
|
249
|
+
*/
|
|
250
|
+
renderCheckmark() {
|
|
251
|
+
if (this.indeterminate) {
|
|
252
|
+
return html`<lt-icon class="checkmark" name="minus"></lt-icon>`;
|
|
253
|
+
}
|
|
254
|
+
if (this.checked) {
|
|
255
|
+
return html`<lt-icon class="checkmark" name="check"></lt-icon>`;
|
|
256
|
+
}
|
|
257
|
+
return html``;
|
|
258
|
+
}
|
|
259
|
+
render() {
|
|
260
|
+
return html`
|
|
261
|
+
<label class="checkbox-wrapper">
|
|
262
|
+
<span class="box">
|
|
263
|
+
<input
|
|
264
|
+
type="checkbox"
|
|
265
|
+
.checked=${this.checked}
|
|
266
|
+
?disabled=${this.disabled}
|
|
267
|
+
?required=${this.required}
|
|
268
|
+
name=${this.name}
|
|
269
|
+
value=${this.value}
|
|
270
|
+
@change=${this.handleChange}
|
|
271
|
+
aria-label=${this.label || "checkbox"}
|
|
272
|
+
aria-checked=${this.indeterminate ? "mixed" : this.checked ? "true" : "false"}
|
|
273
|
+
/>
|
|
274
|
+
${this.renderCheckmark()}
|
|
275
|
+
</span>
|
|
276
|
+
${this.label ? html`<span class="label">${this.label}</span>` : ""}
|
|
277
|
+
</label>
|
|
278
|
+
`;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
Checkbox.styles = checkboxStyles;
|
|
282
|
+
__decorateClass([
|
|
283
|
+
property2({ reflect: true })
|
|
284
|
+
], Checkbox.prototype, "variant", 2);
|
|
285
|
+
__decorateClass([
|
|
286
|
+
property2({ reflect: true })
|
|
287
|
+
], Checkbox.prototype, "size", 2);
|
|
288
|
+
__decorateClass([
|
|
289
|
+
property2({ type: Boolean, reflect: true })
|
|
290
|
+
], Checkbox.prototype, "checked", 2);
|
|
291
|
+
__decorateClass([
|
|
292
|
+
property2({ type: Boolean, reflect: true })
|
|
293
|
+
], Checkbox.prototype, "indeterminate", 2);
|
|
294
|
+
__decorateClass([
|
|
295
|
+
property2({ type: Boolean, reflect: true })
|
|
296
|
+
], Checkbox.prototype, "disabled", 2);
|
|
297
|
+
__decorateClass([
|
|
298
|
+
property2({ type: Boolean, reflect: true })
|
|
299
|
+
], Checkbox.prototype, "required", 2);
|
|
300
|
+
__decorateClass([
|
|
301
|
+
property2()
|
|
302
|
+
], Checkbox.prototype, "label", 2);
|
|
303
|
+
__decorateClass([
|
|
304
|
+
property2({ attribute: "label-position", reflect: true })
|
|
305
|
+
], Checkbox.prototype, "labelPosition", 2);
|
|
306
|
+
__decorateClass([
|
|
307
|
+
property2()
|
|
308
|
+
], Checkbox.prototype, "name", 2);
|
|
309
|
+
__decorateClass([
|
|
310
|
+
property2()
|
|
311
|
+
], Checkbox.prototype, "value", 2);
|
|
312
|
+
__decorateClass([
|
|
313
|
+
query('input[type="checkbox"]')
|
|
314
|
+
], Checkbox.prototype, "input", 2);
|
|
315
|
+
Checkbox = __decorateClass([
|
|
316
|
+
customElement("lt-checkbox")
|
|
317
|
+
], Checkbox);
|
|
318
|
+
export {
|
|
319
|
+
Checkbox
|
|
320
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ThemeableElement } from '../../base';
|
|
2
|
+
import '@latty-ds/icons';
|
|
3
|
+
import type { ChipVariant, ChipSize, ChipAppearance } from './chip.types';
|
|
4
|
+
/**
|
|
5
|
+
* Compact label element for tags, filters, and attributes.
|
|
6
|
+
*
|
|
7
|
+
* @element lt-chip
|
|
8
|
+
* @slot - Label content
|
|
9
|
+
* @slot icon - Leading icon or avatar
|
|
10
|
+
* @fires delete - Fires when the delete button is clicked (only when `deletable`)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```html
|
|
14
|
+
* <lt-chip variant="primary">Design</lt-chip>
|
|
15
|
+
* <lt-chip variant="success" deletable>Active</lt-chip>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class Chip extends ThemeableElement {
|
|
19
|
+
static styles: import("lit").CSSResult;
|
|
20
|
+
/** Visual appearance (filled tinted background or outlined border only). */
|
|
21
|
+
appearance: ChipAppearance;
|
|
22
|
+
/** Color scheme. */
|
|
23
|
+
variant: ChipVariant;
|
|
24
|
+
/** Size (affects height, font, and padding). */
|
|
25
|
+
size: ChipSize;
|
|
26
|
+
/** Disables the chip and its delete button. */
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
/** Shows a delete/dismiss button that fires `lt-delete` when clicked. */
|
|
29
|
+
deletable: boolean;
|
|
30
|
+
/** Background color override. Accepts a hex value (#1a1a2e) or a CSS token name (--lt-color-primary-600). */
|
|
31
|
+
background: string;
|
|
32
|
+
private get _deleteIconSize();
|
|
33
|
+
private _handleDelete;
|
|
34
|
+
render(): import("lit").TemplateResult<1>;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chipStyles: import("lit").CSSResult;
|