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.
- package/LICENSE +21 -21
- package/README.md +573 -577
- package/app/app.config.ts +25 -25
- package/app/assets/ads/checkbox-check.svg +5 -5
- package/app/assets/ads/checkbox-minus.svg +5 -5
- package/app/assets/brand/farmarcas.svg +6 -6
- package/app/assets/brand/radar-symbol.svg +9 -0
- package/app/assets/brand/radar.svg +9 -9
- package/app/assets/css/ads-colors.css +257 -246
- package/app/assets/css/component-tokens.css +367 -403
- package/app/assets/css/main.css +624 -617
- package/app/components/AdsBadge.vue +47 -48
- package/app/components/AdsBroadcast.vue +24 -45
- package/app/components/AdsButton.vue +539 -569
- package/app/components/AdsButtonGroup.vue +39 -39
- package/app/components/AdsButtonMenu.vue +48 -48
- package/app/components/AdsCard.vue +188 -117
- package/app/components/AdsCardHint.vue +22 -0
- package/app/components/AdsCardPeriod.vue +43 -0
- package/app/components/AdsCardVariation.vue +31 -0
- package/app/components/AdsCharttip.vue +78 -78
- package/app/components/AdsCheckbox.vue +77 -77
- package/app/components/AdsDatePicker.vue +492 -491
- package/app/components/AdsDropdownMenu.vue +30 -19
- package/app/components/AdsEmptyState.vue +58 -58
- package/app/components/AdsFeatureCard.vue +210 -219
- package/app/components/AdsFileCard.vue +98 -101
- package/app/components/AdsFooter.vue +25 -25
- package/app/components/AdsHeavyAccountCell.vue +59 -0
- package/app/components/AdsHeavyHeaderCell.vue +70 -0
- package/app/components/AdsHeavyTable.vue +135 -0
- package/app/components/AdsInput.vue +147 -147
- package/app/components/AdsLoading.vue +217 -109
- package/app/components/AdsMenuBar.vue +103 -103
- package/app/components/AdsMetricCard.vue +216 -119
- package/app/components/AdsModal.vue +157 -157
- package/app/components/AdsMonthPicker.vue +80 -80
- package/app/components/AdsNavbarApp.vue +67 -67
- package/app/components/AdsNavbarDesk.vue +62 -62
- package/app/components/AdsNotabilityPill.vue +24 -27
- package/app/components/AdsNumberInput.vue +173 -173
- package/app/components/AdsPagination.vue +91 -91
- package/app/components/AdsPanelCard.vue +99 -0
- package/app/components/AdsPill.vue +144 -92
- package/app/components/AdsProductTag.vue +61 -61
- package/app/components/AdsRadio.vue +70 -70
- package/app/components/AdsSearchInput.vue +122 -122
- package/app/components/AdsSegmentedTabs.vue +62 -28
- package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -210
- package/app/components/AdsSelectItem.vue +128 -0
- package/app/components/AdsSelectPanel.vue +150 -0
- package/app/components/AdsSideMenu.vue +101 -101
- package/app/components/AdsSmalltip.vue +44 -44
- package/app/components/AdsStepper.vue +222 -0
- package/app/components/AdsSteptip.vue +101 -101
- package/app/components/AdsSwitch.vue +59 -59
- package/app/components/AdsTable.vue +161 -100
- package/app/components/AdsTableHeaderCell.vue +80 -0
- package/app/components/AdsTableSkeleton.vue +113 -0
- package/app/components/AdsTableToolbar.vue +44 -44
- package/app/components/AdsTabs.vue +51 -51
- package/app/components/AdsTextarea.vue +116 -116
- package/app/components/AdsToast.vue +183 -181
- package/app/components/AdsTooltip.vue +73 -73
- package/app/components/OverlayLoading.vue +173 -173
- package/app/components/ProgressBarLoading.vue +235 -256
- package/app/composables/useOverlayLoading.ts +66 -66
- package/app/constants/ads-color-swatches.ts +240 -239
- package/app/locale/pt-br.ts +6 -6
- package/app/plugins/ads-toast.client.ts +24 -24
- package/app/theme/ads-theme.ts +374 -370
- package/app/theme/ads-tokens.ts +391 -379
- package/app/theme/component-tokens.json +366 -402
- package/app/theme/component-tokens.ts +807 -815
- package/app/types/overlay-loading.types.ts +26 -26
- package/app/utils/ads-filter-select.ts +191 -172
- package/app/utils/ads-table.ts +395 -204
- package/app/utils/calendar-date.ts +163 -163
- package/app/utils/category-role.ts +45 -45
- package/app/utils/money.ts +77 -77
- package/app/utils/notability.ts +8 -8
- package/app/utils/parser.ts +134 -134
- package/app/utils/percentage.ts +54 -54
- package/nuxt.config.ts +31 -31
- package/package.json +1 -1
- package/app/components/AdsFarmarcasPill.vue +0 -74
- package/app/components/AdsFilterDropdown.vue +0 -174
- package/app/components/AdsFilterOption.vue +0 -74
- package/app/components/AdsListDropdown.vue +0 -44
- package/app/components/AdsMiniPill.vue +0 -40
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AdsDropdownMenu — menu de ações (UDropdownMenu com o tema ADS).
|
|
3
|
+
Para escolher valores (simples, múltipla, busca, subtítulo, selo), use o AdsSelect.
|
|
4
|
+
-->
|
|
5
|
+
<template>
|
|
6
|
+
<UDropdownMenu :items="items" :content="content" :ui="adsDropdownMenuUi">
|
|
7
|
+
<slot />
|
|
8
|
+
</UDropdownMenu>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import type { DropdownMenuItem } from "@nuxt/ui";
|
|
13
|
+
import { adsDropdownMenuUi } from "../theme/ads-theme";
|
|
14
|
+
|
|
15
|
+
withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
/** Ações do menu. Grupos em arrays aninhados ganham separador. */
|
|
18
|
+
items?: DropdownMenuItem[] | DropdownMenuItem[][];
|
|
19
|
+
content?: {
|
|
20
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
21
|
+
align?: "start" | "center" | "end";
|
|
22
|
+
sideOffset?: number;
|
|
23
|
+
};
|
|
24
|
+
}>(),
|
|
25
|
+
{
|
|
26
|
+
items: () => [],
|
|
27
|
+
content: undefined,
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
</script>
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="flex flex-col items-center text-center"
|
|
4
|
-
:class="small ? 'gap-[var(--ads-empty-gap-sm)]' : 'gap-[var(--ads-empty-gap)]'"
|
|
5
|
-
>
|
|
6
|
-
<svg
|
|
7
|
-
viewBox="0 0 24 24"
|
|
8
|
-
fill="none"
|
|
9
|
-
aria-hidden="true"
|
|
10
|
-
class="text-[var(--ads-empty-icon-color)]"
|
|
11
|
-
:class="small ? 'size-[var(--ads-empty-icon-sm)]' : 'size-[var(--ads-empty-icon)]'"
|
|
12
|
-
>
|
|
13
|
-
<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="1.6" />
|
|
14
|
-
<path d="M9 9l6 6M15 9l-6 6" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
|
15
|
-
</svg>
|
|
16
|
-
<div class="flex max-w-xs flex-col items-center gap-[var(--ads-empty-text-gap)]">
|
|
17
|
-
<p
|
|
18
|
-
class="font-bold leading-[1.3] text-[var(--ads-text-primary)]"
|
|
19
|
-
:class="small ? 'text-[length:var(--ads-empty-title-size-sm)]' : 'text-[length:var(--ads-empty-title-size)]'"
|
|
20
|
-
>
|
|
21
|
-
{{ title }}
|
|
22
|
-
</p>
|
|
23
|
-
<p v-if="subtitle" class="text-[length:var(--ads-empty-subtitle-size)] leading-[1.2] text-[var(--ads-text-secondary)]">
|
|
24
|
-
{{ subtitle }}
|
|
25
|
-
</p>
|
|
26
|
-
</div>
|
|
27
|
-
<div v-if="showActions" class="flex flex-col items-center gap-2">
|
|
28
|
-
<slot>
|
|
29
|
-
<AdsButton :label="primaryLabel" leading trailing />
|
|
30
|
-
<AdsButton type="unfilled" :label="secondaryLabel" leading trailing />
|
|
31
|
-
</slot>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script setup lang="ts">
|
|
37
|
-
import AdsButton from "./AdsButton.vue";
|
|
38
|
-
|
|
39
|
-
withDefaults(
|
|
40
|
-
defineProps<{
|
|
41
|
-
title?: string;
|
|
42
|
-
subtitle?: string;
|
|
43
|
-
/** Figma `Small=Yes`. */
|
|
44
|
-
small?: boolean;
|
|
45
|
-
showActions?: boolean;
|
|
46
|
-
primaryLabel?: string;
|
|
47
|
-
secondaryLabel?: string;
|
|
48
|
-
}>(),
|
|
49
|
-
{
|
|
50
|
-
title: "Título do empty state",
|
|
51
|
-
subtitle: "Coloque aqui um texto explicando e direcionando o usuário. Uso opcional.",
|
|
52
|
-
small: false,
|
|
53
|
-
showActions: true,
|
|
54
|
-
primaryLabel: "Button Test",
|
|
55
|
-
secondaryLabel: "Button Test",
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="flex flex-col items-center text-center"
|
|
4
|
+
:class="small ? 'gap-[var(--ads-empty-gap-sm)]' : 'gap-[var(--ads-empty-gap)]'"
|
|
5
|
+
>
|
|
6
|
+
<svg
|
|
7
|
+
viewBox="0 0 24 24"
|
|
8
|
+
fill="none"
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
class="text-[var(--ads-empty-icon-color)]"
|
|
11
|
+
:class="small ? 'size-[var(--ads-empty-icon-sm)]' : 'size-[var(--ads-empty-icon)]'"
|
|
12
|
+
>
|
|
13
|
+
<circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="1.6" />
|
|
14
|
+
<path d="M9 9l6 6M15 9l-6 6" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
|
|
15
|
+
</svg>
|
|
16
|
+
<div class="flex max-w-xs flex-col items-center gap-[var(--ads-empty-text-gap)]">
|
|
17
|
+
<p
|
|
18
|
+
class="font-bold leading-[1.3] text-[var(--ads-text-primary)]"
|
|
19
|
+
:class="small ? 'text-[length:var(--ads-empty-title-size-sm)]' : 'text-[length:var(--ads-empty-title-size)]'"
|
|
20
|
+
>
|
|
21
|
+
{{ title }}
|
|
22
|
+
</p>
|
|
23
|
+
<p v-if="subtitle" class="text-[length:var(--ads-empty-subtitle-size)] leading-[1.2] text-[var(--ads-text-secondary)]">
|
|
24
|
+
{{ subtitle }}
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
<div v-if="showActions" class="flex flex-col items-center gap-2">
|
|
28
|
+
<slot>
|
|
29
|
+
<AdsButton :label="primaryLabel" leading trailing />
|
|
30
|
+
<AdsButton type="unfilled" :label="secondaryLabel" leading trailing />
|
|
31
|
+
</slot>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import AdsButton from "./AdsButton.vue";
|
|
38
|
+
|
|
39
|
+
withDefaults(
|
|
40
|
+
defineProps<{
|
|
41
|
+
title?: string;
|
|
42
|
+
subtitle?: string;
|
|
43
|
+
/** Figma `Small=Yes`. */
|
|
44
|
+
small?: boolean;
|
|
45
|
+
showActions?: boolean;
|
|
46
|
+
primaryLabel?: string;
|
|
47
|
+
secondaryLabel?: string;
|
|
48
|
+
}>(),
|
|
49
|
+
{
|
|
50
|
+
title: "Título do empty state",
|
|
51
|
+
subtitle: "Coloque aqui um texto explicando e direcionando o usuário. Uso opcional.",
|
|
52
|
+
small: false,
|
|
53
|
+
showActions: true,
|
|
54
|
+
primaryLabel: "Button Test",
|
|
55
|
+
secondaryLabel: "Button Test",
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
</script>
|
|
@@ -1,219 +1,210 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const onClick = (event: MouseEvent) => {
|
|
213
|
-
if (!props.disabled) {
|
|
214
|
-
emit("click", event);
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
event.preventDefault();
|
|
218
|
-
};
|
|
219
|
-
</script>
|
|
1
|
+
<!--
|
|
2
|
+
AdsFeatureCard — atalho de módulo sobre o AdsCard. A casca (borda, raio, fundo, hover, foco)
|
|
3
|
+
é a do AdsCard; aqui só muda o conteúdo: ícone, título, descrição, seta e rodapé.
|
|
4
|
+
-->
|
|
5
|
+
<template>
|
|
6
|
+
<AdsCard
|
|
7
|
+
:as="to ? NuxtLink : 'button'"
|
|
8
|
+
v-bind="rootAttrs"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:hoverable="hoverable"
|
|
11
|
+
class="group w-[var(--ads-feature-width)] max-w-full"
|
|
12
|
+
:style="cardStyle"
|
|
13
|
+
@click="onClick"
|
|
14
|
+
>
|
|
15
|
+
<span class="flex h-full w-full flex-col gap-[var(--ads-feature-gap)]">
|
|
16
|
+
<span class="flex items-start gap-3">
|
|
17
|
+
<span
|
|
18
|
+
class="grid size-[var(--ads-feature-icon-box)] shrink-0 place-items-center rounded-[var(--ads-radius-sm)]"
|
|
19
|
+
:class="iconBoxClass"
|
|
20
|
+
>
|
|
21
|
+
<UIcon :name="icon" class="size-6" />
|
|
22
|
+
</span>
|
|
23
|
+
<span class="min-w-0 flex-1">
|
|
24
|
+
<span class="block text-[length:var(--ads-feature-title-size)] font-bold leading-[1.3]" :class="titleClass">
|
|
25
|
+
{{ title }}
|
|
26
|
+
</span>
|
|
27
|
+
<AdsTooltip
|
|
28
|
+
:description="description"
|
|
29
|
+
:show-title="false"
|
|
30
|
+
:disabled="!isDescriptionTruncated"
|
|
31
|
+
align="start"
|
|
32
|
+
>
|
|
33
|
+
<span
|
|
34
|
+
ref="descriptionEl"
|
|
35
|
+
class="mt-1 block line-clamp-2 text-[length:var(--ads-feature-body-size)] leading-relaxed"
|
|
36
|
+
:class="descriptionClass"
|
|
37
|
+
>
|
|
38
|
+
{{ description }}
|
|
39
|
+
</span>
|
|
40
|
+
</AdsTooltip>
|
|
41
|
+
</span>
|
|
42
|
+
<UIcon
|
|
43
|
+
v-if="!disabled"
|
|
44
|
+
name="i-lucide-arrow-right"
|
|
45
|
+
class="size-5 shrink-0 text-[var(--ads-border-icon-support)] transition-colors duration-150 ease-out"
|
|
46
|
+
:class="{ 'group-hover:text-[var(--ads-text-secondary)] group-focus-visible:text-[var(--ads-text-secondary)]': hoverable }"
|
|
47
|
+
/>
|
|
48
|
+
</span>
|
|
49
|
+
|
|
50
|
+
<AdsPill
|
|
51
|
+
v-if="disabled"
|
|
52
|
+
class="mt-auto self-start"
|
|
53
|
+
tone="secondary"
|
|
54
|
+
status="blocked"
|
|
55
|
+
label="Em breve"
|
|
56
|
+
/>
|
|
57
|
+
<span v-else-if="hasFooter" class="mt-auto flex flex-wrap items-center gap-2">
|
|
58
|
+
<AdsPill
|
|
59
|
+
v-for="badge in badges"
|
|
60
|
+
:key="badge.label"
|
|
61
|
+
:tone="badge.tone ?? 'secondary'"
|
|
62
|
+
:status="badge.status ?? 'default'"
|
|
63
|
+
:label="badge.label"
|
|
64
|
+
/>
|
|
65
|
+
<span
|
|
66
|
+
v-if="footerText"
|
|
67
|
+
class="inline-flex items-center gap-1 text-xs text-[var(--ads-text-secondary)]"
|
|
68
|
+
>
|
|
69
|
+
<UIcon v-if="footerIcon" :name="footerIcon" class="size-3.5" />
|
|
70
|
+
{{ footerText }}
|
|
71
|
+
</span>
|
|
72
|
+
</span>
|
|
73
|
+
</span>
|
|
74
|
+
</AdsCard>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script setup lang="ts">
|
|
78
|
+
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
|
79
|
+
import type { RouteLocationRaw } from "vue-router";
|
|
80
|
+
import { useResizeObserver } from "@vueuse/core";
|
|
81
|
+
import { NuxtLink } from "#components";
|
|
82
|
+
import AdsCard from "./AdsCard.vue";
|
|
83
|
+
import AdsPill from "./AdsPill.vue";
|
|
84
|
+
import type { AdsPillStatus, AdsPillTone } from "./AdsPill.vue";
|
|
85
|
+
import AdsTooltip from "./AdsTooltip.vue";
|
|
86
|
+
|
|
87
|
+
export interface AdsFeatureCardBadge {
|
|
88
|
+
label: string;
|
|
89
|
+
tone?: AdsPillTone;
|
|
90
|
+
status?: AdsPillStatus;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Fundo e texto do AdsPill secondary. Primary segue o ícone do próprio card no catálogo. */
|
|
94
|
+
export type AdsFeatureCardColor =
|
|
95
|
+
| "primary"
|
|
96
|
+
| "success"
|
|
97
|
+
| "attention"
|
|
98
|
+
| "warning"
|
|
99
|
+
| "new"
|
|
100
|
+
| "blocked"
|
|
101
|
+
| "ai";
|
|
102
|
+
|
|
103
|
+
const iconBoxByColor: Record<AdsFeatureCardColor, string> = {
|
|
104
|
+
primary: "bg-[var(--ads-button-secondary)] text-[var(--ads-text-brand)]",
|
|
105
|
+
success: "bg-[var(--ads-status-success-100)] text-[var(--ads-status-success-800)]",
|
|
106
|
+
attention: "bg-[var(--ads-status-attention-100)] text-[var(--ads-status-attention-800)]",
|
|
107
|
+
warning: "bg-[var(--ads-status-warning-100)] text-[var(--ads-status-warning-800)]",
|
|
108
|
+
new: "bg-[var(--ads-status-new-100)] text-[var(--ads-status-new-800)]",
|
|
109
|
+
blocked: "bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]",
|
|
110
|
+
ai: "bg-[var(--ads-surface-ai)] text-[var(--ads-text-ai)]",
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const props = withDefaults(
|
|
115
|
+
defineProps<{
|
|
116
|
+
title: string;
|
|
117
|
+
description: string;
|
|
118
|
+
icon: string;
|
|
119
|
+
/** Cor da caixa do ícone. O hover é o padrão dos cards, igual para todas as cores. */
|
|
120
|
+
color?: AdsFeatureCardColor;
|
|
121
|
+
/** Vira link. Sem valor, continua botão. */
|
|
122
|
+
to?: RouteLocationRaw;
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
/** Hover padrão dos cards (borda e sombra neutras; a seta escurece). false desliga. */
|
|
125
|
+
hoverable?: boolean;
|
|
126
|
+
badges?: AdsFeatureCardBadge[];
|
|
127
|
+
footerIcon?: string;
|
|
128
|
+
footerText?: string;
|
|
129
|
+
}>(),
|
|
130
|
+
{
|
|
131
|
+
color: "primary",
|
|
132
|
+
to: undefined,
|
|
133
|
+
disabled: false,
|
|
134
|
+
hoverable: true,
|
|
135
|
+
badges: undefined,
|
|
136
|
+
footerIcon: undefined,
|
|
137
|
+
footerText: undefined,
|
|
138
|
+
},
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const emit = defineEmits<{
|
|
142
|
+
click: [event: MouseEvent];
|
|
143
|
+
}>();
|
|
144
|
+
|
|
145
|
+
const hasFooter = computed(
|
|
146
|
+
() => (props.badges?.length ?? 0) > 0 || Boolean(props.footerText),
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const descriptionEl = ref<HTMLElement | null>(null);
|
|
150
|
+
const isDescriptionTruncated = ref(false);
|
|
151
|
+
|
|
152
|
+
const syncDescriptionTruncation = () => {
|
|
153
|
+
const element = descriptionEl.value;
|
|
154
|
+
if (!element) {
|
|
155
|
+
isDescriptionTruncated.value = false;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
isDescriptionTruncated.value = element.scrollHeight - element.clientHeight > 1;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
useResizeObserver(descriptionEl, syncDescriptionTruncation);
|
|
162
|
+
|
|
163
|
+
onMounted(() => {
|
|
164
|
+
void nextTick(syncDescriptionTruncation);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
watch(
|
|
168
|
+
() => props.description,
|
|
169
|
+
() => {
|
|
170
|
+
void nextTick(syncDescriptionTruncation);
|
|
171
|
+
},
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
/** O link não tem disabled nativo: sai da ordem do Tab e avisa por aria-disabled. */
|
|
175
|
+
const rootAttrs = computed(() =>
|
|
176
|
+
props.to
|
|
177
|
+
? { to: props.to, tabindex: props.disabled ? -1 : undefined, "aria-disabled": props.disabled || undefined }
|
|
178
|
+
: {},
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* A casca e o hover são os do AdsCard. Aqui só entra o desabilitado sem opacidade,
|
|
183
|
+
* porque o conteúdo já troca para as cores terciárias.
|
|
184
|
+
*/
|
|
185
|
+
const cardStyle = computed(() => ({
|
|
186
|
+
"--ads-card-disabled-opacity": "1",
|
|
187
|
+
}));
|
|
188
|
+
|
|
189
|
+
const iconBoxClass = computed(() =>
|
|
190
|
+
props.disabled
|
|
191
|
+
? "bg-[var(--ads-button-secondary-disabled)] text-[var(--ads-text-tertiary)]"
|
|
192
|
+
: iconBoxByColor[props.color],
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const titleClass = computed(() =>
|
|
196
|
+
props.disabled ? "text-[var(--ads-text-tertiary)]" : "text-[var(--ads-feature-title)]",
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
const descriptionClass = computed(() =>
|
|
200
|
+
props.disabled ? "text-[var(--ads-text-tertiary)]" : "text-[var(--ads-feature-body)]",
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const onClick = (event: MouseEvent) => {
|
|
204
|
+
if (!props.disabled) {
|
|
205
|
+
emit("click", event);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
};
|
|
210
|
+
</script>
|