ads-nuxt 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -468,8 +468,7 @@ Opções (`OverlayLoadingOptions`):
468
468
  | `actionLabel`, `onAction` | rótulo e callback de ação |
469
469
  | `actionIcon` | ícone Lucide da ação (padrão: `i-lucide-refresh-cw` só no erro) |
470
470
  | `secondaryActionLabel`, `secondaryActionIcon`, `onSecondaryAction` | segunda ação (unfilled); sem callback, fecha o overlay |
471
- | `onUserClose` | callback ao usuário fechar |
472
- | `closableVariants`| `("info" \| "success" \| "error" \| "warning")[]` — variantes que o usuário pode fechar |
471
+ | `onUserClose` | callback quando uma ação de fechar é acionada |
473
472
 
474
473
  ## Utilitários
475
474
 
@@ -281,13 +281,17 @@
281
281
  --ads-modal-border: #c1c7d0;
282
282
  --ads-modal-title: #061938;
283
283
  --ads-modal-body: #505f79;
284
- --ads-feature-width: 396px;
285
- --ads-feature-gap: 16px;
284
+ --ads-feature-width: 390px;
285
+ --ads-feature-padding: 24px;
286
+ --ads-feature-gap: 24px;
286
287
  --ads-feature-icon-box: 48px;
287
288
  --ads-feature-title-size: 16px;
288
289
  --ads-feature-body-size: 14px;
289
290
  --ads-feature-title: #061938;
290
291
  --ads-feature-body: #505f79;
292
+ --ads-feature-accent-blue: #d9eaff;
293
+ --ads-feature-accent-green: #e8f8ef;
294
+ --ads-feature-accent-green-icon: #16a34a;
291
295
  --ads-card-padding: 16px;
292
296
  --ads-card-radius: 12px;
293
297
  --ads-card-radius-sm: 8px;
@@ -1,22 +1,56 @@
1
1
  <template>
2
- <AdsTooltip :description="text" :show-title="false" class="inline-flex shrink-0">
3
- <!-- span focável, e não button: o card inteiro pode ser um botão -->
4
- <span
5
- tabindex="0"
6
- role="img"
7
- class="inline-flex size-4 items-center justify-center rounded-[var(--ads-radius-circular)] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
8
- :aria-label="text"
9
- >
10
- <UIcon name="i-lucide-info" class="size-4" aria-hidden="true" />
11
- </span>
12
- </AdsTooltip>
2
+ <span class="inline-flex shrink-0" :class="align === 'end' ? 'order-last ml-auto' : undefined">
3
+ <AdsTooltip :description="text" :show-title="false" class="inline-flex">
4
+ <!-- span focável, e não button: o card inteiro pode ser um botão -->
5
+ <span
6
+ tabindex="0"
7
+ role="img"
8
+ class="inline-flex size-4 items-center justify-center rounded-[var(--ads-radius-circular)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
9
+ :class="colorClass"
10
+ :aria-label="text"
11
+ >
12
+ <UIcon :name="icon" class="size-4" aria-hidden="true" />
13
+ </span>
14
+ </AdsTooltip>
15
+ </span>
13
16
  </template>
14
17
 
15
18
  <script setup lang="ts">
19
+ import { computed } from "vue";
16
20
  import AdsTooltip from "./AdsTooltip.vue";
17
21
 
18
- /** Ícone de informação dos cards (Info do Figma). O texto abre no hover e no foco. */
19
- defineProps<{
20
- text: string;
21
- }>();
22
+ /** Cor do ícone do balão. `secondary` é o cinza do Figma. */
23
+ export type AdsCardHintColor = "secondary" | "primary" | "brand" | "success" | "attention" | "warning" | "new" | "ai";
24
+
25
+ /** `start` fica junto do título. `end` encosta no fim da linha, à direita. */
26
+ export type AdsCardHintAlign = "start" | "end";
27
+
28
+ const props = withDefaults(
29
+ defineProps<{
30
+ /** Texto do balão. Também nomeia o ícone para leitor de tela. */
31
+ text: string;
32
+ /** Ícone Lucide. Padrão: informação. */
33
+ icon?: string;
34
+ color?: AdsCardHintColor;
35
+ align?: AdsCardHintAlign;
36
+ }>(),
37
+ {
38
+ icon: "i-lucide-info",
39
+ color: "secondary",
40
+ align: "start",
41
+ },
42
+ );
43
+
44
+ const colorClasses: Record<AdsCardHintColor, string> = {
45
+ secondary: "text-[var(--ads-text-secondary)]",
46
+ primary: "text-[var(--ads-text-primary)]",
47
+ brand: "text-[var(--ads-text-brand)]",
48
+ success: "text-[var(--ads-status-success-800)]",
49
+ attention: "text-[var(--ads-status-attention-800)]",
50
+ warning: "text-[var(--ads-status-warning-800)]",
51
+ new: "text-[var(--ads-status-new-800)]",
52
+ ai: "text-[var(--ads-text-ai)]",
53
+ };
54
+
55
+ const colorClass = computed(() => colorClasses[props.color]);
22
56
  </script>
@@ -1,24 +1,33 @@
1
1
  <!--
2
- AdsFeatureCard — atalho de módulo sobre o AdsCard. A casca (borda, raio, fundo, hover, foco)
3
- é a do AdsCard; aqui só muda o conteúdo: ícone, título, descrição, seta e rodapé.
2
+ AdsFeatureCard — atalho de módulo sobre o AdsCard. A casca (borda, raio, fundo, foco)
3
+ é a do AdsCard. O hover é próprio: título e seta vão para a cor da variação e o fundo
4
+ da pílula escurece. O conteúdo é pílula, título, descrição, seta e ações.
4
5
  -->
5
6
  <template>
6
7
  <AdsCard
7
- :as="to ? NuxtLink : 'button'"
8
- v-bind="rootAttrs"
9
- :disabled="disabled"
10
- :hoverable="hoverable"
8
+ :as="shellIsButton ? (to ? NuxtLink : 'button') : 'div'"
9
+ v-bind="shellIsButton ? interactiveAttrs : {}"
10
+ :disabled="shellIsButton ? disabled : undefined"
11
+ :hoverable="false"
11
12
  class="group w-[var(--ads-feature-width)] max-w-full"
12
13
  :style="cardStyle"
13
- @click="onClick"
14
+ @click="onShellClick"
14
15
  >
15
16
  <span class="flex h-full w-full flex-col gap-[var(--ads-feature-gap)]">
16
- <span class="flex items-start gap-3">
17
+ <component
18
+ :is="mainTag"
19
+ v-bind="hasActions ? interactiveAttrs : {}"
20
+ :type="mainTag === 'button' ? 'button' : undefined"
21
+ :disabled="mainTag === 'button' ? disabled : undefined"
22
+ class="flex w-full min-w-0 items-start gap-3 text-left"
23
+ :class="hasActions ? mainControlClass : undefined"
24
+ @click="onMainClick"
25
+ >
17
26
  <span
18
27
  class="grid size-[var(--ads-feature-icon-box)] shrink-0 place-items-center rounded-[var(--ads-radius-sm)]"
19
28
  :class="iconBoxClass"
20
29
  >
21
- <UIcon :name="icon" class="size-6" />
30
+ <UIcon :name="icon" class="size-5" />
22
31
  </span>
23
32
  <span class="min-w-0 flex-1">
24
33
  <span class="block text-[length:var(--ads-feature-title-size)] font-bold leading-[1.3]" :class="titleClass">
@@ -43,9 +52,9 @@
43
52
  v-if="!disabled"
44
53
  name="i-lucide-arrow-right"
45
54
  class="size-5 shrink-0 text-[var(--ads-border-icon-support)] transition-colors duration-150 ease-out"
46
- :class="{ 'group-hover:text-[var(--ads-text-secondary)] group-focus-visible:text-[var(--ads-text-secondary)]': hoverable }"
55
+ :class="accentHoverClass"
47
56
  />
48
- </span>
57
+ </component>
49
58
 
50
59
  <AdsPill
51
60
  v-if="disabled"
@@ -54,6 +63,20 @@
54
63
  status="blocked"
55
64
  label="Em breve"
56
65
  />
66
+ <span v-else-if="hasActions" class="mt-auto flex flex-wrap items-center gap-x-[var(--ads-space-xs)] gap-y-2">
67
+ <component
68
+ :is="action.to ? NuxtLink : 'button'"
69
+ v-for="(action, index) in actions"
70
+ :key="`${action.label}-${index}`"
71
+ :to="action.to"
72
+ :type="action.to ? undefined : 'button'"
73
+ class="inline-flex items-center gap-1 rounded-[var(--ads-radius-xsm)] bg-[var(--ads-surface-main)] px-[var(--ads-space-nano)] py-[var(--ads-space-quark)] text-[length:var(--ads-font-size-xxxs)] font-medium leading-[1.2] text-[var(--ads-text-secondary)] transition-colors hover:text-[var(--ads-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
74
+ @click="onActionClick($event, action)"
75
+ >
76
+ <UIcon v-if="action.icon" :name="action.icon" class="size-3.5 shrink-0" />
77
+ {{ action.label }}
78
+ </component>
79
+ </span>
57
80
  <span v-else-if="hasFooter" class="mt-auto flex flex-wrap items-center gap-2">
58
81
  <AdsPill
59
82
  v-for="badge in badges"
@@ -90,7 +113,18 @@ export interface AdsFeatureCardBadge {
90
113
  status?: AdsPillStatus;
91
114
  }
92
115
 
93
- /** Fundo e texto do AdsPill secondary. Primary segue o ícone do próprio card no catálogo. */
116
+ /** Ação do rodapé. Com `to`, vira link; sem ele, continua botão. */
117
+ export interface AdsFeatureCardAction {
118
+ label: string;
119
+ icon?: string;
120
+ to?: RouteLocationRaw;
121
+ }
122
+
123
+ /**
124
+ * Cor da pílula do ícone.
125
+ * primary: fundo `--ads-feature-accent-blue`, ícone da marca.
126
+ * success: fundo `--ads-feature-accent-green`, ícone `--ads-feature-accent-green-icon`.
127
+ */
94
128
  export type AdsFeatureCardColor =
95
129
  | "primary"
96
130
  | "success"
@@ -100,14 +134,15 @@ export type AdsFeatureCardColor =
100
134
  | "blocked"
101
135
  | "ai";
102
136
 
103
- const iconBoxByColor: Record<AdsFeatureCardColor, string> = {
104
- primary: "bg-[var(--ads-button-secondary)] text-[var(--ads-text-brand)]",
105
- success: "bg-[var(--ads-status-success-100)] text-[var(--ads-status-success-800)]",
106
- attention: "bg-[var(--ads-status-attention-100)] text-[var(--ads-status-attention-800)]",
107
- warning: "bg-[var(--ads-status-warning-100)] text-[var(--ads-status-warning-800)]",
108
- new: "bg-[var(--ads-status-new-100)] text-[var(--ads-status-new-800)]",
109
- blocked: "bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]",
110
- ai: "bg-[var(--ads-surface-ai)] text-[var(--ads-text-ai)]",
137
+ /** Fundo e cor da variação. O hover do título e da seta usa `fg`; o fundo da pílula mistura os dois. */
138
+ const iconTone: Record<AdsFeatureCardColor, { bg: string; fg: string }> = {
139
+ primary: { bg: "var(--ads-feature-accent-blue)", fg: "var(--ads-text-brand)" },
140
+ success: { bg: "var(--ads-feature-accent-green)", fg: "var(--ads-feature-accent-green-icon)" },
141
+ attention: { bg: "var(--ads-status-attention-100)", fg: "var(--ads-status-attention-800)" },
142
+ warning: { bg: "var(--ads-status-warning-100)", fg: "var(--ads-status-warning-800)" },
143
+ new: { bg: "var(--ads-status-new-100)", fg: "var(--ads-status-new-800)" },
144
+ blocked: { bg: "var(--ads-status-void-100)", fg: "var(--ads-status-void-800)" },
145
+ ai: { bg: "var(--ads-surface-ai)", fg: "var(--ads-text-ai)" },
111
146
  };
112
147
 
113
148
 
@@ -116,13 +151,15 @@ const props = withDefaults(
116
151
  title: string;
117
152
  description: string;
118
153
  icon: string;
119
- /** Cor da caixa do ícone. O hover é o padrão dos cards, igual para todas as cores. */
154
+ /** Cor da pílula. No hover, título e seta usam essa cor e o fundo da pílula escurece. */
120
155
  color?: AdsFeatureCardColor;
121
156
  /** Vira link. Sem valor, continua botão. */
122
157
  to?: RouteLocationRaw;
123
158
  disabled?: boolean;
124
- /** Hover padrão dos cards (borda e sombra neutras; a seta escurece). false desliga. */
159
+ /** Hover colore título e seta e escurece a pílula. false desliga. */
125
160
  hoverable?: boolean;
161
+ /** Ações do rodapé, cada uma com o próprio clique. A casca deixa de ser o botão. */
162
+ actions?: AdsFeatureCardAction[];
126
163
  badges?: AdsFeatureCardBadge[];
127
164
  footerIcon?: string;
128
165
  footerText?: string;
@@ -132,6 +169,7 @@ const props = withDefaults(
132
169
  to: undefined,
133
170
  disabled: false,
134
171
  hoverable: true,
172
+ actions: undefined,
135
173
  badges: undefined,
136
174
  footerIcon: undefined,
137
175
  footerText: undefined,
@@ -140,8 +178,13 @@ const props = withDefaults(
140
178
 
141
179
  const emit = defineEmits<{
142
180
  click: [event: MouseEvent];
181
+ action: [action: AdsFeatureCardAction, event: MouseEvent];
143
182
  }>();
144
183
 
184
+ const hasActions = computed(() => (props.actions?.length ?? 0) > 0);
185
+ /** Sem ações, o cartão inteiro é o botão. Com ações, só o miolo é, para o rodapé ter cliques próprios. */
186
+ const shellIsButton = computed(() => !hasActions.value);
187
+
145
188
  const hasFooter = computed(
146
189
  () => (props.badges?.length ?? 0) > 0 || Boolean(props.footerText),
147
190
  );
@@ -172,28 +215,50 @@ watch(
172
215
  );
173
216
 
174
217
  /** O link não tem disabled nativo: sai da ordem do Tab e avisa por aria-disabled. */
175
- const rootAttrs = computed(() =>
218
+ const interactiveAttrs = computed(() =>
176
219
  props.to
177
220
  ? { to: props.to, tabindex: props.disabled ? -1 : undefined, "aria-disabled": props.disabled || undefined }
178
221
  : {},
179
222
  );
180
223
 
224
+ const mainTag = computed(() => (hasActions.value ? (props.to ? NuxtLink : "button") : "span"));
225
+
226
+ const mainControlClass =
227
+ "cursor-pointer rounded-[var(--ads-radius-xsm)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)] disabled:cursor-not-allowed aria-disabled:cursor-not-allowed";
228
+
229
+ /** Título e seta. O foco do cartão e o do miolo disparam o mesmo estado. */
230
+ const accentHoverClass = computed(() =>
231
+ props.hoverable && !props.disabled
232
+ ? "group-hover:text-[var(--ads-feature-icon-fg)] group-focus-visible:text-[var(--ads-feature-icon-fg)] group-has-[:focus-visible]:text-[var(--ads-feature-icon-fg)]"
233
+ : "",
234
+ );
235
+
181
236
  /**
182
- * A casca e o hover são os do AdsCard. Aqui só entra o desabilitado sem opacidade,
183
- * porque o conteúdo já troca para as cores terciárias.
237
+ * O AdsCard não aplica o hover de borda. Aqui ficam o padding, as cores da variação
238
+ * e o desabilitado sem opacidade, porque o conteúdo já troca para as cores terciárias.
184
239
  */
185
240
  const cardStyle = computed(() => ({
186
241
  "--ads-card-disabled-opacity": "1",
242
+ "--ads-feature-icon-bg": iconTone[props.color].bg,
243
+ "--ads-feature-icon-fg": iconTone[props.color].fg,
244
+ padding: "var(--ads-feature-padding)",
187
245
  }));
188
246
 
189
247
  const iconBoxClass = computed(() =>
190
248
  props.disabled
191
249
  ? "bg-[var(--ads-button-secondary-disabled)] text-[var(--ads-text-tertiary)]"
192
- : iconBoxByColor[props.color],
250
+ : [
251
+ "bg-[var(--ads-feature-icon-bg)] text-[var(--ads-feature-icon-fg)] transition-colors duration-150 ease-out",
252
+ props.hoverable
253
+ ? "group-hover:bg-[color-mix(in_srgb,var(--ads-feature-icon-bg)_82%,var(--ads-feature-icon-fg))] group-focus-visible:bg-[color-mix(in_srgb,var(--ads-feature-icon-bg)_82%,var(--ads-feature-icon-fg))] group-has-[:focus-visible]:bg-[color-mix(in_srgb,var(--ads-feature-icon-bg)_82%,var(--ads-feature-icon-fg))]"
254
+ : "",
255
+ ],
193
256
  );
194
257
 
195
258
  const titleClass = computed(() =>
196
- props.disabled ? "text-[var(--ads-text-tertiary)]" : "text-[var(--ads-feature-title)]",
259
+ props.disabled
260
+ ? "text-[var(--ads-text-tertiary)]"
261
+ : ["text-[var(--ads-feature-title)] transition-colors duration-150 ease-out", accentHoverClass.value],
197
262
  );
198
263
 
199
264
  const descriptionClass = computed(() =>
@@ -207,4 +272,21 @@ const onClick = (event: MouseEvent) => {
207
272
  }
208
273
  event.preventDefault();
209
274
  };
275
+
276
+ const onShellClick = (event: MouseEvent) => {
277
+ if (shellIsButton.value) onClick(event);
278
+ };
279
+
280
+ const onMainClick = (event: MouseEvent) => {
281
+ if (hasActions.value) onClick(event);
282
+ };
283
+
284
+ const onActionClick = (event: MouseEvent, action: AdsFeatureCardAction) => {
285
+ event.stopPropagation();
286
+ if (props.disabled) {
287
+ event.preventDefault();
288
+ return;
289
+ }
290
+ emit("action", action, event);
291
+ };
210
292
  </script>
@@ -68,6 +68,7 @@ import type { AdsTableSkeletonVariant } from "./AdsTableSkeleton.vue";
68
68
  import {
69
69
  adsHeavyCellSize,
70
70
  buildAdsHeavyTableUi,
71
+ mergeAdsTableUi,
71
72
  type AdsTableBorders,
72
73
  type AdsTableDensity,
73
74
  type AdsTableUi,
@@ -129,11 +130,6 @@ const mergedUi = computed((): AdsTableUi => {
129
130
  borders: props.borders,
130
131
  stickyHeader: props.sticky === true || props.sticky === "header",
131
132
  });
132
- if (!props.ui) return base;
133
- const merged = { ...base };
134
- for (const key of Object.keys(props.ui) as (keyof AdsTableUi)[]) {
135
- merged[key] = `${base[key]} ${props.ui[key] ?? ""}`.trim();
136
- }
137
- return merged;
133
+ return mergeAdsTableUi(base, props.ui);
138
134
  });
139
135
  </script>
@@ -11,9 +11,9 @@
11
11
  <template v-if="type === 'kpi'">
12
12
  <UIcon v-if="icon" :name="icon" class="size-6 shrink-0" :class="iconClass" aria-hidden="true" />
13
13
  <div class="flex min-w-0 flex-1 flex-col items-start gap-2">
14
- <div class="flex min-w-0 items-center gap-2">
14
+ <div class="flex w-full min-w-0 items-center gap-2">
15
15
  <p :class="titleClass">{{ title }}</p>
16
- <AdsCardHint v-if="hint" :text="hint" />
16
+ <AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
17
17
  </div>
18
18
  <span v-if="loading" :class="skeletonClass" class="h-5 w-[140px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
19
19
  <div v-else-if="empty" class="flex min-w-0 items-center gap-2">
@@ -32,7 +32,7 @@
32
32
  <div class="flex w-full min-w-0 items-center gap-1">
33
33
  <UIcon v-if="icon" :name="icon" class="size-4 shrink-0" :class="iconClass" aria-hidden="true" />
34
34
  <p class="min-w-0 truncate font-bold" :class="titleClass">{{ title }}</p>
35
- <AdsCardHint v-if="hint" :text="hint" />
35
+ <AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
36
36
  </div>
37
37
  <span v-if="loading" :class="skeletonClass" class="h-7 w-[72px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
38
38
  <div v-else-if="empty" class="flex min-w-0 items-baseline gap-1">
@@ -49,7 +49,7 @@
49
49
  <template v-else>
50
50
  <div class="flex w-full min-w-0 items-center gap-2">
51
51
  <p class="min-w-0 flex-1" :class="titleClass">{{ title }}</p>
52
- <AdsCardHint v-if="hint" :text="hint" />
52
+ <AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
53
53
  <slot name="actions" />
54
54
  </div>
55
55
 
@@ -102,6 +102,7 @@ import { computed } from "vue";
102
102
  import AdsCardHint from "./AdsCardHint.vue";
103
103
  import AdsCardPeriod from "./AdsCardPeriod.vue";
104
104
  import AdsCardVariation from "./AdsCardVariation.vue";
105
+ import type { AdsCardHintAlign, AdsCardHintColor } from "./AdsCardHint.vue";
105
106
  import type { AdsCardVariationDirection, AdsCardVariationTone } from "./AdsCardVariation.vue";
106
107
  import AdsEmptyState from "./AdsEmptyState.vue";
107
108
 
@@ -118,8 +119,14 @@ const props = withDefaults(
118
119
  title: string;
119
120
  /** Valor principal. */
120
121
  value?: string;
121
- /** Texto do ícone de informação ao lado do título. */
122
+ /** Texto do balão do ícone ao lado do título. Sem ele, o ícone some. */
122
123
  hint?: string;
124
+ /** Ícone Lucide do balão. Padrão: informação. */
125
+ hintIcon?: string;
126
+ /** Cor do ícone do balão. */
127
+ hintColor?: AdsCardHintColor;
128
+ /** `end` encosta o ícone no fim do card, à direita. */
129
+ hintAlign?: AdsCardHintAlign;
123
130
  /** Ícone Lucide: 24px no KPI, 16px na Pendência. */
124
131
  icon?: string;
125
132
  /** Unidade ao lado do número na Pendência, como "pendências". */
@@ -162,6 +169,9 @@ const props = withDefaults(
162
169
  type: "metric",
163
170
  value: undefined,
164
171
  hint: undefined,
172
+ hintIcon: "i-lucide-info",
173
+ hintColor: "secondary",
174
+ hintAlign: "start",
165
175
  icon: undefined,
166
176
  unit: undefined,
167
177
  valueIcon: undefined,
@@ -44,6 +44,7 @@ import AdsTableSkeleton, {
44
44
  import {
45
45
  adsTableCellSize,
46
46
  buildAdsTableUi,
47
+ mergeAdsTableUi,
47
48
  type AdsTableBorders,
48
49
  type AdsTableDensity,
49
50
  type AdsTableUi,
@@ -166,11 +167,6 @@ const tableUi = computed(() => {
166
167
  base.loading = "contents";
167
168
  }
168
169
  }
169
- if (!props.ui) return base;
170
- const merged = { ...base };
171
- for (const key of Object.keys(props.ui) as (keyof AdsTableUi)[]) {
172
- merged[key] = `${base[key]} ${props.ui[key] ?? ""}`.trim();
173
- }
174
- return merged;
170
+ return mergeAdsTableUi(base, props.ui);
175
171
  });
176
172
  </script>
@@ -20,17 +20,7 @@
20
20
  </template>
21
21
 
22
22
  <template #content>
23
- <div class="relative px-10 pt-2 text-center">
24
- <!-- O slot #content substitui o cabeçalho do UModal, então o X fica aqui. -->
25
- <button
26
- v-if="isClosable"
27
- type="button"
28
- class="absolute top-0 right-0 flex size-8 items-center justify-center rounded-[var(--ads-radius-xsm)] text-[var(--ads-text-secondary)] hover:bg-black/5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
29
- aria-label="Fechar"
30
- @click="handleClose"
31
- >
32
- <UIcon name="i-lucide-x" class="size-5" />
33
- </button>
23
+ <div class="px-10 text-center">
34
24
  <div class="mb-4 flex justify-center">
35
25
  <div
36
26
  class="flex aspect-square h-20 items-center justify-center rounded-full"
@@ -107,7 +97,7 @@
107
97
 
108
98
  <script setup lang="ts">
109
99
  import { computed } from "vue";
110
- import type { OverlayLoadingProps, OverlayVariant } from "../types/overlay-loading.types";
100
+ import type { OverlayLoadingProps } from "../types/overlay-loading.types";
111
101
  import AdsButton from "./AdsButton.vue";
112
102
 
113
103
  const emit = defineEmits<{
@@ -129,13 +119,8 @@ const props = withDefaults(defineProps<OverlayLoadingProps>(), {
129
119
  secondaryActionIcon: undefined,
130
120
  onSecondaryAction: undefined,
131
121
  onUserClose: undefined,
132
- closableVariants: () => ["info", "success", "error", "warning"],
133
122
  });
134
123
 
135
- const isClosable = computed(() =>
136
- (props.closableVariants as OverlayVariant[]).includes(props.variant),
137
- );
138
-
139
124
  type Feedback = {
140
125
  icon: string;
141
126
  animation: string;
@@ -13,7 +13,7 @@ export const useOverlayLoading = () => {
13
13
  patch: (props: Record<string, unknown>) => void;
14
14
  } | null = null;
15
15
  /**
16
- * O overlay é destruído ao fechar (destroyOnClose). Fechar pelo X ou pela ação emite `close`
16
+ * O overlay é destruído ao fechar (destroyOnClose). Fechar pela ação emite `close`
17
17
  * direto no useOverlay, sem passar por aqui; chamar close/patch depois disso lança
18
18
  * "Overlay not found". Por isso a referência é limpa quando o overlay fecha, por qualquer caminho.
19
19
  */
@@ -280,13 +280,17 @@
280
280
  "--ads-modal-border": "#c1c7d0",
281
281
  "--ads-modal-title": "#061938",
282
282
  "--ads-modal-body": "#505f79",
283
- "--ads-feature-width": "396px",
284
- "--ads-feature-gap": "16px",
283
+ "--ads-feature-width": "390px",
284
+ "--ads-feature-padding": "24px",
285
+ "--ads-feature-gap": "24px",
285
286
  "--ads-feature-icon-box": "48px",
286
287
  "--ads-feature-title-size": "16px",
287
288
  "--ads-feature-body-size": "14px",
288
289
  "--ads-feature-title": "#061938",
289
290
  "--ads-feature-body": "#505f79",
291
+ "--ads-feature-accent-blue": "#d9eaff",
292
+ "--ads-feature-accent-green": "#e8f8ef",
293
+ "--ads-feature-accent-green-icon": "#16a34a",
290
294
  "--ads-card-padding": "16px",
291
295
  "--ads-card-radius": "12px",
292
296
  "--ads-card-radius-sm": "8px",
@@ -531,13 +531,17 @@ export const componentTokenCatalog: readonly TokenComponent[] = [
531
531
  catalog: "feature-card",
532
532
  label: "Feature card",
533
533
  fields: [
534
- length("--ads-feature-width", "Largura", "Medida", "396px"),
535
- length("--ads-feature-gap", "Espaço", "Medida", "16px"),
534
+ length("--ads-feature-width", "Largura", "Medida", "390px"),
535
+ length("--ads-feature-padding", "Padding", "Medida", "24px"),
536
+ length("--ads-feature-gap", "Espaço", "Medida", "24px"),
536
537
  length("--ads-feature-icon-box", "Caixa do ícone", "Medida", "48px"),
537
538
  length("--ads-feature-title-size", "Fonte do título", "Medida", "16px"),
538
539
  length("--ads-feature-body-size", "Fonte do texto", "Medida", "14px"),
539
540
  color("--ads-feature-title", "Título", "Cores", "#061938"),
540
541
  color("--ads-feature-body", "Texto", "Cores", "#505f79"),
542
+ color("--ads-feature-accent-blue", "Fundo azul", "Pílula", "#d9eaff"),
543
+ color("--ads-feature-accent-green", "Fundo verde", "Pílula", "#e8f8ef"),
544
+ color("--ads-feature-accent-green-icon", "Ícone verde", "Pílula", "#16a34a"),
541
545
  ],
542
546
  },
543
547
  {
@@ -6,9 +6,6 @@ export type OverlayVariant =
6
6
  | "info"
7
7
  | "warning";
8
8
 
9
- /** loading e search bloqueiam a tela até o processo terminar; os demais podem ser fechados. */
10
- export type OverlayClosableVariant = "info" | "success" | "error" | "warning";
11
-
12
9
  export interface OverlayLoadingOptions {
13
10
  title?: string;
14
11
  description?: string;
@@ -26,8 +23,8 @@ export interface OverlayLoadingOptions {
26
23
  secondaryActionIcon?: string;
27
24
  /** Sem valor, a ação secundária fecha o overlay. */
28
25
  onSecondaryAction?: () => void;
26
+ /** Disparado quando uma ação de fechar é acionada. */
29
27
  onUserClose?: () => void;
30
- closableVariants?: OverlayClosableVariant[];
31
28
  }
32
29
 
33
30
  export interface OverlayLoadingProps extends OverlayLoadingOptions {
@@ -13,6 +13,8 @@
13
13
  * Variantes Lista/Grade continuam funcionar mas não são o foco da documentação.
14
14
  */
15
15
 
16
+ import { twMerge } from "tailwind-merge";
17
+
16
18
  /** 14px, entrelinha de leitura. Igual no cabeçalho e na célula. */
17
19
  export const ADS_TABLE_CELL_TEXT =
18
20
  "text-[length:var(--ads-font-size-xxs)] leading-[var(--ads-line-height-md)]";
@@ -44,6 +46,22 @@ export interface AdsTableLook {
44
46
  pinnedEdge?: boolean;
45
47
  }
46
48
 
49
+ /**
50
+ * Junta o ajuste do consumidor ao padrão. A classe do consumidor vence quando as duas
51
+ * definem a mesma propriedade: sem isso, `max-h` e `overflow` do padrão anulam os dele.
52
+ */
53
+ export const mergeAdsTableUi = (
54
+ base: AdsTableUi,
55
+ override?: Partial<AdsTableUi>,
56
+ ): AdsTableUi => {
57
+ if (!override) return base;
58
+ const merged = { ...base };
59
+ for (const key of Object.keys(override) as (keyof AdsTableUi)[]) {
60
+ merged[key] = twMerge(base[key], override[key] ?? "");
61
+ }
62
+ return merged;
63
+ };
64
+
47
65
  export type AdsTableUi = {
48
66
  root: string;
49
67
  base: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ads-nuxt",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "license": "MIT",
5
5
  "description": "Alquimia Design System para Nuxt, construído sobre Nuxt UI",
6
6
  "repository": {
@@ -27,7 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@iconify-json/lucide": "^1.2.104",
30
- "@tanstack/vue-virtual": "^3.13.49"
30
+ "@tanstack/vue-virtual": "^3.13.49",
31
+ "tailwind-merge": "^3.7.0"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "@internationalized/date": "^3.12.4",