@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/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Luxottica
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luxottica
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,52 +1,52 @@
1
- # CoreUI Kit
2
-
3
- A React‑based design system and component library.
4
-
5
- ## 🚀 Getting Started
6
-
7
- Install
8
-
9
- ```bash
10
- npm install
11
- ```
12
-
13
- Development
14
-
15
- - Run the build in watch mode
16
-
17
- ```bash
18
- npm run dev
19
- ```
20
-
21
- Start Storybook
22
-
23
- ```bash
24
- npm run storybook
25
- ```
26
-
27
- Run tests
28
-
29
- ```bash
30
- npm test
31
- ```
32
-
33
- Lint/format
34
-
35
- ```bash
36
- npm run lint
37
- ```
38
-
39
- ## 🛠️ Usage
40
-
41
- Import components in other projects:
42
-
43
- ```ts
44
- import '@digital-b2c/coreui-kit/styles.css'
45
-
46
- import { MiniSectionCta } from '@digital-b2c/coreui-kit'
47
-
48
- <MiniSectionCta>
49
- <MiniSectionCta.Title>Header</MiniSectionCta.Title>
50
- <MiniSectionCta.Subtitle>Description</MiniSectionCta.Subtitle>
51
- </MiniSectionCta>
52
- ```
1
+ # CoreUI Kit
2
+
3
+ A React‑based design system and component library.
4
+
5
+ ## 🚀 Getting Started
6
+
7
+ Install
8
+
9
+ ```bash
10
+ npm install
11
+ ```
12
+
13
+ Development
14
+
15
+ - Run the build in watch mode
16
+
17
+ ```bash
18
+ npm run dev
19
+ ```
20
+
21
+ Start Storybook
22
+
23
+ ```bash
24
+ npm run storybook
25
+ ```
26
+
27
+ Run tests
28
+
29
+ ```bash
30
+ npm test
31
+ ```
32
+
33
+ Lint/format
34
+
35
+ ```bash
36
+ npm run lint
37
+ ```
38
+
39
+ ## 🛠️ Usage
40
+
41
+ Import components in other projects:
42
+
43
+ ```ts
44
+ import '@digital-b2c/coreui-kit/styles.css'
45
+
46
+ import { MiniSectionCta } from '@digital-b2c/coreui-kit'
47
+
48
+ <MiniSectionCta>
49
+ <MiniSectionCta.Title>Header</MiniSectionCta.Title>
50
+ <MiniSectionCta.Subtitle>Description</MiniSectionCta.Subtitle>
51
+ </MiniSectionCta>
52
+ ```
package/dist/index.cjs CHANGED
@@ -4,13 +4,14 @@ var clsx3 = require('clsx');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React52 = require('react');
6
6
  var gsap = require('gsap');
7
- var ScrollTrigger = require('gsap/ScrollTrigger');
8
7
  var react = require('@gsap/react');
8
+ var ScrollTrigger = require('gsap/ScrollTrigger');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
12
12
  var clsx3__default = /*#__PURE__*/_interopDefault(clsx3);
13
13
  var React52__default = /*#__PURE__*/_interopDefault(React52);
14
+ var gsap__default = /*#__PURE__*/_interopDefault(gsap);
14
15
 
15
16
  var __defProp = Object.defineProperty;
16
17
  var __defProps = Object.defineProperties;
@@ -511,8 +512,7 @@ var BrandsStrip = ({
511
512
  const [show, setShow] = React52.useState(false);
512
513
  const { is } = useViewPort_default();
513
514
  const isTabletBelow = is("tablet", "below");
514
- console.log(title);
515
- const shouldAnimate = title === void 0 && animate;
515
+ const shouldAnimate = title && animate;
516
516
  return /* @__PURE__ */ jsxRuntime.jsxs(
517
517
  "div",
518
518
  {
@@ -575,34 +575,39 @@ function resolveCompoundSlots(children, slots) {
575
575
 
576
576
  // src/components/Card/Card.module.scss
577
577
  var Card_module_default = {
578
- card: "Card_module_card"
579
- };
580
- var Card = ({ className, title, subtitle, cta, icon, children }) => {
581
- var _a, _b;
582
- const slots = resolveCompoundSlots(children, {
583
- title: CardTitle,
584
- subtitle: CardSubtitle
585
- });
586
- const titleNode = (_a = slots.title) != null ? _a : title;
587
- const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
588
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx3__default.default(Card_module_default.card, className), children: [
589
- icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: icon }),
590
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Card_module_default.content, children: [
591
- titleNode && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "h4", children: titleNode }),
592
- subtitleNode && /* @__PURE__ */ jsxRuntime.jsx("p", { children: subtitleNode })
593
- ] }),
594
- cta && /* @__PURE__ */ jsxRuntime.jsx(
595
- Button,
596
- {
597
- href: cta.url,
598
- isExternal: cta.isExternal,
599
- variant: "secondary",
600
- icon: cta.url ? "rightBlack" : void 0,
601
- children: cta.label
602
- }
603
- )
604
- ] });
605
- };
578
+ card: "Card_module_card",
579
+ logo: "Card_module_logo",
580
+ subtitle: "Card_module_subtitle"
581
+ };
582
+ var Card = React52.forwardRef(
583
+ ({ className, title, subtitle, cta, icon, logo, children }, ref) => {
584
+ var _a, _b;
585
+ const slots = resolveCompoundSlots(children, {
586
+ title: CardTitle,
587
+ subtitle: CardSubtitle
588
+ });
589
+ const titleNode = (_a = slots.title) != null ? _a : title;
590
+ const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
591
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: clsx3__default.default(Card_module_default.card, className), children: [
592
+ (logo == null ? void 0 : logo.src) ? /* @__PURE__ */ jsxRuntime.jsx(Picture, __spreadValues({ className: Card_module_default.logo }, logo)) : icon && /* @__PURE__ */ jsxRuntime.jsx(Icon, { type: icon, className: Card_module_default.logo }),
593
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Card_module_default.content, children: [
594
+ titleNode && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "h4", children: titleNode }),
595
+ subtitleNode && /* @__PURE__ */ jsxRuntime.jsx("div", { className: Card_module_default.subtitle, children: subtitleNode })
596
+ ] }),
597
+ cta && /* @__PURE__ */ jsxRuntime.jsx(
598
+ Button,
599
+ {
600
+ href: cta.url,
601
+ isExternal: cta.isExternal,
602
+ variant: "secondary",
603
+ icon: cta.url ? "rightBlack" : void 0,
604
+ children: cta.label
605
+ }
606
+ )
607
+ ] });
608
+ }
609
+ );
610
+ Card.displayName = "Card";
606
611
 
607
612
  // src/components/Card/index.ts
608
613
  var Card2 = Object.assign(Card, {
@@ -768,10 +773,13 @@ var Pagination = ({
768
773
  var Container_module_default = {
769
774
  container: "Container_module_container"
770
775
  };
771
- var Container = (_a) => {
772
- var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
773
- return /* @__PURE__ */ jsxRuntime.jsx("div", __spreadProps(__spreadValues({ className: clsx3__default.default(Container_module_default.container, className) }, props), { children }));
774
- };
776
+ var Container = React52.forwardRef(
777
+ (_a, ref) => {
778
+ var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
779
+ return /* @__PURE__ */ jsxRuntime.jsx("div", __spreadProps(__spreadValues({ ref, className: clsx3__default.default(Container_module_default.container, className) }, props), { children }));
780
+ }
781
+ );
782
+ Container.displayName = "Container";
775
783
 
776
784
  // src/components/PracticeCard/PracticeCard.module.scss
777
785
  var PracticeCard_module_default = {
@@ -819,31 +827,94 @@ var CardCollection_module_default = {
819
827
  "card-collection": "CardCollection_module_card-collection",
820
828
  content: "CardCollection_module_content",
821
829
  wrapper: "CardCollection_module_wrapper",
830
+ cardWrapper: "CardCollection_module_cardWrapper",
822
831
  threeCols: "CardCollection_module_threeCols",
823
- examCard: "CardCollection_module_examCard"
832
+ examCard: "CardCollection_module_examCard",
833
+ "reveal-wrapper": "CardCollection_module_reveal-wrapper",
834
+ "reveal-inner": "CardCollection_module_reveal-inner",
835
+ card: "CardCollection_module_card",
836
+ "is-expanded": "CardCollection_module_is-expanded",
837
+ cta: "CardCollection_module_cta"
824
838
  };
825
839
  var CardCollection = ({
826
840
  className,
827
841
  variant = "default",
828
842
  title,
829
843
  subtitle,
830
- cards,
844
+ cards = [],
845
+ ctaLabel,
831
846
  children
832
847
  }) => {
833
848
  var _a, _b;
849
+ const container = React52.useRef(null);
850
+ const revealWrapper = React52.useRef(null);
851
+ const extraCard = React52.useRef(null);
852
+ const [isExpanded, setIsExpanded] = React52.useState(false);
834
853
  const slots = resolveCompoundSlots(children, {
835
854
  title: CardCollectionTitle,
836
855
  subtitle: CardCollectionSubtitle
837
856
  });
838
857
  const titleNode = (_a = slots.title) != null ? _a : title;
839
858
  const subtitleNode = (_b = slots.subtitle) != null ? _b : subtitle;
840
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { className: clsx3__default.default(CardCollection_module_default["card-collection"], CardCollection_module_default[variant], className), children: [
841
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: CardCollection_module_default.content, children: [
842
- titleNode && /* @__PURE__ */ jsxRuntime.jsx("h2", { children: titleNode }),
843
- subtitleNode && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "subheading", children: subtitleNode })
844
- ] }),
845
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: CardCollection_module_default.wrapper, children: cards == null ? void 0 : cards.map((card, key) => /* @__PURE__ */ jsxRuntime.jsx(Card2, __spreadValues({ className: CardCollection_module_default.card }, card), key)) })
846
- ] });
859
+ const isExamCard = variant === "examCard";
860
+ const visibleCards = isExamCard ? cards.slice(0, 8) : cards;
861
+ const hiddenCards = isExamCard ? cards.slice(8) : [];
862
+ const { contextSafe } = react.useGSAP({ scope: container });
863
+ const handleShowMore = React52.useCallback(() => {
864
+ contextSafe(() => {
865
+ setIsExpanded(true);
866
+ const tl = gsap__default.default.timeline({ defaults: { ease: "power3.inOut" } });
867
+ tl.to(`.${CardCollection_module_default.cta}`, {
868
+ opacity: 0,
869
+ y: 20,
870
+ duration: 0.3,
871
+ display: "none"
872
+ }).to(`.${CardCollection_module_default.cardWrapper}`, { height: "auto", duration: 0.2 }, "<").to(
873
+ revealWrapper.current,
874
+ {
875
+ height: "auto",
876
+ duration: 0.3
877
+ },
878
+ "-=0.1"
879
+ ).from(
880
+ extraCard.current,
881
+ {
882
+ opacity: 0,
883
+ y: 30,
884
+ duration: 0.3,
885
+ clearProps: "all"
886
+ },
887
+ "-=0.3"
888
+ );
889
+ })();
890
+ }, [contextSafe]);
891
+ return /* @__PURE__ */ jsxRuntime.jsxs(
892
+ Container,
893
+ {
894
+ ref: container,
895
+ className: clsx3__default.default(CardCollection_module_default["card-collection"], CardCollection_module_default[variant], className),
896
+ children: [
897
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: CardCollection_module_default.content, children: [
898
+ titleNode && /* @__PURE__ */ jsxRuntime.jsx("h2", { children: titleNode }),
899
+ subtitleNode && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "subheading", children: subtitleNode })
900
+ ] }),
901
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: CardCollection_module_default.wrapper, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx3__default.default(CardCollection_module_default.cardWrapper, { [CardCollection_module_default["is-expanded"]]: isExpanded }), children: [
902
+ visibleCards.map((card, key) => /* @__PURE__ */ jsxRuntime.jsx(Card2, __spreadValues({ className: CardCollection_module_default.card }, card), key)),
903
+ isExamCard && hiddenCards.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: revealWrapper, className: CardCollection_module_default["reveal-wrapper"], children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: CardCollection_module_default["reveal-inner"], children: hiddenCards.map((card, key) => /* @__PURE__ */ jsxRuntime.jsx(Card2, __spreadValues({ ref: extraCard, className: CardCollection_module_default.card }, card), key)) }) }),
904
+ isExamCard && !isExpanded && ctaLabel && /* @__PURE__ */ jsxRuntime.jsx(
905
+ Button,
906
+ {
907
+ variant: "secondary",
908
+ icon: "downChevronBlack",
909
+ className: CardCollection_module_default.cta,
910
+ onClick: handleShowMore,
911
+ children: ctaLabel
912
+ }
913
+ )
914
+ ] }) })
915
+ ]
916
+ }
917
+ );
847
918
  };
848
919
 
849
920
  // src/widgets/CardCollection/index.ts
@@ -960,6 +1031,75 @@ var ContactModule2 = Object.assign(ContactModule, {
960
1031
  Title: ContactModuleTitle,
961
1032
  Subtitle: ContactModuleSubtitle
962
1033
  });
1034
+ var FooterDisclaimer = ({ children }) => {
1035
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
1036
+ };
1037
+
1038
+ // src/widgets/Footer/Footer.module.scss
1039
+ var Footer_module_default = {
1040
+ footer: "Footer_module_footer",
1041
+ container: "Footer_module_container",
1042
+ bottom: "Footer_module_bottom",
1043
+ "bottom-left": "Footer_module_bottom-left",
1044
+ "bottom-right": "Footer_module_bottom-right",
1045
+ supporters: "Footer_module_supporters",
1046
+ "supporters-logos": "Footer_module_supporters-logos",
1047
+ "supporter-link-primary": "Footer_module_supporter-link-primary",
1048
+ "supporter-link": "Footer_module_supporter-link",
1049
+ disclaimer: "Footer_module_disclaimer",
1050
+ copyright: "Footer_module_copyright",
1051
+ "nav-list": "Footer_module_nav-list",
1052
+ "nav-link": "Footer_module_nav-link"
1053
+ };
1054
+ var Footer = ({
1055
+ className,
1056
+ supporters = [],
1057
+ navigationLinks = [],
1058
+ disclaimer,
1059
+ copyright,
1060
+ children
1061
+ }) => {
1062
+ var _a;
1063
+ const columns = [];
1064
+ for (let i = 0; i < navigationLinks.length; i += 5) {
1065
+ columns.push(navigationLinks.slice(i, i + 5));
1066
+ }
1067
+ const slots = resolveCompoundSlots(children, {
1068
+ disclaimer: FooterDisclaimer
1069
+ });
1070
+ const titleNode = (_a = slots.disclaimer) != null ? _a : disclaimer;
1071
+ return /* @__PURE__ */ jsxRuntime.jsx("footer", { className: clsx3__default.default(Footer_module_default.footer, className), children: /* @__PURE__ */ jsxRuntime.jsxs(Container, { className: Footer_module_default.container, children: [
1072
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Footer_module_default.bottom, children: [
1073
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Footer_module_default["bottom-left"], children: [
1074
+ supporters.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: Footer_module_default.supporters, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: Footer_module_default["supporters-logos"], children: supporters.map(
1075
+ (supporter, index) => supporter.href ? /* @__PURE__ */ jsxRuntime.jsx(
1076
+ "a",
1077
+ {
1078
+ href: supporter.href,
1079
+ target: "_blank",
1080
+ rel: "noopener noreferrer",
1081
+ className: Footer_module_default["supporter-link"],
1082
+ children: /* @__PURE__ */ jsxRuntime.jsx(Picture, __spreadValues({}, supporter.image))
1083
+ },
1084
+ index
1085
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: Footer_module_default["supporter-link-primary"], children: /* @__PURE__ */ jsxRuntime.jsx(Picture, __spreadValues({}, supporter.image)) }, index)
1086
+ ) }) }),
1087
+ titleNode && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx3__default.default(Footer_module_default.disclaimer, "p"), children: titleNode }),
1088
+ copyright && /* @__PURE__ */ jsxRuntime.jsx("p", { className: Footer_module_default.copyright, children: copyright })
1089
+ ] }),
1090
+ columns.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("nav", { className: Footer_module_default["bottom-right"], children: columns.map((column, colIndex) => /* @__PURE__ */ jsxRuntime.jsx("ul", { className: Footer_module_default["nav-list"], children: column.map((link) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
1091
+ "a",
1092
+ __spreadProps(__spreadValues({
1093
+ href: link.href,
1094
+ className: Footer_module_default["nav-link"]
1095
+ }, link.isExternal ? { target: "_blank", rel: "noopener noreferrer" } : {}), {
1096
+ children: link.label
1097
+ })
1098
+ ) }, link.label)) }, colIndex)) })
1099
+ ] }),
1100
+ children
1101
+ ] }) });
1102
+ };
963
1103
  var HeroBannerTitle = ({ children }) => {
964
1104
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
965
1105
  };
@@ -1376,6 +1516,7 @@ exports.ConditionalWrapper = ConditionalWrapper;
1376
1516
  exports.ContactModule = ContactModule2;
1377
1517
  exports.Container = Container;
1378
1518
  exports.CountingCard = CountingCard2;
1519
+ exports.Footer = Footer;
1379
1520
  exports.HeroBanner = HeroBanner2;
1380
1521
  exports.Icon = Icon;
1381
1522
  exports.InfoCard = InfoCard2;