ads-nuxt 0.4.1 → 0.4.2

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 (76) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +574 -574
  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 -9
  8. package/app/assets/brand/radar.svg +9 -9
  9. package/app/assets/css/ads-colors.css +257 -257
  10. package/app/assets/css/main.css +585 -585
  11. package/app/components/AdsBadge.vue +47 -47
  12. package/app/components/AdsBroadcast.vue +24 -24
  13. package/app/components/AdsButton.vue +547 -547
  14. package/app/components/AdsButtonGroup.vue +39 -39
  15. package/app/components/AdsButtonMenu.vue +48 -48
  16. package/app/components/AdsCard.vue +188 -188
  17. package/app/components/AdsCardHint.vue +56 -56
  18. package/app/components/AdsCardPeriod.vue +43 -43
  19. package/app/components/AdsCardVariation.vue +31 -31
  20. package/app/components/AdsCharttip.vue +79 -79
  21. package/app/components/AdsDatePicker.vue +509 -509
  22. package/app/components/AdsDropdownMenu.vue +30 -30
  23. package/app/components/AdsEmptyState.vue +61 -61
  24. package/app/components/AdsFeatureCard.vue +292 -292
  25. package/app/components/AdsFileCard.vue +98 -98
  26. package/app/components/AdsFooter.vue +25 -25
  27. package/app/components/AdsHeavyAccountCell.vue +59 -59
  28. package/app/components/AdsHeavyHeaderCell.vue +70 -70
  29. package/app/components/AdsHeavyTable.vue +135 -135
  30. package/app/components/AdsInput.vue +148 -148
  31. package/app/components/AdsLoading.vue +217 -217
  32. package/app/components/AdsMenuBar.vue +110 -110
  33. package/app/components/AdsMetricCard.vue +226 -226
  34. package/app/components/AdsModal.vue +160 -160
  35. package/app/components/AdsMonthPicker.vue +80 -80
  36. package/app/components/AdsNavbarApp.vue +67 -67
  37. package/app/components/AdsNavbarDesk.vue +67 -67
  38. package/app/components/AdsNotabilityPill.vue +24 -24
  39. package/app/components/AdsNumberInput.vue +173 -173
  40. package/app/components/AdsPanelCard.vue +99 -99
  41. package/app/components/AdsPill.vue +144 -144
  42. package/app/components/AdsProductTag.vue +80 -80
  43. package/app/components/AdsSearchInput.vue +122 -122
  44. package/app/components/AdsSegmentedTabs.vue +62 -62
  45. package/app/components/AdsSelect.vue +283 -283
  46. package/app/components/AdsSelectItem.vue +128 -128
  47. package/app/components/AdsSelectPanel.vue +221 -221
  48. package/app/components/AdsSideMenu.vue +101 -101
  49. package/app/components/AdsSmalltip.vue +44 -44
  50. package/app/components/AdsStepper.vue +222 -222
  51. package/app/components/AdsTable.vue +172 -172
  52. package/app/components/AdsTableHeaderCell.vue +80 -80
  53. package/app/components/AdsTableSkeleton.vue +113 -113
  54. package/app/components/AdsTableToolbar.vue +44 -44
  55. package/app/components/AdsTabs.vue +51 -51
  56. package/app/components/AdsTextarea.vue +116 -116
  57. package/app/components/AdsToast.vue +184 -184
  58. package/app/components/AdsTooltip.vue +73 -73
  59. package/app/components/ProgressBarLoading.vue +235 -235
  60. package/app/composables/useOverlayLoading.ts +88 -88
  61. package/app/constants/ads-color-swatches.ts +240 -240
  62. package/app/locale/pt-br.ts +6 -6
  63. package/app/plugins/ads-toast.client.ts +24 -24
  64. package/app/theme/ads-theme.ts +374 -374
  65. package/app/theme/ads-tokens.ts +391 -391
  66. package/app/types/overlay-loading.types.ts +32 -32
  67. package/app/utils/ads-filter-select.ts +191 -191
  68. package/app/utils/ads-table.ts +416 -416
  69. package/app/utils/calendar-date.ts +163 -163
  70. package/app/utils/category-role.ts +45 -45
  71. package/app/utils/money.ts +77 -77
  72. package/app/utils/notability.ts +8 -8
  73. package/app/utils/parser.ts +134 -134
  74. package/app/utils/percentage.ts +54 -54
  75. package/nuxt.config.ts +31 -31
  76. package/package.json +57 -57
@@ -1,98 +1,98 @@
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
+ <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>
@@ -1,59 +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>
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>
@@ -1,70 +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>
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>