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.
Files changed (80) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +574 -575
  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 -9
  8. package/app/assets/brand/radar.svg +9 -9
  9. package/app/assets/css/ads-colors.css +257 -257
  10. package/app/assets/css/component-tokens.css +6 -2
  11. package/app/assets/css/main.css +585 -585
  12. package/app/components/AdsBadge.vue +47 -47
  13. package/app/components/AdsBroadcast.vue +24 -24
  14. package/app/components/AdsButton.vue +547 -547
  15. package/app/components/AdsButtonGroup.vue +39 -39
  16. package/app/components/AdsButtonMenu.vue +48 -48
  17. package/app/components/AdsCard.vue +188 -188
  18. package/app/components/AdsCardHint.vue +56 -22
  19. package/app/components/AdsCardPeriod.vue +43 -43
  20. package/app/components/AdsCardVariation.vue +31 -31
  21. package/app/components/AdsCharttip.vue +79 -79
  22. package/app/components/AdsDatePicker.vue +509 -509
  23. package/app/components/AdsDropdownMenu.vue +30 -30
  24. package/app/components/AdsEmptyState.vue +61 -61
  25. package/app/components/AdsFeatureCard.vue +292 -210
  26. package/app/components/AdsFileCard.vue +98 -98
  27. package/app/components/AdsFooter.vue +25 -25
  28. package/app/components/AdsHeavyAccountCell.vue +59 -59
  29. package/app/components/AdsHeavyHeaderCell.vue +70 -70
  30. package/app/components/AdsHeavyTable.vue +135 -139
  31. package/app/components/AdsInput.vue +148 -148
  32. package/app/components/AdsLoading.vue +217 -217
  33. package/app/components/AdsMenuBar.vue +110 -110
  34. package/app/components/AdsMetricCard.vue +226 -216
  35. package/app/components/AdsModal.vue +160 -160
  36. package/app/components/AdsMonthPicker.vue +80 -80
  37. package/app/components/AdsNavbarApp.vue +67 -67
  38. package/app/components/AdsNavbarDesk.vue +67 -67
  39. package/app/components/AdsNotabilityPill.vue +24 -24
  40. package/app/components/AdsNumberInput.vue +173 -173
  41. package/app/components/AdsPanelCard.vue +99 -99
  42. package/app/components/AdsPill.vue +144 -144
  43. package/app/components/AdsProductTag.vue +80 -80
  44. package/app/components/AdsSearchInput.vue +122 -122
  45. package/app/components/AdsSegmentedTabs.vue +62 -62
  46. package/app/components/AdsSelect.vue +283 -283
  47. package/app/components/AdsSelectItem.vue +128 -128
  48. package/app/components/AdsSelectPanel.vue +221 -221
  49. package/app/components/AdsSideMenu.vue +101 -101
  50. package/app/components/AdsSmalltip.vue +44 -44
  51. package/app/components/AdsStepper.vue +222 -222
  52. package/app/components/AdsTable.vue +172 -176
  53. package/app/components/AdsTableHeaderCell.vue +80 -80
  54. package/app/components/AdsTableSkeleton.vue +113 -113
  55. package/app/components/AdsTableToolbar.vue +44 -44
  56. package/app/components/AdsTabs.vue +51 -51
  57. package/app/components/AdsTextarea.vue +116 -116
  58. package/app/components/AdsToast.vue +184 -184
  59. package/app/components/AdsTooltip.vue +73 -73
  60. package/app/components/OverlayLoading.vue +2 -17
  61. package/app/components/ProgressBarLoading.vue +235 -235
  62. package/app/composables/useOverlayLoading.ts +88 -88
  63. package/app/constants/ads-color-swatches.ts +240 -240
  64. package/app/locale/pt-br.ts +6 -6
  65. package/app/plugins/ads-toast.client.ts +24 -24
  66. package/app/theme/ads-theme.ts +374 -374
  67. package/app/theme/ads-tokens.ts +391 -391
  68. package/app/theme/component-tokens.json +6 -2
  69. package/app/theme/component-tokens.ts +6 -2
  70. package/app/types/overlay-loading.types.ts +32 -35
  71. package/app/utils/ads-filter-select.ts +191 -191
  72. package/app/utils/ads-table.ts +416 -398
  73. package/app/utils/calendar-date.ts +163 -163
  74. package/app/utils/category-role.ts +45 -45
  75. package/app/utils/money.ts +77 -77
  76. package/app/utils/notability.ts +8 -8
  77. package/app/utils/parser.ts +134 -134
  78. package/app/utils/percentage.ts +54 -54
  79. package/nuxt.config.ts +31 -31
  80. package/package.json +57 -56
@@ -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>
@@ -1,222 +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>
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>