@digital-b2c/coreui-kit 0.3.6 → 0.4.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/index.cjs CHANGED
@@ -3,6 +3,9 @@
3
3
  var clsx3 = require('clsx');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React52 = require('react');
6
+ var gsap = require('gsap');
7
+ var ScrollTrigger = require('gsap/ScrollTrigger');
8
+ var react = require('@gsap/react');
6
9
 
7
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
11
 
@@ -508,7 +511,8 @@ var BrandsStrip = ({
508
511
  const [show, setShow] = React52.useState(false);
509
512
  const { is } = useViewPort_default();
510
513
  const isTabletBelow = is("tablet", "below");
511
- const shouldAnimate = !title && animate;
514
+ console.log(title);
515
+ const shouldAnimate = title === void 0 && animate;
512
516
  return /* @__PURE__ */ jsxRuntime.jsxs(
513
517
  "div",
514
518
  {
@@ -853,40 +857,11 @@ var ContactModuleTitle = ({ children }) => {
853
857
  var ContactModuleSubtitle = ({ children }) => {
854
858
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
855
859
  };
856
- function useIntersectionObserver({
857
- animateOnce = false,
858
- options = {}
859
- } = {}) {
860
- const observeRef = React52.useRef(null);
861
- const [isVisible, setIsVisible] = React52.useState(false);
862
- if (typeof IntersectionObserver === "undefined") {
863
- console.warn("IntersectionObserver is not supported in this browser.");
864
- return { observeRef, isVisible: true };
865
- }
866
- React52.useEffect(() => {
867
- const currentRef = observeRef.current;
868
- if (!currentRef) return;
869
- const observer = new IntersectionObserver((entries) => {
870
- const entry = entries[0];
871
- if (!entry) return;
872
- setIsVisible(entry.isIntersecting);
873
- if (entry.isIntersecting && animateOnce) {
874
- observer.disconnect();
875
- }
876
- }, options);
877
- observer.observe(currentRef);
878
- return () => {
879
- observer.disconnect();
880
- };
881
- }, [observeRef, animateOnce, options]);
882
- return { observeRef, isVisible };
883
- }
884
860
 
885
861
  // src/widgets/ContactModule/ContactModule.module.scss
886
862
  var ContactModule_module_default = {
887
863
  "contact-module": "ContactModule_module_contact-module",
888
864
  blur: "ContactModule_module_blur",
889
- "blur--hidden": "ContactModule_module_blur--hidden",
890
865
  container: "ContactModule_module_container",
891
866
  wrapper: "ContactModule_module_wrapper",
892
867
  content: "ContactModule_module_content",
@@ -896,6 +871,9 @@ var ContactModule_module_default = {
896
871
  image: "ContactModule_module_image",
897
872
  cta: "ContactModule_module_cta"
898
873
  };
874
+ if (typeof window !== "undefined") {
875
+ gsap.gsap.registerPlugin(ScrollTrigger.ScrollTrigger, react.useGSAP);
876
+ }
899
877
  var ContactModule = ({
900
878
  className,
901
879
  children,
@@ -907,24 +885,51 @@ var ContactModule = ({
907
885
  animateBlur = true
908
886
  }) => {
909
887
  var _a, _b;
910
- const { observeRef, isVisible } = useIntersectionObserver({
911
- animateOnce: true,
912
- options: { threshold: 0.8 }
913
- });
888
+ const containerRef = React52.useRef(null);
889
+ const blurRef = React52.useRef(null);
914
890
  const slots = resolveCompoundSlots(children, {
915
891
  title: ContactModuleTitle,
916
892
  subtitle: ContactModuleSubtitle
917
893
  });
918
894
  const titleNode = (_a = slots.title) != null ? _a : title;
919
895
  const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
920
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: observeRef, className: clsx3__default.default(ContactModule_module_default["contact-module"], className), children: [
921
- /* @__PURE__ */ jsxRuntime.jsx(
896
+ react.useGSAP(
897
+ () => {
898
+ if (!blurred || !animateBlur) return;
899
+ const revealProxy = { percentage: 0 };
900
+ gsap.gsap.to(revealProxy, {
901
+ percentage: 150,
902
+ scrollTrigger: {
903
+ trigger: containerRef.current,
904
+ start: "top+=90% bottom",
905
+ once: true
906
+ },
907
+ duration: 2,
908
+ ease: "power2.inOut",
909
+ onUpdate: () => {
910
+ if (blurRef.current) {
911
+ const mask = `radial-gradient(circle at center, transparent ${revealProxy.percentage - 30}%, black ${revealProxy.percentage}%)`;
912
+ blurRef.current.style.maskImage = mask;
913
+ blurRef.current.style.webkitMaskImage = mask;
914
+ }
915
+ },
916
+ onComplete: () => {
917
+ if (blurRef.current) blurRef.current.style.display = "none";
918
+ }
919
+ });
920
+ },
921
+ { scope: containerRef, dependencies: [blurred, animateBlur] }
922
+ );
923
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: clsx3__default.default(ContactModule_module_default["contact-module"], className), children: [
924
+ blurred && /* @__PURE__ */ jsxRuntime.jsx(
922
925
  "div",
923
926
  {
924
- className: clsx3__default.default({
925
- [ContactModule_module_default.blur]: blurred,
926
- [ContactModule_module_default["blur--hidden"]]: blurred && animateBlur && isVisible
927
- })
927
+ ref: blurRef,
928
+ className: ContactModule_module_default.blur,
929
+ style: {
930
+ maskImage: "radial-gradient(circle at center, transparent -30%, black 0%)",
931
+ WebkitMaskImage: "radial-gradient(circle at center, transparent -30%, black 0%)"
932
+ }
928
933
  }
929
934
  ),
930
935
  /* @__PURE__ */ jsxRuntime.jsxs(Container, { className: ContactModule_module_default.container, children: [
@@ -983,7 +988,8 @@ var HeroBanner_module_default = {
983
988
  brandsStrip: "HeroBanner_module_brandsStrip",
984
989
  backgroundImage: "HeroBanner_module_backgroundImage",
985
990
  scrollDown: "HeroBanner_module_scrollDown",
986
- arrow: "HeroBanner_module_arrow"
991
+ arrow: "HeroBanner_module_arrow",
992
+ mainHeroBanner: "HeroBanner_module_mainHeroBanner"
987
993
  };
988
994
  var HeroBanner = ({
989
995
  className,
@@ -1332,6 +1338,34 @@ var Teaser5050WithCta2 = Object.assign(Teaser5050WithCta, {
1332
1338
  Title: Teaser5050WithCtaTitle,
1333
1339
  Subtitle: Teaser5050WithCtaSubtitle
1334
1340
  });
1341
+ function useIntersectionObserver({
1342
+ animateOnce = false,
1343
+ options = {}
1344
+ } = {}) {
1345
+ const observeRef = React52.useRef(null);
1346
+ const [isVisible, setIsVisible] = React52.useState(false);
1347
+ if (typeof IntersectionObserver === "undefined") {
1348
+ console.warn("IntersectionObserver is not supported in this browser.");
1349
+ return { observeRef, isVisible: true };
1350
+ }
1351
+ React52.useEffect(() => {
1352
+ const currentRef = observeRef.current;
1353
+ if (!currentRef) return;
1354
+ const observer = new IntersectionObserver((entries) => {
1355
+ const entry = entries[0];
1356
+ if (!entry) return;
1357
+ setIsVisible(entry.isIntersecting);
1358
+ if (entry.isIntersecting && animateOnce) {
1359
+ observer.disconnect();
1360
+ }
1361
+ }, options);
1362
+ observer.observe(currentRef);
1363
+ return () => {
1364
+ observer.disconnect();
1365
+ };
1366
+ }, [observeRef, animateOnce, options]);
1367
+ return { observeRef, isVisible };
1368
+ }
1335
1369
 
1336
1370
  exports.Anchor = Anchor;
1337
1371
  exports.BrandsStrip = BrandsStrip;