ads-nuxt 0.1.4 → 0.2.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/LICENSE +21 -21
- package/README.md +573 -577
- 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 -0
- package/app/assets/brand/radar.svg +9 -9
- package/app/assets/css/ads-colors.css +257 -246
- package/app/assets/css/component-tokens.css +367 -403
- package/app/assets/css/main.css +624 -617
- package/app/components/AdsBadge.vue +47 -48
- package/app/components/AdsBroadcast.vue +24 -45
- package/app/components/AdsButton.vue +539 -569
- package/app/components/AdsButtonGroup.vue +39 -39
- package/app/components/AdsButtonMenu.vue +48 -48
- package/app/components/AdsCard.vue +188 -117
- package/app/components/AdsCardHint.vue +22 -0
- package/app/components/AdsCardPeriod.vue +43 -0
- package/app/components/AdsCardVariation.vue +31 -0
- package/app/components/AdsCharttip.vue +78 -78
- package/app/components/AdsCheckbox.vue +77 -77
- package/app/components/AdsDatePicker.vue +492 -479
- package/app/components/AdsDropdownMenu.vue +30 -19
- package/app/components/AdsEmptyState.vue +58 -58
- package/app/components/AdsFeatureCard.vue +210 -219
- package/app/components/AdsFileCard.vue +98 -101
- package/app/components/AdsFooter.vue +25 -25
- package/app/components/AdsHeavyAccountCell.vue +59 -0
- package/app/components/AdsHeavyHeaderCell.vue +70 -0
- package/app/components/AdsHeavyTable.vue +135 -0
- package/app/components/AdsInput.vue +147 -143
- package/app/components/AdsLoading.vue +217 -109
- package/app/components/AdsMenuBar.vue +103 -103
- package/app/components/AdsMetricCard.vue +216 -119
- package/app/components/AdsModal.vue +157 -157
- package/app/components/AdsMonthPicker.vue +80 -80
- package/app/components/AdsNavbarApp.vue +67 -67
- package/app/components/AdsNavbarDesk.vue +62 -62
- package/app/components/AdsNotabilityPill.vue +24 -27
- package/app/components/AdsNumberInput.vue +173 -166
- package/app/components/AdsPagination.vue +91 -91
- package/app/components/AdsPanelCard.vue +99 -0
- package/app/components/AdsPill.vue +144 -92
- package/app/components/AdsProductTag.vue +61 -61
- package/app/components/AdsRadio.vue +70 -70
- package/app/components/AdsSearchInput.vue +122 -113
- package/app/components/AdsSegmentedTabs.vue +62 -28
- package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -203
- package/app/components/AdsSelectItem.vue +128 -0
- package/app/components/AdsSelectPanel.vue +150 -0
- package/app/components/AdsSideMenu.vue +101 -101
- package/app/components/AdsSmalltip.vue +44 -44
- package/app/components/AdsStepper.vue +222 -0
- package/app/components/AdsSteptip.vue +101 -101
- package/app/components/AdsSwitch.vue +59 -59
- package/app/components/AdsTable.vue +161 -100
- package/app/components/AdsTableHeaderCell.vue +80 -0
- package/app/components/AdsTableSkeleton.vue +113 -0
- package/app/components/AdsTableToolbar.vue +44 -44
- package/app/components/AdsTabs.vue +51 -51
- package/app/components/AdsTextarea.vue +116 -109
- package/app/components/AdsToast.vue +183 -181
- package/app/components/AdsTooltip.vue +73 -73
- package/app/components/OverlayLoading.vue +173 -173
- package/app/components/ProgressBarLoading.vue +235 -256
- package/app/composables/useOverlayLoading.ts +66 -66
- package/app/constants/ads-color-swatches.ts +240 -239
- package/app/locale/pt-br.ts +6 -6
- package/app/plugins/ads-toast.client.ts +24 -24
- package/app/theme/ads-theme.ts +374 -370
- package/app/theme/ads-tokens.ts +391 -379
- package/app/theme/component-tokens.json +366 -402
- package/app/theme/component-tokens.ts +807 -815
- package/app/types/overlay-loading.types.ts +26 -26
- package/app/utils/ads-filter-select.ts +191 -172
- package/app/utils/ads-table.ts +395 -204
- 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 +1 -1
- package/app/components/AdsFarmarcasPill.vue +0 -74
- package/app/components/AdsFilterDropdown.vue +0 -174
- package/app/components/AdsFilterOption.vue +0 -74
- package/app/components/AdsListDropdown.vue +0 -44
- package/app/components/AdsMiniPill.vue +0 -40
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="inline-flex" role="radiogroup" :aria-label="ariaLabel">
|
|
3
|
-
<button
|
|
4
|
-
v-for="(option, index) in options"
|
|
5
|
-
:key="option.value"
|
|
6
|
-
type="button"
|
|
7
|
-
role="radio"
|
|
8
|
-
class="-ml-px h-[var(--ads-button-group-height)] border border-[var(--ads-button-group-border)] px-4 text-[length:var(--ads-button-group-font-size)] text-[var(--ads-text-primary)] first:ml-0 focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
9
|
-
:class="[
|
|
10
|
-
index === 0 ? 'rounded-l-[var(--ads-radius-xsm)]' : '',
|
|
11
|
-
index === options.length - 1 ? 'rounded-r-[var(--ads-radius-xsm)]' : '',
|
|
12
|
-
model === option.value ? 'z-[1] bg-[var(--ads-button-group-selected)] font-bold' : 'bg-[var(--ads-surface-card)] font-normal',
|
|
13
|
-
]"
|
|
14
|
-
:aria-checked="model === option.value"
|
|
15
|
-
@click="model = option.value"
|
|
16
|
-
>
|
|
17
|
-
{{ option.label }}
|
|
18
|
-
</button>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
export type AdsButtonGroupOption = {
|
|
24
|
-
value: string;
|
|
25
|
-
label: string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
withDefaults(
|
|
29
|
-
defineProps<{
|
|
30
|
-
options: AdsButtonGroupOption[];
|
|
31
|
-
ariaLabel?: string;
|
|
32
|
-
}>(),
|
|
33
|
-
{
|
|
34
|
-
ariaLabel: "Grupo de botões",
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const model = defineModel<string>({ required: true });
|
|
39
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="inline-flex" role="radiogroup" :aria-label="ariaLabel">
|
|
3
|
+
<button
|
|
4
|
+
v-for="(option, index) in options"
|
|
5
|
+
:key="option.value"
|
|
6
|
+
type="button"
|
|
7
|
+
role="radio"
|
|
8
|
+
class="-ml-px h-[var(--ads-button-group-height)] border border-[var(--ads-button-group-border)] px-4 text-[length:var(--ads-button-group-font-size)] text-[var(--ads-text-primary)] first:ml-0 focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
9
|
+
:class="[
|
|
10
|
+
index === 0 ? 'rounded-l-[var(--ads-radius-xsm)]' : '',
|
|
11
|
+
index === options.length - 1 ? 'rounded-r-[var(--ads-radius-xsm)]' : '',
|
|
12
|
+
model === option.value ? 'z-[1] bg-[var(--ads-button-group-selected)] font-bold' : 'bg-[var(--ads-surface-card)] font-normal',
|
|
13
|
+
]"
|
|
14
|
+
:aria-checked="model === option.value"
|
|
15
|
+
@click="model = option.value"
|
|
16
|
+
>
|
|
17
|
+
{{ option.label }}
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
export type AdsButtonGroupOption = {
|
|
24
|
+
value: string;
|
|
25
|
+
label: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
withDefaults(
|
|
29
|
+
defineProps<{
|
|
30
|
+
options: AdsButtonGroupOption[];
|
|
31
|
+
ariaLabel?: string;
|
|
32
|
+
}>(),
|
|
33
|
+
{
|
|
34
|
+
ariaLabel: "Grupo de botões",
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const model = defineModel<string>({ required: true });
|
|
39
|
+
</script>
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="flex w-[var(--ads-button-menu-width)] flex-col overflow-hidden rounded-[var(--ads-radius-xsm)] bg-[var(--ads-surface-card)] shadow-[var(--ads-shadow-level-1)]"
|
|
4
|
-
role="menu"
|
|
5
|
-
>
|
|
6
|
-
<button
|
|
7
|
-
v-for="option in options"
|
|
8
|
-
:key="option.value"
|
|
9
|
-
type="button"
|
|
10
|
-
role="menuitem"
|
|
11
|
-
class="flex flex-col border-b-[0.5px] border-[var(--ads-button-menu-border)] px-4 pt-2 pb-4 text-left last:border-b-0 hover:bg-ads-neutro-claro-20 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
12
|
-
@click="emit('select', option.value)"
|
|
13
|
-
>
|
|
14
|
-
<span class="flex h-10 items-center gap-2 text-[length:var(--ads-button-menu-title-size)] leading-[1.3] font-medium text-[var(--ads-button-menu-title)]">
|
|
15
|
-
<UIcon v-if="showIcons" :name="option.icon || 'i-lucide-sparkles'" class="size-4 shrink-0" />
|
|
16
|
-
{{ option.title }}
|
|
17
|
-
</span>
|
|
18
|
-
<span v-if="showSubtitles && option.subtitle" class="line-clamp-2 text-[length:var(--ads-button-menu-subtitle-size)] leading-[1.2] text-[var(--ads-button-menu-subtitle)]">
|
|
19
|
-
{{ option.subtitle }}
|
|
20
|
-
</span>
|
|
21
|
-
</button>
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script setup lang="ts">
|
|
26
|
-
export type AdsButtonMenuOption = {
|
|
27
|
-
value: string;
|
|
28
|
-
title: string;
|
|
29
|
-
subtitle?: string;
|
|
30
|
-
icon?: string;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
withDefaults(
|
|
34
|
-
defineProps<{
|
|
35
|
-
options: AdsButtonMenuOption[];
|
|
36
|
-
showSubtitles?: boolean;
|
|
37
|
-
showIcons?: boolean;
|
|
38
|
-
}>(),
|
|
39
|
-
{
|
|
40
|
-
showSubtitles: true,
|
|
41
|
-
showIcons: true,
|
|
42
|
-
},
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const emit = defineEmits<{
|
|
46
|
-
select: [value: string];
|
|
47
|
-
}>();
|
|
48
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="flex w-[var(--ads-button-menu-width)] flex-col overflow-hidden rounded-[var(--ads-radius-xsm)] bg-[var(--ads-surface-card)] shadow-[var(--ads-shadow-level-1)]"
|
|
4
|
+
role="menu"
|
|
5
|
+
>
|
|
6
|
+
<button
|
|
7
|
+
v-for="option in options"
|
|
8
|
+
:key="option.value"
|
|
9
|
+
type="button"
|
|
10
|
+
role="menuitem"
|
|
11
|
+
class="flex flex-col border-b-[0.5px] border-[var(--ads-button-menu-border)] px-4 pt-2 pb-4 text-left last:border-b-0 hover:bg-ads-neutro-claro-20 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
12
|
+
@click="emit('select', option.value)"
|
|
13
|
+
>
|
|
14
|
+
<span class="flex h-10 items-center gap-2 text-[length:var(--ads-button-menu-title-size)] leading-[1.3] font-medium text-[var(--ads-button-menu-title)]">
|
|
15
|
+
<UIcon v-if="showIcons" :name="option.icon || 'i-lucide-sparkles'" class="size-4 shrink-0" />
|
|
16
|
+
{{ option.title }}
|
|
17
|
+
</span>
|
|
18
|
+
<span v-if="showSubtitles && option.subtitle" class="line-clamp-2 text-[length:var(--ads-button-menu-subtitle-size)] leading-[1.2] text-[var(--ads-button-menu-subtitle)]">
|
|
19
|
+
{{ option.subtitle }}
|
|
20
|
+
</span>
|
|
21
|
+
</button>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
export type AdsButtonMenuOption = {
|
|
27
|
+
value: string;
|
|
28
|
+
title: string;
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
icon?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
withDefaults(
|
|
34
|
+
defineProps<{
|
|
35
|
+
options: AdsButtonMenuOption[];
|
|
36
|
+
showSubtitles?: boolean;
|
|
37
|
+
showIcons?: boolean;
|
|
38
|
+
}>(),
|
|
39
|
+
{
|
|
40
|
+
showSubtitles: true,
|
|
41
|
+
showIcons: true,
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits<{
|
|
46
|
+
select: [value: string];
|
|
47
|
+
}>();
|
|
48
|
+
</script>
|
|
@@ -1,117 +1,188 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="as"
|
|
4
|
-
:type="as === 'button' ? 'button' : undefined"
|
|
5
|
-
:disabled="as === 'button' ? disabled : undefined"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
v-if="
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="as"
|
|
4
|
+
:type="as === 'button' ? 'button' : undefined"
|
|
5
|
+
:disabled="as === 'button' ? disabled : undefined"
|
|
6
|
+
:aria-busy="loading || undefined"
|
|
7
|
+
class="flex h-full min-w-0 flex-col items-start gap-3 border p-[var(--ads-card-padding)] text-left transition-[background-color,border-color,box-shadow]"
|
|
8
|
+
:class="[radiusClass, surfaceClass]"
|
|
9
|
+
>
|
|
10
|
+
<!-- Cabeçalho -->
|
|
11
|
+
<div v-if="showHeader" class="flex w-full min-w-0 items-center gap-2">
|
|
12
|
+
<div class="min-w-0 flex-1">
|
|
13
|
+
<slot name="header">
|
|
14
|
+
<p :class="type === 'details' ? detailsTitleClass : containerTitleClass">{{ title }}</p>
|
|
15
|
+
</slot>
|
|
16
|
+
</div>
|
|
17
|
+
<AdsCardHint v-if="hint" :text="hint" />
|
|
18
|
+
<slot name="actions" />
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<AdsCardPeriod v-if="period || (loading && periodLabel && type === 'container')" :label="periodLabel" :value="period" :loading="loading" :skeleton-width="110" />
|
|
22
|
+
|
|
23
|
+
<p v-if="description && !loading && !empty" class="text-[length:var(--ads-card-body-size)] leading-[1.4] text-[var(--ads-card-body)]">
|
|
24
|
+
{{ description }}
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<!-- Vazio: mantém o cabeçalho e mostra o empty state -->
|
|
28
|
+
<div v-if="empty && !loading" class="flex w-full justify-center py-2">
|
|
29
|
+
<slot name="empty">
|
|
30
|
+
<AdsEmptyState small :title="emptyMessage" :subtitle="emptyDescription ?? ''" :show-actions="Boolean($slots['empty-actions'])">
|
|
31
|
+
<slot name="empty-actions" />
|
|
32
|
+
</AdsEmptyState>
|
|
33
|
+
</slot>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<!-- Detalhes: lista de informações -->
|
|
37
|
+
<template v-else-if="type === 'details'">
|
|
38
|
+
<div v-if="loading" class="flex w-full flex-col items-start gap-3" aria-hidden="true">
|
|
39
|
+
<span
|
|
40
|
+
v-for="(width, index) in detailSkeletonWidths"
|
|
41
|
+
:key="index"
|
|
42
|
+
class="block h-3.5 max-w-full animate-pulse rounded-[var(--ads-radius-xsm)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
|
|
43
|
+
:style="{ width: `${width}px` }"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
<dl v-else-if="rows.length" class="flex w-full flex-col items-start gap-3">
|
|
47
|
+
<div v-for="(row, index) in rows" :key="index" class="flex min-w-0 max-w-full items-center gap-1 text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">
|
|
48
|
+
<UIcon v-if="row.icon" :name="row.icon" class="size-4 shrink-0" aria-hidden="true" />
|
|
49
|
+
<dt class="shrink-0 font-bold">{{ row.label }}</dt>
|
|
50
|
+
<dd class="min-w-0 truncate">{{ row.value }}</dd>
|
|
51
|
+
</div>
|
|
52
|
+
</dl>
|
|
53
|
+
<slot />
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<!-- Container: conteúdo livre (gráfico, tabela, lista) -->
|
|
57
|
+
<template v-else>
|
|
58
|
+
<div v-if="loading" class="flex h-[200px] w-full items-center justify-center">
|
|
59
|
+
<AdsLoading variant="logo" />
|
|
60
|
+
</div>
|
|
61
|
+
<div v-else-if="$slots.default" class="w-full min-w-0 flex-1">
|
|
62
|
+
<slot />
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<div v-if="(footerText || $slots.footer) && !loading && !empty" class="flex w-full flex-wrap items-start justify-between gap-3">
|
|
67
|
+
<slot name="footer">
|
|
68
|
+
<p class="text-[length:var(--ads-font-size-xxxs)] text-[var(--ads-text-secondary)]">{{ footerText }}</p>
|
|
69
|
+
</slot>
|
|
70
|
+
</div>
|
|
71
|
+
</component>
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script setup lang="ts">
|
|
75
|
+
import { computed, useSlots, type Component } from "vue";
|
|
76
|
+
import AdsCardHint from "./AdsCardHint.vue";
|
|
77
|
+
import AdsCardPeriod from "./AdsCardPeriod.vue";
|
|
78
|
+
import AdsEmptyState from "./AdsEmptyState.vue";
|
|
79
|
+
import AdsLoading from "./AdsLoading.vue";
|
|
80
|
+
|
|
81
|
+
export type AdsCardType = "container" | "details";
|
|
82
|
+
|
|
83
|
+
export interface AdsCardRow {
|
|
84
|
+
/** Ícone Lucide de 16px. */
|
|
85
|
+
icon?: string;
|
|
86
|
+
/** Rótulo em negrito, como "Criado em:". */
|
|
87
|
+
label: string;
|
|
88
|
+
value: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const props = withDefaults(
|
|
92
|
+
defineProps<{
|
|
93
|
+
/**
|
|
94
|
+
* container: título, período e conteúdo livre no slot padrão.
|
|
95
|
+
* details: título maior e lista de informações (rows).
|
|
96
|
+
*/
|
|
97
|
+
type?: AdsCardType;
|
|
98
|
+
/** O slot header substitui. */
|
|
99
|
+
title?: string;
|
|
100
|
+
/** Texto do ícone de informação ao lado do título. */
|
|
101
|
+
hint?: string;
|
|
102
|
+
/** Datas do período, como "01/12/2023 - 20/12/2023". */
|
|
103
|
+
period?: string;
|
|
104
|
+
periodLabel?: string;
|
|
105
|
+
/** Linhas do card Detalhes. */
|
|
106
|
+
rows?: AdsCardRow[];
|
|
107
|
+
/** Texto de apoio abaixo do cabeçalho. Só no código: o Figma não tem. */
|
|
108
|
+
description?: string;
|
|
109
|
+
/** Linha curta no rodapé. O slot footer substitui. Só no código: o Figma não tem. */
|
|
110
|
+
footerText?: string;
|
|
111
|
+
/**
|
|
112
|
+
* `button` quando o cartão é a própria ação. Também aceita um componente de link
|
|
113
|
+
* (como NuxtLink, com `to` passado direto no card): fica clicável como o botão.
|
|
114
|
+
*/
|
|
115
|
+
as?: "div" | "button" | Component;
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
/** Hover padrão dos cards clicáveis: borda cinza mais escura e sombra leve. false desliga. */
|
|
118
|
+
hoverable?: boolean;
|
|
119
|
+
/** Estado Selecionado: fundo azul claro, borda azul e sombra. */
|
|
120
|
+
selected?: boolean;
|
|
121
|
+
/** `md` (12px) é o do Figma; `sm` (8px) é só no código. */
|
|
122
|
+
radius?: "sm" | "md";
|
|
123
|
+
/** Estado Carregando: no container, o loader do Radar; no details, skeleton nas linhas. */
|
|
124
|
+
loading?: boolean;
|
|
125
|
+
/** Estado Vazio: mantém o cabeçalho e mostra o empty state. */
|
|
126
|
+
empty?: boolean;
|
|
127
|
+
emptyMessage?: string;
|
|
128
|
+
emptyDescription?: string;
|
|
129
|
+
}>(),
|
|
130
|
+
{
|
|
131
|
+
type: "container",
|
|
132
|
+
title: undefined,
|
|
133
|
+
hint: undefined,
|
|
134
|
+
period: undefined,
|
|
135
|
+
periodLabel: "Período:",
|
|
136
|
+
rows: () => [],
|
|
137
|
+
description: undefined,
|
|
138
|
+
footerText: undefined,
|
|
139
|
+
as: "div",
|
|
140
|
+
disabled: false,
|
|
141
|
+
hoverable: true,
|
|
142
|
+
selected: false,
|
|
143
|
+
radius: "md",
|
|
144
|
+
loading: false,
|
|
145
|
+
empty: false,
|
|
146
|
+
emptyMessage: "Sem dados no período",
|
|
147
|
+
emptyDescription: undefined,
|
|
148
|
+
},
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const slots = useSlots();
|
|
152
|
+
|
|
153
|
+
const containerTitleClass = "text-[length:var(--ads-font-size-xs)] leading-[1.3] text-[var(--ads-card-title)]";
|
|
154
|
+
const detailsTitleClass = "text-[length:var(--ads-font-size-rg)] font-bold leading-[1.3] text-[var(--ads-card-title)]";
|
|
155
|
+
|
|
156
|
+
/** Larguras do skeleton do Figma; uma barra por linha. */
|
|
157
|
+
const SKELETON_WIDTHS = [200, 240, 160, 180, 260];
|
|
158
|
+
const detailSkeletonWidths = computed(() => {
|
|
159
|
+
const count = props.rows.length || SKELETON_WIDTHS.length;
|
|
160
|
+
return Array.from({ length: count }, (_, index) => SKELETON_WIDTHS[index % SKELETON_WIDTHS.length]);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const showHeader = computed(() => Boolean(props.title || props.hint || slots.header || slots.actions));
|
|
164
|
+
|
|
165
|
+
const radiusClass = computed(() =>
|
|
166
|
+
props.radius === "sm" ? "rounded-[var(--ads-card-radius-sm)]" : "rounded-[var(--ads-card-radius)]",
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const surfaceClass = computed(() => {
|
|
170
|
+
const classes = [
|
|
171
|
+
props.selected
|
|
172
|
+
? "border-[var(--ads-card-selected-border)] bg-[var(--ads-card-selected-background)] shadow-[var(--ads-shadow-level-1)]"
|
|
173
|
+
: "border-[var(--ads-card-border)] bg-[var(--ads-card-background)]",
|
|
174
|
+
];
|
|
175
|
+
|
|
176
|
+
if (props.as !== "div") {
|
|
177
|
+
classes.push(
|
|
178
|
+
"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
|
+
);
|
|
180
|
+
// Hover padrão de todos os cards clicáveis: neutro, borda cinza mais escura e sombra leve.
|
|
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)]");
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return classes;
|
|
187
|
+
});
|
|
188
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
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>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import AdsTooltip from "./AdsTooltip.vue";
|
|
17
|
+
|
|
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
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex w-full flex-wrap items-center gap-x-2 gap-y-1">
|
|
3
|
+
<span class="text-[length:var(--ads-font-size-xxxs)] leading-[1.2] text-[var(--ads-text-secondary)]">{{ label }}</span>
|
|
4
|
+
<span
|
|
5
|
+
v-if="loading"
|
|
6
|
+
class="block h-[18px] animate-pulse rounded-[var(--ads-radius-pill)] bg-[var(--ads-loading-skeleton)] motion-reduce:animate-none"
|
|
7
|
+
:style="{ width: `${skeletonWidth}px` }"
|
|
8
|
+
aria-hidden="true"
|
|
9
|
+
/>
|
|
10
|
+
<span
|
|
11
|
+
v-else-if="value"
|
|
12
|
+
class="inline-flex h-[18px] items-center rounded-[var(--ads-radius-pill)] px-2 text-[length:var(--ads-font-size-minimal)] font-bold leading-[1.1] whitespace-nowrap"
|
|
13
|
+
:class="tone === 'neutral'
|
|
14
|
+
? 'bg-[var(--ads-status-void-100)] text-[var(--ads-status-void-800)]'
|
|
15
|
+
: 'bg-ads-radar-25 text-ads-radar-800'"
|
|
16
|
+
>
|
|
17
|
+
{{ value }}
|
|
18
|
+
</span>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
/**
|
|
24
|
+
* Rótulo com selo, usado no período e no comparativo dos cards.
|
|
25
|
+
* brand é o selo de datas (azul); neutral é o selo do comparativo (cinza).
|
|
26
|
+
*/
|
|
27
|
+
withDefaults(
|
|
28
|
+
defineProps<{
|
|
29
|
+
label: string;
|
|
30
|
+
value?: string;
|
|
31
|
+
tone?: "brand" | "neutral";
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
/** Largura do skeleton do selo, em px. */
|
|
34
|
+
skeletonWidth?: number;
|
|
35
|
+
}>(),
|
|
36
|
+
{
|
|
37
|
+
value: undefined,
|
|
38
|
+
tone: "brand",
|
|
39
|
+
loading: false,
|
|
40
|
+
skeletonWidth: 150,
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="inline-flex shrink-0 items-center gap-0.5 text-[length:var(--ads-font-size-xxxs)] font-bold leading-[1.2] tabular-nums"
|
|
4
|
+
:class="tone === 'negative' ? 'text-[var(--ads-status-warning-500)]' : 'text-[var(--ads-status-success-800)]'"
|
|
5
|
+
>
|
|
6
|
+
<UIcon :name="direction === 'down' ? 'i-lucide-arrow-down' : 'i-lucide-arrow-up'" class="size-4" aria-hidden="true" />
|
|
7
|
+
<span class="sr-only">{{ direction === "down" ? "Queda de" : "Alta de" }}</span>
|
|
8
|
+
{{ value }}
|
|
9
|
+
</span>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
export type AdsCardVariationDirection = "up" | "down";
|
|
14
|
+
export type AdsCardVariationTone = "positive" | "negative";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Variação de métrica (_Card Variation do Figma): seta e percentual.
|
|
18
|
+
* direction diz se o número subiu ou caiu; tone diz se isso é bom (positive) ou ruim (negative).
|
|
19
|
+
*/
|
|
20
|
+
withDefaults(
|
|
21
|
+
defineProps<{
|
|
22
|
+
value: string;
|
|
23
|
+
direction?: AdsCardVariationDirection;
|
|
24
|
+
tone?: AdsCardVariationTone;
|
|
25
|
+
}>(),
|
|
26
|
+
{
|
|
27
|
+
direction: "up",
|
|
28
|
+
tone: "positive",
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
</script>
|