@digital-b2c/coreui-kit 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/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import clsx3 from 'clsx';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import React52, { useRef, Children, isValidElement, useState, useCallback, useEffect } from 'react';
4
- import { gsap } from 'gsap';
5
- import { ScrollTrigger } from 'gsap/ScrollTrigger';
3
+ import React52, { forwardRef, Children, isValidElement, useRef, useState, useCallback, useEffect } from 'react';
4
+ import gsap$1, { gsap } from 'gsap';
6
5
  import { useGSAP } from '@gsap/react';
6
+ import { ScrollTrigger } from 'gsap/ScrollTrigger';
7
7
 
8
8
  var __defProp = Object.defineProperty;
9
9
  var __defProps = Object.defineProperties;
@@ -504,8 +504,7 @@ var BrandsStrip = ({
504
504
  const [show, setShow] = useState(false);
505
505
  const { is } = useViewPort_default();
506
506
  const isTabletBelow = is("tablet", "below");
507
- console.log(title);
508
- const shouldAnimate = title === void 0 && animate;
507
+ const shouldAnimate = title && animate;
509
508
  return /* @__PURE__ */ jsxs(
510
509
  "div",
511
510
  {
@@ -568,34 +567,39 @@ function resolveCompoundSlots(children, slots) {
568
567
 
569
568
  // src/components/Card/Card.module.scss
570
569
  var Card_module_default = {
571
- card: "Card_module_card"
572
- };
573
- var Card = ({ className, title, subtitle, cta, icon, children }) => {
574
- var _a, _b;
575
- const slots = resolveCompoundSlots(children, {
576
- title: CardTitle,
577
- subtitle: CardSubtitle
578
- });
579
- const titleNode = (_a = slots.title) != null ? _a : title;
580
- const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
581
- return /* @__PURE__ */ jsxs("div", { className: clsx3(Card_module_default.card, className), children: [
582
- icon && /* @__PURE__ */ jsx(Icon, { type: icon }),
583
- /* @__PURE__ */ jsxs("div", { className: Card_module_default.content, children: [
584
- titleNode && /* @__PURE__ */ jsx("h3", { className: "h4", children: titleNode }),
585
- subtitleNode && /* @__PURE__ */ jsx("p", { children: subtitleNode })
586
- ] }),
587
- cta && /* @__PURE__ */ jsx(
588
- Button,
589
- {
590
- href: cta.url,
591
- isExternal: cta.isExternal,
592
- variant: "secondary",
593
- icon: cta.url ? "rightBlack" : void 0,
594
- children: cta.label
595
- }
596
- )
597
- ] });
598
- };
570
+ card: "Card_module_card",
571
+ logo: "Card_module_logo",
572
+ subtitle: "Card_module_subtitle"
573
+ };
574
+ var Card = forwardRef(
575
+ ({ className, title, subtitle, cta, icon, logo, children }, ref) => {
576
+ var _a, _b;
577
+ const slots = resolveCompoundSlots(children, {
578
+ title: CardTitle,
579
+ subtitle: CardSubtitle
580
+ });
581
+ const titleNode = (_a = slots.title) != null ? _a : title;
582
+ const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
583
+ return /* @__PURE__ */ jsxs("div", { ref, className: clsx3(Card_module_default.card, className), children: [
584
+ (logo == null ? void 0 : logo.src) ? /* @__PURE__ */ jsx(Picture, __spreadValues({ className: Card_module_default.logo }, logo)) : icon && /* @__PURE__ */ jsx(Icon, { type: icon, className: Card_module_default.logo }),
585
+ /* @__PURE__ */ jsxs("div", { className: Card_module_default.content, children: [
586
+ titleNode && /* @__PURE__ */ jsx("h3", { className: "h4", children: titleNode }),
587
+ subtitleNode && /* @__PURE__ */ jsx("div", { className: Card_module_default.subtitle, children: subtitleNode })
588
+ ] }),
589
+ cta && /* @__PURE__ */ jsx(
590
+ Button,
591
+ {
592
+ href: cta.url,
593
+ isExternal: cta.isExternal,
594
+ variant: "secondary",
595
+ icon: cta.url ? "rightBlack" : void 0,
596
+ children: cta.label
597
+ }
598
+ )
599
+ ] });
600
+ }
601
+ );
602
+ Card.displayName = "Card";
599
603
 
600
604
  // src/components/Card/index.ts
601
605
  var Card2 = Object.assign(Card, {
@@ -761,10 +765,13 @@ var Pagination = ({
761
765
  var Container_module_default = {
762
766
  container: "Container_module_container"
763
767
  };
764
- var Container = (_a) => {
765
- var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
766
- return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ className: clsx3(Container_module_default.container, className) }, props), { children }));
767
- };
768
+ var Container = forwardRef(
769
+ (_a, ref) => {
770
+ var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
771
+ return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({ ref, className: clsx3(Container_module_default.container, className) }, props), { children }));
772
+ }
773
+ );
774
+ Container.displayName = "Container";
768
775
 
769
776
  // src/components/PracticeCard/PracticeCard.module.scss
770
777
  var PracticeCard_module_default = {
@@ -812,31 +819,94 @@ var CardCollection_module_default = {
812
819
  "card-collection": "CardCollection_module_card-collection",
813
820
  content: "CardCollection_module_content",
814
821
  wrapper: "CardCollection_module_wrapper",
822
+ cardWrapper: "CardCollection_module_cardWrapper",
815
823
  threeCols: "CardCollection_module_threeCols",
816
- examCard: "CardCollection_module_examCard"
824
+ examCard: "CardCollection_module_examCard",
825
+ "reveal-wrapper": "CardCollection_module_reveal-wrapper",
826
+ "reveal-inner": "CardCollection_module_reveal-inner",
827
+ card: "CardCollection_module_card",
828
+ "is-expanded": "CardCollection_module_is-expanded",
829
+ cta: "CardCollection_module_cta"
817
830
  };
818
831
  var CardCollection = ({
819
832
  className,
820
833
  variant = "default",
821
834
  title,
822
835
  subtitle,
823
- cards,
836
+ cards = [],
837
+ ctaLabel,
824
838
  children
825
839
  }) => {
826
840
  var _a, _b;
841
+ const container = useRef(null);
842
+ const revealWrapper = useRef(null);
843
+ const extraCard = useRef(null);
844
+ const [isExpanded, setIsExpanded] = useState(false);
827
845
  const slots = resolveCompoundSlots(children, {
828
846
  title: CardCollectionTitle,
829
847
  subtitle: CardCollectionSubtitle
830
848
  });
831
849
  const titleNode = (_a = slots.title) != null ? _a : title;
832
850
  const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
833
- return /* @__PURE__ */ jsxs(Container, { className: clsx3(CardCollection_module_default["card-collection"], CardCollection_module_default[variant], className), children: [
834
- /* @__PURE__ */ jsxs("div", { className: CardCollection_module_default.content, children: [
835
- titleNode && /* @__PURE__ */ jsx("h2", { children: titleNode }),
836
- subtitleNode && /* @__PURE__ */ jsx("div", { className: "subheading", children: subtitleNode })
837
- ] }),
838
- /* @__PURE__ */ jsx("div", { className: CardCollection_module_default.wrapper, children: cards == null ? void 0 : cards.map((card, key) => /* @__PURE__ */ jsx(Card2, __spreadValues({ className: CardCollection_module_default.card }, card), key)) })
839
- ] });
851
+ const isExamCard = variant === "examCard";
852
+ const visibleCards = isExamCard ? cards.slice(0, 8) : cards;
853
+ const hiddenCards = isExamCard ? cards.slice(8) : [];
854
+ const { contextSafe } = useGSAP({ scope: container });
855
+ const handleShowMore = useCallback(() => {
856
+ contextSafe(() => {
857
+ setIsExpanded(true);
858
+ const tl = gsap$1.timeline({ defaults: { ease: "power3.inOut" } });
859
+ tl.to(`.${CardCollection_module_default.cta}`, {
860
+ opacity: 0,
861
+ y: 20,
862
+ duration: 0.3,
863
+ display: "none"
864
+ }).to(`.${CardCollection_module_default.cardWrapper}`, { height: "auto", duration: 0.2 }, "<").to(
865
+ revealWrapper.current,
866
+ {
867
+ height: "auto",
868
+ duration: 0.3
869
+ },
870
+ "-=0.1"
871
+ ).from(
872
+ extraCard.current,
873
+ {
874
+ opacity: 0,
875
+ y: 30,
876
+ duration: 0.3,
877
+ clearProps: "all"
878
+ },
879
+ "-=0.3"
880
+ );
881
+ })();
882
+ }, [contextSafe]);
883
+ return /* @__PURE__ */ jsxs(
884
+ Container,
885
+ {
886
+ ref: container,
887
+ className: clsx3(CardCollection_module_default["card-collection"], CardCollection_module_default[variant], className),
888
+ children: [
889
+ /* @__PURE__ */ jsxs("div", { className: CardCollection_module_default.content, children: [
890
+ titleNode && /* @__PURE__ */ jsx("h2", { children: titleNode }),
891
+ subtitleNode && /* @__PURE__ */ jsx("div", { className: "subheading", children: subtitleNode })
892
+ ] }),
893
+ /* @__PURE__ */ jsx("div", { className: CardCollection_module_default.wrapper, children: /* @__PURE__ */ jsxs("div", { className: clsx3(CardCollection_module_default.cardWrapper, { [CardCollection_module_default["is-expanded"]]: isExpanded }), children: [
894
+ visibleCards.map((card, key) => /* @__PURE__ */ jsx(Card2, __spreadValues({ className: CardCollection_module_default.card }, card), key)),
895
+ isExamCard && hiddenCards.length > 0 && /* @__PURE__ */ jsx("div", { ref: revealWrapper, className: CardCollection_module_default["reveal-wrapper"], children: /* @__PURE__ */ jsx("div", { className: CardCollection_module_default["reveal-inner"], children: hiddenCards.map((card, key) => /* @__PURE__ */ jsx(Card2, __spreadValues({ ref: extraCard, className: CardCollection_module_default.card }, card), key)) }) }),
896
+ isExamCard && !isExpanded && ctaLabel && /* @__PURE__ */ jsx(
897
+ Button,
898
+ {
899
+ variant: "secondary",
900
+ icon: "downChevronBlack",
901
+ className: CardCollection_module_default.cta,
902
+ onClick: handleShowMore,
903
+ children: ctaLabel
904
+ }
905
+ )
906
+ ] }) })
907
+ ]
908
+ }
909
+ );
840
910
  };
841
911
 
842
912
  // src/widgets/CardCollection/index.ts
@@ -953,6 +1023,75 @@ var ContactModule2 = Object.assign(ContactModule, {
953
1023
  Title: ContactModuleTitle,
954
1024
  Subtitle: ContactModuleSubtitle
955
1025
  });
1026
+ var FooterDisclaimer = ({ children }) => {
1027
+ return /* @__PURE__ */ jsx(Fragment, { children });
1028
+ };
1029
+
1030
+ // src/widgets/Footer/Footer.module.scss
1031
+ var Footer_module_default = {
1032
+ footer: "Footer_module_footer",
1033
+ container: "Footer_module_container",
1034
+ bottom: "Footer_module_bottom",
1035
+ "bottom-left": "Footer_module_bottom-left",
1036
+ "bottom-right": "Footer_module_bottom-right",
1037
+ supporters: "Footer_module_supporters",
1038
+ "supporters-logos": "Footer_module_supporters-logos",
1039
+ "supporter-link-primary": "Footer_module_supporter-link-primary",
1040
+ "supporter-link": "Footer_module_supporter-link",
1041
+ disclaimer: "Footer_module_disclaimer",
1042
+ copyright: "Footer_module_copyright",
1043
+ "nav-list": "Footer_module_nav-list",
1044
+ "nav-link": "Footer_module_nav-link"
1045
+ };
1046
+ var Footer = ({
1047
+ className,
1048
+ supporters = [],
1049
+ navigationLinks = [],
1050
+ disclaimer,
1051
+ copyright,
1052
+ children
1053
+ }) => {
1054
+ var _a;
1055
+ const columns = [];
1056
+ for (let i = 0; i < navigationLinks.length; i += 5) {
1057
+ columns.push(navigationLinks.slice(i, i + 5));
1058
+ }
1059
+ const slots = resolveCompoundSlots(children, {
1060
+ disclaimer: FooterDisclaimer
1061
+ });
1062
+ const titleNode = (_a = slots.disclaimer) != null ? _a : disclaimer;
1063
+ return /* @__PURE__ */ jsx("footer", { className: clsx3(Footer_module_default.footer, className), children: /* @__PURE__ */ jsxs(Container, { className: Footer_module_default.container, children: [
1064
+ /* @__PURE__ */ jsxs("div", { className: Footer_module_default.bottom, children: [
1065
+ /* @__PURE__ */ jsxs("div", { className: Footer_module_default["bottom-left"], children: [
1066
+ supporters.length > 0 && /* @__PURE__ */ jsx("div", { className: Footer_module_default.supporters, children: /* @__PURE__ */ jsx("div", { className: Footer_module_default["supporters-logos"], children: supporters.map(
1067
+ (supporter, index) => supporter.href ? /* @__PURE__ */ jsx(
1068
+ "a",
1069
+ {
1070
+ href: supporter.href,
1071
+ target: "_blank",
1072
+ rel: "noopener noreferrer",
1073
+ className: Footer_module_default["supporter-link"],
1074
+ children: /* @__PURE__ */ jsx(Picture, __spreadValues({}, supporter.image))
1075
+ },
1076
+ index
1077
+ ) : /* @__PURE__ */ jsx("div", { className: Footer_module_default["supporter-link-primary"], children: /* @__PURE__ */ jsx(Picture, __spreadValues({}, supporter.image)) }, index)
1078
+ ) }) }),
1079
+ titleNode && /* @__PURE__ */ jsx("div", { className: clsx3(Footer_module_default.disclaimer, "p"), children: titleNode }),
1080
+ copyright && /* @__PURE__ */ jsx("p", { className: Footer_module_default.copyright, children: copyright })
1081
+ ] }),
1082
+ columns.length > 0 && /* @__PURE__ */ jsx("nav", { className: Footer_module_default["bottom-right"], children: columns.map((column, colIndex) => /* @__PURE__ */ jsx("ul", { className: Footer_module_default["nav-list"], children: column.map((link) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
1083
+ "a",
1084
+ __spreadProps(__spreadValues({
1085
+ href: link.href,
1086
+ className: Footer_module_default["nav-link"]
1087
+ }, link.isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {}), {
1088
+ children: link.label
1089
+ })
1090
+ ) }, link.label)) }, colIndex)) })
1091
+ ] }),
1092
+ children
1093
+ ] }) });
1094
+ };
956
1095
  var HeroBannerTitle = ({ children }) => {
957
1096
  return /* @__PURE__ */ jsx(Fragment, { children });
958
1097
  };
@@ -1360,6 +1499,6 @@ function useIntersectionObserver({
1360
1499
  return { observeRef, isVisible };
1361
1500
  }
1362
1501
 
1363
- export { Anchor, BrandsStrip, Button, Card2 as Card, CardCollection2 as CardCollection, ConditionalWrapper, ContactModule2 as ContactModule, Container, CountingCard2 as CountingCard, HeroBanner2 as HeroBanner, Icon, InfoCard2 as InfoCard, MiniBanner2 as MiniBanner, MiniSectionCta2 as MiniSectionCta, Pagination, Picture, PracticeCard, PracticePathCards2 as PracticePathCards, Teaser5050With3Text2 as Teaser5050With3Text, Teaser5050WithCta2 as Teaser5050WithCta, resolveCompoundSlots, svgs, useIntersectionObserver };
1502
+ export { Anchor, BrandsStrip, Button, Card2 as Card, CardCollection2 as CardCollection, ConditionalWrapper, ContactModule2 as ContactModule, Container, CountingCard2 as CountingCard, Footer, HeroBanner2 as HeroBanner, Icon, InfoCard2 as InfoCard, MiniBanner2 as MiniBanner, MiniSectionCta2 as MiniSectionCta, Pagination, Picture, PracticeCard, PracticePathCards2 as PracticePathCards, Teaser5050With3Text2 as Teaser5050With3Text, Teaser5050WithCta2 as Teaser5050WithCta, resolveCompoundSlots, svgs, useIntersectionObserver };
1364
1503
  //# sourceMappingURL=index.mjs.map
1365
1504
  //# sourceMappingURL=index.mjs.map