ads-nuxt 0.4.1 → 0.5.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 (76) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -574
  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 -9
  8. package/app/assets/brand/radar.svg +9 -9
  9. package/app/assets/css/ads-colors.css +257 -257
  10. package/app/assets/css/main.css +585 -585
  11. package/app/components/AdsBadge.vue +47 -47
  12. package/app/components/AdsBroadcast.vue +24 -24
  13. package/app/components/AdsButton.vue +334 -547
  14. package/app/components/AdsButtonGroup.vue +39 -39
  15. package/app/components/AdsButtonMenu.vue +48 -48
  16. package/app/components/AdsCard.vue +188 -188
  17. package/app/components/AdsCardHint.vue +56 -56
  18. package/app/components/AdsCardPeriod.vue +43 -43
  19. package/app/components/AdsCardVariation.vue +31 -31
  20. package/app/components/AdsCharttip.vue +79 -79
  21. package/app/components/AdsDatePicker.vue +509 -509
  22. package/app/components/AdsDropdownMenu.vue +30 -30
  23. package/app/components/AdsEmptyState.vue +61 -61
  24. package/app/components/AdsFeatureCard.vue +292 -292
  25. package/app/components/AdsFileCard.vue +98 -98
  26. package/app/components/AdsFooter.vue +25 -25
  27. package/app/components/AdsHeavyAccountCell.vue +59 -59
  28. package/app/components/AdsHeavyHeaderCell.vue +70 -70
  29. package/app/components/AdsHeavyTable.vue +135 -135
  30. package/app/components/AdsInput.vue +148 -148
  31. package/app/components/AdsLoading.vue +217 -217
  32. package/app/components/AdsMenuBar.vue +110 -110
  33. package/app/components/AdsMetricCard.vue +226 -226
  34. package/app/components/AdsModal.vue +160 -160
  35. package/app/components/AdsMonthPicker.vue +80 -80
  36. package/app/components/AdsNavbarApp.vue +67 -67
  37. package/app/components/AdsNavbarDesk.vue +67 -67
  38. package/app/components/AdsNotabilityPill.vue +24 -24
  39. package/app/components/AdsNumberInput.vue +173 -173
  40. package/app/components/AdsPanelCard.vue +99 -99
  41. package/app/components/AdsPill.vue +144 -144
  42. package/app/components/AdsProductTag.vue +80 -80
  43. package/app/components/AdsSearchInput.vue +122 -122
  44. package/app/components/AdsSegmentedTabs.vue +62 -62
  45. package/app/components/AdsSelect.vue +283 -283
  46. package/app/components/AdsSelectItem.vue +128 -128
  47. package/app/components/AdsSelectPanel.vue +221 -221
  48. package/app/components/AdsSideMenu.vue +101 -101
  49. package/app/components/AdsSmalltip.vue +44 -44
  50. package/app/components/AdsStepper.vue +222 -222
  51. package/app/components/AdsTable.vue +172 -172
  52. package/app/components/AdsTableHeaderCell.vue +80 -80
  53. package/app/components/AdsTableSkeleton.vue +113 -113
  54. package/app/components/AdsTableToolbar.vue +44 -44
  55. package/app/components/AdsTabs.vue +51 -51
  56. package/app/components/AdsTextarea.vue +116 -116
  57. package/app/components/AdsToast.vue +184 -184
  58. package/app/components/AdsTooltip.vue +73 -73
  59. package/app/components/ProgressBarLoading.vue +235 -235
  60. package/app/composables/useOverlayLoading.ts +88 -88
  61. package/app/constants/ads-color-swatches.ts +240 -240
  62. package/app/locale/pt-br.ts +6 -6
  63. package/app/plugins/ads-toast.client.ts +24 -24
  64. package/app/theme/ads-theme.ts +374 -374
  65. package/app/theme/ads-tokens.ts +391 -391
  66. package/app/types/overlay-loading.types.ts +32 -32
  67. package/app/utils/ads-filter-select.ts +191 -191
  68. package/app/utils/ads-table.ts +416 -416
  69. package/app/utils/calendar-date.ts +163 -163
  70. package/app/utils/category-role.ts +45 -45
  71. package/app/utils/money.ts +77 -77
  72. package/app/utils/notability.ts +8 -8
  73. package/app/utils/parser.ts +134 -134
  74. package/app/utils/percentage.ts +54 -54
  75. package/nuxt.config.ts +31 -31
  76. package/package.json +57 -57
@@ -1,99 +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
+ <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,144 +1,144 @@
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 ? "" : labels[props.tone][props.status]),
143
- );
144
- </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 ? "" : labels[props.tone][props.status]),
143
+ );
144
+ </script>
@@ -1,80 +1,80 @@
1
- <template>
2
- <span
3
- class="inline-flex h-[var(--ads-product-tag-height)] items-center 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 || labels[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
- /** Nomes como no Figma (com acento; captador aparece como "prisma"). */
61
- const labels: Record<AdsProductTagName, string> = {
62
- marketing: "marketing",
63
- promocoes: "promoções",
64
- vendas: "vendas",
65
- captador: "prisma",
66
- estoque: "estoque",
67
- pricing: "pricing",
68
- crm: "crm",
69
- compras: "compras",
70
- gestao: "gestão",
71
- trade: "trade",
72
- capacitacao: "capacitação",
73
- ecommerce: "e-commerce",
74
- financas: "finanças",
75
- performance: "performance",
76
- encontro: "encontro",
77
- };
78
-
79
- const surface = computed(() => surfaces[props.product]);
80
- </script>
1
+ <template>
2
+ <span
3
+ class="inline-flex h-[var(--ads-product-tag-height)] items-center 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 || labels[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
+ /** Nomes como no Figma (com acento; captador aparece como "prisma"). */
61
+ const labels: Record<AdsProductTagName, string> = {
62
+ marketing: "marketing",
63
+ promocoes: "promoções",
64
+ vendas: "vendas",
65
+ captador: "prisma",
66
+ estoque: "estoque",
67
+ pricing: "pricing",
68
+ crm: "crm",
69
+ compras: "compras",
70
+ gestao: "gestão",
71
+ trade: "trade",
72
+ capacitacao: "capacitação",
73
+ ecommerce: "e-commerce",
74
+ financas: "finanças",
75
+ performance: "performance",
76
+ encontro: "encontro",
77
+ };
78
+
79
+ const surface = computed(() => surfaces[props.product]);
80
+ </script>