ads-nuxt 0.5.0 → 0.6.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/README.md CHANGED
@@ -199,7 +199,7 @@ const nome = ref("");
199
199
  | Componente | Descrição |
200
200
  | -------------------- | --------- |
201
201
  | `AdsBadge` | Contador ou ponto (`mini`) em 7 cores. |
202
- | `AdsPill` | Pílula de status em tom `primary` ou `secondary` e tamanho `md` (Pill) ou `sm` (Small Pill). |
202
+ | `AdsPill` | Pílula de cor (`color`): `default`, `soft` ou `text`, tamanho `md` ou `sm`. `broadcast` liga a pílula de transmissão. |
203
203
  | `AdsNotabilityPill` | Pílula de notabilidade. |
204
204
  | `AdsProductTag` | Tag de produto. |
205
205
 
@@ -303,8 +303,8 @@ toast.add({
303
303
  ### Pílulas e badges
304
304
 
305
305
  ```vue
306
- <AdsPill status="success" label="Ativo" />
307
- <AdsPill status="warning" tone="secondary" label="Atrasado" icon="i-lucide-alert-triangle" />
306
+ <AdsPill color="success" label="Ativo" />
307
+ <AdsPill variant="soft" color="warning" label="Atrasado" icon="i-lucide-alert-triangle" />
308
308
  <AdsBadge color="primary" :value="5" />
309
309
  <AdsBadge color="warning" mini />
310
310
  ```
@@ -583,3 +583,37 @@
583
583
  background-color: rgba(255, 255, 255, 0.35);
584
584
  }
585
585
  }
586
+
587
+ /*
588
+ * O CSS do Iconify (`.iconify { width: 1em; height: 1em }`) fica fora de @layer
589
+ * e vence o utilitário Tailwind. Esta regra também está fora de camada e é mais
590
+ * específica: o ícone do toast ocupa --ads-toast-icon-size (18px na faixa, 24px no reporte).
591
+ */
592
+ .iconify.ads-toast-icon {
593
+ width: var(--ads-toast-icon-size);
594
+ height: var(--ads-toast-icon-size);
595
+ }
596
+
597
+ /* Ícone de 16px (pill em texto, ação do toast). O 1em do Iconify cederia para 14px. */
598
+ .iconify.ads-icon-xxs {
599
+ width: var(--ads-space-xxs);
600
+ height: var(--ads-space-xxs);
601
+ }
602
+
603
+ /*
604
+ * Tabela dentro do AdsCard: encosta nas laterais e a primeira coluna
605
+ * usa o mesmo padding do card, alinhada ao título. Fora do card, não vale.
606
+ * Fica fora de @layer para vencer o px da célula sem !important.
607
+ */
608
+ .ads-card .ads-table {
609
+ width: calc(100% + 2 * var(--ads-card-bleed, 0px));
610
+ margin-inline: calc(var(--ads-card-bleed, 0px) * -1);
611
+ }
612
+
613
+ .ads-card .ads-table :is(th, td):first-child:not(.p-0) {
614
+ padding-inline-start: var(--ads-card-padding);
615
+ }
616
+
617
+ .ads-card .ads-table :is(th, td):last-child:not(.p-0) {
618
+ padding-inline-end: var(--ads-card-padding);
619
+ }
@@ -1,24 +1,24 @@
1
1
  <!--
2
- AdsBroadcast — atalho de compatibilidade. O Broadcast agora é uma variante da Pill:
3
- prefira <AdsPill variant="broadcast" />.
2
+ AdsBroadcast — atalho de compatibilidade. O Broadcast é a prop da Pill:
3
+ prefira <AdsPill broadcast />.
4
4
  -->
5
5
  <template>
6
- <AdsPill variant="broadcast" :status="status" :label="label" />
6
+ <AdsPill broadcast :color="color" :label="label" />
7
7
  </template>
8
8
 
9
9
  <script setup lang="ts">
10
10
  import AdsPill from "./AdsPill.vue";
11
11
 
12
- export type AdsBroadcastStatus = "warning" | "success";
12
+ export type AdsBroadcastColor = "warning" | "success";
13
13
 
14
14
  withDefaults(
15
15
  defineProps<{
16
16
  label?: string;
17
- status?: AdsBroadcastStatus;
17
+ color?: AdsBroadcastColor;
18
18
  }>(),
19
19
  {
20
20
  label: "",
21
- status: "warning",
21
+ color: "warning",
22
22
  },
23
23
  );
24
24
  </script>
@@ -4,14 +4,15 @@
4
4
  :type="as === 'button' ? 'button' : undefined"
5
5
  :disabled="as === 'button' ? disabled : undefined"
6
6
  :aria-busy="loading || undefined"
7
- class="flex h-full min-w-0 flex-col items-start gap-3 border p-[var(--ads-card-padding)] text-left transition-[background-color,border-color,box-shadow]"
7
+ class="ads-card flex h-full min-w-0 flex-col items-start gap-3 p-[var(--ads-card-padding)] text-left transition-[background-color,border-color,box-shadow]"
8
8
  :class="[radiusClass, surfaceClass]"
9
+ :style="paddingStyle"
9
10
  >
10
11
  <!-- Cabeçalho -->
11
12
  <div v-if="showHeader" class="flex w-full min-w-0 items-center gap-2">
12
13
  <div class="min-w-0 flex-1">
13
14
  <slot name="header">
14
- <p :class="type === 'details' ? detailsTitleClass : containerTitleClass">{{ title }}</p>
15
+ <p :class="titleClass">{{ title }}</p>
15
16
  </slot>
16
17
  </div>
17
18
  <AdsCardHint v-if="hint" :text="hint" />
@@ -20,7 +21,7 @@
20
21
 
21
22
  <AdsCardPeriod v-if="period || (loading && periodLabel && type === 'container')" :label="periodLabel" :value="period" :loading="loading" :skeleton-width="110" />
22
23
 
23
- <p v-if="description && !loading && !empty" class="text-[length:var(--ads-card-body-size)] leading-[1.4] text-[var(--ads-card-body)]">
24
+ <p v-if="description && !loading && !empty" :class="descriptionClass">
24
25
  {{ description }}
25
26
  </p>
26
27
 
@@ -79,6 +80,16 @@ import AdsEmptyState from "./AdsEmptyState.vue";
79
80
  import AdsLoading from "./AdsLoading.vue";
80
81
 
81
82
  export type AdsCardType = "container" | "details";
83
+ /** box: cartão com borda e raio. line: só a divisória de baixo, para uma linha de lista. */
84
+ export type AdsCardVariant = "box" | "line";
85
+ /** default: 16px (padrão). compact: 8px. relaxed: 24px (estratégia, histórico, notabilidade). */
86
+ export type AdsCardPadding = "default" | "compact" | "relaxed";
87
+
88
+ const CARD_PADDING: Record<AdsCardPadding, string> = {
89
+ default: "16px",
90
+ compact: "8px",
91
+ relaxed: "24px",
92
+ };
82
93
 
83
94
  export interface AdsCardRow {
84
95
  /** Ícone Lucide de 16px. */
@@ -104,7 +115,7 @@ const props = withDefaults(
104
115
  periodLabel?: string;
105
116
  /** Linhas do card Detalhes. */
106
117
  rows?: AdsCardRow[];
107
- /** Texto de apoio abaixo do cabeçalho. Só no código: o Figma não tem. */
118
+ /** Texto de apoio. No selected, 14px em text/secondary. Fora disso, só no código. */
108
119
  description?: string;
109
120
  /** Linha curta no rodapé. O slot footer substitui. Só no código: o Figma não tem. */
110
121
  footerText?: string;
@@ -116,9 +127,13 @@ const props = withDefaults(
116
127
  disabled?: boolean;
117
128
  /** Hover padrão dos cards clicáveis: borda cinza mais escura e sombra leve. false desliga. */
118
129
  hoverable?: boolean;
119
- /** Estado Selecionado: fundo azul claro, borda azul e sombra. */
130
+ /** Estado Selecionado: fundo azul claro, borda azul e sombra. Título 14 bold e descrição 14. */
120
131
  selected?: boolean;
121
- /** `md` (12px) é o do Figma; `sm` (8px) é só no código. */
132
+ /** box é o cartão. line é só a borda inferior, sem raio. */
133
+ variant?: AdsCardVariant;
134
+ /** default (16px) é o padrão. compact (8px) é o respiro menor. relaxed (24px) é o respiro maior (estratégia, histórico, notabilidade). */
135
+ padding?: AdsCardPadding;
136
+ /** `md` (12px) é o do Figma; `sm` (8px) é só no código. Ignorado em line. */
122
137
  radius?: "sm" | "md";
123
138
  /** Estado Carregando: no container, o loader do Radar; no details, skeleton nas linhas. */
124
139
  loading?: boolean;
@@ -140,6 +155,8 @@ const props = withDefaults(
140
155
  disabled: false,
141
156
  hoverable: true,
142
157
  selected: false,
158
+ variant: "box",
159
+ padding: "default",
143
160
  radius: "md",
144
161
  loading: false,
145
162
  empty: false,
@@ -150,8 +167,26 @@ const props = withDefaults(
150
167
 
151
168
  const slots = useSlots();
152
169
 
153
- const containerTitleClass = "text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-card-title)]";
170
+ const containerTitleClass = "text-[length:var(--ads-font-size-xs)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
154
171
  const detailsTitleClass = "text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
172
+ const selectedTitleClass = "text-[length:var(--ads-font-size-xxs)] font-bold leading-[1.3] text-[var(--ads-text-primary)]";
173
+
174
+ const titleClass = computed(() => {
175
+ if (props.selected) return selectedTitleClass;
176
+ return props.type === "details" ? detailsTitleClass : containerTitleClass;
177
+ });
178
+
179
+ const descriptionClass = computed(() =>
180
+ props.selected
181
+ ? "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
+ );
184
+
185
+ /** O valor local vence o token global, e a tabela dentro do card usa o mesmo respiro. */
186
+ const paddingStyle = computed(() => ({
187
+ "--ads-card-padding": CARD_PADDING[props.padding],
188
+ "--ads-card-bleed": "var(--ads-card-padding)",
189
+ }));
155
190
 
156
191
  /** Larguras do skeleton do Figma; uma barra por linha. */
157
192
  const SKELETON_WIDTHS = [200, 240, 160, 180, 260];
@@ -162,24 +197,30 @@ const detailSkeletonWidths = computed(() => {
162
197
 
163
198
  const showHeader = computed(() => Boolean(props.title || props.hint || slots.header || slots.actions));
164
199
 
165
- const radiusClass = computed(() =>
166
- props.radius === "sm" ? "rounded-[var(--ads-card-radius-sm)]" : "rounded-[var(--ads-card-radius)]",
167
- );
200
+ const radiusClass = computed(() => {
201
+ if (props.variant === "line") return "rounded-none";
202
+ return props.radius === "sm" ? "rounded-[var(--ads-card-radius-sm)]" : "rounded-[var(--ads-card-radius)]";
203
+ });
168
204
 
169
205
  const surfaceClass = computed(() => {
206
+ const line = props.variant === "line";
170
207
  const classes = [
171
208
  props.selected
172
- ? "border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
173
- : "border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
209
+ ? line
210
+ ? "[border-width:0_0_1px] border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)]"
211
+ : "border border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
212
+ : line
213
+ ? "[border-width:0_0_1px] border-[var(--ads-card-border)] bg-[var(--ads-card-background)]"
214
+ : "border border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
174
215
  ];
175
216
 
176
217
  if (props.as !== "div") {
177
218
  classes.push(
178
219
  "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",
179
220
  );
180
- // Hover padrão de todos os cards clicáveis: neutro, borda cinza mais escura e sombra leve.
221
+ // Hover padrão dos cards clicáveis. Na linha, só a divisória escurece: sombra viraria caixa.
181
222
  if (props.hoverable && !props.selected && !props.disabled) {
182
- classes.push("hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
223
+ classes.push(line ? "hover:border-[var(--ads-card-hover-border)]" : "hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
183
224
  }
184
225
  }
185
226
 
@@ -1,36 +1,38 @@
1
1
  <template>
2
- <div class="flex w-full flex-wrap items-center gap-x-2 gap-y-1">
3
- <span class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">{{ label }}</span>
2
+ <div class="inline-flex max-w-full flex-wrap items-center gap-x-2 gap-y-1">
3
+ <span class="text-[length:var(--ads-font-size-xxs)] font-normal leading-[1.3] text-[var(--ads-text-secondary)]">{{ label }}</span>
4
4
  <span
5
5
  v-if="loading"
6
- class="block h-[18px] animate-pulse rounded-[var(--ads-radius-pill)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
6
+ class="block h-[var(--ads-pill-height)] animate-pulse rounded-[var(--ads-radius-pill)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
7
7
  :style="{ width: `${skeletonWidth}px` }"
8
8
  aria-hidden="true"
9
9
  />
10
- <span
10
+ <AdsPill
11
11
  v-else-if="value"
12
- class="inline-flex h-[18px] items-center rounded-[var(--ads-radius-pill)] px-2 text-[length:var(--ads-font-size-minimal)] font-bold leading-[1.1] whitespace-nowrap"
13
- :class="tone === 'neutral'
14
- ? 'bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]'
15
- : 'bg-ads-radar-25 text-ads-radar-800'"
16
- >
17
- {{ value }}
18
- </span>
12
+ :label="value"
13
+ variant="soft"
14
+ color="default"
15
+ :custom-surface="tone === 'neutral' ? neutralSurface : undefined"
16
+ />
19
17
  </div>
20
18
  </template>
21
19
 
22
20
  <script setup lang="ts">
21
+ import AdsPill from "./AdsPill.vue";
22
+
23
23
  /**
24
- * Rótulo com selo, usado no período e no comparativo dos cards.
25
- * brand é o selo de datas (azul); neutral é o selo do comparativo (cinza).
24
+ * Rótulo de 14px com o valor numa pill. Serve no card e fora dele.
25
+ * brand é a pill secundária padrão (período). neutral é o selo cinza do comparativo.
26
26
  */
27
+ const neutralSurface = "bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]";
28
+
27
29
  withDefaults(
28
30
  defineProps<{
29
31
  label: string;
30
32
  value?: string;
31
33
  tone?: "brand" | "neutral";
32
34
  loading?: boolean;
33
- /** Largura do skeleton do selo, em px. */
35
+ /** Largura do skeleton da pill, em px. */
34
36
  skeletonWidth?: number;
35
37
  }>(),
36
38
  {
@@ -33,7 +33,8 @@
33
33
  </span>
34
34
  <span
35
35
  v-if="hasLabel"
36
- class="text-[length:var(--ads-checkbox-label-size)] font-normal leading-[1.3]"
36
+ class="text-[length:var(--ads-checkbox-label-size)] font-normal leading-[1.3] normal-case"
37
+ style="text-transform: none"
37
38
  :class="isDisabled ? 'text-ads-neutro-medio-70' : 'text-[var(--ads-checkbox-label)]'"
38
39
  >
39
40
  <slot>{{ label }}</slot>
@@ -59,8 +59,8 @@
59
59
  <AdsPill
60
60
  v-if="disabled"
61
61
  class="mt-auto self-start"
62
- tone="secondary"
63
- status="blocked"
62
+ variant="soft"
63
+ color="blocked"
64
64
  label="Em breve"
65
65
  />
66
66
  <span v-else-if="hasActions" class="mt-auto flex flex-wrap items-center gap-x-[var(--ads-space-xs)] gap-y-2">
@@ -81,8 +81,8 @@
81
81
  <AdsPill
82
82
  v-for="badge in badges"
83
83
  :key="badge.label"
84
- :tone="badge.tone ?? 'secondary'"
85
- :status="badge.status ?? 'default'"
84
+ :variant="badge.variant ?? 'soft'"
85
+ :color="badge.color ?? 'default'"
86
86
  :label="badge.label"
87
87
  />
88
88
  <span
@@ -104,13 +104,14 @@ import { useResizeObserver } from "@vueuse/core";
104
104
  import { NuxtLink } from "#components";
105
105
  import AdsCard from "./AdsCard.vue";
106
106
  import AdsPill from "./AdsPill.vue";
107
- import type { AdsPillStatus, AdsPillTone } from "./AdsPill.vue";
107
+ import type { AdsPillColor, AdsPillVariant } from "./AdsPill.vue";
108
108
  import AdsTooltip from "./AdsTooltip.vue";
109
109
 
110
110
  export interface AdsFeatureCardBadge {
111
111
  label: string;
112
- tone?: AdsPillTone;
113
- status?: AdsPillStatus;
112
+ /** default é a pill sólida. soft (padrão do rodapé) é a clara. text é só o texto. */
113
+ variant?: AdsPillVariant;
114
+ color?: AdsPillColor;
114
115
  }
115
116
 
116
117
  /** Ação do rodapé. Com `to`, vira link; sem ele, continua botão. */
@@ -12,8 +12,8 @@
12
12
  }"
13
13
  >
14
14
  <template #content="{ close }">
15
- <div class="flex min-h-0 w-full flex-col gap-[var(--ads-space-xxs)]">
16
- <div class="flex items-start gap-[var(--ads-space-quark)]">
15
+ <div class="flex w-full flex-col gap-[var(--ads-space-xxs)]" :class="scrollable ? 'max-h-full min-h-0 overflow-hidden' : ''">
16
+ <div class="flex shrink-0 items-start gap-[var(--ads-space-quark)]">
17
17
  <span
18
18
  v-if="icon"
19
19
  class="flex size-[var(--ads-space-xs)] shrink-0 items-center justify-center text-[var(--ads-text-primary)]"
@@ -39,18 +39,18 @@
39
39
  </button>
40
40
  </div>
41
41
 
42
- <p v-if="description" class="text-[length:var(--ads-modal-body-size)] leading-[var(--ads-line-height-md)] text-[var(--ads-modal-body)]">
42
+ <p v-if="description" class="shrink-0 text-[length:var(--ads-modal-body-size)] leading-[var(--ads-line-height-md)] text-[var(--ads-modal-body)]">
43
43
  {{ description }}
44
44
  </p>
45
45
 
46
- <div v-if="slots.default" class="min-h-0 overflow-y-auto">
46
+ <div v-if="slots.default" :class="scrollable ? 'min-h-0 flex-1 overflow-y-auto overscroll-contain' : ''">
47
47
  <slot />
48
48
  </div>
49
49
 
50
50
  <div v-if="slots.footer" class="flex w-full shrink-0 items-center justify-end gap-[var(--ads-space-quark)] bg-white">
51
51
  <slot name="footer" />
52
52
  </div>
53
- <div v-else-if="showDefaultActions" class="flex w-full items-center justify-end gap-[var(--ads-space-quark)]">
53
+ <div v-else-if="showDefaultActions" class="flex w-full shrink-0 items-center justify-end gap-[var(--ads-space-quark)]">
54
54
  <AdsButton
55
55
  v-if="cancelLabel"
56
56
  type="unfilled"
@@ -88,7 +88,7 @@ import AdsButton from "./AdsButton.vue";
88
88
  * - título: 20px bold, line-height 130% (Subtitle 20 do Figma)
89
89
  */
90
90
  export type AdsModalVariant = "dialog" | "sheet";
91
- export type AdsModalSize = "md" | "lg" | "xl" | "2xl" | "3xl";
91
+ export type AdsModalSize = "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
92
92
  export type AdsModalDismissReason = "esc" | "outside";
93
93
 
94
94
  const props = withDefaults(
@@ -131,14 +131,23 @@ const widths: Record<AdsModalSize, string> = {
131
131
  xl: "!w-[min(48rem,calc(100%-2rem))]",
132
132
  "2xl": "!w-[min(56rem,calc(100%-2rem))]",
133
133
  "3xl": "!w-[min(64rem,calc(100%-2rem))]",
134
+ /** Mapa de concorrentes. O app não precisa forçar a largura. */
135
+ "4xl": "!w-[min(80rem,calc(100%-2rem))]",
134
136
  };
135
137
 
138
+ /**
139
+ * Com scrollable, o painel trava na altura da tela e só o miolo rola.
140
+ * Cabeçalho, descrição e rodapé ficam visíveis.
141
+ */
142
+ const scrollShell = " !flex !max-h-[calc(100dvh-2rem)] !flex-col !overflow-hidden";
143
+
136
144
  const contentClass = computed(() => {
137
- const scroll = props.scrollable ? " !max-h-[calc(100dvh-2rem)] !overflow-y-auto" : "";
138
145
  if (props.variant === "sheet") {
139
- return `!inset-x-0 !bottom-0 !top-auto !left-0 !translate-x-0 !translate-y-0 !w-full !max-w-none !max-h-[calc(100dvh-2rem)] !divide-y-0 !overflow-y-auto !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-2)] !ring-1 !ring-[var(--ads-modal-border)] !rounded-t-[var(--ads-modal-radius)] !rounded-b-none${scroll}`;
146
+ const sheetScroll = props.scrollable ? scrollShell : " !max-h-[calc(100dvh-2rem)] !overflow-y-auto";
147
+ return `!inset-x-0 !bottom-0 !top-auto !left-0 !translate-x-0 !translate-y-0 !w-full !max-w-none !divide-y-0 !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-2)] !ring-1 !ring-[var(--ads-modal-border)] !rounded-t-[var(--ads-modal-radius)] !rounded-b-none${sheetScroll}`;
140
148
  }
141
- return `${widths[props.size]} !max-w-none !divide-y-0 !rounded-[var(--ads-modal-radius)] !border !border-[var(--ads-modal-border)] !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-3)] !ring-0${scroll}`;
149
+ const dialogScroll = props.scrollable ? scrollShell : "";
150
+ return `${widths[props.size]} !max-w-none !divide-y-0 !rounded-[var(--ads-modal-radius)] !border !border-[var(--ads-modal-border)] !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-3)] !ring-0${dialogScroll}`;
142
151
  });
143
152
 
144
153
  const emit = defineEmits<{
@@ -5,7 +5,7 @@
5
5
  <AdsProductTag v-if="product" :product="product" :label="productLabel" />
6
6
  </div>
7
7
  <div class="flex items-center gap-4">
8
- <AdsPill v-if="showBroadcast && broadcastLabel" variant="broadcast" status="warning" :label="broadcastLabel" />
8
+ <AdsPill v-if="showBroadcast && broadcastLabel" broadcast color="warning" :label="broadcastLabel" />
9
9
  <div class="flex items-center gap-3">
10
10
  <template v-for="(action, index) in actions" :key="action.id">
11
11
  <span v-if="index === actions.length - 1" class="flex size-[var(--ads-navbar-desk-avatar)] items-center justify-center overflow-hidden rounded-full bg-ads-neutro-claro-30" aria-hidden="true">
@@ -1,9 +1,13 @@
1
1
  <template>
2
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]"
3
+ class="inline-flex items-center whitespace-nowrap"
4
+ :class="isText
5
+ ? textClass
6
+ : isBroadcast
7
+ ? [broadcastSizeClass, broadcastSurface.shell, 'shrink-0 justify-center gap-1 overflow-hidden rounded-full text-center leading-[1.2]']
8
+ : [sizeClass, surfaceClass, 'shrink-0 justify-center gap-1 overflow-hidden rounded-full text-center leading-[1.2]']"
5
9
  >
6
- <!-- Broadcast: ponto na cor do status antes do texto -->
10
+ <!-- Broadcast: ponto na cor da pill antes do texto -->
7
11
  <span v-if="isBroadcast" class="flex size-3.5 shrink-0 items-center justify-center" aria-hidden="true">
8
12
  <span class="size-[var(--ads-broadcast-mark)] rounded-full" :class="broadcastSurface.mark" />
9
13
  </span>
@@ -11,7 +15,7 @@
11
15
  v-if="icon"
12
16
  :name="icon"
13
17
  class="shrink-0"
14
- :class="[iconSizeClass, iconClass]"
18
+ :class="[iconSizeClass, isText ? 'ads-icon-xxs' : '', iconClass]"
15
19
  aria-hidden="true"
16
20
  />
17
21
  {{ resolvedLabel }}
@@ -19,7 +23,7 @@
19
23
  v-if="trailingIcon"
20
24
  :name="trailingIcon"
21
25
  class="shrink-0"
22
- :class="iconSizeClass"
26
+ :class="[iconSizeClass, isText ? 'ads-icon-xxs' : '']"
23
27
  aria-hidden="true"
24
28
  />
25
29
  </span>
@@ -28,21 +32,26 @@
28
32
  <script setup lang="ts">
29
33
  import { computed } from "vue";
30
34
 
31
- export type AdsPillStatus = "default" | "success" | "attention" | "warning" | "new" | "blocked";
32
- export type AdsPillTone = "primary" | "secondary";
35
+ export type AdsPillColor = "default" | "success" | "attention" | "warning" | "new" | "blocked";
33
36
  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";
37
+ /** default: pill sólida. soft: pill clara. text: texto 14 regular, sem fundo. */
38
+ export type AdsPillVariant = "default" | "soft" | "text";
36
39
 
37
40
  const props = withDefaults(
38
41
  defineProps<{
39
42
  /**
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.
43
+ * default é a pill sólida. soft é a variação clara.
44
+ * text: sem fundo, sem largura mínima, 14px regular.
45
+ * A cor é a do texto da `color`. Ignora size. O ícone, se houver, tem 16px.
42
46
  */
43
47
  variant?: AdsPillVariant;
44
- status?: AdsPillStatus;
45
- tone?: AdsPillTone;
48
+ /**
49
+ * Pílula de transmissão (LIVE): borda, ponto e texto na cor da `color`.
50
+ * Só warning e success; as outras cores usam warning. Ignora variant e size.
51
+ */
52
+ broadcast?: boolean;
53
+ /** Cor do estado: default, success, attention, warning, new ou blocked. */
54
+ color?: AdsPillColor;
46
55
  /** `md` = Pill normal (24px). `sm` = Small Pill (18px). Default `md`. */
47
56
  size?: AdsPillSize;
48
57
  label?: string;
@@ -61,8 +70,8 @@ const props = withDefaults(
61
70
  }>(),
62
71
  {
63
72
  variant: "default",
64
- status: "default",
65
- tone: "primary",
73
+ broadcast: false,
74
+ color: "default",
66
75
  size: "md",
67
76
  label: undefined,
68
77
  icon: undefined,
@@ -72,8 +81,8 @@ const props = withDefaults(
72
81
  },
73
82
  );
74
83
 
75
- const surfaces: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
76
- primary: {
84
+ const surfaces: Record<Exclude<AdsPillVariant, "text">, Record<AdsPillColor, string>> = {
85
+ default: {
77
86
  default: "bg-[var(--ads-pill-primary-bg)] text-[var(--ads-pill-primary-text)]",
78
87
  success: "bg-[#15c57e] text-white",
79
88
  attention: "bg-[#e9a700] text-white",
@@ -81,7 +90,7 @@ const surfaces: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
81
90
  new: "bg-[#05b4d8] text-white",
82
91
  blocked: "bg-[#0e1013] text-white",
83
92
  },
84
- secondary: {
93
+ soft: {
85
94
  default: "bg-[#e4f2ff] text-[#00389e]",
86
95
  success: "bg-[#c3ffe6] text-[#0e5a3b]",
87
96
  attention: "bg-[#ffe7b9] text-[#8f6600]",
@@ -91,17 +100,17 @@ const surfaces: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
91
100
  },
92
101
  };
93
102
 
94
- const labels: Record<AdsPillTone, Record<AdsPillStatus, string>> = {
95
- primary: {
96
- default: "Primary",
103
+ const labels: Record<Exclude<AdsPillVariant, "text">, Record<AdsPillColor, string>> = {
104
+ default: {
105
+ default: "Default",
97
106
  success: "Success",
98
107
  attention: "Attention",
99
108
  warning: "Warning",
100
109
  new: "New!",
101
110
  blocked: "Blocked",
102
111
  },
103
- secondary: {
104
- default: "Secondary",
112
+ soft: {
113
+ default: "Soft",
105
114
  success: "Success",
106
115
  attention: "Attention",
107
116
  warning: "Warning",
@@ -117,9 +126,29 @@ const sizeClass = computed(() =>
117
126
  : "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
127
  );
119
128
 
120
- const iconSizeClass = computed(() => (props.size === "sm" ? "size-3" : "size-3.5"));
129
+ /** Tinta de cada cor: a cor do texto da pill clara, sem o fundo. */
130
+ const textColors: Record<AdsPillColor, string> = {
131
+ default: "text-[var(--color-ads-radar-800)]",
132
+ success: "text-[var(--ads-status-success-800)]",
133
+ attention: "text-[var(--ads-status-attention-800)]",
134
+ warning: "text-[var(--ads-status-warning-800)]",
135
+ new: "text-[var(--ads-status-new-800)]",
136
+ blocked: "text-[var(--ads-status-void-800)]",
137
+ };
138
+
139
+ const textClass = computed(() => [
140
+ "gap-1 text-[length:var(--ads-font-size-xxs)] font-normal leading-[1.3]",
141
+ textColors[props.color],
142
+ ]);
143
+
144
+ const iconSizeClass = computed(() => {
145
+ if (props.variant === "text") return "size-[var(--ads-space-xxs)]";
146
+ return props.size === "sm" ? "size-3" : "size-3.5";
147
+ });
121
148
 
122
- const isBroadcast = computed(() => props.variant === "broadcast");
149
+ const isBroadcast = computed(() => props.broadcast);
150
+ const isText = computed(() => !isBroadcast.value && props.variant === "text");
151
+ const filledVariant = computed(() => (props.variant === "soft" ? "soft" : "default"));
123
152
 
124
153
  const broadcastSurfaces = {
125
154
  warning: {
@@ -132,13 +161,13 @@ const broadcastSurfaces = {
132
161
  },
133
162
  } as const;
134
163
 
135
- const broadcastSurface = computed(() => broadcastSurfaces[props.status === "success" ? "success" : "warning"]);
164
+ const broadcastSurface = computed(() => broadcastSurfaces[props.color === "success" ? "success" : "warning"]);
136
165
 
137
166
  const broadcastSizeClass =
138
167
  "h-[var(--ads-broadcast-height)] px-[var(--ads-broadcast-padding-x)] py-1 text-[length:var(--ads-broadcast-font-size)] font-bold";
139
168
 
140
- const surfaceClass = computed(() => props.customSurface ?? surfaces[props.tone][props.status]);
169
+ const surfaceClass = computed(() => props.customSurface ?? surfaces[filledVariant.value][props.color]);
141
170
  const resolvedLabel = computed(
142
- () => props.label ?? (isBroadcast.value ? "" : labels[props.tone][props.status]),
171
+ () => props.label ?? (isBroadcast.value ? "" : labels[filledVariant.value][props.color]),
143
172
  );
144
173
  </script>
@@ -1,13 +1,18 @@
1
1
  <template>
2
- <UTabs
3
- v-model="model"
4
- :items="items as TabsItem[]"
5
- :content="false"
6
- variant="pill"
7
- color="neutral"
8
- :ui="adsSegmentedTabsUi"
9
- :aria-label="ariaLabel"
2
+ <div
3
+ ref="scroller"
4
+ class="min-w-0 max-w-full [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"
5
+ :class="overflows ? 'overflow-x-auto overscroll-x-contain' : ''"
10
6
  >
7
+ <UTabs
8
+ v-model="model"
9
+ :items="items as TabsItem[]"
10
+ :content="false"
11
+ variant="pill"
12
+ color="neutral"
13
+ :ui="adsSegmentedTabsUi"
14
+ :aria-label="ariaLabel"
15
+ >
11
16
  <!-- Rótulo e, abaixo, o subtítulo opcional. O ícone de 24px vem do próprio UTabs, à esquerda. -->
12
17
  <template #default="{ item }">
13
18
  <span>{{ item.label }}</span>
@@ -18,13 +23,15 @@
18
23
  {{ (item as AdsSegmentedTabsItem).subtitle }}
19
24
  </span>
20
25
  </template>
21
- </UTabs>
26
+ </UTabs>
27
+ </div>
22
28
  </template>
23
29
 
24
30
  <script setup lang="ts" generic="T extends string | number">
25
31
  import type { TabsItem } from "@nuxt/ui";
26
- import { watch } from "vue";
32
+ import { nextTick, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from "vue";
27
33
  import { adsSegmentedTabsUi } from "../theme/ads-theme";
34
+ import { bindTabWheel, revealActiveTab } from "./ads-tab-scroll";
28
35
 
29
36
  /** Estende TabsItem com `subtitle` opcional. O `icon` (24px, à esquerda) já vem do Nuxt UI. */
30
37
  export interface AdsSegmentedTabsItem extends Omit<TabsItem, "slot"> {
@@ -50,7 +57,7 @@ if (import.meta.dev) {
50
57
  (len) => {
51
58
  if (len > MAX_TABS) {
52
59
  console.warn(
53
- `[AdsSegmentedTabs] Limite de ${MAX_TABS} abas excedido (${len}). Acima desse limite o filtro pode ficar ilegível em telas menores.`,
60
+ `[AdsSegmentedTabs] Limite de ${MAX_TABS} abas excedido (${len}). A faixa rola na horizontal; prefira até ${MAX_TABS} abas.`,
54
61
  );
55
62
  }
56
63
  },
@@ -59,4 +66,41 @@ if (import.meta.dev) {
59
66
  }
60
67
 
61
68
  const model = defineModel<T>({ required: true });
69
+
70
+ const scroller = useTemplateRef<HTMLElement>("scroller");
71
+ /** Começa rolando para o SSR não estourar a página; o mount solta se a faixa cabe. */
72
+ const overflows = ref(true);
73
+ let unbindWheel: (() => void) | undefined;
74
+ let observer: ResizeObserver | undefined;
75
+
76
+ function syncOverflow() {
77
+ const el = scroller.value;
78
+ if (!el) return;
79
+ overflows.value = el.scrollWidth > el.clientWidth + 1;
80
+ }
81
+
82
+ function reveal() {
83
+ nextTick(() => {
84
+ syncOverflow();
85
+ nextTick(() => revealActiveTab(scroller.value));
86
+ });
87
+ }
88
+
89
+ onMounted(() => {
90
+ const el = scroller.value;
91
+ if (!el) return;
92
+ unbindWheel = bindTabWheel(el);
93
+ observer = new ResizeObserver(() => syncOverflow());
94
+ observer.observe(el);
95
+ if (el.firstElementChild) observer.observe(el.firstElementChild);
96
+ reveal();
97
+ });
98
+
99
+ onBeforeUnmount(() => {
100
+ unbindWheel?.();
101
+ observer?.disconnect();
102
+ });
103
+
104
+ watch(model, reveal);
105
+ watch(() => props.items, reveal);
62
106
  </script>
@@ -52,7 +52,7 @@
52
52
  <button
53
53
  v-else
54
54
  type="button"
55
- class="flex h-[var(--ads-filter-height)] max-w-full items-center gap-0.5 rounded-[var(--ads-filter-radius)] px-[var(--ads-filter-padding-x)] text-[length:var(--ads-filter-font-size)] leading-[1.3] transition-colors focus-visible:border-(length:--ads-border-width-slim) focus-visible:border-[var(--ads-filter-focus-border)] focus-visible:outline-none disabled:cursor-not-allowed"
55
+ class="flex h-[var(--ads-filter-height)] max-w-full items-center gap-0.5 rounded-[var(--ads-filter-radius)] px-[var(--ads-filter-padding-x)] text-[length:var(--ads-filter-font-size)] font-normal leading-[1.3] normal-case transition-colors focus-visible:border-(length:--ads-border-width-slim) focus-visible:border-[var(--ads-filter-focus-border)] focus-visible:outline-none disabled:cursor-not-allowed"
56
56
  :class="[fieldClass, block ? 'w-full justify-between' : 'w-fit']"
57
57
  :disabled="disabled"
58
58
  :data-state="fieldState"
@@ -68,7 +68,7 @@
68
68
  :disabled="!triggerHasTooltip"
69
69
  align="start"
70
70
  >
71
- <span class="min-w-0 truncate text-left">{{ triggerLabel }}</span>
71
+ <span class="min-w-0 truncate text-left font-normal normal-case" style="text-transform: none">{{ triggerLabel }}</span>
72
72
  </AdsTooltip>
73
73
  <UIcon name="i-lucide-chevron-down" class="size-4 shrink-0 text-base" :class="chevronClass" />
74
74
  </button>
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  AdsSelectItem — item da lista (Figma: _Dropdown Item). Peça interna do AdsSelect.
3
- Seleção simples: selecionado ganha fundo azul claro e título em negrito.
4
- Checkbox: caixa azul à esquerda; selecionado deixa o título em negrito.
3
+ Selecionado (simples e checkbox): título 14 bold em text/primary. O Figma pede esse negrito.
4
+ O texto não muda de caixa: marcar não deixa o rótulo em maiúscula.
5
5
  -->
6
6
  <template>
7
7
  <button
@@ -43,7 +43,7 @@
43
43
  wing="down"
44
44
  align="start"
45
45
  >
46
- <span class="block min-w-0 truncate text-sm leading-[1.3]" :class="titleClass">
46
+ <span class="block min-w-0 truncate text-sm leading-[1.3] normal-case" :class="titleClass" style="text-transform: none">
47
47
  {{ displayLabel }}
48
48
  </span>
49
49
  </AdsTooltip>
@@ -21,7 +21,7 @@
21
21
  class="size-[var(--ads-side-badge)] shrink-0 rounded-full bg-[var(--ads-funcional-opportunity-200)]"
22
22
  aria-hidden="true"
23
23
  />
24
- <AdsPill v-if="item.pill" size="sm" tone="secondary" status="new" :label="item.pill" />
24
+ <AdsPill v-if="item.pill" size="sm" variant="soft" color="new" :label="item.pill" />
25
25
  <UIcon
26
26
  v-if="item.children?.length"
27
27
  name="i-lucide-chevron-down"
@@ -40,7 +40,7 @@
40
40
  >
41
41
  <UIcon :name="child.icon || 'i-lucide-sun'" class="size-4 shrink-0 text-ads-neutro-escuro-500" />
42
42
  <span class="line-clamp-2 min-w-0 flex-1 text-xs font-bold leading-[1.2] text-[var(--ads-text-secondary)]">{{ child.label }}</span>
43
- <AdsPill v-if="child.pill" size="sm" tone="secondary" status="new" :label="child.pill" />
43
+ <AdsPill v-if="child.pill" size="sm" variant="soft" color="new" :label="child.pill" />
44
44
  </component>
45
45
  </template>
46
46
  </nav>
@@ -3,7 +3,7 @@
3
3
  v-if="hasTrigger"
4
4
  arrow
5
5
  :delay-duration="delayDuration"
6
- :content="{ side: 'top', align: 'center', sideOffset: 4 }"
6
+ :content="{ side: 'top', align: 'center', sideOffset: 4, arrowPadding }"
7
7
  :ui="tooltipUi"
8
8
  >
9
9
  <slot />
@@ -36,6 +36,9 @@ withDefaults(
36
36
  const slots = useSlots();
37
37
  const hasTrigger = computed(() => Boolean(slots.default));
38
38
 
39
+ /** Igual a `--ads-tooltip-radius`. Sem isso, a seta no canto fica sobre a curva e solta do balão. */
40
+ const arrowPadding = 12;
41
+
39
42
  const tooltipUi = {
40
43
  content:
41
44
  "z-[70] rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-small-padding)] shadow-[var(--ads-shadow-level-1)] ring-0",
@@ -1,7 +1,12 @@
1
1
  <template>
2
- <nav :aria-label="ariaLabel">
3
- <!-- Stepper Simples: barras horizontais -->
4
- <div v-if="variant === 'simple'" class="flex items-start gap-4" role="list">
2
+ <nav :aria-label="ariaLabel" class="w-full min-w-0 max-w-full">
3
+ <!-- Stepper Simples: barras horizontais. A faixa rola se os rótulos não cabem. -->
4
+ <div
5
+ v-if="variant === 'simple'"
6
+ ref="scroller"
7
+ class="overflow-x-auto overscroll-x-contain p-1 [scrollbar-width:thin] [scrollbar-color:var(--ads-border-subtle)_transparent]"
8
+ >
9
+ <div class="flex w-max min-w-full items-start gap-4" role="list">
5
10
  <component
6
11
  :is="clickable ? 'button' : 'div'"
7
12
  v-for="(step, index) in steps"
@@ -11,7 +16,7 @@
11
16
  :aria-current="index === modelValue ? 'step' : undefined"
12
17
  :aria-label="step.label ? `${step.label} — ${stepAriaState(index)}` : `Passo ${index + 1} — ${stepAriaState(index)}`"
13
18
  :disabled="clickable ? index > modelValue && !allowForward : undefined"
14
- class="flex min-w-0 flex-1 flex-col items-start gap-2 rounded-[var(--ads-radius-sm)] text-left enabled:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ads-border-focused)] focus-visible:ring-offset-2"
19
+ class="flex min-w-max flex-1 flex-col items-start gap-2 rounded-[var(--ads-radius-sm)] text-left enabled:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ads-border-focused)] focus-visible:ring-offset-2"
15
20
  @click="onStepClick(index)"
16
21
  >
17
22
  <span
@@ -20,16 +25,17 @@
20
25
  />
21
26
  <span
22
27
  v-if="showLabels && step.label"
23
- class="w-full truncate text-[length:var(--ads-font-size-xxs)] leading-[1.3] transition-colors"
28
+ class="whitespace-nowrap text-[length:var(--ads-font-size-xxs)] leading-[1.3] transition-colors"
24
29
  :class="simpleLabelClass(index)"
25
30
  >
26
31
  {{ step.label }}
27
32
  </span>
28
33
  </component>
34
+ </div>
29
35
  </div>
30
36
 
31
37
  <!-- Stepper Visual vertical: círculo à esquerda, título e descrição à direita -->
32
- <div v-else-if="orientation === 'vertical'" class="flex flex-col items-start" role="list">
38
+ <div v-else-if="orientation === 'vertical'" class="flex w-full min-w-0 flex-col items-start" role="list">
33
39
  <component
34
40
  :is="clickable ? 'button' : 'div'"
35
41
  v-for="(step, index) in steps"
@@ -61,7 +67,7 @@
61
67
 
62
68
  <span
63
69
  v-if="showLabels && (step.label || step.description)"
64
- class="flex min-w-0 flex-1 flex-col gap-0.5 leading-[1.3]"
70
+ class="flex min-w-0 flex-1 flex-col gap-0.5 break-words leading-[1.3]"
65
71
  :class="{ 'pt-9': index > 0 }"
66
72
  >
67
73
  <span
@@ -82,8 +88,13 @@
82
88
  </component>
83
89
  </div>
84
90
 
85
- <!-- Stepper Visual: círculos com ícone ou número -->
86
- <div v-else class="flex items-start gap-2" role="list">
91
+ <!-- Stepper Visual: círculos com ícone ou número. A faixa rola se os passos não cabem. -->
92
+ <div
93
+ v-else
94
+ ref="scroller"
95
+ class="overflow-x-auto overscroll-x-contain p-1 [scrollbar-width:thin] [scrollbar-color:var(--ads-border-subtle)_transparent]"
96
+ >
97
+ <div class="flex w-max min-w-full items-start gap-2" role="list">
87
98
  <template v-for="(step, index) in steps" :key="index">
88
99
  <!-- Conector: centrado no círculo de 48px -->
89
100
  <span
@@ -139,10 +150,14 @@
139
150
  </component>
140
151
  </template>
141
152
  </div>
153
+ </div>
142
154
  </nav>
143
155
  </template>
144
156
 
145
157
  <script setup lang="ts">
158
+ import { nextTick, onBeforeUnmount, onMounted, useTemplateRef, watch } from "vue";
159
+ import { bindTabWheel } from "./ads-tab-scroll";
160
+
146
161
  export interface AdsStepperStep {
147
162
  /** Rótulo exibido abaixo da barra (Stepper Simples) ou do círculo (Stepper Visual). */
148
163
  label?: string;
@@ -184,6 +199,46 @@ const props = withDefaults(
184
199
 
185
200
  const modelValue = defineModel<number>({ default: 0 });
186
201
 
202
+ const scroller = useTemplateRef<HTMLElement>("scroller");
203
+ let unbindWheel: (() => void) | undefined;
204
+
205
+ function bindWheel() {
206
+ unbindWheel?.();
207
+ unbindWheel = scroller.value ? bindTabWheel(scroller.value) : undefined;
208
+ }
209
+
210
+ /** Traz o passo atual para a área visível quando a faixa está rolando. */
211
+ function revealCurrent() {
212
+ nextTick(() => {
213
+ const el = scroller.value;
214
+ const current = el?.querySelector<HTMLElement>('[aria-current="step"]');
215
+ if (!el || !current) return;
216
+ const box = el.getBoundingClientRect();
217
+ const step = current.getBoundingClientRect();
218
+ const styles = getComputedStyle(el);
219
+ const left = box.left + (Number.parseFloat(styles.paddingLeft) || 0);
220
+ const right = box.right - (Number.parseFloat(styles.paddingRight) || 0);
221
+ if (step.left < left) el.scrollLeft -= left - step.left;
222
+ else if (step.right > right) el.scrollLeft += step.right - right;
223
+ });
224
+ }
225
+
226
+ onMounted(() => {
227
+ bindWheel();
228
+ revealCurrent();
229
+ });
230
+
231
+ onBeforeUnmount(() => unbindWheel?.());
232
+
233
+ watch(modelValue, revealCurrent);
234
+ watch(
235
+ () => [props.variant, props.orientation, props.steps.length] as const,
236
+ () => nextTick(() => {
237
+ bindWheel();
238
+ revealCurrent();
239
+ }),
240
+ );
241
+
187
242
  const emit = defineEmits<{
188
243
  "update:modelValue": [step: number];
189
244
  }>();
@@ -154,6 +154,8 @@ const tableUi = computed(() => {
154
154
  stickyHeader: props.sticky === true || props.sticky === "header",
155
155
  pinnedEdge: props.pinnedEdge,
156
156
  });
157
+ // Marca para o CSS do AdsCard alinhar a primeira coluna. Fora do card, não faz nada.
158
+ base.root = `${base.root} ads-table`.trim();
157
159
  if (!slots.expanded) {
158
160
  // Árvore via getSubRows: o UTable sempre desenha a linha de detalhe da linha aberta.
159
161
  base.tbody = `${base.tbody} [&>tr[data-slot=tr]:not([data-selectable])]:hidden`;
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <UTabs
3
+ ref="tabs"
3
4
  v-model="model"
4
5
  variant="link"
5
6
  color="primary"
@@ -19,8 +20,9 @@
19
20
 
20
21
  <script setup lang="ts" generic="T extends string | number">
21
22
  import type { TabsItem } from "@nuxt/ui";
22
- import { computed, useSlots } from "vue";
23
+ import { computed, nextTick, onBeforeUnmount, onMounted, useSlots, useTemplateRef, watch } from "vue";
23
24
  import { adsLinkTabsUi } from "../theme/ads-theme";
25
+ import { bindTabWheel, revealActiveTab } from "./ads-tab-scroll";
24
26
 
25
27
  const props = withDefaults(
26
28
  defineProps<{
@@ -48,4 +50,22 @@ const ui = computed(() => ({
48
50
  .join(" "),
49
51
  list: [adsLinkTabsUi.list, props.listClass].filter(Boolean).join(" "),
50
52
  }));
53
+
54
+ const tabs = useTemplateRef<{ $el?: HTMLElement }>("tabs");
55
+ let unbindWheel: (() => void) | undefined;
56
+
57
+ function reveal() {
58
+ nextTick(() => revealActiveTab(tabs.value?.$el));
59
+ }
60
+
61
+ onMounted(() => {
62
+ const list = tabs.value?.$el?.querySelector<HTMLElement>('[role="tablist"]');
63
+ if (list) unbindWheel = bindTabWheel(list);
64
+ reveal();
65
+ });
66
+
67
+ onBeforeUnmount(() => unbindWheel?.());
68
+
69
+ watch(model, reveal);
70
+ watch(() => props.items, reveal);
51
71
  </script>
@@ -5,12 +5,18 @@
5
5
  role="status"
6
6
  >
7
7
  <div class="flex min-w-0 items-center gap-3">
8
- <UIcon
9
- :name="statusIcon"
10
- class="size-[var(--ads-toast-status-icon)] shrink-0"
11
- :class="[statusIconClass, status === 'loading' ? 'animate-spin' : '']"
12
- aria-hidden="true"
13
- />
8
+ <span
9
+ v-if="showIcon"
10
+ class="inline-flex shrink-0 items-center justify-center"
11
+ :style="statusIconBox"
12
+ >
13
+ <UIcon
14
+ :name="statusIcon"
15
+ class="ads-toast-icon size-full"
16
+ :class="[statusIconClass, status === 'loading' ? 'animate-spin' : '']"
17
+ aria-hidden="true"
18
+ />
19
+ </span>
14
20
  <div class="min-w-0">
15
21
  <p class="text-[length:var(--ads-toast-status-title-size)] leading-[1.3] font-bold">{{ title || resolvedMessage }}</p>
16
22
  <p v-if="subtitle" class="text-[length:var(--ads-toast-status-subtitle-size)] leading-[1.1]">{{ subtitle }}</p>
@@ -33,16 +39,35 @@
33
39
  role="status"
34
40
  >
35
41
  <div class="flex min-w-0 flex-1 basis-full items-start gap-2 sm:basis-auto">
36
- <UIcon
37
- :name="resolvedIcon"
38
- class="size-[var(--ads-toast-icon)] shrink-0"
39
- :class="iconClass"
40
- aria-hidden="true"
41
- />
42
+ <span
43
+ v-if="showIcon"
44
+ class="inline-flex shrink-0 items-center justify-center"
45
+ :style="bannerIconBox"
46
+ >
47
+ <UIcon
48
+ :name="resolvedIcon"
49
+ class="ads-toast-icon size-full"
50
+ :class="iconClass"
51
+ aria-hidden="true"
52
+ />
53
+ </span>
42
54
  <div class="min-w-0 flex-1">
43
55
  <slot>
44
56
  <p class="text-[length:var(--ads-toast-font-size)] [font-weight:var(--ads-toast-weight)] leading-[1.3] text-[var(--ads-toast-text)]">
45
- {{ resolvedMessage }}
57
+ {{ resolvedMessage }}<button
58
+ v-if="actionLabel"
59
+ type="button"
60
+ class="ms-1 inline-flex items-baseline gap-1 font-normal text-[var(--ads-text-brand)] underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
61
+ @click="emit('action')"
62
+ >
63
+ {{ actionLabel }}
64
+ <UIcon
65
+ v-if="actionIcon"
66
+ :name="actionIcon"
67
+ class="ads-icon-xxs size-[var(--ads-space-xxs)] shrink-0 self-center"
68
+ aria-hidden="true"
69
+ />
70
+ </button>
46
71
  </p>
47
72
  <p
48
73
  v-if="description"
@@ -54,21 +79,8 @@
54
79
  </slot>
55
80
  </div>
56
81
  </div>
57
- <div
58
- v-if="actionLabel || closable"
59
- class="ml-auto flex shrink-0 items-center gap-[var(--ads-toast-gap)]"
60
- >
61
- <button
62
- v-if="actionLabel"
63
- type="button"
64
- class="text-[length:var(--ads-toast-font-size)] leading-[1.3] font-bold underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2"
65
- :class="actionTextClass"
66
- @click="emit('action')"
67
- >
68
- {{ actionLabel }}
69
- </button>
82
+ <div v-if="closable" class="ml-auto flex shrink-0 items-center">
70
83
  <button
71
- v-if="closable"
72
84
  type="button"
73
85
  class="flex size-[18px] shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] text-[var(--ads-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-primary)]"
74
86
  aria-label="Fechar"
@@ -98,11 +110,17 @@ const props = withDefaults(
98
110
  description?: string;
99
111
  title?: string;
100
112
  subtitle?: string;
101
- icon?: string;
113
+ /**
114
+ * Ícone Lucide. Sem valor, segue o status.
115
+ * `false` tira o ícone do DOM, sem o vão do token.
116
+ */
117
+ icon?: string | false;
102
118
  /** Quando falso, o aviso permanece sem a ação de fechar. */
103
119
  closable?: boolean;
104
- /** Rótulo da ação em link. Sem valor, esconde o link. */
120
+ /** Rótulo da ação no fim da frase. Sem valor, esconde a ação. */
105
121
  actionLabel?: string;
122
+ /** Ícone Lucide da ação, como `i-lucide-arrow-up-right`. Sem valor, a ação é só texto. */
123
+ actionIcon?: string;
106
124
  }>(),
107
125
  {
108
126
  status: "error",
@@ -115,6 +133,7 @@ const props = withDefaults(
115
133
  icon: undefined,
116
134
  closable: true,
117
135
  actionLabel: undefined,
136
+ actionIcon: undefined,
118
137
  },
119
138
  );
120
139
 
@@ -139,16 +158,14 @@ const iconClass = computed(() => {
139
158
  return "text-[var(--ads-toast-error-icon)]";
140
159
  });
141
160
 
142
- const actionTextClass = computed(() => {
143
- if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
144
- if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-warning-icon)]";
145
- if (props.status === "neutral") return "text-[var(--ads-toast-neutral-icon)]";
146
- if (props.status === "loading") return "text-[var(--ads-toast-primary-icon)]";
147
- return "text-[var(--ads-toast-error-icon)]";
148
- });
161
+ const showIcon = computed(() => props.icon !== false);
162
+
163
+ /** Caixa do token. O CSS unlayered do Iconify não define o tamanho: a classe .ads-toast-icon ocupa a caixa. */
164
+ const bannerIconBox = { width: "var(--ads-toast-icon)", height: "var(--ads-toast-icon)", "--ads-toast-icon-size": "var(--ads-toast-icon)" };
165
+ const statusIconBox = { width: "var(--ads-toast-status-icon)", height: "var(--ads-toast-status-icon)", "--ads-toast-icon-size": "var(--ads-toast-status-icon)" };
149
166
 
150
167
  const resolvedIcon = computed(() => {
151
- if (props.icon) return props.icon;
168
+ if (typeof props.icon === "string" && props.icon) return props.icon;
152
169
  if (props.status === "success") return "i-lucide-circle-check";
153
170
  if (props.status === "warning") return "i-lucide-triangle-alert";
154
171
  if (props.status === "attention") return "i-lucide-circle-alert";
@@ -4,7 +4,7 @@
4
4
  arrow
5
5
  :delay-duration="delayDuration"
6
6
  :disabled="disabled"
7
- :content="{ side, align, sideOffset: 8 }"
7
+ :content="{ side, align, sideOffset: 8, arrowPadding }"
8
8
  :ui="tooltipUi"
9
9
  >
10
10
  <slot />
@@ -65,6 +65,9 @@ const side = computed(() => {
65
65
  return "top" as const;
66
66
  });
67
67
 
68
+ /** Igual a `--ads-tooltip-radius`. Sem isso, a seta no canto fica sobre a curva e solta do balão. */
69
+ const arrowPadding = 12;
70
+
68
71
  const tooltipUi = {
69
72
  content:
70
73
  "z-[70] h-auto max-w-[328px] rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-padding-x)] shadow-[var(--ads-shadow-level-1)] ring-0",
@@ -0,0 +1,44 @@
1
+ /** Rola só o ancestral da faixa. Para no limite do componente para não mover a página. */
2
+ function scrollParent(el: HTMLElement, boundary: HTMLElement): HTMLElement | null {
3
+ let node = el.parentElement;
4
+ while (node) {
5
+ const overflow = getComputedStyle(node).overflowX;
6
+ if (overflow === "auto" || overflow === "scroll") return node;
7
+ if (node === boundary) return null;
8
+ node = node.parentElement;
9
+ }
10
+ return null;
11
+ }
12
+
13
+ /** Traz a aba ativa para a área visível quando a faixa está rolando. */
14
+ export function revealActiveTab(scope: HTMLElement | null | undefined) {
15
+ if (!scope) return;
16
+ const active = scope.querySelector<HTMLElement>('[role="tab"][data-state="active"]');
17
+ if (!active) return;
18
+ const scroller = scrollParent(active, scope);
19
+ if (!scroller) return;
20
+
21
+ const scrollerBox = scroller.getBoundingClientRect();
22
+ const tabBox = active.getBoundingClientRect();
23
+ const styles = getComputedStyle(scroller);
24
+ const left = scrollerBox.left + (Number.parseFloat(styles.paddingLeft) || 0);
25
+ const right = scrollerBox.right - (Number.parseFloat(styles.paddingRight) || 0);
26
+
27
+ if (tabBox.left < left) scroller.scrollLeft -= left - tabBox.left;
28
+ else if (tabBox.right > right) scroller.scrollLeft += tabBox.right - right;
29
+ }
30
+
31
+ /**
32
+ * Com a barra escondida, a roda do mouse em cima da faixa rola as abas.
33
+ * Se a faixa cabe, o evento segue para a página.
34
+ */
35
+ export function bindTabWheel(el: HTMLElement) {
36
+ const onWheel = (event: WheelEvent) => {
37
+ if (el.scrollWidth <= el.clientWidth) return;
38
+ if (event.shiftKey || Math.abs(event.deltaX) > Math.abs(event.deltaY)) return;
39
+ el.scrollLeft += event.deltaY;
40
+ event.preventDefault();
41
+ };
42
+ el.addEventListener("wheel", onWheel, { passive: false });
43
+ return () => el.removeEventListener("wheel", onWheel);
44
+ }
@@ -155,13 +155,14 @@ export const adsInputDateTheme = {
155
155
  * Tabs link ADS.
156
156
  * Lista 39px, itens no tamanho do texto, faixa inferior 1px #C1C7D0.
157
157
  * Inativo: Inter 14 medium, #505F79. Ativo: bold, #061938, risco 4px #006FF7.
158
+ * A linha é sombra interna: a lista rola na horizontal e o risco de 4px fica dentro dela.
158
159
  */
159
160
  export const adsLinkTabsUi = {
160
- root: "items-start",
161
- list: "h-[var(--ads-tabs-height)] w-full items-start self-stretch border-b border-[var(--ads-tabs-border)] py-0 px-0",
161
+ root: "w-full min-w-0 items-start",
162
+ list: "h-[var(--ads-tabs-height)] w-full min-w-0 items-start self-stretch overflow-x-auto overscroll-x-contain !mb-0 !border-0 py-0 px-0 shadow-[inset_0_-1px_0_var(--ads-tabs-border)] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
162
163
  trigger:
163
- "h-[var(--ads-tabs-height)] grow-0 px-[var(--ads-tabs-padding-x)] py-0 text-[length:var(--ads-tabs-font-size)] [font-weight:var(--ads-tabs-weight)] leading-[1.3] text-[var(--ads-tabs-inactive)] data-[state=inactive]:text-[var(--ads-tabs-inactive)] data-[state=active]:font-bold data-[state=active]:text-[var(--ads-tabs-active)]",
164
- indicator: "-bottom-px h-[var(--ads-tabs-indicator)] rounded-none bg-[var(--ads-tabs-indicator-color)]",
164
+ "h-[var(--ads-tabs-height)] shrink-0 grow-0 px-[var(--ads-tabs-padding-x)] py-0 text-[length:var(--ads-tabs-font-size)] [font-weight:var(--ads-tabs-weight)] leading-[1.3] text-[var(--ads-tabs-inactive)] data-[state=inactive]:text-[var(--ads-tabs-inactive)] data-[state=active]:font-bold data-[state=active]:text-[var(--ads-tabs-active)] focus-visible:-outline-offset-3",
165
+ indicator: "!bottom-0 h-[var(--ads-tabs-indicator)] rounded-none bg-[var(--ads-tabs-indicator-color)]",
165
166
  } as const;
166
167
 
167
168
  /**
@@ -172,13 +173,13 @@ export const adsLinkTabsUi = {
172
173
  * Ícone opcional de 24px à esquerda; subtítulo opcional em 12 regular secundário, abaixo do rótulo.
173
174
  */
174
175
  export const adsSegmentedTabsUi = {
175
- root: "!w-auto shrink-0",
176
+ root: "w-max max-w-none shrink-0",
176
177
  // Altura mínima do Figma; com ícone ou subtítulo, a aba cresce (8px em cima e embaixo).
177
- list: "!h-auto !min-h-[var(--ads-segmented-height)] !w-auto !self-start !items-stretch !gap-1 !rounded-[var(--ads-segmented-radius)] !border-0 !bg-[var(--ads-segmented-track)] !p-1",
178
+ list: "!h-auto !min-h-[var(--ads-segmented-height)] !w-max !self-start !items-stretch !gap-1 !rounded-[var(--ads-segmented-radius)] !border-0 !bg-[var(--ads-segmented-track)] !p-1",
178
179
  leadingIcon: "!size-6 shrink-0",
179
180
  label: "flex flex-col items-start gap-0.5 text-left whitespace-nowrap",
180
181
  trigger:
181
- "!h-auto !min-h-[var(--ads-segmented-item-height)] !grow-0 !gap-3 !rounded-[var(--ads-segmented-radius)] !px-[var(--ads-segmented-padding-x)] !py-2 !text-[length:var(--ads-segmented-font-size)] !font-normal !leading-[var(--ads-line-height-sm)] !text-[var(--ads-segmented-text)] data-[state=inactive]:!text-[var(--ads-segmented-text)] data-[state=active]:!font-bold data-[state=active]:!text-[var(--ads-segmented-active-text)]",
182
+ "!h-auto !min-h-[var(--ads-segmented-item-height)] !shrink-0 !grow-0 !gap-3 !rounded-[var(--ads-segmented-radius)] !px-[var(--ads-segmented-padding-x)] !py-2 !text-[length:var(--ads-segmented-font-size)] !font-normal !leading-[var(--ads-line-height-sm)] !text-[var(--ads-segmented-text)] data-[state=inactive]:!text-[var(--ads-segmented-text)] data-[state=active]:!font-bold data-[state=active]:!text-[var(--ads-segmented-active-text)]",
182
183
  indicator:
183
184
  "!rounded-[var(--ads-segmented-radius)] !bg-[var(--ads-segmented-active-bg)] !shadow-[var(--ads-shadow-level-1)]",
184
185
  } as const;
@@ -422,7 +422,7 @@ export const componentTokenCatalog: readonly TokenComponent[] = [
422
422
  section: "broadcast",
423
423
  catalog: "pill",
424
424
  label: "Pill broadcast",
425
- note: "Variante broadcast do AdsPill (variant=\"broadcast\"). O AdsBroadcast é um atalho para ela.",
425
+ note: "AdsPill com broadcast. O AdsBroadcast é um atalho para ela.",
426
426
  fields: [
427
427
  length("--ads-broadcast-height", "Altura", "Medida", "24px"),
428
428
  length("--ads-broadcast-padding-x", "Padding horizontal", "Medida", "8px"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ads-nuxt",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "MIT",
5
5
  "description": "Alquimia Design System para Nuxt, construído sobre Nuxt UI",
6
6
  "repository": {