ads-nuxt 0.2.0 → 0.4.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 +6 -4
- package/app/assets/css/component-tokens.css +369 -367
- package/app/assets/css/main.css +26 -65
- package/app/components/AdsBadge.vue +3 -3
- package/app/components/AdsBroadcast.vue +1 -1
- package/app/components/AdsButton.vue +13 -5
- package/app/components/AdsButtonMenu.vue +2 -2
- package/app/components/AdsCharttip.vue +3 -2
- package/app/components/AdsCheckbox.vue +77 -77
- package/app/components/AdsDatePicker.vue +23 -6
- package/app/components/AdsEmptyState.vue +6 -3
- package/app/components/AdsHeavyTable.vue +4 -0
- package/app/components/AdsInput.vue +3 -2
- package/app/components/AdsMenuBar.vue +8 -1
- package/app/components/AdsMetricCard.vue +1 -1
- package/app/components/AdsModal.vue +7 -4
- package/app/components/AdsNavbarApp.vue +1 -1
- package/app/components/AdsNavbarDesk.vue +14 -9
- package/app/components/AdsNumberInput.vue +8 -8
- package/app/components/AdsPagination.vue +91 -91
- package/app/components/AdsPill.vue +1 -1
- package/app/components/AdsProductTag.vue +21 -2
- package/app/components/AdsRadio.vue +70 -70
- package/app/components/AdsSearchInput.vue +2 -2
- package/app/components/AdsSelect.vue +18 -1
- package/app/components/AdsSelectPanel.vue +103 -32
- package/app/components/AdsSteptip.vue +104 -101
- package/app/components/AdsSwitch.vue +59 -59
- package/app/components/AdsTable.vue +16 -1
- package/app/components/AdsTextarea.vue +2 -2
- package/app/components/AdsToast.vue +6 -5
- package/app/components/AdsTooltip.vue +2 -2
- package/app/components/OverlayLoading.vue +313 -173
- package/app/composables/useOverlayLoading.ts +31 -9
- package/app/theme/ads-theme.ts +1 -1
- package/app/theme/component-tokens.json +368 -366
- package/app/theme/component-tokens.ts +809 -807
- package/app/types/overlay-loading.types.ts +11 -2
- package/app/utils/ads-table.ts +3 -0
- package/package.json +56 -55
- package/app/assets/animations/Error.gif +0 -0
- package/app/assets/animations/Loading.gif +0 -0
- package/app/assets/animations/Search.gif +0 -0
- package/app/assets/animations/Success.gif +0 -0
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
>
|
|
14
14
|
<template #content="{ close }">
|
|
15
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-
|
|
16
|
+
<div class="flex 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)]"
|
|
20
20
|
aria-hidden="true"
|
|
21
21
|
>
|
|
22
|
-
<UIcon :name="icon" class="size-[
|
|
22
|
+
<UIcon :name="icon" :class="variant === 'sheet' ? 'size-4' : 'size-[18px]'" />
|
|
23
23
|
</span>
|
|
24
24
|
<div class="flex min-h-[var(--ads-space-xs)] min-w-0 flex-1 items-center">
|
|
25
25
|
<slot name="title">
|
|
@@ -54,11 +54,13 @@
|
|
|
54
54
|
<AdsButton
|
|
55
55
|
v-if="cancelLabel"
|
|
56
56
|
type="unfilled"
|
|
57
|
+
size="sm"
|
|
57
58
|
:label="cancelLabel"
|
|
58
59
|
@click="dismiss(close)"
|
|
59
60
|
/>
|
|
60
61
|
<AdsButton
|
|
61
62
|
v-if="confirmLabel"
|
|
63
|
+
size="sm"
|
|
62
64
|
:label="confirmLabel"
|
|
63
65
|
@click="emit('confirm')"
|
|
64
66
|
/>
|
|
@@ -80,8 +82,9 @@ import AdsButton from "./AdsButton.vue";
|
|
|
80
82
|
* Espaçamento, na escala ADS:
|
|
81
83
|
* - padding do cartão e faixa do cabeçalho: space-xs (24px)
|
|
82
84
|
* - vão entre cabeçalho, texto, conteúdo e ações: space-xxs (16px)
|
|
83
|
-
* - vão entre ícone, título e fechar: space-
|
|
84
|
-
* - ícone:
|
|
85
|
+
* - vão entre ícone, título e fechar: space-quark (4px)
|
|
86
|
+
* - ícone: 18px no dialog (SM do Figma) e 16px no sheet (XS); X com 18px
|
|
87
|
+
* - ações padrão: botões sm (32px, 12px bold), como no Figma
|
|
85
88
|
* - título: 20px bold, line-height 130% (Subtitle 20 do Figma)
|
|
86
89
|
*/
|
|
87
90
|
export type AdsModalVariant = "dialog" | "sheet";
|
|
@@ -39,7 +39,7 @@ export type AdsNavbarAppItem = {
|
|
|
39
39
|
export const adsNavbarAppItems: AdsNavbarAppItem[] = [
|
|
40
40
|
{ id: "home", label: "Home", icon: "i-lucide-home" },
|
|
41
41
|
{ id: "agenda", label: "Agenda", icon: "i-lucide-calendar-days" },
|
|
42
|
-
{ id: "apps", label: "
|
|
42
|
+
{ id: "apps", label: "Produtos", icon: "i-lucide-layout-grid" },
|
|
43
43
|
{ id: "tickets", label: "Tickets", icon: "i-lucide-messages-square" },
|
|
44
44
|
{ id: "perfil", label: "Perfil", icon: "i-lucide-circle-user" },
|
|
45
45
|
];
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<header class="flex h-[var(--ads-navbar-desk-height)] w-full items-center justify-between border-b border-[var(--ads-navbar-desk-border)] bg-[var(--ads-surface-card)]
|
|
2
|
+
<header class="flex h-[var(--ads-navbar-desk-height)] w-full items-center justify-between border-b border-[var(--ads-navbar-desk-border)] bg-[var(--ads-surface-card)] pl-[var(--ads-navbar-desk-padding-x)] pr-[var(--ads-navbar-desk-padding-end)] shadow-[0_2px_4px_-1px_color-mix(in_srgb,var(--color-ads-neutro-medio-60)_75%,transparent)]">
|
|
3
3
|
<div class="flex items-center gap-3">
|
|
4
4
|
<img :src="radarUrl" alt="RADAR" class="h-[21px] w-auto" />
|
|
5
5
|
<AdsProductTag v-if="product" :product="product" :label="productLabel" />
|
|
6
6
|
</div>
|
|
7
|
-
<div class="flex items-center gap-
|
|
8
|
-
<AdsPill v-if="showBroadcast" variant="broadcast" status="warning" />
|
|
7
|
+
<div class="flex items-center gap-4">
|
|
8
|
+
<AdsPill v-if="showBroadcast && broadcastLabel" variant="broadcast" status="warning" :label="broadcastLabel" />
|
|
9
|
+
<div class="flex items-center gap-3">
|
|
10
|
+
<template v-for="(action, index) in actions" :key="action.id">
|
|
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">
|
|
12
|
+
<img v-if="avatarUrl" :src="avatarUrl" alt="" class="size-full object-cover" />
|
|
13
|
+
<UIcon v-else name="i-lucide-user" class="size-4 text-[var(--ads-text-secondary)]" />
|
|
14
|
+
</span>
|
|
9
15
|
<button
|
|
10
|
-
v-for="action in actions"
|
|
11
|
-
:key="action.id"
|
|
12
16
|
type="button"
|
|
13
17
|
class="flex size-[var(--ads-navbar-desk-action)] items-center justify-center rounded-[var(--ads-radius-xsm)] p-2 text-[var(--ads-text-secondary)] hover:bg-ads-neutro-claro-20 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
14
18
|
:aria-label="action.label"
|
|
@@ -16,10 +20,8 @@
|
|
|
16
20
|
>
|
|
17
21
|
<UIcon :name="action.icon" class="size-[18px]" />
|
|
18
22
|
</button>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<UIcon v-else name="i-lucide-user" class="size-4 text-[var(--ads-text-secondary)]" />
|
|
22
|
-
</span>
|
|
23
|
+
</template>
|
|
24
|
+
</div>
|
|
23
25
|
</div>
|
|
24
26
|
</header>
|
|
25
27
|
</template>
|
|
@@ -40,6 +42,8 @@ withDefaults(
|
|
|
40
42
|
product?: AdsProductTagName | null;
|
|
41
43
|
productLabel?: string;
|
|
42
44
|
showBroadcast?: boolean;
|
|
45
|
+
/** Texto da pílula de broadcast (ex.: "LIVE"). Sem valor, a pílula não aparece. */
|
|
46
|
+
broadcastLabel?: string;
|
|
43
47
|
avatarUrl?: string;
|
|
44
48
|
actions?: AdsNavbarDeskAction[];
|
|
45
49
|
}>(),
|
|
@@ -47,6 +51,7 @@ withDefaults(
|
|
|
47
51
|
product: "performance",
|
|
48
52
|
productLabel: "performance",
|
|
49
53
|
showBroadcast: true,
|
|
54
|
+
broadcastLabel: "",
|
|
50
55
|
avatarUrl: "",
|
|
51
56
|
actions: () => [
|
|
52
57
|
{ id: "alerts", label: "Alertas", icon: "i-lucide-bell" },
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
type="number"
|
|
26
26
|
inputmode="decimal"
|
|
27
27
|
size="4"
|
|
28
|
-
class="w-0 min-w-0 flex-1 bg-transparent text-[length:var(--ads-number-font-size)] leading-[1.3] outline-none placeholder:text-
|
|
28
|
+
class="w-0 min-w-0 flex-1 bg-transparent text-[length:var(--ads-number-font-size)] leading-[1.3] text-[var(--ads-text-primary)] outline-none placeholder:text-[var(--ads-number-text)] disabled:cursor-not-allowed disabled:text-[var(--ads-number-disabled-text)] [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
29
29
|
:placeholder="placeholder"
|
|
30
30
|
:disabled="isDisabled"
|
|
31
31
|
:min="min"
|
|
@@ -36,27 +36,27 @@
|
|
|
36
36
|
@focus="emit('focus', $event)"
|
|
37
37
|
@blur="emit('blur', $event)"
|
|
38
38
|
>
|
|
39
|
+
<span v-if="suffix" class="shrink-0 text-[length:var(--ads-number-font-size)] leading-[1.3]">{{ suffix }}</span>
|
|
39
40
|
<div class="flex shrink-0 flex-col">
|
|
40
41
|
<button
|
|
41
42
|
type="button"
|
|
42
|
-
class="inline-flex
|
|
43
|
+
class="inline-flex h-3 w-4 items-center justify-center rounded-sm text-current hover:bg-[var(--ads-button-secondary-hover)] disabled:cursor-not-allowed"
|
|
43
44
|
aria-label="Aumentar valor"
|
|
44
45
|
:disabled="isDisabled"
|
|
45
46
|
@mousedown.prevent="stepBy(1)"
|
|
46
47
|
>
|
|
47
|
-
<UIcon name="i-lucide-chevron-up" class="size-3
|
|
48
|
+
<UIcon name="i-lucide-chevron-up" class="size-3" />
|
|
48
49
|
</button>
|
|
49
50
|
<button
|
|
50
51
|
type="button"
|
|
51
|
-
class="inline-flex
|
|
52
|
+
class="inline-flex h-3 w-4 items-center justify-center rounded-sm text-current hover:bg-[var(--ads-button-secondary-hover)] disabled:cursor-not-allowed"
|
|
52
53
|
aria-label="Diminuir valor"
|
|
53
54
|
:disabled="isDisabled"
|
|
54
55
|
@mousedown.prevent="stepBy(-1)"
|
|
55
56
|
>
|
|
56
|
-
<UIcon name="i-lucide-chevron-down" class="size-3
|
|
57
|
+
<UIcon name="i-lucide-chevron-down" class="size-3" />
|
|
57
58
|
</button>
|
|
58
59
|
</div>
|
|
59
|
-
<span v-if="suffix" class="shrink-0 text-[length:var(--ads-number-font-size)] leading-[1.3]">{{ suffix }}</span>
|
|
60
60
|
</div>
|
|
61
61
|
|
|
62
62
|
<p
|
|
@@ -146,7 +146,7 @@ const visualState = computed<AdsNumberInputState>(() => {
|
|
|
146
146
|
const supportText = computed(() => props.error || props.hint);
|
|
147
147
|
const supportClass = computed(() =>
|
|
148
148
|
visualState.value === "disabled"
|
|
149
|
-
? "text-[var(--ads-text
|
|
149
|
+
? "text-[var(--ads-number-disabled-text)]"
|
|
150
150
|
: "text-[var(--ads-text-secondary)]",
|
|
151
151
|
);
|
|
152
152
|
|
|
@@ -166,7 +166,7 @@ const fieldClass = computed(() => {
|
|
|
166
166
|
return "border-(length:--ads-border-width-slim) border-[var(--ads-number-focus-border)] bg-[var(--ads-number-background)] text-[var(--ads-number-text)]";
|
|
167
167
|
}
|
|
168
168
|
if (visualState.value === "ai") {
|
|
169
|
-
return `border border-[var(--ads-
|
|
169
|
+
return `border border-[var(--ads-text-ai)] bg-[var(--ads-surface-ai)] text-[var(--ads-number-text)] ${focus}`;
|
|
170
170
|
}
|
|
171
171
|
return `border border-[var(--ads-number-border)] bg-[var(--ads-number-background)] text-[var(--ads-number-text)] ${focus}`;
|
|
172
172
|
});
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav class="inline-flex items-center gap-[var(--ads-pagination-gap)] py-1" :aria-label="ariaLabel">
|
|
3
|
-
<button
|
|
4
|
-
type="button"
|
|
5
|
-
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
6
|
-
:disabled="page <= 1"
|
|
7
|
-
@click="go(page - 1)"
|
|
8
|
-
>
|
|
9
|
-
{{ prevLabel }}
|
|
10
|
-
</button>
|
|
11
|
-
<div class="flex items-center gap-[var(--ads-pagination-number-gap)]">
|
|
12
|
-
<template v-for="item in items" :key="item.key">
|
|
13
|
-
<span v-if="item.kind === 'gap'" class="px-1 text-sm text-ads-neutro-escuro-600" aria-hidden="true">…</span>
|
|
14
|
-
<button
|
|
15
|
-
v-else
|
|
16
|
-
type="button"
|
|
17
|
-
class="flex size-[var(--ads-pagination-cell)] items-center justify-center rounded-[var(--ads-radius-xsm)] text-sm leading-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
18
|
-
:class="item.page === page ? 'bg-[var(--ads-pagination-selected)] text-[var(--ads-text-contrast)]' : 'text-[var(--ads-pagination-number)] hover:bg-ads-neutro-claro-
|
|
19
|
-
:aria-current="item.page === page ? 'page' : undefined"
|
|
20
|
-
@click="go(item.page)"
|
|
21
|
-
>
|
|
22
|
-
{{ item.page }}
|
|
23
|
-
</button>
|
|
24
|
-
</template>
|
|
25
|
-
</div>
|
|
26
|
-
<button
|
|
27
|
-
type="button"
|
|
28
|
-
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
29
|
-
:disabled="page >= totalPages"
|
|
30
|
-
@click="go(page + 1)"
|
|
31
|
-
>
|
|
32
|
-
{{ nextLabel }}
|
|
33
|
-
</button>
|
|
34
|
-
</nav>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script setup lang="ts">
|
|
38
|
-
import { computed } from "vue";
|
|
39
|
-
|
|
40
|
-
const props = withDefaults(
|
|
41
|
-
defineProps<{
|
|
42
|
-
page?: number;
|
|
43
|
-
totalPages?: number;
|
|
44
|
-
prevLabel?: string;
|
|
45
|
-
nextLabel?: string;
|
|
46
|
-
ariaLabel?: string;
|
|
47
|
-
}>(),
|
|
48
|
-
{
|
|
49
|
-
page: 1,
|
|
50
|
-
totalPages: 1,
|
|
51
|
-
prevLabel: "Anterior",
|
|
52
|
-
nextLabel: "Próximo",
|
|
53
|
-
ariaLabel: "Paginação",
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const emit = defineEmits<{
|
|
58
|
-
"update:page": [page: number];
|
|
59
|
-
}>();
|
|
60
|
-
|
|
61
|
-
type PageItem = { kind: "page"; page: number; key: string } | { kind: "gap"; key: string };
|
|
62
|
-
|
|
63
|
-
const items = computed<PageItem[]>(() => {
|
|
64
|
-
const total = Math.max(1, props.totalPages);
|
|
65
|
-
const current = Math.min(Math.max(1, props.page), total);
|
|
66
|
-
if (total <= 7) {
|
|
67
|
-
return Array.from({ length: total }, (_, index) => ({
|
|
68
|
-
kind: "page" as const,
|
|
69
|
-
page: index + 1,
|
|
70
|
-
key: `p${index + 1}`,
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
const pages = new Set([1, total, current - 1, current, current + 1]);
|
|
74
|
-
const sorted = [...pages].filter((value) => value >= 1 && value <= total).sort((a, b) => a - b);
|
|
75
|
-
const result: PageItem[] = [];
|
|
76
|
-
sorted.forEach((value, index) => {
|
|
77
|
-
const previous = sorted[index - 1];
|
|
78
|
-
if (previous !== undefined && value - previous > 1) {
|
|
79
|
-
result.push({ kind: "gap", key: `g${previous}` });
|
|
80
|
-
}
|
|
81
|
-
result.push({ kind: "page", page: value, key: `p${value}` });
|
|
82
|
-
});
|
|
83
|
-
return result;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
const go = (next: number) => {
|
|
87
|
-
const total = Math.max(1, props.totalPages);
|
|
88
|
-
const value = Math.min(Math.max(1, next), total);
|
|
89
|
-
if (value !== props.page) emit("update:page", value);
|
|
90
|
-
};
|
|
91
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<nav class="inline-flex items-center gap-[var(--ads-pagination-gap)] py-1" :aria-label="ariaLabel">
|
|
3
|
+
<button
|
|
4
|
+
type="button"
|
|
5
|
+
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
6
|
+
:disabled="page <= 1"
|
|
7
|
+
@click="go(page - 1)"
|
|
8
|
+
>
|
|
9
|
+
{{ prevLabel }}
|
|
10
|
+
</button>
|
|
11
|
+
<div class="flex items-center gap-[var(--ads-pagination-number-gap)]">
|
|
12
|
+
<template v-for="item in items" :key="item.key">
|
|
13
|
+
<span v-if="item.kind === 'gap'" class="px-1 text-sm text-ads-neutro-escuro-600" aria-hidden="true">…</span>
|
|
14
|
+
<button
|
|
15
|
+
v-else
|
|
16
|
+
type="button"
|
|
17
|
+
class="flex size-[var(--ads-pagination-cell)] items-center justify-center rounded-[var(--ads-radius-xsm)] text-sm leading-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
18
|
+
:class="item.page === page ? 'bg-[var(--ads-pagination-selected)] text-[var(--ads-text-contrast)]' : 'text-[var(--ads-pagination-number)] hover:bg-ads-neutro-claro-30'"
|
|
19
|
+
:aria-current="item.page === page ? 'page' : undefined"
|
|
20
|
+
@click="go(item.page)"
|
|
21
|
+
>
|
|
22
|
+
{{ item.page }}
|
|
23
|
+
</button>
|
|
24
|
+
</template>
|
|
25
|
+
</div>
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
class="py-0.5 text-sm leading-[1.3] text-[var(--ads-text-secondary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)] disabled:cursor-not-allowed disabled:text-[var(--ads-text-tertiary)]"
|
|
29
|
+
:disabled="page >= totalPages"
|
|
30
|
+
@click="go(page + 1)"
|
|
31
|
+
>
|
|
32
|
+
{{ nextLabel }}
|
|
33
|
+
</button>
|
|
34
|
+
</nav>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { computed } from "vue";
|
|
39
|
+
|
|
40
|
+
const props = withDefaults(
|
|
41
|
+
defineProps<{
|
|
42
|
+
page?: number;
|
|
43
|
+
totalPages?: number;
|
|
44
|
+
prevLabel?: string;
|
|
45
|
+
nextLabel?: string;
|
|
46
|
+
ariaLabel?: string;
|
|
47
|
+
}>(),
|
|
48
|
+
{
|
|
49
|
+
page: 1,
|
|
50
|
+
totalPages: 1,
|
|
51
|
+
prevLabel: "Anterior",
|
|
52
|
+
nextLabel: "Próximo",
|
|
53
|
+
ariaLabel: "Paginação",
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const emit = defineEmits<{
|
|
58
|
+
"update:page": [page: number];
|
|
59
|
+
}>();
|
|
60
|
+
|
|
61
|
+
type PageItem = { kind: "page"; page: number; key: string } | { kind: "gap"; key: string };
|
|
62
|
+
|
|
63
|
+
const items = computed<PageItem[]>(() => {
|
|
64
|
+
const total = Math.max(1, props.totalPages);
|
|
65
|
+
const current = Math.min(Math.max(1, props.page), total);
|
|
66
|
+
if (total <= 7) {
|
|
67
|
+
return Array.from({ length: total }, (_, index) => ({
|
|
68
|
+
kind: "page" as const,
|
|
69
|
+
page: index + 1,
|
|
70
|
+
key: `p${index + 1}`,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
const pages = new Set([1, total, current - 1, current, current + 1]);
|
|
74
|
+
const sorted = [...pages].filter((value) => value >= 1 && value <= total).sort((a, b) => a - b);
|
|
75
|
+
const result: PageItem[] = [];
|
|
76
|
+
sorted.forEach((value, index) => {
|
|
77
|
+
const previous = sorted[index - 1];
|
|
78
|
+
if (previous !== undefined && value - previous > 1) {
|
|
79
|
+
result.push({ kind: "gap", key: `g${previous}` });
|
|
80
|
+
}
|
|
81
|
+
result.push({ kind: "page", page: value, key: `p${value}` });
|
|
82
|
+
});
|
|
83
|
+
return result;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const go = (next: number) => {
|
|
87
|
+
const total = Math.max(1, props.totalPages);
|
|
88
|
+
const value = Math.min(Math.max(1, next), total);
|
|
89
|
+
if (value !== props.page) emit("update:page", value);
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
@@ -139,6 +139,6 @@ const broadcastSizeClass =
|
|
|
139
139
|
|
|
140
140
|
const surfaceClass = computed(() => props.customSurface ?? surfaces[props.tone][props.status]);
|
|
141
141
|
const resolvedLabel = computed(
|
|
142
|
-
() => props.label ?? (isBroadcast.value ? "
|
|
142
|
+
() => props.label ?? (isBroadcast.value ? "" : labels[props.tone][props.status]),
|
|
143
143
|
);
|
|
144
144
|
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span
|
|
3
|
-
class="inline-flex h-[var(--ads-product-tag-height)] items-center
|
|
3
|
+
class="inline-flex h-[var(--ads-product-tag-height)] items-center px-1.5 text-[length:var(--ads-product-tag-font-size)] leading-none font-medium text-[var(--ads-text-contrast)]"
|
|
4
4
|
:class="surface"
|
|
5
5
|
>
|
|
6
|
-
{{ label || product }}
|
|
6
|
+
{{ label || labels[product] }}
|
|
7
7
|
</span>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
@@ -57,5 +57,24 @@ const surfaces: Record<AdsProductTagName, string> = {
|
|
|
57
57
|
encontro: "bg-ads-produtos-radar-5",
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
/** Nomes como no Figma (com acento; captador aparece como "prisma"). */
|
|
61
|
+
const labels: Record<AdsProductTagName, string> = {
|
|
62
|
+
marketing: "marketing",
|
|
63
|
+
promocoes: "promoções",
|
|
64
|
+
vendas: "vendas",
|
|
65
|
+
captador: "prisma",
|
|
66
|
+
estoque: "estoque",
|
|
67
|
+
pricing: "pricing",
|
|
68
|
+
crm: "crm",
|
|
69
|
+
compras: "compras",
|
|
70
|
+
gestao: "gestão",
|
|
71
|
+
trade: "trade",
|
|
72
|
+
capacitacao: "capacitação",
|
|
73
|
+
ecommerce: "e-commerce",
|
|
74
|
+
financas: "finanças",
|
|
75
|
+
performance: "performance",
|
|
76
|
+
encontro: "encontro",
|
|
77
|
+
};
|
|
78
|
+
|
|
60
79
|
const surface = computed(() => surfaces[props.product]);
|
|
61
80
|
</script>
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<label
|
|
3
|
-
class="inline-flex items-center gap-[var(--ads-radio-gap)]"
|
|
4
|
-
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
5
|
-
>
|
|
6
|
-
<span class="relative grid size-[var(--ads-radio-size)] shrink-0 place-items-center">
|
|
7
|
-
<input
|
|
8
|
-
v-bind="attrs"
|
|
9
|
-
type="radio"
|
|
10
|
-
class="peer absolute inset-0 m-0 size-full appearance-none opacity-0 disabled:cursor-not-allowed"
|
|
11
|
-
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
12
|
-
:name="fieldName"
|
|
13
|
-
:value="value"
|
|
14
|
-
:checked="checked"
|
|
15
|
-
:disabled="isDisabled"
|
|
16
|
-
@change="onChange"
|
|
17
|
-
>
|
|
18
|
-
<span
|
|
19
|
-
class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-size)] rounded-full border-[length:var(--ads-radio-border-width)] bg-[var(--ads-radio-background)] peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-[var(--ads-text-brand)]"
|
|
20
|
-
:class="isDisabled
|
|
21
|
-
? 'border-[var(--ads-radio-disabled)] peer-checked:border-[var(--ads-radio-disabled)] peer-checked:bg-[var(--ads-radio-disabled)]'
|
|
22
|
-
: 'border-[var(--ads-radio-border)] peer-checked:border-[var(--ads-radio-border)] peer-checked:bg-[var(--ads-radio-border)]'"
|
|
23
|
-
/>
|
|
24
|
-
<span class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-dot)] rounded-full bg-[var(--ads-radio-dot-color)] opacity-0 peer-checked:opacity-100" />
|
|
25
|
-
</span>
|
|
26
|
-
<span
|
|
27
|
-
v-if="hasLabel"
|
|
28
|
-
class="text-[length:var(--ads-radio-label-size)] font-normal leading-[1.3]"
|
|
29
|
-
:class="isDisabled ? 'text-
|
|
30
|
-
>
|
|
31
|
-
<slot>{{ label }}</slot>
|
|
32
|
-
</span>
|
|
33
|
-
</label>
|
|
34
|
-
</template>
|
|
35
|
-
|
|
36
|
-
<script setup lang="ts">
|
|
37
|
-
import { computed, useAttrs, useId, useSlots } from "vue";
|
|
38
|
-
|
|
39
|
-
defineOptions({ inheritAttrs: false });
|
|
40
|
-
|
|
41
|
-
const props = withDefaults(
|
|
42
|
-
defineProps<{
|
|
43
|
-
label?: string;
|
|
44
|
-
value?: string | number | boolean;
|
|
45
|
-
name?: string;
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
}>(),
|
|
48
|
-
{
|
|
49
|
-
label: "",
|
|
50
|
-
value: "on",
|
|
51
|
-
name: "",
|
|
52
|
-
disabled: false,
|
|
53
|
-
},
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
const model = defineModel<string | number | boolean>({ default: "" });
|
|
57
|
-
const attrs = useAttrs();
|
|
58
|
-
const slots = useSlots();
|
|
59
|
-
const autoName = useId();
|
|
60
|
-
|
|
61
|
-
const hasLabel = computed(() => props.label.length > 0 || Boolean(slots.default));
|
|
62
|
-
const isDisabled = computed(() => props.disabled);
|
|
63
|
-
const fieldName = computed(() => props.name || autoName);
|
|
64
|
-
const checked = computed(() => model.value === props.value);
|
|
65
|
-
|
|
66
|
-
const onChange = () => {
|
|
67
|
-
if (isDisabled.value) return;
|
|
68
|
-
model.value = props.value;
|
|
69
|
-
};
|
|
70
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
class="inline-flex items-center gap-[var(--ads-radio-gap)]"
|
|
4
|
+
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
5
|
+
>
|
|
6
|
+
<span class="relative grid size-[var(--ads-radio-size)] shrink-0 place-items-center">
|
|
7
|
+
<input
|
|
8
|
+
v-bind="attrs"
|
|
9
|
+
type="radio"
|
|
10
|
+
class="peer absolute inset-0 m-0 size-full appearance-none opacity-0 disabled:cursor-not-allowed"
|
|
11
|
+
:class="isDisabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
12
|
+
:name="fieldName"
|
|
13
|
+
:value="value"
|
|
14
|
+
:checked="checked"
|
|
15
|
+
:disabled="isDisabled"
|
|
16
|
+
@change="onChange"
|
|
17
|
+
>
|
|
18
|
+
<span
|
|
19
|
+
class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-size)] rounded-full border-[length:var(--ads-radio-border-width)] bg-[var(--ads-radio-background)] peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-[var(--ads-text-brand)]"
|
|
20
|
+
:class="isDisabled
|
|
21
|
+
? 'border-[var(--ads-radio-disabled)] peer-checked:border-[var(--ads-radio-disabled)] peer-checked:bg-[var(--ads-radio-disabled)]'
|
|
22
|
+
: 'border-[var(--ads-radio-border)] peer-checked:border-[var(--ads-radio-border)] peer-checked:bg-[var(--ads-radio-border)]'"
|
|
23
|
+
/>
|
|
24
|
+
<span class="pointer-events-none col-start-1 row-start-1 size-[var(--ads-radio-dot)] rounded-full bg-[var(--ads-radio-dot-color)] opacity-0 peer-checked:opacity-100" />
|
|
25
|
+
</span>
|
|
26
|
+
<span
|
|
27
|
+
v-if="hasLabel"
|
|
28
|
+
class="text-[length:var(--ads-radio-label-size)] font-normal leading-[1.3]"
|
|
29
|
+
:class="isDisabled ? 'text-ads-neutro-medio-70' : 'text-[var(--ads-radio-label)]'"
|
|
30
|
+
>
|
|
31
|
+
<slot>{{ label }}</slot>
|
|
32
|
+
</span>
|
|
33
|
+
</label>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { computed, useAttrs, useId, useSlots } from "vue";
|
|
38
|
+
|
|
39
|
+
defineOptions({ inheritAttrs: false });
|
|
40
|
+
|
|
41
|
+
const props = withDefaults(
|
|
42
|
+
defineProps<{
|
|
43
|
+
label?: string;
|
|
44
|
+
value?: string | number | boolean;
|
|
45
|
+
name?: string;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}>(),
|
|
48
|
+
{
|
|
49
|
+
label: "",
|
|
50
|
+
value: "on",
|
|
51
|
+
name: "",
|
|
52
|
+
disabled: false,
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const model = defineModel<string | number | boolean>({ default: "" });
|
|
57
|
+
const attrs = useAttrs();
|
|
58
|
+
const slots = useSlots();
|
|
59
|
+
const autoName = useId();
|
|
60
|
+
|
|
61
|
+
const hasLabel = computed(() => props.label.length > 0 || Boolean(slots.default));
|
|
62
|
+
const isDisabled = computed(() => props.disabled);
|
|
63
|
+
const fieldName = computed(() => props.name || autoName);
|
|
64
|
+
const checked = computed(() => model.value === props.value);
|
|
65
|
+
|
|
66
|
+
const onChange = () => {
|
|
67
|
+
if (isDisabled.value) return;
|
|
68
|
+
model.value = props.value;
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
@@ -93,7 +93,7 @@ const iconClass = computed(() =>
|
|
|
93
93
|
|
|
94
94
|
const hintClass = computed(() => {
|
|
95
95
|
const tone = visualState.value === "disabled"
|
|
96
|
-
? "text-[var(--ads-
|
|
96
|
+
? "text-[var(--ads-search-placeholder)]"
|
|
97
97
|
: "text-[var(--ads-text-secondary)]";
|
|
98
98
|
const type = props.size === "sm" ? "text-[10px] leading-[1.1]" : "text-xs leading-[1.2]";
|
|
99
99
|
return `${type} ${tone}`;
|
|
@@ -115,7 +115,7 @@ const fieldClass = computed(() => {
|
|
|
115
115
|
return `border-(length:--ads-border-width-slim) border-[var(--ads-search-focus-border)] bg-[var(--ads-search-background)] ${tone}`;
|
|
116
116
|
}
|
|
117
117
|
if (visualState.value === "ai") {
|
|
118
|
-
return `border border-[var(--ads-
|
|
118
|
+
return `border border-[var(--ads-text-ai)] bg-[var(--ads-surface-ai)] text-[var(--ads-text-secondary)] ${focus}`;
|
|
119
119
|
}
|
|
120
120
|
return `border border-[var(--ads-search-border)] bg-[var(--ads-search-background)] ${tone} ${focus}`;
|
|
121
121
|
});
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
:search-placeholder="searchPlaceholder"
|
|
22
22
|
:list-label="label || 'Opções'"
|
|
23
23
|
:width-class="panelWidthClass"
|
|
24
|
+
:add-label="addLabel"
|
|
24
25
|
@pick="emit('pick', model)"
|
|
26
|
+
@add="onAdd"
|
|
25
27
|
/>
|
|
26
28
|
</template>
|
|
27
29
|
|
|
@@ -90,7 +92,9 @@
|
|
|
90
92
|
:search-placeholder="searchPlaceholder"
|
|
91
93
|
:list-label="label || 'Opções'"
|
|
92
94
|
:width-class="panelWidthClass"
|
|
95
|
+
:add-label="addLabel"
|
|
93
96
|
@pick="onPick"
|
|
97
|
+
@add="onAdd"
|
|
94
98
|
/>
|
|
95
99
|
</template>
|
|
96
100
|
</UPopover>
|
|
@@ -141,6 +145,11 @@ const props = withDefaults(
|
|
|
141
145
|
inline?: boolean;
|
|
142
146
|
/** Largura da lista. Padrão: --ads-select-panel-width (320px). */
|
|
143
147
|
panelWidthClass?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Ação de cadastrar no rodapé da lista, com ícone de adicionar. `{query}` vira a busca atual,
|
|
150
|
+
* ex.: "Cadastrar {query}". Sem valor, a ação não aparece.
|
|
151
|
+
*/
|
|
152
|
+
addLabel?: string;
|
|
144
153
|
}>(),
|
|
145
154
|
{
|
|
146
155
|
placeholder: "Selecione",
|
|
@@ -164,6 +173,8 @@ const model = defineModel<string | string[]>({ required: true });
|
|
|
164
173
|
const emit = defineEmits<{
|
|
165
174
|
/** Escolha feita: no radio e no month o popover fecha. */
|
|
166
175
|
pick: [value: string | string[]];
|
|
176
|
+
/** Ação de cadastrar. Recebe a busca atual. No popover, a lista fecha antes do evento. */
|
|
177
|
+
add: [query: string];
|
|
167
178
|
}>();
|
|
168
179
|
|
|
169
180
|
defineSlots<{
|
|
@@ -211,7 +222,7 @@ const fieldClass = computed(() => {
|
|
|
211
222
|
return "border-(length:--ads-border-width-slim) border-[var(--ads-filter-focus-border)] bg-[var(--ads-filter-background)] text-[var(--ads-filter-text)]";
|
|
212
223
|
}
|
|
213
224
|
if (fieldState.value === "ai") {
|
|
214
|
-
return "border border-[var(--ads-
|
|
225
|
+
return "border border-[var(--ads-text-ai)] bg-[var(--ads-surface-ai)] hover:border-[var(--ads-filter-hover-border)] text-[var(--ads-filter-text)]";
|
|
215
226
|
}
|
|
216
227
|
if (fieldState.value === "selected") {
|
|
217
228
|
return "border border-[var(--ads-filter-border)] hover:border-[var(--ads-filter-hover-border)] bg-ads-neutro-claro-20 text-[var(--ads-filter-text)]";
|
|
@@ -249,6 +260,12 @@ const onPick = () => {
|
|
|
249
260
|
emit("pick", model.value);
|
|
250
261
|
};
|
|
251
262
|
|
|
263
|
+
const onAdd = (text: string) => {
|
|
264
|
+
// No popover, a lista fecha: o cadastro costuma abrir um formulário ou modal por cima.
|
|
265
|
+
if (!props.inline) isOpen.value = false;
|
|
266
|
+
emit("add", text);
|
|
267
|
+
};
|
|
268
|
+
|
|
252
269
|
watch(isOpen, (open) => {
|
|
253
270
|
if (!open) query.value = "";
|
|
254
271
|
});
|