ads-nuxt 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/app/assets/css/component-tokens.css +6 -2
- package/app/components/AdsCardHint.vue +49 -15
- package/app/components/AdsFeatureCard.vue +109 -27
- package/app/components/AdsHeavyTable.vue +6 -6
- package/app/components/AdsMetricCard.vue +15 -5
- package/app/components/AdsSelect.vue +17 -0
- package/app/components/AdsSelectPanel.vue +103 -32
- package/app/components/AdsTable.vue +18 -7
- package/app/components/OverlayLoading.vue +2 -17
- package/app/composables/useOverlayLoading.ts +1 -1
- package/app/theme/component-tokens.json +6 -2
- package/app/theme/component-tokens.ts +6 -2
- package/app/types/overlay-loading.types.ts +1 -4
- package/app/utils/ads-table.ts +21 -0
- package/package.json +57 -55
package/README.md
CHANGED
|
@@ -186,7 +186,7 @@ const nome = ref("");
|
|
|
186
186
|
|
|
187
187
|
| Componente | Descrição |
|
|
188
188
|
| ----------------- | --------- |
|
|
189
|
-
| `AdsTable` | Tabela baseada no `UTable`, com densidade, zebra, bordas, degradê por nível, `sticky
|
|
189
|
+
| `AdsTable` | Tabela baseada no `UTable`, com densidade, zebra, bordas, degradê por nível, `sticky` (cabeçalho fixo), `virtualize` (lista virtual para muitas linhas), loading e estado vazio. |
|
|
190
190
|
| `AdsTableToolbar` | Barra de ferramentas da tabela. |
|
|
191
191
|
| `AdsCard` | Cartão genérico. |
|
|
192
192
|
| `AdsMetricCard` | Cartão de métrica/indicador. |
|
|
@@ -468,8 +468,7 @@ Opções (`OverlayLoadingOptions`):
|
|
|
468
468
|
| `actionLabel`, `onAction` | rótulo e callback de ação |
|
|
469
469
|
| `actionIcon` | ícone Lucide da ação (padrão: `i-lucide-refresh-cw` só no erro) |
|
|
470
470
|
| `secondaryActionLabel`, `secondaryActionIcon`, `onSecondaryAction` | segunda ação (unfilled); sem callback, fecha o overlay |
|
|
471
|
-
| `onUserClose` | callback
|
|
472
|
-
| `closableVariants`| `("info" \| "success" \| "error" \| "warning")[]` — variantes que o usuário pode fechar |
|
|
471
|
+
| `onUserClose` | callback quando uma ação de fechar é acionada |
|
|
473
472
|
|
|
474
473
|
## Utilitários
|
|
475
474
|
|
|
@@ -281,13 +281,17 @@
|
|
|
281
281
|
--ads-modal-border: #c1c7d0;
|
|
282
282
|
--ads-modal-title: #061938;
|
|
283
283
|
--ads-modal-body: #505f79;
|
|
284
|
-
--ads-feature-width:
|
|
285
|
-
--ads-feature-
|
|
284
|
+
--ads-feature-width: 390px;
|
|
285
|
+
--ads-feature-padding: 24px;
|
|
286
|
+
--ads-feature-gap: 24px;
|
|
286
287
|
--ads-feature-icon-box: 48px;
|
|
287
288
|
--ads-feature-title-size: 16px;
|
|
288
289
|
--ads-feature-body-size: 14px;
|
|
289
290
|
--ads-feature-title: #061938;
|
|
290
291
|
--ads-feature-body: #505f79;
|
|
292
|
+
--ads-feature-accent-blue: #d9eaff;
|
|
293
|
+
--ads-feature-accent-green: #e8f8ef;
|
|
294
|
+
--ads-feature-accent-green-icon: #16a34a;
|
|
291
295
|
--ads-card-padding: 16px;
|
|
292
296
|
--ads-card-radius: 12px;
|
|
293
297
|
--ads-card-radius-sm: 8px;
|
|
@@ -1,22 +1,56 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
<span class="inline-flex shrink-0" :class="align === 'end' ? 'order-last ml-auto' : undefined">
|
|
3
|
+
<AdsTooltip :description="text" :show-title="false" class="inline-flex">
|
|
4
|
+
<!-- span focável, e não button: o card inteiro pode ser um botão -->
|
|
5
|
+
<span
|
|
6
|
+
tabindex="0"
|
|
7
|
+
role="img"
|
|
8
|
+
class="inline-flex size-4 items-center justify-center rounded-[var(--ads-radius-circular)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
|
|
9
|
+
:class="colorClass"
|
|
10
|
+
:aria-label="text"
|
|
11
|
+
>
|
|
12
|
+
<UIcon :name="icon" class="size-4" aria-hidden="true" />
|
|
13
|
+
</span>
|
|
14
|
+
</AdsTooltip>
|
|
15
|
+
</span>
|
|
13
16
|
</template>
|
|
14
17
|
|
|
15
18
|
<script setup lang="ts">
|
|
19
|
+
import { computed } from "vue";
|
|
16
20
|
import AdsTooltip from "./AdsTooltip.vue";
|
|
17
21
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
/** Cor do ícone do balão. `secondary` é o cinza do Figma. */
|
|
23
|
+
export type AdsCardHintColor = "secondary" | "primary" | "brand" | "success" | "attention" | "warning" | "new" | "ai";
|
|
24
|
+
|
|
25
|
+
/** `start` fica junto do título. `end` encosta no fim da linha, à direita. */
|
|
26
|
+
export type AdsCardHintAlign = "start" | "end";
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(
|
|
29
|
+
defineProps<{
|
|
30
|
+
/** Texto do balão. Também nomeia o ícone para leitor de tela. */
|
|
31
|
+
text: string;
|
|
32
|
+
/** Ícone Lucide. Padrão: informação. */
|
|
33
|
+
icon?: string;
|
|
34
|
+
color?: AdsCardHintColor;
|
|
35
|
+
align?: AdsCardHintAlign;
|
|
36
|
+
}>(),
|
|
37
|
+
{
|
|
38
|
+
icon: "i-lucide-info",
|
|
39
|
+
color: "secondary",
|
|
40
|
+
align: "start",
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const colorClasses: Record<AdsCardHintColor, string> = {
|
|
45
|
+
secondary: "text-[var(--ads-text-secondary)]",
|
|
46
|
+
primary: "text-[var(--ads-text-primary)]",
|
|
47
|
+
brand: "text-[var(--ads-text-brand)]",
|
|
48
|
+
success: "text-[var(--ads-status-success-800)]",
|
|
49
|
+
attention: "text-[var(--ads-status-attention-800)]",
|
|
50
|
+
warning: "text-[var(--ads-status-warning-800)]",
|
|
51
|
+
new: "text-[var(--ads-status-new-800)]",
|
|
52
|
+
ai: "text-[var(--ads-text-ai)]",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const colorClass = computed(() => colorClasses[props.color]);
|
|
22
56
|
</script>
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
AdsFeatureCard — atalho de módulo sobre o AdsCard. A casca (borda, raio, fundo,
|
|
3
|
-
é a do AdsCard
|
|
2
|
+
AdsFeatureCard — atalho de módulo sobre o AdsCard. A casca (borda, raio, fundo, foco)
|
|
3
|
+
é a do AdsCard. O hover é próprio: título e seta vão para a cor da variação e o fundo
|
|
4
|
+
da pílula escurece. O conteúdo é pílula, título, descrição, seta e ações.
|
|
4
5
|
-->
|
|
5
6
|
<template>
|
|
6
7
|
<AdsCard
|
|
7
|
-
:as="to ? NuxtLink : 'button'"
|
|
8
|
-
v-bind="
|
|
9
|
-
:disabled="disabled"
|
|
10
|
-
:hoverable="
|
|
8
|
+
:as="shellIsButton ? (to ? NuxtLink : 'button') : 'div'"
|
|
9
|
+
v-bind="shellIsButton ? interactiveAttrs : {}"
|
|
10
|
+
:disabled="shellIsButton ? disabled : undefined"
|
|
11
|
+
:hoverable="false"
|
|
11
12
|
class="group w-[var(--ads-feature-width)] max-w-full"
|
|
12
13
|
:style="cardStyle"
|
|
13
|
-
@click="
|
|
14
|
+
@click="onShellClick"
|
|
14
15
|
>
|
|
15
16
|
<span class="flex h-full w-full flex-col gap-[var(--ads-feature-gap)]">
|
|
16
|
-
<
|
|
17
|
+
<component
|
|
18
|
+
:is="mainTag"
|
|
19
|
+
v-bind="hasActions ? interactiveAttrs : {}"
|
|
20
|
+
:type="mainTag === 'button' ? 'button' : undefined"
|
|
21
|
+
:disabled="mainTag === 'button' ? disabled : undefined"
|
|
22
|
+
class="flex w-full min-w-0 items-start gap-3 text-left"
|
|
23
|
+
:class="hasActions ? mainControlClass : undefined"
|
|
24
|
+
@click="onMainClick"
|
|
25
|
+
>
|
|
17
26
|
<span
|
|
18
27
|
class="grid size-[var(--ads-feature-icon-box)] shrink-0 place-items-center rounded-[var(--ads-radius-sm)]"
|
|
19
28
|
:class="iconBoxClass"
|
|
20
29
|
>
|
|
21
|
-
<UIcon :name="icon" class="size-
|
|
30
|
+
<UIcon :name="icon" class="size-5" />
|
|
22
31
|
</span>
|
|
23
32
|
<span class="min-w-0 flex-1">
|
|
24
33
|
<span class="block text-[length:var(--ads-feature-title-size)] font-bold leading-[1.3]" :class="titleClass">
|
|
@@ -43,9 +52,9 @@
|
|
|
43
52
|
v-if="!disabled"
|
|
44
53
|
name="i-lucide-arrow-right"
|
|
45
54
|
class="size-5 shrink-0 text-[var(--ads-border-icon-support)] transition-colors duration-150 ease-out"
|
|
46
|
-
:class="
|
|
55
|
+
:class="accentHoverClass"
|
|
47
56
|
/>
|
|
48
|
-
</
|
|
57
|
+
</component>
|
|
49
58
|
|
|
50
59
|
<AdsPill
|
|
51
60
|
v-if="disabled"
|
|
@@ -54,6 +63,20 @@
|
|
|
54
63
|
status="blocked"
|
|
55
64
|
label="Em breve"
|
|
56
65
|
/>
|
|
66
|
+
<span v-else-if="hasActions" class="mt-auto flex flex-wrap items-center gap-x-[var(--ads-space-xs)] gap-y-2">
|
|
67
|
+
<component
|
|
68
|
+
:is="action.to ? NuxtLink : 'button'"
|
|
69
|
+
v-for="(action, index) in actions"
|
|
70
|
+
:key="`${action.label}-${index}`"
|
|
71
|
+
:to="action.to"
|
|
72
|
+
:type="action.to ? undefined : 'button'"
|
|
73
|
+
class="inline-flex items-center gap-1 rounded-[var(--ads-radius-xsm)] bg-[var(--ads-surface-main)] px-[var(--ads-space-nano)] py-[var(--ads-space-quark)] text-[length:var(--ads-font-size-xxxs)] font-medium leading-[1.2] text-[var(--ads-text-secondary)] transition-colors hover:text-[var(--ads-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)]"
|
|
74
|
+
@click="onActionClick($event, action)"
|
|
75
|
+
>
|
|
76
|
+
<UIcon v-if="action.icon" :name="action.icon" class="size-3.5 shrink-0" />
|
|
77
|
+
{{ action.label }}
|
|
78
|
+
</component>
|
|
79
|
+
</span>
|
|
57
80
|
<span v-else-if="hasFooter" class="mt-auto flex flex-wrap items-center gap-2">
|
|
58
81
|
<AdsPill
|
|
59
82
|
v-for="badge in badges"
|
|
@@ -90,7 +113,18 @@ export interface AdsFeatureCardBadge {
|
|
|
90
113
|
status?: AdsPillStatus;
|
|
91
114
|
}
|
|
92
115
|
|
|
93
|
-
/**
|
|
116
|
+
/** Ação do rodapé. Com `to`, vira link; sem ele, continua botão. */
|
|
117
|
+
export interface AdsFeatureCardAction {
|
|
118
|
+
label: string;
|
|
119
|
+
icon?: string;
|
|
120
|
+
to?: RouteLocationRaw;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Cor da pílula do ícone.
|
|
125
|
+
* primary: fundo `--ads-feature-accent-blue`, ícone da marca.
|
|
126
|
+
* success: fundo `--ads-feature-accent-green`, ícone `--ads-feature-accent-green-icon`.
|
|
127
|
+
*/
|
|
94
128
|
export type AdsFeatureCardColor =
|
|
95
129
|
| "primary"
|
|
96
130
|
| "success"
|
|
@@ -100,14 +134,15 @@ export type AdsFeatureCardColor =
|
|
|
100
134
|
| "blocked"
|
|
101
135
|
| "ai";
|
|
102
136
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
137
|
+
/** Fundo e cor da variação. O hover do título e da seta usa `fg`; o fundo da pílula mistura os dois. */
|
|
138
|
+
const iconTone: Record<AdsFeatureCardColor, { bg: string; fg: string }> = {
|
|
139
|
+
primary: { bg: "var(--ads-feature-accent-blue)", fg: "var(--ads-text-brand)" },
|
|
140
|
+
success: { bg: "var(--ads-feature-accent-green)", fg: "var(--ads-feature-accent-green-icon)" },
|
|
141
|
+
attention: { bg: "var(--ads-status-attention-100)", fg: "var(--ads-status-attention-800)" },
|
|
142
|
+
warning: { bg: "var(--ads-status-warning-100)", fg: "var(--ads-status-warning-800)" },
|
|
143
|
+
new: { bg: "var(--ads-status-new-100)", fg: "var(--ads-status-new-800)" },
|
|
144
|
+
blocked: { bg: "var(--ads-status-void-100)", fg: "var(--ads-status-void-800)" },
|
|
145
|
+
ai: { bg: "var(--ads-surface-ai)", fg: "var(--ads-text-ai)" },
|
|
111
146
|
};
|
|
112
147
|
|
|
113
148
|
|
|
@@ -116,13 +151,15 @@ const props = withDefaults(
|
|
|
116
151
|
title: string;
|
|
117
152
|
description: string;
|
|
118
153
|
icon: string;
|
|
119
|
-
/** Cor da
|
|
154
|
+
/** Cor da pílula. No hover, título e seta usam essa cor e o fundo da pílula escurece. */
|
|
120
155
|
color?: AdsFeatureCardColor;
|
|
121
156
|
/** Vira link. Sem valor, continua botão. */
|
|
122
157
|
to?: RouteLocationRaw;
|
|
123
158
|
disabled?: boolean;
|
|
124
|
-
/** Hover
|
|
159
|
+
/** Hover colore título e seta e escurece a pílula. false desliga. */
|
|
125
160
|
hoverable?: boolean;
|
|
161
|
+
/** Ações do rodapé, cada uma com o próprio clique. A casca deixa de ser o botão. */
|
|
162
|
+
actions?: AdsFeatureCardAction[];
|
|
126
163
|
badges?: AdsFeatureCardBadge[];
|
|
127
164
|
footerIcon?: string;
|
|
128
165
|
footerText?: string;
|
|
@@ -132,6 +169,7 @@ const props = withDefaults(
|
|
|
132
169
|
to: undefined,
|
|
133
170
|
disabled: false,
|
|
134
171
|
hoverable: true,
|
|
172
|
+
actions: undefined,
|
|
135
173
|
badges: undefined,
|
|
136
174
|
footerIcon: undefined,
|
|
137
175
|
footerText: undefined,
|
|
@@ -140,8 +178,13 @@ const props = withDefaults(
|
|
|
140
178
|
|
|
141
179
|
const emit = defineEmits<{
|
|
142
180
|
click: [event: MouseEvent];
|
|
181
|
+
action: [action: AdsFeatureCardAction, event: MouseEvent];
|
|
143
182
|
}>();
|
|
144
183
|
|
|
184
|
+
const hasActions = computed(() => (props.actions?.length ?? 0) > 0);
|
|
185
|
+
/** Sem ações, o cartão inteiro é o botão. Com ações, só o miolo é, para o rodapé ter cliques próprios. */
|
|
186
|
+
const shellIsButton = computed(() => !hasActions.value);
|
|
187
|
+
|
|
145
188
|
const hasFooter = computed(
|
|
146
189
|
() => (props.badges?.length ?? 0) > 0 || Boolean(props.footerText),
|
|
147
190
|
);
|
|
@@ -172,28 +215,50 @@ watch(
|
|
|
172
215
|
);
|
|
173
216
|
|
|
174
217
|
/** O link não tem disabled nativo: sai da ordem do Tab e avisa por aria-disabled. */
|
|
175
|
-
const
|
|
218
|
+
const interactiveAttrs = computed(() =>
|
|
176
219
|
props.to
|
|
177
220
|
? { to: props.to, tabindex: props.disabled ? -1 : undefined, "aria-disabled": props.disabled || undefined }
|
|
178
221
|
: {},
|
|
179
222
|
);
|
|
180
223
|
|
|
224
|
+
const mainTag = computed(() => (hasActions.value ? (props.to ? NuxtLink : "button") : "span"));
|
|
225
|
+
|
|
226
|
+
const mainControlClass =
|
|
227
|
+
"cursor-pointer rounded-[var(--ads-radius-xsm)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-border-focused)] disabled:cursor-not-allowed aria-disabled:cursor-not-allowed";
|
|
228
|
+
|
|
229
|
+
/** Título e seta. O foco do cartão e o do miolo disparam o mesmo estado. */
|
|
230
|
+
const accentHoverClass = computed(() =>
|
|
231
|
+
props.hoverable && !props.disabled
|
|
232
|
+
? "group-hover:text-[var(--ads-feature-icon-fg)] group-focus-visible:text-[var(--ads-feature-icon-fg)] group-has-[:focus-visible]:text-[var(--ads-feature-icon-fg)]"
|
|
233
|
+
: "",
|
|
234
|
+
);
|
|
235
|
+
|
|
181
236
|
/**
|
|
182
|
-
*
|
|
183
|
-
* porque o conteúdo já troca para as cores terciárias.
|
|
237
|
+
* O AdsCard não aplica o hover de borda. Aqui ficam o padding, as cores da variação
|
|
238
|
+
* e o desabilitado sem opacidade, porque o conteúdo já troca para as cores terciárias.
|
|
184
239
|
*/
|
|
185
240
|
const cardStyle = computed(() => ({
|
|
186
241
|
"--ads-card-disabled-opacity": "1",
|
|
242
|
+
"--ads-feature-icon-bg": iconTone[props.color].bg,
|
|
243
|
+
"--ads-feature-icon-fg": iconTone[props.color].fg,
|
|
244
|
+
padding: "var(--ads-feature-padding)",
|
|
187
245
|
}));
|
|
188
246
|
|
|
189
247
|
const iconBoxClass = computed(() =>
|
|
190
248
|
props.disabled
|
|
191
249
|
? "bg-[var(--ads-button-secondary-disabled)] text-[var(--ads-text-tertiary)]"
|
|
192
|
-
:
|
|
250
|
+
: [
|
|
251
|
+
"bg-[var(--ads-feature-icon-bg)] text-[var(--ads-feature-icon-fg)] transition-colors duration-150 ease-out",
|
|
252
|
+
props.hoverable
|
|
253
|
+
? "group-hover:bg-[color-mix(in_srgb,var(--ads-feature-icon-bg)_82%,var(--ads-feature-icon-fg))] group-focus-visible:bg-[color-mix(in_srgb,var(--ads-feature-icon-bg)_82%,var(--ads-feature-icon-fg))] group-has-[:focus-visible]:bg-[color-mix(in_srgb,var(--ads-feature-icon-bg)_82%,var(--ads-feature-icon-fg))]"
|
|
254
|
+
: "",
|
|
255
|
+
],
|
|
193
256
|
);
|
|
194
257
|
|
|
195
258
|
const titleClass = computed(() =>
|
|
196
|
-
props.disabled
|
|
259
|
+
props.disabled
|
|
260
|
+
? "text-[var(--ads-text-tertiary)]"
|
|
261
|
+
: ["text-[var(--ads-feature-title)] transition-colors duration-150 ease-out", accentHoverClass.value],
|
|
197
262
|
);
|
|
198
263
|
|
|
199
264
|
const descriptionClass = computed(() =>
|
|
@@ -207,4 +272,21 @@ const onClick = (event: MouseEvent) => {
|
|
|
207
272
|
}
|
|
208
273
|
event.preventDefault();
|
|
209
274
|
};
|
|
275
|
+
|
|
276
|
+
const onShellClick = (event: MouseEvent) => {
|
|
277
|
+
if (shellIsButton.value) onClick(event);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const onMainClick = (event: MouseEvent) => {
|
|
281
|
+
if (hasActions.value) onClick(event);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const onActionClick = (event: MouseEvent, action: AdsFeatureCardAction) => {
|
|
285
|
+
event.stopPropagation();
|
|
286
|
+
if (props.disabled) {
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
emit("action", action, event);
|
|
291
|
+
};
|
|
210
292
|
</script>
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
:skeleton-variant="skeletonVariant"
|
|
42
42
|
:skeleton-cell-size="adsHeavyCellSize(density)"
|
|
43
43
|
:sticky="sticky"
|
|
44
|
+
:virtualize="virtualize"
|
|
44
45
|
:framed="framed"
|
|
45
46
|
:density="density"
|
|
46
47
|
:striped="false"
|
|
@@ -67,6 +68,7 @@ import type { AdsTableSkeletonVariant } from "./AdsTableSkeleton.vue";
|
|
|
67
68
|
import {
|
|
68
69
|
adsHeavyCellSize,
|
|
69
70
|
buildAdsHeavyTableUi,
|
|
71
|
+
mergeAdsTableUi,
|
|
70
72
|
type AdsTableBorders,
|
|
71
73
|
type AdsTableDensity,
|
|
72
74
|
type AdsTableUi,
|
|
@@ -97,6 +99,8 @@ const props = withDefaults(
|
|
|
97
99
|
* Padrão: "header" — cabeçalho fica no topo ao rolar horizontalmente.
|
|
98
100
|
*/
|
|
99
101
|
sticky?: boolean | "header" | "footer";
|
|
102
|
+
/** Lista virtual para muitas linhas. Repassa ao AdsTable. */
|
|
103
|
+
virtualize?: boolean;
|
|
100
104
|
emptyLabel?: string;
|
|
101
105
|
emptyIcon?: string;
|
|
102
106
|
loadingLabel?: string;
|
|
@@ -111,6 +115,7 @@ const props = withDefaults(
|
|
|
111
115
|
skeletonRows: 5,
|
|
112
116
|
skeletonVariant: "skeleton",
|
|
113
117
|
sticky: "header",
|
|
118
|
+
virtualize: false,
|
|
114
119
|
emptyLabel: "Nenhum registro encontrado",
|
|
115
120
|
emptyIcon: "i-lucide-inbox",
|
|
116
121
|
loadingLabel: undefined,
|
|
@@ -125,11 +130,6 @@ const mergedUi = computed((): AdsTableUi => {
|
|
|
125
130
|
borders: props.borders,
|
|
126
131
|
stickyHeader: props.sticky === true || props.sticky === "header",
|
|
127
132
|
});
|
|
128
|
-
|
|
129
|
-
const merged = { ...base };
|
|
130
|
-
for (const key of Object.keys(props.ui) as (keyof AdsTableUi)[]) {
|
|
131
|
-
merged[key] = `${base[key]} ${props.ui[key] ?? ""}`.trim();
|
|
132
|
-
}
|
|
133
|
-
return merged;
|
|
133
|
+
return mergeAdsTableUi(base, props.ui);
|
|
134
134
|
});
|
|
135
135
|
</script>
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
<template v-if="type === 'kpi'">
|
|
12
12
|
<UIcon v-if="icon" :name="icon" class="size-6 shrink-0" :class="iconClass" aria-hidden="true" />
|
|
13
13
|
<div class="flex min-w-0 flex-1 flex-col items-start gap-2">
|
|
14
|
-
<div class="flex min-w-0 items-center gap-2">
|
|
14
|
+
<div class="flex w-full min-w-0 items-center gap-2">
|
|
15
15
|
<p :class="titleClass">{{ title }}</p>
|
|
16
|
-
<AdsCardHint v-if="hint" :text="hint" />
|
|
16
|
+
<AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
|
|
17
17
|
</div>
|
|
18
18
|
<span v-if="loading" :class="skeletonClass" class="h-5 w-[140px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
|
|
19
19
|
<div v-else-if="empty" class="flex min-w-0 items-center gap-2">
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<div class="flex w-full min-w-0 items-center gap-1">
|
|
33
33
|
<UIcon v-if="icon" :name="icon" class="size-4 shrink-0" :class="iconClass" aria-hidden="true" />
|
|
34
34
|
<p class="min-w-0 truncate font-bold" :class="titleClass">{{ title }}</p>
|
|
35
|
-
<AdsCardHint v-if="hint" :text="hint" />
|
|
35
|
+
<AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
|
|
36
36
|
</div>
|
|
37
37
|
<span v-if="loading" :class="skeletonClass" class="h-7 w-[72px] rounded-[var(--ads-radius-xsm)]" aria-hidden="true" />
|
|
38
38
|
<div v-else-if="empty" class="flex min-w-0 items-baseline gap-1">
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
<template v-else>
|
|
50
50
|
<div class="flex w-full min-w-0 items-center gap-2">
|
|
51
51
|
<p class="min-w-0 flex-1" :class="titleClass">{{ title }}</p>
|
|
52
|
-
<AdsCardHint v-if="hint" :text="hint" />
|
|
52
|
+
<AdsCardHint v-if="hint" :text="hint" :icon="hintIcon" :color="hintColor" :align="hintAlign" />
|
|
53
53
|
<slot name="actions" />
|
|
54
54
|
</div>
|
|
55
55
|
|
|
@@ -102,6 +102,7 @@ import { computed } from "vue";
|
|
|
102
102
|
import AdsCardHint from "./AdsCardHint.vue";
|
|
103
103
|
import AdsCardPeriod from "./AdsCardPeriod.vue";
|
|
104
104
|
import AdsCardVariation from "./AdsCardVariation.vue";
|
|
105
|
+
import type { AdsCardHintAlign, AdsCardHintColor } from "./AdsCardHint.vue";
|
|
105
106
|
import type { AdsCardVariationDirection, AdsCardVariationTone } from "./AdsCardVariation.vue";
|
|
106
107
|
import AdsEmptyState from "./AdsEmptyState.vue";
|
|
107
108
|
|
|
@@ -118,8 +119,14 @@ const props = withDefaults(
|
|
|
118
119
|
title: string;
|
|
119
120
|
/** Valor principal. */
|
|
120
121
|
value?: string;
|
|
121
|
-
/** Texto do
|
|
122
|
+
/** Texto do balão do ícone ao lado do título. Sem ele, o ícone some. */
|
|
122
123
|
hint?: string;
|
|
124
|
+
/** Ícone Lucide do balão. Padrão: informação. */
|
|
125
|
+
hintIcon?: string;
|
|
126
|
+
/** Cor do ícone do balão. */
|
|
127
|
+
hintColor?: AdsCardHintColor;
|
|
128
|
+
/** `end` encosta o ícone no fim do card, à direita. */
|
|
129
|
+
hintAlign?: AdsCardHintAlign;
|
|
123
130
|
/** Ícone Lucide: 24px no KPI, 16px na Pendência. */
|
|
124
131
|
icon?: string;
|
|
125
132
|
/** Unidade ao lado do número na Pendência, como "pendências". */
|
|
@@ -162,6 +169,9 @@ const props = withDefaults(
|
|
|
162
169
|
type: "metric",
|
|
163
170
|
value: undefined,
|
|
164
171
|
hint: undefined,
|
|
172
|
+
hintIcon: "i-lucide-info",
|
|
173
|
+
hintColor: "secondary",
|
|
174
|
+
hintAlign: "start",
|
|
165
175
|
icon: undefined,
|
|
166
176
|
unit: undefined,
|
|
167
177
|
valueIcon: undefined,
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
:search-placeholder="searchPlaceholder"
|
|
22
22
|
:list-label="label || 'Opções'"
|
|
23
23
|
:width-class="panelWidthClass"
|
|
24
|
+
:add-label="addLabel"
|
|
24
25
|
@pick="emit('pick', model)"
|
|
26
|
+
@add="onAdd"
|
|
25
27
|
/>
|
|
26
28
|
</template>
|
|
27
29
|
|
|
@@ -90,7 +92,9 @@
|
|
|
90
92
|
:search-placeholder="searchPlaceholder"
|
|
91
93
|
:list-label="label || 'Opções'"
|
|
92
94
|
:width-class="panelWidthClass"
|
|
95
|
+
:add-label="addLabel"
|
|
93
96
|
@pick="onPick"
|
|
97
|
+
@add="onAdd"
|
|
94
98
|
/>
|
|
95
99
|
</template>
|
|
96
100
|
</UPopover>
|
|
@@ -141,6 +145,11 @@ const props = withDefaults(
|
|
|
141
145
|
inline?: boolean;
|
|
142
146
|
/** Largura da lista. Padrão: --ads-select-panel-width (320px). */
|
|
143
147
|
panelWidthClass?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Ação de cadastrar no rodapé da lista, com ícone de adicionar. `{query}` vira a busca atual,
|
|
150
|
+
* ex.: "Cadastrar {query}". Sem valor, a ação não aparece.
|
|
151
|
+
*/
|
|
152
|
+
addLabel?: string;
|
|
144
153
|
}>(),
|
|
145
154
|
{
|
|
146
155
|
placeholder: "Selecione",
|
|
@@ -164,6 +173,8 @@ const model = defineModel<string | string[]>({ required: true });
|
|
|
164
173
|
const emit = defineEmits<{
|
|
165
174
|
/** Escolha feita: no radio e no month o popover fecha. */
|
|
166
175
|
pick: [value: string | string[]];
|
|
176
|
+
/** Ação de cadastrar. Recebe a busca atual. No popover, a lista fecha antes do evento. */
|
|
177
|
+
add: [query: string];
|
|
167
178
|
}>();
|
|
168
179
|
|
|
169
180
|
defineSlots<{
|
|
@@ -249,6 +260,12 @@ const onPick = () => {
|
|
|
249
260
|
emit("pick", model.value);
|
|
250
261
|
};
|
|
251
262
|
|
|
263
|
+
const onAdd = (text: string) => {
|
|
264
|
+
// No popover, a lista fecha: o cadastro costuma abrir um formulário ou modal por cima.
|
|
265
|
+
if (!props.inline) isOpen.value = false;
|
|
266
|
+
emit("add", text);
|
|
267
|
+
};
|
|
268
|
+
|
|
252
269
|
watch(isOpen, (open) => {
|
|
253
270
|
if (!open) query.value = "";
|
|
254
271
|
});
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
para mostrar só a lista, AdsSelect com inline.
|
|
4
4
|
Seleção simples (radio) ou múltipla (checkbox), busca opcional no topo, "selecionar todos",
|
|
5
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.
|
|
6
8
|
-->
|
|
7
9
|
<template>
|
|
8
10
|
<div
|
|
@@ -34,46 +36,69 @@
|
|
|
34
36
|
</UInput>
|
|
35
37
|
</div>
|
|
36
38
|
|
|
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
39
|
<div
|
|
45
|
-
|
|
40
|
+
ref="scrollRef"
|
|
46
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]"
|
|
47
42
|
:role="type === 'radio' ? 'listbox' : 'group'"
|
|
48
43
|
:aria-label="listLabel"
|
|
49
44
|
>
|
|
50
|
-
<
|
|
51
|
-
v-if="
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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>
|
|
71
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>
|
|
72
96
|
</div>
|
|
73
97
|
</template>
|
|
74
98
|
|
|
75
99
|
<script setup lang="ts">
|
|
76
|
-
import { computed } from "vue";
|
|
100
|
+
import { computed, ref } from "vue";
|
|
101
|
+
import { useVirtualizer } from "@tanstack/vue-virtual";
|
|
77
102
|
import AdsSelectItem from "./AdsSelectItem.vue";
|
|
78
103
|
import {
|
|
79
104
|
groupFilterOptions,
|
|
@@ -98,6 +123,11 @@ const props = withDefaults(
|
|
|
98
123
|
listLabel?: string;
|
|
99
124
|
/** Largura do painel. Padrão: --ads-select-panel-width (320px). */
|
|
100
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;
|
|
101
131
|
}>(),
|
|
102
132
|
{
|
|
103
133
|
searchable: true,
|
|
@@ -112,7 +142,18 @@ const props = withDefaults(
|
|
|
112
142
|
|
|
113
143
|
const model = defineModel<string | string[]>({ required: true });
|
|
114
144
|
const query = defineModel<string>("query", { default: "" });
|
|
115
|
-
const emit = defineEmits<{
|
|
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
|
+
});
|
|
116
157
|
|
|
117
158
|
const groups = computed(() => groupFilterOptions(props.options, query.value));
|
|
118
159
|
/** Correspondência exata da busca vem primeiro. */
|
|
@@ -122,12 +163,42 @@ const enabledOptions = computed(() => props.options.filter((option) => !option.d
|
|
|
122
163
|
const selectedList = computed(() =>
|
|
123
164
|
Array.isArray(model.value) ? model.value : model.value ? [model.value] : [],
|
|
124
165
|
);
|
|
166
|
+
const selectedSet = computed(() => new Set(selectedList.value));
|
|
125
167
|
const checkState = computed(() => selectionCheckState(selectedList.value, enabledOptions.value));
|
|
126
168
|
const showSelectAll = computed(
|
|
127
169
|
() => props.type === "checkbox" && props.selectAll && query.value.trim() === "",
|
|
128
170
|
);
|
|
129
171
|
|
|
130
|
-
|
|
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);
|
|
131
202
|
|
|
132
203
|
const onSelect = (value: string) => {
|
|
133
204
|
if (props.type === "radio") {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UTable
|
|
3
|
+
:key="virtualize ? 'virtual' : 'static'"
|
|
3
4
|
:data="data"
|
|
4
5
|
:columns="columns"
|
|
5
6
|
:loading="loading"
|
|
6
7
|
:sticky="sticky"
|
|
8
|
+
:virtualize="virtualizeOptions"
|
|
7
9
|
:ui="tableUi"
|
|
8
10
|
>
|
|
9
11
|
<template v-if="!$slots.loading" #loading>
|
|
@@ -42,6 +44,7 @@ import AdsTableSkeleton, {
|
|
|
42
44
|
import {
|
|
43
45
|
adsTableCellSize,
|
|
44
46
|
buildAdsTableUi,
|
|
47
|
+
mergeAdsTableUi,
|
|
45
48
|
type AdsTableBorders,
|
|
46
49
|
type AdsTableDensity,
|
|
47
50
|
type AdsTableUi,
|
|
@@ -75,8 +78,13 @@ const props = withDefaults(
|
|
|
75
78
|
skeletonVariant?: AdsTableSkeletonVariant;
|
|
76
79
|
/** Altura e respiro da linha do skeleton, quando a tabela foge do padrão da densidade. */
|
|
77
80
|
skeletonCellSize?: string;
|
|
78
|
-
/** Cabeçalho (e rodapé) fixos
|
|
81
|
+
/** Cabeçalho (e rodapé) fixos. A tabela ganha altura máxima de 70vh; max-h na classe sobrescreve. */
|
|
79
82
|
sticky?: boolean | "header" | "footer";
|
|
83
|
+
/**
|
|
84
|
+
* Lista virtual: só as linhas visíveis são montadas. Use com muitas linhas (centenas ou mais).
|
|
85
|
+
* Precisa de rolagem própria (sticky ou max-h), senão a tabela inteira é montada.
|
|
86
|
+
*/
|
|
87
|
+
virtualize?: boolean;
|
|
80
88
|
/** Linha de 1px na borda da coluna fixa. */
|
|
81
89
|
pinnedEdge?: boolean;
|
|
82
90
|
emptyLabel?: string;
|
|
@@ -96,6 +104,7 @@ const props = withDefaults(
|
|
|
96
104
|
skeletonVariant: "skeleton",
|
|
97
105
|
skeletonCellSize: undefined,
|
|
98
106
|
sticky: false,
|
|
107
|
+
virtualize: false,
|
|
99
108
|
pinnedEdge: true,
|
|
100
109
|
emptyLabel: "Nenhum registro encontrado",
|
|
101
110
|
emptyIcon: "i-lucide-inbox",
|
|
@@ -128,6 +137,13 @@ const skeletonColumns = computed((): AdsTableSkeletonAlign[] => {
|
|
|
128
137
|
});
|
|
129
138
|
});
|
|
130
139
|
|
|
140
|
+
/** Altura estimada da linha pela densidade; a medida real corrige linhas com conteúdo maior. */
|
|
141
|
+
const virtualizeOptions = computed(() =>
|
|
142
|
+
props.virtualize
|
|
143
|
+
? { estimateSize: props.density === "md" ? 64 : 40, overscan: 12 }
|
|
144
|
+
: false,
|
|
145
|
+
);
|
|
146
|
+
|
|
131
147
|
const tableUi = computed(() => {
|
|
132
148
|
const base = buildAdsTableUi({
|
|
133
149
|
density: props.density,
|
|
@@ -151,11 +167,6 @@ const tableUi = computed(() => {
|
|
|
151
167
|
base.loading = "contents";
|
|
152
168
|
}
|
|
153
169
|
}
|
|
154
|
-
|
|
155
|
-
const merged = { ...base };
|
|
156
|
-
for (const key of Object.keys(props.ui) as (keyof AdsTableUi)[]) {
|
|
157
|
-
merged[key] = `${base[key]} ${props.ui[key] ?? ""}`.trim();
|
|
158
|
-
}
|
|
159
|
-
return merged;
|
|
170
|
+
return mergeAdsTableUi(base, props.ui);
|
|
160
171
|
});
|
|
161
172
|
</script>
|
|
@@ -20,17 +20,7 @@
|
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<template #content>
|
|
23
|
-
<div class="
|
|
24
|
-
<!-- O slot #content substitui o cabeçalho do UModal, então o X fica aqui. -->
|
|
25
|
-
<button
|
|
26
|
-
v-if="isClosable"
|
|
27
|
-
type="button"
|
|
28
|
-
class="absolute top-0 right-0 flex size-8 items-center justify-center rounded-[var(--ads-radius-xsm)] text-[var(--ads-text-secondary)] hover:bg-black/5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-brand)]"
|
|
29
|
-
aria-label="Fechar"
|
|
30
|
-
@click="handleClose"
|
|
31
|
-
>
|
|
32
|
-
<UIcon name="i-lucide-x" class="size-5" />
|
|
33
|
-
</button>
|
|
23
|
+
<div class="px-10 text-center">
|
|
34
24
|
<div class="mb-4 flex justify-center">
|
|
35
25
|
<div
|
|
36
26
|
class="flex aspect-square h-20 items-center justify-center rounded-full"
|
|
@@ -107,7 +97,7 @@
|
|
|
107
97
|
|
|
108
98
|
<script setup lang="ts">
|
|
109
99
|
import { computed } from "vue";
|
|
110
|
-
import type { OverlayLoadingProps
|
|
100
|
+
import type { OverlayLoadingProps } from "../types/overlay-loading.types";
|
|
111
101
|
import AdsButton from "./AdsButton.vue";
|
|
112
102
|
|
|
113
103
|
const emit = defineEmits<{
|
|
@@ -129,13 +119,8 @@ const props = withDefaults(defineProps<OverlayLoadingProps>(), {
|
|
|
129
119
|
secondaryActionIcon: undefined,
|
|
130
120
|
onSecondaryAction: undefined,
|
|
131
121
|
onUserClose: undefined,
|
|
132
|
-
closableVariants: () => ["info", "success", "error", "warning"],
|
|
133
122
|
});
|
|
134
123
|
|
|
135
|
-
const isClosable = computed(() =>
|
|
136
|
-
(props.closableVariants as OverlayVariant[]).includes(props.variant),
|
|
137
|
-
);
|
|
138
|
-
|
|
139
124
|
type Feedback = {
|
|
140
125
|
icon: string;
|
|
141
126
|
animation: string;
|
|
@@ -13,7 +13,7 @@ export const useOverlayLoading = () => {
|
|
|
13
13
|
patch: (props: Record<string, unknown>) => void;
|
|
14
14
|
} | null = null;
|
|
15
15
|
/**
|
|
16
|
-
* O overlay é destruído ao fechar (destroyOnClose). Fechar
|
|
16
|
+
* O overlay é destruído ao fechar (destroyOnClose). Fechar pela ação emite `close`
|
|
17
17
|
* direto no useOverlay, sem passar por aqui; chamar close/patch depois disso lança
|
|
18
18
|
* "Overlay not found". Por isso a referência é limpa quando o overlay fecha, por qualquer caminho.
|
|
19
19
|
*/
|
|
@@ -280,13 +280,17 @@
|
|
|
280
280
|
"--ads-modal-border": "#c1c7d0",
|
|
281
281
|
"--ads-modal-title": "#061938",
|
|
282
282
|
"--ads-modal-body": "#505f79",
|
|
283
|
-
"--ads-feature-width": "
|
|
284
|
-
"--ads-feature-
|
|
283
|
+
"--ads-feature-width": "390px",
|
|
284
|
+
"--ads-feature-padding": "24px",
|
|
285
|
+
"--ads-feature-gap": "24px",
|
|
285
286
|
"--ads-feature-icon-box": "48px",
|
|
286
287
|
"--ads-feature-title-size": "16px",
|
|
287
288
|
"--ads-feature-body-size": "14px",
|
|
288
289
|
"--ads-feature-title": "#061938",
|
|
289
290
|
"--ads-feature-body": "#505f79",
|
|
291
|
+
"--ads-feature-accent-blue": "#d9eaff",
|
|
292
|
+
"--ads-feature-accent-green": "#e8f8ef",
|
|
293
|
+
"--ads-feature-accent-green-icon": "#16a34a",
|
|
290
294
|
"--ads-card-padding": "16px",
|
|
291
295
|
"--ads-card-radius": "12px",
|
|
292
296
|
"--ads-card-radius-sm": "8px",
|
|
@@ -531,13 +531,17 @@ export const componentTokenCatalog: readonly TokenComponent[] = [
|
|
|
531
531
|
catalog: "feature-card",
|
|
532
532
|
label: "Feature card",
|
|
533
533
|
fields: [
|
|
534
|
-
length("--ads-feature-width", "Largura", "Medida", "
|
|
535
|
-
length("--ads-feature-
|
|
534
|
+
length("--ads-feature-width", "Largura", "Medida", "390px"),
|
|
535
|
+
length("--ads-feature-padding", "Padding", "Medida", "24px"),
|
|
536
|
+
length("--ads-feature-gap", "Espaço", "Medida", "24px"),
|
|
536
537
|
length("--ads-feature-icon-box", "Caixa do ícone", "Medida", "48px"),
|
|
537
538
|
length("--ads-feature-title-size", "Fonte do título", "Medida", "16px"),
|
|
538
539
|
length("--ads-feature-body-size", "Fonte do texto", "Medida", "14px"),
|
|
539
540
|
color("--ads-feature-title", "Título", "Cores", "#061938"),
|
|
540
541
|
color("--ads-feature-body", "Texto", "Cores", "#505f79"),
|
|
542
|
+
color("--ads-feature-accent-blue", "Fundo azul", "Pílula", "#d9eaff"),
|
|
543
|
+
color("--ads-feature-accent-green", "Fundo verde", "Pílula", "#e8f8ef"),
|
|
544
|
+
color("--ads-feature-accent-green-icon", "Ícone verde", "Pílula", "#16a34a"),
|
|
541
545
|
],
|
|
542
546
|
},
|
|
543
547
|
{
|
|
@@ -6,9 +6,6 @@ export type OverlayVariant =
|
|
|
6
6
|
| "info"
|
|
7
7
|
| "warning";
|
|
8
8
|
|
|
9
|
-
/** loading e search bloqueiam a tela até o processo terminar; os demais podem ser fechados. */
|
|
10
|
-
export type OverlayClosableVariant = "info" | "success" | "error" | "warning";
|
|
11
|
-
|
|
12
9
|
export interface OverlayLoadingOptions {
|
|
13
10
|
title?: string;
|
|
14
11
|
description?: string;
|
|
@@ -26,8 +23,8 @@ export interface OverlayLoadingOptions {
|
|
|
26
23
|
secondaryActionIcon?: string;
|
|
27
24
|
/** Sem valor, a ação secundária fecha o overlay. */
|
|
28
25
|
onSecondaryAction?: () => void;
|
|
26
|
+
/** Disparado quando uma ação de fechar é acionada. */
|
|
29
27
|
onUserClose?: () => void;
|
|
30
|
-
closableVariants?: OverlayClosableVariant[];
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
export interface OverlayLoadingProps extends OverlayLoadingOptions {
|
package/app/utils/ads-table.ts
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* Variantes Lista/Grade continuam funcionar mas não são o foco da documentação.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
import { twMerge } from "tailwind-merge";
|
|
17
|
+
|
|
16
18
|
/** 14px, entrelinha de leitura. Igual no cabeçalho e na célula. */
|
|
17
19
|
export const ADS_TABLE_CELL_TEXT =
|
|
18
20
|
"text-[length:var(--ads-font-size-xxs)] leading-[var(--ads-line-height-md)]";
|
|
@@ -44,6 +46,22 @@ export interface AdsTableLook {
|
|
|
44
46
|
pinnedEdge?: boolean;
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Junta o ajuste do consumidor ao padrão. A classe do consumidor vence quando as duas
|
|
51
|
+
* definem a mesma propriedade: sem isso, `max-h` e `overflow` do padrão anulam os dele.
|
|
52
|
+
*/
|
|
53
|
+
export const mergeAdsTableUi = (
|
|
54
|
+
base: AdsTableUi,
|
|
55
|
+
override?: Partial<AdsTableUi>,
|
|
56
|
+
): AdsTableUi => {
|
|
57
|
+
if (!override) return base;
|
|
58
|
+
const merged = { ...base };
|
|
59
|
+
for (const key of Object.keys(override) as (keyof AdsTableUi)[]) {
|
|
60
|
+
merged[key] = twMerge(base[key], override[key] ?? "");
|
|
61
|
+
}
|
|
62
|
+
return merged;
|
|
63
|
+
};
|
|
64
|
+
|
|
47
65
|
export type AdsTableUi = {
|
|
48
66
|
root: string;
|
|
49
67
|
base: string;
|
|
@@ -98,6 +116,9 @@ export const buildAdsTableUi = ({
|
|
|
98
116
|
return {
|
|
99
117
|
root: [
|
|
100
118
|
"relative overflow-auto bg-[var(--ads-surface-card)]",
|
|
119
|
+
// O cabeçalho gruda na rolagem da própria tabela: sem altura máxima ela não rola e o
|
|
120
|
+
// cabeçalho sai junto com a página. Uma classe max-h do consumidor sobrescreve esta.
|
|
121
|
+
stickyHeader ? "max-h-[70vh]" : "",
|
|
101
122
|
"[scrollbar-color:var(--ads-border-subtle)_transparent] [scrollbar-width:thin]",
|
|
102
123
|
framed ? "rounded-[var(--ads-radius-md)] border border-[var(--ads-border-subtle)]" : "",
|
|
103
124
|
].join(" "),
|
package/package.json
CHANGED
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ads-nuxt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"description": "Alquimia Design System para Nuxt, construído sobre Nuxt UI",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/jbfarmarcas/alquimia-design-system.git"
|
|
9
|
-
},
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
12
|
-
},
|
|
13
|
-
"type": "module",
|
|
14
|
-
"packageManager": "pnpm@10.4.1",
|
|
15
|
-
"main": "./nuxt.config.ts",
|
|
16
|
-
"files": [
|
|
17
|
-
"app",
|
|
18
|
-
"nuxt.config.ts"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"dev": "nuxt dev playground --port 3010",
|
|
22
|
-
"build": "nuxt build playground",
|
|
23
|
-
"preview": "nuxt preview playground --port 3010",
|
|
24
|
-
"prepare": "nuxt prepare playground",
|
|
25
|
-
"skill:reference": "node scripts/generate-skill-reference.mjs",
|
|
26
|
-
"skill:check": "node scripts/generate-skill-reference.mjs --check"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@iconify-json/lucide": "^1.2.104"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"@
|
|
35
|
-
"@nuxt/
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"@
|
|
46
|
-
"@nuxt/
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ads-nuxt",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Alquimia Design System para Nuxt, construído sobre Nuxt UI",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/jbfarmarcas/alquimia-design-system.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"packageManager": "pnpm@10.4.1",
|
|
15
|
+
"main": "./nuxt.config.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"app",
|
|
18
|
+
"nuxt.config.ts"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"dev": "nuxt dev playground --port 3010",
|
|
22
|
+
"build": "nuxt build playground",
|
|
23
|
+
"preview": "nuxt preview playground --port 3010",
|
|
24
|
+
"prepare": "nuxt prepare playground",
|
|
25
|
+
"skill:reference": "node scripts/generate-skill-reference.mjs",
|
|
26
|
+
"skill:check": "node scripts/generate-skill-reference.mjs --check"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@iconify-json/lucide": "^1.2.104",
|
|
30
|
+
"@tanstack/vue-virtual": "^3.13.49",
|
|
31
|
+
"tailwind-merge": "^3.7.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"@internationalized/date": "^3.12.4",
|
|
35
|
+
"@nuxt/fonts": "^0.12.1 || ^0.14.0",
|
|
36
|
+
"@nuxt/icon": "^2.2.0",
|
|
37
|
+
"@nuxt/ui": "^4.3.0",
|
|
38
|
+
"@vueuse/core": "^14.0.0",
|
|
39
|
+
"@vueuse/nuxt": "^14.0.0",
|
|
40
|
+
"nuxt": "^4.0.0",
|
|
41
|
+
"tailwindcss": "^4.0.15",
|
|
42
|
+
"vue": "^3.5.18"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@internationalized/date": "^3.12.4",
|
|
46
|
+
"@nuxt/fonts": "^0.12.1",
|
|
47
|
+
"@nuxt/icon": "^2.2.0",
|
|
48
|
+
"@nuxt/ui": "^4.3.0",
|
|
49
|
+
"@vueuse/core": "^14.0.0",
|
|
50
|
+
"@vueuse/nuxt": "^14.0.0",
|
|
51
|
+
"nuxt": "^4.0.0",
|
|
52
|
+
"tailwindcss": "^4.0.15",
|
|
53
|
+
"typescript": "^5.6.3",
|
|
54
|
+
"vue": "^3.5.18",
|
|
55
|
+
"vue-router": "^4.5.0"
|
|
56
|
+
}
|
|
57
|
+
}
|