@timlassiter11/yatl 1.0.8 → 1.0.10

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/README.md CHANGED
@@ -31,80 +31,72 @@ npm install @timlassiter11/yatl
31
31
 
32
32
  Alternatively you can manually download the source files from the [releases](https://github.com/timlassiter11/YATL/releases) section.
33
33
 
34
+ ## Examples
34
35
  ### Lit
36
+
35
37
  ```ts
36
38
  import { html, LitElement } from 'lit';
37
39
 
38
- import '@timlassiter11/yatl';
39
-
40
- class MyComponent extends LitElement {
41
- @state()
42
- private _tableData: User[] = [];
43
-
44
- private _tableColums: ColumnOptions<User>[] = [
45
- {
46
- field: 'id',
47
- title: 'ID',
48
- resizeable: true,
49
- sortable: true,
50
- searchable: false,
51
- },
52
- {
53
- field: 'name',
54
- resizeable: true,
55
- sortable: true,
56
- searchable: true,
57
- tokenize: true,
58
- },
59
- {
60
- field: 'status',
61
- resizeable: true,
62
- sortable: true,
63
- searchable: false,
64
- }
65
- ];
66
-
67
- protected override render() {
68
- return html`
69
- <yatl-table
70
- .columns=${this._columns}
71
- .data=${this._tableData}
72
- enable-virtual-scroll
73
- @yatl-row-click=${this.handleRowClicked}>
74
- </yatl-table>
75
- `;
76
- }
77
-
78
- private handleRowClicked = (event) => {
79
- console.log(event.detail)
80
- }
40
+ import { ColumnOptions, YatlRowClickEvent } from '@timlassiter11/yatl';
41
+ import { customElement, state } from 'lit/decorators.js';
42
+
43
+ type User = { id: number; name: string; dateCreated: Date };
44
+
45
+ @customElement('my-component')
46
+ export class MyComponent extends LitElement {
47
+ private dateFormatter = Intl.DateTimeFormat(undefined, {
48
+ dateStyle: 'short',
49
+ timeStyle: undefined,
50
+ });
51
+
52
+ private colums: ColumnOptions<User>[] = [
53
+ {
54
+ field: 'id',
55
+ title: 'ID',
56
+ resizable: true,
57
+ sortable: true,
58
+ searchable: false,
59
+ },
60
+ {
61
+ field: 'name',
62
+ resizable: true,
63
+ sortable: true,
64
+ searchable: true,
65
+ tokenize: true,
66
+ },
67
+ {
68
+ field: 'dateCreated',
69
+ resizable: true,
70
+ sortable: true,
71
+ searchable: false,
72
+ valueFormatter: value => this.dateFormatter.format(value as Date),
73
+ },
74
+ ];
75
+
76
+ @state()
77
+ private data: User[] = [
78
+ { id: 0, name: 'Bjarne Stroustrup', dateCreated: new Date(1968, 11, 30) },
79
+ { id: 1, name: 'Guido van Rossum', dateCreated: new Date(1974, 0, 31) },
80
+ ];
81
+
82
+ protected override render() {
83
+ return html`
84
+ <yatl-table
85
+ .columns=${this.colums}
86
+ .data=${this.data}
87
+ enable-virtual-scroll
88
+ @yatl-row-click=${this.handleRowClicked}
89
+ >
90
+ </yatl-table>
91
+ `;
92
+ }
93
+
94
+ private handleRowClicked = (event: YatlRowClickEvent<User>) => {
95
+ console.log(event.detail);
96
+ };
81
97
  }
82
98
  ```
83
99
 
84
- ### js
85
-
86
- ```js
87
- const table = document.querySelector('yatl-table');
88
-
89
- table.columns = [
90
- { field: 'id', title: 'ID', sortable: true, width: 60 },
91
- { field: 'name', title: 'Name', sortable: true, searchable: true },
92
- { field: 'role', title: 'Role', sortable: true },
93
- {
94
- field: 'status',
95
- title: 'Status',
96
- // Custom renderer example
97
- cellRenderer: value => (value === 'Active' ? '🟢' : '🔴'),
98
- },
99
- ];
100
-
101
- table.data = [
102
- { id: 1, name: 'Alice', role: 'Admin', status: 'Active' },
103
- { id: 2, name: 'Bob', role: 'User', status: 'Inactive' },
104
- // ... more data
105
- ];
106
- ```
107
-
108
100
  ### Vanilla JS
109
101
 
110
102
  ```html
@@ -159,53 +151,130 @@ table.data = [
159
151
  </html>
160
152
  ```
161
153
 
162
- ## Styling
154
+ ## Styling Guide
163
155
 
164
- `yatl-table` uses the native Web Component Shadow DOM to encapsulate its styles. This prevents your global CSS from accidentally breaking the table, and prevents the table's styles from leaking out.
156
+ YATL Table is built with extensive CSS Custom Properties (variables) to make theming easy. Styles are scoped to the shadow DOM, but you can control them from anywhere in your application (e.g., :root or a parent container) using the provided --yatl-table-\* variables.
165
157
 
166
- To customize the table, you use the standard CSS ::part() pseudo-element.
167
- ### The Basics
158
+ ### Quick Start
168
159
 
169
- To style a specific part of the table, select the element and use ::part(name).
160
+ You can apply styles directly to the component or inherit them globally.
170
161
 
171
162
  ```css
172
- /* Target the main table container */
173
- yatl-table::part(table) {
174
- border: 1px solid #e2e8f0;
175
- border-radius: 8px;
176
- font-family: 'Inter', sans-serif;
163
+ /* Apply globally */
164
+ :root {
165
+ --yatl-table-font-size: 1rem;
166
+ --yatl-table-bg-light: #fdfdfd;
177
167
  }
178
168
 
179
- /* Target the header row */
180
- yatl-table::part(header) {
181
- background-color: #f8fafc;
182
- font-weight: 700;
183
- text-transform: uppercase;
184
- font-size: 0.75rem;
169
+ /* Or scope to a specific class */
170
+ .my-custom-table {
171
+ --yatl-table-border-color: #ccc;
172
+ --yatl-table-header-bg: #eee;
173
+ }
174
+ ```
175
+
176
+ ### CSS Variables Reference
177
+
178
+ #### Typography
179
+
180
+ | Variable | Description |
181
+ | ------------------------ | -------------------------------- |
182
+ | --yatl-table-font | The font family stack. |
183
+ | --yatl-table-font-size | Base font size for all text. |
184
+ | --yatl-table-line-height | Line height for text legibility. |
185
+
186
+ #### Spacing & Layout
187
+
188
+ | Variable | Description |
189
+ | --------------------------- | ------------------------------------------------- |
190
+ | --yatl-table-cell-padding | Padding inside standard body cells. |
191
+ | --yatl-table-header-padding | Padding inside header cells. |
192
+ | --yatl-table-resizer-width | The width of the "grab" area for column resizing. |
193
+
194
+ #### Color Variables
195
+
196
+ | Variable | Description |
197
+ | ---------------------------- | ---------------------------------------------- |
198
+ | --yatl-table-bg | Main background color of the table. |
199
+ | --yatl-table-text | Primary text color. |
200
+ | --yatl-table-text-muted | Secondary/footer text color. |
201
+ | --yatl-table-border-color | Border color for rows and the table container. |
202
+ | --yatl-table-header-bg | Background for the sticky header row. |
203
+ | --yatl-table-header-text | Text color for the header row. |
204
+ | --yatl-table-row-hover-bg | Background color when hovering over a row. |
205
+ | --yatl-table-row-selected-bg | Background color for selected rows. |
206
+
207
+ **NOTE**: For each color variable, there is a dedicated `-light` and `-dark` variable. See [Color Scheme](#color-scheme) below for more info.
208
+
209
+ ### Color Scheme
210
+
211
+ By default, this component adapts to the current `color-scheme` by utilizing the [light-dark()](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark) CSS function. This will automatically adjust to the system theme, but can be manually overridden. If you have a theme toggler, you should have it set the document `color-scheme`. Below is an example assuming you set a `light` or `dark` class on your document element.
212
+
213
+ ```css
214
+ :root {
215
+ color-scheme: light dark;
216
+ }
217
+
218
+ :root.light {
219
+ color-scheme: light;
220
+ }
221
+
222
+ :root.dark {
223
+ color-scheme: dark;
224
+ }
225
+ ```
226
+
227
+ To force a color regardless of the current color scheme, you can override the base variable.
228
+
229
+ ```css
230
+ :root {
231
+ /* Always dark background */
232
+ --yatl-table-bg: #212121;
233
+ }
234
+ ```
235
+
236
+ If you want to update a color for one of the color schemes, use the specific theme variable instead.
237
+
238
+ ```css
239
+ :root {
240
+ /* light background */
241
+ --yatl-table-bg-light: #e0e0e0;
242
+ /* dark background */
243
+ --yatl-table-bg-dark: #202020;
185
244
  }
186
245
  ```
187
246
 
247
+ ### CSS Shadow Parts
188
248
 
189
- ### Part Reference
249
+ For deeper customization beyond color and spacing, you can target specific elements using the ::part pseudo-element.
190
250
 
191
- Here is a list of all exposed parts you can target:
251
+ ```css
252
+ yatl-table::part(header) {
253
+ text-transform: uppercase;
254
+ letter-spacing: 0.05em;
255
+ }
256
+ ```
192
257
 
193
- | Part Name | Description |
194
- |-------------------|---------------------------------------------------|
195
- | table | The main container grid. |
196
- | header | The container for the header row. |
197
- | header-cell | Individual header cells. |
198
- | header-title | The text span inside a header cell. |
199
- | header-sort-icon | The sorting arrow icon. |
200
- | header-resizer | The drag handle for resizing columns. |
201
- | row | The container for a data row. |
202
- | cell | Targets all cells (both header and body). |
203
- | body-cell | Targets only data cells (not headers). |
204
- | footer | The footer container. |
205
- | message | The empty state / no results message container. |
258
+ #### Parts Reference
259
+
260
+ | Part Name | Description |
261
+ | ---------------- | ----------------------------------------------- |
262
+ | table | The main container grid. |
263
+ | header | The container for the header row. |
264
+ | header-cell | Individual header cells. |
265
+ | header-title | The text span inside a header cell. |
266
+ | header-sort-icon | The sorting arrow icon. |
267
+ | header-resizer | The drag handle for resizing columns. |
268
+ | row | The container for a data row. |
269
+ | cell | Targets all cells (both header and body). |
270
+ | body-cell | Targets only data cells (not headers). |
271
+ | footer | The footer container. |
272
+ | message | The empty state / no results message container. |
206
273
 
207
274
  ### Common Recipes
275
+
208
276
  #### Zebra Striping
277
+
209
278
  You can use standard pseudo-classes like :nth-child combined with ::part.
210
279
 
211
280
  ```css
@@ -222,6 +291,7 @@ yatl-table::part(row):hover {
222
291
  ```
223
292
 
224
293
  #### Targeting Specific Columns
294
+
225
295
  Every cell automatically gets a part name based on its field property in the format cell-{field}.
226
296
 
227
297
  For example, if you have a column defined as `{ field: 'status' }`:
@@ -249,7 +319,7 @@ You can style rows based on their data using the rowParts property in JavaScript
249
319
  const table = document.querySelector('yatl-table');
250
320
 
251
321
  // Return a string (or array of strings) to add to the row's parts
252
- table.rowParts = (row) => {
322
+ table.rowParts = row => {
253
323
  const parts = [];
254
324
  if (row.stock < 5) parts.push('low-stock');
255
325
  if (row.price > 1000) parts.push('expensive');
@@ -272,6 +342,7 @@ yatl-table::part(expensive) {
272
342
  ```
273
343
 
274
344
  #### Customizing the Footer
345
+
275
346
  ```css
276
347
  yatl-table::part(footer) {
277
348
  background-color: #1e293b;
@@ -300,4 +371,4 @@ Most of the time this isn't ideal though and instead we'd like to let the layout
300
371
  <div>... Some boring footer info or something</div>
301
372
  </div>
302
373
  </body>
303
- ```
374
+ ```
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
+ import * as lit_html from 'lit-html';
1
2
  import * as lit from 'lit';
2
- import { LitElement, TemplateResult, nothing, PropertyValues } from 'lit';
3
+ import { LitElement, nothing, PropertyValues } from 'lit';
3
4
 
4
5
  type NestedKeyOf<ObjectType> = ObjectType extends object ? {
5
6
  [Key in keyof ObjectType & (string | number)]: NonNullable<ObjectType[Key]> extends unknown[] ? `${Key}` : NonNullable<ObjectType[Key]> extends object ? // Recurse with the non-nullable type
@@ -622,16 +623,16 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
622
623
  * @param index - The original index of the row to delete.
623
624
  */
624
625
  deleteRow(index: number): void;
625
- protected renderColumnSortIcon(column: DisplayColumnOptions<T>, state: ColumnState<T>): TemplateResult<1> | typeof nothing;
626
- protected renderColumnResizer(column: DisplayColumnOptions<T>, _state: ColumnState<T>): TemplateResult<1> | typeof nothing;
627
- protected renderHeaderCell(field: NestedKeyOf<T>): TemplateResult<1> | typeof nothing;
628
- protected renderHeader(): TemplateResult<1>;
626
+ protected renderColumnSortIcon(column: DisplayColumnOptions<T>, state: ColumnState<T>): lit_html.TemplateResult<1> | typeof nothing;
627
+ protected renderColumnResizer(column: DisplayColumnOptions<T>, _state: ColumnState<T>): lit_html.TemplateResult<1> | typeof nothing;
628
+ protected renderHeaderCell(field: NestedKeyOf<T>): lit_html.TemplateResult<1> | typeof nothing;
629
+ protected renderHeader(): lit_html.TemplateResult<1>;
629
630
  protected renderCellContents(value: unknown, column: DisplayColumnOptions<T>, row: T): unknown;
630
- protected renderCell(field: NestedKeyOf<T>, row: T): TemplateResult<1> | typeof nothing | undefined;
631
- protected renderRow(row: T, index: number): TemplateResult<1>;
632
- protected renderBody(): TemplateResult<1>;
633
- protected renderFooter(): TemplateResult<1> | typeof nothing;
634
- protected render(): TemplateResult<1>;
631
+ protected renderCell(field: NestedKeyOf<T>, row: T): lit_html.TemplateResult<1> | typeof nothing | undefined;
632
+ protected renderRow(row: T, index: number): lit_html.TemplateResult<1>;
633
+ protected renderBodyContents(): lit_html.TemplateResult<1>;
634
+ protected renderFooter(): lit_html.TemplateResult<1> | typeof nothing;
635
+ protected render(): lit_html.TemplateResult<1>;
635
636
  protected updated(changedProperties: PropertyValues<YatlTable<T>>): void;
636
637
  disconnectedCallback(): void;
637
638
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ import * as lit_html from 'lit-html';
1
2
  import * as lit from 'lit';
2
- import { LitElement, TemplateResult, nothing, PropertyValues } from 'lit';
3
+ import { LitElement, nothing, PropertyValues } from 'lit';
3
4
 
4
5
  type NestedKeyOf<ObjectType> = ObjectType extends object ? {
5
6
  [Key in keyof ObjectType & (string | number)]: NonNullable<ObjectType[Key]> extends unknown[] ? `${Key}` : NonNullable<ObjectType[Key]> extends object ? // Recurse with the non-nullable type
@@ -622,16 +623,16 @@ declare class YatlTable<T extends object = UnspecifiedRecord> extends LitElement
622
623
  * @param index - The original index of the row to delete.
623
624
  */
624
625
  deleteRow(index: number): void;
625
- protected renderColumnSortIcon(column: DisplayColumnOptions<T>, state: ColumnState<T>): TemplateResult<1> | typeof nothing;
626
- protected renderColumnResizer(column: DisplayColumnOptions<T>, _state: ColumnState<T>): TemplateResult<1> | typeof nothing;
627
- protected renderHeaderCell(field: NestedKeyOf<T>): TemplateResult<1> | typeof nothing;
628
- protected renderHeader(): TemplateResult<1>;
626
+ protected renderColumnSortIcon(column: DisplayColumnOptions<T>, state: ColumnState<T>): lit_html.TemplateResult<1> | typeof nothing;
627
+ protected renderColumnResizer(column: DisplayColumnOptions<T>, _state: ColumnState<T>): lit_html.TemplateResult<1> | typeof nothing;
628
+ protected renderHeaderCell(field: NestedKeyOf<T>): lit_html.TemplateResult<1> | typeof nothing;
629
+ protected renderHeader(): lit_html.TemplateResult<1>;
629
630
  protected renderCellContents(value: unknown, column: DisplayColumnOptions<T>, row: T): unknown;
630
- protected renderCell(field: NestedKeyOf<T>, row: T): TemplateResult<1> | typeof nothing | undefined;
631
- protected renderRow(row: T, index: number): TemplateResult<1>;
632
- protected renderBody(): TemplateResult<1>;
633
- protected renderFooter(): TemplateResult<1> | typeof nothing;
634
- protected render(): TemplateResult<1>;
631
+ protected renderCell(field: NestedKeyOf<T>, row: T): lit_html.TemplateResult<1> | typeof nothing | undefined;
632
+ protected renderRow(row: T, index: number): lit_html.TemplateResult<1>;
633
+ protected renderBodyContents(): lit_html.TemplateResult<1>;
634
+ protected renderFooter(): lit_html.TemplateResult<1> | typeof nothing;
635
+ protected render(): lit_html.TemplateResult<1>;
635
636
  protected updated(changedProperties: PropertyValues<YatlTable<T>>): void;
636
637
  disconnectedCallback(): void;
637
638
  /**
package/dist/index.js CHANGED
@@ -240,12 +240,12 @@ var import_class_map = require("lit/directives/class-map.js");
240
240
  var import_if_defined = require("lit/directives/if-defined.js");
241
241
  var import_repeat = require("lit/directives/repeat.js");
242
242
  var import_style_map = require("lit/directives/style-map.js");
243
- var import_virtualizer = require("@lit-labs/virtualizer");
243
+ var import_virtualize = require("@lit-labs/virtualizer/virtualize.js");
244
244
 
245
245
  // src/yatl-table.styles.ts
246
246
  var import_lit2 = require("lit");
247
247
  var yatl_table_styles_default = import_lit2.css`
248
- /* Style declarations */
248
+ /* Theme declarations */
249
249
  :host {
250
250
  /* Typography */
251
251
  --yatl-font-family: var(
@@ -267,62 +267,106 @@ var yatl_table_styles_default = import_lit2.css`
267
267
  --yatl-cell-padding: var(--yatl-table-cell-padding, 10px 16px);
268
268
  --yatl-header-padding: var(--yatl-table-header-padding, 12px 16px);
269
269
 
270
- /* Colors */
271
- --yatl-bg: var(--yatl-table-bg, #ffffff);
272
- --yatl-text: var(--yatl-table-text, #0f172a);
273
- --yatl-text-muted: var(--yatl-table-text-muted, #64748b);
274
- --yatl-border-color: var(--yatl-table-border-color, #e2e8f0);
270
+ /* Light colors */
271
+ --yatl-bg-light: var(--yatl-table-bg-light, #ffffff);
272
+ --yatl-text-light: var(--yatl-table-text-light, #0f172a);
273
+ --yatl-text-muted-light: var(--yatl-table-text-muted-light, #64748b);
274
+ --yatl-border-color-light: var(--yatl-table-border-color-light, #e2e8f0);
275
+ --yatl-header-bg-light: var(
276
+ --yatl-table-header-bg-light,
277
+ color-mix(in srgb, black 5%, var(--yatl-bg))
278
+ );
279
+ --yatl-header-text-light: var(--yatl-table-header-text-light, #475569);
280
+ --yatl-header-drop-bg-light: var(
281
+ --yatl-table-drop-bg-light,
282
+ color-mix(in srgb, black 5%, transparent)
283
+ );
284
+ --yatl-row-hover-bg-light: var(
285
+ --yatl-table-row-hover-bg-light,
286
+ color-mix(in srgb, black 5%, transparent)
287
+ );
288
+ --yatl-row-selected-bg-light: var(
289
+ --yatl-table-row-selected-bg-light,
290
+ color-mix(in srgb, black 20%, transparent)
291
+ );
275
292
 
276
- --yatl-header-bg: var(--yatl-table-header-bg, #f8fafc);
277
- --yatl-header-text: var(--yatl-table-header-text, #475569);
293
+ /* Dark colors */
294
+ --yatl-bg-dark: var(--yatl-table-bg-dark, #101219);
295
+ --yatl-text-dark: var(--yatl-table-text-dark, #f1f5f9);
296
+ --yatl-text-muted-dark: var(--yatl-table-text-muted-dark, #94a3b8);
297
+ --yatl-border-color-dark: var(--yatl-table-border-color-dark, #1a1b1e);
298
+ --yatl-header-bg-dark: var(
299
+ --yatl-table-header-bg-dark,
300
+ color-mix(in srgb, white 5%, var(--yatl-bg))
301
+ );
302
+ --yatl-header-text-dark: var(--yatl-table-header-text-dark, #cbd5e1);
303
+ --yatl-header-drop-bg-dark: var(
304
+ --yatl-table-drop-bg-dark,
305
+ color-mix(in srgb, white 5%, transparent)
306
+ );
307
+ --yatl-row-hover-bg-dark: var(
308
+ --yatl-table-row-hover-bg-dark,
309
+ color-mix(in srgb, white 5%, transparent)
310
+ );
311
+ --yatl-row-selected-bg-dark: var(
312
+ --yatl-table-row-selected-bg-dark,
313
+ color-mix(in srgb, white 20%, transparent)
314
+ );
278
315
 
279
- --yatl-row-hover-bg: var(--yatl-table-row-hover-bg, #f1f5f9);
280
- --yatl-row-selected-bg: var(--yatl-table-row-selected-bg, #e0f2fe);
316
+ /* Applied colors */
317
+ --yatl-bg: var(
318
+ --yatl-table-bg,
319
+ light-dark(var(--yatl-bg-light), var(--yatl-bg-dark))
320
+ );
321
+ --yatl-text: var(
322
+ --yatl-table-text,
323
+ light-dark(var(--yatl-text-light), var(--yatl-text-dark))
324
+ );
325
+ --yatl-text-muted: var(
326
+ --yatl-table-text-muted,
327
+ light-dark(var(--yatl-text-muted-light), var(--yatl-text-muted-dark))
328
+ );
329
+ --yatl-border-color: var(
330
+ --yatl-table-border-color,
331
+ light-dark(var(--yatl-border-color-light), var(--yatl-border-color-dark))
332
+ );
333
+ --yatl-header-bg: var(
334
+ --yatl-table-header-bg,
335
+ light-dark(var(--yatl-header-bg-light), var(--yatl-header-bg-dark))
336
+ );
337
+ --yatl-header-text: var(
338
+ --yatl-table-header,
339
+ light-dark(var(--yatl-header-text-light), var(--yatl-header-text-dark))
340
+ );
341
+ --yatl-header-drop-bg: var(
342
+ --yatl-table-header-drop-bg,
343
+ light-dark(
344
+ var(--yatl-header-drop-bg-light),
345
+ var(--yatl-header-drop-bg-dark)
346
+ )
347
+ );
348
+ --yatl-row-hover-bg: var(
349
+ --yatl-table-row-hover-bg,
350
+ light-dark(var(--yatl-row-hover-bg-light), var(--yatl-row-hover-bg-dark))
351
+ );
352
+ --yatl-row-selected-bg: var(
353
+ --yatl-table-row-selected-bg,
354
+ light-dark(
355
+ var(--yatl-row-selected-bg-light),
356
+ var(--yatl-row-selected-bg-dark)
357
+ )
358
+ );
281
359
 
282
360
  /* Resize grab handle width */
283
- --yatl-resizer-width: 10px;
361
+ --yatl-resizer-width: var(--yatl-table-resizer-width, 10px);
284
362
  /* z-index for the header */
285
363
  --header-z-index: 2;
286
- /* Drop target background color */
287
- --header-drop-color: rgba(255, 255, 255, 0.1);
288
364
 
289
365
  font-family: var(--yatl-font-family);
290
366
  font-size: var(--yatl-font-size);
291
367
  color: var(--yatl-text);
292
368
  }
293
369
 
294
- :host(.dark) {
295
- --yatl-table-bg: #1e293b;
296
- --yatl-table-text: #f1f5f9;
297
- --yatl-table-text-muted: #94a3b8;
298
- --yatl-table-border-color: #334155;
299
-
300
- --yatl-table-header-bg: #0f172a;
301
- --yatl-table-header-text: #cbd5e1;
302
-
303
- --yatl-table-row-hover-bg: #334155;
304
- --yatl-table-row-selected-bg: #1e3a8a;
305
- }
306
-
307
- @media (prefers-color-scheme: dark) {
308
- :host {
309
- --yatl-bg: var(--yatl-table-bg, #1e293b);
310
- --yatl-text: var(--yatl-table-text, #f1f5f9);
311
- --yatl-text-muted: var(--yatl-table-text-muted, #94a3b8);
312
- --yatl-border-color: var(--yatl-table-border-color, #334155);
313
-
314
- --yatl-header-bg: var(--yatl-table-header-bg, #0f172a);
315
- --yatl-header-text: var(--yatl-table-header-text, #cbd5e1);
316
-
317
- --yatl-row-hover-bg: var(--yatl-table-row-hover-bg, #334155);
318
- --yatl-row-selected-bg: var(--yatl-table-row-selected-bg, #1e3a8a);
319
- }
320
- }
321
-
322
- :host {
323
- font-family: system-ui, sans-serif;
324
- }
325
-
326
370
  .table {
327
371
  background-color: var(--yatl-bg);
328
372
  border: 1px solid var(--yatl-border-color);
@@ -361,7 +405,7 @@ var yatl_table_styles_default = import_lit2.css`
361
405
 
362
406
  .header .cell:hover::after,
363
407
  .row:not(.header):hover::after {
364
- background-color: rgba(0, 0, 0, 0.2);
408
+ background-color: var(--yatl-row-hover-bg);
365
409
  }
366
410
 
367
411
  .cell {
@@ -394,7 +438,7 @@ var yatl_table_styles_default = import_lit2.css`
394
438
  }
395
439
 
396
440
  .drop-indicator {
397
- background: rgba(0, 0, 0, 0.4);
441
+ background: var(--yatl-header-drop-bg);
398
442
  }
399
443
 
400
444
  .message {
@@ -542,6 +586,10 @@ var yatl_table_styles_default = import_lit2.css`
542
586
  overflow: hidden;
543
587
  text-overflow: ellipsis;
544
588
  }
589
+
590
+ .body {
591
+ height: 100%;
592
+ }
545
593
  `;
546
594
 
547
595
  // src/yatl-table.ts
@@ -1364,28 +1412,28 @@ var YatlTable = class extends import_lit3.LitElement {
1364
1412
  </div>
1365
1413
  `;
1366
1414
  }
1367
- renderBody() {
1415
+ renderBodyContents() {
1368
1416
  if (!this.hasVisibleColumn()) {
1369
1417
  return import_lit3.html`
1370
1418
  <div part="message" class="message">No visible columns.</div>
1371
1419
  `;
1372
1420
  }
1373
1421
  if (this.data.length === 0) {
1374
- return import_lit3.html`<div part="message" class="message">
1375
- ${this.emptyMessage}
1376
- </div>`;
1422
+ return import_lit3.html`
1423
+ <div part="message" class="message">${this.emptyMessage}</div>
1424
+ `;
1377
1425
  }
1378
1426
  if (this.filteredData.length === 0) {
1379
- return import_lit3.html`<div part="message" class="message">
1380
- ${this.noResultsMessage}
1381
- </div>`;
1427
+ return import_lit3.html`
1428
+ <div part="message" class="message">${this.noResultsMessage}</div>
1429
+ `;
1382
1430
  }
1383
1431
  if (this.enableVirtualScroll) {
1384
1432
  return import_lit3.html`
1385
- <lit-virtualizer
1386
- .items=${this.filteredData}
1387
- .renderItem=${(item, index) => this.renderRow(item, index)}
1388
- ></lit-virtualizer>
1433
+ ${(0, import_virtualize.virtualize)({
1434
+ items: this.filteredData,
1435
+ renderItem: (item, index) => this.renderRow(item, index)
1436
+ })}
1389
1437
  `;
1390
1438
  }
1391
1439
  return import_lit3.html`
@@ -1430,7 +1478,10 @@ var YatlTable = class extends import_lit3.LitElement {
1430
1478
  style=${(0, import_style_map.styleMap)({ "--grid-template": gridTemplate })}
1431
1479
  >
1432
1480
  ${this.renderHeader()}
1433
- <slot> ${this.renderBody()} ${this.renderFooter()} </slot>
1481
+ <div class="body">
1482
+ <slot> ${this.renderBodyContents()}</slot>
1483
+ </div>
1484
+ ${this.renderFooter()}
1434
1485
  </div>
1435
1486
  `;
1436
1487
  }