ads-nuxt 0.4.1 → 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 (76) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +574 -574
  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/main.css +585 -585
  11. package/app/components/AdsBadge.vue +47 -47
  12. package/app/components/AdsBroadcast.vue +24 -24
  13. package/app/components/AdsButton.vue +547 -547
  14. package/app/components/AdsButtonGroup.vue +39 -39
  15. package/app/components/AdsButtonMenu.vue +48 -48
  16. package/app/components/AdsCard.vue +188 -188
  17. package/app/components/AdsCardHint.vue +56 -56
  18. package/app/components/AdsCardPeriod.vue +43 -43
  19. package/app/components/AdsCardVariation.vue +31 -31
  20. package/app/components/AdsCharttip.vue +79 -79
  21. package/app/components/AdsDatePicker.vue +509 -509
  22. package/app/components/AdsDropdownMenu.vue +30 -30
  23. package/app/components/AdsEmptyState.vue +61 -61
  24. package/app/components/AdsFeatureCard.vue +292 -292
  25. package/app/components/AdsFileCard.vue +98 -98
  26. package/app/components/AdsFooter.vue +25 -25
  27. package/app/components/AdsHeavyAccountCell.vue +59 -59
  28. package/app/components/AdsHeavyHeaderCell.vue +70 -70
  29. package/app/components/AdsHeavyTable.vue +135 -135
  30. package/app/components/AdsInput.vue +148 -148
  31. package/app/components/AdsLoading.vue +217 -217
  32. package/app/components/AdsMenuBar.vue +110 -110
  33. package/app/components/AdsMetricCard.vue +226 -226
  34. package/app/components/AdsModal.vue +160 -160
  35. package/app/components/AdsMonthPicker.vue +80 -80
  36. package/app/components/AdsNavbarApp.vue +67 -67
  37. package/app/components/AdsNavbarDesk.vue +67 -67
  38. package/app/components/AdsNotabilityPill.vue +24 -24
  39. package/app/components/AdsNumberInput.vue +173 -173
  40. package/app/components/AdsPanelCard.vue +99 -99
  41. package/app/components/AdsPill.vue +144 -144
  42. package/app/components/AdsProductTag.vue +80 -80
  43. package/app/components/AdsSearchInput.vue +122 -122
  44. package/app/components/AdsSegmentedTabs.vue +62 -62
  45. package/app/components/AdsSelect.vue +283 -283
  46. package/app/components/AdsSelectItem.vue +128 -128
  47. package/app/components/AdsSelectPanel.vue +221 -221
  48. package/app/components/AdsSideMenu.vue +101 -101
  49. package/app/components/AdsSmalltip.vue +44 -44
  50. package/app/components/AdsStepper.vue +222 -222
  51. package/app/components/AdsTable.vue +172 -172
  52. package/app/components/AdsTableHeaderCell.vue +80 -80
  53. package/app/components/AdsTableSkeleton.vue +113 -113
  54. package/app/components/AdsTableToolbar.vue +44 -44
  55. package/app/components/AdsTabs.vue +51 -51
  56. package/app/components/AdsTextarea.vue +116 -116
  57. package/app/components/AdsToast.vue +184 -184
  58. package/app/components/AdsTooltip.vue +73 -73
  59. package/app/components/ProgressBarLoading.vue +235 -235
  60. package/app/composables/useOverlayLoading.ts +88 -88
  61. package/app/constants/ads-color-swatches.ts +240 -240
  62. package/app/locale/pt-br.ts +6 -6
  63. package/app/plugins/ads-toast.client.ts +24 -24
  64. package/app/theme/ads-theme.ts +374 -374
  65. package/app/theme/ads-tokens.ts +391 -391
  66. package/app/types/overlay-loading.types.ts +32 -32
  67. package/app/utils/ads-filter-select.ts +191 -191
  68. package/app/utils/ads-table.ts +416 -416
  69. package/app/utils/calendar-date.ts +163 -163
  70. package/app/utils/category-role.ts +45 -45
  71. package/app/utils/money.ts +77 -77
  72. package/app/utils/notability.ts +8 -8
  73. package/app/utils/parser.ts +134 -134
  74. package/app/utils/percentage.ts +54 -54
  75. package/nuxt.config.ts +31 -31
  76. package/package.json +57 -57
@@ -1,160 +1,160 @@
1
- <template>
2
- <UModal
3
- v-model:open="open"
4
- :dismissible="dismissible"
5
- :close="false"
6
- :title="title"
7
- :description="description"
8
- :ui="{ overlay: 'bg-neutral-950/40', content: contentClass }"
9
- :content="{
10
- onEscapeKeyDown: () => emit('dismiss', 'esc'),
11
- onPointerDownOutside: () => emit('dismiss', 'outside'),
12
- }"
13
- >
14
- <template #content="{ close }">
15
- <div class="flex min-h-0 w-full flex-col gap-[var(--ads-space-xxs)]">
16
- <div class="flex items-start gap-[var(--ads-space-quark)]">
17
- <span
18
- v-if="icon"
19
- class="flex size-[var(--ads-space-xs)] shrink-0 items-center justify-center text-[var(--ads-text-primary)]"
20
- aria-hidden="true"
21
- >
22
- <UIcon :name="icon" :class="variant === 'sheet' ? 'size-4' : 'size-[18px]'" />
23
- </span>
24
- <div class="flex min-h-[var(--ads-space-xs)] min-w-0 flex-1 items-center">
25
- <slot name="title">
26
- <h2 class="text-[length:var(--ads-modal-title-size)] font-bold leading-[1.3] text-[var(--ads-modal-title)]">
27
- {{ title }}
28
- </h2>
29
- </slot>
30
- </div>
31
- <button
32
- v-if="closable"
33
- type="button"
34
- class="flex size-[var(--ads-space-xs)] shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] text-[var(--ads-text-primary)] hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
35
- aria-label="Fechar"
36
- @click="dismiss(close)"
37
- >
38
- <UIcon name="i-lucide-x" class="size-[18px]" />
39
- </button>
40
- </div>
41
-
42
- <p v-if="description" class="text-[length:var(--ads-modal-body-size)] leading-[var(--ads-line-height-md)] text-[var(--ads-modal-body)]">
43
- {{ description }}
44
- </p>
45
-
46
- <div v-if="slots.default" class="min-h-0 overflow-y-auto">
47
- <slot />
48
- </div>
49
-
50
- <div v-if="slots.footer" class="flex w-full shrink-0 items-center justify-end gap-[var(--ads-space-quark)] bg-white">
51
- <slot name="footer" />
52
- </div>
53
- <div v-else-if="showDefaultActions" class="flex w-full items-center justify-end gap-[var(--ads-space-quark)]">
54
- <AdsButton
55
- v-if="cancelLabel"
56
- type="unfilled"
57
- size="sm"
58
- :label="cancelLabel"
59
- @click="dismiss(close)"
60
- />
61
- <AdsButton
62
- v-if="confirmLabel"
63
- size="sm"
64
- :label="confirmLabel"
65
- @click="emit('confirm')"
66
- />
67
- </div>
68
- </div>
69
- </template>
70
- </UModal>
71
- </template>
72
-
73
- <script setup lang="ts">
74
- import { computed, useSlots } from "vue";
75
- import AdsButton from "./AdsButton.vue";
76
-
77
- /**
78
- * `dialog`: cartão centralizado (desktop, Figma `APP=No`), 532px, raio SM (8px).
79
- * `sheet`: folha presa à base (mobile/app, Figma `APP=Yes`), largura cheia,
80
- * arredondamento só no topo, sombra nível 2.
81
- *
82
- * Espaçamento, na escala ADS:
83
- * - padding do cartão e faixa do cabeçalho: space-xs (24px)
84
- * - vão entre cabeçalho, texto, conteúdo e ações: space-xxs (16px)
85
- * - vão entre ícone, título e fechar: space-quark (4px)
86
- * - ícone: 18px no dialog (SM do Figma) e 16px no sheet (XS); X com 18px
87
- * - ações padrão: botões sm (32px, 12px bold), como no Figma
88
- * - título: 20px bold, line-height 130% (Subtitle 20 do Figma)
89
- */
90
- export type AdsModalVariant = "dialog" | "sheet";
91
- export type AdsModalSize = "md" | "lg" | "xl" | "2xl" | "3xl";
92
- export type AdsModalDismissReason = "esc" | "outside";
93
-
94
- const props = withDefaults(
95
- defineProps<{
96
- title: string;
97
- description?: string;
98
- /** Nome Lucide, como `i-lucide-align-center`. Sem valor, o título fica só com o texto. */
99
- icon?: string;
100
- cancelLabel?: string;
101
- confirmLabel?: string;
102
- variant?: AdsModalVariant;
103
- /** Largura do cartão. `md` é o diálogo de confirmação (532px). */
104
- size?: AdsModalSize;
105
- scrollable?: boolean;
106
- dismissible?: boolean;
107
- /** Sem o X. Overlay e Esc continuam no `dismissible`. */
108
- closable?: boolean;
109
- }>(),
110
- {
111
- description: undefined,
112
- icon: undefined,
113
- cancelLabel: "Cancelar",
114
- confirmLabel: "Continuar",
115
- variant: "dialog",
116
- size: "md",
117
- scrollable: false,
118
- dismissible: true,
119
- closable: true,
120
- },
121
- );
122
-
123
- /**
124
- * `!` força a prioridade sobre as classes padrão do tema `UModal`
125
- * (ex.: `shadow-lg`, `rounded-lg`), que entram na cascata depois das nossas
126
- * — sem o important, o valor do Figma perde para o default do Nuxt UI.
127
- */
128
- const widths: Record<AdsModalSize, string> = {
129
- md: "!w-[min(532px,calc(100%-2rem))]",
130
- lg: "!w-[min(42rem,calc(100%-2rem))]",
131
- xl: "!w-[min(48rem,calc(100%-2rem))]",
132
- "2xl": "!w-[min(56rem,calc(100%-2rem))]",
133
- "3xl": "!w-[min(64rem,calc(100%-2rem))]",
134
- };
135
-
136
- const contentClass = computed(() => {
137
- const scroll = props.scrollable ? " !max-h-[calc(100dvh-2rem)] !overflow-y-auto" : "";
138
- if (props.variant === "sheet") {
139
- return `!inset-x-0 !bottom-0 !top-auto !left-0 !translate-x-0 !translate-y-0 !w-full !max-w-none !max-h-[calc(100dvh-2rem)] !divide-y-0 !overflow-y-auto !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-2)] !ring-1 !ring-[var(--ads-modal-border)] !rounded-t-[var(--ads-modal-radius)] !rounded-b-none${scroll}`;
140
- }
141
- return `${widths[props.size]} !max-w-none !divide-y-0 !rounded-[var(--ads-modal-radius)] !border !border-[var(--ads-modal-border)] !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-3)] !ring-0${scroll}`;
142
- });
143
-
144
- const emit = defineEmits<{
145
- confirm: [];
146
- cancel: [];
147
- dismiss: [reason: AdsModalDismissReason];
148
- }>();
149
-
150
- const open = defineModel<boolean>("open", { default: false });
151
- const slots = useSlots();
152
- const showDefaultActions = computed(() => !slots.footer && !slots.default);
153
-
154
- const dismiss = (close: () => void) => {
155
- if (!props.closable) return;
156
- emit("cancel");
157
- close();
158
- open.value = false;
159
- };
160
- </script>
1
+ <template>
2
+ <UModal
3
+ v-model:open="open"
4
+ :dismissible="dismissible"
5
+ :close="false"
6
+ :title="title"
7
+ :description="description"
8
+ :ui="{ overlay: 'bg-neutral-950/40', content: contentClass }"
9
+ :content="{
10
+ onEscapeKeyDown: () => emit('dismiss', 'esc'),
11
+ onPointerDownOutside: () => emit('dismiss', 'outside'),
12
+ }"
13
+ >
14
+ <template #content="{ close }">
15
+ <div class="flex min-h-0 w-full flex-col gap-[var(--ads-space-xxs)]">
16
+ <div class="flex items-start gap-[var(--ads-space-quark)]">
17
+ <span
18
+ v-if="icon"
19
+ class="flex size-[var(--ads-space-xs)] shrink-0 items-center justify-center text-[var(--ads-text-primary)]"
20
+ aria-hidden="true"
21
+ >
22
+ <UIcon :name="icon" :class="variant === 'sheet' ? 'size-4' : 'size-[18px]'" />
23
+ </span>
24
+ <div class="flex min-h-[var(--ads-space-xs)] min-w-0 flex-1 items-center">
25
+ <slot name="title">
26
+ <h2 class="text-[length:var(--ads-modal-title-size)] font-bold leading-[1.3] text-[var(--ads-modal-title)]">
27
+ {{ title }}
28
+ </h2>
29
+ </slot>
30
+ </div>
31
+ <button
32
+ v-if="closable"
33
+ type="button"
34
+ class="flex size-[var(--ads-space-xs)] shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] text-[var(--ads-text-primary)] hover:bg-neutral-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
35
+ aria-label="Fechar"
36
+ @click="dismiss(close)"
37
+ >
38
+ <UIcon name="i-lucide-x" class="size-[18px]" />
39
+ </button>
40
+ </div>
41
+
42
+ <p v-if="description" class="text-[length:var(--ads-modal-body-size)] leading-[var(--ads-line-height-md)] text-[var(--ads-modal-body)]">
43
+ {{ description }}
44
+ </p>
45
+
46
+ <div v-if="slots.default" class="min-h-0 overflow-y-auto">
47
+ <slot />
48
+ </div>
49
+
50
+ <div v-if="slots.footer" class="flex w-full shrink-0 items-center justify-end gap-[var(--ads-space-quark)] bg-white">
51
+ <slot name="footer" />
52
+ </div>
53
+ <div v-else-if="showDefaultActions" class="flex w-full items-center justify-end gap-[var(--ads-space-quark)]">
54
+ <AdsButton
55
+ v-if="cancelLabel"
56
+ type="unfilled"
57
+ size="sm"
58
+ :label="cancelLabel"
59
+ @click="dismiss(close)"
60
+ />
61
+ <AdsButton
62
+ v-if="confirmLabel"
63
+ size="sm"
64
+ :label="confirmLabel"
65
+ @click="emit('confirm')"
66
+ />
67
+ </div>
68
+ </div>
69
+ </template>
70
+ </UModal>
71
+ </template>
72
+
73
+ <script setup lang="ts">
74
+ import { computed, useSlots } from "vue";
75
+ import AdsButton from "./AdsButton.vue";
76
+
77
+ /**
78
+ * `dialog`: cartão centralizado (desktop, Figma `APP=No`), 532px, raio SM (8px).
79
+ * `sheet`: folha presa à base (mobile/app, Figma `APP=Yes`), largura cheia,
80
+ * arredondamento só no topo, sombra nível 2.
81
+ *
82
+ * Espaçamento, na escala ADS:
83
+ * - padding do cartão e faixa do cabeçalho: space-xs (24px)
84
+ * - vão entre cabeçalho, texto, conteúdo e ações: space-xxs (16px)
85
+ * - vão entre ícone, título e fechar: space-quark (4px)
86
+ * - ícone: 18px no dialog (SM do Figma) e 16px no sheet (XS); X com 18px
87
+ * - ações padrão: botões sm (32px, 12px bold), como no Figma
88
+ * - título: 20px bold, line-height 130% (Subtitle 20 do Figma)
89
+ */
90
+ export type AdsModalVariant = "dialog" | "sheet";
91
+ export type AdsModalSize = "md" | "lg" | "xl" | "2xl" | "3xl";
92
+ export type AdsModalDismissReason = "esc" | "outside";
93
+
94
+ const props = withDefaults(
95
+ defineProps<{
96
+ title: string;
97
+ description?: string;
98
+ /** Nome Lucide, como `i-lucide-align-center`. Sem valor, o título fica só com o texto. */
99
+ icon?: string;
100
+ cancelLabel?: string;
101
+ confirmLabel?: string;
102
+ variant?: AdsModalVariant;
103
+ /** Largura do cartão. `md` é o diálogo de confirmação (532px). */
104
+ size?: AdsModalSize;
105
+ scrollable?: boolean;
106
+ dismissible?: boolean;
107
+ /** Sem o X. Overlay e Esc continuam no `dismissible`. */
108
+ closable?: boolean;
109
+ }>(),
110
+ {
111
+ description: undefined,
112
+ icon: undefined,
113
+ cancelLabel: "Cancelar",
114
+ confirmLabel: "Continuar",
115
+ variant: "dialog",
116
+ size: "md",
117
+ scrollable: false,
118
+ dismissible: true,
119
+ closable: true,
120
+ },
121
+ );
122
+
123
+ /**
124
+ * `!` força a prioridade sobre as classes padrão do tema `UModal`
125
+ * (ex.: `shadow-lg`, `rounded-lg`), que entram na cascata depois das nossas
126
+ * — sem o important, o valor do Figma perde para o default do Nuxt UI.
127
+ */
128
+ const widths: Record<AdsModalSize, string> = {
129
+ md: "!w-[min(532px,calc(100%-2rem))]",
130
+ lg: "!w-[min(42rem,calc(100%-2rem))]",
131
+ xl: "!w-[min(48rem,calc(100%-2rem))]",
132
+ "2xl": "!w-[min(56rem,calc(100%-2rem))]",
133
+ "3xl": "!w-[min(64rem,calc(100%-2rem))]",
134
+ };
135
+
136
+ const contentClass = computed(() => {
137
+ const scroll = props.scrollable ? " !max-h-[calc(100dvh-2rem)] !overflow-y-auto" : "";
138
+ if (props.variant === "sheet") {
139
+ return `!inset-x-0 !bottom-0 !top-auto !left-0 !translate-x-0 !translate-y-0 !w-full !max-w-none !max-h-[calc(100dvh-2rem)] !divide-y-0 !overflow-y-auto !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-2)] !ring-1 !ring-[var(--ads-modal-border)] !rounded-t-[var(--ads-modal-radius)] !rounded-b-none${scroll}`;
140
+ }
141
+ return `${widths[props.size]} !max-w-none !divide-y-0 !rounded-[var(--ads-modal-radius)] !border !border-[var(--ads-modal-border)] !bg-[var(--ads-modal-background)] !p-[var(--ads-modal-padding)] !shadow-[var(--ads-shadow-level-3)] !ring-0${scroll}`;
142
+ });
143
+
144
+ const emit = defineEmits<{
145
+ confirm: [];
146
+ cancel: [];
147
+ dismiss: [reason: AdsModalDismissReason];
148
+ }>();
149
+
150
+ const open = defineModel<boolean>("open", { default: false });
151
+ const slots = useSlots();
152
+ const showDefaultActions = computed(() => !slots.footer && !slots.default);
153
+
154
+ const dismiss = (close: () => void) => {
155
+ if (!props.closable) return;
156
+ emit("cancel");
157
+ close();
158
+ open.value = false;
159
+ };
160
+ </script>
@@ -1,80 +1,80 @@
1
- <template>
2
- <div
3
- class="flex h-[284px] w-[290px] flex-col gap-3 rounded-[var(--ads-radius-sm)] bg-[var(--ads-surface-card)] p-4 shadow-[var(--ads-shadow-level-1)]"
4
- role="dialog"
5
- aria-label="Selecionar mês"
6
- >
7
- <div class="flex items-center justify-between">
8
- <button
9
- type="button"
10
- class="inline-flex size-6 items-center justify-center text-[var(--ads-text-primary)]"
11
- aria-label="Ano anterior"
12
- @click="year -= 1"
13
- >
14
- <UIcon name="i-lucide-chevron-left" class="size-6" />
15
- </button>
16
- <p class="text-sm font-bold leading-[1.3] text-[var(--ads-text-primary)]">{{ year }}</p>
17
- <button
18
- type="button"
19
- class="inline-flex size-6 items-center justify-center text-[var(--ads-text-primary)]"
20
- aria-label="Próximo ano"
21
- @click="year += 1"
22
- >
23
- <UIcon name="i-lucide-chevron-right" class="size-6" />
24
- </button>
25
- </div>
26
-
27
- <div class="grid min-h-0 flex-1 grid-cols-3 grid-rows-4 gap-1">
28
- <button
29
- v-for="(month, index) in ADS_FILTER_MONTHS"
30
- :key="month.short"
31
- type="button"
32
- class="flex items-center justify-center rounded-[var(--ads-radius-xsm)] text-sm leading-[1.3] transition-colors focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-date-focus-border)] disabled:cursor-not-allowed"
33
- :class="
34
- index === selectedMonthIndex
35
- ? 'bg-[var(--ads-surface-brand)] font-bold text-[var(--ads-text-contrast)]'
36
- : 'text-[var(--ads-text-primary)] enabled:hover:bg-[var(--ads-month-hover-bg)]'
37
- "
38
- :aria-label="month.full"
39
- :aria-pressed="index === selectedMonthIndex"
40
- @click="onSelect(index)"
41
- >
42
- {{ month.short }}
43
- </button>
44
- </div>
45
- </div>
46
- </template>
47
-
48
- <script setup lang="ts">
49
- import { computed, ref, watch } from "vue";
50
- import {
51
- ADS_FILTER_MONTHS,
52
- formatMonthValue,
53
- parseMonthValue,
54
- } from "../utils/ads-filter-select";
55
-
56
- const model = defineModel<string>({ default: "" });
57
- const emit = defineEmits<{ pick: [] }>();
58
-
59
- const initial = parseMonthValue(model.value);
60
- const year = ref(initial?.year ?? new Date().getFullYear());
61
-
62
- watch(
63
- () => model.value,
64
- (value) => {
65
- const parsed = parseMonthValue(value);
66
- if (parsed) year.value = parsed.year;
67
- },
68
- );
69
-
70
- const selectedMonthIndex = computed(() => {
71
- const parsed = parseMonthValue(model.value);
72
- if (!parsed || parsed.year !== year.value) return -1;
73
- return parsed.monthIndex;
74
- });
75
-
76
- const onSelect = (monthIndex: number) => {
77
- model.value = formatMonthValue(year.value, monthIndex);
78
- emit("pick");
79
- };
80
- </script>
1
+ <template>
2
+ <div
3
+ class="flex h-[284px] w-[290px] flex-col gap-3 rounded-[var(--ads-radius-sm)] bg-[var(--ads-surface-card)] p-4 shadow-[var(--ads-shadow-level-1)]"
4
+ role="dialog"
5
+ aria-label="Selecionar mês"
6
+ >
7
+ <div class="flex items-center justify-between">
8
+ <button
9
+ type="button"
10
+ class="inline-flex size-6 items-center justify-center text-[var(--ads-text-primary)]"
11
+ aria-label="Ano anterior"
12
+ @click="year -= 1"
13
+ >
14
+ <UIcon name="i-lucide-chevron-left" class="size-6" />
15
+ </button>
16
+ <p class="text-sm font-bold leading-[1.3] text-[var(--ads-text-primary)]">{{ year }}</p>
17
+ <button
18
+ type="button"
19
+ class="inline-flex size-6 items-center justify-center text-[var(--ads-text-primary)]"
20
+ aria-label="Próximo ano"
21
+ @click="year += 1"
22
+ >
23
+ <UIcon name="i-lucide-chevron-right" class="size-6" />
24
+ </button>
25
+ </div>
26
+
27
+ <div class="grid min-h-0 flex-1 grid-cols-3 grid-rows-4 gap-1">
28
+ <button
29
+ v-for="(month, index) in ADS_FILTER_MONTHS"
30
+ :key="month.short"
31
+ type="button"
32
+ class="flex items-center justify-center rounded-[var(--ads-radius-xsm)] text-sm leading-[1.3] transition-colors focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--ads-date-focus-border)] disabled:cursor-not-allowed"
33
+ :class="
34
+ index === selectedMonthIndex
35
+ ? 'bg-[var(--ads-surface-brand)] font-bold text-[var(--ads-text-contrast)]'
36
+ : 'text-[var(--ads-text-primary)] enabled:hover:bg-[var(--ads-month-hover-bg)]'
37
+ "
38
+ :aria-label="month.full"
39
+ :aria-pressed="index === selectedMonthIndex"
40
+ @click="onSelect(index)"
41
+ >
42
+ {{ month.short }}
43
+ </button>
44
+ </div>
45
+ </div>
46
+ </template>
47
+
48
+ <script setup lang="ts">
49
+ import { computed, ref, watch } from "vue";
50
+ import {
51
+ ADS_FILTER_MONTHS,
52
+ formatMonthValue,
53
+ parseMonthValue,
54
+ } from "../utils/ads-filter-select";
55
+
56
+ const model = defineModel<string>({ default: "" });
57
+ const emit = defineEmits<{ pick: [] }>();
58
+
59
+ const initial = parseMonthValue(model.value);
60
+ const year = ref(initial?.year ?? new Date().getFullYear());
61
+
62
+ watch(
63
+ () => model.value,
64
+ (value) => {
65
+ const parsed = parseMonthValue(value);
66
+ if (parsed) year.value = parsed.year;
67
+ },
68
+ );
69
+
70
+ const selectedMonthIndex = computed(() => {
71
+ const parsed = parseMonthValue(model.value);
72
+ if (!parsed || parsed.year !== year.value) return -1;
73
+ return parsed.monthIndex;
74
+ });
75
+
76
+ const onSelect = (monthIndex: number) => {
77
+ model.value = formatMonthValue(year.value, monthIndex);
78
+ emit("pick");
79
+ };
80
+ </script>
@@ -1,67 +1,67 @@
1
- <template>
2
- <nav
3
- class="flex h-[var(--ads-navbar-app-height)] w-full items-center justify-center gap-[var(--ads-navbar-app-gap)] border-t border-ads-neutro-claro-20 bg-[var(--ads-surface-card)] px-4"
4
- aria-label="Navegação do aplicativo"
5
- >
6
- <component
7
- :is="item.to ? NuxtLink : 'button'"
8
- v-for="item in items"
9
- :key="item.id"
10
- v-bind="item.to ? { to: item.to } : { type: 'button' }"
11
- class="flex w-[var(--ads-navbar-app-item-width)] flex-col items-center gap-1 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
12
- :aria-current="item.id === activeId ? 'page' : undefined"
13
- @click="emit('update:activeId', item.id)"
14
- >
15
- <span
16
- class="flex size-[var(--ads-navbar-app-well)] items-center justify-center rounded-[var(--ads-radius-xsm)]"
17
- :class="item.id === activeId ? 'bg-[var(--ads-navbar-app-active)] text-[var(--ads-text-contrast)]' : 'text-[var(--ads-text-secondary)]'"
18
- >
19
- <UIcon :name="item.icon" class="size-[18px]" />
20
- </span>
21
- <span
22
- class="text-[length:var(--ads-navbar-app-font-size)] font-bold leading-4"
23
- :class="item.id === activeId ? 'text-[var(--ads-navbar-app-active)]' : 'text-[var(--ads-text-secondary)]'"
24
- >{{ item.label }}</span>
25
- </component>
26
- </nav>
27
- </template>
28
-
29
- <script lang="ts">
30
- import type { RouteLocationRaw } from "vue-router";
31
-
32
- export type AdsNavbarAppItem = {
33
- id: string;
34
- label: string;
35
- icon: string;
36
- to?: RouteLocationRaw;
37
- };
38
-
39
- export const adsNavbarAppItems: AdsNavbarAppItem[] = [
40
- { id: "home", label: "Home", icon: "i-lucide-home" },
41
- { id: "agenda", label: "Agenda", icon: "i-lucide-calendar-days" },
42
- { id: "apps", label: "Produtos", icon: "i-lucide-layout-grid" },
43
- { id: "tickets", label: "Tickets", icon: "i-lucide-messages-square" },
44
- { id: "perfil", label: "Perfil", icon: "i-lucide-circle-user" },
45
- ];
46
- </script>
47
-
48
- <script setup lang="ts">
49
- import { NuxtLink } from "#components";
50
-
51
-
52
- withDefaults(
53
- defineProps<{
54
- items?: AdsNavbarAppItem[];
55
- activeId?: string;
56
- }>(),
57
- {
58
- items: () => adsNavbarAppItems,
59
- activeId: "home",
60
- },
61
- );
62
-
63
- const emit = defineEmits<{
64
- "update:activeId": [id: string];
65
- }>();
66
-
67
- </script>
1
+ <template>
2
+ <nav
3
+ class="flex h-[var(--ads-navbar-app-height)] w-full items-center justify-center gap-[var(--ads-navbar-app-gap)] border-t border-ads-neutro-claro-20 bg-[var(--ads-surface-card)] px-4"
4
+ aria-label="Navegação do aplicativo"
5
+ >
6
+ <component
7
+ :is="item.to ? NuxtLink : 'button'"
8
+ v-for="item in items"
9
+ :key="item.id"
10
+ v-bind="item.to ? { to: item.to } : { type: 'button' }"
11
+ class="flex w-[var(--ads-navbar-app-item-width)] flex-col items-center gap-1 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
12
+ :aria-current="item.id === activeId ? 'page' : undefined"
13
+ @click="emit('update:activeId', item.id)"
14
+ >
15
+ <span
16
+ class="flex size-[var(--ads-navbar-app-well)] items-center justify-center rounded-[var(--ads-radius-xsm)]"
17
+ :class="item.id === activeId ? 'bg-[var(--ads-navbar-app-active)] text-[var(--ads-text-contrast)]' : 'text-[var(--ads-text-secondary)]'"
18
+ >
19
+ <UIcon :name="item.icon" class="size-[18px]" />
20
+ </span>
21
+ <span
22
+ class="text-[length:var(--ads-navbar-app-font-size)] font-bold leading-4"
23
+ :class="item.id === activeId ? 'text-[var(--ads-navbar-app-active)]' : 'text-[var(--ads-text-secondary)]'"
24
+ >{{ item.label }}</span>
25
+ </component>
26
+ </nav>
27
+ </template>
28
+
29
+ <script lang="ts">
30
+ import type { RouteLocationRaw } from "vue-router";
31
+
32
+ export type AdsNavbarAppItem = {
33
+ id: string;
34
+ label: string;
35
+ icon: string;
36
+ to?: RouteLocationRaw;
37
+ };
38
+
39
+ export const adsNavbarAppItems: AdsNavbarAppItem[] = [
40
+ { id: "home", label: "Home", icon: "i-lucide-home" },
41
+ { id: "agenda", label: "Agenda", icon: "i-lucide-calendar-days" },
42
+ { id: "apps", label: "Produtos", icon: "i-lucide-layout-grid" },
43
+ { id: "tickets", label: "Tickets", icon: "i-lucide-messages-square" },
44
+ { id: "perfil", label: "Perfil", icon: "i-lucide-circle-user" },
45
+ ];
46
+ </script>
47
+
48
+ <script setup lang="ts">
49
+ import { NuxtLink } from "#components";
50
+
51
+
52
+ withDefaults(
53
+ defineProps<{
54
+ items?: AdsNavbarAppItem[];
55
+ activeId?: string;
56
+ }>(),
57
+ {
58
+ items: () => adsNavbarAppItems,
59
+ activeId: "home",
60
+ },
61
+ );
62
+
63
+ const emit = defineEmits<{
64
+ "update:activeId": [id: string];
65
+ }>();
66
+
67
+ </script>