@fluencypassdevs/pulse 0.1.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.
- package/dist/buttons/cta-brand.d.ts +39 -0
- package/dist/buttons/cta-brand.js +8 -0
- package/dist/buttons/cta-brand.js.map +1 -0
- package/dist/buttons/index.d.ts +5 -0
- package/dist/buttons/index.js +10 -0
- package/dist/buttons/index.js.map +1 -0
- package/dist/buttons/link-brand.d.ts +39 -0
- package/dist/buttons/link-brand.js +6 -0
- package/dist/buttons/link-brand.js.map +1 -0
- package/dist/chunk-2NMEKWO5.js +35 -0
- package/dist/chunk-2NMEKWO5.js.map +1 -0
- package/dist/chunk-44ESRMDK.js +56 -0
- package/dist/chunk-44ESRMDK.js.map +1 -0
- package/dist/chunk-5OLUQZFV.js +27 -0
- package/dist/chunk-5OLUQZFV.js.map +1 -0
- package/dist/chunk-CHSR2ETD.js +24 -0
- package/dist/chunk-CHSR2ETD.js.map +1 -0
- package/dist/chunk-CNVIYLIS.js +3 -0
- package/dist/chunk-CNVIYLIS.js.map +1 -0
- package/dist/chunk-EFZL6LLI.js +3 -0
- package/dist/chunk-EFZL6LLI.js.map +1 -0
- package/dist/chunk-EQHE53IC.js +3 -0
- package/dist/chunk-EQHE53IC.js.map +1 -0
- package/dist/chunk-GQURTO6D.js +29 -0
- package/dist/chunk-GQURTO6D.js.map +1 -0
- package/dist/chunk-JK3UYOM2.js +49 -0
- package/dist/chunk-JK3UYOM2.js.map +1 -0
- package/dist/chunk-KIXWOUY4.js +82 -0
- package/dist/chunk-KIXWOUY4.js.map +1 -0
- package/dist/chunk-KWQHWZI7.js +74 -0
- package/dist/chunk-KWQHWZI7.js.map +1 -0
- package/dist/chunk-OHRYR7PN.js +37 -0
- package/dist/chunk-OHRYR7PN.js.map +1 -0
- package/dist/chunk-PGXSBSQT.js +57 -0
- package/dist/chunk-PGXSBSQT.js.map +1 -0
- package/dist/chunk-RSCKN557.js +29 -0
- package/dist/chunk-RSCKN557.js.map +1 -0
- package/dist/chunk-SDJ6HXPX.js +48 -0
- package/dist/chunk-SDJ6HXPX.js.map +1 -0
- package/dist/chunk-SDPIL7HA.js +65 -0
- package/dist/chunk-SDPIL7HA.js.map +1 -0
- package/dist/chunk-SGFTGHM5.js +3 -0
- package/dist/chunk-SGFTGHM5.js.map +1 -0
- package/dist/chunk-T7EIAVSF.js +18 -0
- package/dist/chunk-T7EIAVSF.js.map +1 -0
- package/dist/chunk-VNGGZL6V.js +105 -0
- package/dist/chunk-VNGGZL6V.js.map +1 -0
- package/dist/chunk-W4KJCBMW.js +11 -0
- package/dist/chunk-W4KJCBMW.js.map +1 -0
- package/dist/chunk-WVYPNZFL.js +77 -0
- package/dist/chunk-WVYPNZFL.js.map +1 -0
- package/dist/chunk-WZIXM2X2.js +55 -0
- package/dist/chunk-WZIXM2X2.js.map +1 -0
- package/dist/chunk-XGV5OIPX.js +33 -0
- package/dist/chunk-XGV5OIPX.js.map +1 -0
- package/dist/chunk-YVBHOWUJ.js +3 -0
- package/dist/chunk-YVBHOWUJ.js.map +1 -0
- package/dist/chunk-YYH3A42F.js +24 -0
- package/dist/chunk-YYH3A42F.js.map +1 -0
- package/dist/chunk-ZRJFO4OW.js +26 -0
- package/dist/chunk-ZRJFO4OW.js.map +1 -0
- package/dist/effects/card-dark-glow.d.ts +30 -0
- package/dist/effects/card-dark-glow.js +6 -0
- package/dist/effects/card-dark-glow.js.map +1 -0
- package/dist/effects/circle-glow.d.ts +26 -0
- package/dist/effects/circle-glow.js +6 -0
- package/dist/effects/circle-glow.js.map +1 -0
- package/dist/effects/hand-underline.d.ts +33 -0
- package/dist/effects/hand-underline.js +8 -0
- package/dist/effects/hand-underline.js.map +1 -0
- package/dist/effects/index.d.ts +7 -0
- package/dist/effects/index.js +14 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/effects/magnetic-button.d.ts +36 -0
- package/dist/effects/magnetic-button.js +7 -0
- package/dist/effects/magnetic-button.js.map +1 -0
- package/dist/effects/marquee.d.ts +30 -0
- package/dist/effects/marquee.js +6 -0
- package/dist/effects/marquee.js.map +1 -0
- package/dist/effects/rotating-word.d.ts +40 -0
- package/dist/effects/rotating-word.js +7 -0
- package/dist/effects/rotating-word.js.map +1 -0
- package/dist/hooks/use-intersection.d.ts +34 -0
- package/dist/hooks/use-intersection.js +5 -0
- package/dist/hooks/use-intersection.js.map +1 -0
- package/dist/hooks/use-reduced-motion.d.ts +11 -0
- package/dist/hooks/use-reduced-motion.js +5 -0
- package/dist/hooks/use-reduced-motion.js.map +1 -0
- package/dist/index.d.ts +887 -0
- package/dist/index.js +1640 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/index.d.ts +2 -0
- package/dist/layout/index.js +7 -0
- package/dist/layout/index.js.map +1 -0
- package/dist/layout/section.d.ts +36 -0
- package/dist/layout/section.js +6 -0
- package/dist/layout/section.js.map +1 -0
- package/dist/motion/animated-number.d.ts +35 -0
- package/dist/motion/animated-number.js +8 -0
- package/dist/motion/animated-number.js.map +1 -0
- package/dist/motion/index.d.ts +6 -0
- package/dist/motion/index.js +12 -0
- package/dist/motion/index.js.map +1 -0
- package/dist/motion/reveal-on-scroll.d.ts +27 -0
- package/dist/motion/reveal-on-scroll.js +8 -0
- package/dist/motion/reveal-on-scroll.js.map +1 -0
- package/dist/motion/smooth-anchor.d.ts +31 -0
- package/dist/motion/smooth-anchor.js +5 -0
- package/dist/motion/smooth-anchor.js.map +1 -0
- package/dist/motion/stagger-reveal.d.ts +30 -0
- package/dist/motion/stagger-reveal.js +8 -0
- package/dist/motion/stagger-reveal.js.map +1 -0
- package/dist/styles/foundation.css +79 -0
- package/dist/styles/styles.css +1221 -0
- package/dist/typography/hero-heading.d.ts +25 -0
- package/dist/typography/hero-heading.js +6 -0
- package/dist/typography/hero-heading.js.map +1 -0
- package/dist/typography/index.d.ts +5 -0
- package/dist/typography/index.js +10 -0
- package/dist/typography/index.js.map +1 -0
- package/dist/typography/section-eyebrow.d.ts +21 -0
- package/dist/typography/section-eyebrow.js +6 -0
- package/dist/typography/section-eyebrow.js.map +1 -0
- package/dist/typography/section-heading.d.ts +37 -0
- package/dist/typography/section-heading.js +6 -0
- package/dist/typography/section-heading.js.map +1 -0
- package/dist/typography/section-subtitle.d.ts +19 -0
- package/dist/typography/section-subtitle.js +6 -0
- package/dist/typography/section-subtitle.js.map +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useRef, useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
// src/hooks/use-intersection.ts
|
|
4
|
+
function useIntersection(options = {}) {
|
|
5
|
+
const {
|
|
6
|
+
threshold = 0.15,
|
|
7
|
+
rootMargin = "0px 0px -10% 0px",
|
|
8
|
+
root = null,
|
|
9
|
+
once = true,
|
|
10
|
+
startVisible = false
|
|
11
|
+
} = options;
|
|
12
|
+
const ref = useRef(null);
|
|
13
|
+
const [isVisible, setIsVisible] = useState(startVisible);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (startVisible) return;
|
|
16
|
+
const el = ref.current;
|
|
17
|
+
if (!el) return;
|
|
18
|
+
const observer = new IntersectionObserver(
|
|
19
|
+
([entry]) => {
|
|
20
|
+
if (entry == null ? void 0 : entry.isIntersecting) {
|
|
21
|
+
setIsVisible(true);
|
|
22
|
+
if (once) observer.disconnect();
|
|
23
|
+
} else if (!once) {
|
|
24
|
+
setIsVisible(false);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{ threshold, rootMargin, root }
|
|
28
|
+
);
|
|
29
|
+
observer.observe(el);
|
|
30
|
+
return () => observer.disconnect();
|
|
31
|
+
}, [threshold, rootMargin, root, once, startVisible]);
|
|
32
|
+
return { ref, isVisible };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { useIntersection };
|
|
36
|
+
//# sourceMappingURL=chunk-OHRYR7PN.js.map
|
|
37
|
+
//# sourceMappingURL=chunk-OHRYR7PN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-intersection.ts"],"names":[],"mappings":";;;AAiCO,SAAS,eAAA,CACd,OAAA,GAAkC,EAAC,EACqB;AACxD,EAAA,MAAM;AAAA,IACJ,SAAA,GAAY,IAAA;AAAA,IACZ,UAAA,GAAa,kBAAA;AAAA,IACb,IAAA,GAAO,IAAA;AAAA,IACP,IAAA,GAAO,IAAA;AAAA,IACP,YAAA,GAAe;AAAA,GACjB,GAAI,OAAA;AAEJ,EAAA,MAAM,GAAA,GAAM,OAAiB,IAAI,CAAA;AACjC,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,YAAY,CAAA;AAEvD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,YAAA,EAAc;AAClB,IAAA,MAAM,KAAK,GAAA,CAAI,OAAA;AACf,IAAA,IAAI,CAAC,EAAA,EAAI;AAET,IAAA,MAAM,WAAW,IAAI,oBAAA;AAAA,MACnB,CAAC,CAAC,KAAK,CAAA,KAAM;AACX,QAAA,IAAI,+BAAO,cAAA,EAAgB;AACzB,UAAA,YAAA,CAAa,IAAI,CAAA;AACjB,UAAA,IAAI,IAAA,WAAe,UAAA,EAAW;AAAA,QAChC,CAAA,MAAA,IAAW,CAAC,IAAA,EAAM;AAChB,UAAA,YAAA,CAAa,KAAK,CAAA;AAAA,QACpB;AAAA,MACF,CAAA;AAAA,MACA,EAAE,SAAA,EAAW,UAAA,EAAY,IAAA;AAAK,KAChC;AAEA,IAAA,QAAA,CAAS,QAAQ,EAAE,CAAA;AACnB,IAAA,OAAO,MAAM,SAAS,UAAA,EAAW;AAAA,EACnC,GAAG,CAAC,SAAA,EAAW,YAAY,IAAA,EAAM,IAAA,EAAM,YAAY,CAAC,CAAA;AAEpD,EAAA,OAAO,EAAE,KAAK,SAAA,EAAU;AAC1B","file":"chunk-OHRYR7PN.js","sourcesContent":["\"use client\"\n\nimport { useEffect, useRef, useState } from \"react\"\n\nexport interface UseIntersectionOptions {\n /** Quanto do elemento precisa estar visivel pra disparar (0-1). Default `0.15`. */\n threshold?: number\n /** Margin do viewport (CSS shorthand). Default `\"0px 0px -10% 0px\"`. */\n rootMargin?: string\n /** Container alternativo (default: viewport). */\n root?: Element | null\n /** Quando `true`, desliga o observer apos a primeira intersecao. Default `true`. */\n once?: boolean\n /**\n * Quando `true`, comeca como visivel (sem aguardar observer). Util quando\n * `useReducedMotion()` e true e queremos pular a animacao de entrada.\n */\n startVisible?: boolean\n}\n\n/**\n * Observa um elemento e retorna `{ ref, isVisible }`. Reusado por\n * `RevealOnScroll`, `StaggerReveal` e `AnimatedNumber`.\n *\n * Comportamento:\n * - SSR-safe (so monta IntersectionObserver no client).\n * - `once=true` (default) desconecta o observer apos a primeira intersecao.\n * - `startVisible=true` ja entrega `isVisible: true` no primeiro render.\n *\n * @example\n * const { ref, isVisible } = useIntersection({ threshold: 0.4 })\n * return <div ref={ref}>{isVisible ? \"visible\" : \"hidden\"}</div>\n */\nexport function useIntersection<T extends HTMLElement = HTMLDivElement>(\n options: UseIntersectionOptions = {}\n): { ref: React.RefObject<T | null>; isVisible: boolean } {\n const {\n threshold = 0.15,\n rootMargin = \"0px 0px -10% 0px\",\n root = null,\n once = true,\n startVisible = false,\n } = options\n\n const ref = useRef<T | null>(null)\n const [isVisible, setIsVisible] = useState(startVisible)\n\n useEffect(() => {\n if (startVisible) return\n const el = ref.current\n if (!el) return\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry?.isIntersecting) {\n setIsVisible(true)\n if (once) observer.disconnect()\n } else if (!once) {\n setIsVisible(false)\n }\n },\n { threshold, rootMargin, root }\n )\n\n observer.observe(el)\n return () => observer.disconnect()\n }, [threshold, rootMargin, root, once, startVisible])\n\n return { ref, isVisible }\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useIntersection } from './chunk-OHRYR7PN.js';
|
|
2
|
+
import { useReducedMotion } from './chunk-T7EIAVSF.js';
|
|
3
|
+
import { cn } from './chunk-W4KJCBMW.js';
|
|
4
|
+
import { __objRest, __spreadProps, __spreadValues } from './chunk-2NMEKWO5.js';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function StaggerReveal(_a) {
|
|
9
|
+
var _b = _a, {
|
|
10
|
+
step = 100,
|
|
11
|
+
threshold = 0.15,
|
|
12
|
+
rootMargin = "0px 0px -10% 0px",
|
|
13
|
+
className,
|
|
14
|
+
children
|
|
15
|
+
} = _b, props = __objRest(_b, [
|
|
16
|
+
"step",
|
|
17
|
+
"threshold",
|
|
18
|
+
"rootMargin",
|
|
19
|
+
"className",
|
|
20
|
+
"children"
|
|
21
|
+
]);
|
|
22
|
+
const reduced = useReducedMotion();
|
|
23
|
+
const { ref, isVisible } = useIntersection({
|
|
24
|
+
threshold,
|
|
25
|
+
rootMargin,
|
|
26
|
+
startVisible: reduced
|
|
27
|
+
});
|
|
28
|
+
const enhanced = React.Children.map(children, (child, i) => {
|
|
29
|
+
var _a2, _b2;
|
|
30
|
+
if (!React.isValidElement(child)) return child;
|
|
31
|
+
const element = child;
|
|
32
|
+
const childClassName = (_a2 = element.props.className) != null ? _a2 : "";
|
|
33
|
+
const childStyle = (_b2 = element.props.style) != null ? _b2 : {};
|
|
34
|
+
return React.cloneElement(element, {
|
|
35
|
+
className: cn(childClassName, "stagger-child"),
|
|
36
|
+
style: __spreadProps(__spreadValues({}, childStyle), {
|
|
37
|
+
// `--stagger-index` e usada por .stagger-revealed .stagger-child no CSS.
|
|
38
|
+
// `--stagger-step-ms` permite override do espacamento por instancia.
|
|
39
|
+
["--stagger-index"]: i,
|
|
40
|
+
["--stagger-step-ms"]: `${step}ms`
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
"div",
|
|
46
|
+
__spreadProps(__spreadValues({
|
|
47
|
+
ref,
|
|
48
|
+
className: cn(isVisible && "stagger-revealed", className)
|
|
49
|
+
}, props), {
|
|
50
|
+
children: enhanced
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { StaggerReveal };
|
|
56
|
+
//# sourceMappingURL=chunk-PGXSBSQT.js.map
|
|
57
|
+
//# sourceMappingURL=chunk-PGXSBSQT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/marketing/motion/stagger-reveal.tsx"],"names":["_a","_b"],"mappings":";;;;;;;AAiCA,SAAS,cAAc,EAAA,EAOA;AAPA,EAAA,IAAA,EAAA,GAAA,EAAA,EACrB;AAAA,IAAA,IAAA,GAAO,GAAA;AAAA,IACP,SAAA,GAAY,IAAA;AAAA,IACZ,UAAA,GAAa,kBAAA;AAAA,IACb,SAAA;AAAA,IACA;AAAA,GAtCF,GAiCuB,EAAA,EAMlB,KAAA,GAAA,SAAA,CANkB,EAAA,EAMlB;AAAA,IALH,MAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GAAA,CAAA;AAGA,EAAA,MAAM,UAAU,gBAAA,EAAiB;AACjC,EAAA,MAAM,EAAE,GAAA,EAAK,SAAA,EAAU,GAAI,eAAA,CAAgC;AAAA,IACzD,SAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA,EAAc;AAAA,GACf,CAAA;AAED,EAAA,MAAM,WAAiB,KAAA,CAAA,QAAA,CAAS,GAAA,CAAI,QAAA,EAAU,CAAC,OAAO,CAAA,KAAM;AAhD9D,IAAA,IAAAA,GAAAA,EAAAC,GAAAA;AAiDI,IAAA,IAAI,CAAO,KAAA,CAAA,cAAA,CAAe,KAAK,CAAA,EAAG,OAAO,KAAA;AAEzC,IAAA,MAAM,OAAA,GAAU,KAAA;AAChB,IAAA,MAAM,kBAAiBD,GAAAA,GAAA,OAAA,CAAQ,KAAA,CAAM,SAAA,KAAd,OAAAA,GAAAA,GAA2B,EAAA;AAClD,IAAA,MAAM,cAAkCC,GAAAA,GAAA,OAAA,CAAQ,MAAM,KAAA,KAAd,IAAA,GAAAA,MAAuB,EAAC;AAChE,IAAA,OAAa,mBAAa,OAAA,EAAS;AAAA,MACjC,SAAA,EAAW,EAAA,CAAG,cAAA,EAAgB,eAAe,CAAA;AAAA,MAC7C,KAAA,EAAO,iCACF,UAAA,CAAA,EADE;AAAA;AAAA;AAAA,QAIL,CAAC,iBAA2B,GAAG,CAAA;AAAA,QAC/B,CAAC,mBAA6B,GAAG,CAAA,EAAG,IAAI,CAAA,EAAA;AAAA,OAC1C;AAAA,KACD,CAAA;AAAA,EACH,CAAC,CAAA;AAED,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA,aAAA,CAAA,cAAA,CAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAAA,CAAG,SAAA,IAAa,kBAAA,EAAoB,SAAS;AAAA,KAAA,EACpD,KAAA,CAAA,EAHL;AAAA,MAKE,QAAA,EAAA;AAAA,KAAA;AAAA,GACH;AAEJ","file":"chunk-PGXSBSQT.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@core/lib/utils\"\nimport { useIntersection } from \"@pulse/hooks/use-intersection\"\nimport { useReducedMotion } from \"@pulse/hooks/use-reduced-motion\"\n\nexport interface StaggerRevealProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Delay entre cada filho em ms. Default `100`. */\n step?: number\n /** Fracao do container que precisa estar visivel pra disparar. Default `0.15`. */\n threshold?: number\n /** Margin do viewport (CSS shorthand). Default `\"0px 0px -10% 0px\"`. */\n rootMargin?: string\n}\n\n/**\n * Container que anima seus filhos entrando em sequencia (fade-up com delay\n * incremental). Clona cada filho valido e injeta `--stagger-index` como CSS\n * variable; a animacao acontece via `.stagger-child` em `globals.css`.\n *\n * O `step` (default 100ms) controla o espacamento entre cada filho:\n * - 1o filho: delay 0\n * - 2o filho: delay 100ms\n * - 3o filho: delay 200ms ...\n *\n * Note que o `step` so afeta visualmente quando o CSS usa\n * `calc(var(--stagger-index) * Xms)` — atualmente o globals usa `100ms`\n * fixo (o step prop sobrescreve via inline style se necessario).\n *\n * Acessibilidade: respeita `prefers-reduced-motion` — filhos ja entram visiveis.\n */\nfunction StaggerReveal({\n step = 100,\n threshold = 0.15,\n rootMargin = \"0px 0px -10% 0px\",\n className,\n children,\n ...props\n}: StaggerRevealProps) {\n const reduced = useReducedMotion()\n const { ref, isVisible } = useIntersection<HTMLDivElement>({\n threshold,\n rootMargin,\n startVisible: reduced,\n })\n\n const enhanced = React.Children.map(children, (child, i) => {\n if (!React.isValidElement(child)) return child\n type ChildProps = { className?: string; style?: React.CSSProperties }\n const element = child as React.ReactElement<ChildProps>\n const childClassName = element.props.className ?? \"\"\n const childStyle: React.CSSProperties = element.props.style ?? {}\n return React.cloneElement(element, {\n className: cn(childClassName, \"stagger-child\"),\n style: {\n ...childStyle,\n // `--stagger-index` e usada por .stagger-revealed .stagger-child no CSS.\n // `--stagger-step-ms` permite override do espacamento por instancia.\n [\"--stagger-index\" as string]: i,\n [\"--stagger-step-ms\" as string]: `${step}ms`,\n },\n })\n })\n\n return (\n <div\n ref={ref}\n className={cn(isVisible && \"stagger-revealed\", className)}\n {...props}\n >\n {enhanced}\n </div>\n )\n}\n\nexport { StaggerReveal }\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cn } from './chunk-W4KJCBMW.js';
|
|
2
|
+
import { __objRest, __spreadValues } from './chunk-2NMEKWO5.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var SectionHeading = React.forwardRef(
|
|
7
|
+
function SectionHeading2(_a, ref) {
|
|
8
|
+
var _b = _a, { as = "h2", weight = "light", align = "center", maxW = "wide", className } = _b, props = __objRest(_b, ["as", "weight", "align", "maxW", "className"]);
|
|
9
|
+
const Tag = as;
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
Tag,
|
|
12
|
+
__spreadValues({
|
|
13
|
+
ref,
|
|
14
|
+
"data-slot": "section-heading",
|
|
15
|
+
className: cn(
|
|
16
|
+
"text-4xl sm:text-5xl md:text-6xl tracking-tight leading-[1.15] text-balance",
|
|
17
|
+
weight === "light" ? "font-light" : "font-bold",
|
|
18
|
+
maxW === "wide" ? "max-w-5xl" : "max-w-3xl",
|
|
19
|
+
align === "center" ? "text-center mx-auto" : "text-left",
|
|
20
|
+
className
|
|
21
|
+
)
|
|
22
|
+
}, props)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export { SectionHeading };
|
|
28
|
+
//# sourceMappingURL=chunk-RSCKN557.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-RSCKN557.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/marketing/typography/section-heading.tsx"],"names":["SectionHeading"],"mappings":";;;;;AAuCA,IAAM,cAAA,GAAuB,KAAA,CAAA,UAAA;AAAA,EAC3B,SAASA,eAAAA,CACP,EAAA,EACA,GAAA,EACA;AAFA,IAAA,IAAA,EAAA,GAAA,EAAA,EAAE,OAAK,IAAA,EAAM,MAAA,GAAS,OAAA,EAAS,KAAA,GAAQ,UAAU,IAAA,GAAO,MAAA,EAAQ,SAAA,EAzCpE,GAyCI,IAA8E,KAAA,GAAA,SAAA,CAA9E,EAAA,EAA8E,CAA5E,IAAA,EAAW,QAAA,EAAkB,SAAkB,MAAA,EAAe,WAAA,CAAA,CAAA;AAGhE,IAAA,MAAM,GAAA,GAAM,EAAA;AACZ,IAAA,uBACE,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA,cAAA,CAAA;AAAA,QACC,GAAA;AAAA,QACA,WAAA,EAAU,iBAAA;AAAA,QACV,SAAA,EAAW,EAAA;AAAA,UACT,6EAAA;AAAA,UACA,MAAA,KAAW,UAAU,YAAA,GAAe,WAAA;AAAA,UACpC,IAAA,KAAS,SAAS,WAAA,GAAc,WAAA;AAAA,UAChC,KAAA,KAAU,WAAW,qBAAA,GAAwB,WAAA;AAAA,UAC7C;AAAA;AACF,OAAA,EACI,KAAA;AAAA,KACN;AAAA,EAEJ;AACF","file":"chunk-RSCKN557.js","sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@core/lib/utils\"\n\ntype SectionHeadingTag = \"h2\" | \"h3\"\n\nexport interface SectionHeadingProps\n extends Omit<React.HTMLAttributes<HTMLHeadingElement>, \"color\"> {\n /** Tag renderizada. Default `\"h2\"`. */\n as?: SectionHeadingTag\n /**\n * Peso/intencao visual:\n * - `\"light\"` (default): `font-light` — elegante, usual em maioria das dobras.\n * - `\"bold\"`: `font-bold` — impacto, usado em momentos de virada (quebra).\n */\n weight?: \"light\" | \"bold\"\n /** Alinhamento. Default `\"center\"`. */\n align?: \"left\" | \"center\"\n /**\n * Largura maxima do bloco de texto:\n * - `\"wide\"` (default): `max-w-5xl` — usual centro/elegante.\n * - `\"prose\"`: `max-w-3xl` — quando o titulo e mais conciso.\n */\n maxW?: \"wide\" | \"prose\"\n}\n\n/**\n * Titulo de dobra de landing. Dois pesos principais (`light` elegante vs `bold`\n * impacto). Pareie com `SectionEyebrow` acima e `SectionSubtitle` abaixo.\n *\n * @example\n * <SectionHeading>\n * Conteudo, professores e <strong>tecnologia</strong> no mesmo lugar\n * </SectionHeading>\n *\n * <SectionHeading weight=\"bold\" align=\"left\" maxW=\"prose\">\n * Mude o jeito de aprender ingles\n * </SectionHeading>\n */\nconst SectionHeading = React.forwardRef<HTMLHeadingElement, SectionHeadingProps>(\n function SectionHeading(\n { as = \"h2\", weight = \"light\", align = \"center\", maxW = \"wide\", className, ...props },\n ref\n ) {\n const Tag = as as React.ElementType\n return (\n <Tag\n ref={ref}\n data-slot=\"section-heading\"\n className={cn(\n \"text-4xl sm:text-5xl md:text-6xl tracking-tight leading-[1.15] text-balance\",\n weight === \"light\" ? \"font-light\" : \"font-bold\",\n maxW === \"wide\" ? \"max-w-5xl\" : \"max-w-3xl\",\n align === \"center\" ? \"text-center mx-auto\" : \"text-left\",\n className\n )}\n {...props}\n />\n )\n }\n)\n\nexport { SectionHeading }\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { cn } from './chunk-W4KJCBMW.js';
|
|
2
|
+
import { __objRest, __spreadProps, __spreadValues } from './chunk-2NMEKWO5.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var BASE_CLASSES = [
|
|
7
|
+
"text-[color:var(--brand-default)]",
|
|
8
|
+
"hover:text-[color:var(--brand-dark)]",
|
|
9
|
+
"underline-offset-4 transition-colors",
|
|
10
|
+
"outline-none focus-visible:outline-2 focus-visible:outline-offset-2",
|
|
11
|
+
"focus-visible:outline-[color:var(--brand-default)] rounded-sm"
|
|
12
|
+
].join(" ");
|
|
13
|
+
var LinkBrand = React.forwardRef(
|
|
14
|
+
function LinkBrand2(props, ref) {
|
|
15
|
+
if (props.as === "button") {
|
|
16
|
+
const _a = props, { as: _as, className: className2, children: children2 } = _a, rest2 = __objRest(_a, ["as", "className", "children"]);
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
"button",
|
|
19
|
+
__spreadProps(__spreadValues({
|
|
20
|
+
ref,
|
|
21
|
+
type: "button",
|
|
22
|
+
"data-slot": "link-brand",
|
|
23
|
+
className: cn(BASE_CLASSES, className2)
|
|
24
|
+
}, rest2), {
|
|
25
|
+
children: children2
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
const _b = props, { href, external = false, className, children } = _b, rest = __objRest(_b, ["href", "external", "className", "children"]);
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"a",
|
|
32
|
+
__spreadProps(__spreadValues({
|
|
33
|
+
ref,
|
|
34
|
+
href,
|
|
35
|
+
target: external ? "_blank" : void 0,
|
|
36
|
+
rel: external ? "noopener noreferrer" : void 0,
|
|
37
|
+
"data-slot": "link-brand",
|
|
38
|
+
className: cn(BASE_CLASSES, className)
|
|
39
|
+
}, rest), {
|
|
40
|
+
children
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export { LinkBrand };
|
|
47
|
+
//# sourceMappingURL=chunk-SDJ6HXPX.js.map
|
|
48
|
+
//# sourceMappingURL=chunk-SDJ6HXPX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/marketing/buttons/link-brand.tsx"],"names":["LinkBrand","className","children","rest"],"mappings":";;;;;AAMA,IAAM,YAAA,GAAe;AAAA,EACnB,mCAAA;AAAA,EACA,sCAAA;AAAA,EACA,sCAAA;AAAA,EACA,qEAAA;AAAA,EACA;AACF,CAAA,CAAE,KAAK,GAAG,CAAA;AAuCV,IAAM,SAAA,GAAkB,KAAA,CAAA,UAAA;AAAA,EACtB,SAASA,UAAAA,CAAU,KAAA,EAAO,GAAA,EAAK;AAC7B,IAAA,IAAI,KAAA,CAAM,OAAO,QAAA,EAAU;AACzB,MAAA,MAAkD,EAAA,GAAA,KAAA,EAA1C,EAAA,EAAA,EAAI,GAAA,EAAK,SAAA,EAAAC,YAAW,QAAA,EAAAC,SAAAA,EAtDlC,GAsDwD,EAAA,EAATC,KAAAA,GAAA,SAAA,CAAS,EAAA,EAAT,CAAjC,MAAS,WAAA,EAAW,UAAA,CAAA,CAAA;AAC5B,MAAA,uBACE,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA,aAAA,CAAA,cAAA,CAAA;AAAA,UACC,GAAA;AAAA,UACA,IAAA,EAAK,QAAA;AAAA,UACL,WAAA,EAAU,YAAA;AAAA,UACV,SAAA,EAAW,EAAA,CAAG,YAAA,EAAcF,UAAS;AAAA,SAAA,EACjCE,KAAAA,CAAAA,EALL;AAAA,UAOE,QAAA,EAAAD;AAAA,SAAA;AAAA,OACH;AAAA,IAEJ;AAEA,IAAA,MAAiE,EAAA,GAAA,KAAA,EAAzD,EAAA,IAAA,EAAM,QAAA,GAAW,KAAA,EAAO,SAAA,EAAW,QAAA,EApE/C,GAoEqE,EAAA,EAAT,IAAA,GAAA,SAAA,CAAS,EAAA,EAAT,CAAhD,MAAA,EAAM,YAAkB,WAAA,EAAW,UAAA,CAAA,CAAA;AAC3C,IAAA,uBACE,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA,aAAA,CAAA,cAAA,CAAA;AAAA,QACC,GAAA;AAAA,QACA,IAAA;AAAA,QACA,MAAA,EAAQ,WAAW,QAAA,GAAW,MAAA;AAAA,QAC9B,GAAA,EAAK,WAAW,qBAAA,GAAwB,MAAA;AAAA,QACxC,WAAA,EAAU,YAAA;AAAA,QACV,SAAA,EAAW,EAAA,CAAG,YAAA,EAAc,SAAS;AAAA,OAAA,EACjC,IAAA,CAAA,EAPL;AAAA,QASE;AAAA,OAAA;AAAA,KACH;AAAA,EAEJ;AACF","file":"chunk-SDJ6HXPX.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@core/lib/utils\"\n\nconst BASE_CLASSES = [\n \"text-[color:var(--brand-default)]\",\n \"hover:text-[color:var(--brand-dark)]\",\n \"underline-offset-4 transition-colors\",\n \"outline-none focus-visible:outline-2 focus-visible:outline-offset-2\",\n \"focus-visible:outline-[color:var(--brand-default)] rounded-sm\",\n].join(\" \")\n\ntype LinkBrandAnchorProps = {\n /** Renderiza como `<a>` (default). */\n as?: \"a\"\n /** URL destino. */\n href: string\n external?: boolean\n} & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"as\" | \"href\">\n\ntype LinkBrandButtonProps = {\n /** Renderiza como `<button>` quando a acao e JS (sem URL). */\n as: \"button\"\n href?: never\n external?: never\n} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"as\">\n\nexport type LinkBrandProps = LinkBrandAnchorProps | LinkBrandButtonProps\n\n/**\n * Link de texto discreto da marca — `text-brand-default` com hover pra\n * `text-brand-dark`. Usado em nav, footer e texto inline.\n *\n * Sem underline por default (visual mais clean). Pra ter underline, passe\n * `className=\"hover:underline\"` ou `underline` no consumer.\n *\n * Pode renderizar como `<a>` (default) ou `<button>` via prop `as`.\n *\n * @example\n * <LinkBrand href=\"/precos\">Ver planos</LinkBrand>\n *\n * <LinkBrand href=\"https://twitter.com\" external>\n * Siga no Twitter\n * </LinkBrand>\n *\n * <LinkBrand as=\"button\" onClick={() => openModal()}>\n * Abrir filtros\n * </LinkBrand>\n */\nconst LinkBrand = React.forwardRef<HTMLAnchorElement | HTMLButtonElement, LinkBrandProps>(\n function LinkBrand(props, ref) {\n if (props.as === \"button\") {\n const { as: _as, className, children, ...rest } = props\n return (\n <button\n ref={ref as React.Ref<HTMLButtonElement>}\n type=\"button\"\n data-slot=\"link-brand\"\n className={cn(BASE_CLASSES, className)}\n {...rest}\n >\n {children}\n </button>\n )\n }\n\n const { href, external = false, className, children, ...rest } = props\n return (\n <a\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n target={external ? \"_blank\" : undefined}\n rel={external ? \"noopener noreferrer\" : undefined}\n data-slot=\"link-brand\"\n className={cn(BASE_CLASSES, className)}\n {...rest}\n >\n {children}\n </a>\n )\n }\n)\n\nexport { LinkBrand }\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
// src/components/marketing/motion/smooth-anchor.tsx
|
|
4
|
+
function SmoothAnchor({ headerOffset = 96, duration = 900 }) {
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
if (typeof window === "undefined") return;
|
|
7
|
+
if (window.location.hash) {
|
|
8
|
+
const id = window.location.hash.slice(1);
|
|
9
|
+
const el = document.getElementById(id);
|
|
10
|
+
if (el) {
|
|
11
|
+
requestAnimationFrame(() => el.classList.add("anchor-target-pulse"));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function onClick(e) {
|
|
15
|
+
if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey) return;
|
|
16
|
+
const target = e.target;
|
|
17
|
+
const anchor = target == null ? void 0 : target.closest('a[href^="#"]');
|
|
18
|
+
if (!anchor) return;
|
|
19
|
+
const href = anchor.getAttribute("href");
|
|
20
|
+
if (!href || href === "#") return;
|
|
21
|
+
const id = href.slice(1);
|
|
22
|
+
const el = document.getElementById(id);
|
|
23
|
+
if (!el) return;
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
const prefersReduced = window.matchMedia(
|
|
26
|
+
"(prefers-reduced-motion: reduce)"
|
|
27
|
+
).matches;
|
|
28
|
+
const rect = el.getBoundingClientRect();
|
|
29
|
+
const targetY = window.scrollY + rect.top - headerOffset;
|
|
30
|
+
if (prefersReduced) {
|
|
31
|
+
window.scrollTo(0, targetY);
|
|
32
|
+
} else {
|
|
33
|
+
smoothScrollTo(targetY, duration);
|
|
34
|
+
}
|
|
35
|
+
history.replaceState(null, "", href);
|
|
36
|
+
el.classList.remove("anchor-target-pulse");
|
|
37
|
+
void el.offsetWidth;
|
|
38
|
+
el.classList.add("anchor-target-pulse");
|
|
39
|
+
}
|
|
40
|
+
document.addEventListener("click", onClick);
|
|
41
|
+
return () => document.removeEventListener("click", onClick);
|
|
42
|
+
}, [headerOffset, duration]);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function smoothScrollTo(targetY, duration) {
|
|
46
|
+
const startY = window.scrollY;
|
|
47
|
+
const distance = targetY - startY;
|
|
48
|
+
if (Math.abs(distance) < 2) return;
|
|
49
|
+
const startTime = performance.now();
|
|
50
|
+
function step(now) {
|
|
51
|
+
const elapsed = now - startTime;
|
|
52
|
+
const t = Math.min(elapsed / duration, 1);
|
|
53
|
+
const eased = easeInOutCubic(t);
|
|
54
|
+
window.scrollTo(0, startY + distance * eased);
|
|
55
|
+
if (t < 1) requestAnimationFrame(step);
|
|
56
|
+
}
|
|
57
|
+
requestAnimationFrame(step);
|
|
58
|
+
}
|
|
59
|
+
function easeInOutCubic(t) {
|
|
60
|
+
return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { SmoothAnchor };
|
|
64
|
+
//# sourceMappingURL=chunk-SDPIL7HA.js.map
|
|
65
|
+
//# sourceMappingURL=chunk-SDPIL7HA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/marketing/motion/smooth-anchor.tsx"],"names":[],"mappings":";;;AAiCA,SAAS,aAAa,EAAE,YAAA,GAAe,EAAA,EAAI,QAAA,GAAW,KAAI,EAAsB;AAC9E,EAAM,gBAAU,MAAM;AACpB,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAGnC,IAAA,IAAI,MAAA,CAAO,SAAS,IAAA,EAAM;AACxB,MAAA,MAAM,EAAA,GAAK,MAAA,CAAO,QAAA,CAAS,IAAA,CAAK,MAAM,CAAC,CAAA;AACvC,MAAA,MAAM,EAAA,GAAK,QAAA,CAAS,cAAA,CAAe,EAAE,CAAA;AACrC,MAAA,IAAI,EAAA,EAAI;AACN,QAAA,qBAAA,CAAsB,MAAM,EAAA,CAAG,SAAA,CAAU,GAAA,CAAI,qBAAqB,CAAC,CAAA;AAAA,MACrE;AAAA,IACF;AAEA,IAAA,SAAS,QAAQ,CAAA,EAAe;AAC9B,MAAA,IAAI,CAAA,CAAE,oBAAoB,CAAA,CAAE,MAAA,KAAW,KAAK,CAAA,CAAE,OAAA,IAAW,EAAE,OAAA,EAAS;AACpE,MAAA,MAAM,SAAS,CAAA,CAAE,MAAA;AACjB,MAAA,MAAM,MAAA,GAAS,iCAAQ,OAAA,CAAQ,cAAA,CAAA;AAC/B,MAAA,IAAI,CAAC,MAAA,EAAQ;AACb,MAAA,MAAM,IAAA,GAAO,MAAA,CAAO,YAAA,CAAa,MAAM,CAAA;AACvC,MAAA,IAAI,CAAC,IAAA,IAAQ,IAAA,KA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,QAAQ,CAAA,GAAI,CAAA,EAAG;AAC5B,EAAA,MAAM,SAAA,GAAY,YAAY,GAAA,EAAI;AAElC,EAAA,SAAS,KAAK,GAAA,EAAa;AACzB,IAAA,MAAM,UAAU,GAAA,GAAM,SAAA;AACtB,IAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,OAAA,GAAU,UAAU,CAAC,CAAA;AACxC,IAAA,MAAM,KAAA,GAAQ,eAAe,CAAC,CAAA;AAC9B,IAAA,MAAA,CAAO,QAAA,CAAS,CAAA,EAAG,MAAA,GAAS,QAAA,GAAW,KAAK,CAAA;AAC5C,IAAA,IAAI,CAAA,GAAI,CAAA,EAAG,qBAAA,CAAsB,IAAI,CAAA;AAAA,EACvC;AAEA,EAAA,qBAAA,CAAsB,IAAI,CAAA;AAC5B;AAEA,SAAS,eAAe,CAAA,EAAmB;AACzC,EAAA,OAAO,CAAA,GAAI,GAAA,GAAM,CAAA,GAAI,CAAA,GAAI,CAAA,GAAI,CAAA,GAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,EAAA,GAAK,CAAA,GAAI,CAAA,EAAG,CAAC,CAAA,GAAI,CAAA;AACjE","file":"chunk-SDPIL7HA.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nexport interface SmoothAnchorProps {\n /** Offset em px pra compensar header sticky. Default `96`. */\n headerOffset?: number\n /** Duracao do scroll em ms. Default `900`. */\n duration?: number\n}\n\n/**\n * Intercepta cliques em links de hash (`<a href=\"#algo\">`) e faz scroll suave\n * com easing `easeInOutCubic` em vez do `scroll-behavior: smooth` nativo\n * (que tem duracao curta e easing fixo).\n *\n * Renderiza `null` (so registra listener global). Monte UMA VEZ por app,\n * tipicamente no `<RootLayout>` ou na pagina raiz da landing.\n *\n * Comportamento:\n * - Ignora clicks com modificadores (cmd/ctrl/middle-button).\n * - Atualiza URL via `history.replaceState` sem disparar scroll nativo.\n * - Adiciona classe `anchor-target-pulse` no destino apos chegar (animacao\n * visual opcional, definida em `globals.css`).\n * - Respeita `prefers-reduced-motion` (scroll instantaneo, sem easing).\n *\n * @example\n * // app/layout.tsx\n * <body>\n * <SmoothAnchor headerOffset={64} />\n * {children}\n * </body>\n */\nfunction SmoothAnchor({ headerOffset = 96, duration = 900 }: SmoothAnchorProps) {\n React.useEffect(() => {\n if (typeof window === \"undefined\") return\n\n // Se a pagina abre ja com hash, pulsa o destino apos o scroll inicial.\n if (window.location.hash) {\n const id = window.location.hash.slice(1)\n const el = document.getElementById(id)\n if (el) {\n requestAnimationFrame(() => el.classList.add(\"anchor-target-pulse\"))\n }\n }\n\n function onClick(e: MouseEvent) {\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey) return\n const target = e.target as HTMLElement | null\n const anchor = target?.closest('a[href^=\"#\"]') as HTMLAnchorElement | null\n if (!anchor) return\n const href = anchor.getAttribute(\"href\")\n if (!href || href === \"#\") return\n const id = href.slice(1)\n const el = document.getElementById(id)\n if (!el) return\n\n e.preventDefault()\n const prefersReduced = window.matchMedia(\n \"(prefers-reduced-motion: reduce)\"\n ).matches\n\n const rect = el.getBoundingClientRect()\n const targetY = window.scrollY + rect.top - headerOffset\n\n if (prefersReduced) {\n window.scrollTo(0, targetY)\n } else {\n smoothScrollTo(targetY, duration)\n }\n\n history.replaceState(null, \"\", href)\n // Reativa pulse mesmo se a URL ja for a mesma\n el.classList.remove(\"anchor-target-pulse\")\n void el.offsetWidth\n el.classList.add(\"anchor-target-pulse\")\n }\n\n document.addEventListener(\"click\", onClick)\n return () => document.removeEventListener(\"click\", onClick)\n }, [headerOffset, duration])\n\n return null\n}\n\nfunction smoothScrollTo(targetY: number, duration: number) {\n const startY = window.scrollY\n const distance = targetY - startY\n if (Math.abs(distance) < 2) return\n const startTime = performance.now()\n\n function step(now: number) {\n const elapsed = now - startTime\n const t = Math.min(elapsed / duration, 1)\n const eased = easeInOutCubic(t)\n window.scrollTo(0, startY + distance * eased)\n if (t < 1) requestAnimationFrame(step)\n }\n\n requestAnimationFrame(step)\n}\n\nfunction easeInOutCubic(t: number): number {\n return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2\n}\n\nexport { SmoothAnchor }\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-SGFTGHM5.js"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
// src/hooks/use-reduced-motion.ts
|
|
4
|
+
function useReducedMotion() {
|
|
5
|
+
const [reduced, setReduced] = useState(false);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
8
|
+
setReduced(media.matches);
|
|
9
|
+
const handler = (event) => setReduced(event.matches);
|
|
10
|
+
media.addEventListener("change", handler);
|
|
11
|
+
return () => media.removeEventListener("change", handler);
|
|
12
|
+
}, []);
|
|
13
|
+
return reduced;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { useReducedMotion };
|
|
17
|
+
//# sourceMappingURL=chunk-T7EIAVSF.js.map
|
|
18
|
+
//# sourceMappingURL=chunk-T7EIAVSF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-reduced-motion.ts"],"names":[],"mappings":";;;AAYO,SAAS,gBAAA,GAA4B;AAC1C,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAE5C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,UAAA,CAAW,kCAAkC,CAAA;AAClE,IAAA,UAAA,CAAW,MAAM,OAAO,CAAA;AAExB,IAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KAA+B,UAAA,CAAW,MAAM,OAAO,CAAA;AACxE,IAAA,KAAA,CAAM,gBAAA,CAAiB,UAAU,OAAO,CAAA;AACxC,IAAA,OAAO,MAAM,KAAA,CAAM,mBAAA,CAAoB,QAAA,EAAU,OAAO,CAAA;AAAA,EAC1D,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,OAAA;AACT","file":"chunk-T7EIAVSF.js","sourcesContent":["\"use client\"\n\nimport { useEffect, useState } from \"react\"\n\n/**\n * Returns `true` quando o usuario habilitou \"prefers-reduced-motion\" no SO.\n * Componentes do `marketing/motion/*` consultam esse hook pra desligar animacoes\n * (resolver para o estado final direto) — requisito WCAG 2.3.3.\n *\n * SSR-safe: comeca em `false` no server e atualiza no client apos mount.\n * Reage a mudancas dinamicas (usuario toggla a preferencia com a aba aberta).\n */\nexport function useReducedMotion(): boolean {\n const [reduced, setReduced] = useState(false)\n\n useEffect(() => {\n const media = window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n setReduced(media.matches)\n\n const handler = (event: MediaQueryListEvent) => setReduced(event.matches)\n media.addEventListener(\"change\", handler)\n return () => media.removeEventListener(\"change\", handler)\n }, [])\n\n return reduced\n}\n"]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useReducedMotion } from './chunk-T7EIAVSF.js';
|
|
2
|
+
import { cn } from './chunk-W4KJCBMW.js';
|
|
3
|
+
import { __objRest, __spreadProps, __spreadValues } from './chunk-2NMEKWO5.js';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var MagneticButton = React.forwardRef(
|
|
8
|
+
function MagneticButton2(_a, forwardedRef) {
|
|
9
|
+
var _b = _a, { strength = 0.25, radius = 100, className, style, children } = _b, props = __objRest(_b, ["strength", "radius", "className", "style", "children"]);
|
|
10
|
+
const innerRef = React.useRef(null);
|
|
11
|
+
const ref = forwardedRef != null ? forwardedRef : innerRef;
|
|
12
|
+
const hoveredRef = React.useRef(false);
|
|
13
|
+
const reduced = useReducedMotion();
|
|
14
|
+
const [hovered, setHovered] = React.useState(false);
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
const el = ref.current;
|
|
17
|
+
if (!el) return;
|
|
18
|
+
const s = hovered ? 1.03 : 1;
|
|
19
|
+
const cur = el.style.transform;
|
|
20
|
+
if (cur && /scale\([^)]+\)/.test(cur)) {
|
|
21
|
+
el.style.transform = cur.replace(/scale\([^)]+\)/, `scale(${s})`);
|
|
22
|
+
} else {
|
|
23
|
+
el.style.transform = `translate3d(0,0,0) scale(${s})`;
|
|
24
|
+
}
|
|
25
|
+
}, [hovered, ref]);
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (reduced) return;
|
|
28
|
+
if (typeof window === "undefined") return;
|
|
29
|
+
if (window.matchMedia("(pointer: coarse)").matches) return;
|
|
30
|
+
const el = ref.current;
|
|
31
|
+
if (!el) return;
|
|
32
|
+
let isVisible = false;
|
|
33
|
+
let rafId = 0;
|
|
34
|
+
let lastX = 0;
|
|
35
|
+
let lastY = 0;
|
|
36
|
+
const io = new IntersectionObserver(
|
|
37
|
+
([entry]) => {
|
|
38
|
+
var _a2;
|
|
39
|
+
isVisible = (_a2 = entry == null ? void 0 : entry.isIntersecting) != null ? _a2 : false;
|
|
40
|
+
if (!isVisible) {
|
|
41
|
+
el.style.transform = `translate3d(0,0,0) scale(${hoveredRef.current ? 1.03 : 1})`;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{ rootMargin: "200px" }
|
|
45
|
+
);
|
|
46
|
+
io.observe(el);
|
|
47
|
+
function flush() {
|
|
48
|
+
rafId = 0;
|
|
49
|
+
if (!isVisible) return;
|
|
50
|
+
const cur = ref.current;
|
|
51
|
+
if (!cur) return;
|
|
52
|
+
const rect = cur.getBoundingClientRect();
|
|
53
|
+
const cx = rect.left + rect.width / 2;
|
|
54
|
+
const cy = rect.top + rect.height / 2;
|
|
55
|
+
const dx = lastX - cx;
|
|
56
|
+
const dy = lastY - cy;
|
|
57
|
+
const dist = Math.hypot(dx, dy);
|
|
58
|
+
const tx = dist < radius ? dx * strength : 0;
|
|
59
|
+
const ty = dist < radius ? dy * strength : 0;
|
|
60
|
+
const s = hoveredRef.current ? 1.03 : 1;
|
|
61
|
+
cur.style.transform = `translate3d(${tx}px, ${ty}px, 0) scale(${s})`;
|
|
62
|
+
}
|
|
63
|
+
function onMove(e) {
|
|
64
|
+
if (!isVisible) return;
|
|
65
|
+
lastX = e.clientX;
|
|
66
|
+
lastY = e.clientY;
|
|
67
|
+
if (rafId) return;
|
|
68
|
+
rafId = requestAnimationFrame(flush);
|
|
69
|
+
}
|
|
70
|
+
window.addEventListener("mousemove", onMove, { passive: true });
|
|
71
|
+
return () => {
|
|
72
|
+
window.removeEventListener("mousemove", onMove);
|
|
73
|
+
io.disconnect();
|
|
74
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
75
|
+
};
|
|
76
|
+
}, [reduced, strength, radius, ref]);
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
"div",
|
|
79
|
+
__spreadProps(__spreadValues({
|
|
80
|
+
ref,
|
|
81
|
+
"data-slot": "magnetic-button",
|
|
82
|
+
onMouseEnter: () => {
|
|
83
|
+
hoveredRef.current = true;
|
|
84
|
+
setHovered(true);
|
|
85
|
+
},
|
|
86
|
+
onMouseLeave: () => {
|
|
87
|
+
hoveredRef.current = false;
|
|
88
|
+
setHovered(false);
|
|
89
|
+
},
|
|
90
|
+
className: cn("inline-block", className),
|
|
91
|
+
style: __spreadValues({
|
|
92
|
+
transition: "transform 0.25s cubic-bezier(0.22, 1, 0.36, 1)",
|
|
93
|
+
willChange: "transform",
|
|
94
|
+
filter: hovered ? "var(--shadow-brand-glow-hover)" : "var(--shadow-brand-glow-idle)"
|
|
95
|
+
}, style)
|
|
96
|
+
}, props), {
|
|
97
|
+
children
|
|
98
|
+
})
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
export { MagneticButton };
|
|
104
|
+
//# sourceMappingURL=chunk-VNGGZL6V.js.map
|
|
105
|
+
//# sourceMapp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C,CAAA;AAAA,IACF,GAAG,CAAC,OAAA,EAAS,QAAA,EAAU,MAAA,EAAQ,GAAG,CAAC,CAAA;AAEnC,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA,aAAA,CAAA,cAAA,CAAA;AAAA,QACC,GAAA;AAAA,QACA,WAAA,EAAU,iBAAA;AAAA,QACV,cAAc,MAAM;AAClB,UAAA,UAAA,CAAW,OAAA,GAAU,IAAA;AACrB,UAAA,UAAA,CAAW,IAAI,CAAA;AAAA,QACjB,CAAA;AAAA,QACA,cAAc,MAAM;AAClB,UAAA,UAAA,CAAW,OAAA,GAAU,KAAA;AACrB,UAAA,UAAA,CAAW,KAAK,CAAA;AAAA,QAClB,CAAA;AAAA,QACA,SAAA,EAAW,EAAA,CAAG,cAAA,EAAgB,SAAS,CAAA;AAAA,QACvC,KAAA,EAAO,cAAA,CAAA;AAAA,UACL,UAAA,EAAY,gDAAA;AAAA,UACZ,UAAA,EAAY,WAAA;AAAA,UACZ,MAAA,EAAQ,UACJ,gCAAA,GACA;AAAA,SAAA,EACD,KAAA;AAAA,OAAA,EAED,KAAA,CAAA,EApBL;AAAA,QAsBE;AAAA,OAAA;AAAA,KACH;AAAA,EAEJ;AACF","file":"chunk-VNGGZL6V.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@core/lib/utils\"\nimport { useReducedMotion } from \"@pulse/hooks/use-reduced-motion\"\n\nexport interface MagneticButtonProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Multiplicador do offset (quanto o filho \"puxa\" em direcao ao cursor). Default `0.25`. */\n strength?: number\n /** Distancia em px na qual o efeito ativa. Default `100`. */\n radius?: number\n children: React.ReactNode\n}\n\n/**\n * Wrapper que aplica efeito magnetico no filho (puxa em direcao ao cursor\n * quando proximo). Inspirado em CTAs premium de landing pages.\n *\n * Otimizacoes de performance:\n * - Escreve `transform` direto no DOM via ref (sem React state na hot path).\n * - Throttle com `requestAnimationFrame` (max 1 update por frame).\n * - `IntersectionObserver` gating: so processa `mousemove` quando visivel\n * (rootMargin 200px pra suavidade na entrada).\n *\n * Acessibilidade:\n * - Skip total se `prefers-reduced-motion: reduce`.\n * - Skip total em `pointer: coarse` (touch devices) — sem cursor real.\n *\n * O drop-shadow usa CSS vars (`--shadow-brand-glow-idle/-hover`) — consumer\n * pode override pro brand proprio sem mexer no componente.\n *\n * @example\n * <MagneticButton>\n * <a href=\"#vendas\">\n * <Button variant=\"default\">CTA principal</Button>\n * </a>\n * </MagneticButton>\n */\nconst MagneticButton = React.forwardRef<HTMLDivElement, MagneticButtonProps>(\n function MagneticButton(\n { strength = 0.25, radius = 100, className, style, children, ...props },\n forwardedRef\n ) {\n const innerRef = React.useRef<HTMLDivElement>(null)\n const ref = (forwardedRef as React.RefObject<HTMLDivElement>) ?? innerRef\n const hoveredRef = React.useRef(false)\n const reduced = useReducedMotion()\n const [hovered, setHovered] = React.useState(false)\n\n // Sincroniza scale quando hover muda — sem tocar no offset do mousemove.\n React.useEffect(() => {\n const el = ref.current\n if (!el) return\n const s = hovered ? 1.03 : 1\n const cur = el.style.transform\n if (cur && /scale\\([^)]+\\)/.test(cur)) {\n el.style.transform = cur.replace(/scale\\([^)]+\\)/, `scale(${s})`)\n } else {\n el.style.transform = `translate3d(0,0,0) scale(${s})`\n }\n }, [hovered, ref])\n\n React.useEffect(() => {\n if (reduced) return\n if (typeof window === \"undefined\") return\n if (window.matchMedia(\"(pointer: coarse)\").matches) return\n\n const el = ref.current\n if (!el) return\n\n let isVisible = false\n let rafId = 0\n let lastX = 0\n let lastY = 0\n\n const io = new IntersectionObserver(\n ([entry]) => {\n isVisible = entry?.isIntersecting ?? false\n if (!isVisible) {\n el.style.transform = `translate3d(0,0,0) scale(${\n hoveredRef.current ? 1.03 : 1\n })`\n }\n },\n { rootMargin: \"200px\" }\n )\n io.observe(el)\n\n function flush() {\n rafId = 0\n if (!isVisible) return\n const cur = ref.current\n if (!cur) return\n const rect = cur.getBoundingClientRect()\n const cx = rect.left + rect.width / 2\n const cy = rect.top + rect.height / 2\n const dx = lastX - cx\n const dy = lastY - cy\n const dist = Math.hypot(dx, dy)\n const tx = dist < radius ? dx * strength : 0\n const ty = dist < radius ? dy * strength : 0\n const s = hoveredRef.current ? 1.03 : 1\n cur.style.transform = `translate3d(${tx}px, ${ty}px, 0) scale(${s})`\n }\n\n function onMove(e: MouseEvent) {\n if (!isVisible) return\n lastX = e.clientX\n lastY = e.clientY\n if (rafId) return\n rafId = requestAnimationFrame(flush)\n }\n\n window.addEventListener(\"mousemove\", onMove, { passive: true })\n return () => {\n window.removeEventListener(\"mousemove\", onMove)\n io.disconnect()\n if (rafId) cancelAnimationFrame(rafId)\n }\n }, [reduced, strength, radius, ref])\n\n return (\n <div\n ref={ref}\n data-slot=\"magnetic-button\"\n onMouseEnter={() => {\n hoveredRef.current = true\n setHovered(true)\n }}\n onMouseLeave={() => {\n hoveredRef.current = false\n setHovered(false)\n }}\n className={cn(\"inline-block\", className)}\n style={{\n transition: \"transform 0.25s cubic-bezier(0.22, 1, 0.36, 1)\",\n willChange: \"transform\",\n filter: hovered\n ? \"var(--shadow-brand-glow-hover)\"\n : \"var(--shadow-brand-glow-idle)\",\n ...style,\n }}\n {...props}\n >\n {children}\n </div>\n )\n }\n)\n\nexport { MagneticButton }\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
4
|
+
// ../core/src/lib/utils.ts
|
|
5
|
+
function cn(...inputs) {
|
|
6
|
+
return twMerge(clsx(inputs));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { cn };
|
|
10
|
+
//# sourceMappingURL=chunk-W4KJCBMW.js.map
|
|
11
|
+
//# sourceMappingURL=chunk-W4KJCBMW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../core/src/lib/utils.ts"],"names":[],"mappings":";;;;AAGO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B","file":"chunk-W4KJCBMW.js","sourcesContent":["import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useIntersection } from './chunk-OHRYR7PN.js';
|
|
2
|
+
import { useReducedMotion } from './chunk-T7EIAVSF.js';
|
|
3
|
+
import { cn } from './chunk-W4KJCBMW.js';
|
|
4
|
+
import { __objRest, __spreadProps, __spreadValues } from './chunk-2NMEKWO5.js';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function easeOutCubic(t) {
|
|
9
|
+
return 1 - Math.pow(1 - t, 3);
|
|
10
|
+
}
|
|
11
|
+
function formatNumber(n, decimals, locale) {
|
|
12
|
+
if (locale === "pt-BR") {
|
|
13
|
+
return n.toLocaleString("pt-BR", {
|
|
14
|
+
minimumFractionDigits: decimals,
|
|
15
|
+
maximumFractionDigits: decimals
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return n.toFixed(decimals);
|
|
19
|
+
}
|
|
20
|
+
function AnimatedNumber(_a) {
|
|
21
|
+
var _b = _a, {
|
|
22
|
+
value,
|
|
23
|
+
from = 0,
|
|
24
|
+
duration = 1400,
|
|
25
|
+
prefix = "",
|
|
26
|
+
suffix = "",
|
|
27
|
+
decimals = 0,
|
|
28
|
+
locale = "pt-BR",
|
|
29
|
+
threshold = 0.4,
|
|
30
|
+
className
|
|
31
|
+
} = _b, props = __objRest(_b, [
|
|
32
|
+
"value",
|
|
33
|
+
"from",
|
|
34
|
+
"duration",
|
|
35
|
+
"prefix",
|
|
36
|
+
"suffix",
|
|
37
|
+
"decimals",
|
|
38
|
+
"locale",
|
|
39
|
+
"threshold",
|
|
40
|
+
"className"
|
|
41
|
+
]);
|
|
42
|
+
const reduced = useReducedMotion();
|
|
43
|
+
const { ref, isVisible } = useIntersection({
|
|
44
|
+
threshold,
|
|
45
|
+
startVisible: reduced
|
|
46
|
+
});
|
|
47
|
+
const [current, setCurrent] = React.useState(reduced ? value : from);
|
|
48
|
+
const startedRef = React.useRef(false);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (reduced) {
|
|
51
|
+
setCurrent(value);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (!isVisible || startedRef.current) return;
|
|
55
|
+
startedRef.current = true;
|
|
56
|
+
const start = performance.now();
|
|
57
|
+
let frame = 0;
|
|
58
|
+
const tick = (now) => {
|
|
59
|
+
const elapsed = now - start;
|
|
60
|
+
const t = Math.min(elapsed / duration, 1);
|
|
61
|
+
const next = from + (value - from) * easeOutCubic(t);
|
|
62
|
+
setCurrent(next);
|
|
63
|
+
if (t < 1) frame = requestAnimationFrame(tick);
|
|
64
|
+
};
|
|
65
|
+
frame = requestAnimationFrame(tick);
|
|
66
|
+
return () => cancelAnimationFrame(frame);
|
|
67
|
+
}, [isVisible, value, from, duration, reduced]);
|
|
68
|
+
return /* @__PURE__ */ jsxs("span", __spreadProps(__spreadValues({ ref, className: cn("tabular-nums", className) }, props), { children: [
|
|
69
|
+
prefix,
|
|
70
|
+
formatNumber(current, decimals, locale),
|
|
71
|
+
suffix
|
|
72
|
+
] }));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { AnimatedNumber };
|
|
76
|
+
//# sourceMappingURL=chunk-WVYPNZFL.js.map
|
|
77
|
+
//# sourceMappingURL=chunk-WVYPNZFL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/marketing/motion/animated-number.tsx"],"names":[],"mappings":";;;;;;;AA8BA,SAAS,aAAa,CAAA,EAAmB;AACvC,EAAA,OAAO,CAAA,GAAI,I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AM;AACpB,IAAA,IAAI,OAAA,EAAS;AACX,MAAA,UAAA,CAAW,KAAK,CAAA;AAChB,MAAA;AAAA,IACF;AACA,IAAA,IAAI,CAAC,SAAA,IAAa,UAAA,CAAW,OAAA,EAAS;AACtC,IAAA,UAAA,CAAW,OAAA,GAAU,IAAA;AAErB,IAAA,MAAM,KAAA,GAAQ,YAAY,GAAA,EAAI;AAC9B,IAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,IAAA,MAAM,IAAA,GAAO,CAAC,GAAA,KAAgB;AAC5B,MAAA,MAAM,UAAU,GAAA,GAAM,KAAA;AACtB,MAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,OAAA,GAAU,UAAU,CAAC,CAAA;AACxC,MAAA,MAAM,IAAA,GAAO,IAAA,GAAA,CAAQ,KAAA,GAAQ,IAAA,IAAQ,aAAa,CAAC,CAAA;AACnD,MAAA,UAAA,CAAW,IAAI,CAAA;AACf,MAAA,IAAI,CAAA,GAAI,CAAA,EAAG,KAAA,GAAQ,qBAAA,CAAsB,IAAI,CAAA;AAAA,IAC/C,CAAA;AACA,IAAA,KAAA,GAAQ,sBAAsB,IAAI,CAAA;AAClC,IAAA,OAAO,MAAM,qBAAqB,KAAK,CAAA;AAAA,EACzC,GAAG,CAAC,SAAA,EAAW,OAAO,IAAA,EAAM,QAAA,EAAU,OAAO,CAAC,CAAA;AAE9C,EAAA,uBACE,IAAA,CAAC,uCAAK,GAAA,EAAU,SAAA,EAAW,GAAG,cAAA,EAAgB,SAAS,CAAA,EAAA,EAAO,KAAA,CAAA,EAA7D,EACE,QAAA,EAAA;AAAA,IAAA,MAAA;AAAA,IACA,YAAA,CAAa,OAAA,EAAS,QAAA,EAAU,MAAM,CAAA;AAAA,IACtC;AAAA,GAAA,EAAA,CACH,CAAA;AAEJ","file":"chunk-WVYPNZFL.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { cn } from \"@core/lib/utils\"\nimport { useIntersection } from \"@pulse/hooks/use-intersection\"\nimport { useReducedMotion } from \"@pulse/hooks/use-reduced-motion\"\n\nexport interface AnimatedNumberProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Valor final do contador. */\n value: number\n /** Valor inicial. Default `0`. */\n from?: number\n /** Duracao da animacao em ms. Default `1400`. */\n duration?: number\n /** Texto antes do numero (ex: `\"R$ \"` ou `\"+\"`). */\n prefix?: string\n /** Texto depois do numero (ex: `\"%\"` ou `\"k\"`). */\n suffix?: string\n /** Casas decimais. Default `0`. */\n decimals?: number\n /**\n * Formato dos numeros. `\"pt-BR\"` usa separador `.` e decimal `,`;\n * `\"plain\"` usa `toFixed`. Default `\"pt-BR\"`.\n */\n locale?: \"pt-BR\" | \"plain\"\n /** Threshold do IntersectionObserver. Default `0.4`. */\n threshold?: number\n}\n\nfunction easeOutCubic(t: number): number {\n return 1 - Math.pow(1 - t, 3)\n}\n\nfunction formatNumber(n: number, decimals: number, locale: \"pt-BR\" | \"plain\"): string {\n if (locale === \"pt-BR\") {\n return n.toLocaleString(\"pt-BR\", {\n minimumFractionDigits: decimals,\n maximumFractionDigits: decimals,\n })\n }\n return n.toFixed(decimals)\n}\n\n/**\n * Conta de `from` ate `value` com easing `easeOutCubic` quando o componente\n * entra no viewport. Aplica `tabular-nums` automaticamente pra largura estavel\n * durante a contagem (evita \"saltos\" no layout).\n *\n * Acessibilidade: respeita `prefers-reduced-motion` — pula direto pro valor\n * final, sem animar.\n */\nfunction AnimatedNumber({\n value,\n from = 0,\n duration = 1400,\n prefix = \"\",\n suffix = \"\",\n decimals = 0,\n locale = \"pt-BR\",\n threshold = 0.4,\n className,\n ...props\n}: AnimatedNumberProps) {\n const reduced = useReducedMotion()\n const { ref, isVisible } = useIntersection<HTMLSpanElement>({\n threshold,\n startVisible: reduced,\n })\n const [current, setCurrent] = React.useState(reduced ? value : from)\n const startedRef = React.useRef(false)\n\n React.useEffect(() => {\n if (reduced) {\n setCurrent(value)\n return\n }\n if (!isVisible || startedRef.current) return\n startedRef.current = true\n\n const start = performance.now()\n let frame = 0\n const tick = (now: number) => {\n const elapsed = now - start\n const t = Math.min(elapsed / duration, 1)\n const next = from + (value - from) * easeOutCubic(t)\n setCurrent(next)\n if (t < 1) frame = requestAnimationFrame(tick)\n }\n frame = requestAnimationFrame(tick)\n return () => cancelAnimationFrame(frame)\n }, [isVisible, value, from, duration, reduced])\n\n return (\n <span ref={ref} className={cn(\"tabular-nums\", className)} {...props}>\n {prefix}\n {formatNumber(current, decimals, locale)}\n {suffix}\n </span>\n )\n}\n\nexport { AnimatedNumber }\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cn } from './chunk-W4KJCBMW.js';
|
|
2
|
+
import { __objRest, __spreadProps, __spreadValues } from './chunk-2NMEKWO5.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var Marquee = React.forwardRef(function Marquee2(_a, ref) {
|
|
7
|
+
var _b = _a, {
|
|
8
|
+
speed = 40,
|
|
9
|
+
direction = "left",
|
|
10
|
+
pauseOnHover = true,
|
|
11
|
+
gap = 48,
|
|
12
|
+
className,
|
|
13
|
+
children,
|
|
14
|
+
style
|
|
15
|
+
} = _b, props = __objRest(_b, [
|
|
16
|
+
"speed",
|
|
17
|
+
"direction",
|
|
18
|
+
"pauseOnHover",
|
|
19
|
+
"gap",
|
|
20
|
+
"className",
|
|
21
|
+
"children",
|
|
22
|
+
"style"
|
|
23
|
+
]);
|
|
24
|
+
const trackStyle = {
|
|
25
|
+
["--cycle-marquee-duration"]: `${speed}s`,
|
|
26
|
+
["--cycle-marquee-gap"]: `${gap}px`
|
|
27
|
+
};
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
"div",
|
|
30
|
+
__spreadProps(__spreadValues({
|
|
31
|
+
ref,
|
|
32
|
+
"data-slot": "marquee",
|
|
33
|
+
"data-pause-on-hover": pauseOnHover ? "true" : "false",
|
|
34
|
+
className: cn("cycle-marquee", className),
|
|
35
|
+
style
|
|
36
|
+
}, props), {
|
|
37
|
+
children: /* @__PURE__ */ jsxs(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: "cycle-marquee-track",
|
|
41
|
+
"data-direction": direction,
|
|
42
|
+
style: trackStyle,
|
|
43
|
+
children: [
|
|
44
|
+
children,
|
|
45
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "contents", children })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export { Marquee };
|
|
54
|
+
//# sourceMappingURL=chunk-WZIXM2X2.js.map
|
|
55
|
+
//# sourceMappingURL=chunk-WZIXM2X2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/marketing/effects/marquee.tsx"],"names":["Marquee"],"mappings":";;;;;AA8BA,IAAM,OAAA,GAAgB,KAAA,CAAA,UAAA,CAAyC,SAASA,QAAAA,CACtE,IAUA,GAAA,EACA;AAXA,EAAA,IAAA,EAAA,GAAA,EAAA,EACE;AAAA,IAAA,KAAA,GAAQ,EAAA;AAAA,IACR,SAAA,GAAY,MAAA;AAAA,IACZ,YAAA,GAAe,IAAA;AAAA,IACf,GAAA,GAAM,EAAA;AAAA,IACN,SAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GAtCJ,GA+BE,EAAA,EAQK,KAAA,GAAA,SAAA,CARL,EAAA,EAQK;AAAA,IAPH,OAAA;AAAA,IACA,WAAA;AAAA,IACA,cAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GAAA,CAAA;AAMF,EAAA,MAAM,UAAA,GAAa;AAAA,IACjB,CAAC,0BAAoC,GAAG,CAAA,EAAG,KAAK,CAAA,CAAA,CAAA;AAAA,IAChD,CAAC,qBAA+B,GAAG,CAAA,EAAG,GAAG,CAAA,EAAA;AAAA,GAC3C;AAEA,EAAA,uBACE,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA,aAAA,CAAA,cAAA,CAAA;AAAA,MACC,GAAA;AAAA,MACA,WAAA,EAAU,SAAA;AAAA,MACV,qBAAA,EAAqB,eAAe,MAAA,GAAS,OAAA;AAAA,MAC7C,SAAA,EAAW,EAAA,CAAG,eAAA,EAAiB,SAAS,CAAA;AAAA,MACxC;AAAA,KAAA,EACI,KAAA,CAAA,EANL;AAAA,MAQC,QAAA,kBAAA,IAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAU,qBAAA;AAAA,UACV,gBAAA,EAAgB,SAAA;AAAA,UAChB,KAAA,EAAO,UAAA;AAAA,UAEN,QAAA,EAAA;AAAA,YAAA,QAAA;AAAA,gCAEA,KAAA,EAAA,EAAI,aAAA,EAAY,MAAA,EAAO,SAAA,EAAU,YAC/B,QAAA,EACH;AAAA;AAAA;AAAA;AACF,KAAA;AAAA,GACF;AAEJ,CAAC","file":"chunk-WZIXM2X2.js","sourcesContent":["import * as React from \"react\"\n\nimport { cn } from \"@core/lib/utils\"\n\nexport interface MarqueeProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Duracao de um ciclo completo em segundos. Default `40`. */\n speed?: number\n /** Direcao do movimento. Default `\"left\"`. */\n direction?: \"left\" | \"right\"\n /** Pausa em `:hover` e `:focus-within`. Default `true` (acessibilidade). */\n pauseOnHover?: boolean\n /** Espacamento entre cada item em px. Default `48`. */\n gap?: number\n}\n\n/**\n * Scroll horizontal infinito (logo cloud, partner band). Duplica os children\n * internamente pra criar loop seamless. Pausa em hover/focus pra dar tempo\n * de leitura. Respeita `prefers-reduced-motion` (anima zerada).\n *\n * Importante: a duplicacao usa `aria-hidden` no segundo bloco pra evitar\n * leitura repetida por screen readers.\n *\n * @example\n * <Marquee speed={30} gap={64}>\n * <img src=\"/logos/logo-a.png\" alt=\"Cliente A\" />\n * <img src=\"/logos/logo-b.png\" alt=\"Cliente B\" />\n * <img src=\"/logos/logo-c.png\" alt=\"Cliente C\" />\n * </Marquee>\n */\nconst Marquee = React.forwardRef<HTMLDivElement, MarqueeProps>(function Marquee(\n {\n speed = 40,\n direction = \"left\",\n pauseOnHover = true,\n gap = 48,\n className,\n children,\n style,\n ...props\n },\n ref\n) {\n // Style merge: nossas CSS vars + qualquer style passado pelo consumer\n const trackStyle = {\n [\"--cycle-marquee-duration\" as string]: `${speed}s`,\n [\"--cycle-marquee-gap\" as string]: `${gap}px`,\n }\n\n return (\n <div\n ref={ref}\n data-slot=\"marquee\"\n data-pause-on-hover={pauseOnHover ? \"true\" : \"false\"}\n className={cn(\"cycle-marquee\", className)}\n style={style}\n {...props}\n >\n <div\n className=\"cycle-marquee-track\"\n data-direction={direction}\n style={trackStyle}\n >\n {children}\n {/* Duplicacao pro loop seamless — `aria-hidden` pra screen readers ignorarem. */}\n <div aria-hidden=\"true\" className=\"contents\">\n {children}\n </div>\n </div>\n </div>\n )\n})\n\nexport { Marquee }\n"]}
|