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,184 +1,184 @@
1
- <template>
2
- <div
3
- v-if="appearance === 'status'"
4
- class="flex w-[var(--ads-toast-status-width)] max-w-full items-center justify-between gap-3 rounded-[var(--ads-toast-radius)] bg-[var(--ads-toast-status-bg)] p-3 text-[var(--ads-toast-status-text)] shadow-[var(--ads-shadow-level-1)]"
5
- role="status"
6
- >
7
- <div class="flex min-w-0 items-center gap-3">
8
- <UIcon
9
- :name="statusIcon"
10
- class="size-[var(--ads-toast-status-icon)] shrink-0"
11
- :class="[statusIconClass, status === 'loading' ? 'animate-spin' : '']"
12
- aria-hidden="true"
13
- />
14
- <div class="min-w-0">
15
- <p class="text-[length:var(--ads-toast-status-title-size)] leading-[1.3] font-bold">{{ title || resolvedMessage }}</p>
16
- <p v-if="subtitle" class="text-[length:var(--ads-toast-status-subtitle-size)] leading-[1.1]">{{ subtitle }}</p>
17
- </div>
18
- </div>
19
- <button
20
- v-if="closable"
21
- type="button"
22
- class="flex size-[18px] shrink-0 items-center justify-center text-[var(--ads-text-contrast)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-contrast)]"
23
- aria-label="Fechar"
24
- @click="emit('close')"
25
- >
26
- <UIcon name="i-lucide-x" class="size-[18px]" />
27
- </button>
28
- </div>
29
- <div
30
- v-else
31
- class="flex flex-wrap items-center gap-[var(--ads-toast-gap)] rounded-[var(--ads-toast-radius)] p-[var(--ads-toast-padding)]"
32
- :class="[surfaceClass, app ? 'w-[331px] max-w-full' : 'w-full']"
33
- role="status"
34
- >
35
- <div class="flex min-w-0 flex-1 basis-full items-start gap-2 sm:basis-auto">
36
- <UIcon
37
- :name="resolvedIcon"
38
- class="size-[var(--ads-toast-icon)] shrink-0"
39
- :class="iconClass"
40
- aria-hidden="true"
41
- />
42
- <div class="min-w-0 flex-1">
43
- <slot>
44
- <p class="text-[length:var(--ads-toast-font-size)] [font-weight:var(--ads-toast-weight)] leading-[1.3] text-[var(--ads-toast-text)]">
45
- {{ resolvedMessage }}
46
- </p>
47
- <p
48
- v-if="description"
49
- class="text-[length:var(--ads-toast-font-size)] leading-[1.3] text-[var(--ads-text-secondary)]"
50
- :class="app ? 'mt-1' : 'mt-0.5'"
51
- >
52
- {{ description }}
53
- </p>
54
- </slot>
55
- </div>
56
- </div>
57
- <div
58
- v-if="actionLabel || closable"
59
- class="ml-auto flex shrink-0 items-center gap-[var(--ads-toast-gap)]"
60
- >
61
- <button
62
- v-if="actionLabel"
63
- type="button"
64
- class="text-[length:var(--ads-toast-font-size)] leading-[1.3] font-bold underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2"
65
- :class="actionTextClass"
66
- @click="emit('action')"
67
- >
68
- {{ actionLabel }}
69
- </button>
70
- <button
71
- v-if="closable"
72
- type="button"
73
- class="flex size-[18px] shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] text-[var(--ads-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-primary)]"
74
- aria-label="Fechar"
75
- @click="emit('close')"
76
- >
77
- <UIcon name="i-lucide-x" class="size-[18px]" />
78
- </button>
79
- </div>
80
- </div>
81
- </template>
82
-
83
- <script setup lang="ts">
84
- import { computed } from "vue";
85
-
86
- export type AdsToastStatus = "success" | "error" | "warning" | "attention" | "neutral" | "loading";
87
- export type AdsToastAppearance = "banner" | "status";
88
-
89
- const props = withDefaults(
90
- defineProps<{
91
- status?: AdsToastStatus;
92
- /** `banner` é a faixa clara (Toast Header). `status` é o reporte escuro (Toast Alert). */
93
- appearance?: AdsToastAppearance;
94
- /** Faixa estreita de 331px, a variação `App` do ADS. */
95
- app?: boolean;
96
- message?: string;
97
- /** Descrição complementar exibida abaixo da mensagem na faixa (banner). */
98
- description?: string;
99
- title?: string;
100
- subtitle?: string;
101
- icon?: string;
102
- /** Quando falso, o aviso permanece sem a ação de fechar. */
103
- closable?: boolean;
104
- /** Rótulo da ação em link. Sem valor, esconde o link. */
105
- actionLabel?: string;
106
- }>(),
107
- {
108
- status: "error",
109
- appearance: "banner",
110
- app: false,
111
- message: undefined,
112
- description: undefined,
113
- title: undefined,
114
- subtitle: undefined,
115
- icon: undefined,
116
- closable: true,
117
- actionLabel: undefined,
118
- },
119
- );
120
-
121
- const emit = defineEmits<{
122
- close: [];
123
- action: [];
124
- }>();
125
-
126
- const surfaceClass = computed(() => {
127
- if (props.status === "success") return "bg-[var(--ads-status-success-100)]";
128
- if (props.status === "warning" || props.status === "attention") return "bg-[var(--ads-toast-warning-bg)]";
129
- if (props.status === "neutral") return "bg-[var(--ads-toast-neutral-bg)]";
130
- if (props.status === "loading") return "bg-[var(--ads-toast-primary-bg)]";
131
- return "bg-[var(--ads-toast-error-bg)]";
132
- });
133
-
134
- const iconClass = computed(() => {
135
- if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
136
- if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-warning-icon)]";
137
- if (props.status === "neutral") return "text-[var(--ads-toast-neutral-icon)]";
138
- if (props.status === "loading") return "text-[var(--ads-toast-primary-icon)]";
139
- return "text-[var(--ads-toast-error-icon)]";
140
- });
141
-
142
- const actionTextClass = computed(() => {
143
- if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
144
- if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-warning-icon)]";
145
- if (props.status === "neutral") return "text-[var(--ads-toast-neutral-icon)]";
146
- if (props.status === "loading") return "text-[var(--ads-toast-primary-icon)]";
147
- return "text-[var(--ads-toast-error-icon)]";
148
- });
149
-
150
- const resolvedIcon = computed(() => {
151
- if (props.icon) return props.icon;
152
- if (props.status === "success") return "i-lucide-circle-check";
153
- if (props.status === "warning") return "i-lucide-triangle-alert";
154
- if (props.status === "attention") return "i-lucide-circle-alert";
155
- if (props.status === "neutral") return "i-lucide-calendar-fold";
156
- if (props.status === "loading") return "i-lucide-info";
157
- return "i-lucide-circle-x";
158
- });
159
-
160
- const statusIcon = computed(() => {
161
- if (props.icon) return props.icon;
162
- if (props.status === "success") return "i-lucide-circle-check";
163
- if (props.status === "warning" || props.status === "attention") return "i-lucide-triangle-alert";
164
- if (props.status === "loading") return "i-lucide-loader-circle";
165
- return "i-lucide-circle-x";
166
- });
167
-
168
- const statusIconClass = computed(() => {
169
- if (props.status === "success") return "text-[var(--ads-toast-status-success)]";
170
- if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-status-warning)]";
171
- if (props.status === "loading") return "text-[var(--ads-toast-status-loading)]";
172
- return "text-[var(--ads-toast-status-error)]";
173
- });
174
-
175
- const resolvedMessage = computed(() => {
176
- if (props.message) return props.message;
177
- if (props.status === "success") return "Mensagem de sucesso";
178
- if (props.status === "warning") return "Mensagem de alerta";
179
- if (props.status === "attention") return "Mensagem de atenção";
180
- if (props.status === "neutral") return "Mensagem de lembrete";
181
- if (props.status === "loading") return "Mensagem de reporte";
182
- return "Mensagem de erro";
183
- });
184
- </script>
1
+ <template>
2
+ <div
3
+ v-if="appearance === 'status'"
4
+ class="flex w-[var(--ads-toast-status-width)] max-w-full items-center justify-between gap-3 rounded-[var(--ads-toast-radius)] bg-[var(--ads-toast-status-bg)] p-3 text-[var(--ads-toast-status-text)] shadow-[var(--ads-shadow-level-1)]"
5
+ role="status"
6
+ >
7
+ <div class="flex min-w-0 items-center gap-3">
8
+ <UIcon
9
+ :name="statusIcon"
10
+ class="size-[var(--ads-toast-status-icon)] shrink-0"
11
+ :class="[statusIconClass, status === 'loading' ? 'animate-spin' : '']"
12
+ aria-hidden="true"
13
+ />
14
+ <div class="min-w-0">
15
+ <p class="text-[length:var(--ads-toast-status-title-size)] leading-[1.3] font-bold">{{ title || resolvedMessage }}</p>
16
+ <p v-if="subtitle" class="text-[length:var(--ads-toast-status-subtitle-size)] leading-[1.1]">{{ subtitle }}</p>
17
+ </div>
18
+ </div>
19
+ <button
20
+ v-if="closable"
21
+ type="button"
22
+ class="flex size-[18px] shrink-0 items-center justify-center text-[var(--ads-text-contrast)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-contrast)]"
23
+ aria-label="Fechar"
24
+ @click="emit('close')"
25
+ >
26
+ <UIcon name="i-lucide-x" class="size-[18px]" />
27
+ </button>
28
+ </div>
29
+ <div
30
+ v-else
31
+ class="flex flex-wrap items-center gap-[var(--ads-toast-gap)] rounded-[var(--ads-toast-radius)] p-[var(--ads-toast-padding)]"
32
+ :class="[surfaceClass, app ? 'w-[331px] max-w-full' : 'w-full']"
33
+ role="status"
34
+ >
35
+ <div class="flex min-w-0 flex-1 basis-full items-start gap-2 sm:basis-auto">
36
+ <UIcon
37
+ :name="resolvedIcon"
38
+ class="size-[var(--ads-toast-icon)] shrink-0"
39
+ :class="iconClass"
40
+ aria-hidden="true"
41
+ />
42
+ <div class="min-w-0 flex-1">
43
+ <slot>
44
+ <p class="text-[length:var(--ads-toast-font-size)] [font-weight:var(--ads-toast-weight)] leading-[1.3] text-[var(--ads-toast-text)]">
45
+ {{ resolvedMessage }}
46
+ </p>
47
+ <p
48
+ v-if="description"
49
+ class="text-[length:var(--ads-toast-font-size)] leading-[1.3] text-[var(--ads-text-secondary)]"
50
+ :class="app ? 'mt-1' : 'mt-0.5'"
51
+ >
52
+ {{ description }}
53
+ </p>
54
+ </slot>
55
+ </div>
56
+ </div>
57
+ <div
58
+ v-if="actionLabel || closable"
59
+ class="ml-auto flex shrink-0 items-center gap-[var(--ads-toast-gap)]"
60
+ >
61
+ <button
62
+ v-if="actionLabel"
63
+ type="button"
64
+ class="text-[length:var(--ads-toast-font-size)] leading-[1.3] font-bold underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2"
65
+ :class="actionTextClass"
66
+ @click="emit('action')"
67
+ >
68
+ {{ actionLabel }}
69
+ </button>
70
+ <button
71
+ v-if="closable"
72
+ type="button"
73
+ class="flex size-[18px] shrink-0 items-center justify-center rounded-[var(--ads-radius-xsm)] text-[var(--ads-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-primary)]"
74
+ aria-label="Fechar"
75
+ @click="emit('close')"
76
+ >
77
+ <UIcon name="i-lucide-x" class="size-[18px]" />
78
+ </button>
79
+ </div>
80
+ </div>
81
+ </template>
82
+
83
+ <script setup lang="ts">
84
+ import { computed } from "vue";
85
+
86
+ export type AdsToastStatus = "success" | "error" | "warning" | "attention" | "neutral" | "loading";
87
+ export type AdsToastAppearance = "banner" | "status";
88
+
89
+ const props = withDefaults(
90
+ defineProps<{
91
+ status?: AdsToastStatus;
92
+ /** `banner` é a faixa clara (Toast Header). `status` é o reporte escuro (Toast Alert). */
93
+ appearance?: AdsToastAppearance;
94
+ /** Faixa estreita de 331px, a variação `App` do ADS. */
95
+ app?: boolean;
96
+ message?: string;
97
+ /** Descrição complementar exibida abaixo da mensagem na faixa (banner). */
98
+ description?: string;
99
+ title?: string;
100
+ subtitle?: string;
101
+ icon?: string;
102
+ /** Quando falso, o aviso permanece sem a ação de fechar. */
103
+ closable?: boolean;
104
+ /** Rótulo da ação em link. Sem valor, esconde o link. */
105
+ actionLabel?: string;
106
+ }>(),
107
+ {
108
+ status: "error",
109
+ appearance: "banner",
110
+ app: false,
111
+ message: undefined,
112
+ description: undefined,
113
+ title: undefined,
114
+ subtitle: undefined,
115
+ icon: undefined,
116
+ closable: true,
117
+ actionLabel: undefined,
118
+ },
119
+ );
120
+
121
+ const emit = defineEmits<{
122
+ close: [];
123
+ action: [];
124
+ }>();
125
+
126
+ const surfaceClass = computed(() => {
127
+ if (props.status === "success") return "bg-[var(--ads-status-success-100)]";
128
+ if (props.status === "warning" || props.status === "attention") return "bg-[var(--ads-toast-warning-bg)]";
129
+ if (props.status === "neutral") return "bg-[var(--ads-toast-neutral-bg)]";
130
+ if (props.status === "loading") return "bg-[var(--ads-toast-primary-bg)]";
131
+ return "bg-[var(--ads-toast-error-bg)]";
132
+ });
133
+
134
+ const iconClass = computed(() => {
135
+ if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
136
+ if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-warning-icon)]";
137
+ if (props.status === "neutral") return "text-[var(--ads-toast-neutral-icon)]";
138
+ if (props.status === "loading") return "text-[var(--ads-toast-primary-icon)]";
139
+ return "text-[var(--ads-toast-error-icon)]";
140
+ });
141
+
142
+ const actionTextClass = computed(() => {
143
+ if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
144
+ if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-warning-icon)]";
145
+ if (props.status === "neutral") return "text-[var(--ads-toast-neutral-icon)]";
146
+ if (props.status === "loading") return "text-[var(--ads-toast-primary-icon)]";
147
+ return "text-[var(--ads-toast-error-icon)]";
148
+ });
149
+
150
+ const resolvedIcon = computed(() => {
151
+ if (props.icon) return props.icon;
152
+ if (props.status === "success") return "i-lucide-circle-check";
153
+ if (props.status === "warning") return "i-lucide-triangle-alert";
154
+ if (props.status === "attention") return "i-lucide-circle-alert";
155
+ if (props.status === "neutral") return "i-lucide-calendar-fold";
156
+ if (props.status === "loading") return "i-lucide-info";
157
+ return "i-lucide-circle-x";
158
+ });
159
+
160
+ const statusIcon = computed(() => {
161
+ if (props.icon) return props.icon;
162
+ if (props.status === "success") return "i-lucide-circle-check";
163
+ if (props.status === "warning" || props.status === "attention") return "i-lucide-triangle-alert";
164
+ if (props.status === "loading") return "i-lucide-loader-circle";
165
+ return "i-lucide-circle-x";
166
+ });
167
+
168
+ const statusIconClass = computed(() => {
169
+ if (props.status === "success") return "text-[var(--ads-toast-status-success)]";
170
+ if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-status-warning)]";
171
+ if (props.status === "loading") return "text-[var(--ads-toast-status-loading)]";
172
+ return "text-[var(--ads-toast-status-error)]";
173
+ });
174
+
175
+ const resolvedMessage = computed(() => {
176
+ if (props.message) return props.message;
177
+ if (props.status === "success") return "Mensagem de sucesso";
178
+ if (props.status === "warning") return "Mensagem de alerta";
179
+ if (props.status === "attention") return "Mensagem de atenção";
180
+ if (props.status === "neutral") return "Mensagem de lembrete";
181
+ if (props.status === "loading") return "Mensagem de reporte";
182
+ return "Mensagem de erro";
183
+ });
184
+ </script>
@@ -1,73 +1,73 @@
1
- <template>
2
- <UTooltip
3
- v-if="hasTrigger"
4
- arrow
5
- :delay-duration="delayDuration"
6
- :disabled="disabled"
7
- :content="{ side, align, sideOffset: 8 }"
8
- :ui="tooltipUi"
9
- >
10
- <slot />
11
- <template #content>
12
- <div class="flex max-w-[328px] flex-col gap-1 text-[var(--ads-text-contrast)]">
13
- <p v-if="showTitle" class="text-[length:var(--ads-tooltip-title-size)] leading-[1.3] font-bold text-[var(--ads-tooltip-title)]">{{ title }}</p>
14
- <p v-if="showDescription" class="text-[length:var(--ads-tooltip-font-size)] leading-[1.3] text-[var(--ads-tooltip-title)]">{{ description }}</p>
15
- </div>
16
- </template>
17
- </UTooltip>
18
- <div
19
- v-else
20
- class="flex max-w-[328px] flex-col gap-1 rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-padding-x)] text-[var(--ads-tooltip-title)] shadow-[var(--ads-shadow-level-1)]"
21
- >
22
- <p v-if="showTitle" class="text-[length:var(--ads-tooltip-title-size)] leading-[1.3] font-bold">{{ title }}</p>
23
- <p v-if="showDescription" class="text-[length:var(--ads-tooltip-font-size)] leading-[1.3]">{{ description }}</p>
24
- </div>
25
- </template>
26
-
27
- <script setup lang="ts">
28
- import { computed, useSlots } from "vue";
29
-
30
- type Wing = "up" | "down" | "left" | "right";
31
-
32
- const props = withDefaults(
33
- defineProps<{
34
- title?: string;
35
- description?: string;
36
- showTitle?: boolean;
37
- showDescription?: boolean;
38
- /** Figma `Wing Position`. */
39
- wing?: Wing;
40
- delayDuration?: number;
41
- /** Alinhamento do balão em relação ao gatilho. */
42
- align?: "start" | "center" | "end";
43
- /** Não abre o balão. Útil para texto que só aparece quando é cortado. */
44
- disabled?: boolean;
45
- }>(),
46
- {
47
- title: "Título",
48
- description: "Descrição do tooltip.",
49
- showTitle: true,
50
- showDescription: true,
51
- wing: "up",
52
- delayDuration: 150,
53
- align: "center",
54
- disabled: false,
55
- },
56
- );
57
-
58
- const slots = useSlots();
59
- const hasTrigger = computed(() => Boolean(slots.default));
60
-
61
- const side = computed(() => {
62
- if (props.wing === "down") return "bottom" as const;
63
- if (props.wing === "left") return "left" as const;
64
- if (props.wing === "right") return "right" as const;
65
- return "top" as const;
66
- });
67
-
68
- const tooltipUi = {
69
- content:
70
- "z-[70] h-auto max-w-[328px] rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-padding-x)] shadow-[var(--ads-shadow-level-1)] ring-0",
71
- arrow: "fill-[var(--ads-tooltip-bg)]",
72
- };
73
- </script>
1
+ <template>
2
+ <UTooltip
3
+ v-if="hasTrigger"
4
+ arrow
5
+ :delay-duration="delayDuration"
6
+ :disabled="disabled"
7
+ :content="{ side, align, sideOffset: 8 }"
8
+ :ui="tooltipUi"
9
+ >
10
+ <slot />
11
+ <template #content>
12
+ <div class="flex max-w-[328px] flex-col gap-1 text-[var(--ads-text-contrast)]">
13
+ <p v-if="showTitle" class="text-[length:var(--ads-tooltip-title-size)] leading-[1.3] font-bold text-[var(--ads-tooltip-title)]">{{ title }}</p>
14
+ <p v-if="showDescription" class="text-[length:var(--ads-tooltip-font-size)] leading-[1.3] text-[var(--ads-tooltip-title)]">{{ description }}</p>
15
+ </div>
16
+ </template>
17
+ </UTooltip>
18
+ <div
19
+ v-else
20
+ class="flex max-w-[328px] flex-col gap-1 rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-padding-x)] text-[var(--ads-tooltip-title)] shadow-[var(--ads-shadow-level-1)]"
21
+ >
22
+ <p v-if="showTitle" class="text-[length:var(--ads-tooltip-title-size)] leading-[1.3] font-bold">{{ title }}</p>
23
+ <p v-if="showDescription" class="text-[length:var(--ads-tooltip-font-size)] leading-[1.3]">{{ description }}</p>
24
+ </div>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import { computed, useSlots } from "vue";
29
+
30
+ type Wing = "up" | "down" | "left" | "right";
31
+
32
+ const props = withDefaults(
33
+ defineProps<{
34
+ title?: string;
35
+ description?: string;
36
+ showTitle?: boolean;
37
+ showDescription?: boolean;
38
+ /** Figma `Wing Position`. */
39
+ wing?: Wing;
40
+ delayDuration?: number;
41
+ /** Alinhamento do balão em relação ao gatilho. */
42
+ align?: "start" | "center" | "end";
43
+ /** Não abre o balão. Útil para texto que só aparece quando é cortado. */
44
+ disabled?: boolean;
45
+ }>(),
46
+ {
47
+ title: "Título",
48
+ description: "Descrição do tooltip.",
49
+ showTitle: true,
50
+ showDescription: true,
51
+ wing: "up",
52
+ delayDuration: 150,
53
+ align: "center",
54
+ disabled: false,
55
+ },
56
+ );
57
+
58
+ const slots = useSlots();
59
+ const hasTrigger = computed(() => Boolean(slots.default));
60
+
61
+ const side = computed(() => {
62
+ if (props.wing === "down") return "bottom" as const;
63
+ if (props.wing === "left") return "left" as const;
64
+ if (props.wing === "right") return "right" as const;
65
+ return "top" as const;
66
+ });
67
+
68
+ const tooltipUi = {
69
+ content:
70
+ "z-[70] h-auto max-w-[328px] rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] p-[var(--ads-tooltip-padding-x)] shadow-[var(--ads-shadow-level-1)] ring-0",
71
+ arrow: "fill-[var(--ads-tooltip-bg)]",
72
+ };
73
+ </script>
@@ -20,17 +20,7 @@
20
20
  </template>
21
21
 
22
22
  <template #content>
23
- <div class="relative px-10 pt-2 text-center">
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, OverlayVariant } from "../types/overlay-loading.types";
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;