ads-nuxt 0.1.5 → 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 (90) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -577
  3. package/app/app.config.ts +25 -25
  4. package/app/assets/ads/checkbox-check.svg +5 -5
  5. package/app/assets/ads/checkbox-minus.svg +5 -5
  6. package/app/assets/brand/farmarcas.svg +6 -6
  7. package/app/assets/brand/radar-symbol.svg +9 -0
  8. package/app/assets/brand/radar.svg +9 -9
  9. package/app/assets/css/ads-colors.css +257 -246
  10. package/app/assets/css/component-tokens.css +367 -403
  11. package/app/assets/css/main.css +624 -617
  12. package/app/components/AdsBadge.vue +47 -48
  13. package/app/components/AdsBroadcast.vue +24 -45
  14. package/app/components/AdsButton.vue +539 -569
  15. package/app/components/AdsButtonGroup.vue +39 -39
  16. package/app/components/AdsButtonMenu.vue +48 -48
  17. package/app/components/AdsCard.vue +188 -117
  18. package/app/components/AdsCardHint.vue +22 -0
  19. package/app/components/AdsCardPeriod.vue +43 -0
  20. package/app/components/AdsCardVariation.vue +31 -0
  21. package/app/components/AdsCharttip.vue +78 -78
  22. package/app/components/AdsCheckbox.vue +77 -77
  23. package/app/components/AdsDatePicker.vue +492 -491
  24. package/app/components/AdsDropdownMenu.vue +30 -19
  25. package/app/components/AdsEmptyState.vue +58 -58
  26. package/app/components/AdsFeatureCard.vue +210 -219
  27. package/app/components/AdsFileCard.vue +98 -101
  28. package/app/components/AdsFooter.vue +25 -25
  29. package/app/components/AdsHeavyAccountCell.vue +59 -0
  30. package/app/components/AdsHeavyHeaderCell.vue +70 -0
  31. package/app/components/AdsHeavyTable.vue +135 -0
  32. package/app/components/AdsInput.vue +147 -147
  33. package/app/components/AdsLoading.vue +217 -109
  34. package/app/components/AdsMenuBar.vue +103 -103
  35. package/app/components/AdsMetricCard.vue +216 -119
  36. package/app/components/AdsModal.vue +157 -157
  37. package/app/components/AdsMonthPicker.vue +80 -80
  38. package/app/components/AdsNavbarApp.vue +67 -67
  39. package/app/components/AdsNavbarDesk.vue +62 -62
  40. package/app/components/AdsNotabilityPill.vue +24 -27
  41. package/app/components/AdsNumberInput.vue +173 -173
  42. package/app/components/AdsPagination.vue +91 -91
  43. package/app/components/AdsPanelCard.vue +99 -0
  44. package/app/components/AdsPill.vue +144 -92
  45. package/app/components/AdsProductTag.vue +61 -61
  46. package/app/components/AdsRadio.vue +70 -70
  47. package/app/components/AdsSearchInput.vue +122 -122
  48. package/app/components/AdsSegmentedTabs.vue +62 -28
  49. package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -210
  50. package/app/components/AdsSelectItem.vue +128 -0
  51. package/app/components/AdsSelectPanel.vue +150 -0
  52. package/app/components/AdsSideMenu.vue +101 -101
  53. package/app/components/AdsSmalltip.vue +44 -44
  54. package/app/components/AdsStepper.vue +222 -0
  55. package/app/components/AdsSteptip.vue +101 -101
  56. package/app/components/AdsSwitch.vue +59 -59
  57. package/app/components/AdsTable.vue +161 -100
  58. package/app/components/AdsTableHeaderCell.vue +80 -0
  59. package/app/components/AdsTableSkeleton.vue +113 -0
  60. package/app/components/AdsTableToolbar.vue +44 -44
  61. package/app/components/AdsTabs.vue +51 -51
  62. package/app/components/AdsTextarea.vue +116 -116
  63. package/app/components/AdsToast.vue +183 -181
  64. package/app/components/AdsTooltip.vue +73 -73
  65. package/app/components/OverlayLoading.vue +173 -173
  66. package/app/components/ProgressBarLoading.vue +235 -256
  67. package/app/composables/useOverlayLoading.ts +66 -66
  68. package/app/constants/ads-color-swatches.ts +240 -239
  69. package/app/locale/pt-br.ts +6 -6
  70. package/app/plugins/ads-toast.client.ts +24 -24
  71. package/app/theme/ads-theme.ts +374 -370
  72. package/app/theme/ads-tokens.ts +391 -379
  73. package/app/theme/component-tokens.json +366 -402
  74. package/app/theme/component-tokens.ts +807 -815
  75. package/app/types/overlay-loading.types.ts +26 -26
  76. package/app/utils/ads-filter-select.ts +191 -172
  77. package/app/utils/ads-table.ts +395 -204
  78. package/app/utils/calendar-date.ts +163 -163
  79. package/app/utils/category-role.ts +45 -45
  80. package/app/utils/money.ts +77 -77
  81. package/app/utils/notability.ts +8 -8
  82. package/app/utils/parser.ts +134 -134
  83. package/app/utils/percentage.ts +54 -54
  84. package/nuxt.config.ts +31 -31
  85. package/package.json +1 -1
  86. package/app/components/AdsFarmarcasPill.vue +0 -74
  87. package/app/components/AdsFilterDropdown.vue +0 -174
  88. package/app/components/AdsFilterOption.vue +0 -74
  89. package/app/components/AdsListDropdown.vue +0 -44
  90. package/app/components/AdsMiniPill.vue +0 -40
@@ -1,101 +1,98 @@
1
- <template>
2
- <div
3
- class="flex min-h-[var(--ads-file-min-height)] flex-col justify-center gap-2 rounded-[var(--ads-file-radius)] border px-[var(--ads-file-padding-x)] py-[var(--ads-file-padding-y)]"
4
- :class="surface.card"
5
- :role="status === 'error' ? 'alert' : 'status'"
6
- >
7
- <p
8
- v-if="message"
9
- class="text-[length:var(--ads-file-title-size)] font-semibold leading-5"
10
- :class="surface.message"
11
- >
12
- {{ message }}
13
- </p>
14
- <div class="flex items-center justify-between gap-3">
15
- <div class="flex min-w-0 items-center gap-2">
16
- <span
17
- class="inline-flex size-[var(--ads-file-icon-box)] shrink-0 items-center justify-center rounded-[var(--ads-file-radius)]"
18
- :class="surface.icon"
19
- aria-hidden="true"
20
- >
21
- <UIcon :name="resolvedIcon" class="size-4" />
22
- </span>
23
- <div class="min-w-0">
24
- <AdsTooltip :description="name" :show-title="false" align="start">
25
- <p class="truncate text-[length:var(--ads-file-title-size)] font-semibold leading-5 text-[var(--ads-text-primary)]">
26
- {{ name }}
27
- </p>
28
- </AdsTooltip>
29
- <p
30
- v-if="detail"
31
- class="text-[length:var(--ads-file-detail-size)] font-normal leading-4 text-[var(--ads-text-secondary)]"
32
- >
33
- {{ detail }}
34
- </p>
35
- </div>
36
- </div>
37
- <AdsButton
38
- v-if="removable"
39
- type="unfilled"
40
- color="neutral"
41
- size="sm"
42
- icon="i-lucide-trash-2"
43
- :aria-label="removeLabel"
44
- @click="emit('remove')"
45
- />
46
- </div>
47
- </div>
48
- </template>
49
-
50
- <script setup lang="ts">
51
- import { computed } from "vue";
52
- import AdsButton from "./AdsButton.vue";
53
- import AdsTooltip from "./AdsTooltip.vue";
54
-
55
- export type AdsFileCardStatus = "success" | "error";
56
-
57
- const props = withDefaults(
58
- defineProps<{
59
- /** Nome do arquivo. */
60
- name: string;
61
- /** Linha de apoio, como o tamanho. */
62
- detail?: string;
63
- status?: AdsFileCardStatus;
64
- /** Texto do problema, acima do arquivo. */
65
- message?: string;
66
- icon?: string;
67
- removable?: boolean;
68
- removeLabel?: string;
69
- }>(),
70
- {
71
- detail: undefined,
72
- status: "success",
73
- message: undefined,
74
- icon: undefined,
75
- removable: false,
76
- removeLabel: "Remover arquivo",
77
- },
78
- );
79
-
80
- const emit = defineEmits<{
81
- remove: [];
82
- }>();
83
-
84
- const surfaces: Record<AdsFileCardStatus, { card: string; icon: string; message: string; glyph: string }> = {
85
- success: {
86
- card: "border-[var(--ads-status-success-500)] bg-[color-mix(in_srgb,var(--ads-status-success-100)_var(--ads-opacity-light),transparent)]",
87
- icon: "bg-[var(--ads-status-success-100)] text-[var(--ads-status-success-800)]",
88
- message: "text-[var(--ads-status-success-800)]",
89
- glyph: "i-lucide-cloud-check",
90
- },
91
- error: {
92
- card: "border-[var(--ads-status-warning-500)] bg-[color-mix(in_srgb,var(--ads-status-warning-100)_var(--ads-opacity-light),transparent)]",
93
- icon: "bg-[var(--ads-status-warning-100)] text-[var(--ads-status-warning-500)]",
94
- message: "text-[var(--ads-status-warning-500)]",
95
- glyph: "i-lucide-ban",
96
- },
97
- };
98
-
99
- const surface = computed(() => surfaces[props.status]);
100
- const resolvedIcon = computed(() => props.icon || surface.value.glyph);
101
- </script>
1
+ <template>
2
+ <div class="flex w-full flex-col items-start gap-2" :role="status === 'error' ? 'alert' : 'status'">
3
+ <!-- Erro: o problema fica acima do arquivo -->
4
+ <p
5
+ v-if="status === 'error' && message"
6
+ class="flex items-center gap-1 text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-status-warning-800)]"
7
+ >
8
+ <UIcon name="i-lucide-circle-alert" class="size-4 shrink-0" aria-hidden="true" />
9
+ {{ message }}
10
+ </p>
11
+
12
+ <div
13
+ class="flex min-h-[var(--ads-file-min-height)] w-full items-center gap-3 rounded-[var(--ads-file-radius)] px-[var(--ads-file-padding-x)] py-[var(--ads-file-padding-y)]"
14
+ :class="surface.card"
15
+ >
16
+ <span
17
+ class="inline-flex size-[var(--ads-file-icon-box)] shrink-0 items-center justify-center rounded-[var(--ads-file-radius)]"
18
+ :class="surface.icon"
19
+ aria-hidden="true"
20
+ >
21
+ <UIcon :name="resolvedIcon" class="size-6" />
22
+ </span>
23
+
24
+ <div class="flex min-w-0 flex-1 flex-col items-start gap-0.5">
25
+ <AdsTooltip :description="name" :show-title="false" align="start" class="max-w-full">
26
+ <p class="max-w-full truncate text-[length:var(--ads-file-title-size)] font-medium leading-[1.3] text-[var(--ads-text-primary)]">
27
+ {{ name }}
28
+ </p>
29
+ </AdsTooltip>
30
+ <p v-if="detail" class="text-[length:var(--ads-file-detail-size)] leading-[1.2] text-[var(--ads-text-secondary)]">
31
+ {{ detail }}
32
+ </p>
33
+ </div>
34
+
35
+ <AdsButton
36
+ v-if="removable"
37
+ type="unfilled"
38
+ color="neutral"
39
+ size="sm"
40
+ icon="i-lucide-trash-2"
41
+ :aria-label="removeLabel"
42
+ @click="emit('remove')"
43
+ />
44
+ </div>
45
+ </div>
46
+ </template>
47
+
48
+ <script setup lang="ts">
49
+ import { computed } from "vue";
50
+ import AdsButton from "./AdsButton.vue";
51
+ import AdsTooltip from "./AdsTooltip.vue";
52
+
53
+ export type AdsFileCardStatus = "success" | "error";
54
+
55
+ const props = withDefaults(
56
+ defineProps<{
57
+ /** Nome do arquivo. */
58
+ name: string;
59
+ /** Linha de apoio, como o tamanho. */
60
+ detail?: string;
61
+ status?: AdsFileCardStatus;
62
+ /** Texto do problema, acima do arquivo. Só aparece no erro. */
63
+ message?: string;
64
+ /** Ícone Lucide. Padrão: planilha no sucesso, arquivo com X no erro. */
65
+ icon?: string;
66
+ removable?: boolean;
67
+ removeLabel?: string;
68
+ }>(),
69
+ {
70
+ detail: undefined,
71
+ status: "success",
72
+ message: undefined,
73
+ icon: undefined,
74
+ removable: false,
75
+ removeLabel: "Remover arquivo",
76
+ },
77
+ );
78
+
79
+ const emit = defineEmits<{
80
+ remove: [];
81
+ }>();
82
+
83
+ const surfaces: Record<AdsFileCardStatus, { card: string; icon: string; glyph: string }> = {
84
+ success: {
85
+ card: "border border-[var(--ads-status-success-600)] bg-[color-mix(in_srgb,var(--ads-status-success-100)_var(--ads-opacity-medium),transparent)]",
86
+ icon: "bg-[var(--ads-status-success-100)] text-[var(--ads-status-success-800)]",
87
+ glyph: "i-lucide-file-spreadsheet",
88
+ },
89
+ error: {
90
+ card: "border-[1.5px] border-[var(--ads-status-warning-300)] bg-[color-mix(in_srgb,var(--ads-status-warning-100)_30%,transparent)]",
91
+ icon: "bg-[color-mix(in_srgb,var(--ads-status-warning-100)_var(--ads-opacity-medium),transparent)] text-[var(--ads-status-warning-800)]",
92
+ glyph: "i-lucide-file-x",
93
+ },
94
+ };
95
+
96
+ const surface = computed(() => surfaces[props.status]);
97
+ const resolvedIcon = computed(() => props.icon || surface.value.glyph);
98
+ </script>
@@ -1,25 +1,25 @@
1
- <template>
2
- <footer class="flex min-h-[var(--ads-footer-min-height)] w-full flex-wrap items-center justify-between gap-3 bg-[var(--ads-surface-card)] px-10 py-2">
3
- <p class="text-xs leading-4 text-[var(--ads-footer-text)]">
4
- <span class="font-bold">© Copyright Radar Farmarcas </span>
5
- <span>- Todos os direitos reservados.</span>
6
- </p>
7
- <p class="flex items-center gap-2 text-xs leading-4 text-[var(--ads-footer-text)]">
8
- <span>{{ developerLabel }}</span>
9
- <img :src="logoUrl" alt="Farmarcas" class="h-[var(--ads-footer-logo-height)] w-auto" />
10
- </p>
11
- </footer>
12
- </template>
13
-
14
- <script setup lang="ts">
15
- import logoUrl from "../assets/brand/farmarcas.svg?url";
16
-
17
- withDefaults(
18
- defineProps<{
19
- developerLabel?: string;
20
- }>(),
21
- {
22
- developerLabel: "Desenvolvido por",
23
- },
24
- );
25
- </script>
1
+ <template>
2
+ <footer class="flex min-h-[var(--ads-footer-min-height)] w-full flex-wrap items-center justify-between gap-3 bg-[var(--ads-surface-card)] px-10 py-2">
3
+ <p class="text-xs leading-4 text-[var(--ads-footer-text)]">
4
+ <span class="font-bold">© Copyright Radar Farmarcas </span>
5
+ <span>- Todos os direitos reservados.</span>
6
+ </p>
7
+ <p class="flex items-center gap-2 text-xs leading-4 text-[var(--ads-footer-text)]">
8
+ <span>{{ developerLabel }}</span>
9
+ <img :src="logoUrl" alt="Farmarcas" class="h-[var(--ads-footer-logo-height)] w-auto" />
10
+ </p>
11
+ </footer>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import logoUrl from "../assets/brand/farmarcas.svg?url";
16
+
17
+ withDefaults(
18
+ defineProps<{
19
+ developerLabel?: string;
20
+ }>(),
21
+ {
22
+ developerLabel: "Desenvolvido por",
23
+ },
24
+ );
25
+ </script>
@@ -0,0 +1,59 @@
1
+ <!--
2
+ AdsHeavyAccountCell — Primeira coluna da AdsHeavyTable (Figma: "_Fin Account Cell" e "_Fin Toggle").
3
+
4
+ O nível sai da profundidade da linha: 0 é Grupo, 1 é Item, 2 ou mais é Subitem.
5
+ Marca a linha para o fundo azul do grupo e para a zebra dos itens.
6
+
7
+ @example
8
+ ```vue
9
+ <template #name-cell="{ row }">
10
+ <AdsHeavyAccountCell :row="row" :label="row.original.name" />
11
+ </template>
12
+ ```
13
+ -->
14
+ <template>
15
+ <div
16
+ class="flex items-center gap-3 pe-4"
17
+ :class="INDENT[Math.min(row.depth, INDENT.length - 1)]"
18
+ :data-heavy-group="isGroup ? '' : undefined"
19
+ :data-heavy-zebra="isZebra ? '' : undefined"
20
+ >
21
+ <button
22
+ v-if="row.subRows.length"
23
+ type="button"
24
+ class="relative flex size-5 shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] border border-[var(--ads-neutral-mid-60)] bg-[var(--ads-surface-card)] after:absolute after:-inset-1.5 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-button-primary)]"
25
+ :aria-expanded="row.getIsExpanded()"
26
+ :aria-label="`${row.getIsExpanded() ? 'Recolher' : 'Expandir'} ${label}`"
27
+ @click="row.toggleExpanded()"
28
+ >
29
+ <UIcon
30
+ :name="row.getIsExpanded() ? 'i-lucide-minus' : 'i-lucide-plus'"
31
+ class="size-4 text-[var(--ads-text-secondary)]"
32
+ aria-hidden="true"
33
+ />
34
+ </button>
35
+ <span class="min-w-0 flex-1 overflow-hidden text-ellipsis">{{ label }}</span>
36
+ </div>
37
+ </template>
38
+
39
+ <script setup lang="ts">
40
+ import { computed } from "vue";
41
+
42
+ const INDENT = ["ps-4", "ps-12", "ps-18"] as const;
43
+
44
+ const props = defineProps<{
45
+ /** Linha do TanStack, recebida no slot da célula. */
46
+ row: {
47
+ depth: number;
48
+ index: number;
49
+ subRows: unknown[];
50
+ getIsExpanded: () => boolean;
51
+ toggleExpanded: () => void;
52
+ };
53
+ label: string;
54
+ }>();
55
+
56
+ const isGroup = computed(() => props.row.depth === 0);
57
+ /** `index` recomeça em cada grupo, então a zebra também recomeça. */
58
+ const isZebra = computed(() => !isGroup.value && props.row.index % 2 === 1);
59
+ </script>
@@ -0,0 +1,70 @@
1
+ <!--
2
+ AdsHeavyHeaderCell — Título de coluna da AdsHeavyTable (Figma: "_Fin Header Cell").
3
+
4
+ Ordenar só aparece em coluna ordenável. Grupo não ordena sozinho no TanStack: passe em
5
+ `sort-column` a subcoluna que ele ordena. Fixar some com `enablePinning: false` e pede
6
+ `v-model:column-pinning` na tabela.
7
+
8
+ @example
9
+ ```ts
10
+ { id: "jul", header: ({ column, table }) => h(AdsHeavyHeaderCell, {
11
+ column, label: "Jul/2026", sortColumn: table.getColumn("jul-real"),
12
+ }) }
13
+ ```
14
+ -->
15
+ <template>
16
+ <div class="flex items-center justify-center">
17
+ <component
18
+ :is="sortTarget?.getCanSort() ? 'button' : 'span'"
19
+ :type="sortTarget?.getCanSort() ? 'button' : undefined"
20
+ class="flex items-center gap-2 rounded-[var(--ads-radius-xsm)] font-bold text-[var(--ads-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-button-primary)]"
21
+ :aria-label="sortTarget?.getCanSort() ? `Ordenar por ${label}` : undefined"
22
+ @click="sortTarget?.getCanSort() && sortTarget.toggleSorting()"
23
+ >
24
+ <UIcon
25
+ v-if="sortTarget?.getCanSort()"
26
+ :name="sortIcon"
27
+ class="size-4 shrink-0 text-[var(--ads-border-icon-support)]"
28
+ aria-hidden="true"
29
+ />
30
+ {{ label }}
31
+ </component>
32
+ <button
33
+ v-if="column?.getCanPin()"
34
+ type="button"
35
+ class="flex size-6 shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-button-primary)]"
36
+ :aria-label="`${column.getIsPinned() ? 'Soltar' : 'Fixar'} coluna ${label}`"
37
+ :aria-pressed="Boolean(column.getIsPinned())"
38
+ @click="column.pin(column.getIsPinned() ? false : 'left')"
39
+ >
40
+ <UIcon
41
+ name="i-lucide-pin"
42
+ class="size-4"
43
+ :class="column.getIsPinned() ? 'text-[var(--ads-text-brand)]' : 'text-[var(--ads-border-icon-support)]'"
44
+ aria-hidden="true"
45
+ />
46
+ </button>
47
+ </div>
48
+ </template>
49
+
50
+ <script setup lang="ts">
51
+ import { computed } from "vue";
52
+ import type { AdsTableHeaderColumn } from "../utils/ads-table";
53
+
54
+ const props = defineProps<{
55
+ label: string;
56
+ /** Coluna do TanStack, recebida na função `header`. */
57
+ column?: AdsTableHeaderColumn;
58
+ /** Coluna que o título ordena, quando não é a própria (grupos). */
59
+ sortColumn?: AdsTableHeaderColumn;
60
+ }>();
61
+
62
+ const sortTarget = computed(() => props.sortColumn ?? props.column);
63
+
64
+ const SORT_ICON = { asc: "i-lucide-arrow-up", desc: "i-lucide-arrow-down" } as const;
65
+
66
+ const sortIcon = computed(() => {
67
+ const sorted = sortTarget.value?.getIsSorted();
68
+ return sorted ? SORT_ICON[sorted] : "i-lucide-chevrons-up-down";
69
+ });
70
+ </script>
@@ -0,0 +1,135 @@
1
+ <!--
2
+ AdsHeavyTable — Tabela financeira (Figma: "Heavy Table").
3
+
4
+ Baseada no UTable (via AdsTable) com:
5
+ - Cabeçalho em dois níveis (grupos de colunas via nested `columns`).
6
+ - Grupos de linhas em accordion expandir/recolher (_Fin Group):
7
+ passe `get-sub-rows`, `get-row-id` e `v-model:expanded`;
8
+ na primeira coluna, use `AdsHeavyAccountCell`.
9
+ - Títulos com ordenar e fixar via `AdsHeavyHeaderCell`.
10
+ - Larguras e divisórias de período via `adsHeavyColumn` e `adsHeavyAccountColumn()`.
11
+ - Cabeçalho fixo por padrão (`sticky="header"`).
12
+ - Tons de variação e projeção via `adsHeavyVariationClass()`.
13
+
14
+ Props não declaradas (column-pinning, get-row-id, get-sub-rows, v-model:expanded,
15
+ footer, row-class, etc.) são repassadas ao UTable via attrs fallthrough.
16
+ Para o botão de fixar funcionar, use `v-model:column-pinning`.
17
+
18
+ @example
19
+ ```vue
20
+ <AdsHeavyTable
21
+ :data="rows"
22
+ :columns="cols"
23
+ :get-sub-rows="(row) => row.children"
24
+ :get-row-id="(row) => row.id"
25
+ v-model:expanded="expanded"
26
+ v-model:column-pinning="pinning"
27
+ class="max-h-96"
28
+ >
29
+ <template #name-cell="{ row }">
30
+ <AdsHeavyAccountCell :row="row" :label="row.original.name" />
31
+ </template>
32
+ </AdsHeavyTable>
33
+ ```
34
+ -->
35
+ <template>
36
+ <AdsTable
37
+ :data="data"
38
+ :columns="columns"
39
+ :loading="loading"
40
+ :skeleton-rows="skeletonRows"
41
+ :skeleton-variant="skeletonVariant"
42
+ :skeleton-cell-size="adsHeavyCellSize(density)"
43
+ :sticky="sticky"
44
+ :framed="framed"
45
+ :density="density"
46
+ :striped="false"
47
+ :borders="borders"
48
+ :depth="false"
49
+ :pinned-edge="false"
50
+ :empty-label="emptyLabel"
51
+ :empty-icon="emptyIcon"
52
+ :loading-label="loadingLabel"
53
+ :ui="mergedUi"
54
+ v-bind="$attrs"
55
+ >
56
+ <template v-for="(_, name) in $slots" #[name]="slotProps">
57
+ <slot :name="name" v-bind="slotProps ?? {}" />
58
+ </template>
59
+ </AdsTable>
60
+ </template>
61
+
62
+ <script setup lang="ts" generic="T extends TableData">
63
+ import { computed } from "vue";
64
+ import type { TableColumn, TableData } from "@nuxt/ui";
65
+ import AdsTable from "./AdsTable.vue";
66
+ import type { AdsTableSkeletonVariant } from "./AdsTableSkeleton.vue";
67
+ import {
68
+ adsHeavyCellSize,
69
+ buildAdsHeavyTableUi,
70
+ type AdsTableBorders,
71
+ type AdsTableDensity,
72
+ type AdsTableUi,
73
+ } from "../utils/ads-table";
74
+
75
+ defineOptions({ inheritAttrs: false });
76
+
77
+ const props = withDefaults(
78
+ defineProps<{
79
+ data: T[];
80
+ columns: TableColumn<T>[];
81
+ /** md: padrão financeiro. sm: tabela compacta. */
82
+ density?: AdsTableDensity;
83
+ /** Borda e raio próprios. Dentro de AdsCard, false. */
84
+ framed?: boolean;
85
+ /** lines: só horizontal. grid: horizontal e vertical. */
86
+ borders?: AdsTableBorders;
87
+ loading?: boolean;
88
+ /** Número de linhas do skeleton de carregamento (1–8). */
89
+ skeletonRows?: number;
90
+ /**
91
+ * Estilo do skeleton padrão.
92
+ * skeleton: barras de placeholder. logo: loader do Radar.
93
+ */
94
+ skeletonVariant?: AdsTableSkeletonVariant;
95
+ /**
96
+ * Cabeçalho fixo quando a tabela tem altura máxima.
97
+ * Padrão: "header" — cabeçalho fica no topo ao rolar horizontalmente.
98
+ */
99
+ sticky?: boolean | "header" | "footer";
100
+ emptyLabel?: string;
101
+ emptyIcon?: string;
102
+ loadingLabel?: string;
103
+ /** Ajuste pontual de um slot; soma ao padrão. */
104
+ ui?: Partial<AdsTableUi>;
105
+ }>(),
106
+ {
107
+ density: "md",
108
+ framed: true,
109
+ borders: "lines",
110
+ loading: false,
111
+ skeletonRows: 5,
112
+ skeletonVariant: "skeleton",
113
+ sticky: "header",
114
+ emptyLabel: "Nenhum registro encontrado",
115
+ emptyIcon: "i-lucide-inbox",
116
+ loadingLabel: undefined,
117
+ ui: undefined,
118
+ },
119
+ );
120
+
121
+ const mergedUi = computed((): AdsTableUi => {
122
+ const base = buildAdsHeavyTableUi({
123
+ density: props.density,
124
+ framed: props.framed,
125
+ borders: props.borders,
126
+ stickyHeader: props.sticky === true || props.sticky === "header",
127
+ });
128
+ if (!props.ui) return base;
129
+ const merged = { ...base };
130
+ for (const key of Object.keys(props.ui) as (keyof AdsTableUi)[]) {
131
+ merged[key] = `${base[key]} ${props.ui[key] ?? ""}`.trim();
132
+ }
133
+ return merged;
134
+ });
135
+ </script>