ads-nuxt 0.4.0 → 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 (80) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +574 -575
  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/component-tokens.css +6 -2
  11. package/app/assets/css/main.css +585 -585
  12. package/app/components/AdsBadge.vue +47 -47
  13. package/app/components/AdsBroadcast.vue +24 -24
  14. package/app/components/AdsButton.vue +547 -547
  15. package/app/components/AdsButtonGroup.vue +39 -39
  16. package/app/components/AdsButtonMenu.vue +48 -48
  17. package/app/components/AdsCard.vue +188 -188
  18. package/app/components/AdsCardHint.vue +56 -22
  19. package/app/components/AdsCardPeriod.vue +43 -43
  20. package/app/components/AdsCardVariation.vue +31 -31
  21. package/app/components/AdsCharttip.vue +79 -79
  22. package/app/components/AdsDatePicker.vue +509 -509
  23. package/app/components/AdsDropdownMenu.vue +30 -30
  24. package/app/components/AdsEmptyState.vue +61 -61
  25. package/app/components/AdsFeatureCard.vue +292 -210
  26. package/app/components/AdsFileCard.vue +98 -98
  27. package/app/components/AdsFooter.vue +25 -25
  28. package/app/components/AdsHeavyAccountCell.vue +59 -59
  29. package/app/components/AdsHeavyHeaderCell.vue +70 -70
  30. package/app/components/AdsHeavyTable.vue +135 -139
  31. package/app/components/AdsInput.vue +148 -148
  32. package/app/components/AdsLoading.vue +217 -217
  33. package/app/components/AdsMenuBar.vue +110 -110
  34. package/app/components/AdsMetricCard.vue +226 -216
  35. package/app/components/AdsModal.vue +160 -160
  36. package/app/components/AdsMonthPicker.vue +80 -80
  37. package/app/components/AdsNavbarApp.vue +67 -67
  38. package/app/components/AdsNavbarDesk.vue +67 -67
  39. package/app/components/AdsNotabilityPill.vue +24 -24
  40. package/app/components/AdsNumberInput.vue +173 -173
  41. package/app/components/AdsPanelCard.vue +99 -99
  42. package/app/components/AdsPill.vue +144 -144
  43. package/app/components/AdsProductTag.vue +80 -80
  44. package/app/components/AdsSearchInput.vue +122 -122
  45. package/app/components/AdsSegmentedTabs.vue +62 -62
  46. package/app/components/AdsSelect.vue +283 -283
  47. package/app/components/AdsSelectItem.vue +128 -128
  48. package/app/components/AdsSelectPanel.vue +221 -221
  49. package/app/components/AdsSideMenu.vue +101 -101
  50. package/app/components/AdsSmalltip.vue +44 -44
  51. package/app/components/AdsStepper.vue +222 -222
  52. package/app/components/AdsTable.vue +172 -176
  53. package/app/components/AdsTableHeaderCell.vue +80 -80
  54. package/app/components/AdsTableSkeleton.vue +113 -113
  55. package/app/components/AdsTableToolbar.vue +44 -44
  56. package/app/components/AdsTabs.vue +51 -51
  57. package/app/components/AdsTextarea.vue +116 -116
  58. package/app/components/AdsToast.vue +184 -184
  59. package/app/components/AdsTooltip.vue +73 -73
  60. package/app/components/OverlayLoading.vue +2 -17
  61. package/app/components/ProgressBarLoading.vue +235 -235
  62. package/app/composables/useOverlayLoading.ts +88 -88
  63. package/app/constants/ads-color-swatches.ts +240 -240
  64. package/app/locale/pt-br.ts +6 -6
  65. package/app/plugins/ads-toast.client.ts +24 -24
  66. package/app/theme/ads-theme.ts +374 -374
  67. package/app/theme/ads-tokens.ts +391 -391
  68. package/app/theme/component-tokens.json +6 -2
  69. package/app/theme/component-tokens.ts +6 -2
  70. package/app/types/overlay-loading.types.ts +32 -35
  71. package/app/utils/ads-filter-select.ts +191 -191
  72. package/app/utils/ads-table.ts +416 -398
  73. package/app/utils/calendar-date.ts +163 -163
  74. package/app/utils/category-role.ts +45 -45
  75. package/app/utils/money.ts +77 -77
  76. package/app/utils/notability.ts +8 -8
  77. package/app/utils/parser.ts +134 -134
  78. package/app/utils/percentage.ts +54 -54
  79. package/nuxt.config.ts +31 -31
  80. package/package.json +57 -56
@@ -1,216 +1,226 @@
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 rounded-[var(--ads-metric-radius)] border p-[var(--ads-metric-padding)] text-left font-normal transition-[background-color,border-color,box-shadow]"
8
- :class="[type === 'kpi' ? 'flex-row items-center gap-4' : 'flex-col items-start gap-3', surfaceClass]"
9
- >
10
- <!-- KPI: ícone grande à esquerda, título e valor à direita -->
11
- <template v-if="type === 'kpi'">
12
- <UIcon v-if="icon" :name="icon" class="size-6 shrink-0" :class="iconClass" aria-hidden="true" />
13
- <div class="flex min-w-0 flex-1 flex-col items-start gap-2">
14
- <div class="flex min-w-0 items-center gap-2">
15
- <p :class="titleClass">{{ title }}</p>
16
- <AdsCardHint v-if="hint" :text="hint" />
17
- </div>
18
- <span v-if="loading" :class="skeletonClass" class="h-5 w-[140px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
19
- <div v-else-if="empty" class="flex min-w-0 items-center gap-2">
20
- <span class="text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-text-tertiary)]" aria-hidden="true">—</span>
21
- <span :class="emptyMessageClass">{{ emptyMessage }}</span>
22
- </div>
23
- <div v-else class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
24
- <p class="text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-text-secondary)] tabular-nums">{{ value }}</p>
25
- <AdsCardVariation v-if="delta" :value="delta" :direction="deltaDirection" :tone="deltaTone" />
26
- </div>
27
- </div>
28
- </template>
29
-
30
- <!-- Pendência: ícone pequeno e título em negrito; número grande com unidade -->
31
- <template v-else-if="type === 'pending'">
32
- <div class="flex w-full min-w-0 items-center gap-1">
33
- <UIcon v-if="icon" :name="icon" class="size-4 shrink-0" :class="iconClass" aria-hidden="true" />
34
- <p class="min-w-0 truncate font-bold" :class="titleClass">{{ title }}</p>
35
- <AdsCardHint v-if="hint" :text="hint" />
36
- </div>
37
- <span v-if="loading" :class="skeletonClass" class="h-7 w-[72px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
38
- <div v-else-if="empty" class="flex min-w-0 items-baseline gap-1">
39
- <span class="text-[length:var(--ads-font-size-md)] font-bold leading-[1.3] text-[var(--ads-text-tertiary)]" aria-hidden="true">—</span>
40
- <span :class="emptyMessageClass">{{ emptyMessage }}</span>
41
- </div>
42
- <p v-else class="flex min-w-0 flex-wrap items-baseline gap-1">
43
- <span :class="[bigValueClass, selected ? '!text-[var(--ads-text-brand)]' : '']">{{ value }}</span>
44
- <span v-if="unit" class="text-[length:var(--ads-font-size-xxxs)] font-bold leading-[1.2] text-[var(--ads-text-secondary)]">{{ unit }}</span>
45
- </p>
46
- </template>
47
-
48
- <!-- Métrica: período, valor com variação e comparativo -->
49
- <template v-else>
50
- <div class="flex w-full min-w-0 items-center gap-2">
51
- <p class="min-w-0 flex-1" :class="titleClass">{{ title }}</p>
52
- <AdsCardHint v-if="hint" :text="hint" />
53
- <slot name="actions" />
54
- </div>
55
-
56
- <AdsCardPeriod v-if="period || (loading && periodLabel)" :label="periodLabel" :value="period" :loading="loading" />
57
-
58
- <div v-if="empty && !loading" class="flex w-full justify-center py-2">
59
- <slot name="empty">
60
- <AdsEmptyState small :title="emptyMessage" :subtitle="emptyDescription ?? ''" :show-actions="Boolean($slots['empty-actions'])">
61
- <slot name="empty-actions" />
62
- </AdsEmptyState>
63
- </slot>
64
- </div>
65
-
66
- <template v-else>
67
- <span v-if="loading" :class="skeletonClass" class="h-7 w-[110px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
68
- <div v-else class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
69
- <UIcon v-if="valueIcon" :name="valueIcon" class="size-6 shrink-0 text-[var(--ads-text-primary)]" aria-hidden="true" />
70
- <p :class="bigValueClass">{{ value }}</p>
71
- <AdsCardVariation v-if="delta" :value="delta" :direction="deltaDirection" :tone="deltaTone" />
72
- </div>
73
-
74
- <template v-if="comparisonLabel">
75
- <hr v-if="divider && !comparisonInline" class="h-px w-full border-0 bg-[var(--ads-border-subtle)]" />
76
-
77
- <div v-if="comparisonInline" class="flex w-full flex-wrap items-baseline gap-x-2 gap-y-1 text-[var(--ads-text-secondary)]">
78
- <span class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2]">{{ comparisonLabel }}</span>
79
- <span v-if="loading" :class="skeletonClass" class="h-4 w-20 rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
80
- <span v-else class="text-[length:var(--ads-font-size-xs)] leading-[1.3] tabular-nums">{{ comparisonValue }}</span>
81
- </div>
82
-
83
- <div v-else class="flex w-full flex-col items-start gap-2">
84
- <AdsCardPeriod
85
- :label="comparisonLabel"
86
- :value="comparisonBadge"
87
- tone="neutral"
88
- :loading="loading && Boolean(comparisonBadge)"
89
- :skeleton-width="80"
90
- />
91
- <span v-if="loading" :class="skeletonClass" class="h-4 w-16 rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
92
- <p v-else class="text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-text-secondary)] tabular-nums">{{ comparisonValue }}</p>
93
- </div>
94
- </template>
95
- </template>
96
- </template>
97
- </component>
98
- </template>
99
-
100
- <script setup lang="ts">
101
- import { computed } from "vue";
102
- import AdsCardHint from "./AdsCardHint.vue";
103
- import AdsCardPeriod from "./AdsCardPeriod.vue";
104
- import AdsCardVariation from "./AdsCardVariation.vue";
105
- import type { AdsCardVariationDirection, AdsCardVariationTone } from "./AdsCardVariation.vue";
106
- import AdsEmptyState from "./AdsEmptyState.vue";
107
-
108
- export type AdsMetricCardType = "kpi" | "pending" | "metric";
109
-
110
- const props = withDefaults(
111
- defineProps<{
112
- /**
113
- * kpi: ícone grande, título e valor.
114
- * pending: número em destaque com unidade, bom para cards selecionáveis.
115
- * metric: período, valor com variação e comparativo.
116
- */
117
- type?: AdsMetricCardType;
118
- title: string;
119
- /** Valor principal. */
120
- value?: string;
121
- /** Texto do ícone de informação ao lado do título. */
122
- hint?: string;
123
- /** Ícone Lucide: 24px no KPI, 16px na Pendência. */
124
- icon?: string;
125
- /** Unidade ao lado do número na Pendência, como "pendências". */
126
- unit?: string;
127
- /** Ícone de 24px antes do valor na Métrica. */
128
- valueIcon?: string;
129
- /** Variação ao lado do valor (KPI e Métrica), como "1,15%". */
130
- delta?: string;
131
- deltaDirection?: AdsCardVariationDirection;
132
- /** positive quando a variação é boa; negative quando é ruim. */
133
- deltaTone?: AdsCardVariationTone;
134
- /** Datas do período (Métrica), como "01/12/2023 - 20/12/2023". */
135
- period?: string;
136
- periodLabel?: string;
137
- /** Rótulo do comparativo (Métrica). Sem ele, o comparativo some. */
138
- comparisonLabel?: string;
139
- comparisonValue?: string;
140
- /** Selo cinza ao lado do rótulo do comparativo, como "Set, Out e Nov". */
141
- comparisonBadge?: string;
142
- /** Rótulo e valor do comparativo na mesma linha, sem divisória. */
143
- comparisonInline?: boolean;
144
- /** Linha entre o valor e o comparativo empilhado. */
145
- divider?: boolean;
146
- /** Estado Selecionado: fundo azul claro, borda azul e sombra. */
147
- selected?: boolean;
148
- /** Estado Carregando: título e rótulos ficam; valores viram skeleton. */
149
- loading?: boolean;
150
- /** Estado Vazio. KPI e Pendência mostram "—" com a mensagem; Métrica mostra o empty state. */
151
- empty?: boolean;
152
- emptyMessage?: string;
153
- /** Texto de apoio do empty state da Métrica. */
154
- emptyDescription?: string;
155
- /** `button` quando o cartão é a própria ação. */
156
- as?: "div" | "button";
157
- disabled?: boolean;
158
- /** Hover padrão dos cards clicáveis: borda cinza mais escura e sombra leve. false desliga. */
159
- hoverable?: boolean;
160
- }>(),
161
- {
162
- type: "metric",
163
- value: undefined,
164
- hint: undefined,
165
- icon: undefined,
166
- unit: undefined,
167
- valueIcon: undefined,
168
- delta: undefined,
169
- deltaDirection: "up",
170
- deltaTone: "positive",
171
- period: undefined,
172
- periodLabel: "Período:",
173
- comparisonLabel: undefined,
174
- comparisonValue: undefined,
175
- comparisonBadge: undefined,
176
- comparisonInline: false,
177
- divider: true,
178
- selected: false,
179
- loading: false,
180
- empty: false,
181
- emptyMessage: "Sem dados no período",
182
- emptyDescription: undefined,
183
- as: "div",
184
- disabled: false,
185
- hoverable: true,
186
- },
187
- );
188
-
189
- const titleClass = "text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-metric-label)]";
190
- const bigValueClass = "text-[length:var(--ads-font-size-md)] font-bold leading-[1.3] text-[var(--ads-metric-value)] tabular-nums";
191
- const emptyMessageClass = "text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]";
192
- const skeletonClass = "block animate-pulse bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none";
193
-
194
- const iconClass = computed(() =>
195
- props.selected ? "text-[var(--ads-text-brand)]" : "text-[var(--ads-text-secondary)]",
196
- );
197
-
198
- const surfaceClass = computed(() => {
199
- const classes = [
200
- props.selected
201
- ? "border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
202
- : "border-[var(--ads-metric-border)] bg-[var(--ads-metric-background)]",
203
- ];
204
-
205
- if (props.as === "button") {
206
- classes.push(
207
- "cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)] disabled:cursor-not-allowed disabled:opacity-50",
208
- );
209
- if (props.hoverable && !props.selected && !props.disabled) {
210
- classes.push("hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
211
- }
212
- }
213
-
214
- return classes;
215
- });
216
- </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 rounded-[var(--ads-metric-radius)] border p-[var(--ads-metric-padding)] text-left font-normal transition-[background-color,border-color,box-shadow]"
8
+ :class="[type === 'kpi' ? 'flex-row items-center gap-4' : 'flex-col items-start gap-3', surfaceClass]"
9
+ >
10
+ <!-- KPI: ícone grande à esquerda, título e valor à direita -->
11
+ <template v-if="type === 'kpi'">
12
+ <UIcon v-if="icon" :name="icon" class="size-6 shrink-0" :class="iconClass" aria-hidden="true" />
13
+ <div class="flex min-w-0 flex-1 flex-col items-start gap-2">
14
+ <div class="flex w-full min-w-0 items-center gap-2">
15
+ <p :class="titleClass">{{ title }}</p>
16
+ <AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
17
+ </div>
18
+ <span v-if="loading" :class="skeletonClass" class="h-5 w-[140px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
19
+ <div v-else-if="empty" class="flex min-w-0 items-center gap-2">
20
+ <span class="text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-text-tertiary)]" aria-hidden="true">—</span>
21
+ <span :class="emptyMessageClass">{{ emptyMessage }}</span>
22
+ </div>
23
+ <div v-else class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
24
+ <p class="text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-text-secondary)] tabular-nums">{{ value }}</p>
25
+ <AdsCardVariation v-if="delta" :value="delta" :direction="deltaDirection" :tone="deltaTone" />
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <!-- Pendência: ícone pequeno e título em negrito; número grande com unidade -->
31
+ <template v-else-if="type === 'pending'">
32
+ <div class="flex w-full min-w-0 items-center gap-1">
33
+ <UIcon v-if="icon" :name="icon" class="size-4 shrink-0" :class="iconClass" aria-hidden="true" />
34
+ <p class="min-w-0 truncate font-bold" :class="titleClass">{{ title }}</p>
35
+ <AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
36
+ </div>
37
+ <span v-if="loading" :class="skeletonClass" class="h-7 w-[72px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
38
+ <div v-else-if="empty" class="flex min-w-0 items-baseline gap-1">
39
+ <span class="text-[length:var(--ads-font-size-md)] font-bold leading-[1.3] text-[var(--ads-text-tertiary)]" aria-hidden="true">—</span>
40
+ <span :class="emptyMessageClass">{{ emptyMessage }}</span>
41
+ </div>
42
+ <p v-else class="flex min-w-0 flex-wrap items-baseline gap-1">
43
+ <span :class="[bigValueClass, selected ? '!text-[var(--ads-text-brand)]' : '']">{{ value }}</span>
44
+ <span v-if="unit" class="text-[length:var(--ads-font-size-xxxs)] font-bold leading-[1.2] text-[var(--ads-text-secondary)]">{{ unit }}</span>
45
+ </p>
46
+ </template>
47
+
48
+ <!-- Métrica: período, valor com variação e comparativo -->
49
+ <template v-else>
50
+ <div class="flex w-full min-w-0 items-center gap-2">
51
+ <p class="min-w-0 flex-1" :class="titleClass">{{ title }}</p>
52
+ <AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
53
+ <slot name="actions" />
54
+ </div>
55
+
56
+ <AdsCardPeriod v-if="period || (loading && periodLabel)" :label="periodLabel" :value="period" :loading="loading" />
57
+
58
+ <div v-if="empty && !loading" class="flex w-full justify-center py-2">
59
+ <slot name="empty">
60
+ <AdsEmptyState small :title="emptyMessage" :subtitle="emptyDescription ?? ''" :show-actions="Boolean($slots['empty-actions'])">
61
+ <slot name="empty-actions" />
62
+ </AdsEmptyState>
63
+ </slot>
64
+ </div>
65
+
66
+ <template v-else>
67
+ <span v-if="loading" :class="skeletonClass" class="h-7 w-[110px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
68
+ <div v-else class="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1">
69
+ <UIcon v-if="valueIcon" :name="valueIcon" class="size-6 shrink-0 text-[var(--ads-text-primary)]" aria-hidden="true" />
70
+ <p :class="bigValueClass">{{ value }}</p>
71
+ <AdsCardVariation v-if="delta" :value="delta" :direction="deltaDirection" :tone="deltaTone" />
72
+ </div>
73
+
74
+ <template v-if="comparisonLabel">
75
+ <hr v-if="divider && !comparisonInline" class="h-px w-full border-0 bg-[var(--ads-border-subtle)]" />
76
+
77
+ <div v-if="comparisonInline" class="flex w-full flex-wrap items-baseline gap-x-2 gap-y-1 text-[var(--ads-text-secondary)]">
78
+ <span class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2]">{{ comparisonLabel }}</span>
79
+ <span v-if="loading" :class="skeletonClass" class="h-4 w-20 rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
80
+ <span v-else class="text-[length:var(--ads-font-size-xs)] leading-[1.3] tabular-nums">{{ comparisonValue }}</span>
81
+ </div>
82
+
83
+ <div v-else class="flex w-full flex-col items-start gap-2">
84
+ <AdsCardPeriod
85
+ :label="comparisonLabel"
86
+ :value="comparisonBadge"
87
+ tone="neutral"
88
+ :loading="loading && Boolean(comparisonBadge)"
89
+ :skeleton-width="80"
90
+ />
91
+ <span v-if="loading" :class="skeletonClass" class="h-4 w-16 rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
92
+ <p v-else class="text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-text-secondary)] tabular-nums">{{ comparisonValue }}</p>
93
+ </div>
94
+ </template>
95
+ </template>
96
+ </template>
97
+ </component>
98
+ </template>
99
+
100
+ <script setup lang="ts">
101
+ import { computed } from "vue";
102
+ import AdsCardHint from "./AdsCardHint.vue";
103
+ import AdsCardPeriod from "./AdsCardPeriod.vue";
104
+ import AdsCardVariation from "./AdsCardVariation.vue";
105
+ import type { AdsCardHintAlign, AdsCardHintColor } from "./AdsCardHint.vue";
106
+ import type { AdsCardVariationDirection, AdsCardVariationTone } from "./AdsCardVariation.vue";
107
+ import AdsEmptyState from "./AdsEmptyState.vue";
108
+
109
+ export type AdsMetricCardType = "kpi" | "pending" | "metric";
110
+
111
+ const props = withDefaults(
112
+ defineProps<{
113
+ /**
114
+ * kpi: ícone grande, título e valor.
115
+ * pending: número em destaque com unidade, bom para cards selecionáveis.
116
+ * metric: período, valor com variação e comparativo.
117
+ */
118
+ type?: AdsMetricCardType;
119
+ title: string;
120
+ /** Valor principal. */
121
+ value?: string;
122
+ /** Texto do balão do ícone ao lado do título. Sem ele, o ícone some. */
123
+ hint?: string;
124
+ /** Ícone Lucide do balão. Padrão: informação. */
125
+ hintIcon?: string;
126
+ /** Cor do ícone do balão. */
127
+ hintColor?: AdsCardHintColor;
128
+ /** `end` encosta o ícone no fim do card, à direita. */
129
+ hintAlign?: AdsCardHintAlign;
130
+ /** Ícone Lucide: 24px no KPI, 16px na Pendência. */
131
+ icon?: string;
132
+ /** Unidade ao lado do número na Pendência, como "pendências". */
133
+ unit?: string;
134
+ /** Ícone de 24px antes do valor na Métrica. */
135
+ valueIcon?: string;
136
+ /** Variação ao lado do valor (KPI e Métrica), como "1,15%". */
137
+ delta?: string;
138
+ deltaDirection?: AdsCardVariationDirection;
139
+ /** positive quando a variação é boa; negative quando é ruim. */
140
+ deltaTone?: AdsCardVariationTone;
141
+ /** Datas do período (Métrica), como "01/12/2023 - 20/12/2023". */
142
+ period?: string;
143
+ periodLabel?: string;
144
+ /** Rótulo do comparativo (Métrica). Sem ele, o comparativo some. */
145
+ comparisonLabel?: string;
146
+ comparisonValue?: string;
147
+ /** Selo cinza ao lado do rótulo do comparativo, como "Set, Out e Nov". */
148
+ comparisonBadge?: string;
149
+ /** Rótulo e valor do comparativo na mesma linha, sem divisória. */
150
+ comparisonInline?: boolean;
151
+ /** Linha entre o valor e o comparativo empilhado. */
152
+ divider?: boolean;
153
+ /** Estado Selecionado: fundo azul claro, borda azul e sombra. */
154
+ selected?: boolean;
155
+ /** Estado Carregando: título e rótulos ficam; valores viram skeleton. */
156
+ loading?: boolean;
157
+ /** Estado Vazio. KPI e Pendência mostram "—" com a mensagem; Métrica mostra o empty state. */
158
+ empty?: boolean;
159
+ emptyMessage?: string;
160
+ /** Texto de apoio do empty state da Métrica. */
161
+ emptyDescription?: string;
162
+ /** `button` quando o cartão é a própria ação. */
163
+ as?: "div" | "button";
164
+ disabled?: boolean;
165
+ /** Hover padrão dos cards clicáveis: borda cinza mais escura e sombra leve. false desliga. */
166
+ hoverable?: boolean;
167
+ }>(),
168
+ {
169
+ type: "metric",
170
+ value: undefined,
171
+ hint: undefined,
172
+ hintIcon: "i-lucide-info",
173
+ hintColor: "secondary",
174
+ hintAlign: "start",
175
+ icon: undefined,
176
+ unit: undefined,
177
+ valueIcon: undefined,
178
+ delta: undefined,
179
+ deltaDirection: "up",
180
+ deltaTone: "positive",
181
+ period: undefined,
182
+ periodLabel: "Período:",
183
+ comparisonLabel: undefined,
184
+ comparisonValue: undefined,
185
+ comparisonBadge: undefined,
186
+ comparisonInline: false,
187
+ divider: true,
188
+ selected: false,
189
+ loading: false,
190
+ empty: false,
191
+ emptyMessage: "Sem dados no período",
192
+ emptyDescription: undefined,
193
+ as: "div",
194
+ disabled: false,
195
+ hoverable: true,
196
+ },
197
+ );
198
+
199
+ const titleClass = "text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-metric-label)]";
200
+ const bigValueClass = "text-[length:var(--ads-font-size-md)] font-bold leading-[1.3] text-[var(--ads-metric-value)] tabular-nums";
201
+ const emptyMessageClass = "text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]";
202
+ const skeletonClass = "block animate-pulse bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none";
203
+
204
+ const iconClass = computed(() =>
205
+ props.selected ? "text-[var(--ads-text-brand)]" : "text-[var(--ads-text-secondary)]",
206
+ );
207
+
208
+ const surfaceClass = computed(() => {
209
+ const classes = [
210
+ props.selected
211
+ ? "border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
212
+ : "border-[var(--ads-metric-border)] bg-[var(--ads-metric-background)]",
213
+ ];
214
+
215
+ if (props.as === "button") {
216
+ classes.push(
217
+ "cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)] disabled:cursor-not-allowed disabled:opacity-50",
218
+ );
219
+ if (props.hoverable && !props.selected && !props.disabled) {
220
+ classes.push("hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
221
+ }
222
+ }
223
+
224
+ return classes;
225
+ });
226
+ </script>