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,221 +1,221 @@
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
- A lista é virtualizada (@tanstack/vue-virtual): só as linhas visíveis são montadas,
7
- então milhares de opções não travam a tela. Altura medida por linha, pois subtítulo e selo mudam a altura.
8
- -->
9
- <template>
10
- <div
11
- 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)]"
12
- :class="widthClass"
13
- >
14
- <div v-if="searchable" class="border-b border-[var(--ads-select-divider)] px-4 pt-4 pb-3">
15
- <UInput
16
- v-model="query"
17
- :placeholder="searchPlaceholder"
18
- aria-label="Pesquisar opções"
19
- icon="i-lucide-search"
20
- color="neutral"
21
- variant="outline"
22
- size="md"
23
- class="w-full"
24
- :ui="searchFieldUi"
25
- >
26
- <template v-if="query" #trailing>
27
- <button
28
- type="button"
29
- class="text-[var(--ads-text-secondary)]"
30
- aria-label="Limpar busca"
31
- @click="query = ''"
32
- >
33
- <UIcon name="i-lucide-x" class="size-4" />
34
- </button>
35
- </template>
36
- </UInput>
37
- </div>
38
-
39
- <div
40
- ref="scrollRef"
41
- 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]"
42
- :role="type === 'radio' ? 'listbox' : 'group'"
43
- :aria-label="listLabel"
44
- >
45
- <p
46
- v-if="groups.empty"
47
- class="flex min-h-12 items-center p-4 text-sm leading-[1.3] text-[var(--ads-text-secondary)]"
48
- >
49
- {{ emptyLabel }}
50
- </p>
51
-
52
- <div v-else class="relative w-full" :style="{ height: `${virtualizer.getTotalSize()}px` }">
53
- <div
54
- v-for="virtualRow in virtualizer.getVirtualItems()"
55
- :key="virtualRow.key"
56
- :ref="measureRow"
57
- :data-index="virtualRow.index"
58
- role="presentation"
59
- class="absolute top-0 left-0 w-full"
60
- :style="{ transform: `translateY(${virtualRow.start}px)` }"
61
- >
62
- <AdsSelectItem
63
- v-if="!rowItems[virtualRow.index].option"
64
- mode="checkbox"
65
- :label="selectAllLabel"
66
- :selected="checkState === 'all'"
67
- :indeterminate="checkState === 'partial'"
68
- :divider="rowItems.length > 1"
69
- @select="onSelectAll"
70
- />
71
- <AdsSelectItem
72
- v-else
73
- :mode="type"
74
- :label="rowItems[virtualRow.index].option!.label"
75
- :subtitle="rowItems[virtualRow.index].option!.subtitle"
76
- :badge="rowItems[virtualRow.index].option!.badge"
77
- :disabled="rowItems[virtualRow.index].option!.disabled"
78
- :selected="isSelected(rowItems[virtualRow.index].option!.value)"
79
- :divider="virtualRow.index < rowItems.length - 1"
80
- @select="onSelect(rowItems[virtualRow.index].option!.value)"
81
- />
82
- </div>
83
- </div>
84
- </div>
85
-
86
- <button
87
- v-if="addText"
88
- type="button"
89
- class="flex min-h-12 w-full items-center gap-2 border-t border-[var(--ads-select-divider)] px-4 py-3 text-left text-sm leading-[1.3] font-bold text-[var(--ads-text-brand)] transition-colors hover:bg-[var(--ads-select-item-hover)] focus-visible:bg-[var(--ads-select-item-hover)] focus-visible:outline-none"
90
- data-testid="select-add"
91
- @click="emit('add', query.trim())"
92
- >
93
- <UIcon name="i-lucide-plus" class="size-4 shrink-0" aria-hidden="true" />
94
- <span class="min-w-0 truncate">{{ addText }}</span>
95
- </button>
96
- </div>
97
- </template>
98
-
99
- <script setup lang="ts">
100
- import { computed, ref } from "vue";
101
- import { useVirtualizer } from "@tanstack/vue-virtual";
102
- import AdsSelectItem from "./AdsSelectItem.vue";
103
- import {
104
- groupFilterOptions,
105
- selectionCheckState,
106
- toggleFilterValue,
107
- toggleSelectAll,
108
- type AdsFilterOption as FilterOption,
109
- } from "../utils/ads-filter-select";
110
-
111
- const props = withDefaults(
112
- defineProps<{
113
- /** radio: seleção simples (Figma Simples). checkbox: seleção múltipla. */
114
- type: "checkbox" | "radio";
115
- options: FilterOption[];
116
- /** Campo de busca no topo, com divisória. */
117
- searchable?: boolean;
118
- /** "Selecionar todos" no começo da lista. Só no checkbox, e some durante a busca. */
119
- selectAll?: boolean;
120
- selectAllLabel?: string;
121
- emptyLabel?: string;
122
- searchPlaceholder?: string;
123
- listLabel?: string;
124
- /** Largura do painel. Padrão: --ads-select-panel-width (320px). */
125
- widthClass?: string;
126
- /**
127
- * Ação de cadastrar no rodapé, com ícone de adicionar. `{query}` vira a busca atual.
128
- * Sem valor, a ação não aparece.
129
- */
130
- addLabel?: string;
131
- }>(),
132
- {
133
- searchable: true,
134
- selectAll: true,
135
- selectAllLabel: "Selecionar todos",
136
- emptyLabel: "Nenhum resultado",
137
- searchPlaceholder: "Pesquisar",
138
- listLabel: "Opções",
139
- widthClass: "w-[var(--ads-select-panel-width)] max-w-full",
140
- },
141
- );
142
-
143
- const model = defineModel<string | string[]>({ required: true });
144
- const query = defineModel<string>("query", { default: "" });
145
- const emit = defineEmits<{
146
- pick: [];
147
- /** Ação de cadastrar. Recebe a busca atual, sem espaços nas pontas. */
148
- add: [query: string];
149
- }>();
150
-
151
- /** Texto da ação: `{query}` recebe a busca; sem busca, o trecho some. */
152
- const addText = computed(() => {
153
- if (!props.addLabel) return "";
154
- const text = props.addLabel.replaceAll("{query}", query.value.trim());
155
- return text.replace(/\s+/g, " ").trim();
156
- });
157
-
158
- const groups = computed(() => groupFilterOptions(props.options, query.value));
159
- /** Correspondência exata da busca vem primeiro. */
160
- const rows = computed(() => [...groups.value.exact, ...groups.value.matches]);
161
- const enabledOptions = computed(() => props.options.filter((option) => !option.disabled));
162
-
163
- const selectedList = computed(() =>
164
- Array.isArray(model.value) ? model.value : model.value ? [model.value] : [],
165
- );
166
- const selectedSet = computed(() => new Set(selectedList.value));
167
- const checkState = computed(() => selectionCheckState(selectedList.value, enabledOptions.value));
168
- const showSelectAll = computed(
169
- () => props.type === "checkbox" && props.selectAll && query.value.trim() === "",
170
- );
171
-
172
- /** Linhas da lista virtual: "selecionar todos" (sem option) no começo, quando aparece. */
173
- interface PanelRow {
174
- key: string;
175
- option?: FilterOption;
176
- }
177
- const rowItems = computed<PanelRow[]>(() => {
178
- const list = rows.value.map((option) => ({ key: option.value, option }));
179
- return showSelectAll.value ? [{ key: SELECT_ALL_KEY }, ...list] : list;
180
- });
181
-
182
- const SELECT_ALL_KEY = "__select-all__";
183
- /** Altura mínima de uma linha (min-h-12). A medida real corrige linhas com subtítulo ou selo. */
184
- const ROW_ESTIMATE = 48;
185
-
186
- const scrollRef = ref<HTMLElement | null>(null);
187
- const virtualizer = useVirtualizer(
188
- computed(() => ({
189
- count: rowItems.value.length,
190
- getScrollElement: () => scrollRef.value,
191
- estimateSize: () => ROW_ESTIMATE,
192
- overscan: 8,
193
- getItemKey: (index: number) => rowItems.value[index]?.key ?? index,
194
- })),
195
- );
196
-
197
- const measureRow = (el: unknown) => {
198
- if (el instanceof HTMLElement) virtualizer.value.measureElement(el);
199
- };
200
-
201
- const isSelected = (value: string) => selectedSet.value.has(value);
202
-
203
- const onSelect = (value: string) => {
204
- if (props.type === "radio") {
205
- model.value = value;
206
- emit("pick");
207
- return;
208
- }
209
- model.value = toggleFilterValue(selectedList.value, value);
210
- };
211
-
212
- const onSelectAll = () => {
213
- model.value = toggleSelectAll(selectedList.value, enabledOptions.value);
214
- };
215
-
216
- /** Busca do Figma: pílula de 40px, borda neutra e lupa de 16px. */
217
- const searchFieldUi = {
218
- 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)]",
219
- leadingIcon: "size-4 text-[var(--ads-text-tertiary)]",
220
- };
221
- </script>
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
+ A lista é virtualizada (@tanstack/vue-virtual): só as linhas visíveis são montadas,
7
+ então milhares de opções não travam a tela. Altura medida por linha, pois subtítulo e selo mudam a altura.
8
+ -->
9
+ <template>
10
+ <div
11
+ 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)]"
12
+ :class="widthClass"
13
+ >
14
+ <div v-if="searchable" class="border-b border-[var(--ads-select-divider)] px-4 pt-4 pb-3">
15
+ <UInput
16
+ v-model="query"
17
+ :placeholder="searchPlaceholder"
18
+ aria-label="Pesquisar opções"
19
+ icon="i-lucide-search"
20
+ color="neutral"
21
+ variant="outline"
22
+ size="md"
23
+ class="w-full"
24
+ :ui="searchFieldUi"
25
+ >
26
+ <template v-if="query" #trailing>
27
+ <button
28
+ type="button"
29
+ class="text-[var(--ads-text-secondary)]"
30
+ aria-label="Limpar busca"
31
+ @click="query = ''"
32
+ >
33
+ <UIcon name="i-lucide-x" class="size-4" />
34
+ </button>
35
+ </template>
36
+ </UInput>
37
+ </div>
38
+
39
+ <div
40
+ ref="scrollRef"
41
+ 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]"
42
+ :role="type === 'radio' ? 'listbox' : 'group'"
43
+ :aria-label="listLabel"
44
+ >
45
+ <p
46
+ v-if="groups.empty"
47
+ class="flex min-h-12 items-center p-4 text-sm leading-[1.3] text-[var(--ads-text-secondary)]"
48
+ >
49
+ {{ emptyLabel }}
50
+ </p>
51
+
52
+ <div v-else class="relative w-full" :style="{ height: `${virtualizer.getTotalSize()}px` }">
53
+ <div
54
+ v-for="virtualRow in virtualizer.getVirtualItems()"
55
+ :key="virtualRow.key"
56
+ :ref="measureRow"
57
+ :data-index="virtualRow.index"
58
+ role="presentation"
59
+ class="absolute top-0 left-0 w-full"
60
+ :style="{ transform: `translateY(${virtualRow.start}px)` }"
61
+ >
62
+ <AdsSelectItem
63
+ v-if="!rowItems[virtualRow.index].option"
64
+ mode="checkbox"
65
+ :label="selectAllLabel"
66
+ :selected="checkState === 'all'"
67
+ :indeterminate="checkState === 'partial'"
68
+ :divider="rowItems.length > 1"
69
+ @select="onSelectAll"
70
+ />
71
+ <AdsSelectItem
72
+ v-else
73
+ :mode="type"
74
+ :label="rowItems[virtualRow.index].option!.label"
75
+ :subtitle="rowItems[virtualRow.index].option!.subtitle"
76
+ :badge="rowItems[virtualRow.index].option!.badge"
77
+ :disabled="rowItems[virtualRow.index].option!.disabled"
78
+ :selected="isSelected(rowItems[virtualRow.index].option!.value)"
79
+ :divider="virtualRow.index < rowItems.length - 1"
80
+ @select="onSelect(rowItems[virtualRow.index].option!.value)"
81
+ />
82
+ </div>
83
+ </div>
84
+ </div>
85
+
86
+ <button
87
+ v-if="addText"
88
+ type="button"
89
+ class="flex min-h-12 w-full items-center gap-2 border-t border-[var(--ads-select-divider)] px-4 py-3 text-left text-sm leading-[1.3] font-bold text-[var(--ads-text-brand)] transition-colors hover:bg-[var(--ads-select-item-hover)] focus-visible:bg-[var(--ads-select-item-hover)] focus-visible:outline-none"
90
+ data-testid="select-add"
91
+ @click="emit('add', query.trim())"
92
+ >
93
+ <UIcon name="i-lucide-plus" class="size-4 shrink-0" aria-hidden="true" />
94
+ <span class="min-w-0 truncate">{{ addText }}</span>
95
+ </button>
96
+ </div>
97
+ </template>
98
+
99
+ <script setup lang="ts">
100
+ import { computed, ref } from "vue";
101
+ import { useVirtualizer } from "@tanstack/vue-virtual";
102
+ import AdsSelectItem from "./AdsSelectItem.vue";
103
+ import {
104
+ groupFilterOptions,
105
+ selectionCheckState,
106
+ toggleFilterValue,
107
+ toggleSelectAll,
108
+ type AdsFilterOption as FilterOption,
109
+ } from "../utils/ads-filter-select";
110
+
111
+ const props = withDefaults(
112
+ defineProps<{
113
+ /** radio: seleção simples (Figma Simples). checkbox: seleção múltipla. */
114
+ type: "checkbox" | "radio";
115
+ options: FilterOption[];
116
+ /** Campo de busca no topo, com divisória. */
117
+ searchable?: boolean;
118
+ /** "Selecionar todos" no começo da lista. Só no checkbox, e some durante a busca. */
119
+ selectAll?: boolean;
120
+ selectAllLabel?: string;
121
+ emptyLabel?: string;
122
+ searchPlaceholder?: string;
123
+ listLabel?: string;
124
+ /** Largura do painel. Padrão: --ads-select-panel-width (320px). */
125
+ widthClass?: string;
126
+ /**
127
+ * Ação de cadastrar no rodapé, com ícone de adicionar. `{query}` vira a busca atual.
128
+ * Sem valor, a ação não aparece.
129
+ */
130
+ addLabel?: string;
131
+ }>(),
132
+ {
133
+ searchable: true,
134
+ selectAll: true,
135
+ selectAllLabel: "Selecionar todos",
136
+ emptyLabel: "Nenhum resultado",
137
+ searchPlaceholder: "Pesquisar",
138
+ listLabel: "Opções",
139
+ widthClass: "w-[var(--ads-select-panel-width)] max-w-full",
140
+ },
141
+ );
142
+
143
+ const model = defineModel<string | string[]>({ required: true });
144
+ const query = defineModel<string>("query", { default: "" });
145
+ const emit = defineEmits<{
146
+ pick: [];
147
+ /** Ação de cadastrar. Recebe a busca atual, sem espaços nas pontas. */
148
+ add: [query: string];
149
+ }>();
150
+
151
+ /** Texto da ação: `{query}` recebe a busca; sem busca, o trecho some. */
152
+ const addText = computed(() => {
153
+ if (!props.addLabel) return "";
154
+ const text = props.addLabel.replaceAll("{query}", query.value.trim());
155
+ return text.replace(/\s+/g, " ").trim();
156
+ });
157
+
158
+ const groups = computed(() => groupFilterOptions(props.options, query.value));
159
+ /** Correspondência exata da busca vem primeiro. */
160
+ const rows = computed(() => [...groups.value.exact, ...groups.value.matches]);
161
+ const enabledOptions = computed(() => props.options.filter((option) => !option.disabled));
162
+
163
+ const selectedList = computed(() =>
164
+ Array.isArray(model.value) ? model.value : model.value ? [model.value] : [],
165
+ );
166
+ const selectedSet = computed(() => new Set(selectedList.value));
167
+ const checkState = computed(() => selectionCheckState(selectedList.value, enabledOptions.value));
168
+ const showSelectAll = computed(
169
+ () => props.type === "checkbox" && props.selectAll && query.value.trim() === "",
170
+ );
171
+
172
+ /** Linhas da lista virtual: "selecionar todos" (sem option) no começo, quando aparece. */
173
+ interface PanelRow {
174
+ key: string;
175
+ option?: FilterOption;
176
+ }
177
+ const rowItems = computed<PanelRow[]>(() => {
178
+ const list = rows.value.map((option) => ({ key: option.value, option }));
179
+ return showSelectAll.value ? [{ key: SELECT_ALL_KEY }, ...list] : list;
180
+ });
181
+
182
+ const SELECT_ALL_KEY = "__select-all__";
183
+ /** Altura mínima de uma linha (min-h-12). A medida real corrige linhas com subtítulo ou selo. */
184
+ const ROW_ESTIMATE = 48;
185
+
186
+ const scrollRef = ref<HTMLElement | null>(null);
187
+ const virtualizer = useVirtualizer(
188
+ computed(() => ({
189
+ count: rowItems.value.length,
190
+ getScrollElement: () => scrollRef.value,
191
+ estimateSize: () => ROW_ESTIMATE,
192
+ overscan: 8,
193
+ getItemKey: (index: number) => rowItems.value[index]?.key ?? index,
194
+ })),
195
+ );
196
+
197
+ const measureRow = (el: unknown) => {
198
+ if (el instanceof HTMLElement) virtualizer.value.measureElement(el);
199
+ };
200
+
201
+ const isSelected = (value: string) => selectedSet.value.has(value);
202
+
203
+ const onSelect = (value: string) => {
204
+ if (props.type === "radio") {
205
+ model.value = value;
206
+ emit("pick");
207
+ return;
208
+ }
209
+ model.value = toggleFilterValue(selectedList.value, value);
210
+ };
211
+
212
+ const onSelectAll = () => {
213
+ model.value = toggleSelectAll(selectedList.value, enabledOptions.value);
214
+ };
215
+
216
+ /** Busca do Figma: pílula de 40px, borda neutra e lupa de 16px. */
217
+ const searchFieldUi = {
218
+ 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)]",
219
+ leadingIcon: "size-4 text-[var(--ads-text-tertiary)]",
220
+ };
221
+ </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
- <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
+ <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>