@digital-b2c/coreui-kit 0.2.2 → 0.3.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 +79 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +90 -34
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +80 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx3 from 'clsx';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import React, { Children, isValidElement,
|
|
3
|
+
import React, { Children, isValidElement, useRef, useState, useEffect, useCallback } from 'react';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __defProps = Object.defineProperties;
|
|
@@ -821,16 +821,47 @@ var ContactModuleTitle = ({ children }) => {
|
|
|
821
821
|
var ContactModuleSubtitle = ({ children }) => {
|
|
822
822
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
823
823
|
};
|
|
824
|
+
function useIntersectionObserver({
|
|
825
|
+
animateOnce = false,
|
|
826
|
+
options = {}
|
|
827
|
+
} = {}) {
|
|
828
|
+
const observeRef = useRef(null);
|
|
829
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
830
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
831
|
+
console.warn("IntersectionObserver is not supported in this browser.");
|
|
832
|
+
return { observeRef, isVisible: true };
|
|
833
|
+
}
|
|
834
|
+
useEffect(() => {
|
|
835
|
+
const currentRef = observeRef.current;
|
|
836
|
+
if (!currentRef) return;
|
|
837
|
+
const observer = new IntersectionObserver((entries) => {
|
|
838
|
+
const entry = entries[0];
|
|
839
|
+
if (!entry) return;
|
|
840
|
+
setIsVisible(entry.isIntersecting);
|
|
841
|
+
if (entry.isIntersecting && animateOnce) {
|
|
842
|
+
observer.disconnect();
|
|
843
|
+
}
|
|
844
|
+
}, options);
|
|
845
|
+
observer.observe(currentRef);
|
|
846
|
+
return () => {
|
|
847
|
+
observer.disconnect();
|
|
848
|
+
};
|
|
849
|
+
}, [observeRef, animateOnce, options]);
|
|
850
|
+
return { observeRef, isVisible };
|
|
851
|
+
}
|
|
824
852
|
|
|
825
853
|
// src/widgets/ContactModule/ContactModule.module.scss
|
|
826
854
|
var ContactModule_module_default = {
|
|
827
855
|
"contact-module": "ContactModule_module_contact-module",
|
|
856
|
+
blur: "ContactModule_module_blur",
|
|
857
|
+
"blur--hidden": "ContactModule_module_blur--hidden",
|
|
828
858
|
container: "ContactModule_module_container",
|
|
829
859
|
wrapper: "ContactModule_module_wrapper",
|
|
830
860
|
content: "ContactModule_module_content",
|
|
831
861
|
"cta-wrapper": "ContactModule_module_cta-wrapper",
|
|
832
862
|
cta: "ContactModule_module_cta",
|
|
833
863
|
title: "ContactModule_module_title",
|
|
864
|
+
subtitle: "ContactModule_module_subtitle",
|
|
834
865
|
image: "ContactModule_module_image"
|
|
835
866
|
};
|
|
836
867
|
var ContactModule = ({
|
|
@@ -840,35 +871,51 @@ var ContactModule = ({
|
|
|
840
871
|
subtitle,
|
|
841
872
|
ctas,
|
|
842
873
|
image,
|
|
843
|
-
blurred
|
|
874
|
+
blurred = true,
|
|
875
|
+
animateBlur = true
|
|
844
876
|
}) => {
|
|
845
877
|
var _a, _b;
|
|
878
|
+
const { observeRef, isVisible } = useIntersectionObserver({
|
|
879
|
+
animateOnce: true,
|
|
880
|
+
options: { threshold: 0.8 }
|
|
881
|
+
});
|
|
846
882
|
const slots = resolveCompoundSlots(children, {
|
|
847
883
|
title: ContactModuleTitle,
|
|
848
884
|
subtitle: ContactModuleSubtitle
|
|
849
885
|
});
|
|
850
886
|
const titleNode = (_a = slots.title) != null ? _a : title;
|
|
851
887
|
const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
888
|
+
return /* @__PURE__ */ jsxs("div", { ref: observeRef, className: clsx3(ContactModule_module_default["contact-module"], className), children: [
|
|
889
|
+
/* @__PURE__ */ jsx(
|
|
890
|
+
"div",
|
|
891
|
+
{
|
|
892
|
+
className: clsx3({
|
|
893
|
+
[ContactModule_module_default.blur]: blurred,
|
|
894
|
+
[ContactModule_module_default["blur--hidden"]]: blurred && animateBlur && isVisible
|
|
895
|
+
})
|
|
896
|
+
}
|
|
897
|
+
),
|
|
898
|
+
/* @__PURE__ */ jsxs(Container, { className: ContactModule_module_default.container, children: [
|
|
899
|
+
/* @__PURE__ */ jsxs("div", { className: ContactModule_module_default.wrapper, children: [
|
|
900
|
+
/* @__PURE__ */ jsxs("div", { className: ContactModule_module_default.content, children: [
|
|
901
|
+
titleNode && /* @__PURE__ */ jsx("div", { className: clsx3(ContactModule_module_default.title, "h1"), children: titleNode }),
|
|
902
|
+
subtitleNode && /* @__PURE__ */ jsx("div", { className: clsx3(ContactModule_module_default.subtitle, "subheading"), children: subtitleNode })
|
|
903
|
+
] }),
|
|
904
|
+
/* @__PURE__ */ jsx("div", { className: ContactModule_module_default["cta-wrapper"], children: ctas == null ? void 0 : ctas.map((cta, key) => /* @__PURE__ */ jsx(
|
|
905
|
+
Button,
|
|
906
|
+
{
|
|
907
|
+
className: ContactModule_module_default.cta,
|
|
908
|
+
href: cta.url,
|
|
909
|
+
isExternal: cta.isExternal,
|
|
910
|
+
variant: key % 2 === 0 ? "secondary" : "primary",
|
|
911
|
+
children: cta.label
|
|
912
|
+
},
|
|
913
|
+
key
|
|
914
|
+
)) })
|
|
857
915
|
] }),
|
|
858
|
-
/* @__PURE__ */ jsx(
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
className: ContactModule_module_default.cta,
|
|
862
|
-
href: cta.url,
|
|
863
|
-
isExternal: cta.isExternal,
|
|
864
|
-
variant: key % 2 === 0 ? "secondary" : "primary",
|
|
865
|
-
children: cta.label
|
|
866
|
-
},
|
|
867
|
-
key
|
|
868
|
-
)) })
|
|
869
|
-
] }),
|
|
870
|
-
image && /* @__PURE__ */ jsx(Picture, __spreadValues({ className: ContactModule_module_default.image }, image))
|
|
871
|
-
] }) });
|
|
916
|
+
image && /* @__PURE__ */ jsx(Picture, __spreadValues({ className: ContactModule_module_default.image }, image))
|
|
917
|
+
] })
|
|
918
|
+
] });
|
|
872
919
|
};
|
|
873
920
|
|
|
874
921
|
// src/widgets/ContactModule/index.ts
|
|
@@ -1033,14 +1080,14 @@ var MiniSectionCtaSubtitle = ({ children }) => {
|
|
|
1033
1080
|
// src/widgets/MiniSectionCta/MiniSectionCta.module.scss
|
|
1034
1081
|
var MiniSectionCta_module_default = {
|
|
1035
1082
|
miniSectionCta: "MiniSectionCta_module_miniSectionCta",
|
|
1036
|
-
|
|
1083
|
+
wrapper: "MiniSectionCta_module_wrapper",
|
|
1037
1084
|
col: "MiniSectionCta_module_col",
|
|
1038
1085
|
BgColorBlack: "MiniSectionCta_module_BgColorBlack",
|
|
1039
1086
|
infoCallout: "MiniSectionCta_module_infoCallout",
|
|
1087
|
+
subtitle: "MiniSectionCta_module_subtitle",
|
|
1040
1088
|
miniTextCenterCta: "MiniSectionCta_module_miniTextCenterCta",
|
|
1041
1089
|
cta: "MiniSectionCta_module_cta",
|
|
1042
|
-
BgColorGrey: "MiniSectionCta_module_BgColorGrey"
|
|
1043
|
-
subtitle: "MiniSectionCta_module_subtitle"
|
|
1090
|
+
BgColorGrey: "MiniSectionCta_module_BgColorGrey"
|
|
1044
1091
|
};
|
|
1045
1092
|
var MiniSectionCta = ({
|
|
1046
1093
|
className,
|
|
@@ -1057,10 +1104,16 @@ var MiniSectionCta = ({
|
|
|
1057
1104
|
});
|
|
1058
1105
|
const titleNode = (_a = slots.title) != null ? _a : title;
|
|
1059
1106
|
const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
|
|
1060
|
-
return /* @__PURE__ */ jsx("div", { className: clsx3(MiniSectionCta_module_default.miniSectionCta, MiniSectionCta_module_default[variant], className), children: /* @__PURE__ */
|
|
1107
|
+
return /* @__PURE__ */ jsx("div", { className: clsx3(MiniSectionCta_module_default.miniSectionCta, MiniSectionCta_module_default[variant], className), children: /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsxs("div", { className: MiniSectionCta_module_default.wrapper, children: [
|
|
1061
1108
|
/* @__PURE__ */ jsxs("div", { className: MiniSectionCta_module_default.col, children: [
|
|
1062
1109
|
titleNode && /* @__PURE__ */ jsx("h2", { className: variant === "BgColorBlack" || variant === "BgColorGrey" ? "h3" : "h2", children: titleNode }),
|
|
1063
|
-
subtitleNode && /* @__PURE__ */ jsx(
|
|
1110
|
+
subtitleNode && /* @__PURE__ */ jsx(
|
|
1111
|
+
"div",
|
|
1112
|
+
{
|
|
1113
|
+
className: clsx3(MiniSectionCta_module_default.subtitle, variant === "infoCallout" ? "h4" : "subheading"),
|
|
1114
|
+
children: subtitleNode
|
|
1115
|
+
}
|
|
1116
|
+
)
|
|
1064
1117
|
] }),
|
|
1065
1118
|
cta && /* @__PURE__ */ jsx("div", { className: MiniSectionCta_module_default.col, children: /* @__PURE__ */ jsx(
|
|
1066
1119
|
Button,
|
|
@@ -1073,7 +1126,7 @@ var MiniSectionCta = ({
|
|
|
1073
1126
|
children: cta.label
|
|
1074
1127
|
}
|
|
1075
1128
|
) })
|
|
1076
|
-
] }) });
|
|
1129
|
+
] }) }) });
|
|
1077
1130
|
};
|
|
1078
1131
|
|
|
1079
1132
|
// src/widgets/MiniSectionCta/index.ts
|