ads-nuxt 0.6.4 → 0.6.6

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
@@ -186,7 +186,7 @@ const nome = ref("");
186
186
 
187
187
  | Componente | Descrição |
188
188
  | ----------------- | --------- |
189
- | `AdsTable` | Tabela baseada no `UTable`, com densidade, zebra, bordas, degradê por nível, `sticky` (cabeçalho fixo), `virtualize` (lista virtual para muitas linhas), loading e estado vazio. |
189
+ | `AdsTable` | Tabela baseada no `UTable`, com densidade, zebra, bordas, degradê por nível, `sticky` / `sticky-scrollbar` (opt-in), `virtualize` (lista virtual), loading e estado vazio. |
190
190
  | `AdsTableToolbar` | Barra de ferramentas da tabela. |
191
191
  | `AdsCard` | Cartão genérico. |
192
192
  | `AdsMetricCard` | Cartão de métrica/indicador. |
@@ -603,9 +603,25 @@
603
603
  /*
604
604
  * Tabela dentro do AdsCard: encosta nas laterais e a primeira coluna
605
605
  * usa o mesmo padding do card, alinhada ao título. Fora do card, não vale.
606
+ * O bleed vai no shell (barra sticky + tabela).
606
607
  * Fica fora de @layer para vencer o px da célula sem !important.
607
608
  */
608
- .ads-card .ads-table {
609
+ .ads-card .ads-table-shell {
610
+ /* max-width:none vence o max-w-full do shell — senão a largura fica em 100%
611
+ do padding-box e a margem negativa só empurra para a esquerda (vão à direita). */
612
+ width: calc(100% + 2 * var(--ads-card-bleed, 0px));
613
+ max-width: none;
614
+ margin-inline: calc(var(--ads-card-bleed, 0px) * -1);
615
+ }
616
+
617
+ .ads-card .ads-table-shell .ads-table {
618
+ /* Sem width:100% — anulava o w-max! do sticky-scrollbar. */
619
+ margin-inline: 0;
620
+ }
621
+
622
+ /* Compat: AdsTable antigo sem shell ainda sangra pelo .ads-table. */
623
+ .ads-card > .ads-table,
624
+ .ads-card .ads-card-body > .ads-table {
609
625
  width: calc(100% + 2 * var(--ads-card-bleed, 0px));
610
626
  margin-inline: calc(var(--ads-card-bleed, 0px) * -1);
611
627
  }
@@ -41,6 +41,7 @@
41
41
  :skeleton-variant="skeletonVariant"
42
42
  :skeleton-cell-size="adsHeavyCellSize(density)"
43
43
  :sticky="sticky"
44
+ :sticky-scrollbar="stickyScrollbar"
44
45
  :virtualize="virtualize"
45
46
  :framed="framed"
46
47
  :density="density"
@@ -71,6 +72,7 @@ import {
71
72
  mergeAdsTableUi,
72
73
  type AdsTableBorders,
73
74
  type AdsTableDensity,
75
+ type AdsTableSticky,
74
76
  type AdsTableUi,
75
77
  } from "../utils/ads-table";
76
78
 
@@ -97,8 +99,14 @@ const props = withDefaults(
97
99
  /**
98
100
  * Cabeçalho fixo quando a tabela tem altura máxima.
99
101
  * Padrão: "header" — cabeçalho fica no topo ao rolar horizontalmente.
102
+ * `all` = mesmo efeito de `header` (colunas fixas via column-pinning).
100
103
  */
101
- sticky?: boolean | "header" | "footer";
104
+ sticky?: AdsTableSticky;
105
+ /**
106
+ * Barra de rolagem horizontal sticky. Repassa ao AdsTable.
107
+ * Padrão: desligado.
108
+ */
109
+ stickyScrollbar?: boolean;
102
110
  /** Lista virtual para muitas linhas. Repassa ao AdsTable. */
103
111
  virtualize?: boolean;
104
112
  emptyLabel?: string;
@@ -115,6 +123,7 @@ const props = withDefaults(
115
123
  skeletonRows: 5,
116
124
  skeletonVariant: "skeleton",
117
125
  sticky: "header",
126
+ stickyScrollbar: false,
118
127
  virtualize: false,
119
128
  emptyLabel: "Nenhum registro encontrado",
120
129
  emptyIcon: "i-lucide-inbox",
@@ -128,7 +137,10 @@ const mergedUi = computed((): AdsTableUi => {
128
137
  density: props.density,
129
138
  framed: props.framed,
130
139
  borders: props.borders,
131
- stickyHeader: props.sticky === true || props.sticky === "header",
140
+ stickyHeader:
141
+ props.sticky === true ||
142
+ props.sticky === "header" ||
143
+ props.sticky === "all",
132
144
  });
133
145
  return mergeAdsTableUi(base, props.ui);
134
146
  });
@@ -1,55 +1,93 @@
1
1
  <template>
2
- <UTable
3
- :key="virtualize ? 'virtual' : 'static'"
4
- :data="data"
5
- :columns="columns"
6
- :loading="loading"
7
- :sticky="sticky"
8
- :virtualize="virtualizeOptions"
9
- :ui="tableUi"
2
+ <div
3
+ ref="shellEl"
4
+ class="ads-table-shell relative w-full min-w-0"
5
+ :class="[
6
+ stickyScrollbar ? 'ads-table-shell--sticky-scroll' : undefined,
7
+ attrs.class,
8
+ ]"
10
9
  >
11
- <template v-if="!$slots.loading" #loading>
12
- <AdsTableSkeleton
13
- :rows="skeletonRows"
14
- :variant="skeletonVariant"
15
- :columns="skeletonColumns"
16
- :cell-class="skeletonCellSize ?? adsTableCellSize(density)"
10
+ <!--
11
+ sticky-scrollbar: overflow-x-auto + overflow-y-clip no viewport — o Y da
12
+ página continua no main (thead sticky) e o X fica só aqui (barra fake).
13
+ -->
14
+ <div
15
+ ref="tableScroller"
16
+ class="w-full min-w-0"
17
+ :class="tableScrollerClass"
18
+ >
19
+ <UTable
20
+ v-bind="utableAttrs"
21
+ :key="virtualize ? 'virtual' : 'static'"
22
+ :data="data"
23
+ :columns="columns"
24
+ :loading="loading"
25
+ :sticky="uTableSticky"
26
+ :virtualize="virtualizeOptions"
27
+ :ui="tableUi"
28
+ >
29
+ <template v-if="!$slots.loading" #loading>
30
+ <AdsTableSkeleton
31
+ :rows="skeletonRows"
32
+ :variant="skeletonVariant"
33
+ :columns="skeletonColumns"
34
+ :cell-class="skeletonCellSize ?? adsTableCellSize(density)"
35
+ />
36
+ </template>
37
+
38
+ <template v-if="!$slots.empty" #empty>
39
+ <div class="flex flex-col items-center gap-2">
40
+ <UIcon
41
+ :name="emptyIcon"
42
+ class="size-6 text-[var(--ads-border-icon-support)]"
43
+ aria-hidden="true"
44
+ />
45
+ <p class="text-sm text-[var(--ads-text-secondary)]">{{ emptyLabel }}</p>
46
+ </div>
47
+ </template>
48
+
49
+ <template v-for="(_, name) in $slots" #[name]="slotProps">
50
+ <slot :name="name" v-bind="slotProps ?? {}" />
51
+ </template>
52
+ </UTable>
53
+ </div>
54
+
55
+ <div
56
+ v-if="stickyScrollbar"
57
+ ref="fakeScroller"
58
+ class="sticky bottom-0 z-20 w-full overflow-x-auto overscroll-x-contain border-t border-[var(--ads-border-subtle)] bg-[var(--ads-surface-card)] [scrollbar-color:var(--ads-border-subtle)_transparent] [scrollbar-width:thin]"
59
+ :class="needsFakeScroll ? undefined : 'invisible pointer-events-none'"
60
+ aria-hidden="true"
61
+ >
62
+ <div
63
+ class="h-3 min-w-full"
64
+ :style="{ width: `${scrollContentWidth}px` }"
17
65
  />
18
- </template>
19
-
20
- <template v-if="!$slots.empty" #empty>
21
- <div class="flex flex-col items-center gap-2">
22
- <UIcon
23
- :name="emptyIcon"
24
- class="size-6 text-[var(--ads-border-icon-support)]"
25
- aria-hidden="true"
26
- />
27
- <p class="text-sm text-[var(--ads-text-secondary)]">{{ emptyLabel }}</p>
28
- </div>
29
- </template>
30
-
31
- <template v-for="(_, name) in $slots" #[name]="slotProps">
32
- <slot :name="name" v-bind="slotProps ?? {}" />
33
- </template>
34
- </UTable>
66
+ </div>
67
+ </div>
35
68
  </template>
36
69
 
37
70
  <script setup lang="ts" generic="T extends TableData">
38
- import { computed, useAttrs, useSlots } from "vue";
71
+ import { computed, nextTick, onMounted, ref, useAttrs, useSlots, watch } from "vue";
39
72
  import type { TableColumn, TableData } from "@nuxt/ui";
73
+ import { useEventListener, useResizeObserver } from "@vueuse/core";
40
74
  import AdsTableSkeleton, {
41
75
  type AdsTableSkeletonAlign,
42
76
  type AdsTableSkeletonVariant,
43
77
  } from "./AdsTableSkeleton.vue";
78
+ import { twMerge } from "tailwind-merge";
44
79
  import {
45
80
  adsTableCellSize,
46
81
  buildAdsTableUi,
47
82
  mergeAdsTableUi,
48
83
  type AdsTableBorders,
49
84
  type AdsTableDensity,
85
+ type AdsTableSticky,
50
86
  type AdsTableUi,
51
87
  } from "../utils/ads-table";
52
88
 
89
+ defineOptions({ inheritAttrs: false });
90
+
53
91
  const props = withDefaults(
54
92
  defineProps<{
55
93
  data: T[];
@@ -78,8 +116,17 @@ const props = withDefaults(
78
116
  skeletonVariant?: AdsTableSkeletonVariant;
79
117
  /** Altura e respiro da linha do skeleton, quando a tabela foge do padrão da densidade. */
80
118
  skeletonCellSize?: string;
81
- /** Cabeçalho (e rodapé) fixos. A tabela ganha altura máxima de 70vh; max-h na classe sobrescreve. */
82
- sticky?: boolean | "header" | "footer";
119
+ /**
120
+ * Cabeçalho (e rodapé) fixos. A tabela ganha altura máxima de 70vh; max-h na classe sobrescreve.
121
+ * `all` = mesmo efeito de `header` (colunas fixas vêm de `v-model:column-pinning`).
122
+ */
123
+ sticky?: AdsTableSticky;
124
+ /**
125
+ * Barra de rolagem horizontal sticky no rodapé da viewport.
126
+ * Um único scroller (viewport) + trilho sticky; barra nativa escondida.
127
+ * Padrão: desligado.
128
+ */
129
+ stickyScrollbar?: boolean;
83
130
  /**
84
131
  * Lista virtual: só as linhas visíveis são montadas. Use com muitas linhas (centenas ou mais).
85
132
  * Precisa de rolagem própria (sticky ou max-h), senão a tabela inteira é montada.
@@ -87,6 +134,11 @@ const props = withDefaults(
87
134
  virtualize?: boolean;
88
135
  /** Linha de 1px na borda da coluna fixa. */
89
136
  pinnedEdge?: boolean;
137
+ /**
138
+ * Cabeçalho em dois níveis (colunas aninhadas): grupos brancos + folhas cinza.
139
+ * Padrão: desligado.
140
+ */
141
+ groupedHeader?: boolean;
90
142
  emptyLabel?: string;
91
143
  emptyIcon?: string;
92
144
  loadingLabel?: string;
@@ -104,8 +156,10 @@ const props = withDefaults(
104
156
  skeletonVariant: "skeleton",
105
157
  skeletonCellSize: undefined,
106
158
  sticky: false,
159
+ stickyScrollbar: false,
107
160
  virtualize: false,
108
161
  pinnedEdge: true,
162
+ groupedHeader: false,
109
163
  emptyLabel: "Nenhum registro encontrado",
110
164
  emptyIcon: "i-lucide-inbox",
111
165
  loadingLabel: undefined,
@@ -116,6 +170,50 @@ const props = withDefaults(
116
170
  const slots = useSlots();
117
171
  const attrs = useAttrs();
118
172
 
173
+ /** Repassa attrs do consumidor ao UTable (ex.: v-model:column-pinning). class/style ficam no shell. */
174
+ const utableAttrs = computed(() => {
175
+ const { class: _class, style: _style, ...rest } = attrs as Record<string, unknown>;
176
+ return rest;
177
+ });
178
+
179
+ const shellEl = ref<HTMLElement | null>(null);
180
+ const tableScroller = ref<HTMLElement | null>(null);
181
+ const fakeScroller = ref<HTMLElement | null>(null);
182
+ const scrollContentWidth = ref(0);
183
+ const needsFakeScroll = ref(false);
184
+
185
+ let syncSource: "table" | "fake" | null = null;
186
+ let syncRaf = 0;
187
+
188
+ /** UTable não conhece `all`; mapeia para cabeçalho fixo. */
189
+ const uTableSticky = computed(() => {
190
+ if (props.sticky === "all" || props.sticky === true) return "header" as const;
191
+ return props.sticky;
192
+ });
193
+
194
+ const stickyHeaderEnabled = computed(
195
+ () =>
196
+ props.sticky === true ||
197
+ props.sticky === "header" ||
198
+ props.sticky === "all",
199
+ );
200
+
201
+ /**
202
+ * overflow-y-clip (não visible): o CSS não promove Y a auto, então o thead
203
+ * sticky continua grudado no main da página — sem max-h / scroll interno.
204
+ * overflow-x-auto: só o scroll horizontal fica neste viewport.
205
+ */
206
+ const tableScrollerClass = computed(() => {
207
+ if (!props.stickyScrollbar) return undefined;
208
+ const hideNative = needsFakeScroll.value
209
+ ? "[scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"
210
+ : "[scrollbar-width:thin] [scrollbar-color:var(--ads-border-subtle)_transparent]";
211
+ return [
212
+ "overflow-x-auto overflow-y-clip overscroll-x-contain",
213
+ hideNative,
214
+ ];
215
+ });
216
+
119
217
  const leafColumns = (columns: TableColumn<T>[]): TableColumn<T>[] =>
120
218
  columns.flatMap((column) =>
121
219
  "columns" in column && column.columns?.length ? leafColumns(column.columns) : [column],
@@ -151,11 +249,28 @@ const tableUi = computed(() => {
151
249
  framed: props.framed,
152
250
  borders: props.borders,
153
251
  depth: props.depth,
154
- stickyHeader: props.sticky === true || props.sticky === "header",
252
+ stickyHeader: stickyHeaderEnabled.value,
155
253
  pinnedEdge: props.pinnedEdge,
254
+ groupedHeader: props.groupedHeader,
156
255
  });
157
256
  // Marca para o CSS do AdsCard alinhar a primeira coluna. Fora do card, não faz nada.
158
257
  base.root = `${base.root} ads-table`.trim();
258
+ if (props.stickyScrollbar) {
259
+ // Sem max-h: a página rola no Y; o viewport externo só rola no X.
260
+ // sticky do UTable (thead) gruda no main graças ao overflow-y-clip.
261
+ base.root = twMerge(
262
+ base.root.replace(/\boverflow-auto\b/g, "").replace(/\bmax-h-\S+/g, ""),
263
+ "w-full min-w-max max-w-none! overflow-visible max-h-none!",
264
+ );
265
+ base.base = twMerge(base.base, "w-full");
266
+ // Tira o bg-default/75 + blur do tema Nuxt no sticky; o th / groupedHeader definem o fundo.
267
+ if (stickyHeaderEnabled.value) {
268
+ base.thead = twMerge(base.thead, "backdrop-blur-none!");
269
+ if (!props.groupedHeader) {
270
+ base.thead = twMerge(base.thead, "bg-transparent!");
271
+ }
272
+ }
273
+ }
159
274
  if (!slots.expanded) {
160
275
  // Árvore via getSubRows: o UTable sempre desenha a linha de detalhe da linha aberta.
161
276
  base.tbody = `${base.tbody} [&>tr[data-slot=tr]:not([data-selectable])]:hidden`;
@@ -171,4 +286,128 @@ const tableUi = computed(() => {
171
286
  }
172
287
  return mergeAdsTableUi(base, props.ui);
173
288
  });
289
+
290
+ const maxScrollLeft = (el: HTMLElement) =>
291
+ Math.max(0, el.scrollWidth - el.clientWidth);
292
+
293
+ const setScrollLeft = (el: HTMLElement, value: number) => {
294
+ const max = maxScrollLeft(el);
295
+ const next = Math.min(max, Math.max(0, value));
296
+ if (el.scrollLeft !== next) el.scrollLeft = next;
297
+ };
298
+
299
+ const mirrorScroll = (from: HTMLElement, to: HTMLElement) => {
300
+ const maxFrom = maxScrollLeft(from);
301
+ const maxTo = maxScrollLeft(to);
302
+ if (maxFrom <= 0 || maxTo <= 0) {
303
+ setScrollLeft(to, 0);
304
+ return;
305
+ }
306
+ // Mantém a mesma proporção — evita “travar” no início/fim por diferença de largura.
307
+ const ratio = from.scrollLeft / maxFrom;
308
+ setScrollLeft(to, ratio * maxTo);
309
+ };
310
+
311
+ const onTableScroll = () => {
312
+ if (!props.stickyScrollbar || syncSource === "fake") return;
313
+ const table = tableScroller.value;
314
+ const fake = fakeScroller.value;
315
+ if (!table || !fake) return;
316
+ syncSource = "table";
317
+ cancelAnimationFrame(syncRaf);
318
+ syncRaf = requestAnimationFrame(() => {
319
+ mirrorScroll(table, fake);
320
+ syncSource = null;
321
+ });
322
+ };
323
+
324
+ const onFakeScroll = () => {
325
+ if (!props.stickyScrollbar || syncSource === "table") return;
326
+ const table = tableScroller.value;
327
+ const fake = fakeScroller.value;
328
+ if (!table || !fake) return;
329
+ syncSource = "fake";
330
+ cancelAnimationFrame(syncRaf);
331
+ syncRaf = requestAnimationFrame(() => {
332
+ mirrorScroll(fake, table);
333
+ syncSource = null;
334
+ });
335
+ };
336
+
337
+ /** Shift+wheel / trackpad X: só a tabela, sem o main do layout. */
338
+ const onShellWheel = (event: WheelEvent) => {
339
+ if (!props.stickyScrollbar || !needsFakeScroll.value) return;
340
+ const table = tableScroller.value;
341
+ if (!table) return;
342
+
343
+ const horizontal =
344
+ event.shiftKey || Math.abs(event.deltaX) > Math.abs(event.deltaY);
345
+ if (!horizontal) return;
346
+
347
+ const delta = event.shiftKey && event.deltaX === 0 ? event.deltaY : event.deltaX;
348
+ if (delta === 0) return;
349
+
350
+ event.preventDefault();
351
+ syncSource = "table";
352
+ setScrollLeft(table, table.scrollLeft + delta);
353
+ if (fakeScroller.value) mirrorScroll(table, fakeScroller.value);
354
+ syncSource = null;
355
+ };
356
+
357
+ const measureFakeScroll = () => {
358
+ if (!props.stickyScrollbar) {
359
+ scrollContentWidth.value = 0;
360
+ needsFakeScroll.value = false;
361
+ return;
362
+ }
363
+ const table = tableScroller.value;
364
+ if (!table) {
365
+ scrollContentWidth.value = 0;
366
+ needsFakeScroll.value = false;
367
+ return;
368
+ }
369
+ // Mede pelo conteúdo interno quando o scroller ainda reporta scrollWidth=client.
370
+ const content = table.firstElementChild as HTMLElement | null;
371
+ const contentOverflow = content
372
+ ? Math.max(0, content.scrollWidth - table.clientWidth)
373
+ : 0;
374
+ const max = Math.max(maxScrollLeft(table), contentOverflow);
375
+ needsFakeScroll.value = max > 1;
376
+ const fakeWidth = fakeScroller.value?.clientWidth || table.clientWidth;
377
+ scrollContentWidth.value = Math.max(fakeWidth + max, fakeWidth);
378
+ if (fakeScroller.value && needsFakeScroll.value) {
379
+ mirrorScroll(table, fakeScroller.value);
380
+ }
381
+ };
382
+
383
+ /** Conteúdo interno: ResizeObserver no scroller não vê mudança de scrollWidth. */
384
+ const scrollerContentEl = computed(
385
+ () => (tableScroller.value?.firstElementChild as HTMLElement | null) ?? null,
386
+ );
387
+
388
+ const scheduleMeasure = () => {
389
+ void nextTick(() => {
390
+ measureFakeScroll();
391
+ requestAnimationFrame(() => {
392
+ measureFakeScroll();
393
+ window.setTimeout(measureFakeScroll, 50);
394
+ window.setTimeout(measureFakeScroll, 200);
395
+ });
396
+ });
397
+ };
398
+
399
+ useEventListener(tableScroller, "scroll", onTableScroll, { passive: true });
400
+ useEventListener(fakeScroller, "scroll", onFakeScroll, { passive: true });
401
+ useEventListener(shellEl, "wheel", onShellWheel, { passive: false });
402
+
403
+ useResizeObserver(shellEl, scheduleMeasure);
404
+ useResizeObserver(tableScroller, scheduleMeasure);
405
+ useResizeObserver(scrollerContentEl, scheduleMeasure);
406
+
407
+ onMounted(scheduleMeasure);
408
+
409
+ watch(
410
+ () => [props.data, props.columns, props.stickyScrollbar, props.sticky, props.ui] as const,
411
+ scheduleMeasure,
412
+ );
174
413
  </script>
@@ -29,6 +29,13 @@ export type AdsTableDensity = "md" | "sm";
29
29
  /** lines: só a divisória horizontal. grid: divisória horizontal e vertical. */
30
30
  export type AdsTableBorders = "lines" | "grid";
31
31
 
32
+ /**
33
+ * sticky do AdsTable.
34
+ * `all` = mesmo efeito de `header` (colunas fixas vêm de column-pinning).
35
+ */
36
+ export type AdsTableSticky = boolean | "header" | "footer" | "all";
37
+
38
+
32
39
  export interface AdsTableLook {
33
40
  /** Só o respiro da célula. A fonte não muda. */
34
41
  density?: AdsTableDensity;
@@ -44,6 +51,12 @@ export interface AdsTableLook {
44
51
  stickyHeader?: boolean;
45
52
  /** Linha de 1px na borda da coluna fixa. A Heavy Table desenha a sua por divisória de período. */
46
53
  pinnedEdge?: boolean;
54
+ /**
55
+ * Cabeçalho em dois níveis (colunas com `columns`): 1ª linha (grupos) branca;
56
+ * 2ª (folhas) neutral-100. Mesma Body 14 Bold nas duas. Case (ex. uppercase)
57
+ * fica a cargo do consumidor.
58
+ */
59
+ groupedHeader?: boolean;
47
60
  }
48
61
 
49
62
  /**
@@ -104,14 +117,29 @@ export const buildAdsTableUi = ({
104
117
  depth = false,
105
118
  stickyHeader = false,
106
119
  pinnedEdge: showPinnedEdge = true,
120
+ groupedHeader = false,
107
121
  }: AdsTableLook = {}): AdsTableUi => {
108
122
  const size = CELL_SIZE[density];
109
123
  const grid = borders === "grid" ? GRID_BORDER : "";
110
124
  // Na grade a borda da direita já fecha a coluna fixa da esquerda; a da direita desenha a sua
111
125
  // por fora, em cima da borda da vizinha, para não somar 2px.
112
- const gridPinnedEdge = "data-[pinned=right]:shadow-[-1px_0_0_var(--ads-border-subtle)]";
126
+ // Grade: 1px na borda da coluna fixa (sem degradê). Lines: border-r/l.
127
+ const gridPinnedEdge =
128
+ "data-[pinned=left]:shadow-[1px_0_0_var(--ads-border-subtle)] data-[pinned=right]:shadow-[-1px_0_0_var(--ads-border-subtle)]";
113
129
  const linesPinnedEdge = "data-[pinned=left]:border-r data-[pinned=right]:border-l";
114
130
  const pinnedEdge = !showPinnedEdge ? "" : borders === "grid" ? gridPinnedEdge : linesPinnedEdge;
131
+ // Degradê só com pinnedEdge — senão tapa a borda da grade e “some” visualmente.
132
+ const pinFade = showPinnedEdge ? PIN_FADE : "";
133
+ // 1ª linha = grupos (incl. grupo com 1 coluna); 2ª = folhas. Evita seletor [colspan].
134
+ const groupedThead = groupedHeader
135
+ ? [
136
+ "bg-transparent",
137
+ "[&>tr:first-child>th]:bg-[var(--ads-surface-card)]",
138
+ "[&>tr:first-child>th]:text-center",
139
+ "[&>tr:first-child>th]:text-[var(--ads-text-secondary)]",
140
+ "[&>tr:nth-child(2)>th]:bg-neutral-100",
141
+ ].join(" ")
142
+ : "bg-neutral-100";
115
143
 
116
144
  return {
117
145
  root: [
@@ -123,7 +151,7 @@ export const buildAdsTableUi = ({
123
151
  framed ? "rounded-[var(--ads-radius-md)] border border-[var(--ads-border-subtle)]" : "",
124
152
  ].join(" "),
125
153
  base: "min-w-full border-separate border-spacing-0",
126
- thead: `z-[2] bg-neutral-100 backdrop-blur-none ${stickyHeader ? STICKY_HEADER_SHADOW : ""}`.trim(),
154
+ thead: `z-[2] backdrop-blur-none ${groupedThead} ${stickyHeader ? STICKY_HEADER_SHADOW : ""}`.trim(),
127
155
  tbody: [
128
156
  "divide-y-0 [&>tr:last-child>td]:border-b-0",
129
157
  striped ? "[&>tr:nth-child(even)>td:not(:has([data-cell-fill]))]:bg-[var(--ads-surface-main)]" : "",
@@ -146,10 +174,12 @@ export const buildAdsTableUi = ({
146
174
  // Depois da grade: o cabeçalho tem borda mais forte que a das células.
147
175
  "border-[var(--color-ads-neutro-claro-40)]",
148
176
  ADS_TABLE_HEADER_TEXT,
149
- "[&[colspan]]:text-center [&[colspan]]:text-[var(--ads-text-primary)]",
177
+ groupedHeader
178
+ ? "[&[colspan]]:text-center [&[colspan]]:text-[var(--ads-text-secondary)]"
179
+ : "[&[colspan]]:text-center [&[colspan]]:text-[var(--ads-text-primary)]",
150
180
  "data-[pinned=left]:z-[3] data-[pinned=right]:z-[3]",
151
181
  pinnedEdge,
152
- PIN_FADE,
182
+ pinFade,
153
183
  ].join(" "),
154
184
  td: [
155
185
  size.td,
@@ -157,7 +187,7 @@ export const buildAdsTableUi = ({
157
187
  grid,
158
188
  ADS_TABLE_CELL_TEXT,
159
189
  pinnedEdge,
160
- PIN_FADE,
190
+ pinFade,
161
191
  ].join(" "),
162
192
  separator: "hidden",
163
193
  empty: `py-10 text-center text-[var(--ads-text-secondary)] ${ADS_TABLE_CELL_TEXT}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ads-nuxt",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "license": "MIT",
5
5
  "description": "Alquimia Design System para Nuxt, construído sobre Nuxt UI",
6
6
  "repository": {