ads-nuxt 0.6.0 → 0.6.1
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.
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
--ads-notability-height: 24px;
|
|
229
229
|
--ads-notability-min-width: 100px;
|
|
230
230
|
--ads-notability-padding-x: 8px;
|
|
231
|
-
--ads-notability-font-size:
|
|
231
|
+
--ads-notability-font-size: 14px;
|
|
232
232
|
--ads-notability-weight: 700;
|
|
233
233
|
--ads-mini-height: 18px;
|
|
234
234
|
--ads-mini-padding-x: 8px;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
:type="as === 'button' ? 'button' : undefined"
|
|
5
5
|
:disabled="as === 'button' ? disabled : undefined"
|
|
6
6
|
:aria-busy="loading || undefined"
|
|
7
|
-
class="ads-card flex h-full min-w-0 flex-col items-start
|
|
8
|
-
:class="[radiusClass, surfaceClass]"
|
|
7
|
+
class="ads-card flex h-full min-w-0 flex-col items-start p-[var(--ads-card-padding)] text-left transition-[background-color,border-color,box-shadow]"
|
|
8
|
+
:class="[gapClass, radiusClass, surfaceClass]"
|
|
9
9
|
:style="paddingStyle"
|
|
10
10
|
>
|
|
11
11
|
<!-- Cabeçalho -->
|
|
@@ -79,7 +79,7 @@ import AdsCardPeriod from "./AdsCardPeriod.vue";
|
|
|
79
79
|
import AdsEmptyState from "./AdsEmptyState.vue";
|
|
80
80
|
import AdsLoading from "./AdsLoading.vue";
|
|
81
81
|
|
|
82
|
-
export type AdsCardType = "container" | "details";
|
|
82
|
+
export type AdsCardType = "container" | "details" | "informative";
|
|
83
83
|
/** box: cartão com borda e raio. line: só a divisória de baixo, para uma linha de lista. */
|
|
84
84
|
export type AdsCardVariant = "box" | "line";
|
|
85
85
|
/** default: 16px (padrão). compact: 8px. relaxed: 24px (estratégia, histórico, notabilidade). */
|
|
@@ -104,6 +104,8 @@ const props = withDefaults(
|
|
|
104
104
|
/**
|
|
105
105
|
* container: título, período e conteúdo livre no slot padrão.
|
|
106
106
|
* details: título maior e lista de informações (rows).
|
|
107
|
+
* informative: chamada azul de notabilidade, com título curto em maiúsculas e texto de apoio.
|
|
108
|
+
* Ignora selected, variant e padding.
|
|
107
109
|
*/
|
|
108
110
|
type?: AdsCardType;
|
|
109
111
|
/** O slot header substitui. */
|
|
@@ -171,23 +173,35 @@ const containerTitleClass = "text-[length:var(--ads-font-size-xs)] font-bold lea
|
|
|
171
173
|
const detailsTitleClass = "text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
|
|
172
174
|
const selectedTitleClass = "text-[length:var(--ads-font-size-xxs)] font-bold leading-[1.3] text-[var(--ads-text-primary)]";
|
|
173
175
|
|
|
176
|
+
const informativeTitleClass =
|
|
177
|
+
"w-full text-[length:var(--ads-font-size-xxxs)] font-bold uppercase leading-[var(--ads-line-height-sm)] text-[var(--ads-text-secondary)]";
|
|
178
|
+
|
|
179
|
+
const isInformative = computed(() => props.type === "informative");
|
|
180
|
+
|
|
174
181
|
const titleClass = computed(() => {
|
|
182
|
+
if (isInformative.value) return informativeTitleClass;
|
|
175
183
|
if (props.selected) return selectedTitleClass;
|
|
176
184
|
return props.type === "details" ? detailsTitleClass : containerTitleClass;
|
|
177
185
|
});
|
|
178
186
|
|
|
179
|
-
const descriptionClass = computed(() =>
|
|
180
|
-
|
|
187
|
+
const descriptionClass = computed(() => {
|
|
188
|
+
if (isInformative.value) {
|
|
189
|
+
return "w-full text-[length:var(--ads-font-size-xxs)] font-normal leading-[1.3] text-[var(--ads-text-secondary)]";
|
|
190
|
+
}
|
|
191
|
+
return props.selected
|
|
181
192
|
? "text-[length:var(--ads-font-size-xxs)] font-normal leading-[1.3] text-[var(--ads-text-secondary)]"
|
|
182
|
-
: "text-[length:var(--ads-card-body-size)] leading-[1.4] text-[var(--ads-card-body)]"
|
|
183
|
-
);
|
|
193
|
+
: "text-[length:var(--ads-card-body-size)] leading-[1.4] text-[var(--ads-card-body)]";
|
|
194
|
+
});
|
|
184
195
|
|
|
185
196
|
/** O valor local vence o token global, e a tabela dentro do card usa o mesmo respiro. */
|
|
186
197
|
const paddingStyle = computed(() => ({
|
|
187
|
-
"--ads-card-padding": CARD_PADDING[props.padding],
|
|
198
|
+
"--ads-card-padding": isInformative.value ? "var(--ads-space-xxxs)" : CARD_PADDING[props.padding],
|
|
188
199
|
"--ads-card-bleed": "var(--ads-card-padding)",
|
|
189
200
|
}));
|
|
190
201
|
|
|
202
|
+
/** 6px do Figma não existe na escala. O passo mais próximo é o quark (4px). */
|
|
203
|
+
const gapClass = computed(() => (isInformative.value ? "gap-[var(--ads-space-quark)]" : "gap-3"));
|
|
204
|
+
|
|
191
205
|
/** Larguras do skeleton do Figma; uma barra por linha. */
|
|
192
206
|
const SKELETON_WIDTHS = [200, 240, 160, 180, 260];
|
|
193
207
|
const detailSkeletonWidths = computed(() => {
|
|
@@ -198,6 +212,7 @@ const detailSkeletonWidths = computed(() => {
|
|
|
198
212
|
const showHeader = computed(() => Boolean(props.title || props.hint || slots.header || slots.actions));
|
|
199
213
|
|
|
200
214
|
const radiusClass = computed(() => {
|
|
215
|
+
if (isInformative.value) return "rounded-[var(--ads-radius-sm)]";
|
|
201
216
|
if (props.variant === "line") return "rounded-none";
|
|
202
217
|
return props.radius === "sm" ? "rounded-[var(--ads-card-radius-sm)]" : "rounded-[var(--ads-card-radius)]";
|
|
203
218
|
});
|
|
@@ -205,13 +220,15 @@ const radiusClass = computed(() => {
|
|
|
205
220
|
const surfaceClass = computed(() => {
|
|
206
221
|
const line = props.variant === "line";
|
|
207
222
|
const classes = [
|
|
208
|
-
|
|
209
|
-
?
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
:
|
|
223
|
+
isInformative.value
|
|
224
|
+
? "border border-[var(--color-ads-radar-200)] bg-[var(--color-ads-radar-25)]"
|
|
225
|
+
: props.selected
|
|
226
|
+
? line
|
|
227
|
+
? "[border-width:0_0_1px] border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)]"
|
|
228
|
+
: "border border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
|
|
229
|
+
: line
|
|
230
|
+
? "[border-width:0_0_1px] border-[var(--ads-card-border)] bg-[var(--ads-card-background)]"
|
|
231
|
+
: "border border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
|
|
215
232
|
];
|
|
216
233
|
|
|
217
234
|
if (props.as !== "div") {
|
|
@@ -219,7 +236,7 @@ const surfaceClass = computed(() => {
|
|
|
219
236
|
"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",
|
|
220
237
|
);
|
|
221
238
|
// Hover padrão dos cards clicáveis. Na linha, só a divisória escurece: sombra viraria caixa.
|
|
222
|
-
if (props.hoverable && !props.selected && !props.disabled) {
|
|
239
|
+
if (props.hoverable && !props.selected && !isInformative.value && !props.disabled) {
|
|
223
240
|
classes.push(line ? "hover:border-[var(--ads-card-hover-border)]" : "hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
|
|
224
241
|
}
|
|
225
242
|
}
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<span
|
|
3
|
+
class="inline-flex min-h-[var(--ads-notability-height)] shrink-0 items-center justify-center overflow-hidden rounded-[var(--ads-radius-pill)] px-[var(--ads-notability-padding-x)] py-[var(--ads-space-quark)] text-center text-[length:var(--ads-notability-font-size)] leading-[1.3] whitespace-nowrap [font-weight:var(--ads-notability-weight)]"
|
|
4
|
+
:class="surface"
|
|
5
|
+
>
|
|
6
|
+
{{ resolvedLabel }}
|
|
7
|
+
</span>
|
|
3
8
|
</template>
|
|
4
9
|
|
|
5
10
|
<script setup lang="ts">
|
|
6
11
|
import { computed } from "vue";
|
|
7
12
|
import { formatNotability } from "../utils/notability";
|
|
8
|
-
import AdsPill from "./AdsPill.vue";
|
|
9
13
|
|
|
10
14
|
const props = defineProps<{
|
|
11
15
|
notability: string;
|
|
12
16
|
label?: string;
|
|
13
17
|
}>();
|
|
14
18
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* image: status/new 100 + 800.
|
|
21
|
+
* traffic: charts/data 4/100 a 80% + charts/data 4/800.
|
|
22
|
+
* profit: innovation/100 a 70% + charts/data 2/800.
|
|
23
|
+
*/
|
|
24
|
+
const surfaces: Record<string, string> = {
|
|
25
|
+
image: "bg-[var(--ads-status-new-100)] text-[var(--ads-status-new-800)]",
|
|
26
|
+
traffic: "bg-[color-mix(in_srgb,var(--ads-chart-data-4-100)_80%,transparent)] text-[var(--ads-chart-data-4-800)]",
|
|
27
|
+
profit: "bg-[color-mix(in_srgb,var(--ads-status-innovation-100)_70%,transparent)] text-[var(--ads-chart-data-2-800)]",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const surface = computed(() => surfaces[props.notability] ?? surfaces.image);
|
|
22
31
|
|
|
23
32
|
const resolvedLabel = computed(() => props.label ?? formatNotability(props.notability));
|
|
24
33
|
</script>
|
|
@@ -63,8 +63,7 @@ const props = withDefaults(
|
|
|
63
63
|
trailingIcon?: string;
|
|
64
64
|
/**
|
|
65
65
|
* Override avançado de fundo e texto (classes Tailwind).
|
|
66
|
-
*
|
|
67
|
-
* Em produção, prefira esses atalhos em vez desta prop.
|
|
66
|
+
* Em produção, prefira os atalhos de domínio em vez desta prop.
|
|
68
67
|
*/
|
|
69
68
|
customSurface?: string;
|
|
70
69
|
}>(),
|
|
@@ -408,12 +408,12 @@ export const componentTokenCatalog: readonly TokenComponent[] = [
|
|
|
408
408
|
section: "notabilidade",
|
|
409
409
|
catalog: "notability-pill",
|
|
410
410
|
label: "Pill de notabilidade",
|
|
411
|
-
note: "
|
|
411
|
+
note: "Texto 14 bold e padding vertical quark. Imagem usa status/new. Tráfego usa chart data 4/100 a 80%. Lucro usa innovation/100 a 70%.",
|
|
412
412
|
fields: [
|
|
413
|
-
length("--ads-notability-height", "Altura", "Medida", "24px"),
|
|
413
|
+
length("--ads-notability-height", "Altura mínima", "Medida", "24px"),
|
|
414
414
|
length("--ads-notability-min-width", "Largura mínima", "Medida", "100px"),
|
|
415
415
|
length("--ads-notability-padding-x", "Padding horizontal", "Medida", "8px"),
|
|
416
|
-
length("--ads-notability-font-size", "Fonte", "Medida", "
|
|
416
|
+
length("--ads-notability-font-size", "Fonte", "Medida", "14px"),
|
|
417
417
|
weight("--ads-notability-weight", "Peso", "Medida", "700"),
|
|
418
418
|
],
|
|
419
419
|
},
|
package/app/utils/notability.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const NOTABILITY_LABELS: Record<string, string> = {
|
|
2
|
-
traffic: "
|
|
3
|
-
image: "
|
|
4
|
-
profit: "
|
|
2
|
+
traffic: "Geradores de Tráfego",
|
|
3
|
+
image: "Formadores de Imagem",
|
|
4
|
+
profit: "Geradores de Lucro",
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export const formatNotability = (notability: string): string =>
|