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,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 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 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 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 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,117 +1,188 @@
1
- <template>
2
- <component
3
- :is="as"
4
- :type="as === 'button' ? 'button' : undefined"
5
- :disabled="as === 'button' ? disabled : undefined"
6
- class="h-full border p-[var(--ads-card-padding)] text-left"
7
- :class="[radiusClass, surfaceClass]"
8
- >
9
- <div
10
- v-if="showHeader"
11
- class="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between"
12
- >
13
- <div class="min-w-0 flex-1">
14
- <slot name="header">
15
- <p class="flex items-center justify-between gap-2 font-bold text-[var(--ads-card-title)]">
16
- <span class="min-w-0">{{ title }}</span>
17
- <slot name="hint" />
18
- </p>
19
- </slot>
20
- </div>
21
- <div v-if="$slots.actions" class="flex shrink-0 flex-wrap items-center gap-2">
22
- <slot name="actions" />
23
- </div>
24
- </div>
25
-
26
- <div
27
- v-if="description || $slots.default"
28
- :class="showHeader ? 'mt-2' : undefined"
29
- >
30
- <slot>
31
- <p class="text-[length:var(--ads-card-body-size)] leading-relaxed text-[var(--ads-card-body)]">
32
- {{ description }}
33
- </p>
34
- </slot>
35
- </div>
36
-
37
- <div
38
- v-if="footerText || $slots.footer"
39
- class="flex flex-wrap items-start justify-between gap-3"
40
- :class="hasContentAboveFooter ? 'mt-4' : undefined"
41
- >
42
- <slot name="footer">
43
- <p class="text-xs text-[var(--ads-text-secondary)]">
44
- {{ footerText }}
45
- </p>
46
- </slot>
47
- </div>
48
- </component>
49
- </template>
50
-
51
- <script setup lang="ts">
52
- import { computed, useSlots } from "vue";
53
-
54
- const props = withDefaults(
55
- defineProps<{
56
- /** Título em negrito. O slot header substitui. */
57
- title?: string;
58
- /** Texto de apoio. O slot padrão substitui. */
59
- description?: string;
60
- /** Linha curta no rodapé. O slot footer substitui. */
61
- footerText?: string;
62
- /** `button` quando o cartão é a própria ação. */
63
- as?: "div" | "button";
64
- disabled?: boolean;
65
- /** Realce de item escolhido, como um filtro ativo. */
66
- selected?: boolean;
67
- /** `sm` (8px) em cartões grandes; `md` (12px) é o padrão. */
68
- radius?: "sm" | "md";
69
- }>(),
70
- {
71
- as: "div",
72
- disabled: false,
73
- selected: false,
74
- radius: "md",
75
- },
76
- );
77
-
78
- const radiusClass = computed(() =>
79
- props.radius === "sm"
80
- ? "rounded-[var(--ads-card-radius-sm)]"
81
- : "rounded-[var(--ads-card-radius)]",
82
- );
83
-
84
- const surfaceClass = computed(() => {
85
- const classes = [
86
- props.selected
87
- ? "border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)]"
88
- : "border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
89
- ];
90
-
91
- if (props.as === "button") {
92
- classes.push(
93
- "cursor-pointer transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-primary)] disabled:cursor-not-allowed disabled:opacity-50",
94
- );
95
- if (!props.selected && !props.disabled) {
96
- classes.push("hover:bg-[var(--color-neutral-100)]");
97
- }
98
- }
99
-
100
- return classes;
101
- });
102
-
103
- const slots = useSlots();
104
-
105
- const showHeader = computed(
106
- () =>
107
- Boolean(props.title) ||
108
- Boolean(slots.header || slots.actions),
109
- );
110
-
111
- const hasContentAboveFooter = computed(
112
- () =>
113
- showHeader.value ||
114
- Boolean(props.description) ||
115
- Boolean(slots.default),
116
- );
117
- </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>
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <AdsTooltip :description="text" :show-title="false" class="inline-flex shrink-0">
3
+ <!-- span focável, e não button: o card inteiro pode ser um botão -->
4
+ <span
5
+ tabindex="0"
6
+ role="img"
7
+ class="inline-flex size-4 items-center justify-center rounded-[var(--ads-radius-circular)] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
8
+ :aria-label="text"
9
+ >
10
+ <UIcon name="i-lucide-info" class="size-4" aria-hidden="true" />
11
+ </span>
12
+ </AdsTooltip>
13
+ </template>
14
+
15
+ <script setup lang="ts">
16
+ import AdsTooltip from "./AdsTooltip.vue";
17
+
18
+ /** Ícone de informação dos cards (Info do Figma). O texto abre no hover e no foco. */
19
+ defineProps<{
20
+ text: string;
21
+ }>();
22
+ </script>
@@ -0,0 +1,43 @@
1
+ <template>
2
+ <div class="flex w-full flex-wrap items-center gap-x-2 gap-y-1">
3
+ <span class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">{{ label }}</span>
4
+ <span
5
+ v-if="loading"
6
+ class="block h-[18px] animate-pulse rounded-[var(--ads-radius-pill)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
7
+ :style="{ width: `${skeletonWidth}px` }"
8
+ aria-hidden="true"
9
+ />
10
+ <span
11
+ v-else-if="value"
12
+ class="inline-flex h-[18px] items-center rounded-[var(--ads-radius-pill)] px-2 text-[length:var(--ads-font-size-minimal)] font-bold leading-[1.1] whitespace-nowrap"
13
+ :class="tone === 'neutral'
14
+ ? 'bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]'
15
+ : 'bg-ads-radar-25 text-ads-radar-800'"
16
+ >
17
+ {{ value }}
18
+ </span>
19
+ </div>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ /**
24
+ * Rótulo com selo, usado no período e no comparativo dos cards.
25
+ * brand é o selo de datas (azul); neutral é o selo do comparativo (cinza).
26
+ */
27
+ withDefaults(
28
+ defineProps<{
29
+ label: string;
30
+ value?: string;
31
+ tone?: "brand" | "neutral";
32
+ loading?: boolean;
33
+ /** Largura do skeleton do selo, em px. */
34
+ skeletonWidth?: number;
35
+ }>(),
36
+ {
37
+ value: undefined,
38
+ tone: "brand",
39
+ loading: false,
40
+ skeletonWidth: 150,
41
+ },
42
+ );
43
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <span
3
+ class="inline-flex shrink-0 items-center gap-0.5 text-[length:var(--ads-font-size-xxxs)] font-bold leading-[1.2] tabular-nums"
4
+ :class="tone === 'negative' ? 'text-[var(--ads-status-warning-500)]' : 'text-[var(--ads-status-success-800)]'"
5
+ >
6
+ <UIcon :name="direction === 'down' ? 'i-lucide-arrow-down' : 'i-lucide-arrow-up'" class="size-4" aria-hidden="true" />
7
+ <span class="sr-only">{{ direction === "down" ? "Queda de" : "Alta de" }}</span>
8
+ {{ value }}
9
+ </span>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ export type AdsCardVariationDirection = "up" | "down";
14
+ export type AdsCardVariationTone = "positive" | "negative";
15
+
16
+ /**
17
+ * Variação de métrica (_Card Variation do Figma): seta e percentual.
18
+ * direction diz se o número subiu ou caiu; tone diz se isso é bom (positive) ou ruim (negative).
19
+ */
20
+ withDefaults(
21
+ defineProps<{
22
+ value: string;
23
+ direction?: AdsCardVariationDirection;
24
+ tone?: AdsCardVariationTone;
25
+ }>(),
26
+ {
27
+ direction: "up",
28
+ tone: "positive",
29
+ },
30
+ );
31
+ </script>