@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.
Files changed (228) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +106 -0
  3. package/custom-elements.json +8785 -0
  4. package/dist/base/index.d.ts +1 -0
  5. package/dist/base/index.js +35 -0
  6. package/dist/base/themeable-element.d.ts +20 -0
  7. package/dist/components/accordion/accordion.d.ts +82 -0
  8. package/dist/components/accordion/accordion.styles.d.ts +1 -0
  9. package/dist/components/accordion/accordion.types.d.ts +10 -0
  10. package/dist/components/accordion/index.d.ts +8 -0
  11. package/dist/components/accordion/index.js +468 -0
  12. package/dist/components/alert/alert.d.ts +51 -0
  13. package/dist/components/alert/alert.styles.d.ts +1 -0
  14. package/dist/components/alert/alert.types.d.ts +2 -0
  15. package/dist/components/alert/index.d.ts +2 -0
  16. package/dist/components/alert/index.js +746 -0
  17. package/dist/components/avatar/avatar.d.ts +27 -0
  18. package/dist/components/avatar/avatar.styles.d.ts +1 -0
  19. package/dist/components/avatar/avatar.types.d.ts +3 -0
  20. package/dist/components/avatar/index.d.ts +2 -0
  21. package/dist/components/avatar/index.js +222 -0
  22. package/dist/components/badge/badge.d.ts +29 -0
  23. package/dist/components/badge/badge.styles.d.ts +1 -0
  24. package/dist/components/badge/badge.types.d.ts +3 -0
  25. package/dist/components/badge/index.d.ts +2 -0
  26. package/dist/components/badge/index.js +277 -0
  27. package/dist/components/breadcrumb/breadcrumb.d.ts +53 -0
  28. package/dist/components/breadcrumb/breadcrumb.styles.d.ts +2 -0
  29. package/dist/components/breadcrumb/breadcrumb.types.d.ts +1 -0
  30. package/dist/components/breadcrumb/index.d.ts +2 -0
  31. package/dist/components/breadcrumb/index.js +166 -0
  32. package/dist/components/button/button.d.ts +111 -0
  33. package/dist/components/button/button.styles.d.ts +1 -0
  34. package/dist/components/button/button.types.d.ts +38 -0
  35. package/dist/components/button/index.d.ts +8 -0
  36. package/dist/components/button/index.js +466 -0
  37. package/dist/components/calendar/calendar.d.ts +84 -0
  38. package/dist/components/calendar/calendar.styles.d.ts +1 -0
  39. package/dist/components/calendar/calendar.types.d.ts +15 -0
  40. package/dist/components/calendar/index.d.ts +1 -0
  41. package/dist/components/calendar/index.js +958 -0
  42. package/dist/components/checkbox/checkbox.d.ts +113 -0
  43. package/dist/components/checkbox/checkbox.styles.d.ts +1 -0
  44. package/dist/components/checkbox/checkbox.types.d.ts +21 -0
  45. package/dist/components/checkbox/index.d.ts +8 -0
  46. package/dist/components/checkbox/index.js +320 -0
  47. package/dist/components/chip/chip.d.ts +35 -0
  48. package/dist/components/chip/chip.styles.d.ts +1 -0
  49. package/dist/components/chip/chip.types.d.ts +3 -0
  50. package/dist/components/chip/index.d.ts +2 -0
  51. package/dist/components/chip/index.js +282 -0
  52. package/dist/components/color-input/color-input.d.ts +55 -0
  53. package/dist/components/color-input/color-input.styles.d.ts +1 -0
  54. package/dist/components/color-input/color-input.types.d.ts +2 -0
  55. package/dist/components/color-input/index.d.ts +1 -0
  56. package/dist/components/color-input/index.js +489 -0
  57. package/dist/components/combobox/combobox.d.ts +59 -0
  58. package/dist/components/combobox/combobox.styles.d.ts +1 -0
  59. package/dist/components/combobox/combobox.types.d.ts +7 -0
  60. package/dist/components/combobox/index.d.ts +2 -0
  61. package/dist/components/combobox/index.js +1988 -0
  62. package/dist/components/date-input/date-input.d.ts +66 -0
  63. package/dist/components/date-input/date-input.styles.d.ts +1 -0
  64. package/dist/components/date-input/date-input.types.d.ts +3 -0
  65. package/dist/components/date-input/index.d.ts +2 -0
  66. package/dist/components/date-input/index.js +2863 -0
  67. package/dist/components/datepicker/datepicker.d.ts +52 -0
  68. package/dist/components/datepicker/datepicker.styles.d.ts +1 -0
  69. package/dist/components/datepicker/datepicker.types.d.ts +3 -0
  70. package/dist/components/datepicker/index.d.ts +2 -0
  71. package/dist/components/datepicker/index.js +416 -0
  72. package/dist/components/dialog/dialog.d.ts +114 -0
  73. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  74. package/dist/components/dialog/dialog.types.d.ts +11 -0
  75. package/dist/components/dialog/index.d.ts +2 -0
  76. package/dist/components/dialog/index.js +920 -0
  77. package/dist/components/divider/divider.d.ts +35 -0
  78. package/dist/components/divider/divider.styles.d.ts +1 -0
  79. package/dist/components/divider/divider.types.d.ts +2 -0
  80. package/dist/components/divider/index.d.ts +2 -0
  81. package/dist/components/divider/index.js +149 -0
  82. package/dist/components/dropdown/dropdown-item.d.ts +24 -0
  83. package/dist/components/dropdown/dropdown-item.styles.d.ts +1 -0
  84. package/dist/components/dropdown/dropdown.d.ts +30 -0
  85. package/dist/components/dropdown/dropdown.styles.d.ts +1 -0
  86. package/dist/components/dropdown/dropdown.types.d.ts +1 -0
  87. package/dist/components/dropdown/index.d.ts +3 -0
  88. package/dist/components/dropdown/index.js +1791 -0
  89. package/dist/components/header/header.d.ts +19 -0
  90. package/dist/components/header/header.styles.d.ts +1 -0
  91. package/dist/components/header/header.types.d.ts +1 -0
  92. package/dist/components/header/index.d.ts +2 -0
  93. package/dist/components/header/index.js +104 -0
  94. package/dist/components/icon-button/icon-button.d.ts +52 -0
  95. package/dist/components/icon-button/icon-button.styles.d.ts +1 -0
  96. package/dist/components/icon-button/icon-button.types.d.ts +8 -0
  97. package/dist/components/icon-button/index.d.ts +1 -0
  98. package/dist/components/icon-button/index.js +342 -0
  99. package/dist/components/image/image.d.ts +26 -0
  100. package/dist/components/image/image.styles.d.ts +1 -0
  101. package/dist/components/image/image.types.d.ts +0 -0
  102. package/dist/components/image/index.d.ts +1 -0
  103. package/dist/components/image/index.js +105 -0
  104. package/dist/components/link/index.d.ts +1 -0
  105. package/dist/components/link/index.js +108 -0
  106. package/dist/components/link/link.d.ts +22 -0
  107. package/dist/components/link/link.styles.d.ts +1 -0
  108. package/dist/components/link/link.types.d.ts +1 -0
  109. package/dist/components/list/index.d.ts +9 -0
  110. package/dist/components/list/index.js +254 -0
  111. package/dist/components/list/list-item.d.ts +41 -0
  112. package/dist/components/list/list-item.styles.d.ts +1 -0
  113. package/dist/components/list/list.d.ts +85 -0
  114. package/dist/components/list/list.styles.d.ts +1 -0
  115. package/dist/components/list/list.types.d.ts +16 -0
  116. package/dist/components/nav/index.d.ts +3 -0
  117. package/dist/components/nav/index.js +345 -0
  118. package/dist/components/nav/nav-item.d.ts +73 -0
  119. package/dist/components/nav/nav.d.ts +49 -0
  120. package/dist/components/nav/nav.styles.d.ts +2 -0
  121. package/dist/components/nav/nav.types.d.ts +1 -0
  122. package/dist/components/pagination/index.d.ts +2 -0
  123. package/dist/components/pagination/index.js +210 -0
  124. package/dist/components/pagination/pagination.d.ts +34 -0
  125. package/dist/components/pagination/pagination.styles.d.ts +1 -0
  126. package/dist/components/pagination/pagination.types.d.ts +1 -0
  127. package/dist/components/progress/index.d.ts +2 -0
  128. package/dist/components/progress/index.js +167 -0
  129. package/dist/components/progress/progress.d.ts +44 -0
  130. package/dist/components/progress/progress.styles.d.ts +1 -0
  131. package/dist/components/progress/progress.types.d.ts +2 -0
  132. package/dist/components/radio/index.d.ts +8 -0
  133. package/dist/components/radio/index.js +294 -0
  134. package/dist/components/radio/radio.d.ts +96 -0
  135. package/dist/components/radio/radio.styles.d.ts +1 -0
  136. package/dist/components/radio/radio.types.d.ts +21 -0
  137. package/dist/components/radio-group/index.d.ts +8 -0
  138. package/dist/components/radio-group/index.js +384 -0
  139. package/dist/components/radio-group/radio-group.d.ts +100 -0
  140. package/dist/components/radio-group/radio-group.styles.d.ts +1 -0
  141. package/dist/components/radio-group/radio-group.types.d.ts +8 -0
  142. package/dist/components/select/index.d.ts +8 -0
  143. package/dist/components/select/index.js +2123 -0
  144. package/dist/components/select/select.d.ts +129 -0
  145. package/dist/components/select/select.styles.d.ts +1 -0
  146. package/dist/components/select/select.types.d.ts +37 -0
  147. package/dist/components/shared/backdrop.styles.d.ts +1 -0
  148. package/dist/components/shared/floating.d.ts +10 -0
  149. package/dist/components/sidepanel/index.d.ts +1 -0
  150. package/dist/components/sidepanel/index.js +768 -0
  151. package/dist/components/sidepanel/sidepanel.d.ts +48 -0
  152. package/dist/components/sidepanel/sidepanel.styles.d.ts +1 -0
  153. package/dist/components/sidepanel/sidepanel.types.d.ts +1 -0
  154. package/dist/components/skeleton/index.d.ts +2 -0
  155. package/dist/components/skeleton/index.js +129 -0
  156. package/dist/components/skeleton/skeleton.d.ts +39 -0
  157. package/dist/components/skeleton/skeleton.styles.d.ts +1 -0
  158. package/dist/components/skeleton/skeleton.types.d.ts +1 -0
  159. package/dist/components/slider/index.d.ts +2 -0
  160. package/dist/components/slider/index.js +635 -0
  161. package/dist/components/slider/slider.d.ts +33 -0
  162. package/dist/components/slider/slider.styles.d.ts +1 -0
  163. package/dist/components/slider/slider.types.d.ts +1 -0
  164. package/dist/components/snackbar/index.d.ts +2 -0
  165. package/dist/components/snackbar/index.js +358 -0
  166. package/dist/components/snackbar/snackbar.d.ts +63 -0
  167. package/dist/components/snackbar/snackbar.styles.d.ts +1 -0
  168. package/dist/components/snackbar/snackbar.types.d.ts +1 -0
  169. package/dist/components/spinner/index.d.ts +8 -0
  170. package/dist/components/spinner/index.js +131 -0
  171. package/dist/components/spinner/spineer.styles.d.ts +1 -0
  172. package/dist/components/spinner/spinner.d.ts +52 -0
  173. package/dist/components/spinner/spinner.types.d.ts +18 -0
  174. package/dist/components/surface/index.d.ts +8 -0
  175. package/dist/components/surface/index.js +128 -0
  176. package/dist/components/surface/surface.d.ts +48 -0
  177. package/dist/components/surface/surface.styles.d.ts +1 -0
  178. package/dist/components/surface/surface.types.d.ts +20 -0
  179. package/dist/components/switch/index.d.ts +8 -0
  180. package/dist/components/switch/index.js +293 -0
  181. package/dist/components/switch/switch.d.ts +90 -0
  182. package/dist/components/switch/switch.styles.d.ts +1 -0
  183. package/dist/components/switch/switch.types.d.ts +21 -0
  184. package/dist/components/tab/index.d.ts +9 -0
  185. package/dist/components/tab/index.js +252 -0
  186. package/dist/components/tab/tab-panel.d.ts +28 -0
  187. package/dist/components/tab/tab-panel.styles.d.ts +1 -0
  188. package/dist/components/tab/tab.d.ts +59 -0
  189. package/dist/components/tab/tab.styles.d.ts +1 -0
  190. package/dist/components/tab/tab.types.d.ts +7 -0
  191. package/dist/components/tab-group/index.d.ts +8 -0
  192. package/dist/components/tab-group/index.js +441 -0
  193. package/dist/components/tab-group/tab-group.d.ts +99 -0
  194. package/dist/components/tab-group/tab-group.styles.d.ts +1 -0
  195. package/dist/components/tab-group/tab-group.types.d.ts +11 -0
  196. package/dist/components/table/index.d.ts +2 -0
  197. package/dist/components/table/index.js +582 -0
  198. package/dist/components/table/table.d.ts +160 -0
  199. package/dist/components/table/table.styles.d.ts +1 -0
  200. package/dist/components/table/table.types.d.ts +106 -0
  201. package/dist/components/text/index.d.ts +1 -0
  202. package/dist/components/text/index.js +207 -0
  203. package/dist/components/text/text.d.ts +32 -0
  204. package/dist/components/text/text.styles.d.ts +1 -0
  205. package/dist/components/text/text.types.d.ts +2 -0
  206. package/dist/components/textfield/index.d.ts +8 -0
  207. package/dist/components/textfield/index.js +718 -0
  208. package/dist/components/textfield/textfield.d.ts +168 -0
  209. package/dist/components/textfield/textfield.styles.d.ts +1 -0
  210. package/dist/components/textfield/textfield.types.d.ts +40 -0
  211. package/dist/components/tooltip/index.d.ts +2 -0
  212. package/dist/components/tooltip/index.js +379 -0
  213. package/dist/components/tooltip/tooltip.d.ts +42 -0
  214. package/dist/components/tooltip/tooltip.styles.d.ts +1 -0
  215. package/dist/components/tooltip/tooltip.types.d.ts +1 -0
  216. package/dist/css/font-face.css +22 -0
  217. package/dist/css/latty.css +57 -0
  218. package/dist/fonts/HankenGrotesk-Variable.woff2 +0 -0
  219. package/dist/fonts/HankenGrotesk-VariableItalic.woff2 +0 -0
  220. package/dist/index.cjs +12739 -0
  221. package/dist/index.d.ts +101 -0
  222. package/dist/index.js +11406 -0
  223. package/dist/manifest.json +2396 -0
  224. package/dist/utils/click-outside.d.ts +22 -0
  225. package/dist/utils/color.d.ts +14 -0
  226. package/dist/utils/dispatch.d.ts +18 -0
  227. package/dist/utils/index.d.ts +3 -0
  228. package/package.json +231 -0
@@ -0,0 +1,160 @@
1
+ import { type PropertyValues } from 'lit';
2
+ import { ThemeableElement } from '../../base';
3
+ import { TableColumn, TableDensity, TableResponsiveMode, SortState } from './table.types';
4
+ import '@latty-ds/icons';
5
+ /**
6
+ * Table component with sorting, responsive modes, and extensive customization.
7
+ *
8
+ * @element lt-table
9
+ *
10
+ * Features:
11
+ * - Sortable columns with visual indicators
12
+ * - Two responsive modes: scroll (horizontal) and stack (cards on mobile)
13
+ * - Three density options: compact, normal, comfortable
14
+ * - Sticky columns support
15
+ * - Custom cell renderers
16
+ * - Hover and stripe effects
17
+ * - Loading and empty states
18
+ * - Column alignment and sizing
19
+ * - Hide columns on mobile
20
+ * - Accessible with keyboard navigation
21
+ *
22
+ * @fires sort-change - Fired when sort changes
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const columns = [
27
+ * { key: 'name', label: 'Name', sortable: true },
28
+ * { key: 'email', label: 'Email', sortable: true },
29
+ * { key: 'age', label: 'Age', sortable: true, align: 'right' }
30
+ * ];
31
+ *
32
+ * const data = [
33
+ * { name: 'John Doe', email: 'john@example.com', age: 30 },
34
+ * { name: 'Jane Smith', email: 'jane@example.com', age: 25 }
35
+ * ];
36
+ * ```
37
+ *
38
+ * Via JS property assignment (supports `render` and `sortFn`):
39
+ * ```javascript
40
+ * const table = document.querySelector('lt-table');
41
+ * table.columns = columns;
42
+ * table.data = data;
43
+ * ```
44
+ *
45
+ * Via JSON string attributes (SSR / Astro templates, no render/sortFn):
46
+ * ```html
47
+ * <lt-table
48
+ * columns='[{"key":"name","label":"Name","sortable":true}]'
49
+ * data='[{"name":"John Doe"}]'
50
+ * density="normal"
51
+ * responsive-mode="scroll"
52
+ * hoverable
53
+ * striped
54
+ * ></lt-table>
55
+ * ```
56
+ */
57
+ export declare class Table<T = Record<string, unknown>> extends ThemeableElement {
58
+ static styles: import("lit").CSSResult;
59
+ /**
60
+ * Column definitions for the table.
61
+ * Accepts a JS array (`.columns = [...]`) or a JSON string attribute (`columns='[...]'`).
62
+ * When passed as JSON, only serializable fields are supported (no `render` or `sortFn`).
63
+ * @default []
64
+ */
65
+ columns: TableColumn<T>[];
66
+ /**
67
+ * Data rows for the table.
68
+ * Accepts a JS array (`.data = [...]`) or a JSON string attribute (`data='[...]'`).
69
+ * @default []
70
+ */
71
+ data: T[];
72
+ /**
73
+ * Density/spacing of the table.
74
+ * @default 'normal'
75
+ */
76
+ density: TableDensity;
77
+ /**
78
+ * Responsive behavior on small screens.
79
+ * @default 'scroll'
80
+ */
81
+ responsiveMode: TableResponsiveMode;
82
+ /**
83
+ * Whether rows have a hover effect.
84
+ * @default false
85
+ */
86
+ hoverable: boolean;
87
+ /**
88
+ * Whether to show alternating row colors.
89
+ * @default false
90
+ */
91
+ striped: boolean;
92
+ /**
93
+ * Whether to show borders around cells.
94
+ * @default false
95
+ */
96
+ bordered: boolean;
97
+ /**
98
+ * Whether the table is in a loading state.
99
+ * @default false
100
+ */
101
+ loading: boolean;
102
+ /**
103
+ * Message to display when there is no data.
104
+ * @default 'No data available'
105
+ */
106
+ emptyMessage: string;
107
+ /**
108
+ * Field name to use as a stable row identity key for efficient DOM reuse during sorts/updates.
109
+ * When omitted, falls back to the row's JSON representation.
110
+ * @default ''
111
+ */
112
+ rowKey: string;
113
+ /**
114
+ * Current sort state (controlled externally).
115
+ * If not provided, sorting is managed internally.
116
+ */
117
+ sort?: SortState;
118
+ /**
119
+ * Internal sort state (when not controlled externally).
120
+ */
121
+ private internalSort;
122
+ /**
123
+ * Sorted data based on current sort state.
124
+ */
125
+ private sortedData;
126
+ /**
127
+ * Gets the current effective sort state.
128
+ */
129
+ private get currentSort();
130
+ willUpdate(changedProperties: PropertyValues<this>): void;
131
+ /**
132
+ * Updates the sorted data based on current sort state.
133
+ */
134
+ private updateSortedData;
135
+ /**
136
+ * Handles header click for sorting.
137
+ */
138
+ private handleHeaderClick;
139
+ /**
140
+ * Gets a cell value from a row using a key (supports nested keys).
141
+ */
142
+ private getCellValue;
143
+ /**
144
+ * Renders a cell's content.
145
+ */
146
+ private renderCell;
147
+ /**
148
+ * Renders the sort icon for a column header.
149
+ */
150
+ private renderSortIcon;
151
+ /**
152
+ * Renders the table header.
153
+ */
154
+ private renderHeader;
155
+ /**
156
+ * Renders the table body.
157
+ */
158
+ private renderBody;
159
+ render(): import("lit").TemplateResult<1>;
160
+ }
@@ -0,0 +1 @@
1
+ export declare const tableStyles: import("lit").CSSResult;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Responsive behavior of the table on small screens.
3
+ *
4
+ * - `scroll`: Horizontal scroll (default)
5
+ * - `stack`: Stack columns vertically as cards
6
+ */
7
+ export type TableResponsiveMode = 'scroll' | 'stack';
8
+ /**
9
+ * Density/size variant of the table.
10
+ *
11
+ * - `compact`: Reduced padding for dense data
12
+ * - `normal`: Standard padding (default)
13
+ * - `comfortable`: Increased padding for better readability
14
+ */
15
+ export type TableDensity = 'compact' | 'normal' | 'comfortable';
16
+ /**
17
+ * Sort direction for a column.
18
+ */
19
+ export type SortDirection = 'asc' | 'desc' | null;
20
+ /**
21
+ * Alignment for cell content.
22
+ */
23
+ export type CellAlign = 'left' | 'center' | 'right';
24
+ /**
25
+ * Configuration for a table column.
26
+ */
27
+ export interface TableColumn<T = Record<string, unknown>> {
28
+ /**
29
+ * Unique key for this column (used to access data).
30
+ */
31
+ key: string;
32
+ /**
33
+ * Header label displayed in the table header.
34
+ */
35
+ label: string;
36
+ /**
37
+ * Whether this column is sortable.
38
+ * @default false
39
+ */
40
+ sortable?: boolean;
41
+ /**
42
+ * Custom sort function for this column.
43
+ * If not provided, default sorting (string/number comparison) is used.
44
+ */
45
+ sortFn?: (a: T, b: T, direction: 'asc' | 'desc') => number;
46
+ /**
47
+ * Width of the column (e.g., '200px', '20%', 'auto').
48
+ * @default 'auto'
49
+ */
50
+ width?: string;
51
+ /**
52
+ * Minimum width of the column (e.g., '100px').
53
+ */
54
+ minWidth?: string;
55
+ /**
56
+ * Text alignment for this column.
57
+ * @default 'left'
58
+ */
59
+ align?: CellAlign;
60
+ /**
61
+ * Whether to hide this column on mobile devices.
62
+ * @default false
63
+ */
64
+ hideOnMobile?: boolean;
65
+ /**
66
+ * Custom renderer function for cell content.
67
+ * Return a Lit TemplateResult (html`...`) or an HTMLElement for safe rendering.
68
+ * If not provided, the value is displayed as-is.
69
+ */
70
+ render?: (value: unknown, row: T, index: number) => unknown;
71
+ /**
72
+ * Whether this column should be sticky (fixed) when scrolling.
73
+ * @default false
74
+ */
75
+ sticky?: boolean;
76
+ }
77
+ /**
78
+ * Current sort state of the table.
79
+ */
80
+ export interface SortState {
81
+ /**
82
+ * Key of the column being sorted.
83
+ */
84
+ key: string;
85
+ /**
86
+ * Direction of the sort.
87
+ */
88
+ direction: 'asc' | 'desc';
89
+ }
90
+ /**
91
+ * Event detail for sort change events.
92
+ */
93
+ export interface SortChangeDetail {
94
+ /**
95
+ * Key of the column being sorted.
96
+ */
97
+ key: string;
98
+ /**
99
+ * New sort direction.
100
+ */
101
+ direction: 'asc' | 'desc';
102
+ /**
103
+ * Previous sort state (null if no previous sort).
104
+ */
105
+ previousSort: SortState | null;
106
+ }
@@ -0,0 +1 @@
1
+ export { Text } from './text';
@@ -0,0 +1,207 @@
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/base/themeable-element.ts
13
+ import { LitElement } from "lit";
14
+ import { property } from "lit/decorators.js";
15
+ var ThemeableElement = class extends LitElement {
16
+ willUpdate(changed) {
17
+ super.willUpdate(changed);
18
+ if (changed.has("theme")) {
19
+ this._syncThemeAttribute();
20
+ }
21
+ }
22
+ _syncThemeAttribute() {
23
+ if (this.theme === "dark" || this.theme === "light") {
24
+ this.setAttribute("data-theme", this.theme);
25
+ } else {
26
+ this.removeAttribute("data-theme");
27
+ }
28
+ }
29
+ };
30
+ __decorateClass([
31
+ property({ reflect: true })
32
+ ], ThemeableElement.prototype, "theme", 2);
33
+
34
+ // src/components/text/text.ts
35
+ import { customElement, property as property2 } from "lit/decorators.js";
36
+ import { html, unsafeStatic } from "lit/static-html.js";
37
+
38
+ // src/components/text/text.styles.ts
39
+ import { css } from "lit";
40
+ var textStyles = css`
41
+ :host {
42
+ display: block;
43
+ color: inherit;
44
+ }
45
+
46
+ /* Inline variants sit in text flow */
47
+ :host([variant='caption']),
48
+ :host([variant='overline']),
49
+ :host([variant='label']) {
50
+ display: inline;
51
+ }
52
+
53
+ [part='base'] {
54
+ margin: 0;
55
+ color: inherit;
56
+ font-family: var(--lt-typography-fontfamily);
57
+ }
58
+
59
+ /* ── Display ─────────────────────────────────────────────────────────── */
60
+
61
+ :host([variant='display-2xl']) [part='base'] {
62
+ font-size: clamp(2.5rem, 6vw, 4.5rem);
63
+ font-weight: var(--lt-text-weight, 200);
64
+ line-height: 1.1;
65
+ letter-spacing: -0.02em;
66
+ }
67
+
68
+ :host([variant='display-xl']) [part='base'] {
69
+ font-size: clamp(2rem, 5vw, 3.75rem);
70
+ font-weight: var(--lt-text-weight, 200);
71
+ line-height: 1.1;
72
+ letter-spacing: -0.02em;
73
+ }
74
+
75
+ :host([variant='display-lg']) [part='base'] {
76
+ font-size: clamp(2rem, 4vw, 3rem);
77
+ font-weight: var(--lt-text-weight, 200);
78
+ line-height: 1.15;
79
+ letter-spacing: -0.01em;
80
+ }
81
+
82
+ /* ── Headings ─────────────────────────────────────────────────────────── */
83
+
84
+ :host([variant='h1']) [part='base'] {
85
+ font-size: clamp(1.75rem, 2.5vw + 0.75rem, 2.5rem);
86
+ font-weight: var(--lt-text-weight, 600);
87
+ line-height: 1.2;
88
+ letter-spacing: -0.02em;
89
+ }
90
+
91
+ :host([variant='h2']) [part='base'] {
92
+ font-size: clamp(1.5rem, 2vw + 0.5rem, 2rem);
93
+ font-weight: var(--lt-text-weight, 600);
94
+ line-height: 1.25;
95
+ letter-spacing: -0.01em;
96
+ }
97
+
98
+ :host([variant='h3']) [part='base'] {
99
+ font-size: clamp(1.25rem, 1.5vw + 0.5rem, 1.5rem);
100
+ font-weight: var(--lt-text-weight, 600);
101
+ line-height: 1.3;
102
+ }
103
+
104
+ :host([variant='h4']) [part='base'] {
105
+ font-size: 1.25rem;
106
+ font-weight: var(--lt-text-weight, 600);
107
+ line-height: 1.35;
108
+ }
109
+
110
+ :host([variant='h5']) [part='base'] {
111
+ font-size: 1.125rem;
112
+ font-weight: var(--lt-text-weight, 600);
113
+ line-height: 1.4;
114
+ }
115
+
116
+ :host([variant='h6']) [part='base'] {
117
+ font-size: 1rem;
118
+ font-weight: var(--lt-text-weight, 600);
119
+ line-height: 1.4;
120
+ }
121
+
122
+ /* ── Body ─────────────────────────────────────────────────────────────── */
123
+
124
+ :host([variant='lead']) [part='base'] {
125
+ font-size: 1.25rem;
126
+ font-weight: var(--lt-text-weight, 400);
127
+ line-height: 1.6;
128
+ }
129
+
130
+ :host([variant='body']) [part='base'],
131
+ :host(:not([variant])) [part='base'] {
132
+ font-size: 1rem;
133
+ font-weight: var(--lt-text-weight, 400);
134
+ line-height: 1.6;
135
+ }
136
+
137
+ :host([variant='body-sm']) [part='base'] {
138
+ font-size: 0.875rem;
139
+ font-weight: var(--lt-text-weight, 400);
140
+ line-height: 1.6;
141
+ }
142
+
143
+ /* ── Inline ───────────────────────────────────────────────────────────── */
144
+
145
+ :host([variant='caption']) [part='base'] {
146
+ font-size: 0.75rem;
147
+ font-weight: var(--lt-text-weight, 400);
148
+ line-height: 1.5;
149
+ }
150
+
151
+ :host([variant='overline']) [part='base'] {
152
+ font-size: 0.6875rem;
153
+ font-weight: var(--lt-text-weight, 600);
154
+ line-height: 1.2;
155
+ letter-spacing: 0.08em;
156
+ text-transform: uppercase;
157
+ }
158
+
159
+ :host([variant='label']) [part='base'] {
160
+ font-size: 0.875rem;
161
+ font-weight: var(--lt-text-weight, 600);
162
+ line-height: 1.4;
163
+ }
164
+ `;
165
+
166
+ // src/components/text/text.ts
167
+ var VARIANT_TAG = {
168
+ "display-2xl": "p",
169
+ "display-xl": "p",
170
+ "display-lg": "p",
171
+ h1: "h1",
172
+ h2: "h2",
173
+ h3: "h3",
174
+ h4: "h4",
175
+ h5: "h5",
176
+ h6: "h6",
177
+ lead: "p",
178
+ body: "p",
179
+ "body-sm": "p",
180
+ caption: "span",
181
+ overline: "span",
182
+ label: "span"
183
+ };
184
+ var Text = class extends ThemeableElement {
185
+ constructor() {
186
+ super(...arguments);
187
+ this.variant = "body";
188
+ this.as = "";
189
+ }
190
+ render() {
191
+ const tag = unsafeStatic(this.as || VARIANT_TAG[this.variant] || "p");
192
+ return html`<${tag} part="base"><slot></slot></${tag}>`;
193
+ }
194
+ };
195
+ Text.styles = textStyles;
196
+ __decorateClass([
197
+ property2({ reflect: true })
198
+ ], Text.prototype, "variant", 2);
199
+ __decorateClass([
200
+ property2({ reflect: true })
201
+ ], Text.prototype, "as", 2);
202
+ Text = __decorateClass([
203
+ customElement("lt-text")
204
+ ], Text);
205
+ export {
206
+ Text
207
+ };
@@ -0,0 +1,32 @@
1
+ import { ThemeableElement } from '../../base';
2
+ import type { TextVariant, TextTag } from './text.types';
3
+ /**
4
+ * Renders text with a predefined typographic style. Display and heading variants
5
+ * (display-2xl → h3) use fluid `clamp()` font sizes that scale between a mobile
6
+ * minimum and a desktop maximum. The rendered HTML tag matches the variant by
7
+ * default but can be overridden with the `as` attribute.
8
+ *
9
+ * Override font-weight on any variant with `--lt-text-weight`:
10
+ * ```css
11
+ * lt-text { --lt-text-weight: 700; }
12
+ * ```
13
+ *
14
+ * @element lt-text
15
+ * @cssprop [--lt-text-weight] - Overrides the default font-weight for the variant.
16
+ *
17
+ * @example
18
+ * ```html
19
+ * <lt-text variant="display-lg" as="h1">Hero heading</lt-text>
20
+ * <lt-text variant="h2" as="h3">Visually h2, semantically h3</lt-text>
21
+ * <lt-text variant="lead">Introductory paragraph.</lt-text>
22
+ * <lt-text variant="overline">Category</lt-text>
23
+ * ```
24
+ */
25
+ export declare class Text extends ThemeableElement {
26
+ static styles: import("lit").CSSResult;
27
+ /** Typographic style to apply. */
28
+ variant: TextVariant;
29
+ /** HTML tag to render. Defaults to the semantic tag for the chosen variant. */
30
+ as: TextTag | '';
31
+ render(): import("lit").TemplateResult;
32
+ }
@@ -0,0 +1 @@
1
+ export declare const textStyles: import("lit").CSSResult;
@@ -0,0 +1,2 @@
1
+ export type TextVariant = 'display-2xl' | 'display-xl' | 'display-lg' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'lead' | 'body' | 'body-sm' | 'caption' | 'overline' | 'label';
2
+ export type TextTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'label' | 'strong' | 'em';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Textfield component module.
3
+ * Exports the Textfield web component and related type definitions.
4
+ *
5
+ * @module components/textfield
6
+ */
7
+ export { Textfield } from './textfield';
8
+ export type { HelperText, TextfieldSize, TextfieldType, TextfieldVariant } from './textfield.types';