ads-nuxt 0.5.1 → 0.6.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 +3 -3
- package/app/assets/css/component-tokens.css +1 -1
- package/app/assets/css/main.css +34 -0
- package/app/components/AdsBroadcast.vue +6 -6
- package/app/components/AdsCard.vue +76 -18
- package/app/components/AdsCardPeriod.vue +16 -14
- package/app/components/AdsCheckbox.vue +2 -1
- package/app/components/AdsFeatureCard.vue +8 -7
- package/app/components/AdsModal.vue +18 -9
- package/app/components/AdsNavbarDesk.vue +1 -1
- package/app/components/AdsNotabilityPill.vue +18 -9
- package/app/components/AdsPill.vue +58 -30
- package/app/components/AdsSegmentedTabs.vue +55 -11
- package/app/components/AdsSelect.vue +2 -2
- package/app/components/AdsSelectItem.vue +3 -3
- package/app/components/AdsSideMenu.vue +2 -2
- package/app/components/AdsStepper.vue +64 -9
- package/app/components/AdsTable.vue +2 -0
- package/app/components/AdsTabs.vue +21 -1
- package/app/components/AdsToast.vue +54 -37
- package/app/components/ads-tab-scroll.ts +44 -0
- package/app/theme/ads-theme.ts +8 -7
- package/app/theme/component-tokens.ts +4 -4
- package/app/utils/notability.ts +3 -3
- package/package.json +1 -1
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
|
|
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
|
|
307
|
-
<AdsPill
|
|
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
|
```
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
--ads-notability-height: 24px;
|
|
229
229
|
--ads-notability-min-width: 100px;
|
|
230
230
|
--ads-notability-padding-x: 8px;
|
|
231
|
-
--ads-notability-font-size:
|
|
231
|
+
--ads-notability-font-size: 14px;
|
|
232
232
|
--ads-notability-weight: 700;
|
|
233
233
|
--ads-mini-height: 18px;
|
|
234
234
|
--ads-mini-padding-x: 8px;
|
package/app/assets/css/main.css
CHANGED
|
@@ -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
|
|
3
|
-
prefira <AdsPill
|
|
2
|
+
AdsBroadcast — atalho de compatibilidade. O Broadcast é a prop da Pill:
|
|
3
|
+
prefira <AdsPill broadcast />.
|
|
4
4
|
-->
|
|
5
5
|
<template>
|
|
6
|
-
<AdsPill
|
|
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
|
|
12
|
+
export type AdsBroadcastColor = "warning" | "success";
|
|
13
13
|
|
|
14
14
|
withDefaults(
|
|
15
15
|
defineProps<{
|
|
16
16
|
label?: string;
|
|
17
|
-
|
|
17
|
+
color?: AdsBroadcastColor;
|
|
18
18
|
}>(),
|
|
19
19
|
{
|
|
20
20
|
label: "",
|
|
21
|
-
|
|
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
|
|
8
|
-
:class="[radiusClass, surfaceClass]"
|
|
7
|
+
class="ads-card flex h-full min-w-0 flex-col items-start p-[var(--ads-card-padding)] text-left transition-[background-color,border-color,box-shadow]"
|
|
8
|
+
:class="[gapClass, 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="
|
|
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="
|
|
24
|
+
<p v-if="description && !loading && !empty" :class="descriptionClass">
|
|
24
25
|
{{ description }}
|
|
25
26
|
</p>
|
|
26
27
|
|
|
@@ -78,7 +79,17 @@ import AdsCardPeriod from "./AdsCardPeriod.vue";
|
|
|
78
79
|
import AdsEmptyState from "./AdsEmptyState.vue";
|
|
79
80
|
import AdsLoading from "./AdsLoading.vue";
|
|
80
81
|
|
|
81
|
-
export type AdsCardType = "container" | "details";
|
|
82
|
+
export type AdsCardType = "container" | "details" | "informative";
|
|
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. */
|
|
@@ -93,6 +104,8 @@ const props = withDefaults(
|
|
|
93
104
|
/**
|
|
94
105
|
* container: título, período e conteúdo livre no slot padrão.
|
|
95
106
|
* details: título maior e lista de informações (rows).
|
|
107
|
+
* informative: chamada azul de notabilidade, com título curto em maiúsculas e texto de apoio.
|
|
108
|
+
* Ignora selected, variant e padding.
|
|
96
109
|
*/
|
|
97
110
|
type?: AdsCardType;
|
|
98
111
|
/** O slot header substitui. */
|
|
@@ -104,7 +117,7 @@ const props = withDefaults(
|
|
|
104
117
|
periodLabel?: string;
|
|
105
118
|
/** Linhas do card Detalhes. */
|
|
106
119
|
rows?: AdsCardRow[];
|
|
107
|
-
/** Texto de apoio
|
|
120
|
+
/** Texto de apoio. No selected, 14px em text/secondary. Fora disso, só no código. */
|
|
108
121
|
description?: string;
|
|
109
122
|
/** Linha curta no rodapé. O slot footer substitui. Só no código: o Figma não tem. */
|
|
110
123
|
footerText?: string;
|
|
@@ -116,9 +129,13 @@ const props = withDefaults(
|
|
|
116
129
|
disabled?: boolean;
|
|
117
130
|
/** Hover padrão dos cards clicáveis: borda cinza mais escura e sombra leve. false desliga. */
|
|
118
131
|
hoverable?: boolean;
|
|
119
|
-
/** Estado Selecionado: fundo azul claro, borda azul e sombra. */
|
|
132
|
+
/** Estado Selecionado: fundo azul claro, borda azul e sombra. Título 14 bold e descrição 14. */
|
|
120
133
|
selected?: boolean;
|
|
121
|
-
/**
|
|
134
|
+
/** box é o cartão. line é só a borda inferior, sem raio. */
|
|
135
|
+
variant?: AdsCardVariant;
|
|
136
|
+
/** default (16px) é o padrão. compact (8px) é o respiro menor. relaxed (24px) é o respiro maior (estratégia, histórico, notabilidade). */
|
|
137
|
+
padding?: AdsCardPadding;
|
|
138
|
+
/** `md` (12px) é o do Figma; `sm` (8px) é só no código. Ignorado em line. */
|
|
122
139
|
radius?: "sm" | "md";
|
|
123
140
|
/** Estado Carregando: no container, o loader do Radar; no details, skeleton nas linhas. */
|
|
124
141
|
loading?: boolean;
|
|
@@ -140,6 +157,8 @@ const props = withDefaults(
|
|
|
140
157
|
disabled: false,
|
|
141
158
|
hoverable: true,
|
|
142
159
|
selected: false,
|
|
160
|
+
variant: "box",
|
|
161
|
+
padding: "default",
|
|
143
162
|
radius: "md",
|
|
144
163
|
loading: false,
|
|
145
164
|
empty: false,
|
|
@@ -150,8 +169,38 @@ const props = withDefaults(
|
|
|
150
169
|
|
|
151
170
|
const slots = useSlots();
|
|
152
171
|
|
|
153
|
-
const containerTitleClass = "text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-card-title)]";
|
|
172
|
+
const containerTitleClass = "text-[length:var(--ads-font-size-xs)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
|
|
154
173
|
const detailsTitleClass = "text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
|
|
174
|
+
const selectedTitleClass = "text-[length:var(--ads-font-size-xxs)] font-bold leading-[1.3] text-[var(--ads-text-primary)]";
|
|
175
|
+
|
|
176
|
+
const informativeTitleClass =
|
|
177
|
+
"w-full text-[length:var(--ads-font-size-xxxs)] font-bold uppercase leading-[var(--ads-line-height-sm)] text-[var(--ads-text-secondary)]";
|
|
178
|
+
|
|
179
|
+
const isInformative = computed(() => props.type === "informative");
|
|
180
|
+
|
|
181
|
+
const titleClass = computed(() => {
|
|
182
|
+
if (isInformative.value) return informativeTitleClass;
|
|
183
|
+
if (props.selected) return selectedTitleClass;
|
|
184
|
+
return props.type === "details" ? detailsTitleClass : containerTitleClass;
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const descriptionClass = computed(() => {
|
|
188
|
+
if (isInformative.value) {
|
|
189
|
+
return "w-full text-[length:var(--ads-font-size-xxs)] font-normal leading-[1.3] text-[var(--ads-text-secondary)]";
|
|
190
|
+
}
|
|
191
|
+
return props.selected
|
|
192
|
+
? "text-[length:var(--ads-font-size-xxs)] font-normal leading-[1.3] text-[var(--ads-text-secondary)]"
|
|
193
|
+
: "text-[length:var(--ads-card-body-size)] leading-[1.4] text-[var(--ads-card-body)]";
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
/** O valor local vence o token global, e a tabela dentro do card usa o mesmo respiro. */
|
|
197
|
+
const paddingStyle = computed(() => ({
|
|
198
|
+
"--ads-card-padding": isInformative.value ? "var(--ads-space-xxxs)" : CARD_PADDING[props.padding],
|
|
199
|
+
"--ads-card-bleed": "var(--ads-card-padding)",
|
|
200
|
+
}));
|
|
201
|
+
|
|
202
|
+
/** 6px do Figma não existe na escala. O passo mais próximo é o quark (4px). */
|
|
203
|
+
const gapClass = computed(() => (isInformative.value ? "gap-[var(--ads-space-quark)]" : "gap-3"));
|
|
155
204
|
|
|
156
205
|
/** Larguras do skeleton do Figma; uma barra por linha. */
|
|
157
206
|
const SKELETON_WIDTHS = [200, 240, 160, 180, 260];
|
|
@@ -162,24 +211,33 @@ const detailSkeletonWidths = computed(() => {
|
|
|
162
211
|
|
|
163
212
|
const showHeader = computed(() => Boolean(props.title || props.hint || slots.header || slots.actions));
|
|
164
213
|
|
|
165
|
-
const radiusClass = computed(() =>
|
|
166
|
-
|
|
167
|
-
);
|
|
214
|
+
const radiusClass = computed(() => {
|
|
215
|
+
if (isInformative.value) return "rounded-[var(--ads-radius-sm)]";
|
|
216
|
+
if (props.variant === "line") return "rounded-none";
|
|
217
|
+
return props.radius === "sm" ? "rounded-[var(--ads-card-radius-sm)]" : "rounded-[var(--ads-card-radius)]";
|
|
218
|
+
});
|
|
168
219
|
|
|
169
220
|
const surfaceClass = computed(() => {
|
|
221
|
+
const line = props.variant === "line";
|
|
170
222
|
const classes = [
|
|
171
|
-
|
|
172
|
-
? "border-[var(--ads-
|
|
173
|
-
:
|
|
223
|
+
isInformative.value
|
|
224
|
+
? "border border-[var(--color-ads-radar-200)] bg-[var(--color-ads-radar-25)]"
|
|
225
|
+
: props.selected
|
|
226
|
+
? line
|
|
227
|
+
? "[border-width:0_0_1px] border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)]"
|
|
228
|
+
: "border border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
|
|
229
|
+
: line
|
|
230
|
+
? "[border-width:0_0_1px] border-[var(--ads-card-border)] bg-[var(--ads-card-background)]"
|
|
231
|
+
: "border border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
|
|
174
232
|
];
|
|
175
233
|
|
|
176
234
|
if (props.as !== "div") {
|
|
177
235
|
classes.push(
|
|
178
236
|
"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
237
|
);
|
|
180
|
-
// Hover padrão
|
|
181
|
-
if (props.hoverable && !props.selected && !props.disabled) {
|
|
182
|
-
classes.push("hover:border-[var(--ads-card-hover-border)] hover:shadow-[var(--ads-shadow-level-1)]");
|
|
238
|
+
// Hover padrão dos cards clicáveis. Na linha, só a divisória escurece: sombra viraria caixa.
|
|
239
|
+
if (props.hoverable && !props.selected && !isInformative.value && !props.disabled) {
|
|
240
|
+
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
241
|
}
|
|
184
242
|
}
|
|
185
243
|
|
|
@@ -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-
|
|
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-[
|
|
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
|
-
<
|
|
10
|
+
<AdsPill
|
|
11
11
|
v-else-if="value"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
25
|
-
* brand é
|
|
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
|
|
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
|
-
|
|
63
|
-
|
|
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
|
-
:
|
|
85
|
-
:
|
|
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 {
|
|
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
|
-
|
|
113
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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"
|
|
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,24 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<span
|
|
3
|
+
class="inline-flex min-h-[var(--ads-notability-height)] shrink-0 items-center justify-center overflow-hidden rounded-[var(--ads-radius-pill)] px-[var(--ads-notability-padding-x)] py-[var(--ads-space-quark)] text-center text-[length:var(--ads-notability-font-size)] leading-[1.3] whitespace-nowrap [font-weight:var(--ads-notability-weight)]"
|
|
4
|
+
:class="surface"
|
|
5
|
+
>
|
|
6
|
+
{{ resolvedLabel }}
|
|
7
|
+
</span>
|
|
3
8
|
</template>
|
|
4
9
|
|
|
5
10
|
<script setup lang="ts">
|
|
6
11
|
import { computed } from "vue";
|
|
7
12
|
import { formatNotability } from "../utils/notability";
|
|
8
|
-
import AdsPill from "./AdsPill.vue";
|
|
9
13
|
|
|
10
14
|
const props = defineProps<{
|
|
11
15
|
notability: string;
|
|
12
16
|
label?: string;
|
|
13
17
|
}>();
|
|
14
18
|
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
/**
|
|
20
|
+
* image: status/new 100 + 800.
|
|
21
|
+
* traffic: charts/data 4/100 a 80% + charts/data 4/800.
|
|
22
|
+
* profit: innovation/100 a 70% + charts/data 2/800.
|
|
23
|
+
*/
|
|
24
|
+
const surfaces: Record<string, string> = {
|
|
25
|
+
image: "bg-[var(--ads-status-new-100)] text-[var(--ads-status-new-800)]",
|
|
26
|
+
traffic: "bg-[color-mix(in_srgb,var(--ads-chart-data-4-100)_80%,transparent)] text-[var(--ads-chart-data-4-800)]",
|
|
27
|
+
profit: "bg-[color-mix(in_srgb,var(--ads-status-innovation-100)_70%,transparent)] text-[var(--ads-chart-data-2-800)]",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const surface = computed(() => surfaces[props.notability] ?? surfaces.image);
|
|
22
31
|
|
|
23
32
|
const resolvedLabel = computed(() => props.label ?? formatNotability(props.notability));
|
|
24
33
|
</script>
|