ads-nuxt 0.5.1 → 0.6.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 +3 -3
- package/app/assets/css/component-tokens.css +1 -1
- package/app/assets/css/main.css +34 -0
- package/app/components/AdsBroadcast.vue +6 -6
- package/app/components/AdsCard.vue +76 -18
- package/app/components/AdsCardPeriod.vue +16 -14
- package/app/components/AdsCheckbox.vue +2 -1
- package/app/components/AdsFeatureCard.vue +8 -7
- package/app/components/AdsModal.vue +18 -9
- package/app/components/AdsNavbarDesk.vue +1 -1
- package/app/components/AdsNotabilityPill.vue +18 -9
- package/app/components/AdsPill.vue +58 -30
- package/app/components/AdsSegmentedTabs.vue +55 -11
- package/app/components/AdsSelect.vue +2 -2
- package/app/components/AdsSelectItem.vue +3 -3
- package/app/components/AdsSideMenu.vue +2 -2
- package/app/components/AdsStepper.vue +64 -9
- package/app/components/AdsTable.vue +2 -0
- package/app/components/AdsTabs.vue +21 -1
- package/app/components/AdsToast.vue +54 -37
- package/app/components/ads-tab-scroll.ts +44 -0
- package/app/theme/ads-theme.ts +8 -7
- package/app/theme/component-tokens.ts +4 -4
- package/app/utils/notability.ts +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** Rola só o ancestral da faixa. Para no limite do componente para não mover a página. */
|
|
2
|
+
function scrollParent(el: HTMLElement, boundary: HTMLElement): HTMLElement | null {
|
|
3
|
+
let node = el.parentElement;
|
|
4
|
+
while (node) {
|
|
5
|
+
const overflow = getComputedStyle(node).overflowX;
|
|
6
|
+
if (overflow === "auto" || overflow === "scroll") return node;
|
|
7
|
+
if (node === boundary) return null;
|
|
8
|
+
node = node.parentElement;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Traz a aba ativa para a área visível quando a faixa está rolando. */
|
|
14
|
+
export function revealActiveTab(scope: HTMLElement | null | undefined) {
|
|
15
|
+
if (!scope) return;
|
|
16
|
+
const active = scope.querySelector<HTMLElement>('[role="tab"][data-state="active"]');
|
|
17
|
+
if (!active) return;
|
|
18
|
+
const scroller = scrollParent(active, scope);
|
|
19
|
+
if (!scroller) return;
|
|
20
|
+
|
|
21
|
+
const scrollerBox = scroller.getBoundingClientRect();
|
|
22
|
+
const tabBox = active.getBoundingClientRect();
|
|
23
|
+
const styles = getComputedStyle(scroller);
|
|
24
|
+
const left = scrollerBox.left + (Number.parseFloat(styles.paddingLeft) || 0);
|
|
25
|
+
const right = scrollerBox.right - (Number.parseFloat(styles.paddingRight) || 0);
|
|
26
|
+
|
|
27
|
+
if (tabBox.left < left) scroller.scrollLeft -= left - tabBox.left;
|
|
28
|
+
else if (tabBox.right > right) scroller.scrollLeft += tabBox.right - right;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Com a barra escondida, a roda do mouse em cima da faixa rola as abas.
|
|
33
|
+
* Se a faixa cabe, o evento segue para a página.
|
|
34
|
+
*/
|
|
35
|
+
export function bindTabWheel(el: HTMLElement) {
|
|
36
|
+
const onWheel = (event: WheelEvent) => {
|
|
37
|
+
if (el.scrollWidth <= el.clientWidth) return;
|
|
38
|
+
if (event.shiftKey || Math.abs(event.deltaX) > Math.abs(event.deltaY)) return;
|
|
39
|
+
el.scrollLeft += event.deltaY;
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
};
|
|
42
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
43
|
+
return () => el.removeEventListener("wheel", onWheel);
|
|
44
|
+
}
|
package/app/theme/ads-theme.ts
CHANGED
|
@@ -155,13 +155,14 @@ export const adsInputDateTheme = {
|
|
|
155
155
|
* Tabs link ADS.
|
|
156
156
|
* Lista 39px, itens no tamanho do texto, faixa inferior 1px #C1C7D0.
|
|
157
157
|
* Inativo: Inter 14 medium, #505F79. Ativo: bold, #061938, risco 4px #006FF7.
|
|
158
|
+
* A linha é sombra interna: a lista rola na horizontal e o risco de 4px fica dentro dela.
|
|
158
159
|
*/
|
|
159
160
|
export const adsLinkTabsUi = {
|
|
160
|
-
root: "items-start",
|
|
161
|
-
list: "h-[var(--ads-tabs-height)] w-full items-start self-stretch
|
|
161
|
+
root: "w-full min-w-0 items-start",
|
|
162
|
+
list: "h-[var(--ads-tabs-height)] w-full min-w-0 items-start self-stretch overflow-x-auto overscroll-x-contain !mb-0 !border-0 py-0 px-0 shadow-[inset_0_-1px_0_var(--ads-tabs-border)] [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",
|
|
162
163
|
trigger:
|
|
163
|
-
"h-[var(--ads-tabs-height)] grow-0 px-[var(--ads-tabs-padding-x)] py-0 text-[length:var(--ads-tabs-font-size)] [font-weight:var(--ads-tabs-weight)] leading-[1.3] text-[var(--ads-tabs-inactive)] data-[state=inactive]:text-[var(--ads-tabs-inactive)] data-[state=active]:font-bold data-[state=active]:text-[var(--ads-tabs-active)]",
|
|
164
|
-
indicator: "
|
|
164
|
+
"h-[var(--ads-tabs-height)] shrink-0 grow-0 px-[var(--ads-tabs-padding-x)] py-0 text-[length:var(--ads-tabs-font-size)] [font-weight:var(--ads-tabs-weight)] leading-[1.3] text-[var(--ads-tabs-inactive)] data-[state=inactive]:text-[var(--ads-tabs-inactive)] data-[state=active]:font-bold data-[state=active]:text-[var(--ads-tabs-active)] focus-visible:-outline-offset-3",
|
|
165
|
+
indicator: "!bottom-0 h-[var(--ads-tabs-indicator)] rounded-none bg-[var(--ads-tabs-indicator-color)]",
|
|
165
166
|
} as const;
|
|
166
167
|
|
|
167
168
|
/**
|
|
@@ -172,13 +173,13 @@ export const adsLinkTabsUi = {
|
|
|
172
173
|
* Ícone opcional de 24px à esquerda; subtítulo opcional em 12 regular secundário, abaixo do rótulo.
|
|
173
174
|
*/
|
|
174
175
|
export const adsSegmentedTabsUi = {
|
|
175
|
-
root: "
|
|
176
|
+
root: "w-max max-w-none shrink-0",
|
|
176
177
|
// Altura mínima do Figma; com ícone ou subtítulo, a aba cresce (8px em cima e embaixo).
|
|
177
|
-
list: "!h-auto !min-h-[var(--ads-segmented-height)] !w-
|
|
178
|
+
list: "!h-auto !min-h-[var(--ads-segmented-height)] !w-max !self-start !items-stretch !gap-1 !rounded-[var(--ads-segmented-radius)] !border-0 !bg-[var(--ads-segmented-track)] !p-1",
|
|
178
179
|
leadingIcon: "!size-6 shrink-0",
|
|
179
180
|
label: "flex flex-col items-start gap-0.5 text-left whitespace-nowrap",
|
|
180
181
|
trigger:
|
|
181
|
-
"!h-auto !min-h-[var(--ads-segmented-item-height)] !grow-0 !gap-3 !rounded-[var(--ads-segmented-radius)] !px-[var(--ads-segmented-padding-x)] !py-2 !text-[length:var(--ads-segmented-font-size)] !font-normal !leading-[var(--ads-line-height-sm)] !text-[var(--ads-segmented-text)] data-[state=inactive]:!text-[var(--ads-segmented-text)] data-[state=active]:!font-bold data-[state=active]:!text-[var(--ads-segmented-active-text)]",
|
|
182
|
+
"!h-auto !min-h-[var(--ads-segmented-item-height)] !shrink-0 !grow-0 !gap-3 !rounded-[var(--ads-segmented-radius)] !px-[var(--ads-segmented-padding-x)] !py-2 !text-[length:var(--ads-segmented-font-size)] !font-normal !leading-[var(--ads-line-height-sm)] !text-[var(--ads-segmented-text)] data-[state=inactive]:!text-[var(--ads-segmented-text)] data-[state=active]:!font-bold data-[state=active]:!text-[var(--ads-segmented-active-text)]",
|
|
182
183
|
indicator:
|
|
183
184
|
"!rounded-[var(--ads-segmented-radius)] !bg-[var(--ads-segmented-active-bg)] !shadow-[var(--ads-shadow-level-1)]",
|
|
184
185
|
} as const;
|
|
@@ -408,12 +408,12 @@ export const componentTokenCatalog: readonly TokenComponent[] = [
|
|
|
408
408
|
section: "notabilidade",
|
|
409
409
|
catalog: "notability-pill",
|
|
410
410
|
label: "Pill de notabilidade",
|
|
411
|
-
note: "
|
|
411
|
+
note: "Texto 14 bold e padding vertical quark. Imagem usa status/new. Tráfego usa chart data 4/100 a 80%. Lucro usa innovation/100 a 70%.",
|
|
412
412
|
fields: [
|
|
413
|
-
length("--ads-notability-height", "Altura", "Medida", "24px"),
|
|
413
|
+
length("--ads-notability-height", "Altura mínima", "Medida", "24px"),
|
|
414
414
|
length("--ads-notability-min-width", "Largura mínima", "Medida", "100px"),
|
|
415
415
|
length("--ads-notability-padding-x", "Padding horizontal", "Medida", "8px"),
|
|
416
|
-
length("--ads-notability-font-size", "Fonte", "Medida", "
|
|
416
|
+
length("--ads-notability-font-size", "Fonte", "Medida", "14px"),
|
|
417
417
|
weight("--ads-notability-weight", "Peso", "Medida", "700"),
|
|
418
418
|
],
|
|
419
419
|
},
|
|
@@ -422,7 +422,7 @@ export const componentTokenCatalog: readonly TokenComponent[] = [
|
|
|
422
422
|
section: "broadcast",
|
|
423
423
|
catalog: "pill",
|
|
424
424
|
label: "Pill broadcast",
|
|
425
|
-
note: "
|
|
425
|
+
note: "AdsPill com broadcast. O AdsBroadcast é um atalho para ela.",
|
|
426
426
|
fields: [
|
|
427
427
|
length("--ads-broadcast-height", "Altura", "Medida", "24px"),
|
|
428
428
|
length("--ads-broadcast-padding-x", "Padding horizontal", "Medida", "8px"),
|
package/app/utils/notability.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const NOTABILITY_LABELS: Record<string, string> = {
|
|
2
|
-
traffic: "
|
|
3
|
-
image: "
|
|
4
|
-
profit: "
|
|
2
|
+
traffic: "Geradores de Tráfego",
|
|
3
|
+
image: "Formadores de Imagem",
|
|
4
|
+
profit: "Geradores de Lucro",
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export const formatNotability = (notability: string): string =>
|