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.
Files changed (90) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -577
  3. package/app/app.config.ts +25 -25
  4. package/app/assets/ads/checkbox-check.svg +5 -5
  5. package/app/assets/ads/checkbox-minus.svg +5 -5
  6. package/app/assets/brand/farmarcas.svg +6 -6
  7. package/app/assets/brand/radar-symbol.svg +9 -0
  8. package/app/assets/brand/radar.svg +9 -9
  9. package/app/assets/css/ads-colors.css +257 -246
  10. package/app/assets/css/component-tokens.css +367 -403
  11. package/app/assets/css/main.css +624 -617
  12. package/app/components/AdsBadge.vue +47 -48
  13. package/app/components/AdsBroadcast.vue +24 -45
  14. package/app/components/AdsButton.vue +539 -569
  15. package/app/components/AdsButtonGroup.vue +39 -39
  16. package/app/components/AdsButtonMenu.vue +48 -48
  17. package/app/components/AdsCard.vue +188 -117
  18. package/app/components/AdsCardHint.vue +22 -0
  19. package/app/components/AdsCardPeriod.vue +43 -0
  20. package/app/components/AdsCardVariation.vue +31 -0
  21. package/app/components/AdsCharttip.vue +78 -78
  22. package/app/components/AdsCheckbox.vue +77 -77
  23. package/app/components/AdsDatePicker.vue +492 -479
  24. package/app/components/AdsDropdownMenu.vue +30 -19
  25. package/app/components/AdsEmptyState.vue +58 -58
  26. package/app/components/AdsFeatureCard.vue +210 -219
  27. package/app/components/AdsFileCard.vue +98 -101
  28. package/app/components/AdsFooter.vue +25 -25
  29. package/app/components/AdsHeavyAccountCell.vue +59 -0
  30. package/app/components/AdsHeavyHeaderCell.vue +70 -0
  31. package/app/components/AdsHeavyTable.vue +135 -0
  32. package/app/components/AdsInput.vue +147 -143
  33. package/app/components/AdsLoading.vue +217 -109
  34. package/app/components/AdsMenuBar.vue +103 -103
  35. package/app/components/AdsMetricCard.vue +216 -119
  36. package/app/components/AdsModal.vue +157 -157
  37. package/app/components/AdsMonthPicker.vue +80 -80
  38. package/app/components/AdsNavbarApp.vue +67 -67
  39. package/app/components/AdsNavbarDesk.vue +62 -62
  40. package/app/components/AdsNotabilityPill.vue +24 -27
  41. package/app/components/AdsNumberInput.vue +173 -166
  42. package/app/components/AdsPagination.vue +91 -91
  43. package/app/components/AdsPanelCard.vue +99 -0
  44. package/app/components/AdsPill.vue +144 -92
  45. package/app/components/AdsProductTag.vue +61 -61
  46. package/app/components/AdsRadio.vue +70 -70
  47. package/app/components/AdsSearchInput.vue +122 -113
  48. package/app/components/AdsSegmentedTabs.vue +62 -28
  49. package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -203
  50. package/app/components/AdsSelectItem.vue +128 -0
  51. package/app/components/AdsSelectPanel.vue +150 -0
  52. package/app/components/AdsSideMenu.vue +101 -101
  53. package/app/components/AdsSmalltip.vue +44 -44
  54. package/app/components/AdsStepper.vue +222 -0
  55. package/app/components/AdsSteptip.vue +101 -101
  56. package/app/components/AdsSwitch.vue +59 -59
  57. package/app/components/AdsTable.vue +161 -100
  58. package/app/components/AdsTableHeaderCell.vue +80 -0
  59. package/app/components/AdsTableSkeleton.vue +113 -0
  60. package/app/components/AdsTableToolbar.vue +44 -44
  61. package/app/components/AdsTabs.vue +51 -51
  62. package/app/components/AdsTextarea.vue +116 -109
  63. package/app/components/AdsToast.vue +183 -181
  64. package/app/components/AdsTooltip.vue +73 -73
  65. package/app/components/OverlayLoading.vue +173 -173
  66. package/app/components/ProgressBarLoading.vue +235 -256
  67. package/app/composables/useOverlayLoading.ts +66 -66
  68. package/app/constants/ads-color-swatches.ts +240 -239
  69. package/app/locale/pt-br.ts +6 -6
  70. package/app/plugins/ads-toast.client.ts +24 -24
  71. package/app/theme/ads-theme.ts +374 -370
  72. package/app/theme/ads-tokens.ts +391 -379
  73. package/app/theme/component-tokens.json +366 -402
  74. package/app/theme/component-tokens.ts +807 -815
  75. package/app/types/overlay-loading.types.ts +26 -26
  76. package/app/utils/ads-filter-select.ts +191 -172
  77. package/app/utils/ads-table.ts +395 -204
  78. package/app/utils/calendar-date.ts +163 -163
  79. package/app/utils/category-role.ts +45 -45
  80. package/app/utils/money.ts +77 -77
  81. package/app/utils/notability.ts +8 -8
  82. package/app/utils/parser.ts +134 -134
  83. package/app/utils/percentage.ts +54 -54
  84. package/nuxt.config.ts +31 -31
  85. package/package.json +1 -1
  86. package/app/components/AdsFarmarcasPill.vue +0 -74
  87. package/app/components/AdsFilterDropdown.vue +0 -174
  88. package/app/components/AdsFilterOption.vue +0 -74
  89. package/app/components/AdsListDropdown.vue +0 -44
  90. package/app/components/AdsMiniPill.vue +0 -40
@@ -0,0 +1,150 @@
1
+ <!--
2
+ AdsSelectPanel — peça interna do AdsSelect (Figma: Super dropdown). Use o AdsSelect;
3
+ para mostrar só a lista, AdsSelect com inline.
4
+ Seleção simples (radio) ou múltipla (checkbox), busca opcional no topo, "selecionar todos",
5
+ subtítulo, selo e itens desabilitados. A lista rola a partir de 320px.
6
+ -->
7
+ <template>
8
+ <div
9
+ class="flex flex-col overflow-hidden rounded-[var(--ads-radius-sm)] border border-[var(--ads-select-panel-border)] bg-[var(--ads-surface-card)] shadow-[var(--ads-shadow-level-1)]"
10
+ :class="widthClass"
11
+ >
12
+ <div v-if="searchable" class="border-b border-[var(--ads-select-divider)] px-4 pt-4 pb-3">
13
+ <UInput
14
+ v-model="query"
15
+ :placeholder="searchPlaceholder"
16
+ aria-label="Pesquisar opções"
17
+ icon="i-lucide-search"
18
+ color="neutral"
19
+ variant="outline"
20
+ size="md"
21
+ class="w-full"
22
+ :ui="searchFieldUi"
23
+ >
24
+ <template v-if="query" #trailing>
25
+ <button
26
+ type="button"
27
+ class="text-[var(--ads-text-secondary)]"
28
+ aria-label="Limpar busca"
29
+ @click="query = ''"
30
+ >
31
+ <UIcon name="i-lucide-x" class="size-4" />
32
+ </button>
33
+ </template>
34
+ </UInput>
35
+ </div>
36
+
37
+ <p
38
+ v-if="groups.empty"
39
+ class="flex min-h-12 items-center p-4 text-sm leading-[1.3] text-[var(--ads-text-secondary)]"
40
+ >
41
+ {{ emptyLabel }}
42
+ </p>
43
+
44
+ <div
45
+ v-else
46
+ class="max-h-[var(--ads-select-panel-max-height)] overflow-y-auto overscroll-contain [scrollbar-color:var(--color-ads-neutro-claro-50)_transparent] [scrollbar-width:thin]"
47
+ :role="type === 'radio' ? 'listbox' : 'group'"
48
+ :aria-label="listLabel"
49
+ >
50
+ <AdsSelectItem
51
+ v-if="showSelectAll"
52
+ mode="checkbox"
53
+ :label="selectAllLabel"
54
+ :selected="checkState === 'all'"
55
+ :indeterminate="checkState === 'partial'"
56
+ :divider="rows.length > 0"
57
+ @select="onSelectAll"
58
+ />
59
+ <AdsSelectItem
60
+ v-for="(option, index) in rows"
61
+ :key="option.value"
62
+ :mode="type"
63
+ :label="option.label"
64
+ :subtitle="option.subtitle"
65
+ :badge="option.badge"
66
+ :disabled="option.disabled"
67
+ :selected="isSelected(option.value)"
68
+ :divider="index < rows.length - 1"
69
+ @select="onSelect(option.value)"
70
+ />
71
+ </div>
72
+ </div>
73
+ </template>
74
+
75
+ <script setup lang="ts">
76
+ import { computed } from "vue";
77
+ import AdsSelectItem from "./AdsSelectItem.vue";
78
+ import {
79
+ groupFilterOptions,
80
+ selectionCheckState,
81
+ toggleFilterValue,
82
+ toggleSelectAll,
83
+ type AdsFilterOption as FilterOption,
84
+ } from "../utils/ads-filter-select";
85
+
86
+ const props = withDefaults(
87
+ defineProps<{
88
+ /** radio: seleção simples (Figma Simples). checkbox: seleção múltipla. */
89
+ type: "checkbox" | "radio";
90
+ options: FilterOption[];
91
+ /** Campo de busca no topo, com divisória. */
92
+ searchable?: boolean;
93
+ /** "Selecionar todos" no começo da lista. Só no checkbox, e some durante a busca. */
94
+ selectAll?: boolean;
95
+ selectAllLabel?: string;
96
+ emptyLabel?: string;
97
+ searchPlaceholder?: string;
98
+ listLabel?: string;
99
+ /** Largura do painel. Padrão: --ads-select-panel-width (320px). */
100
+ widthClass?: string;
101
+ }>(),
102
+ {
103
+ searchable: true,
104
+ selectAll: true,
105
+ selectAllLabel: "Selecionar todos",
106
+ emptyLabel: "Nenhum resultado",
107
+ searchPlaceholder: "Pesquisar",
108
+ listLabel: "Opções",
109
+ widthClass: "w-[var(--ads-select-panel-width)] max-w-full",
110
+ },
111
+ );
112
+
113
+ const model = defineModel<string | string[]>({ required: true });
114
+ const query = defineModel<string>("query", { default: "" });
115
+ const emit = defineEmits<{ pick: [] }>();
116
+
117
+ const groups = computed(() => groupFilterOptions(props.options, query.value));
118
+ /** Correspondência exata da busca vem primeiro. */
119
+ const rows = computed(() => [...groups.value.exact, ...groups.value.matches]);
120
+ const enabledOptions = computed(() => props.options.filter((option) => !option.disabled));
121
+
122
+ const selectedList = computed(() =>
123
+ Array.isArray(model.value) ? model.value : model.value ? [model.value] : [],
124
+ );
125
+ const checkState = computed(() => selectionCheckState(selectedList.value, enabledOptions.value));
126
+ const showSelectAll = computed(
127
+ () => props.type === "checkbox" && props.selectAll && query.value.trim() === "",
128
+ );
129
+
130
+ const isSelected = (value: string) => selectedList.value.includes(value);
131
+
132
+ const onSelect = (value: string) => {
133
+ if (props.type === "radio") {
134
+ model.value = value;
135
+ emit("pick");
136
+ return;
137
+ }
138
+ model.value = toggleFilterValue(selectedList.value, value);
139
+ };
140
+
141
+ const onSelectAll = () => {
142
+ model.value = toggleSelectAll(selectedList.value, enabledOptions.value);
143
+ };
144
+
145
+ /** Busca do Figma: pílula de 40px, borda neutra e lupa de 16px. */
146
+ const searchFieldUi = {
147
+ base: "h-10 rounded-[var(--ads-radius-pill)] bg-[var(--ads-surface-card)] text-sm text-[var(--ads-text-secondary)] !outline-none ring-1 ring-inset ring-ads-neutro-claro-50 enabled:hover:ring-[var(--ads-filter-hover-border)] placeholder:text-[var(--ads-filter-disabled-text)] focus-visible:!outline-none focus-visible:ring-(length:--ads-border-width-slim) focus-visible:ring-[var(--ads-text-brand)]",
148
+ leadingIcon: "size-4 text-[var(--ads-text-tertiary)]",
149
+ };
150
+ </script>
@@ -1,101 +1,101 @@
1
- <template>
2
- <nav
3
- class="flex w-[var(--ads-side-width)] flex-col border-r-[0.5px] border-[var(--ads-side-border)] bg-[var(--ads-surface-card)]"
4
- aria-label="Menu lateral"
5
- >
6
- <template v-for="item in items" :key="item.id">
7
- <component
8
- :is="item.to && !item.children?.length ? NuxtLink : 'button'"
9
- v-bind="item.to && !item.children?.length ? { to: item.to } : { type: 'button' }"
10
- class="flex h-[var(--ads-side-row-height)] items-center gap-1 border-b-[0.5px] border-[var(--ads-side-border)] py-2 pe-1 text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
11
- :class="rowClass(item, false)"
12
- :aria-expanded="item.children?.length ? isOpen(item.id) : undefined"
13
- @click="onRow(item)"
14
- >
15
- <span class="flex min-w-0 flex-1 items-center gap-2">
16
- <UIcon :name="item.icon || 'i-lucide-sun'" class="size-4 shrink-0 text-ads-neutro-escuro-500" />
17
- <span class="line-clamp-2 text-xs font-bold leading-[1.2] text-[var(--ads-text-secondary)]">{{ item.label }}</span>
18
- </span>
19
- <span
20
- v-if="item.badge"
21
- class="size-[var(--ads-side-badge)] shrink-0 rounded-full bg-[var(--ads-funcional-opportunity-200)]"
22
- aria-hidden="true"
23
- />
24
- <AdsMiniPill v-if="item.pill" type="novo" :label="item.pill" />
25
- <UIcon
26
- v-if="item.children?.length"
27
- name="i-lucide-chevron-down"
28
- class="size-4 shrink-0 text-ads-neutro-medio-100 transition-transform duration-150"
29
- :class="isOpen(item.id) ? '' : '-rotate-90'"
30
- />
31
- </component>
32
- <component
33
- :is="child.to ? NuxtLink : 'button'"
34
- v-for="child in isOpen(item.id) ? item.children : []"
35
- :key="child.id"
36
- v-bind="child.to ? { to: child.to } : { type: 'button' }"
37
- class="flex h-[var(--ads-side-row-height)] items-center gap-2 border-b-[0.5px] border-[var(--ads-side-border)] py-2 pe-1 ps-6 text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
38
- :class="rowClass(child, true)"
39
- @click="emit('select', child.id)"
40
- >
41
- <UIcon :name="child.icon || 'i-lucide-sun'" class="size-4 shrink-0 text-ads-neutro-escuro-500" />
42
- <span class="line-clamp-2 min-w-0 flex-1 text-xs font-bold leading-[1.2] text-[var(--ads-text-secondary)]">{{ child.label }}</span>
43
- <AdsMiniPill v-if="child.pill" type="novo" :label="child.pill" />
44
- </component>
45
- </template>
46
- </nav>
47
- </template>
48
-
49
- <script setup lang="ts">
50
- import { ref } from "vue";
51
- import type { RouteLocationRaw } from "vue-router";
52
- import { NuxtLink } from "#components";
53
- import AdsMiniPill from "./AdsMiniPill.vue";
54
-
55
- export type AdsSideMenuItem = {
56
- id: string;
57
- label: string;
58
- icon?: string;
59
- to?: RouteLocationRaw;
60
- children?: AdsSideMenuItem[];
61
- /** Texto da mini pill. Vazio esconde. */
62
- pill?: string;
63
- /** Ponto de 8px (Figma Show Badge no item mãe). */
64
- badge?: boolean;
65
- };
66
-
67
- const props = withDefaults(
68
- defineProps<{
69
- items: AdsSideMenuItem[];
70
- /** Pais abertos no primeiro render. O Figma não desenha o clique. */
71
- defaultOpen?: string[];
72
- }>(),
73
- {
74
- defaultOpen: () => [],
75
- },
76
- );
77
-
78
- const emit = defineEmits<{
79
- select: [id: string];
80
- }>();
81
-
82
- const openIds = ref(new Set(props.defaultOpen));
83
-
84
- const isOpen = (id: string) => openIds.value.has(id);
85
-
86
- const rowClass = (item: AdsSideMenuItem, child: boolean) => {
87
- if (child) return "bg-[var(--ads-side-child-bg)]";
88
- if (item.children?.length && isOpen(item.id)) return "bg-[var(--ads-side-open-bg)] ps-4";
89
- return "bg-[var(--ads-surface-card)] ps-4";
90
- };
91
-
92
- const onRow = (item: AdsSideMenuItem) => {
93
- if (item.children?.length) {
94
- const next = new Set(openIds.value);
95
- if (next.has(item.id)) next.delete(item.id);
96
- else next.add(item.id);
97
- openIds.value = next;
98
- }
99
- emit("select", item.id);
100
- };
101
- </script>
1
+ <template>
2
+ <nav
3
+ class="flex w-[var(--ads-side-width)] flex-col border-r-[0.5px] border-[var(--ads-side-border)] bg-[var(--ads-surface-card)]"
4
+ aria-label="Menu lateral"
5
+ >
6
+ <template v-for="item in items" :key="item.id">
7
+ <component
8
+ :is="item.to && !item.children?.length ? NuxtLink : 'button'"
9
+ v-bind="item.to && !item.children?.length ? { to: item.to } : { type: 'button' }"
10
+ class="flex h-[var(--ads-side-row-height)] items-center gap-1 border-b-[0.5px] border-[var(--ads-side-border)] py-2 pe-1 text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
11
+ :class="rowClass(item, false)"
12
+ :aria-expanded="item.children?.length ? isOpen(item.id) : undefined"
13
+ @click="onRow(item)"
14
+ >
15
+ <span class="flex min-w-0 flex-1 items-center gap-2">
16
+ <UIcon :name="item.icon || 'i-lucide-sun'" class="size-4 shrink-0 text-ads-neutro-escuro-500" />
17
+ <span class="line-clamp-2 text-xs font-bold leading-[1.2] text-[var(--ads-text-secondary)]">{{ item.label }}</span>
18
+ </span>
19
+ <span
20
+ v-if="item.badge"
21
+ class="size-[var(--ads-side-badge)] shrink-0 rounded-full bg-[var(--ads-funcional-opportunity-200)]"
22
+ aria-hidden="true"
23
+ />
24
+ <AdsPill v-if="item.pill" size="sm" tone="secondary" status="new" :label="item.pill" />
25
+ <UIcon
26
+ v-if="item.children?.length"
27
+ name="i-lucide-chevron-down"
28
+ class="size-4 shrink-0 text-ads-neutro-medio-100 transition-transform duration-150"
29
+ :class="isOpen(item.id) ? '' : '-rotate-90'"
30
+ />
31
+ </component>
32
+ <component
33
+ :is="child.to ? NuxtLink : 'button'"
34
+ v-for="child in isOpen(item.id) ? item.children : []"
35
+ :key="child.id"
36
+ v-bind="child.to ? { to: child.to } : { type: 'button' }"
37
+ class="flex h-[var(--ads-side-row-height)] items-center gap-2 border-b-[0.5px] border-[var(--ads-side-border)] py-2 pe-1 ps-6 text-left focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
38
+ :class="rowClass(child, true)"
39
+ @click="emit('select', child.id)"
40
+ >
41
+ <UIcon :name="child.icon || 'i-lucide-sun'" class="size-4 shrink-0 text-ads-neutro-escuro-500" />
42
+ <span class="line-clamp-2 min-w-0 flex-1 text-xs font-bold leading-[1.2] text-[var(--ads-text-secondary)]">{{ child.label }}</span>
43
+ <AdsPill v-if="child.pill" size="sm" tone="secondary" status="new" :label="child.pill" />
44
+ </component>
45
+ </template>
46
+ </nav>
47
+ </template>
48
+
49
+ <script setup lang="ts">
50
+ import { ref } from "vue";
51
+ import type { RouteLocationRaw } from "vue-router";
52
+ import { NuxtLink } from "#components";
53
+ import AdsPill from "./AdsPill.vue";
54
+
55
+ export type AdsSideMenuItem = {
56
+ id: string;
57
+ label: string;
58
+ icon?: string;
59
+ to?: RouteLocationRaw;
60
+ children?: AdsSideMenuItem[];
61
+ /** Texto da mini pill. Vazio esconde. */
62
+ pill?: string;
63
+ /** Ponto de 8px (Figma Show Badge no item mãe). */
64
+ badge?: boolean;
65
+ };
66
+
67
+ const props = withDefaults(
68
+ defineProps<{
69
+ items: AdsSideMenuItem[];
70
+ /** Pais abertos no primeiro render. O Figma não desenha o clique. */
71
+ defaultOpen?: string[];
72
+ }>(),
73
+ {
74
+ defaultOpen: () => [],
75
+ },
76
+ );
77
+
78
+ const emit = defineEmits<{
79
+ select: [id: string];
80
+ }>();
81
+
82
+ const openIds = ref(new Set(props.defaultOpen));
83
+
84
+ const isOpen = (id: string) => openIds.value.has(id);
85
+
86
+ const rowClass = (item: AdsSideMenuItem, child: boolean) => {
87
+ if (child) return "bg-[var(--ads-side-child-bg)]";
88
+ if (item.children?.length && isOpen(item.id)) return "bg-[var(--ads-side-open-bg)] ps-4";
89
+ return "bg-[var(--ads-surface-card)] ps-4";
90
+ };
91
+
92
+ const onRow = (item: AdsSideMenuItem) => {
93
+ if (item.children?.length) {
94
+ const next = new Set(openIds.value);
95
+ if (next.has(item.id)) next.delete(item.id);
96
+ else next.add(item.id);
97
+ openIds.value = next;
98
+ }
99
+ emit("select", item.id);
100
+ };
101
+ </script>
@@ -1,44 +1,44 @@
1
- <template>
2
- <UTooltip
3
- v-if="hasTrigger"
4
- arrow
5
- :delay-duration="delayDuration"
6
- :content="{ side: 'top', align: 'center', sideOffset: 4 }"
7
- :ui="tooltipUi"
8
- >
9
- <slot />
10
- <template #content>
11
- <span class="text-[length:var(--ads-tooltip-small-font-size)] leading-[1.1] text-[var(--ads-tooltip-title)]">{{ text }}</span>
12
- </template>
13
- </UTooltip>
14
- <p
15
- v-else
16
- class="inline-flex rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-small-padding)] text-[length:var(--ads-tooltip-small-font-size)] leading-[1.1] text-[var(--ads-tooltip-title)] shadow-[var(--ads-shadow-level-1)]"
17
- >
18
- {{ text }}
19
- </p>
20
- </template>
21
-
22
- <script setup lang="ts">
23
- import { computed, useSlots } from "vue";
24
-
25
- withDefaults(
26
- defineProps<{
27
- text?: string;
28
- delayDuration?: number;
29
- }>(),
30
- {
31
- text: "Clique para ver mais",
32
- delayDuration: 150,
33
- },
34
- );
35
-
36
- const slots = useSlots();
37
- const hasTrigger = computed(() => Boolean(slots.default));
38
-
39
- const tooltipUi = {
40
- content:
41
- "z-[70] rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-small-padding)] shadow-[var(--ads-shadow-level-1)] ring-0",
42
- arrow: "fill-[var(--ads-tooltip-bg)]",
43
- };
44
- </script>
1
+ <template>
2
+ <UTooltip
3
+ v-if="hasTrigger"
4
+ arrow
5
+ :delay-duration="delayDuration"
6
+ :content="{ side: 'top', align: 'center', sideOffset: 4 }"
7
+ :ui="tooltipUi"
8
+ >
9
+ <slot />
10
+ <template #content>
11
+ <span class="text-[length:var(--ads-tooltip-small-font-size)] leading-[1.1] text-[var(--ads-tooltip-title)]">{{ text }}</span>
12
+ </template>
13
+ </UTooltip>
14
+ <p
15
+ v-else
16
+ class="inline-flex rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-small-padding)] text-[length:var(--ads-tooltip-small-font-size)] leading-[1.1] text-[var(--ads-tooltip-title)] shadow-[var(--ads-shadow-level-1)]"
17
+ >
18
+ {{ text }}
19
+ </p>
20
+ </template>
21
+
22
+ <script setup lang="ts">
23
+ import { computed, useSlots } from "vue";
24
+
25
+ withDefaults(
26
+ defineProps<{
27
+ text?: string;
28
+ delayDuration?: number;
29
+ }>(),
30
+ {
31
+ text: "Clique para ver mais",
32
+ delayDuration: 150,
33
+ },
34
+ );
35
+
36
+ const slots = useSlots();
37
+ const hasTrigger = computed(() => Boolean(slots.default));
38
+
39
+ const tooltipUi = {
40
+ content:
41
+ "z-[70] rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-small-padding)] shadow-[var(--ads-shadow-level-1)] ring-0",
42
+ arrow: "fill-[var(--ads-tooltip-bg)]",
43
+ };
44
+ </script>
@@ -0,0 +1,222 @@
1
+ <template>
2
+ <nav :aria-label="ariaLabel">
3
+ <!-- Stepper Simples: barras horizontais -->
4
+ <div v-if="variant === 'simple'" class="flex items-start gap-4" role="list">
5
+ <component
6
+ :is="clickable ? 'button' : 'div'"
7
+ v-for="(step, index) in steps"
8
+ :key="index"
9
+ :type="clickable ? 'button' : undefined"
10
+ role="listitem"
11
+ :aria-current="index === modelValue ? 'step' : undefined"
12
+ :aria-label="step.label ? `${step.label} — ${stepAriaState(index)}` : `Passo ${index + 1} — ${stepAriaState(index)}`"
13
+ :disabled="clickable ? index > modelValue && !allowForward : undefined"
14
+ class="flex min-w-0 flex-1 flex-col items-start gap-2 rounded-[var(--ads-radius-sm)] text-left enabled:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ads-border-focused)] focus-visible:ring-offset-2"
15
+ @click="onStepClick(index)"
16
+ >
17
+ <span
18
+ class="block h-1 w-full rounded-[2px] transition-colors"
19
+ :class="index <= modelValue ? 'bg-[var(--ads-text-brand)]' : 'bg-[var(--ads-button-secondary-hover)]'"
20
+ />
21
+ <span
22
+ v-if="showLabels && step.label"
23
+ class="w-full truncate text-[length:var(--ads-font-size-xxs)] leading-[1.3] transition-colors"
24
+ :class="simpleLabelClass(index)"
25
+ >
26
+ {{ step.label }}
27
+ </span>
28
+ </component>
29
+ </div>
30
+
31
+ <!-- Stepper Visual vertical: círculo à esquerda, título e descrição à direita -->
32
+ <div v-else-if="orientation === 'vertical'" class="flex flex-col items-start" role="list">
33
+ <component
34
+ :is="clickable ? 'button' : 'div'"
35
+ v-for="(step, index) in steps"
36
+ :key="index"
37
+ :type="clickable ? 'button' : undefined"
38
+ role="listitem"
39
+ :aria-current="index === modelValue ? 'step' : undefined"
40
+ :aria-label="step.label ? `${step.label} — ${stepAriaState(index)}` : `Passo ${index + 1} — ${stepAriaState(index)}`"
41
+ :disabled="clickable ? index > modelValue && !allowForward : undefined"
42
+ class="flex w-full items-start gap-4 rounded-[var(--ads-radius-sm)] text-left enabled:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ads-border-focused)] focus-visible:ring-offset-2"
43
+ @click="onStepClick(index)"
44
+ >
45
+ <span class="flex w-12 shrink-0 flex-col items-center">
46
+ <span
47
+ v-if="index > 0"
48
+ class="h-6 w-0.5 rounded-[1px] transition-colors"
49
+ :class="index <= modelValue ? 'bg-[var(--ads-text-brand)]' : 'bg-[var(--ads-border-subtle)]'"
50
+ aria-hidden="true"
51
+ />
52
+ <span
53
+ class="flex size-12 items-center justify-center rounded-[var(--ads-radius-circular)] transition-colors"
54
+ :class="circleClass(index)"
55
+ >
56
+ <UIcon v-if="index < modelValue" name="i-lucide-check" class="size-6" />
57
+ <UIcon v-else-if="indicator === 'icon' && step.icon" :name="step.icon" class="size-6" />
58
+ <span v-else class="text-[length:var(--ads-font-size-xs)] font-bold leading-[1.3]">{{ index + 1 }}</span>
59
+ </span>
60
+ </span>
61
+
62
+ <span
63
+ v-if="showLabels && (step.label || step.description)"
64
+ class="flex min-w-0 flex-1 flex-col gap-0.5 leading-[1.3]"
65
+ :class="{ 'pt-9': index > 0 }"
66
+ >
67
+ <span
68
+ v-if="step.label"
69
+ class="text-[length:var(--ads-font-size-xs)] font-bold transition-colors"
70
+ :class="titleClass(index)"
71
+ >
72
+ {{ step.label }}
73
+ </span>
74
+ <span
75
+ v-if="step.description"
76
+ class="text-[length:var(--ads-font-size-xxs)] transition-colors"
77
+ :class="index > modelValue ? 'text-[var(--ads-text-tertiary)]' : 'text-[var(--ads-text-secondary)]'"
78
+ >
79
+ {{ step.description }}
80
+ </span>
81
+ </span>
82
+ </component>
83
+ </div>
84
+
85
+ <!-- Stepper Visual: círculos com ícone ou número -->
86
+ <div v-else class="flex items-start gap-2" role="list">
87
+ <template v-for="(step, index) in steps" :key="index">
88
+ <!-- Conector: centrado no círculo de 48px -->
89
+ <span
90
+ v-if="index > 0"
91
+ class="flex h-12 min-w-10 flex-1 flex-col justify-center"
92
+ aria-hidden="true"
93
+ >
94
+ <span
95
+ class="h-0.5 w-full rounded-[1px] transition-colors"
96
+ :class="index <= modelValue ? 'bg-[var(--ads-text-brand)]' : 'bg-[var(--ads-border-subtle)]'"
97
+ />
98
+ </span>
99
+
100
+ <component
101
+ :is="clickable ? 'button' : 'div'"
102
+ :type="clickable ? 'button' : undefined"
103
+ role="listitem"
104
+ :aria-current="index === modelValue ? 'step' : undefined"
105
+ :aria-label="step.label ? `${step.label} — ${stepAriaState(index)}` : `Passo ${index + 1} — ${stepAriaState(index)}`"
106
+ :disabled="clickable ? index > modelValue && !allowForward : undefined"
107
+ class="flex shrink-0 flex-col items-center gap-3 rounded-[var(--ads-radius-sm)] enabled:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ads-border-focused)] focus-visible:ring-offset-2"
108
+ :class="{ 'min-w-[120px]': showLabels }"
109
+ @click="onStepClick(index)"
110
+ >
111
+ <span
112
+ class="flex size-12 items-center justify-center rounded-[var(--ads-radius-circular)] transition-colors"
113
+ :class="circleClass(index)"
114
+ >
115
+ <UIcon v-if="index < modelValue" name="i-lucide-check" class="size-6" />
116
+ <UIcon v-else-if="indicator === 'icon' && step.icon" :name="step.icon" class="size-6" />
117
+ <span v-else class="text-[length:var(--ads-font-size-xs)] font-bold leading-[1.3]">{{ index + 1 }}</span>
118
+ </span>
119
+
120
+ <span
121
+ v-if="showLabels && (step.label || step.description)"
122
+ class="flex flex-col items-center gap-0.5 whitespace-nowrap text-center leading-[1.3]"
123
+ >
124
+ <span
125
+ v-if="step.label"
126
+ class="text-[length:var(--ads-font-size-xs)] font-bold transition-colors"
127
+ :class="titleClass(index)"
128
+ >
129
+ {{ step.label }}
130
+ </span>
131
+ <span
132
+ v-if="step.description"
133
+ class="text-[length:var(--ads-font-size-xxs)] transition-colors"
134
+ :class="index > modelValue ? 'text-[var(--ads-text-tertiary)]' : 'text-[var(--ads-text-secondary)]'"
135
+ >
136
+ {{ step.description }}
137
+ </span>
138
+ </span>
139
+ </component>
140
+ </template>
141
+ </div>
142
+ </nav>
143
+ </template>
144
+
145
+ <script setup lang="ts">
146
+ export interface AdsStepperStep {
147
+ /** Rótulo exibido abaixo da barra (Stepper Simples) ou do círculo (Stepper Visual). */
148
+ label?: string;
149
+ /** Texto abaixo do título. Só aparece no Stepper Visual. */
150
+ description?: string;
151
+ /** Ícone Lucide. Só usado quando indicator="icon" e passo não está concluído. */
152
+ icon?: string;
153
+ }
154
+
155
+ const props = withDefaults(
156
+ defineProps<{
157
+ /** Lista de passos. Mínimo 2, máximo 6. */
158
+ steps: AdsStepperStep[];
159
+ /** Estilo visual do stepper. */
160
+ variant?: "simple" | "visual";
161
+ /** Direção do Stepper Visual. O Stepper Simples é sempre horizontal. */
162
+ orientation?: "horizontal" | "vertical";
163
+ /** O que aparece no círculo do Stepper Visual (passos pendentes). Concluídos sempre mostram check. */
164
+ indicator?: "icon" | "number";
165
+ /** Exibe os rótulos dos passos. */
166
+ showLabels?: boolean;
167
+ /** Permite navegar clicando nos passos. */
168
+ clickable?: boolean;
169
+ /** Permite avançar clicando em passos futuros (só válido quando clickable=true). */
170
+ allowForward?: boolean;
171
+ /** Rótulo acessível da navegação. */
172
+ ariaLabel?: string;
173
+ }>(),
174
+ {
175
+ variant: "simple",
176
+ orientation: "horizontal",
177
+ indicator: "number",
178
+ showLabels: true,
179
+ clickable: false,
180
+ allowForward: false,
181
+ ariaLabel: "Progresso",
182
+ },
183
+ );
184
+
185
+ const modelValue = defineModel<number>({ default: 0 });
186
+
187
+ const emit = defineEmits<{
188
+ "update:modelValue": [step: number];
189
+ }>();
190
+
191
+ const onStepClick = (index: number) => {
192
+ if (!props.clickable) return;
193
+ if (index > modelValue.value && !props.allowForward) return;
194
+ modelValue.value = index;
195
+ };
196
+
197
+ const stepAriaState = (index: number) => {
198
+ if (index < modelValue.value) return "concluído";
199
+ if (index === modelValue.value) return "atual";
200
+ return "pendente";
201
+ };
202
+
203
+ /** Rótulo do Stepper Simples: atual em negrito, pendente em cor terciária. */
204
+ const simpleLabelClass = (index: number): string => {
205
+ if (index < modelValue.value) return "font-medium text-[var(--ads-text-primary)]";
206
+ if (index === modelValue.value) return "font-bold text-[var(--ads-text-primary)]";
207
+ return "font-medium text-[var(--ads-text-tertiary)]";
208
+ };
209
+
210
+ /** Círculo do Stepper Visual: concluído e atual preenchidos com a marca, pendente com borda clara. */
211
+ const circleClass = (index: number): string =>
212
+ index <= modelValue.value
213
+ ? "bg-[var(--ads-text-brand)] text-white"
214
+ : "border-2 border-[var(--ads-border-subtle)] bg-[var(--ads-surface-card)] text-[var(--ads-text-tertiary)]";
215
+
216
+ /** Título do passo: atual com a cor da marca. */
217
+ const titleClass = (index: number): string => {
218
+ if (index < modelValue.value) return "text-[var(--ads-text-primary)]";
219
+ if (index === modelValue.value) return "text-[var(--ads-text-brand)]";
220
+ return "text-[var(--ads-text-tertiary)]";
221
+ };
222
+ </script>