ads-nuxt 0.4.0 → 0.4.2
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/LICENSE +21 -21
- package/README.md +574 -575
- package/app/app.config.ts +25 -25
- package/app/assets/ads/checkbox-check.svg +5 -5
- package/app/assets/ads/checkbox-minus.svg +5 -5
- package/app/assets/brand/farmarcas.svg +6 -6
- package/app/assets/brand/radar-symbol.svg +9 -9
- package/app/assets/brand/radar.svg +9 -9
- package/app/assets/css/ads-colors.css +257 -257
- package/app/assets/css/component-tokens.css +6 -2
- package/app/assets/css/main.css +585 -585
- package/app/components/AdsBadge.vue +47 -47
- package/app/components/AdsBroadcast.vue +24 -24
- package/app/components/AdsButton.vue +547 -547
- package/app/components/AdsButtonGroup.vue +39 -39
- package/app/components/AdsButtonMenu.vue +48 -48
- package/app/components/AdsCard.vue +188 -188
- package/app/components/AdsCardHint.vue +56 -22
- package/app/components/AdsCardPeriod.vue +43 -43
- package/app/components/AdsCardVariation.vue +31 -31
- package/app/components/AdsCharttip.vue +79 -79
- package/app/components/AdsDatePicker.vue +509 -509
- package/app/components/AdsDropdownMenu.vue +30 -30
- package/app/components/AdsEmptyState.vue +61 -61
- package/app/components/AdsFeatureCard.vue +292 -210
- package/app/components/AdsFileCard.vue +98 -98
- package/app/components/AdsFooter.vue +25 -25
- package/app/components/AdsHeavyAccountCell.vue +59 -59
- package/app/components/AdsHeavyHeaderCell.vue +70 -70
- package/app/components/AdsHeavyTable.vue +135 -139
- package/app/components/AdsInput.vue +148 -148
- package/app/components/AdsLoading.vue +217 -217
- package/app/components/AdsMenuBar.vue +110 -110
- package/app/components/AdsMetricCard.vue +226 -216
- package/app/components/AdsModal.vue +160 -160
- package/app/components/AdsMonthPicker.vue +80 -80
- package/app/components/AdsNavbarApp.vue +67 -67
- package/app/components/AdsNavbarDesk.vue +67 -67
- package/app/components/AdsNotabilityPill.vue +24 -24
- package/app/components/AdsNumberInput.vue +173 -173
- package/app/components/AdsPanelCard.vue +99 -99
- package/app/components/AdsPill.vue +144 -144
- package/app/components/AdsProductTag.vue +80 -80
- package/app/components/AdsSearchInput.vue +122 -122
- package/app/components/AdsSegmentedTabs.vue +62 -62
- package/app/components/AdsSelect.vue +283 -283
- package/app/components/AdsSelectItem.vue +128 -128
- package/app/components/AdsSelectPanel.vue +221 -221
- package/app/components/AdsSideMenu.vue +101 -101
- package/app/components/AdsSmalltip.vue +44 -44
- package/app/components/AdsStepper.vue +222 -222
- package/app/components/AdsTable.vue +172 -176
- package/app/components/AdsTableHeaderCell.vue +80 -80
- package/app/components/AdsTableSkeleton.vue +113 -113
- package/app/components/AdsTableToolbar.vue +44 -44
- package/app/components/AdsTabs.vue +51 -51
- package/app/components/AdsTextarea.vue +116 -116
- package/app/components/AdsToast.vue +184 -184
- package/app/components/AdsTooltip.vue +73 -73
- package/app/components/OverlayLoading.vue +2 -17
- package/app/components/ProgressBarLoading.vue +235 -235
- package/app/composables/useOverlayLoading.ts +88 -88
- package/app/constants/ads-color-swatches.ts +240 -240
- package/app/locale/pt-br.ts +6 -6
- package/app/plugins/ads-toast.client.ts +24 -24
- package/app/theme/ads-theme.ts +374 -374
- package/app/theme/ads-tokens.ts +391 -391
- package/app/theme/component-tokens.json +6 -2
- package/app/theme/component-tokens.ts +6 -2
- package/app/types/overlay-loading.types.ts +32 -35
- package/app/utils/ads-filter-select.ts +191 -191
- package/app/utils/ads-table.ts +416 -398
- package/app/utils/calendar-date.ts +163 -163
- package/app/utils/category-role.ts +45 -45
- package/app/utils/money.ts +77 -77
- package/app/utils/notability.ts +8 -8
- package/app/utils/parser.ts +134 -134
- package/app/utils/percentage.ts +54 -54
- package/nuxt.config.ts +31 -31
- package/package.json +57 -56
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- Shimmer sobre conteúdo existente (só no código): o pai precisa de relative e overflow-hidden -->
|
|
3
|
-
<div
|
|
4
|
-
v-if="variant === 'shimmer' && overlay"
|
|
5
|
-
class="ads-loading-shimmer pointer-events-none absolute inset-0 z-10 overflow-hidden"
|
|
6
|
-
aria-hidden="true"
|
|
7
|
-
/>
|
|
8
|
-
|
|
9
|
-
<!-- Shimmer do Figma: bloco cinza com brilho que atravessa -->
|
|
10
|
-
<div
|
|
11
|
-
v-else-if="variant === 'shimmer'"
|
|
12
|
-
class="relative w-full overflow-hidden rounded-[var(--ads-radius-sm)]"
|
|
13
|
-
:class="[shimmerHeightClass, skeletonColorClass]"
|
|
14
|
-
role="status"
|
|
15
|
-
aria-label="Carregando"
|
|
16
|
-
>
|
|
17
|
-
<div class="ads-loading-shimmer absolute inset-0" aria-hidden="true" />
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<span
|
|
21
|
-
v-else-if="variant === 'skeleton' && lines < 1"
|
|
22
|
-
class="block animate-pulse rounded-[var(--ads-loading-radius)] motion-reduce:animate-none"
|
|
23
|
-
:class="skeletonColorClass"
|
|
24
|
-
role="status"
|
|
25
|
-
aria-label="Carregando"
|
|
26
|
-
/>
|
|
27
|
-
|
|
28
|
-
<div
|
|
29
|
-
v-else-if="variant === 'skeleton'"
|
|
30
|
-
class="flex w-full flex-col items-start gap-2"
|
|
31
|
-
role="status"
|
|
32
|
-
aria-label="Carregando"
|
|
33
|
-
>
|
|
34
|
-
<span
|
|
35
|
-
v-for="(width, index) in skeletonLines"
|
|
36
|
-
:key="index"
|
|
37
|
-
class="block animate-pulse rounded-[var(--ads-loading-radius)] motion-reduce:animate-none"
|
|
38
|
-
:class="[width, skeletonLineClass, skeletonColorClass]"
|
|
39
|
-
aria-hidden="true"
|
|
40
|
-
/>
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div
|
|
44
|
-
v-else-if="variant === 'logo'"
|
|
45
|
-
role="status"
|
|
46
|
-
:aria-label="label || 'Carregando'"
|
|
47
|
-
:class="logoRootClass"
|
|
48
|
-
>
|
|
49
|
-
<p v-if="label" :class="labelClass">{{ label }}</p>
|
|
50
|
-
<img
|
|
51
|
-
:src="radarLogoUrl"
|
|
52
|
-
alt=""
|
|
53
|
-
class="ads-loading-logo"
|
|
54
|
-
:class="[logoSizeClass, logoToneClass]"
|
|
55
|
-
aria-hidden="true"
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
<div
|
|
60
|
-
v-else
|
|
61
|
-
role="status"
|
|
62
|
-
:aria-label="label ? undefined : 'Carregando'"
|
|
63
|
-
:class="spinnerRootClass"
|
|
64
|
-
>
|
|
65
|
-
<svg
|
|
66
|
-
class="shrink-0 animate-spin motion-reduce:animate-none"
|
|
67
|
-
:width="spinner.px"
|
|
68
|
-
:height="spinner.px"
|
|
69
|
-
:viewBox="`0 0 ${spinner.px} ${spinner.px}`"
|
|
70
|
-
fill="none"
|
|
71
|
-
aria-hidden="true"
|
|
72
|
-
>
|
|
73
|
-
<circle
|
|
74
|
-
:cx="spinner.px / 2"
|
|
75
|
-
:cy="spinner.px / 2"
|
|
76
|
-
:r="spinner.radius"
|
|
77
|
-
:stroke-width="spinner.stroke"
|
|
78
|
-
:class="tone === 'muted' ? 'stroke-[var(--ads-loading-skeleton)]' : 'stroke-[var(--ads-loading-spinner-track)]'"
|
|
79
|
-
/>
|
|
80
|
-
<!-- Arco de 3/8 da volta, começando no topo -->
|
|
81
|
-
<circle
|
|
82
|
-
:cx="spinner.px / 2"
|
|
83
|
-
:cy="spinner.px / 2"
|
|
84
|
-
:r="spinner.radius"
|
|
85
|
-
:stroke-width="spinner.stroke"
|
|
86
|
-
:stroke-dasharray="`${spinner.arc} ${spinner.circumference}`"
|
|
87
|
-
:transform="`rotate(-90 ${spinner.px / 2} ${spinner.px / 2})`"
|
|
88
|
-
:class="tone === 'muted' ? 'stroke-[var(--ads-border-icon-support)]' : 'stroke-[var(--ads-loading-spinner-color)]'"
|
|
89
|
-
/>
|
|
90
|
-
</svg>
|
|
91
|
-
<p v-if="label" :class="labelClass">{{ label }}</p>
|
|
92
|
-
</div>
|
|
93
|
-
</template>
|
|
94
|
-
|
|
95
|
-
<script setup lang="ts">
|
|
96
|
-
import { computed } from "vue";
|
|
97
|
-
import radarLogoUrl from "../assets/brand/radar-symbol.svg?url";
|
|
98
|
-
|
|
99
|
-
export type AdsLoadingVariant = "spinner" | "skeleton" | "shimmer" | "logo";
|
|
100
|
-
export type AdsLoadingSize = "sm" | "md" | "lg";
|
|
101
|
-
export type AdsLoadingTone = "primary" | "muted";
|
|
102
|
-
|
|
103
|
-
const props = withDefaults(
|
|
104
|
-
defineProps<{
|
|
105
|
-
/**
|
|
106
|
-
* spinner: área ainda vazia.
|
|
107
|
-
* skeleton: o formato da tela já é conhecido.
|
|
108
|
-
* shimmer: bloco cinza com brilho; com `overlay`, brilho sobre o conteúdo.
|
|
109
|
-
* logo: símbolo do Radar, para a página ou uma seção inteira.
|
|
110
|
-
*/
|
|
111
|
-
variant?: AdsLoadingVariant;
|
|
112
|
-
/** sm na tabela, md na seção, lg no modal. */
|
|
113
|
-
size?: AdsLoadingSize;
|
|
114
|
-
/** primary no dado principal, muted em áreas secundárias. */
|
|
115
|
-
tone?: AdsLoadingTone;
|
|
116
|
-
/** Centraliza o spinner ou o logo numa seção vazia. Só no código: o Figma não tem esse eixo. */
|
|
117
|
-
region?: boolean;
|
|
118
|
-
/** Rótulo: à direita do spinner, acima do logo. */
|
|
119
|
-
label?: string;
|
|
120
|
-
/**
|
|
121
|
-
* Linhas do skeleton. Zero desenha um bloco só; altura e largura vêm da class.
|
|
122
|
-
* Só no código: o Figma define 3 linhas fixas.
|
|
123
|
-
*/
|
|
124
|
-
lines?: number;
|
|
125
|
-
/** Shimmer só com o brilho, por cima do conteúdo do pai. Só no código. */
|
|
126
|
-
overlay?: boolean;
|
|
127
|
-
}>(),
|
|
128
|
-
{
|
|
129
|
-
variant: "spinner",
|
|
130
|
-
size: "md",
|
|
131
|
-
tone: "primary",
|
|
132
|
-
region: false,
|
|
133
|
-
label: "",
|
|
134
|
-
lines: 3,
|
|
135
|
-
overlay: false,
|
|
136
|
-
},
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
/** Anel do Figma: 16, 24 e 40 px, com trilha de 2, 3 e 4 px. */
|
|
140
|
-
const SPINNER = {
|
|
141
|
-
sm: { px: 16, stroke: 2 },
|
|
142
|
-
md: { px: 24, stroke: 3 },
|
|
143
|
-
lg: { px: 40, stroke: 4 },
|
|
144
|
-
} as const;
|
|
145
|
-
|
|
146
|
-
const spinner = computed(() => {
|
|
147
|
-
const { px, stroke } = SPINNER[props.size];
|
|
148
|
-
const radius = (px - stroke) / 2;
|
|
149
|
-
const circumference = 2 * Math.PI * radius;
|
|
150
|
-
return { px, stroke, radius, circumference, arc: circumference * 0.375 };
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
/** Larguras do Figma: 240, 192 e 144 px num bloco de 240. */
|
|
154
|
-
const skeletonWidths = ["w-full", "w-4/5", "w-3/5"] as const;
|
|
155
|
-
|
|
156
|
-
const skeletonLines = computed(() =>
|
|
157
|
-
Array.from({ length: props.lines }, (_, index) => skeletonWidths[index % skeletonWidths.length]),
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
const skeletonLineClass = computed(() => {
|
|
161
|
-
if (props.size === "sm") return "h-2";
|
|
162
|
-
if (props.size === "lg") return "h-4";
|
|
163
|
-
return "h-[var(--ads-loading-bar)]";
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
const skeletonColorClass = computed(() =>
|
|
167
|
-
props.tone === "muted" ? "bg-[var(--ads-loading-skeleton-muted)]" : "bg-[var(--ads-loading-skeleton)]",
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const shimmerHeightClass = computed(() => {
|
|
171
|
-
if (props.size === "sm") return "h-10";
|
|
172
|
-
if (props.size === "lg") return "h-30";
|
|
173
|
-
return "h-20";
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
const logoSizeClass = computed(() => {
|
|
177
|
-
// Tamanhos do Figma: 66×41, 156×98 e 216×136.
|
|
178
|
-
if (props.size === "sm") return "h-[41px] w-auto";
|
|
179
|
-
if (props.size === "lg") return "h-[136px] w-auto";
|
|
180
|
-
return "h-[98px] w-auto";
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
const logoToneClass = computed(() =>
|
|
184
|
-
props.tone === "muted" ? "opacity-40" : "opacity-100",
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
const labelClass =
|
|
188
|
-
"text-[length:var(--ads-loading-label-size)] leading-[1.3] whitespace-nowrap text-[var(--ads-text-secondary)]";
|
|
189
|
-
|
|
190
|
-
const regionClass = "flex min-h-48 w-full items-center justify-center gap-2 py-10 text-center sm:py-12";
|
|
191
|
-
|
|
192
|
-
const logoRootClass = computed(() =>
|
|
193
|
-
props.region ? `${regionClass} flex-col` : "inline-flex flex-col items-center gap-2 text-center",
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
const spinnerRootClass = computed(() =>
|
|
197
|
-
props.region ? regionClass : "inline-flex items-center gap-2",
|
|
198
|
-
);
|
|
199
|
-
</script>
|
|
200
|
-
|
|
201
|
-
<style scoped>
|
|
202
|
-
.ads-loading-logo {
|
|
203
|
-
animation: ads-loading-logo-pulse 1.6s ease-in-out infinite;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
@keyframes ads-loading-logo-pulse {
|
|
207
|
-
0%, 100% { opacity: 1; }
|
|
208
|
-
50% { opacity: 0.25; }
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
@media (prefers-reduced-motion: reduce) {
|
|
212
|
-
.ads-loading-logo {
|
|
213
|
-
animation: none;
|
|
214
|
-
opacity: 0.5;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Shimmer sobre conteúdo existente (só no código): o pai precisa de relative e overflow-hidden -->
|
|
3
|
+
<div
|
|
4
|
+
v-if="variant === 'shimmer' && overlay"
|
|
5
|
+
class="ads-loading-shimmer pointer-events-none absolute inset-0 z-10 overflow-hidden"
|
|
6
|
+
aria-hidden="true"
|
|
7
|
+
/>
|
|
8
|
+
|
|
9
|
+
<!-- Shimmer do Figma: bloco cinza com brilho que atravessa -->
|
|
10
|
+
<div
|
|
11
|
+
v-else-if="variant === 'shimmer'"
|
|
12
|
+
class="relative w-full overflow-hidden rounded-[var(--ads-radius-sm)]"
|
|
13
|
+
:class="[shimmerHeightClass, skeletonColorClass]"
|
|
14
|
+
role="status"
|
|
15
|
+
aria-label="Carregando"
|
|
16
|
+
>
|
|
17
|
+
<div class="ads-loading-shimmer absolute inset-0" aria-hidden="true" />
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<span
|
|
21
|
+
v-else-if="variant === 'skeleton' && lines < 1"
|
|
22
|
+
class="block animate-pulse rounded-[var(--ads-loading-radius)] motion-reduce:animate-none"
|
|
23
|
+
:class="skeletonColorClass"
|
|
24
|
+
role="status"
|
|
25
|
+
aria-label="Carregando"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<div
|
|
29
|
+
v-else-if="variant === 'skeleton'"
|
|
30
|
+
class="flex w-full flex-col items-start gap-2"
|
|
31
|
+
role="status"
|
|
32
|
+
aria-label="Carregando"
|
|
33
|
+
>
|
|
34
|
+
<span
|
|
35
|
+
v-for="(width, index) in skeletonLines"
|
|
36
|
+
:key="index"
|
|
37
|
+
class="block animate-pulse rounded-[var(--ads-loading-radius)] motion-reduce:animate-none"
|
|
38
|
+
:class="[width, skeletonLineClass, skeletonColorClass]"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div
|
|
44
|
+
v-else-if="variant === 'logo'"
|
|
45
|
+
role="status"
|
|
46
|
+
:aria-label="label || 'Carregando'"
|
|
47
|
+
:class="logoRootClass"
|
|
48
|
+
>
|
|
49
|
+
<p v-if="label" :class="labelClass">{{ label }}</p>
|
|
50
|
+
<img
|
|
51
|
+
:src="radarLogoUrl"
|
|
52
|
+
alt=""
|
|
53
|
+
class="ads-loading-logo"
|
|
54
|
+
:class="[logoSizeClass, logoToneClass]"
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
v-else
|
|
61
|
+
role="status"
|
|
62
|
+
:aria-label="label ? undefined : 'Carregando'"
|
|
63
|
+
:class="spinnerRootClass"
|
|
64
|
+
>
|
|
65
|
+
<svg
|
|
66
|
+
class="shrink-0 animate-spin motion-reduce:animate-none"
|
|
67
|
+
:width="spinner.px"
|
|
68
|
+
:height="spinner.px"
|
|
69
|
+
:viewBox="`0 0 ${spinner.px} ${spinner.px}`"
|
|
70
|
+
fill="none"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
>
|
|
73
|
+
<circle
|
|
74
|
+
:cx="spinner.px / 2"
|
|
75
|
+
:cy="spinner.px / 2"
|
|
76
|
+
:r="spinner.radius"
|
|
77
|
+
:stroke-width="spinner.stroke"
|
|
78
|
+
:class="tone === 'muted' ? 'stroke-[var(--ads-loading-skeleton)]' : 'stroke-[var(--ads-loading-spinner-track)]'"
|
|
79
|
+
/>
|
|
80
|
+
<!-- Arco de 3/8 da volta, começando no topo -->
|
|
81
|
+
<circle
|
|
82
|
+
:cx="spinner.px / 2"
|
|
83
|
+
:cy="spinner.px / 2"
|
|
84
|
+
:r="spinner.radius"
|
|
85
|
+
:stroke-width="spinner.stroke"
|
|
86
|
+
:stroke-dasharray="`${spinner.arc} ${spinner.circumference}`"
|
|
87
|
+
:transform="`rotate(-90 ${spinner.px / 2} ${spinner.px / 2})`"
|
|
88
|
+
:class="tone === 'muted' ? 'stroke-[var(--ads-border-icon-support)]' : 'stroke-[var(--ads-loading-spinner-color)]'"
|
|
89
|
+
/>
|
|
90
|
+
</svg>
|
|
91
|
+
<p v-if="label" :class="labelClass">{{ label }}</p>
|
|
92
|
+
</div>
|
|
93
|
+
</template>
|
|
94
|
+
|
|
95
|
+
<script setup lang="ts">
|
|
96
|
+
import { computed } from "vue";
|
|
97
|
+
import radarLogoUrl from "../assets/brand/radar-symbol.svg?url";
|
|
98
|
+
|
|
99
|
+
export type AdsLoadingVariant = "spinner" | "skeleton" | "shimmer" | "logo";
|
|
100
|
+
export type AdsLoadingSize = "sm" | "md" | "lg";
|
|
101
|
+
export type AdsLoadingTone = "primary" | "muted";
|
|
102
|
+
|
|
103
|
+
const props = withDefaults(
|
|
104
|
+
defineProps<{
|
|
105
|
+
/**
|
|
106
|
+
* spinner: área ainda vazia.
|
|
107
|
+
* skeleton: o formato da tela já é conhecido.
|
|
108
|
+
* shimmer: bloco cinza com brilho; com `overlay`, brilho sobre o conteúdo.
|
|
109
|
+
* logo: símbolo do Radar, para a página ou uma seção inteira.
|
|
110
|
+
*/
|
|
111
|
+
variant?: AdsLoadingVariant;
|
|
112
|
+
/** sm na tabela, md na seção, lg no modal. */
|
|
113
|
+
size?: AdsLoadingSize;
|
|
114
|
+
/** primary no dado principal, muted em áreas secundárias. */
|
|
115
|
+
tone?: AdsLoadingTone;
|
|
116
|
+
/** Centraliza o spinner ou o logo numa seção vazia. Só no código: o Figma não tem esse eixo. */
|
|
117
|
+
region?: boolean;
|
|
118
|
+
/** Rótulo: à direita do spinner, acima do logo. */
|
|
119
|
+
label?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Linhas do skeleton. Zero desenha um bloco só; altura e largura vêm da class.
|
|
122
|
+
* Só no código: o Figma define 3 linhas fixas.
|
|
123
|
+
*/
|
|
124
|
+
lines?: number;
|
|
125
|
+
/** Shimmer só com o brilho, por cima do conteúdo do pai. Só no código. */
|
|
126
|
+
overlay?: boolean;
|
|
127
|
+
}>(),
|
|
128
|
+
{
|
|
129
|
+
variant: "spinner",
|
|
130
|
+
size: "md",
|
|
131
|
+
tone: "primary",
|
|
132
|
+
region: false,
|
|
133
|
+
label: "",
|
|
134
|
+
lines: 3,
|
|
135
|
+
overlay: false,
|
|
136
|
+
},
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
/** Anel do Figma: 16, 24 e 40 px, com trilha de 2, 3 e 4 px. */
|
|
140
|
+
const SPINNER = {
|
|
141
|
+
sm: { px: 16, stroke: 2 },
|
|
142
|
+
md: { px: 24, stroke: 3 },
|
|
143
|
+
lg: { px: 40, stroke: 4 },
|
|
144
|
+
} as const;
|
|
145
|
+
|
|
146
|
+
const spinner = computed(() => {
|
|
147
|
+
const { px, stroke } = SPINNER[props.size];
|
|
148
|
+
const radius = (px - stroke) / 2;
|
|
149
|
+
const circumference = 2 * Math.PI * radius;
|
|
150
|
+
return { px, stroke, radius, circumference, arc: circumference * 0.375 };
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
/** Larguras do Figma: 240, 192 e 144 px num bloco de 240. */
|
|
154
|
+
const skeletonWidths = ["w-full", "w-4/5", "w-3/5"] as const;
|
|
155
|
+
|
|
156
|
+
const skeletonLines = computed(() =>
|
|
157
|
+
Array.from({ length: props.lines }, (_, index) => skeletonWidths[index % skeletonWidths.length]),
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const skeletonLineClass = computed(() => {
|
|
161
|
+
if (props.size === "sm") return "h-2";
|
|
162
|
+
if (props.size === "lg") return "h-4";
|
|
163
|
+
return "h-[var(--ads-loading-bar)]";
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const skeletonColorClass = computed(() =>
|
|
167
|
+
props.tone === "muted" ? "bg-[var(--ads-loading-skeleton-muted)]" : "bg-[var(--ads-loading-skeleton)]",
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const shimmerHeightClass = computed(() => {
|
|
171
|
+
if (props.size === "sm") return "h-10";
|
|
172
|
+
if (props.size === "lg") return "h-30";
|
|
173
|
+
return "h-20";
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const logoSizeClass = computed(() => {
|
|
177
|
+
// Tamanhos do Figma: 66×41, 156×98 e 216×136.
|
|
178
|
+
if (props.size === "sm") return "h-[41px] w-auto";
|
|
179
|
+
if (props.size === "lg") return "h-[136px] w-auto";
|
|
180
|
+
return "h-[98px] w-auto";
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const logoToneClass = computed(() =>
|
|
184
|
+
props.tone === "muted" ? "opacity-40" : "opacity-100",
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const labelClass =
|
|
188
|
+
"text-[length:var(--ads-loading-label-size)] leading-[1.3] whitespace-nowrap text-[var(--ads-text-secondary)]";
|
|
189
|
+
|
|
190
|
+
const regionClass = "flex min-h-48 w-full items-center justify-center gap-2 py-10 text-center sm:py-12";
|
|
191
|
+
|
|
192
|
+
const logoRootClass = computed(() =>
|
|
193
|
+
props.region ? `${regionClass} flex-col` : "inline-flex flex-col items-center gap-2 text-center",
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
const spinnerRootClass = computed(() =>
|
|
197
|
+
props.region ? regionClass : "inline-flex items-center gap-2",
|
|
198
|
+
);
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<style scoped>
|
|
202
|
+
.ads-loading-logo {
|
|
203
|
+
animation: ads-loading-logo-pulse 1.6s ease-in-out infinite;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@keyframes ads-loading-logo-pulse {
|
|
207
|
+
0%, 100% { opacity: 1; }
|
|
208
|
+
50% { opacity: 0.25; }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@media (prefers-reduced-motion: reduce) {
|
|
212
|
+
.ads-loading-logo {
|
|
213
|
+
animation: none;
|
|
214
|
+
opacity: 0.5;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
</style>
|
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<nav
|
|
3
|
-
class="flex w-[var(--ads-menu-width)] flex-col items-center gap-[var(--ads-menu-gap)] bg-[var(--ads-surface-card)] px-0 py-[var(--ads-menu-padding-y)] shadow-[0_2px_4px_-1px_color-mix(in_srgb,var(--color-ads-neutro-medio-60)_75%,transparent)]"
|
|
4
|
-
aria-label="Menu principal"
|
|
5
|
-
>
|
|
6
|
-
<template v-for="item in items" :key="item.id">
|
|
7
|
-
<span
|
|
8
|
-
v-if="item.dividerBefore"
|
|
9
|
-
class="h-px w-12 bg-[var(--ads-menu-divider)]"
|
|
10
|
-
role="separator"
|
|
11
|
-
/>
|
|
12
|
-
<component
|
|
13
|
-
:is="item.to ? NuxtLink : 'button'"
|
|
14
|
-
v-bind="item.to ? { to: item.to } : { type: 'button' }"
|
|
15
|
-
class="flex w-full flex-col items-center gap-1 rounded-[var(--ads-radius-xsm)] px-1 py-0 text-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
16
|
-
:class="stateOf(item) === 'open' ? 'shadow-[inset_4px_0_0_var(--ads-text-brand)]' : ''"
|
|
17
|
-
:aria-current="stateOf(item) === 'regular' ? undefined : 'page'"
|
|
18
|
-
@click="onSelect(item.id)"
|
|
19
|
-
>
|
|
20
|
-
<span class="flex size-[var(--ads-menu-icon-box)] items-center justify-center rounded-[var(--ads-radius-xsm)] p-1">
|
|
21
|
-
<UIcon :name="item.icon" class="size-[var(--ads-menu-icon)]" :class="iconTone(item)" />
|
|
22
|
-
</span>
|
|
23
|
-
<span
|
|
24
|
-
class="max-w-full text-[length:var(--ads-menu-label-size)] font-bold leading-[1.2] whitespace-pre-line"
|
|
25
|
-
:class="labelTone(item)"
|
|
26
|
-
>{{ item.label }}</span>
|
|
27
|
-
</component>
|
|
28
|
-
<span
|
|
29
|
-
v-if="item.dividerAfter"
|
|
30
|
-
class="h-px w-12 bg-[var(--ads-menu-divider)]"
|
|
31
|
-
role="separator"
|
|
32
|
-
/>
|
|
33
|
-
</template>
|
|
34
|
-
</nav>
|
|
35
|
-
</template>
|
|
36
|
-
|
|
37
|
-
<script lang="ts">
|
|
38
|
-
import type { RouteLocationRaw } from "vue-router";
|
|
39
|
-
|
|
40
|
-
export type AdsMenuBarState = "regular" | "selected" | "open";
|
|
41
|
-
|
|
42
|
-
export type AdsMenuBarItem = {
|
|
43
|
-
id: string;
|
|
44
|
-
label: string;
|
|
45
|
-
icon: string;
|
|
46
|
-
to?: RouteLocationRaw;
|
|
47
|
-
dividerBefore?: boolean;
|
|
48
|
-
/** Linha depois do item. O Figma fecha a lista com uma linha após Campanhas. */
|
|
49
|
-
dividerAfter?: boolean;
|
|
50
|
-
state?: AdsMenuBarState;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/** Ordem do Menu bar default no Figma. Home usa o mesmo tom dos demais (o frame default pinta o rótulo em dark/500). */
|
|
54
|
-
export const adsMenuBarItems: AdsMenuBarItem[] = [
|
|
55
|
-
{ id: "home", label: "Home", icon: "i-lucide-home" },
|
|
56
|
-
{ id: "gestao", label: "Gestão", icon: "i-lucide-folder-tree", dividerBefore: true },
|
|
57
|
-
{ id: "financas", label: "Finanças", icon: "i-lucide-hand-coins" },
|
|
58
|
-
{ id: "compras", label: "Compras", icon: "i-lucide-shopping-cart" },
|
|
59
|
-
{ id: "trade", label: "Trade", icon: "i-lucide-store" },
|
|
60
|
-
{ id: "marketing", label: "Marketing", icon: "i-lucide-megaphone" },
|
|
61
|
-
{ id: "capacitacao", label: "Capacitação", icon: "i-lucide-book-open" },
|
|
62
|
-
{ id: "relatorios", label: "Relatórios", icon: "i-lucide-bar-chart-big" },
|
|
63
|
-
{ id: "promocao", label: "Promoção", icon: "i-lucide-trophy" },
|
|
64
|
-
{ id: "encontro", label: "Encontro\nFarmarcas", icon: "i-lucide-contact" },
|
|
65
|
-
{ id: "campanhas", label: "Campanhas", icon: "i-lucide-goal", dividerAfter: true },
|
|
66
|
-
];
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<script setup lang="ts">
|
|
70
|
-
import { NuxtLink } from "#components";
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const props = withDefaults(
|
|
75
|
-
defineProps<{
|
|
76
|
-
items?: AdsMenuBarItem[];
|
|
77
|
-
activeId?: string;
|
|
78
|
-
openId?: string;
|
|
79
|
-
}>(),
|
|
80
|
-
{
|
|
81
|
-
items: () => adsMenuBarItems,
|
|
82
|
-
activeId: "",
|
|
83
|
-
openId: "",
|
|
84
|
-
},
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const emit = defineEmits<{
|
|
88
|
-
"update:activeId": [id: string];
|
|
89
|
-
select: [id: string];
|
|
90
|
-
}>();
|
|
91
|
-
|
|
92
|
-
const stateOf = (item: AdsMenuBarItem): AdsMenuBarState => {
|
|
93
|
-
if (item.state) return item.state;
|
|
94
|
-
if (props.openId === item.id) return "open";
|
|
95
|
-
if (props.activeId === item.id) return "selected";
|
|
96
|
-
return "regular";
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const iconTone = (item: AdsMenuBarItem) =>
|
|
100
|
-
stateOf(item) === "regular" ? "text-ads-neutro-escuro-500" : "text-[var(--ads-text-brand)]";
|
|
101
|
-
|
|
102
|
-
const labelTone = (item: AdsMenuBarItem) =>
|
|
103
|
-
stateOf(item) === "regular" ? "text-[var(--ads-text-secondary)]" : "text-[var(--ads-text-brand)]";
|
|
104
|
-
|
|
105
|
-
const onSelect = (id: string) => {
|
|
106
|
-
emit("update:activeId", id);
|
|
107
|
-
emit("select", id);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<nav
|
|
3
|
+
class="flex w-[var(--ads-menu-width)] flex-col items-center gap-[var(--ads-menu-gap)] bg-[var(--ads-surface-card)] px-0 py-[var(--ads-menu-padding-y)] shadow-[0_2px_4px_-1px_color-mix(in_srgb,var(--color-ads-neutro-medio-60)_75%,transparent)]"
|
|
4
|
+
aria-label="Menu principal"
|
|
5
|
+
>
|
|
6
|
+
<template v-for="item in items" :key="item.id">
|
|
7
|
+
<span
|
|
8
|
+
v-if="item.dividerBefore"
|
|
9
|
+
class="h-px w-12 bg-[var(--ads-menu-divider)]"
|
|
10
|
+
role="separator"
|
|
11
|
+
/>
|
|
12
|
+
<component
|
|
13
|
+
:is="item.to ? NuxtLink : 'button'"
|
|
14
|
+
v-bind="item.to ? { to: item.to } : { type: 'button' }"
|
|
15
|
+
class="flex w-full flex-col items-center gap-1 rounded-[var(--ads-radius-xsm)] px-1 py-0 text-center focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
16
|
+
:class="stateOf(item) === 'open' ? 'shadow-[inset_4px_0_0_var(--ads-text-brand)]' : ''"
|
|
17
|
+
:aria-current="stateOf(item) === 'regular' ? undefined : 'page'"
|
|
18
|
+
@click="onSelect(item.id)"
|
|
19
|
+
>
|
|
20
|
+
<span class="flex size-[var(--ads-menu-icon-box)] items-center justify-center rounded-[var(--ads-radius-xsm)] p-1">
|
|
21
|
+
<UIcon :name="item.icon" class="size-[var(--ads-menu-icon)]" :class="iconTone(item)" />
|
|
22
|
+
</span>
|
|
23
|
+
<span
|
|
24
|
+
class="max-w-full text-[length:var(--ads-menu-label-size)] font-bold leading-[1.2] whitespace-pre-line"
|
|
25
|
+
:class="labelTone(item)"
|
|
26
|
+
>{{ item.label }}</span>
|
|
27
|
+
</component>
|
|
28
|
+
<span
|
|
29
|
+
v-if="item.dividerAfter"
|
|
30
|
+
class="h-px w-12 bg-[var(--ads-menu-divider)]"
|
|
31
|
+
role="separator"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
34
|
+
</nav>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
import type { RouteLocationRaw } from "vue-router";
|
|
39
|
+
|
|
40
|
+
export type AdsMenuBarState = "regular" | "selected" | "open";
|
|
41
|
+
|
|
42
|
+
export type AdsMenuBarItem = {
|
|
43
|
+
id: string;
|
|
44
|
+
label: string;
|
|
45
|
+
icon: string;
|
|
46
|
+
to?: RouteLocationRaw;
|
|
47
|
+
dividerBefore?: boolean;
|
|
48
|
+
/** Linha depois do item. O Figma fecha a lista com uma linha após Campanhas. */
|
|
49
|
+
dividerAfter?: boolean;
|
|
50
|
+
state?: AdsMenuBarState;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** Ordem do Menu bar default no Figma. Home usa o mesmo tom dos demais (o frame default pinta o rótulo em dark/500). */
|
|
54
|
+
export const adsMenuBarItems: AdsMenuBarItem[] = [
|
|
55
|
+
{ id: "home", label: "Home", icon: "i-lucide-home" },
|
|
56
|
+
{ id: "gestao", label: "Gestão", icon: "i-lucide-folder-tree", dividerBefore: true },
|
|
57
|
+
{ id: "financas", label: "Finanças", icon: "i-lucide-hand-coins" },
|
|
58
|
+
{ id: "compras", label: "Compras", icon: "i-lucide-shopping-cart" },
|
|
59
|
+
{ id: "trade", label: "Trade", icon: "i-lucide-store" },
|
|
60
|
+
{ id: "marketing", label: "Marketing", icon: "i-lucide-megaphone" },
|
|
61
|
+
{ id: "capacitacao", label: "Capacitação", icon: "i-lucide-book-open" },
|
|
62
|
+
{ id: "relatorios", label: "Relatórios", icon: "i-lucide-bar-chart-big" },
|
|
63
|
+
{ id: "promocao", label: "Promoção", icon: "i-lucide-trophy" },
|
|
64
|
+
{ id: "encontro", label: "Encontro\nFarmarcas", icon: "i-lucide-contact" },
|
|
65
|
+
{ id: "campanhas", label: "Campanhas", icon: "i-lucide-goal", dividerAfter: true },
|
|
66
|
+
];
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<script setup lang="ts">
|
|
70
|
+
import { NuxtLink } from "#components";
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
const props = withDefaults(
|
|
75
|
+
defineProps<{
|
|
76
|
+
items?: AdsMenuBarItem[];
|
|
77
|
+
activeId?: string;
|
|
78
|
+
openId?: string;
|
|
79
|
+
}>(),
|
|
80
|
+
{
|
|
81
|
+
items: () => adsMenuBarItems,
|
|
82
|
+
activeId: "",
|
|
83
|
+
openId: "",
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const emit = defineEmits<{
|
|
88
|
+
"update:activeId": [id: string];
|
|
89
|
+
select: [id: string];
|
|
90
|
+
}>();
|
|
91
|
+
|
|
92
|
+
const stateOf = (item: AdsMenuBarItem): AdsMenuBarState => {
|
|
93
|
+
if (item.state) return item.state;
|
|
94
|
+
if (props.openId === item.id) return "open";
|
|
95
|
+
if (props.activeId === item.id) return "selected";
|
|
96
|
+
return "regular";
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const iconTone = (item: AdsMenuBarItem) =>
|
|
100
|
+
stateOf(item) === "regular" ? "text-ads-neutro-escuro-500" : "text-[var(--ads-text-brand)]";
|
|
101
|
+
|
|
102
|
+
const labelTone = (item: AdsMenuBarItem) =>
|
|
103
|
+
stateOf(item) === "regular" ? "text-[var(--ads-text-secondary)]" : "text-[var(--ads-text-brand)]";
|
|
104
|
+
|
|
105
|
+
const onSelect = (id: string) => {
|
|
106
|
+
emit("update:activeId", id);
|
|
107
|
+
emit("select", id);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
</script>
|