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.
- package/LICENSE +21 -21
- package/README.md +574 -575
- package/app/app.config.ts +25 -25
- package/app/assets/ads/checkbox-check.svg +5 -5
- package/app/assets/ads/checkbox-minus.svg +5 -5
- package/app/assets/brand/farmarcas.svg +6 -6
- package/app/assets/brand/radar-symbol.svg +9 -9
- package/app/assets/brand/radar.svg +9 -9
- package/app/assets/css/ads-colors.css +257 -257
- package/app/assets/css/component-tokens.css +6 -2
- package/app/assets/css/main.css +585 -585
- package/app/components/AdsBadge.vue +47 -47
- package/app/components/AdsBroadcast.vue +24 -24
- package/app/components/AdsButton.vue +547 -547
- package/app/components/AdsButtonGroup.vue +39 -39
- package/app/components/AdsButtonMenu.vue +48 -48
- package/app/components/AdsCard.vue +188 -188
- package/app/components/AdsCardHint.vue +56 -22
- package/app/components/AdsCardPeriod.vue +43 -43
- package/app/components/AdsCardVariation.vue +31 -31
- package/app/components/AdsCharttip.vue +79 -79
- package/app/components/AdsDatePicker.vue +509 -509
- package/app/components/AdsDropdownMenu.vue +30 -30
- package/app/components/AdsEmptyState.vue +61 -61
- package/app/components/AdsFeatureCard.vue +292 -210
- package/app/components/AdsFileCard.vue +98 -98
- package/app/components/AdsFooter.vue +25 -25
- package/app/components/AdsHeavyAccountCell.vue +59 -59
- package/app/components/AdsHeavyHeaderCell.vue +70 -70
- package/app/components/AdsHeavyTable.vue +135 -139
- package/app/components/AdsInput.vue +148 -148
- package/app/components/AdsLoading.vue +217 -217
- package/app/components/AdsMenuBar.vue +110 -110
- package/app/components/AdsMetricCard.vue +226 -216
- package/app/components/AdsModal.vue +160 -160
- package/app/components/AdsMonthPicker.vue +80 -80
- package/app/components/AdsNavbarApp.vue +67 -67
- package/app/components/AdsNavbarDesk.vue +67 -67
- package/app/components/AdsNotabilityPill.vue +24 -24
- package/app/components/AdsNumberInput.vue +173 -173
- package/app/components/AdsPanelCard.vue +99 -99
- package/app/components/AdsPill.vue +144 -144
- package/app/components/AdsProductTag.vue +80 -80
- package/app/components/AdsSearchInput.vue +122 -122
- package/app/components/AdsSegmentedTabs.vue +62 -62
- package/app/components/AdsSelect.vue +283 -283
- package/app/components/AdsSelectItem.vue +128 -128
- package/app/components/AdsSelectPanel.vue +221 -221
- package/app/components/AdsSideMenu.vue +101 -101
- package/app/components/AdsSmalltip.vue +44 -44
- package/app/components/AdsStepper.vue +222 -222
- package/app/components/AdsTable.vue +172 -176
- package/app/components/AdsTableHeaderCell.vue +80 -80
- package/app/components/AdsTableSkeleton.vue +113 -113
- package/app/components/AdsTableToolbar.vue +44 -44
- package/app/components/AdsTabs.vue +51 -51
- package/app/components/AdsTextarea.vue +116 -116
- package/app/components/AdsToast.vue +184 -184
- package/app/components/AdsTooltip.vue +73 -73
- package/app/components/OverlayLoading.vue +2 -17
- package/app/components/ProgressBarLoading.vue +235 -235
- package/app/composables/useOverlayLoading.ts +88 -88
- package/app/constants/ads-color-swatches.ts +240 -240
- package/app/locale/pt-br.ts +6 -6
- package/app/plugins/ads-toast.client.ts +24 -24
- package/app/theme/ads-theme.ts +374 -374
- package/app/theme/ads-tokens.ts +391 -391
- package/app/theme/component-tokens.json +6 -2
- package/app/theme/component-tokens.ts +6 -2
- package/app/types/overlay-loading.types.ts +32 -35
- package/app/utils/ads-filter-select.ts +191 -191
- package/app/utils/ads-table.ts +416 -398
- package/app/utils/calendar-date.ts +163 -163
- package/app/utils/category-role.ts +45 -45
- package/app/utils/money.ts +77 -77
- package/app/utils/notability.ts +8 -8
- package/app/utils/parser.ts +134 -134
- package/app/utils/percentage.ts +54 -54
- package/nuxt.config.ts +31 -31
- package/package.json +57 -56
|
@@ -1,210 +1,292 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
AdsFeatureCard — atalho de módulo sobre o AdsCard. A casca (borda, raio, fundo,
|
|
3
|
-
é a do AdsCard
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
)
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
1
|
+
<!--
|
|
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.
|
|
5
|
+
-->
|
|
6
|
+
<template>
|
|
7
|
+
<AdsCard
|
|
8
|
+
:as="shellIsButton ? (to ? NuxtLink : 'button') : 'div'"
|
|
9
|
+
v-bind="shellIsButton ? interactiveAttrs : {}"
|
|
10
|
+
:disabled="shellIsButton ? disabled : undefined"
|
|
11
|
+
:hoverable="false"
|
|
12
|
+
class="group w-[var(--ads-feature-width)] max-w-full"
|
|
13
|
+
:style="cardStyle"
|
|
14
|
+
@click="onShellClick"
|
|
15
|
+
>
|
|
16
|
+
<span class="flex h-full w-full flex-col gap-[var(--ads-feature-gap)]">
|
|
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
|
+
>
|
|
26
|
+
<span
|
|
27
|
+
class="grid size-[var(--ads-feature-icon-box)] shrink-0 place-items-center rounded-[var(--ads-radius-sm)]"
|
|
28
|
+
:class="iconBoxClass"
|
|
29
|
+
>
|
|
30
|
+
<UIcon :name="icon" class="size-5" />
|
|
31
|
+
</span>
|
|
32
|
+
<span class="min-w-0 flex-1">
|
|
33
|
+
<span class="block text-[length:var(--ads-feature-title-size)] font-bold leading-[1.3]" :class="titleClass">
|
|
34
|
+
{{ title }}
|
|
35
|
+
</span>
|
|
36
|
+
<AdsTooltip
|
|
37
|
+
:description="description"
|
|
38
|
+
:show-title="false"
|
|
39
|
+
:disabled="!isDescriptionTruncated"
|
|
40
|
+
align="start"
|
|
41
|
+
>
|
|
42
|
+
<span
|
|
43
|
+
ref="descriptionEl"
|
|
44
|
+
class="mt-1 block line-clamp-2 text-[length:var(--ads-feature-body-size)] leading-relaxed"
|
|
45
|
+
:class="descriptionClass"
|
|
46
|
+
>
|
|
47
|
+
{{ description }}
|
|
48
|
+
</span>
|
|
49
|
+
</AdsTooltip>
|
|
50
|
+
</span>
|
|
51
|
+
<UIcon
|
|
52
|
+
v-if="!disabled"
|
|
53
|
+
name="i-lucide-arrow-right"
|
|
54
|
+
class="size-5 shrink-0 text-[var(--ads-border-icon-support)] transition-colors duration-150 ease-out"
|
|
55
|
+
:class="accentHoverClass"
|
|
56
|
+
/>
|
|
57
|
+
</component>
|
|
58
|
+
|
|
59
|
+
<AdsPill
|
|
60
|
+
v-if="disabled"
|
|
61
|
+
class="mt-auto self-start"
|
|
62
|
+
tone="secondary"
|
|
63
|
+
status="blocked"
|
|
64
|
+
label="Em breve"
|
|
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>
|
|
80
|
+
<span v-else-if="hasFooter" class="mt-auto flex flex-wrap items-center gap-2">
|
|
81
|
+
<AdsPill
|
|
82
|
+
v-for="badge in badges"
|
|
83
|
+
:key="badge.label"
|
|
84
|
+
:tone="badge.tone ?? 'secondary'"
|
|
85
|
+
:status="badge.status ?? 'default'"
|
|
86
|
+
:label="badge.label"
|
|
87
|
+
/>
|
|
88
|
+
<span
|
|
89
|
+
v-if="footerText"
|
|
90
|
+
class="inline-flex items-center gap-1 text-xs text-[var(--ads-text-secondary)]"
|
|
91
|
+
>
|
|
92
|
+
<UIcon v-if="footerIcon" :name="footerIcon" class="size-3.5" />
|
|
93
|
+
{{ footerText }}
|
|
94
|
+
</span>
|
|
95
|
+
</span>
|
|
96
|
+
</span>
|
|
97
|
+
</AdsCard>
|
|
98
|
+
</template>
|
|
99
|
+
|
|
100
|
+
<script setup lang="ts">
|
|
101
|
+
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
|
102
|
+
import type { RouteLocationRaw } from "vue-router";
|
|
103
|
+
import { useResizeObserver } from "@vueuse/core";
|
|
104
|
+
import { NuxtLink } from "#components";
|
|
105
|
+
import AdsCard from "./AdsCard.vue";
|
|
106
|
+
import AdsPill from "./AdsPill.vue";
|
|
107
|
+
import type { AdsPillStatus, AdsPillTone } from "./AdsPill.vue";
|
|
108
|
+
import AdsTooltip from "./AdsTooltip.vue";
|
|
109
|
+
|
|
110
|
+
export interface AdsFeatureCardBadge {
|
|
111
|
+
label: string;
|
|
112
|
+
tone?: AdsPillTone;
|
|
113
|
+
status?: AdsPillStatus;
|
|
114
|
+
}
|
|
115
|
+
|
|
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
|
+
*/
|
|
128
|
+
export type AdsFeatureCardColor =
|
|
129
|
+
| "primary"
|
|
130
|
+
| "success"
|
|
131
|
+
| "attention"
|
|
132
|
+
| "warning"
|
|
133
|
+
| "new"
|
|
134
|
+
| "blocked"
|
|
135
|
+
| "ai";
|
|
136
|
+
|
|
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)" },
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
const props = withDefaults(
|
|
150
|
+
defineProps<{
|
|
151
|
+
title: string;
|
|
152
|
+
description: string;
|
|
153
|
+
icon: string;
|
|
154
|
+
/** Cor da pílula. No hover, título e seta usam essa cor e o fundo da pílula escurece. */
|
|
155
|
+
color?: AdsFeatureCardColor;
|
|
156
|
+
/** Vira link. Sem valor, continua botão. */
|
|
157
|
+
to?: RouteLocationRaw;
|
|
158
|
+
disabled?: boolean;
|
|
159
|
+
/** Hover colore título e seta e escurece a pílula. false desliga. */
|
|
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[];
|
|
163
|
+
badges?: AdsFeatureCardBadge[];
|
|
164
|
+
footerIcon?: string;
|
|
165
|
+
footerText?: string;
|
|
166
|
+
}>(),
|
|
167
|
+
{
|
|
168
|
+
color: "primary",
|
|
169
|
+
to: undefined,
|
|
170
|
+
disabled: false,
|
|
171
|
+
hoverable: true,
|
|
172
|
+
actions: undefined,
|
|
173
|
+
badges: undefined,
|
|
174
|
+
footerIcon: undefined,
|
|
175
|
+
footerText: undefined,
|
|
176
|
+
},
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const emit = defineEmits<{
|
|
180
|
+
click: [event: MouseEvent];
|
|
181
|
+
action: [action: AdsFeatureCardAction, event: MouseEvent];
|
|
182
|
+
}>();
|
|
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
|
+
|
|
188
|
+
const hasFooter = computed(
|
|
189
|
+
() => (props.badges?.length ?? 0) > 0 || Boolean(props.footerText),
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
const descriptionEl = ref<HTMLElement | null>(null);
|
|
193
|
+
const isDescriptionTruncated = ref(false);
|
|
194
|
+
|
|
195
|
+
const syncDescriptionTruncation = () => {
|
|
196
|
+
const element = descriptionEl.value;
|
|
197
|
+
if (!element) {
|
|
198
|
+
isDescriptionTruncated.value = false;
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
isDescriptionTruncated.value = element.scrollHeight - element.clientHeight > 1;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
useResizeObserver(descriptionEl, syncDescriptionTruncation);
|
|
205
|
+
|
|
206
|
+
onMounted(() => {
|
|
207
|
+
void nextTick(syncDescriptionTruncation);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
watch(
|
|
211
|
+
() => props.description,
|
|
212
|
+
() => {
|
|
213
|
+
void nextTick(syncDescriptionTruncation);
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
/** O link não tem disabled nativo: sai da ordem do Tab e avisa por aria-disabled. */
|
|
218
|
+
const interactiveAttrs = computed(() =>
|
|
219
|
+
props.to
|
|
220
|
+
? { to: props.to, tabindex: props.disabled ? -1 : undefined, "aria-disabled": props.disabled || undefined }
|
|
221
|
+
: {},
|
|
222
|
+
);
|
|
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
|
+
|
|
236
|
+
/**
|
|
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.
|
|
239
|
+
*/
|
|
240
|
+
const cardStyle = computed(() => ({
|
|
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)",
|
|
245
|
+
}));
|
|
246
|
+
|
|
247
|
+
const iconBoxClass = computed(() =>
|
|
248
|
+
props.disabled
|
|
249
|
+
? "bg-[var(--ads-button-secondary-disabled)] text-[var(--ads-text-tertiary)]"
|
|
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
|
+
],
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
const titleClass = computed(() =>
|
|
259
|
+
props.disabled
|
|
260
|
+
? "text-[var(--ads-text-tertiary)]"
|
|
261
|
+
: ["text-[var(--ads-feature-title)] transition-colors duration-150 ease-out", accentHoverClass.value],
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
const descriptionClass = computed(() =>
|
|
265
|
+
props.disabled ? "text-[var(--ads-text-tertiary)]" : "text-[var(--ads-feature-body)]",
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
const onClick = (event: MouseEvent) => {
|
|
269
|
+
if (!props.disabled) {
|
|
270
|
+
emit("click", event);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
event.preventDefault();
|
|
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
|
+
};
|
|
292
|
+
</script>
|