ads-nuxt 0.1.4 → 0.2.0

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 (90) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -577
  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 -0
  8. package/app/assets/brand/radar.svg +9 -9
  9. package/app/assets/css/ads-colors.css +257 -246
  10. package/app/assets/css/component-tokens.css +367 -403
  11. package/app/assets/css/main.css +624 -617
  12. package/app/components/AdsBadge.vue +47 -48
  13. package/app/components/AdsBroadcast.vue +24 -45
  14. package/app/components/AdsButton.vue +539 -569
  15. package/app/components/AdsButtonGroup.vue +39 -39
  16. package/app/components/AdsButtonMenu.vue +48 -48
  17. package/app/components/AdsCard.vue +188 -117
  18. package/app/components/AdsCardHint.vue +22 -0
  19. package/app/components/AdsCardPeriod.vue +43 -0
  20. package/app/components/AdsCardVariation.vue +31 -0
  21. package/app/components/AdsCharttip.vue +78 -78
  22. package/app/components/AdsCheckbox.vue +77 -77
  23. package/app/components/AdsDatePicker.vue +492 -479
  24. package/app/components/AdsDropdownMenu.vue +30 -19
  25. package/app/components/AdsEmptyState.vue +58 -58
  26. package/app/components/AdsFeatureCard.vue +210 -219
  27. package/app/components/AdsFileCard.vue +98 -101
  28. package/app/components/AdsFooter.vue +25 -25
  29. package/app/components/AdsHeavyAccountCell.vue +59 -0
  30. package/app/components/AdsHeavyHeaderCell.vue +70 -0
  31. package/app/components/AdsHeavyTable.vue +135 -0
  32. package/app/components/AdsInput.vue +147 -143
  33. package/app/components/AdsLoading.vue +217 -109
  34. package/app/components/AdsMenuBar.vue +103 -103
  35. package/app/components/AdsMetricCard.vue +216 -119
  36. package/app/components/AdsModal.vue +157 -157
  37. package/app/components/AdsMonthPicker.vue +80 -80
  38. package/app/components/AdsNavbarApp.vue +67 -67
  39. package/app/components/AdsNavbarDesk.vue +62 -62
  40. package/app/components/AdsNotabilityPill.vue +24 -27
  41. package/app/components/AdsNumberInput.vue +173 -166
  42. package/app/components/AdsPagination.vue +91 -91
  43. package/app/components/AdsPanelCard.vue +99 -0
  44. package/app/components/AdsPill.vue +144 -92
  45. package/app/components/AdsProductTag.vue +61 -61
  46. package/app/components/AdsRadio.vue +70 -70
  47. package/app/components/AdsSearchInput.vue +122 -113
  48. package/app/components/AdsSegmentedTabs.vue +62 -28
  49. package/app/components/{AdsFilterSelect.vue → AdsSelect.vue} +266 -203
  50. package/app/components/AdsSelectItem.vue +128 -0
  51. package/app/components/AdsSelectPanel.vue +150 -0
  52. package/app/components/AdsSideMenu.vue +101 -101
  53. package/app/components/AdsSmalltip.vue +44 -44
  54. package/app/components/AdsStepper.vue +222 -0
  55. package/app/components/AdsSteptip.vue +101 -101
  56. package/app/components/AdsSwitch.vue +59 -59
  57. package/app/components/AdsTable.vue +161 -100
  58. package/app/components/AdsTableHeaderCell.vue +80 -0
  59. package/app/components/AdsTableSkeleton.vue +113 -0
  60. package/app/components/AdsTableToolbar.vue +44 -44
  61. package/app/components/AdsTabs.vue +51 -51
  62. package/app/components/AdsTextarea.vue +116 -109
  63. package/app/components/AdsToast.vue +183 -181
  64. package/app/components/AdsTooltip.vue +73 -73
  65. package/app/components/OverlayLoading.vue +173 -173
  66. package/app/components/ProgressBarLoading.vue +235 -256
  67. package/app/composables/useOverlayLoading.ts +66 -66
  68. package/app/constants/ads-color-swatches.ts +240 -239
  69. package/app/locale/pt-br.ts +6 -6
  70. package/app/plugins/ads-toast.client.ts +24 -24
  71. package/app/theme/ads-theme.ts +374 -370
  72. package/app/theme/ads-tokens.ts +391 -379
  73. package/app/theme/component-tokens.json +366 -402
  74. package/app/theme/component-tokens.ts +807 -815
  75. package/app/types/overlay-loading.types.ts +26 -26
  76. package/app/utils/ads-filter-select.ts +191 -172
  77. package/app/utils/ads-table.ts +395 -204
  78. package/app/utils/calendar-date.ts +163 -163
  79. package/app/utils/category-role.ts +45 -45
  80. package/app/utils/money.ts +77 -77
  81. package/app/utils/notability.ts +8 -8
  82. package/app/utils/parser.ts +134 -134
  83. package/app/utils/percentage.ts +54 -54
  84. package/nuxt.config.ts +31 -31
  85. package/package.json +1 -1
  86. package/app/components/AdsFarmarcasPill.vue +0 -74
  87. package/app/components/AdsFilterDropdown.vue +0 -174
  88. package/app/components/AdsFilterOption.vue +0 -74
  89. package/app/components/AdsListDropdown.vue +0 -44
  90. package/app/components/AdsMiniPill.vue +0 -40
@@ -1,181 +1,183 @@
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
- </slot>
48
- </div>
49
- </div>
50
- <div
51
- v-if="actionLabel || closable"
52
- class="ml-auto flex shrink-0 items-center gap-2"
53
- >
54
- <AdsButton
55
- v-if="actionLabel"
56
- size="sm"
57
- :color="actionColor"
58
- :leading="Boolean(actionIcon)"
59
- :icon="actionIcon"
60
- :label="actionLabel"
61
- @click="emit('action')"
62
- />
63
- <button
64
- v-if="closable"
65
- type="button"
66
- class="flex size-6 shrink-0 items-center justify-center rounded text-[var(--ads-text-primary)] hover:bg-black/5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-primary)]"
67
- aria-label="Fechar"
68
- @click="emit('close')"
69
- >
70
- <UIcon name="i-lucide-x" class="size-[18px]" />
71
- </button>
72
- </div>
73
- </div>
74
- </template>
75
-
76
- <script setup lang="ts">
77
- import { computed } from "vue";
78
- import AdsButton from "./AdsButton.vue";
79
- import type { AdsButtonColor } from "./AdsButton.vue";
80
-
81
- export type AdsToastStatus = "primary" | "success" | "error" | "warning" | "neutral" | "loading";
82
- export type AdsToastAppearance = "banner" | "status";
83
-
84
- const props = withDefaults(
85
- defineProps<{
86
- status?: AdsToastStatus;
87
- /** `banner` é a faixa clara. `status` é o reporte escuro (Figma Status Toast). */
88
- appearance?: AdsToastAppearance;
89
- /** Faixa estreita de 331px, a variação `App` do ADS. */
90
- app?: boolean;
91
- message?: string;
92
- title?: string;
93
- subtitle?: string;
94
- icon?: string;
95
- /** Quando falso, o aviso permanece sem a ação de fechar. */
96
- closable?: boolean;
97
- /** Recuperação na própria faixa, como tentar de novo. */
98
- actionLabel?: string;
99
- /** Ícone da ação. Vazio esconde o ícone. */
100
- actionIcon?: string;
101
- }>(),
102
- {
103
- status: "error",
104
- appearance: "banner",
105
- app: false,
106
- message: undefined,
107
- title: undefined,
108
- subtitle: undefined,
109
- icon: undefined,
110
- closable: true,
111
- actionLabel: undefined,
112
- actionIcon: "i-lucide-refresh-cw",
113
- },
114
- );
115
-
116
- const emit = defineEmits<{
117
- close: [];
118
- action: [];
119
- }>();
120
-
121
- const actionColor = computed((): AdsButtonColor => {
122
- if (props.status === "success") return "success";
123
- if (props.status === "warning") return "attention";
124
- if (props.status === "primary") return "primary";
125
- if (props.status === "neutral") return "neutral";
126
- return "warning";
127
- });
128
-
129
- const surfaceClass = computed(() => {
130
- if (props.status === "primary") return "bg-[var(--ads-toast-primary-bg)]";
131
- if (props.status === "success") return "bg-[var(--ads-status-success-100)]";
132
- if (props.status === "warning") return "bg-[var(--ads-toast-warning-bg)]";
133
- if (props.status === "neutral") return "bg-[var(--ads-toast-neutral-bg)]";
134
- if (props.status === "loading") return "bg-[var(--ads-toast-primary-bg)]";
135
- return "bg-[var(--ads-toast-error-bg)]";
136
- });
137
-
138
- const iconClass = computed(() => {
139
- if (props.status === "primary") return "text-[var(--ads-toast-primary-icon)]";
140
- if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
141
- if (props.status === "warning") return "text-[var(--ads-toast-warning-icon)]";
142
- if (props.status === "neutral") return "text-[var(--ads-toast-neutral-icon)]";
143
- if (props.status === "loading") return "text-ads-oportunidade-300";
144
- return "text-[var(--ads-toast-error-icon)]";
145
- });
146
-
147
- const resolvedIcon = computed(() => {
148
- if (props.icon) return props.icon;
149
- if (props.status === "primary") return "i-lucide-info";
150
- if (props.status === "success") return "i-lucide-circle-check";
151
- if (props.status === "warning") return "i-lucide-triangle-alert";
152
- if (props.status === "neutral") return "i-lucide-calendar-fold";
153
- if (props.status === "loading") return "i-lucide-loader-circle";
154
- return "i-lucide-circle-x";
155
- });
156
-
157
- const statusIcon = computed(() => {
158
- if (props.icon) return props.icon;
159
- if (props.status === "success") return "i-lucide-circle-check";
160
- if (props.status === "warning") return "i-lucide-triangle-alert";
161
- if (props.status === "loading") return "i-lucide-loader-circle";
162
- return "i-lucide-circle-x";
163
- });
164
-
165
- const statusIconClass = computed(() => {
166
- if (props.status === "success") return "text-[var(--ads-toast-status-success)]";
167
- if (props.status === "warning") return "text-[var(--ads-toast-status-warning)]";
168
- if (props.status === "loading") return "text-[var(--ads-toast-status-loading)]";
169
- return "text-[var(--ads-toast-status-error)]";
170
- });
171
-
172
- const resolvedMessage = computed(() => {
173
- if (props.message) return props.message;
174
- if (props.status === "primary") return "Mensagem informativa";
175
- if (props.status === "success") return "Mensagem de sucesso";
176
- if (props.status === "warning") return "Mensagem de alerta";
177
- if (props.status === "neutral") return "Mensagem de lembrete";
178
- if (props.status === "loading") return "Mensagem de reporte";
179
- return "Mensagem de erro";
180
- });
181
- </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="mt-0.5 text-[length:var(--ads-toast-font-size)] leading-[1.3] text-[var(--ads-text-secondary)]"
50
+ >
51
+ {{ description }}
52
+ </p>
53
+ </slot>
54
+ </div>
55
+ </div>
56
+ <div
57
+ v-if="actionLabel || closable"
58
+ class="ml-auto flex shrink-0 items-center gap-2"
59
+ >
60
+ <button
61
+ v-if="actionLabel"
62
+ type="button"
63
+ class="text-[length:var(--ads-toast-font-size)] [font-weight:var(--ads-toast-weight)] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-offset-2"
64
+ :class="actionTextClass"
65
+ @click="emit('action')"
66
+ >
67
+ {{ actionLabel }}
68
+ </button>
69
+ <button
70
+ v-if="closable"
71
+ type="button"
72
+ class="flex size-6 shrink-0 items-center justify-center rounded text-[var(--ads-text-primary)] hover:bg-black/5 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ads-text-primary)]"
73
+ aria-label="Fechar"
74
+ @click="emit('close')"
75
+ >
76
+ <UIcon name="i-lucide-x" class="size-[18px]" />
77
+ </button>
78
+ </div>
79
+ </div>
80
+ </template>
81
+
82
+ <script setup lang="ts">
83
+ import { computed } from "vue";
84
+
85
+ export type AdsToastStatus = "success" | "error" | "warning" | "attention" | "neutral" | "loading";
86
+ export type AdsToastAppearance = "banner" | "status";
87
+
88
+ const props = withDefaults(
89
+ defineProps<{
90
+ status?: AdsToastStatus;
91
+ /** `banner` é a faixa clara (Toast Header). `status` é o reporte escuro (Toast Alert). */
92
+ appearance?: AdsToastAppearance;
93
+ /** Faixa estreita de 331px, a variação `App` do ADS. */
94
+ app?: boolean;
95
+ message?: string;
96
+ /** Descrição complementar exibida abaixo da mensagem na faixa (banner). */
97
+ description?: string;
98
+ title?: string;
99
+ subtitle?: string;
100
+ icon?: string;
101
+ /** Quando falso, o aviso permanece sem a ação de fechar. */
102
+ closable?: boolean;
103
+ /** Rótulo da ação em link. Sem valor, esconde o link. */
104
+ actionLabel?: string;
105
+ }>(),
106
+ {
107
+ status: "error",
108
+ appearance: "banner",
109
+ app: false,
110
+ message: undefined,
111
+ description: undefined,
112
+ title: undefined,
113
+ subtitle: undefined,
114
+ icon: undefined,
115
+ closable: true,
116
+ actionLabel: undefined,
117
+ },
118
+ );
119
+
120
+ const emit = defineEmits<{
121
+ close: [];
122
+ action: [];
123
+ }>();
124
+
125
+ const surfaceClass = computed(() => {
126
+ if (props.status === "success") return "bg-[var(--ads-status-success-100)]";
127
+ if (props.status === "warning" || props.status === "attention") return "bg-[var(--ads-toast-warning-bg)]";
128
+ if (props.status === "neutral") return "bg-[var(--ads-toast-neutral-bg)]";
129
+ if (props.status === "loading") return "bg-[var(--ads-toast-primary-bg)]";
130
+ return "bg-[var(--ads-toast-error-bg)]";
131
+ });
132
+
133
+ const iconClass = computed(() => {
134
+ if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
135
+ if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-warning-icon)]";
136
+ if (props.status === "neutral") return "text-[var(--ads-toast-neutral-icon)]";
137
+ if (props.status === "loading") return "text-[var(--ads-toast-primary-icon)]";
138
+ return "text-[var(--ads-toast-error-icon)]";
139
+ });
140
+
141
+ const actionTextClass = computed(() => {
142
+ if (props.status === "success") return "text-[var(--ads-toast-success-icon)]";
143
+ if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-warning-icon)]";
144
+ if (props.status === "neutral") return "text-[var(--ads-text-secondary)]";
145
+ if (props.status === "loading") return "text-[var(--ads-toast-primary-icon)]";
146
+ return "text-[var(--ads-toast-error-icon)]";
147
+ });
148
+
149
+ const resolvedIcon = computed(() => {
150
+ if (props.icon) return props.icon;
151
+ if (props.status === "success") return "i-lucide-circle-check";
152
+ if (props.status === "warning") return "i-lucide-triangle-alert";
153
+ if (props.status === "attention") return "i-lucide-circle-alert";
154
+ if (props.status === "neutral") return "i-lucide-calendar-fold";
155
+ if (props.status === "loading") return "i-lucide-info";
156
+ return "i-lucide-circle-x";
157
+ });
158
+
159
+ const statusIcon = computed(() => {
160
+ if (props.icon) return props.icon;
161
+ if (props.status === "success") return "i-lucide-circle-check";
162
+ if (props.status === "warning" || props.status === "attention") return "i-lucide-triangle-alert";
163
+ if (props.status === "loading") return "i-lucide-loader-circle";
164
+ return "i-lucide-circle-x";
165
+ });
166
+
167
+ const statusIconClass = computed(() => {
168
+ if (props.status === "success") return "text-[var(--ads-toast-status-success)]";
169
+ if (props.status === "warning" || props.status === "attention") return "text-[var(--ads-toast-status-warning)]";
170
+ if (props.status === "loading") return "text-[var(--ads-toast-status-loading)]";
171
+ return "text-[var(--ads-toast-status-error)]";
172
+ });
173
+
174
+ const resolvedMessage = computed(() => {
175
+ if (props.message) return props.message;
176
+ if (props.status === "success") return "Mensagem de sucesso";
177
+ if (props.status === "warning") return "Mensagem de alerta";
178
+ if (props.status === "attention") return "Mensagem de atenção";
179
+ if (props.status === "neutral") return "Mensagem de lembrete";
180
+ if (props.status === "loading") return "Mensagem de reporte";
181
+ return "Mensagem de erro";
182
+ });
183
+ </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-[var(--ads-steptip-width)] flex-col gap-1 rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] px-[var(--ads-tooltip-padding-x)] py-[var(--ads-tooltip-padding-y)] 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)] px-4 py-3 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-[var(--ads-steptip-width)] flex-col gap-1 rounded-[var(--ads-tooltip-radius)] bg-[var(--ads-tooltip-bg)] px-[var(--ads-tooltip-padding-x)] py-[var(--ads-tooltip-padding-y)] 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)] px-4 py-3 shadow-[var(--ads-shadow-level-1)] ring-0",
71
+ arrow: "fill-[var(--ads-tooltip-bg)]",
72
+ };
73
+ </script>