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,39 +1,39 @@
1
- <template>
2
- <div class="inline-flex" role="radiogroup" :aria-label="ariaLabel">
3
- <button
4
- v-for="(option, index) in options"
5
- :key="option.value"
6
- type="button"
7
- role="radio"
8
- class="-ml-px h-[var(--ads-button-group-height)] border border-[var(--ads-button-group-border)] px-4 text-[length:var(--ads-button-group-font-size)] text-[var(--ads-text-primary)] first:ml-0 focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
9
- :class="[
10
- index === 0 ? 'rounded-l-[var(--ads-radius-xsm)]' : '',
11
- index === options.length - 1 ? 'rounded-r-[var(--ads-radius-xsm)]' : '',
12
- model === option.value ? 'z-[1] bg-[var(--ads-button-group-selected)] font-bold' : 'bg-[var(--ads-surface-card)] font-normal',
13
- ]"
14
- :aria-checked="model === option.value"
15
- @click="model = option.value"
16
- >
17
- {{ option.label }}
18
- </button>
19
- </div>
20
- </template>
21
-
22
- <script setup lang="ts">
23
- export type AdsButtonGroupOption = {
24
- value: string;
25
- label: string;
26
- };
27
-
28
- withDefaults(
29
- defineProps<{
30
- options: AdsButtonGroupOption[];
31
- ariaLabel?: string;
32
- }>(),
33
- {
34
- ariaLabel: "Grupo de botões",
35
- },
36
- );
37
-
38
- const model = defineModel<string>({ required: true });
39
- </script>
1
+ <template>
2
+ <div class="inline-flex" role="radiogroup" :aria-label="ariaLabel">
3
+ <button
4
+ v-for="(option, index) in options"
5
+ :key="option.value"
6
+ type="button"
7
+ role="radio"
8
+ class="-ml-px h-[var(--ads-button-group-height)] border border-[var(--ads-button-group-border)] px-4 text-[length:var(--ads-button-group-font-size)] text-[var(--ads-text-primary)] first:ml-0 focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
9
+ :class="[
10
+ index === 0 ? 'rounded-l-[var(--ads-radius-xsm)]' : '',
11
+ index === options.length - 1 ? 'rounded-r-[var(--ads-radius-xsm)]' : '',
12
+ model === option.value ? 'z-[1] bg-[var(--ads-button-group-selected)] font-bold' : 'bg-[var(--ads-surface-card)] font-normal',
13
+ ]"
14
+ :aria-checked="model === option.value"
15
+ @click="model = option.value"
16
+ >
17
+ {{ option.label }}
18
+ </button>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ export type AdsButtonGroupOption = {
24
+ value: string;
25
+ label: string;
26
+ };
27
+
28
+ withDefaults(
29
+ defineProps<{
30
+ options: AdsButtonGroupOption[];
31
+ ariaLabel?: string;
32
+ }>(),
33
+ {
34
+ ariaLabel: "Grupo de botões",
35
+ },
36
+ );
37
+
38
+ const model = defineModel<string>({ required: true });
39
+ </script>
@@ -1,48 +1,48 @@
1
- <template>
2
- <div
3
- class="flex w-[var(--ads-button-menu-width)] flex-col overflow-hidden rounded-[var(--ads-radius-xsm)] bg-[var(--ads-surface-card)] shadow-[var(--ads-shadow-level-1)]"
4
- role="menu"
5
- >
6
- <button
7
- v-for="option in options"
8
- :key="option.value"
9
- type="button"
10
- role="menuitem"
11
- class="flex flex-col border-b-[0.5px] border-[var(--ads-button-menu-border)] px-4 pt-2 pb-4 text-left last:border-b-0 hover:bg-ads-neutro-claro-20 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
12
- @click="emit('select', option.value)"
13
- >
14
- <span class="flex h-10 items-center gap-2 px-4 text-[length:var(--ads-button-menu-title-size)] leading-[1.3] font-medium text-[var(--ads-button-menu-title)]">
15
- <UIcon v-if="showIcons" :name="option.icon || 'i-lucide-sparkles'" class="size-4 shrink-0" />
16
- {{ option.title }}
17
- </span>
18
- <span v-if="showSubtitles && option.subtitle" class="line-clamp-2 px-4 text-[length:var(--ads-button-menu-subtitle-size)] leading-[1.2] text-[var(--ads-button-menu-subtitle)]">
19
- {{ option.subtitle }}
20
- </span>
21
- </button>
22
- </div>
23
- </template>
24
-
25
- <script setup lang="ts">
26
- export type AdsButtonMenuOption = {
27
- value: string;
28
- title: string;
29
- subtitle?: string;
30
- icon?: string;
31
- };
32
-
33
- withDefaults(
34
- defineProps<{
35
- options: AdsButtonMenuOption[];
36
- showSubtitles?: boolean;
37
- showIcons?: boolean;
38
- }>(),
39
- {
40
- showSubtitles: true,
41
- showIcons: true,
42
- },
43
- );
44
-
45
- const emit = defineEmits<{
46
- select: [value: string];
47
- }>();
48
- </script>
1
+ <template>
2
+ <div
3
+ class="flex w-[var(--ads-button-menu-width)] flex-col overflow-hidden rounded-[var(--ads-radius-xsm)] bg-[var(--ads-surface-card)] shadow-[var(--ads-shadow-level-1)]"
4
+ role="menu"
5
+ >
6
+ <button
7
+ v-for="option in options"
8
+ :key="option.value"
9
+ type="button"
10
+ role="menuitem"
11
+ class="flex flex-col border-b-[0.5px] border-[var(--ads-button-menu-border)] px-4 pt-2 pb-4 text-left last:border-b-0 hover:bg-ads-neutro-claro-20 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
12
+ @click="emit('select', option.value)"
13
+ >
14
+ <span class="flex h-10 items-center gap-2 px-4 text-[length:var(--ads-button-menu-title-size)] leading-[1.3] font-medium text-[var(--ads-button-menu-title)]">
15
+ <UIcon v-if="showIcons" :name="option.icon || 'i-lucide-sparkles'" class="size-4 shrink-0" />
16
+ {{ option.title }}
17
+ </span>
18
+ <span v-if="showSubtitles && option.subtitle" class="line-clamp-2 px-4 text-[length:var(--ads-button-menu-subtitle-size)] leading-[1.2] text-[var(--ads-button-menu-subtitle)]">
19
+ {{ option.subtitle }}
20
+ </span>
21
+ </button>
22
+ </div>
23
+ </template>
24
+
25
+ <script setup lang="ts">
26
+ export type AdsButtonMenuOption = {
27
+ value: string;
28
+ title: string;
29
+ subtitle?: string;
30
+ icon?: string;
31
+ };
32
+
33
+ withDefaults(
34
+ defineProps<{
35
+ options: AdsButtonMenuOption[];
36
+ showSubtitles?: boolean;
37
+ showIcons?: boolean;
38
+ }>(),
39
+ {
40
+ showSubtitles: true,
41
+ showIcons: true,
42
+ },
43
+ );
44
+
45
+ const emit = defineEmits<{
46
+ select: [value: string];
47
+ }>();
48
+ </script>
@@ -1,188 +1,188 @@
1
- <template>
2
- <component
3
- :is="as"
4
- :type="as === 'button' ? 'button' : undefined"
5
- :disabled="as === 'button' ? disabled : undefined"
6
- :aria-busy="loading || undefined"
7
- class="flex h-full min-w-0 flex-col items-start gap-3 border p-[var(--ads-card-padding)] text-left transition-[background-color,border-color,box-shadow]"
8
- :class="[radiusClass, surfaceClass]"
9
- >
10
- <!-- Cabeçalho -->
11
- <div v-if="showHeader" class="flex w-full min-w-0 items-center gap-2">
12
- <div class="min-w-0 flex-1">
13
- <slot name="header">
14
- <p :class="type === 'details' ? detailsTitleClass : containerTitleClass">{{ title }}</p>
15
- </slot>
16
- </div>
17
- <AdsCardHint v-if="hint" :text="hint" />
18
- <slot name="actions" />
19
- </div>
20
-
21
- <AdsCardPeriod v-if="period || (loading && periodLabel && type === 'container')" :label="periodLabel" :value="period" :loading="loading" :skeleton-width="110" />
22
-
23
- <p v-if="description && !loading && !empty" class="text-[length:var(--ads-card-body-size)] leading-[1.4] text-[var(--ads-card-body)]">
24
- {{ description }}
25
- </p>
26
-
27
- <!-- Vazio: mantém o cabeçalho e mostra o empty state -->
28
- <div v-if="empty && !loading" class="flex w-full justify-center py-2">
29
- <slot name="empty">
30
- <AdsEmptyState small :title="emptyMessage" :subtitle="emptyDescription ?? ''" :show-actions="Boolean($slots['empty-actions'])">
31
- <slot name="empty-actions" />
32
- </AdsEmptyState>
33
- </slot>
34
- </div>
35
-
36
- <!-- Detalhes: lista de informações -->
37
- <template v-else-if="type === 'details'">
38
- <div v-if="loading" class="flex w-full flex-col items-start gap-3" aria-hidden="true">
39
- <span
40
- v-for="(width, index) in detailSkeletonWidths"
41
- :key="index"
42
- class="block h-3.5 max-w-full animate-pulse rounded-[var(--ads-radius-xsm)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
43
- :style="{ width: `${width}px` }"
44
- />
45
- </div>
46
- <dl v-else-if="rows.length" class="flex w-full flex-col items-start gap-3">
47
- <div v-for="(row, index) in rows" :key="index" class="flex min-w-0 max-w-full items-center gap-1 text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">
48
- <UIcon v-if="row.icon" :name="row.icon" class="size-4 shrink-0" aria-hidden="true" />
49
- <dt class="shrink-0 font-bold">{{ row.label }}</dt>
50
- <dd class="min-w-0 truncate">{{ row.value }}</dd>
51
- </div>
52
- </dl>
53
- <slot />
54
- </template>
55
-
56
- <!-- Container: conteúdo livre (gráfico, tabela, lista) -->
57
- <template v-else>
58
- <div v-if="loading" class="flex h-[200px] w-full items-center justify-center">
59
- <AdsLoading variant="logo" />
60
- </div>
61
- <div v-else-if="$slots.default" class="w-full min-w-0 flex-1">
62
- <slot />
63
- </div>
64
- </template>
65
-
66
- <div v-if="(footerText || $slots.footer) && !loading && !empty" class="flex w-full flex-wrap items-start justify-between gap-3">
67
- <slot name="footer">
68
- <p class="text-[length:var(--ads-font-size-xxxs)] text-[var(--ads-text-secondary)]">{{ footerText }}</p>
69
- </slot>
70
- </div>
71
- </component>
72
- </template>
73
-
74
- <script setup lang="ts">
75
- import { computed, useSlots, type Component } from "vue";
76
- import AdsCardHint from "./AdsCardHint.vue";
77
- import AdsCardPeriod from "./AdsCardPeriod.vue";
78
- import AdsEmptyState from "./AdsEmptyState.vue";
79
- import AdsLoading from "./AdsLoading.vue";
80
-
81
- export type AdsCardType = "container" | "details";
82
-
83
- export interface AdsCardRow {
84
- /** Ícone Lucide de 16px. */
85
- icon?: string;
86
- /** Rótulo em negrito, como "Criado em:". */
87
- label: string;
88
- value: string;
89
- }
90
-
91
- const props = withDefaults(
92
- defineProps<{
93
- /**
94
- * container: título, período e conteúdo livre no slot padrão.
95
- * details: título maior e lista de informações (rows).
96
- */
97
- type?: AdsCardType;
98
- /** O slot header substitui. */
99
- title?: string;
100
- /** Texto do ícone de informação ao lado do título. */
101
- hint?: string;
102
- /** Datas do período, como "01/12/2023 - 20/12/2023". */
103
- period?: string;
104
- periodLabel?: string;
105
- /** Linhas do card Detalhes. */
106
- rows?: AdsCardRow[];
107
- /** Texto de apoio abaixo do cabeçalho. Só no código: o Figma não tem. */
108
- description?: string;
109
- /** Linha curta no rodapé. O slot footer substitui. Só no código: o Figma não tem. */
110
- footerText?: string;
111
- /**
112
- * `button` quando o cartão é a própria ação. Também aceita um componente de link
113
- * (como NuxtLink, com `to` passado direto no card): fica clicável como o botão.
114
- */
115
- as?: "div" | "button" | Component;
116
- disabled?: boolean;
117
- /** Hover padrão dos cards clicáveis: borda cinza mais escura e sombra leve. false desliga. */
118
- hoverable?: boolean;
119
- /** Estado Selecionado: fundo azul claro, borda azul e sombra. */
120
- selected?: boolean;
121
- /** `md` (12px) é o do Figma; `sm` (8px) é só no código. */
122
- radius?: "sm" | "md";
123
- /** Estado Carregando: no container, o loader do Radar; no details, skeleton nas linhas. */
124
- loading?: boolean;
125
- /** Estado Vazio: mantém o cabeçalho e mostra o empty state. */
126
- empty?: boolean;
127
- emptyMessage?: string;
128
- emptyDescription?: string;
129
- }>(),
130
- {
131
- type: "container",
132
- title: undefined,
133
- hint: undefined,
134
- period: undefined,
135
- periodLabel: "Período:",
136
- rows: () => [],
137
- description: undefined,
138
- footerText: undefined,
139
- as: "div",
140
- disabled: false,
141
- hoverable: true,
142
- selected: false,
143
- radius: "md",
144
- loading: false,
145
- empty: false,
146
- emptyMessage: "Sem dados no período",
147
- emptyDescription: undefined,
148
- },
149
- );
150
-
151
- const slots = useSlots();
152
-
153
- const containerTitleClass = "text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-card-title)]";
154
- const detailsTitleClass = "text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
155
-
156
- /** Larguras do skeleton do Figma; uma barra por linha. */
157
- const SKELETON_WIDTHS = [200, 240, 160, 180, 260];
158
- const detailSkeletonWidths = computed(() => {
159
- const count = props.rows.length || SKELETON_WIDTHS.length;
160
- return Array.from({ length: count }, (_, index) => SKELETON_WIDTHS[index % SKELETON_WIDTHS.length]);
161
- });
162
-
163
- const showHeader = computed(() => Boolean(props.title || props.hint || slots.header || slots.actions));
164
-
165
- const radiusClass = computed(() =>
166
- props.radius === "sm" ? "rounded-[var(--ads-card-radius-sm)]" : "rounded-[var(--ads-card-radius)]",
167
- );
168
-
169
- const surfaceClass = computed(() => {
170
- const classes = [
171
- props.selected
172
- ? "border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
173
- : "border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
174
- ];
175
-
176
- if (props.as !== "div") {
177
- classes.push(
178
- "cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)] disabled:cursor-not-allowed disabled:opacity-[var(--ads-card-disabled-opacity,0.5)] aria-disabled:cursor-not-allowed",
179
- );
180
- // Hover padrão de todos os cards clicáveis: neutro, borda cinza mais escura e sombra leve.
181
- if (props.hoverable && !props.selected && !props.disabled) {
182
- classes.push("hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
183
- }
184
- }
185
-
186
- return classes;
187
- });
188
- </script>
1
+ <template>
2
+ <component
3
+ :is="as"
4
+ :type="as === 'button' ? 'button' : undefined"
5
+ :disabled="as === 'button' ? disabled : undefined"
6
+ :aria-busy="loading || undefined"
7
+ class="flex h-full min-w-0 flex-col items-start gap-3 border p-[var(--ads-card-padding)] text-left transition-[background-color,border-color,box-shadow]"
8
+ :class="[radiusClass, surfaceClass]"
9
+ >
10
+ <!-- Cabeçalho -->
11
+ <div v-if="showHeader" class="flex w-full min-w-0 items-center gap-2">
12
+ <div class="min-w-0 flex-1">
13
+ <slot name="header">
14
+ <p :class="type === 'details' ? detailsTitleClass : containerTitleClass">{{ title }}</p>
15
+ </slot>
16
+ </div>
17
+ <AdsCardHint v-if="hint" :text="hint" />
18
+ <slot name="actions" />
19
+ </div>
20
+
21
+ <AdsCardPeriod v-if="period || (loading && periodLabel && type === 'container')" :label="periodLabel" :value="period" :loading="loading" :skeleton-width="110" />
22
+
23
+ <p v-if="description && !loading && !empty" class="text-[length:var(--ads-card-body-size)] leading-[1.4] text-[var(--ads-card-body)]">
24
+ {{ description }}
25
+ </p>
26
+
27
+ <!-- Vazio: mantém o cabeçalho e mostra o empty state -->
28
+ <div v-if="empty && !loading" class="flex w-full justify-center py-2">
29
+ <slot name="empty">
30
+ <AdsEmptyState small :title="emptyMessage" :subtitle="emptyDescription ?? ''" :show-actions="Boolean($slots['empty-actions'])">
31
+ <slot name="empty-actions" />
32
+ </AdsEmptyState>
33
+ </slot>
34
+ </div>
35
+
36
+ <!-- Detalhes: lista de informações -->
37
+ <template v-else-if="type === 'details'">
38
+ <div v-if="loading" class="flex w-full flex-col items-start gap-3" aria-hidden="true">
39
+ <span
40
+ v-for="(width, index) in detailSkeletonWidths"
41
+ :key="index"
42
+ class="block h-3.5 max-w-full animate-pulse rounded-[var(--ads-radius-xsm)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
43
+ :style="{ width: `${width}px` }"
44
+ />
45
+ </div>
46
+ <dl v-else-if="rows.length" class="flex w-full flex-col items-start gap-3">
47
+ <div v-for="(row, index) in rows" :key="index" class="flex min-w-0 max-w-full items-center gap-1 text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">
48
+ <UIcon v-if="row.icon" :name="row.icon" class="size-4 shrink-0" aria-hidden="true" />
49
+ <dt class="shrink-0 font-bold">{{ row.label }}</dt>
50
+ <dd class="min-w-0 truncate">{{ row.value }}</dd>
51
+ </div>
52
+ </dl>
53
+ <slot />
54
+ </template>
55
+
56
+ <!-- Container: conteúdo livre (gráfico, tabela, lista) -->
57
+ <template v-else>
58
+ <div v-if="loading" class="flex h-[200px] w-full items-center justify-center">
59
+ <AdsLoading variant="logo" />
60
+ </div>
61
+ <div v-else-if="$slots.default" class="w-full min-w-0 flex-1">
62
+ <slot />
63
+ </div>
64
+ </template>
65
+
66
+ <div v-if="(footerText || $slots.footer) && !loading && !empty" class="flex w-full flex-wrap items-start justify-between gap-3">
67
+ <slot name="footer">
68
+ <p class="text-[length:var(--ads-font-size-xxxs)] text-[var(--ads-text-secondary)]">{{ footerText }}</p>
69
+ </slot>
70
+ </div>
71
+ </component>
72
+ </template>
73
+
74
+ <script setup lang="ts">
75
+ import { computed, useSlots, type Component } from "vue";
76
+ import AdsCardHint from "./AdsCardHint.vue";
77
+ import AdsCardPeriod from "./AdsCardPeriod.vue";
78
+ import AdsEmptyState from "./AdsEmptyState.vue";
79
+ import AdsLoading from "./AdsLoading.vue";
80
+
81
+ export type AdsCardType = "container" | "details";
82
+
83
+ export interface AdsCardRow {
84
+ /** Ícone Lucide de 16px. */
85
+ icon?: string;
86
+ /** Rótulo em negrito, como "Criado em:". */
87
+ label: string;
88
+ value: string;
89
+ }
90
+
91
+ const props = withDefaults(
92
+ defineProps<{
93
+ /**
94
+ * container: título, período e conteúdo livre no slot padrão.
95
+ * details: título maior e lista de informações (rows).
96
+ */
97
+ type?: AdsCardType;
98
+ /** O slot header substitui. */
99
+ title?: string;
100
+ /** Texto do ícone de informação ao lado do título. */
101
+ hint?: string;
102
+ /** Datas do período, como "01/12/2023 - 20/12/2023". */
103
+ period?: string;
104
+ periodLabel?: string;
105
+ /** Linhas do card Detalhes. */
106
+ rows?: AdsCardRow[];
107
+ /** Texto de apoio abaixo do cabeçalho. Só no código: o Figma não tem. */
108
+ description?: string;
109
+ /** Linha curta no rodapé. O slot footer substitui. Só no código: o Figma não tem. */
110
+ footerText?: string;
111
+ /**
112
+ * `button` quando o cartão é a própria ação. Também aceita um componente de link
113
+ * (como NuxtLink, com `to` passado direto no card): fica clicável como o botão.
114
+ */
115
+ as?: "div" | "button" | Component;
116
+ disabled?: boolean;
117
+ /** Hover padrão dos cards clicáveis: borda cinza mais escura e sombra leve. false desliga. */
118
+ hoverable?: boolean;
119
+ /** Estado Selecionado: fundo azul claro, borda azul e sombra. */
120
+ selected?: boolean;
121
+ /** `md` (12px) é o do Figma; `sm` (8px) é só no código. */
122
+ radius?: "sm" | "md";
123
+ /** Estado Carregando: no container, o loader do Radar; no details, skeleton nas linhas. */
124
+ loading?: boolean;
125
+ /** Estado Vazio: mantém o cabeçalho e mostra o empty state. */
126
+ empty?: boolean;
127
+ emptyMessage?: string;
128
+ emptyDescription?: string;
129
+ }>(),
130
+ {
131
+ type: "container",
132
+ title: undefined,
133
+ hint: undefined,
134
+ period: undefined,
135
+ periodLabel: "Período:",
136
+ rows: () => [],
137
+ description: undefined,
138
+ footerText: undefined,
139
+ as: "div",
140
+ disabled: false,
141
+ hoverable: true,
142
+ selected: false,
143
+ radius: "md",
144
+ loading: false,
145
+ empty: false,
146
+ emptyMessage: "Sem dados no período",
147
+ emptyDescription: undefined,
148
+ },
149
+ );
150
+
151
+ const slots = useSlots();
152
+
153
+ const containerTitleClass = "text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-card-title)]";
154
+ const detailsTitleClass = "text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
155
+
156
+ /** Larguras do skeleton do Figma; uma barra por linha. */
157
+ const SKELETON_WIDTHS = [200, 240, 160, 180, 260];
158
+ const detailSkeletonWidths = computed(() => {
159
+ const count = props.rows.length || SKELETON_WIDTHS.length;
160
+ return Array.from({ length: count }, (_, index) => SKELETON_WIDTHS[index % SKELETON_WIDTHS.length]);
161
+ });
162
+
163
+ const showHeader = computed(() => Boolean(props.title || props.hint || slots.header || slots.actions));
164
+
165
+ const radiusClass = computed(() =>
166
+ props.radius === "sm" ? "rounded-[var(--ads-card-radius-sm)]" : "rounded-[var(--ads-card-radius)]",
167
+ );
168
+
169
+ const surfaceClass = computed(() => {
170
+ const classes = [
171
+ props.selected
172
+ ? "border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
173
+ : "border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
174
+ ];
175
+
176
+ if (props.as !== "div") {
177
+ classes.push(
178
+ "cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)] disabled:cursor-not-allowed disabled:opacity-[var(--ads-card-disabled-opacity,0.5)] aria-disabled:cursor-not-allowed",
179
+ );
180
+ // Hover padrão de todos os cards clicáveis: neutro, borda cinza mais escura e sombra leve.
181
+ if (props.hoverable && !props.selected && !props.disabled) {
182
+ classes.push("hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
183
+ }
184
+ }
185
+
186
+ return classes;
187
+ });
188
+ </script>