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.
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 -479
  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 -143
  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 -166
  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 -113
  48. package/app/components/AdsSegmentedTabs.vue +62 -28
  49. package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -203
  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 -109
  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,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 h-[var(--ads-pill-height)] min-w-[var(--ads-pill-min-width)] shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full px-[var(--ads-pill-padding-x)] py-1 text-center text-[length:var(--ads-pill-font-size)] [font-weight:var(--ads-pill-weight)] leading-[1.2] whitespace-nowrap"
4
- :class="surfaceClass"
5
- >
6
- <UIcon
7
- v-if="icon"
8
- :name="icon"
9
- class="size-3.5 shrink-0"
10
- :class="iconClass"
11
- aria-hidden="true"
12
- />
13
- {{ resolvedLabel }}
14
- </span>
15
- </template>
16
-
17
- <script setup lang="ts">
18
- import { computed } from "vue";
19
-
20
- export type AdsPillStatus = "default" | "success" | "attention" | "warning" | "new" | "blocked" | "innovation" | "neutral";
21
- export type AdsPillTone = "primary" | "secondary";
22
-
23
- const props = withDefaults(
24
- defineProps<{
25
- status?: AdsPillStatus;
26
- tone?: AdsPillTone;
27
- label?: string;
28
- icon?: string;
29
- /** Classes do ícone, como o giro do carregamento. */
30
- iconClass?: string;
31
- }>(),
32
- {
33
- status: "default",
34
- tone: "primary",
35
- label: undefined,
36
- icon: undefined,
37
- iconClass: undefined,
38
- },
39
- );
40
-
41
- /** Coleta manual: primary com fundo charts/data-1/800 e texto branco; secondary com fundo #fde3ff. */
42
- const innovationSecondary = "bg-[#fde3ff] text-[var(--ads-chart-data-1-800)]";
43
-
44
- const surfaces: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
45
- primary: {
46
- default: "bg-[var(--ads-pill-primary-bg)] text-[var(--ads-pill-primary-text)]",
47
- success: "bg-[#15c57e] text-white",
48
- attention: "bg-[#e9a700] text-white",
49
- warning: "bg-[#dc0034] text-white",
50
- new: "bg-[#05b4d8] text-white",
51
- blocked: "bg-[#0e1013] text-white",
52
- innovation: "bg-[var(--ads-chart-data-1-800)] text-white",
53
- neutral: "bg-[var(--color-neutral-300)] text-[var(--ads-text-primary)]",
54
- },
55
- secondary: {
56
- default: "bg-[#e4f2ff] text-[#00389e]",
57
- success: "bg-[#c3ffe6] text-[#0e5a3b]",
58
- attention: "bg-[#ffe7b9] text-[#8f6600]",
59
- warning: "bg-[#ffbdcd] text-[#840221]",
60
- new: "bg-[#c4f5ff] text-[#006478]",
61
- blocked: "bg-[#cfdef3] text-[#0e1013]",
62
- innovation: innovationSecondary,
63
- neutral: "bg-[var(--color-neutral-200)] text-[var(--ads-text-primary)]",
64
- },
65
- };
66
-
67
- const labels: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
68
- primary: {
69
- default: "Primary",
70
- success: "Success",
71
- attention: "Attention",
72
- warning: "Warning",
73
- new: "New!",
74
- blocked: "Blocked",
75
- innovation: "Innovation",
76
- neutral: "Neutral",
77
- },
78
- secondary: {
79
- default: "Secondary",
80
- success: "Success",
81
- attention: "Attention",
82
- warning: "Warning",
83
- new: "New!",
84
- blocked: "Blocked",
85
- innovation: "Innovation",
86
- neutral: "Neutral",
87
- },
88
- };
89
-
90
- const surfaceClass = computed(() => surfaces[props.tone][props.status]);
91
- const resolvedLabel = computed(() => props.label ?? labels[props.tone][props.status]);
92
- </script>
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>