ads-nuxt 0.1.4 → 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 -479
- 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 -143
- 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 -166
- 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 -113
- package/app/components/AdsSegmentedTabs.vue +62 -28
- package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -203
- 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 -109
- 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,91 +1,91 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav class="inline-flex items-center gap-[var(--ads-pagination-gap)] py-1" :aria-label="ariaLabel">
|
|
3
|
-
<button
|
|
4
|
-
type="button"
|
|
5
|
-
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
6
|
-
:disabled="page <= 1"
|
|
7
|
-
@click="go(page - 1)"
|
|
8
|
-
>
|
|
9
|
-
{{ prevLabel }}
|
|
10
|
-
</button>
|
|
11
|
-
<div class="flex items-center gap-[var(--ads-pagination-number-gap)]">
|
|
12
|
-
<template v-for="item in items" :key="item.key">
|
|
13
|
-
<span v-if="item.kind === 'gap'" class="px-1 text-sm text-ads-neutro-escuro-600" aria-hidden="true">…</span>
|
|
14
|
-
<button
|
|
15
|
-
v-else
|
|
16
|
-
type="button"
|
|
17
|
-
class="flex size-[var(--ads-pagination-cell)] items-center justify-center rounded-[var(--ads-radius-xsm)] text-sm leading-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
18
|
-
:class="item.page === page ? 'bg-[var(--ads-pagination-selected)] text-[var(--ads-text-contrast)]' : 'text-[var(--ads-pagination-number)] hover:bg-ads-neutro-claro-20'"
|
|
19
|
-
:aria-current="item.page === page ? 'page' : undefined"
|
|
20
|
-
@click="go(item.page)"
|
|
21
|
-
>
|
|
22
|
-
{{ item.page }}
|
|
23
|
-
</button>
|
|
24
|
-
</template>
|
|
25
|
-
</div>
|
|
26
|
-
<button
|
|
27
|
-
type="button"
|
|
28
|
-
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
29
|
-
:disabled="page >= totalPages"
|
|
30
|
-
@click="go(page + 1)"
|
|
31
|
-
>
|
|
32
|
-
{{ nextLabel }}
|
|
33
|
-
</button>
|
|
34
|
-
</nav>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script setup lang="ts">
|
|
38
|
-
import { computed } from "vue";
|
|
39
|
-
|
|
40
|
-
const props = withDefaults(
|
|
41
|
-
defineProps<{
|
|
42
|
-
page?: number;
|
|
43
|
-
totalPages?: number;
|
|
44
|
-
prevLabel?: string;
|
|
45
|
-
nextLabel?: string;
|
|
46
|
-
ariaLabel?: string;
|
|
47
|
-
}>(),
|
|
48
|
-
{
|
|
49
|
-
page: 1,
|
|
50
|
-
totalPages: 1,
|
|
51
|
-
prevLabel: "Anterior",
|
|
52
|
-
nextLabel: "Próximo",
|
|
53
|
-
ariaLabel: "Paginação",
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const emit = defineEmits<{
|
|
58
|
-
"update:page": [page: number];
|
|
59
|
-
}>();
|
|
60
|
-
|
|
61
|
-
type PageItem = { kind: "page"; page: number; key: string } | { kind: "gap"; key: string };
|
|
62
|
-
|
|
63
|
-
const items = computed<PageItem[]>(() => {
|
|
64
|
-
const total = Math.max(1, props.totalPages);
|
|
65
|
-
const current = Math.min(Math.max(1, props.page), total);
|
|
66
|
-
if (total <= 7) {
|
|
67
|
-
return Array.from({ length: total }, (_, index) => ({
|
|
68
|
-
kind: "page" as const,
|
|
69
|
-
page: index + 1,
|
|
70
|
-
key: `p${index + 1}`,
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
const pages = new Set([1, total, current - 1, current, current + 1]);
|
|
74
|
-
const sorted = [...pages].filter((value) => value >= 1 && value <= total).sort((a, b) => a - b);
|
|
75
|
-
const result: PageItem[] = [];
|
|
76
|
-
sorted.forEach((value, index) => {
|
|
77
|
-
const previous = sorted[index - 1];
|
|
78
|
-
if (previous !== undefined && value - previous > 1) {
|
|
79
|
-
result.push({ kind: "gap", key: `g${previous}` });
|
|
80
|
-
}
|
|
81
|
-
result.push({ kind: "page", page: value, key: `p${value}` });
|
|
82
|
-
});
|
|
83
|
-
return result;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const go = (next: number) => {
|
|
87
|
-
const total = Math.max(1, props.totalPages);
|
|
88
|
-
const value = Math.min(Math.max(1, next), total);
|
|
89
|
-
if (value !== props.page) emit("update:page", value);
|
|
90
|
-
};
|
|
91
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<nav class="inline-flex items-center gap-[var(--ads-pagination-gap)] py-1" :aria-label="ariaLabel">
|
|
3
|
+
<button
|
|
4
|
+
type="button"
|
|
5
|
+
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
6
|
+
:disabled="page <= 1"
|
|
7
|
+
@click="go(page - 1)"
|
|
8
|
+
>
|
|
9
|
+
{{ prevLabel }}
|
|
10
|
+
</button>
|
|
11
|
+
<div class="flex items-center gap-[var(--ads-pagination-number-gap)]">
|
|
12
|
+
<template v-for="item in items" :key="item.key">
|
|
13
|
+
<span v-if="item.kind === 'gap'" class="px-1 text-sm text-ads-neutro-escuro-600" aria-hidden="true">…</span>
|
|
14
|
+
<button
|
|
15
|
+
v-else
|
|
16
|
+
type="button"
|
|
17
|
+
class="flex size-[var(--ads-pagination-cell)] items-center justify-center rounded-[var(--ads-radius-xsm)] text-sm leading-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
18
|
+
:class="item.page === page ? 'bg-[var(--ads-pagination-selected)] text-[var(--ads-text-contrast)]' : 'text-[var(--ads-pagination-number)] hover:bg-ads-neutro-claro-20'"
|
|
19
|
+
:aria-current="item.page === page ? 'page' : undefined"
|
|
20
|
+
@click="go(item.page)"
|
|
21
|
+
>
|
|
22
|
+
{{ item.page }}
|
|
23
|
+
</button>
|
|
24
|
+
</template>
|
|
25
|
+
</div>
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
29
|
+
:disabled="page >= totalPages"
|
|
30
|
+
@click="go(page + 1)"
|
|
31
|
+
>
|
|
32
|
+
{{ nextLabel }}
|
|
33
|
+
</button>
|
|
34
|
+
</nav>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { computed } from "vue";
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(
|
|
41
|
+
defineProps<{
|
|
42
|
+
page?: number;
|
|
43
|
+
totalPages?: number;
|
|
44
|
+
prevLabel?: string;
|
|
45
|
+
nextLabel?: string;
|
|
46
|
+
ariaLabel?: string;
|
|
47
|
+
}>(),
|
|
48
|
+
{
|
|
49
|
+
page: 1,
|
|
50
|
+
totalPages: 1,
|
|
51
|
+
prevLabel: "Anterior",
|
|
52
|
+
nextLabel: "Próximo",
|
|
53
|
+
ariaLabel: "Paginação",
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const emit = defineEmits<{
|
|
58
|
+
"update:page": [page: number];
|
|
59
|
+
}>();
|
|
60
|
+
|
|
61
|
+
type PageItem = { kind: "page"; page: number; key: string } | { kind: "gap"; key: string };
|
|
62
|
+
|
|
63
|
+
const items = computed<PageItem[]>(() => {
|
|
64
|
+
const total = Math.max(1, props.totalPages);
|
|
65
|
+
const current = Math.min(Math.max(1, props.page), total);
|
|
66
|
+
if (total <= 7) {
|
|
67
|
+
return Array.from({ length: total }, (_, index) => ({
|
|
68
|
+
kind: "page" as const,
|
|
69
|
+
page: index + 1,
|
|
70
|
+
key: `p${index + 1}`,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
const pages = new Set([1, total, current - 1, current, current + 1]);
|
|
74
|
+
const sorted = [...pages].filter((value) => value >= 1 && value <= total).sort((a, b) => a - b);
|
|
75
|
+
const result: PageItem[] = [];
|
|
76
|
+
sorted.forEach((value, index) => {
|
|
77
|
+
const previous = sorted[index - 1];
|
|
78
|
+
if (previous !== undefined && value - previous > 1) {
|
|
79
|
+
result.push({ kind: "gap", key: `g${previous}` });
|
|
80
|
+
}
|
|
81
|
+
result.push({ kind: "page", page: value, key: `p${value}` });
|
|
82
|
+
});
|
|
83
|
+
return result;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const go = (next: number) => {
|
|
87
|
+
const total = Math.max(1, props.totalPages);
|
|
88
|
+
const value = Math.min(Math.max(1, next), total);
|
|
89
|
+
if (value !== props.page) emit("update:page", value);
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section
|
|
3
|
+
class="flex flex-col gap-4 border border-[var(--ads-card-border)] bg-[var(--ads-card-background)] p-6"
|
|
4
|
+
:class="[radiusClass, loading ? 'relative overflow-hidden' : '']"
|
|
5
|
+
:aria-busy="loading || undefined"
|
|
6
|
+
>
|
|
7
|
+
<!-- Overlay de carregamento (shimmer sobre o conteúdo existente). Só no código. -->
|
|
8
|
+
<AdsLoading v-if="loading" variant="shimmer" overlay />
|
|
9
|
+
|
|
10
|
+
<div v-if="showHeader" class="flex w-full items-start gap-4">
|
|
11
|
+
<div class="flex min-w-0 flex-1 flex-col items-start gap-1">
|
|
12
|
+
<slot name="header">
|
|
13
|
+
<div v-if="title || hint" class="flex min-w-0 max-w-full items-center gap-2">
|
|
14
|
+
<h3 v-if="title" class="min-w-0 text-[length:var(--ads-font-size-xs)] font-normal leading-[1.3] text-[var(--ads-card-title)]">
|
|
15
|
+
{{ title }}
|
|
16
|
+
</h3>
|
|
17
|
+
<AdsCardHint v-if="hint" :text="hint" />
|
|
18
|
+
</div>
|
|
19
|
+
<p v-if="subtitle" class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">
|
|
20
|
+
{{ subtitle }}
|
|
21
|
+
</p>
|
|
22
|
+
</slot>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div v-if="$slots.actions || viewToggle" class="flex shrink-0 items-center gap-2">
|
|
26
|
+
<slot name="actions" />
|
|
27
|
+
<div v-if="viewToggle" class="flex items-center gap-1" role="group" aria-label="Visualização">
|
|
28
|
+
<button
|
|
29
|
+
v-for="option in VIEW_OPTIONS"
|
|
30
|
+
:key="option.value"
|
|
31
|
+
type="button"
|
|
32
|
+
class="flex size-8 items-center justify-center rounded-[var(--ads-radius-sm)] text-[var(--ads-text-primary)] transition-colors hover:bg-ads-neutro-claro-20 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
|
|
33
|
+
:class="{ 'bg-ads-neutro-claro-20': view === option.value }"
|
|
34
|
+
:aria-label="option.label"
|
|
35
|
+
:aria-pressed="view === option.value"
|
|
36
|
+
@click="view = option.value"
|
|
37
|
+
>
|
|
38
|
+
<UIcon :name="option.icon" class="size-4" aria-hidden="true" />
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- Corpo: gráfico ou tabela via slot padrão -->
|
|
45
|
+
<div class="min-h-0 w-full flex-1">
|
|
46
|
+
<slot />
|
|
47
|
+
</div>
|
|
48
|
+
</section>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script setup lang="ts">
|
|
52
|
+
import { computed, useSlots } from "vue";
|
|
53
|
+
import AdsCardHint from "./AdsCardHint.vue";
|
|
54
|
+
import AdsLoading from "./AdsLoading.vue";
|
|
55
|
+
|
|
56
|
+
export type AdsPanelCardView = "chart" | "table";
|
|
57
|
+
|
|
58
|
+
const props = withDefaults(
|
|
59
|
+
defineProps<{
|
|
60
|
+
/** O slot header substitui título e subtítulo. */
|
|
61
|
+
title?: string;
|
|
62
|
+
/** Texto do ícone de informação ao lado do título. */
|
|
63
|
+
hint?: string;
|
|
64
|
+
subtitle?: string;
|
|
65
|
+
/** Mostra os botões Gráfico e Tabela. Use com v-model:view. */
|
|
66
|
+
viewToggle?: boolean;
|
|
67
|
+
/** Estado Carregando: shimmer sobre o painel. Só no código: o Figma não tem. */
|
|
68
|
+
loading?: boolean;
|
|
69
|
+
/** `sm` (8px) é o do Figma; `md` (12px) é só no código. */
|
|
70
|
+
radius?: "sm" | "md";
|
|
71
|
+
}>(),
|
|
72
|
+
{
|
|
73
|
+
title: undefined,
|
|
74
|
+
hint: undefined,
|
|
75
|
+
subtitle: undefined,
|
|
76
|
+
viewToggle: false,
|
|
77
|
+
loading: false,
|
|
78
|
+
radius: "sm",
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
/** Visualização ativa: troque o conteúdo do slot padrão conforme o valor. */
|
|
83
|
+
const view = defineModel<AdsPanelCardView>("view", { default: "chart" });
|
|
84
|
+
|
|
85
|
+
const VIEW_OPTIONS: { value: AdsPanelCardView; label: string; icon: string }[] = [
|
|
86
|
+
{ value: "chart", label: "Ver gráfico", icon: "i-lucide-chart-line" },
|
|
87
|
+
{ value: "table", label: "Ver tabela", icon: "i-lucide-table" },
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
const slots = useSlots();
|
|
91
|
+
|
|
92
|
+
const showHeader = computed(() =>
|
|
93
|
+
Boolean(props.title || props.subtitle || props.hint || props.viewToggle || slots.header || slots.actions),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const radiusClass = computed(() =>
|
|
97
|
+
props.radius === "md" ? "rounded-[var(--ads-card-radius)]" : "rounded-[var(--ads-card-radius-sm)]",
|
|
98
|
+
);
|
|
99
|
+
</script>
|
|
@@ -1,92 +1,144 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span
|
|
3
|
-
class="inline-flex
|
|
4
|
-
:class="surfaceClass"
|
|
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
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="inline-flex shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full text-center leading-[1.2] whitespace-nowrap"
|
|
4
|
+
:class="isBroadcast ? [broadcastSizeClass, broadcastSurface.shell] : [sizeClass, surfaceClass]"
|
|
5
|
+
>
|
|
6
|
+
<!-- Broadcast: ponto na cor do status antes do texto -->
|
|
7
|
+
<span v-if="isBroadcast" class="flex size-3.5 shrink-0 items-center justify-center" aria-hidden="true">
|
|
8
|
+
<span class="size-[var(--ads-broadcast-mark)] rounded-full" :class="broadcastSurface.mark" />
|
|
9
|
+
</span>
|
|
10
|
+
<UIcon
|
|
11
|
+
v-if="icon"
|
|
12
|
+
:name="icon"
|
|
13
|
+
class="shrink-0"
|
|
14
|
+
:class="[iconSizeClass, iconClass]"
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
/>
|
|
17
|
+
{{ resolvedLabel }}
|
|
18
|
+
<UIcon
|
|
19
|
+
v-if="trailingIcon"
|
|
20
|
+
:name="trailingIcon"
|
|
21
|
+
class="shrink-0"
|
|
22
|
+
:class="iconSizeClass"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
/>
|
|
25
|
+
</span>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { computed } from "vue";
|
|
30
|
+
|
|
31
|
+
export type AdsPillStatus = "default" | "success" | "attention" | "warning" | "new" | "blocked";
|
|
32
|
+
export type AdsPillTone = "primary" | "secondary";
|
|
33
|
+
export type AdsPillSize = "md" | "sm";
|
|
34
|
+
/** default: pill sólida ou clara. broadcast: borda, ponto e texto na cor do status (warning ou success). */
|
|
35
|
+
export type AdsPillVariant = "default" | "broadcast";
|
|
36
|
+
|
|
37
|
+
const props = withDefaults(
|
|
38
|
+
defineProps<{
|
|
39
|
+
/**
|
|
40
|
+
* broadcast: a pílula de transmissão (LIVE), com borda e ponto. Só tem as cores
|
|
41
|
+
* warning e success; os outros status usam warning. Ignora tone e size.
|
|
42
|
+
*/
|
|
43
|
+
variant?: AdsPillVariant;
|
|
44
|
+
status?: AdsPillStatus;
|
|
45
|
+
tone?: AdsPillTone;
|
|
46
|
+
/** `md` = Pill normal (24px). `sm` = Small Pill (18px). Default `md`. */
|
|
47
|
+
size?: AdsPillSize;
|
|
48
|
+
label?: string;
|
|
49
|
+
/** Ícone à esquerda (Lucide). */
|
|
50
|
+
icon?: string;
|
|
51
|
+
/** Classes do ícone à esquerda, como o giro do carregamento. */
|
|
52
|
+
iconClass?: string;
|
|
53
|
+
/** Ícone opcional à direita (Lucide). */
|
|
54
|
+
trailingIcon?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Override avançado de fundo e texto (classes Tailwind).
|
|
57
|
+
* Uso interno do atalho de domínio AdsNotabilityPill.
|
|
58
|
+
* Em produção, prefira esses atalhos em vez desta prop.
|
|
59
|
+
*/
|
|
60
|
+
customSurface?: string;
|
|
61
|
+
}>(),
|
|
62
|
+
{
|
|
63
|
+
variant: "default",
|
|
64
|
+
status: "default",
|
|
65
|
+
tone: "primary",
|
|
66
|
+
size: "md",
|
|
67
|
+
label: undefined,
|
|
68
|
+
icon: undefined,
|
|
69
|
+
iconClass: undefined,
|
|
70
|
+
trailingIcon: undefined,
|
|
71
|
+
customSurface: undefined,
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const surfaces: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
|
|
76
|
+
primary: {
|
|
77
|
+
default: "bg-[var(--ads-pill-primary-bg)] text-[var(--ads-pill-primary-text)]",
|
|
78
|
+
success: "bg-[#15c57e] text-white",
|
|
79
|
+
attention: "bg-[#e9a700] text-white",
|
|
80
|
+
warning: "bg-[#dc0034] text-white",
|
|
81
|
+
new: "bg-[#05b4d8] text-white",
|
|
82
|
+
blocked: "bg-[#0e1013] text-white",
|
|
83
|
+
},
|
|
84
|
+
secondary: {
|
|
85
|
+
default: "bg-[#e4f2ff] text-[#00389e]",
|
|
86
|
+
success: "bg-[#c3ffe6] text-[#0e5a3b]",
|
|
87
|
+
attention: "bg-[#ffe7b9] text-[#8f6600]",
|
|
88
|
+
warning: "bg-[#ffbdcd] text-[#840221]",
|
|
89
|
+
new: "bg-[#c4f5ff] text-[#006478]",
|
|
90
|
+
blocked: "bg-[#cfdef3] text-[#0e1013]",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const labels: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
|
|
95
|
+
primary: {
|
|
96
|
+
default: "Primary",
|
|
97
|
+
success: "Success",
|
|
98
|
+
attention: "Attention",
|
|
99
|
+
warning: "Warning",
|
|
100
|
+
new: "New!",
|
|
101
|
+
blocked: "Blocked",
|
|
102
|
+
},
|
|
103
|
+
secondary: {
|
|
104
|
+
default: "Secondary",
|
|
105
|
+
success: "Success",
|
|
106
|
+
attention: "Attention",
|
|
107
|
+
warning: "Warning",
|
|
108
|
+
new: "New!",
|
|
109
|
+
blocked: "Blocked",
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** Classes de tamanho para `size="md"` (padrão) e `size="sm"` (Small Pill). */
|
|
114
|
+
const sizeClass = computed(() =>
|
|
115
|
+
props.size === "sm"
|
|
116
|
+
? "h-[var(--ads-mini-height)] px-[var(--ads-mini-padding-x)] py-1 text-[length:var(--ads-mini-font-size)] [font-weight:var(--ads-mini-weight)]"
|
|
117
|
+
: "h-[var(--ads-pill-height)] px-[var(--ads-pill-padding-x)] py-1 text-[length:var(--ads-pill-font-size)] [font-weight:var(--ads-pill-weight)]",
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const iconSizeClass = computed(() => (props.size === "sm" ? "size-3" : "size-3.5"));
|
|
121
|
+
|
|
122
|
+
const isBroadcast = computed(() => props.variant === "broadcast");
|
|
123
|
+
|
|
124
|
+
const broadcastSurfaces = {
|
|
125
|
+
warning: {
|
|
126
|
+
shell: "border border-[var(--ads-broadcast-warning)] bg-[var(--ads-broadcast-warning-bg)] text-[var(--ads-broadcast-warning)]",
|
|
127
|
+
mark: "bg-[var(--ads-broadcast-warning)]",
|
|
128
|
+
},
|
|
129
|
+
success: {
|
|
130
|
+
shell: "border border-[var(--ads-broadcast-success)] bg-[var(--ads-broadcast-success-bg)] text-[var(--ads-broadcast-success)]",
|
|
131
|
+
mark: "bg-[var(--ads-broadcast-success)]",
|
|
132
|
+
},
|
|
133
|
+
} as const;
|
|
134
|
+
|
|
135
|
+
const broadcastSurface = computed(() => broadcastSurfaces[props.status === "success" ? "success" : "warning"]);
|
|
136
|
+
|
|
137
|
+
const broadcastSizeClass =
|
|
138
|
+
"h-[var(--ads-broadcast-height)] px-[var(--ads-broadcast-padding-x)] py-1 text-[length:var(--ads-broadcast-font-size)] font-bold";
|
|
139
|
+
|
|
140
|
+
const surfaceClass = computed(() => props.customSurface ?? surfaces[props.tone][props.status]);
|
|
141
|
+
const resolvedLabel = computed(
|
|
142
|
+
() => props.label ?? (isBroadcast.value ? "LIVE" : labels[props.tone][props.status]),
|
|
143
|
+
);
|
|
144
|
+
</script>
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<span
|
|
3
|
-
class="inline-flex h-[var(--ads-product-tag-height)] items-center rounded-[var(--ads-radius-xsm)] px-1.5 text-[length:var(--ads-product-tag-font-size)] leading-none font-medium text-[var(--ads-text-contrast)]"
|
|
4
|
-
:class="surface"
|
|
5
|
-
>
|
|
6
|
-
{{ label || product }}
|
|
7
|
-
</span>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import { computed } from "vue";
|
|
12
|
-
|
|
13
|
-
/** Mapeia `_Tags` do Figma. O fundo usa a cor de vertical/produto já publicada. */
|
|
14
|
-
export type AdsProductTagName =
|
|
15
|
-
| "marketing"
|
|
16
|
-
| "promocoes"
|
|
17
|
-
| "vendas"
|
|
18
|
-
| "captador"
|
|
19
|
-
| "estoque"
|
|
20
|
-
| "pricing"
|
|
21
|
-
| "crm"
|
|
22
|
-
| "compras"
|
|
23
|
-
| "gestao"
|
|
24
|
-
| "trade"
|
|
25
|
-
| "capacitacao"
|
|
26
|
-
| "ecommerce"
|
|
27
|
-
| "financas"
|
|
28
|
-
| "performance"
|
|
29
|
-
| "encontro";
|
|
30
|
-
|
|
31
|
-
const props = withDefaults(
|
|
32
|
-
defineProps<{
|
|
33
|
-
product?: AdsProductTagName;
|
|
34
|
-
label?: string;
|
|
35
|
-
}>(),
|
|
36
|
-
{
|
|
37
|
-
product: "performance",
|
|
38
|
-
label: "",
|
|
39
|
-
},
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const surfaces: Record<AdsProductTagName, string> = {
|
|
43
|
-
marketing: "bg-ads-produtos-radar-3",
|
|
44
|
-
promocoes: "bg-ads-produtos-radar-3",
|
|
45
|
-
vendas: "bg-ads-produtos-radar-7",
|
|
46
|
-
captador: "bg-ads-produtos-radar-10",
|
|
47
|
-
estoque: "bg-ads-produtos-radar-11",
|
|
48
|
-
pricing: "bg-ads-produtos-radar-7",
|
|
49
|
-
crm: "bg-ads-innovation-300",
|
|
50
|
-
compras: "bg-ads-produtos-radar-2",
|
|
51
|
-
gestao: "bg-ads-produtos-radar-1",
|
|
52
|
-
trade: "bg-ads-produtos-radar-2",
|
|
53
|
-
capacitacao: "bg-ads-produtos-radar-4",
|
|
54
|
-
ecommerce: "bg-ads-produtos-radar-9",
|
|
55
|
-
financas: "bg-ads-produtos-radar-6",
|
|
56
|
-
performance: "bg-ads-produtos-radar-6",
|
|
57
|
-
encontro: "bg-ads-produtos-radar-5",
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const surface = computed(() => surfaces[props.product]);
|
|
61
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="inline-flex h-[var(--ads-product-tag-height)] items-center rounded-[var(--ads-radius-xsm)] px-1.5 text-[length:var(--ads-product-tag-font-size)] leading-none font-medium text-[var(--ads-text-contrast)]"
|
|
4
|
+
:class="surface"
|
|
5
|
+
>
|
|
6
|
+
{{ label || product }}
|
|
7
|
+
</span>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { computed } from "vue";
|
|
12
|
+
|
|
13
|
+
/** Mapeia `_Tags` do Figma. O fundo usa a cor de vertical/produto já publicada. */
|
|
14
|
+
export type AdsProductTagName =
|
|
15
|
+
| "marketing"
|
|
16
|
+
| "promocoes"
|
|
17
|
+
| "vendas"
|
|
18
|
+
| "captador"
|
|
19
|
+
| "estoque"
|
|
20
|
+
| "pricing"
|
|
21
|
+
| "crm"
|
|
22
|
+
| "compras"
|
|
23
|
+
| "gestao"
|
|
24
|
+
| "trade"
|
|
25
|
+
| "capacitacao"
|
|
26
|
+
| "ecommerce"
|
|
27
|
+
| "financas"
|
|
28
|
+
| "performance"
|
|
29
|
+
| "encontro";
|
|
30
|
+
|
|
31
|
+
const props = withDefaults(
|
|
32
|
+
defineProps<{
|
|
33
|
+
product?: AdsProductTagName;
|
|
34
|
+
label?: string;
|
|
35
|
+
}>(),
|
|
36
|
+
{
|
|
37
|
+
product: "performance",
|
|
38
|
+
label: "",
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const surfaces: Record<AdsProductTagName, string> = {
|
|
43
|
+
marketing: "bg-ads-produtos-radar-3",
|
|
44
|
+
promocoes: "bg-ads-produtos-radar-3",
|
|
45
|
+
vendas: "bg-ads-produtos-radar-7",
|
|
46
|
+
captador: "bg-ads-produtos-radar-10",
|
|
47
|
+
estoque: "bg-ads-produtos-radar-11",
|
|
48
|
+
pricing: "bg-ads-produtos-radar-7",
|
|
49
|
+
crm: "bg-ads-innovation-300",
|
|
50
|
+
compras: "bg-ads-produtos-radar-2",
|
|
51
|
+
gestao: "bg-ads-produtos-radar-1",
|
|
52
|
+
trade: "bg-ads-produtos-radar-2",
|
|
53
|
+
capacitacao: "bg-ads-produtos-radar-4",
|
|
54
|
+
ecommerce: "bg-ads-produtos-radar-9",
|
|
55
|
+
financas: "bg-ads-produtos-radar-6",
|
|
56
|
+
performance: "bg-ads-produtos-radar-6",
|
|
57
|
+
encontro: "bg-ads-produtos-radar-5",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const surface = computed(() => surfaces[props.product]);
|
|
61
|
+
</script>
|